Source for file Regexp.php

Documentation is available at Regexp.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  Regexp.php
  5.  *
  6.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id: d345ea5d519fa9329d8f3e431424fdb1bf114a50 $
  10.  */
  11.  
  12. // {{{ Ethna_Plugin_Validator_Regexp
  13. /**
  14.  *  正規表現によるバリデータプラグイン
  15.  *
  16.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  17.  *  @access     public
  18.  *  @package    Ethna
  19.  */
  20. {
  21.     /** @var    bool    配列を受け取るかフラグ */
  22.     public $accept_array = false;
  23.  
  24.     /**
  25.      *  正規表現によるフォーム値のチェックを行う
  26.      *
  27.      *  @access public
  28.      *  @param  string  $name       フォームの名前
  29.      *  @param  mixed   $var        フォームの値
  30.      *  @param  array   $params     プラグインのパラメータ
  31.      */
  32.     public function validate($name$var$params)
  33.     {
  34.         $true true;
  35.         $type $this->getFormType($name);
  36.         if (isset($params['regexp']== false
  37.             || $type == VAR_TYPE_FILE || $this->isEmpty($var$type)) {
  38.             return $true;
  39.         }
  40.  
  41.         if (preg_match($params['regexp']$var== 0{
  42.             if (isset($params['error'])) {
  43.                 $msg $params['error'];
  44.             else {
  45.                 $msg _et('Please input {form} properly.');
  46.             }
  47.             return Ethna::raiseNotice($msgE_FORM_REGEXP);
  48.         }
  49.  
  50.         return $true;
  51.     }
  52. }
  53. // }}}

Documentation generated on Fri, 11 Nov 2011 03:58:59 +0900 by phpDocumentor 1.4.3