Code Igniter
Adalah framework PHP yang sangat enteng dan berguna banyak.
language/Japanese
calendar_lang.php
<?php $lang['cal_su'] = "<font color='red'>?</font>"; $lang['cal_mo'] = "?"; $lang['cal_tu'] = "?"; $lang['cal_we'] = "?"; $lang['cal_th'] = "?"; $lang['cal_fr'] = "?"; $lang['cal_sa'] = "?"; $lang['cal_sun'] = "<font color='red'>?</font>"; $lang['cal_mon'] = "?"; $lang['cal_tue'] = "?"; $lang['cal_wed'] = "?"; $lang['cal_thu'] = "?"; $lang['cal_fri'] = "?"; $lang['cal_sat'] = "?"; $lang['cal_sunday'] = "<font color='red'>???</font>"; $lang['cal_monday'] = "???"; $lang['cal_tuesday'] = "???"; $lang['cal_wednesday'] = "???"; $lang['cal_thursday'] = "???"; $lang['cal_friday'] = "???"; $lang['cal_saturday'] = "???"; $lang['cal_jan'] = "1?"; $lang['cal_feb'] = "2?"; $lang['cal_mar'] = "3?"; $lang['cal_apr'] = "4?"; $lang['cal_may'] = "5?"; $lang['cal_jun'] = "6?"; $lang['cal_jul'] = "7?"; $lang['cal_aug'] = "8?"; $lang['cal_sep'] = "9?"; $lang['cal_oct'] = "10?"; $lang['cal_nov'] = "11?"; $lang['cal_dec'] = "12?"; $lang['cal_january'] = "1?"; $lang['cal_february'] = "2?"; $lang['cal_march'] = "3?"; $lang['cal_april'] = "4?"; $lang['cal_mayl'] = "5?"; $lang['cal_june'] = "6?"; $lang['cal_july'] = "7?"; $lang['cal_august'] = "8?"; $lang['cal_september'] = "9?"; $lang['cal_october'] = "10?"; $lang['cal_november'] = "11?"; $lang['cal_december'] = "12?"; ?>
validation_lang.php
<?php $lang['required'] = "?%s?????????"; $lang['isset'] = "?%s???????????"; $lang['valid_email'] = "?%s??????????????????????"; $lang['valid_url'] = "?%s?????URL?????????."; $lang['min_length'] = "?%s????%s????????????"; $lang['max_length'] = "?%s????%s????????????"; $lang['exact_length'] = "?%s??%s????????????"; $lang['alpha'] = "?%s?????????????????"; $lang['alpha_numeric'] = "?%s?????????????????"; $lang['alpha_dash'] = "?%s?????????????(_)??????????(-)??????????????"; $lang['numeric'] = "?%s????????????????"; $lang['matches'] = "?%s??????%s???????????????????"; ?>
Libraries
wikipedia.php – Module untuk mendapatkan kejadian2 apa yang terjadi pada tahun X. Hanya bekerja untuk wikipedia Jepang. Masih mempunyai beberapa bug untuk tahun 2004 keatas.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /** * * Wikipedia read engine service for Jibunshi * */ class Wikipedia { var $server = "http://ja.wikipedia.org/w/index.php"; // Wiki edit var $wikiHome = "http://ja.wikipedia.org/wiki/"; // Wiki view var $CI; var $debug = FALSE; function Wikipedia() { $this->CI =& get_instance(); } function getDekiGotoDb($year) { $sql = "SELECT html FROM nyanya WHERE year = ?"; $result = $this->CI->db->query($sql , $year); if ($result->num_rows() > 0) { return $result->row()->html; } else { return $this->getDekiGoto($year); } } function getDekiGoto($year) { $var['title'] = $year . "?"; $var['action'] = 'edit'; // Above 2004 , ????? section is moved to 3 if ($year >= 2004) $var['section'] = '3'; else $var['section'] = '2'; $response = $this->doREST($this->server , $var); // Get the text from <textarea> box if (preg_match("/<textarea[^>]*> *== *???? *== *(.+)<\/textarea>/sm" , $response , $textarea)) { $textarea = $textarea[1]; $textarea = $this->wikiToHtml($textarea); $textarea = $this->deletePicture($textarea); $textarea = $this->wikiLinkConvert($textarea); strip_tags($textarea); } else { $textarea = "Now Printing"; } if ($this->debug) { echo "<pure>"; var_dump($textarea); echo "</pure>"; } return $textarea; } function wikiToHtml($bunsyo) { $lines = explode("\n" , $bunsyo); foreach($lines as $key => $line) { if (trim ($line) != "") { // *[[7?27?]] $patterns[0] = '/\* ?\[\[([^-]+?[^-]+?)\]\] ?-? *$/'; $replacements[0] = '<h3>$1</h3>'; // *[[2?]] - [[???????|????]][[??????]]?????14????????????? $patterns[1] = '/\* ?\[\[([^-]+?)\]\] ?-? ?(.+)/'; $replacements[1] = '<h3>$1</h3> <p>$2</p>'; // *[[1?5?]] - [[????|????]]??????? $patterns[2] = '/\* ?\[\[([^-]+?[^-]+?)\]\] ?-? ?(.+)/'; $replacements[2] = '<h3>$1</h3> <p>$2</p>'; // *5?31? - [[2002 FIFA???????]]????[[??]]?[[????|??]]????????? $patterns[3] = '/\* ?([^-]+?[^-]+?) ?-? ?(.+)/'; $replacements[3] = '<p>$2</p>'; // *8? - [[?????]]????[[?????]]???[[?????]]???? $patterns[4] = '/\* ?([^-]+?) ?-? ?(.+)/'; $replacements[4] = '<h3>$1</h3> <p>$2</p>'; // **????????[[????]]????????????????????????????????????????????? $patterns[5] = '/^ ?\*\* ?(.+)/'; $replacements[5] = '<p>$1</p>'; // *[[????]]?[[PHS]]??????????? $patterns[6] = '/^ ?\* ?(.+)/'; $replacements[6] = '<p>$1</p>'; // === [[1?]] === $patterns[6] = '/=== ?\[\[\d+?\]\] ?===/'; $replacements[6] = ''; $lines[$key] = preg_replace($patterns , $replacements, $line); } } return implode("\n", $lines); } function deletePicture($bunsyo) { $patterns[7] = '/{{[^}]+}}/sm'; $replacements[7] = ''; return preg_replace($patterns , $replacements, $bunsyo); } function wikiLinkConvert($bunsyo) { $patterns[0] = '/\[\[([^\]]+)\|([^\]]*)\]\]/'; $patterns[1] = '/\[\[([^\]]+)\]\]/'; $replacements[0] = '<a href="' . $this->wikiHome . '$2">$1</a>'; $replacements[1] = '<a href="' . $this->wikiHome . '$1">$1</a>'; return preg_replace($patterns , $replacements, $bunsyo); } function HTTPPost($data , $url , $referer) { $ch = curl_init(); $proxy = getOneProxy(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Set supaya return value nya ke string curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_POST, 1); // curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0); // curl_setopt($ch, CURLOPT_PROXY, $proxy); // echo "Using proxy $proxy\n"; curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $retval = curl_exec($ch); // echo $retval; curl_close($ch); } function HTTPGet($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Set supaya return value nya ke string curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_REFERER, ""); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); $retval = curl_exec($ch); return $retval; curl_close($ch); } function doREST($url, $params) { if ($params) { foreach($params as $key => $param) { $_par[] = "$key=" . urlencode($param); } $_complete = "?"; $_complete .= implode("&" , $_par); } return $this->HTTPGet($url . $_complete); } } ?>
MY_Email.php – Ini adalah overwrite dari module email aslinya CodeIgniter. CodeIgniter punya sistem email aslinya ada bug kalo ngirim email Jepang, terutama SJIS dan EUC. Dengan sistem yang ini mao kirim pake SJIS, EUC, UTF-8 pun bisa tanpa ada masalah.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class MY_Email extends CI_Email { var $mailtype = "html"; var $wordwrap = FALSE; function My_Email() { parent::CI_Email(); } /** * Build alternative plain text message * * This function provides the raw message for use * in plain-text headers of HTML-formatted emails. * If the user hasn't specified his own alternative message * it creates one by stripping the HTML * * @access private * @return string */ function _get_alt_message() { if ($this->alt_message != "") { /* * Modified by rickyok * Purpose: When you word_wrap the ISO-2022-jp, you cannot wrap * because it will cause the message to ???? * Time: 2007/11/05 12:49:51 **/ return $this->alt_message; } if (eregi( '\<body(.*)\</body\>', $this->_body, $match)) { $body = $match['1']; $body = substr($body, strpos($body, ">") + 1); } else { $body = $this->_body; } $body = trim(strip_tags($body)); $body = preg_replace( '#<!--(.*)--\>#', "", $body); $body = str_replace("\t", "", $body); for ($i = 20; $i >= 3; $i--) { $n = ""; for ($x = 1; $x <= $i; $x ++) $n .= "\n"; $body = str_replace($n, "\n\n", $body); } return $body; } /** * Set Body * * @access public * @param string * @return void */ function message($body) { $this->_body = rtrim(str_replace("\r", "", $body)); } // -------------------------------------------------------------------- /** * Build Final Body and attachments * * @access public * @return void */ function _build_message() { if ($this->wordwrap === TRUE AND $this->mailtype != 'html') { $this->_body = $this->word_wrap($this->_body); } $this->_set_boundaries(); $this->_write_headers(); $hdr = ($this->_get_protocol() == 'mail') ? $this->newline : ''; switch ($this->_get_content_type()) { case 'plain' : $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding(); if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $this->_finalbody = $this->_body; return; } $hdr .= $this->newline . $this->newline . $this->_body; $this->_finalbody = $hdr; return; break; case 'html' : $hdr .= "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline; $hdr .= $this->_get_mime_message() . $this->newline . $this->newline; $hdr .= "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline; $hdr .= mb_convert_encoding(mb_convert_kana($this->_get_alt_message(), "KVa"), $this->charset) . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: quoted/printable"; $this->_body = mb_convert_encoding(mb_convert_kana($this->_body, "KVa"), $this->charset); if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $this->_finalbody = $this->_body . $this->newline . $this->newline . "--" . $this->_alt_boundary . "--"; return; } $hdr .= $this->newline . $this->newline; $hdr .= $this->_body . $this->newline . $this->newline . "--" . $this->_alt_boundary . "--"; $this->_finalbody = $hdr; return; break; case 'plain-attach' : $hdr .= "Content-Type: multipart/".$this->multipart."; boundary=\"" . $this->_atc_boundary."\"" . $this->newline; $hdr .= $this->_get_mime_message() . $this->newline . $this->newline; $hdr .= "--" . $this->_atc_boundary . $this->newline; $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding(); if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $body = $this->_body . $this->newline . $this->newline; } $hdr .= $this->newline . $this->newline; $hdr .= $this->_body . $this->newline . $this->newline; break; case 'html-attach' : $hdr .= "Content-Type: multipart/".$this->multipart."; boundary=\"" . $this->_atc_boundary."\"" . $this->newline; $hdr .= $this->_get_mime_message() . $this->newline . $this->newline; $hdr .= "--" . $this->_atc_boundary . $this->newline; $hdr .= "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline .$this->newline; $hdr .= "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline; $hdr .= $this->_get_alt_message() . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: quoted/printable"; if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $body = $this->_body . $this->newline . $this->newline; $body .= "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline; } $hdr .= $this->newline . $this->newline; $hdr .= $this->_body . $this->newline . $this->newline; $hdr .= "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline; break; } $attachment = array(); $z = 0; for ($i=0; $i < count($this->_attach_name); $i++) { $filename = $this->_attach_name[$i]; $basename = basename($filename); $ctype = $this->_attach_type[$i]; if ( ! file_exists($filename)) { $this->_set_error_message('email_attachment_missing', $filename); return FALSE; } $h = "--".$this->_atc_boundary.$this->newline; $h .= "Content-type: ".$ctype."; "; $h .= "name=\"".$basename."\"".$this->newline; $h .= "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline; $h .= "Content-Transfer-Encoding: base64".$this->newline; $attachment[$z++] = $h; $file = filesize($filename) +1; if ( ! $fp = fopen($filename, 'r')) { $this->_set_error_message('email_attachment_unredable', $filename); return FALSE; } $attachment[$z++] = chunk_split(base64_encode(fread($fp, $file))); fclose($fp); } if ($this->_get_protocol() == 'mail') { $this->_finalbody = $body . implode($this->newline, $attachment).$this->newline."--".$this->_atc_boundary."--"; return; } $this->_finalbody = $hdr.implode($this->newline, $attachment).$this->newline."--".$this->_atc_boundary."--"; return; } // -------------------------------------------------------------------- /** * Set Email Subject * * @access public * @param string * @return void */ function subject($subject) { $subject = preg_replace("/(\r\n)|(\r)|(\n)/", "", $subject); $subject = preg_replace("/(\t)/", " ", $subject); $subject = mb_convert_kana($subject, "KVa"); $subject = mb_encode_mimeheader($subject, $this->charset); $this->_set_header('Subject', trim($subject)); } // -------------------------------------------------------------------- /** * Set FROM * * @access public * @param string * @param string * @return void */ function from($from, $name = '') { $name = mb_convert_kana($name, "KVa"); $name = mb_encode_mimeheader($name, $this->charset); if (preg_match( '/\<(.*)\>/', $from, $match)) $from = $match['1']; if ($this->validate) $this->validate_email($this->_str_to_array($from)); if ($name != '' && substr($name, 0, 1) != '"') { $name = '"'.$name.'"'; } $this->_set_header('From', $name.' <'.$from.'>'); $this->_set_header('Return-Path', '<'.$from.'>'); } // -------------------------------------------------------------------- } ?>
session.php – Gantiin dari original CI punya buat pake session nya PHP. Bukan gue yang bikin
Tapi karena susah nyarinya, taro dulu ach di sini.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class MY_Email extends CI_Email { var $mailtype = "html"; var $wordwrap = FALSE; function My_Email() { parent::CI_Email(); } /** * Build alternative plain text message * * This function provides the raw message for use * in plain-text headers of HTML-formatted emails. * If the user hasn't specified his own alternative message * it creates one by stripping the HTML * * @access private * @return string */ function _get_alt_message() { if ($this->alt_message != "") { /* * Modified by rickyok * Purpose: When you word_wrap the ISO-2022-jp, you cannot wrap * because it will cause the message to ???? * Time: 2007/11/05 12:49:51 **/ return $this->alt_message; } if (eregi( '\<body(.*)\</body\>', $this->_body, $match)) { $body = $match['1']; $body = substr($body, strpos($body, ">") + 1); } else { $body = $this->_body; } $body = trim(strip_tags($body)); $body = preg_replace( '#<!--(.*)--\>#', "", $body); $body = str_replace("\t", "", $body); for ($i = 20; $i >= 3; $i--) { $n = ""; for ($x = 1; $x <= $i; $x ++) $n .= "\n"; $body = str_replace($n, "\n\n", $body); } return $body; } /** * Set Body * * @access public * @param string * @return void */ function message($body) { $this->_body = rtrim(str_replace("\r", "", $body)); } // -------------------------------------------------------------------- /** * Build Final Body and attachments * * @access public * @return void */ function _build_message() { if ($this->wordwrap === TRUE AND $this->mailtype != 'html') { $this->_body = $this->word_wrap($this->_body); } $this->_set_boundaries(); $this->_write_headers(); $hdr = ($this->_get_protocol() == 'mail') ? $this->newline : ''; switch ($this->_get_content_type()) { case 'plain' : $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding(); if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $this->_finalbody = $this->_body; return; } $hdr .= $this->newline . $this->newline . $this->_body; $this->_finalbody = $hdr; return; break; case 'html' : $hdr .= "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline; $hdr .= $this->_get_mime_message() . $this->newline . $this->newline; $hdr .= "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline; $hdr .= mb_convert_encoding(mb_convert_kana($this->_get_alt_message(), "KVa"), $this->charset) . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: quoted/printable"; $this->_body = mb_convert_encoding(mb_convert_kana($this->_body, "KVa"), $this->charset); if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $this->_finalbody = $this->_body . $this->newline . $this->newline . "--" . $this->_alt_boundary . "--"; return; } $hdr .= $this->newline . $this->newline; $hdr .= $this->_body . $this->newline . $this->newline . "--" . $this->_alt_boundary . "--"; $this->_finalbody = $hdr; return; break; case 'plain-attach' : $hdr .= "Content-Type: multipart/".$this->multipart."; boundary=\"" . $this->_atc_boundary."\"" . $this->newline; $hdr .= $this->_get_mime_message() . $this->newline . $this->newline; $hdr .= "--" . $this->_atc_boundary . $this->newline; $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding(); if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $body = $this->_body . $this->newline . $this->newline; } $hdr .= $this->newline . $this->newline; $hdr .= $this->_body . $this->newline . $this->newline; break; case 'html-attach' : $hdr .= "Content-Type: multipart/".$this->multipart."; boundary=\"" . $this->_atc_boundary."\"" . $this->newline; $hdr .= $this->_get_mime_message() . $this->newline . $this->newline; $hdr .= "--" . $this->_atc_boundary . $this->newline; $hdr .= "Content-Type: multipart/alternative; boundary=\"" . $this->_alt_boundary . "\"" . $this->newline .$this->newline; $hdr .= "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/plain; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: " . $this->_get_encoding() . $this->newline . $this->newline; $hdr .= $this->_get_alt_message() . $this->newline . $this->newline . "--" . $this->_alt_boundary . $this->newline; $hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline; $hdr .= "Content-Transfer-Encoding: quoted/printable"; if ($this->_get_protocol() == 'mail') { $this->_header_str .= $hdr; $body = $this->_body . $this->newline . $this->newline; $body .= "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline; } $hdr .= $this->newline . $this->newline; $hdr .= $this->_body . $this->newline . $this->newline; $hdr .= "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline; break; } $attachment = array(); $z = 0; for ($i=0; $i < count($this->_attach_name); $i++) { $filename = $this->_attach_name[$i]; $basename = basename($filename); $ctype = $this->_attach_type[$i]; if ( ! file_exists($filename)) { $this->_set_error_message('email_attachment_missing', $filename); return FALSE; } $h = "--".$this->_atc_boundary.$this->newline; $h .= "Content-type: ".$ctype."; "; $h .= "name=\"".$basename."\"".$this->newline; $h .= "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline; $h .= "Content-Transfer-Encoding: base64".$this->newline; $attachment[$z++] = $h; $file = filesize($filename) +1; if ( ! $fp = fopen($filename, 'r')) { $this->_set_error_message('email_attachment_unredable', $filename); return FALSE; } $attachment[$z++] = chunk_split(base64_encode(fread($fp, $file))); fclose($fp); } if ($this->_get_protocol() == 'mail') { $this->_finalbody = $body . implode($this->newline, $attachment).$this->newline."--".$this->_atc_boundary."--"; return; } $this->_finalbody = $hdr.implode($this->newline, $attachment).$this->newline."--".$this->_atc_boundary."--"; return; } // -------------------------------------------------------------------- /** * Set Email Subject * * @access public * @param string * @return void */ function subject($subject) { $subject = preg_replace("/(\r\n)|(\r)|(\n)/", "", $subject); $subject = preg_replace("/(\t)/", " ", $subject); $subject = mb_convert_kana($subject, "KVa"); $subject = mb_encode_mimeheader($subject, $this->charset); $this->_set_header('Subject', trim($subject)); } // -------------------------------------------------------------------- /** * Set FROM * * @access public * @param string * @param string * @return void */ function from($from, $name = '') { $name = mb_convert_kana($name, "KVa"); $name = mb_encode_mimeheader($name, $this->charset); if (preg_match( '/\<(.*)\>/', $from, $match)) $from = $match['1']; if ($this->validate) $this->validate_email($this->_str_to_array($from)); if ($name != '' && substr($name, 0, 1) != '"') { $name = '"'.$name.'"'; } $this->_set_header('From', $name.' <'.$from.'>'); $this->_set_header('Return-Path', '<'.$from.'>'); } // -------------------------------------------------------------------- } ?>
My_Validation.php – Sedikit hack buat menjalankan fungsi2 yang sering gue pake.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class MY_Validation extends CI_Validation { function MY_Validation() { parent::CI_Validation(); } function katakana($text) { // Convert to ?? $text = mb_convert_kana($text , 'KVC'); $_POST[$this->_current_field] = $text; return mb_ereg("^[?-??-??-???????-??-??-??-??-???]+$",$text); } // -------------------------------------------------------------------- /** * Set Select * * Enables pull-down lists to be set to the value the user * selected in the event of an error * * @access public * @param string * @param string * @return string */ function set_select($field = '', $value = '') { if ($field == '' OR $value == '' OR ! isset($this->$field)) { return ''; } if ($this->$field == $value) { return ' selected="selected"'; } } // -------------------------------------------------------------------- /** * Set Radio * * Enables radio buttons to be set to the value the user * selected in the event of an error * * @access public * @param string * @param string * @return string */ function set_radio($field = '', $value = '') { if ($field == '' OR $value == '' OR ! isset($this->$field)) { return ''; } if ($this->$field == $value) { return ' checked="checked"'; } } // -------------------------------------------------------------------- /** * Set Checkbox * * Enables checkboxes to be set to the value the user * selected in the event of an error * * @access public * @param string * @param string * @return string */ function set_checkbox($field = '', $value = '') { if ($field == '' OR $value == '' OR ! isset($this->$field)) { return ''; } if ($this->$field == $value) { return ' checked="checked"'; } } } ?>