Source for file Ethna_Plugin_Validator_Mbregexp.php

Documentation is available at Ethna_Plugin_Validator_Mbregexp.php

  1. <?php
  2. // {{{ Ethna_Plugin_Validator_Mbegexp
  3. /**
  4.  *  マルチバイト対応正規表現によるバリデータプラグイン
  5.  *
  6.  *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
  7.  *  @access     public
  8.  *  @package    Ethna
  9.  */
  10. {
  11.     /** @var    bool    配列を受け取るかフラグ */
  12.     var $accept_array = false;
  13.  
  14.     /**
  15.      *  正規表現によるフォーム値のチェックを行う(マルチバイト対応)
  16.      *
  17.      *  @access public
  18.      *  @param  string  $name       フォームの名前
  19.      *  @param  mixed   $var        フォームの値
  20.      *  @param  array   $params     プラグインのパラメータ
  21.      */
  22.     function &validate($name$var$params)
  23.     {
  24.         $true true;
  25.         $type $this->getFormType($name);
  26.         if (isset($params['mbregexp']== false
  27.             || $type == VAR_TYPE_FILE || $this->isEmpty($var$type)) {
  28.             return $true;
  29.         }
  30.  
  31.         $encoding (isset($params['encoding']))
  32.                   ? $params['encoding']
  33.                   : 'EUC-JP';
  34.         mb_regex_encoding($encoding);
  35.  
  36.         if (mb_ereg($params['mbregexp']$var!== 1{
  37.             if (isset($params['error'])) {
  38.                 $msg $params['error'];
  39.             else {
  40.                 $msg "{form}を正しく入力してください";
  41.             }
  42.             return Ethna::raiseNotice($msgE_FORM_REGEXP);
  43.         }
  44.  
  45.         return $true;
  46.     }
  47. }
  48. // }}}
  49. ?>

Documentation generated on Thu, 08 May 2008 00:15:22 +0900 by phpDocumentor 1.4.2