Source for file Custom.php

Documentation is available at Custom.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  Custom.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: 7663a3c29060e8cac88af9815b279c1521445744 $
  10.  */
  11.  
  12. // {{{ Ethna_Plugin_Validator_Custom
  13. /**
  14.  *  customバリデータのラッパープラグイン
  15.  *
  16.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  17.  *  @access     public
  18.  *  @package    Ethna
  19.  */
  20. {
  21.     /** @var    bool    配列を受け取るかフラグ */
  22.     public $accept_array = true;
  23.  
  24.     /**
  25.      *  customバリデータのラッパー
  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.         $false false;
  36.  
  37.         $method_list preg_split('/\s*,\s*/'$params['custom']-1PREG_SPLIT_NO_EMPTY);
  38.         if (is_array($method_list== false{
  39.             return $true;
  40.         }
  41.  
  42.         foreach ($method_list as $method{
  43.             if (method_exists($this->af$method)) {
  44.                 $ret $this->af->$method($name);
  45.                 if (Ethna::isError($ret)) {
  46.                     // このエラーはすでに af::checkSomething() で ae::add()
  47.                     // してある
  48.                     return $false;
  49.                 }
  50.             }
  51.         }
  52.  
  53.         return $true;
  54.     }
  55. }
  56. // }}}

Documentation generated on Fri, 11 Nov 2011 03:57:56 +0900 by phpDocumentor 1.4.3