• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Ethna类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Ethna的典型用法代码示例。如果您正苦于以下问题:PHP Ethna类的具体用法?PHP Ethna怎么用?PHP Ethna使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Ethna类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: perform

 /**
  *  add view
  *
  *  @access public
  */
 function perform()
 {
     $r =& $this->_getopt(array('basedir=', 'skelfile=', 'template'));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // view_name
     $view_name = array_shift($arg_list);
     if ($view_name == null) {
         return Ethna::raiseError('view name isn\'t set.', 'usage');
     }
     $r =& Ethna_Controller::checkViewName($view_name);
     if (Ethna::isError($r)) {
         return $r;
     }
     // add view
     $ret =& $this->_perform('View', $view_name, $opt_list);
     if (Ethna::isError($ret) || $ret === false) {
         return $ret;
     }
     // add template
     if (isset($opt_list['template'])) {
         $ret =& $this->_perform('Template', $view_name, $opt_list);
         if (Ethna::isError($ret) || $ret === false) {
             return $ret;
         }
     }
     return true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:35,代码来源:Ethna_Plugin_Handle_AddView.php


示例2: perform

 /**
  *  @access public
  */
 function perform()
 {
     $args =& $this->_parseArgList();
     if (Ethna::isError($args)) {
         return $args;
     }
     $pear =& new Ethna_PearWrapper();
     if (isset($args['pearopt'])) {
         $pear->setPearOpt($args['pearopt']);
     }
     $target = isset($args['target']) ? $args['target'] : null;
     $channel = isset($args['channel']) ? $args['channel'] : null;
     $basedir = isset($args['basedir']) ? realpath($args['basedir']) : getcwd();
     $r =& $pear->init($target, $basedir, $channel);
     if (Ethna::isError($r)) {
         return $r;
     }
     $r =& $pear->doClearCache();
     if (Ethna::isError($r)) {
         return $r;
     }
     $r =& $pear->doChannelUpdate();
     if (Ethna::isError($r)) {
         return $r;
     }
     return true;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:30,代码来源:Ethna_Plugin_Handle_ChannelUpdate.php


示例3: realpath

 /**
  *  @access protected
  */
 function &_perform($target, $target_name, $opt_list)
 {
     // basedir
     if (isset($opt_list['basedir'])) {
         $basedir = realpath(end($opt_list['basedir']));
     } else {
         $basedir = getcwd();
     }
     // skelfile
     if (isset($opt_list['skelfile'])) {
         $skelfile = end($opt_list['skelfile']);
     } else {
         $skelfile = null;
     }
     // gateway
     if (isset($opt_list['gateway'])) {
         $gateway = 'GATEWAY_' . strtoupper(end($opt_list['gateway']));
         if (defined($gateway)) {
             $gateway = constant($gateway);
         } else {
             return Ethna::raiseError('unknown gateway', 'usage');
         }
     } else {
         $gateway = GATEWAY_WWW;
     }
     $r =& Ethna_Generator::generate($target, $basedir, $target_name, $skelfile, $gateway);
     if (Ethna::isError($r)) {
         printf("error occurred while generating skelton. please see also following error message(s)\n\n");
         return $r;
     }
     $true = true;
     return $true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:36,代码来源:Ethna_Plugin_Handle_AddAction.php


示例4: CommitTransaction

 /**
  * commitTransaction
  * トランザクションを終了し、全ての変更をコミットする
  *
  * @return 成功時:true 失敗時:false
  */
 public function CommitTransaction()
 {
     if (Ethna::isError($this->db->commit())) {
         return false;
     }
     return true;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:13,代码来源:SQLBaseLibrary.class.php


示例5: perform

 /**
  *  show help
  *
  *  @access public
  */
 function perform()
 {
     $r = $this->_getopt();
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // action_name
     $handle_name = array_shift($arg_list);
     if (!strlen($handle_name)) {
         $handler_list = $this->eh->getHandlerList();
         printf("usage: ethna [option] [command] [args...]\n\n");
         printf("available options are as follows:\n\n");
         printf("  -v, --version    show version and exit\n");
         printf("\navailable commands are as follows:\n\n");
         foreach ($handler_list as $handler) {
             printf("  %s\n", $handler->getId());
         }
         return true;
     }
     // getHandler
     $handler = $this->eh->getHandler($handle_name);
     if (Ethna::isError($handler) || $handler === false) {
         // command not found
         return Ethna::raiseError('command not found.', 'usage');
     }
     echo $handler->getDescription();
     return true;
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:34,代码来源:Help.php


示例6: perform

 /**
  *  ビューを出力する
  *
  *  @param  string  $template   テンプレート名
  *  @param  bool    $capture    true ならば出力を表示せずに返す
  *
  *  @access public
  */
 function perform($template = null, $capture = false)
 {
     if ($template === null && $this->template === null) {
         return Ethna::raiseWarning('template is not defined');
     }
     if ($template !== null) {
         $this->template = $template;
     }
     if (!is_absolute_path($this->template)) {
         $this->template = sprintf('%s%s', $this->template_dir, $this->template);
     }
     if (is_readable($this->template)) {
         ob_start();
         include $this->template;
         $captured = ob_get_contents();
         ob_end_clean();
         if ($capture === true) {
             return $captured;
         } else {
             echo $captured;
         }
     } else {
         return Ethna::raiseWarning('template not found ' . $this->template);
     }
 }
开发者ID:hiro1173,项目名称:legacy,代码行数:33,代码来源:Hdinstaller_Renderer_Php.php


示例7: _perform

 /**
  *  @access protected
  */
 function _perform($target)
 {
     $r =& $this->_getopt(array('basedir='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // table_name
     $table_name = array_shift($arg_list);
     if ($table_name == null) {
         return Ethna::raiseError('table name isn\'t set.', 'usage');
     }
     // basedir
     if (isset($opt_list['basedir'])) {
         $basedir = realpath(end($opt_list['basedir']));
     } else {
         $basedir = getcwd();
     }
     $r =& Ethna_Generator::generate($target, $basedir, $table_name);
     if (Ethna::isError($r)) {
         printf("error occurred while generating skelton. please see also following error message(s)\n\n");
         return $r;
     }
     return true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:28,代码来源:Ethna_Plugin_Handle_AddAppObject.php


示例8: validate

 /**
  *  最小値のチェックを行う
  *
  *  @access public
  *  @param  string  $name       フォームの名前
  *  @param  mixed   $var        フォームの値
  *  @param  array   $params     プラグインのパラメータ
  */
 public function validate($name, $var, $params)
 {
     $true = true;
     $type = $this->getFormType($name);
     if (isset($params['min']) == false || $this->isEmpty($var, $type)) {
         return $true;
     }
     switch ($type) {
         case VAR_TYPE_INT:
             if ($var < $params['min']) {
                 if (isset($params['error'])) {
                     $msg = $params['error'];
                 } else {
                     $msg = _et('Please input more than %d(int) to {form}.');
                 }
                 return Ethna::raiseNotice($msg, E_FORM_MIN_INT, array($params['min']));
             }
             break;
         case VAR_TYPE_FLOAT:
             if ($var < $params['min']) {
                 if (isset($params['error'])) {
                     $msg = $params['error'];
                 } else {
                     $msg = _et('Please input more than %f(float) to {form}.');
                 }
                 return Ethna::raiseNotice($msg, E_FORM_MIN_FLOAT, array($params['min']));
             }
             break;
         case VAR_TYPE_DATETIME:
             $t_min = strtotime($params['min']);
             $t_var = strtotime($var);
             if ($t_var < $t_min) {
                 if (isset($params['error'])) {
                     $msg = $params['error'];
                 } else {
                     $msg = _et('Please input datetime value %s or later to {form}.');
                 }
                 return Ethna::raiseNotice($msg, E_FORM_MIN_DATETIME, array($params['min']));
             }
             break;
         case VAR_TYPE_FILE:
             $st = stat($var['tmp_name']);
             if ($st[7] < $params['min'] * 1024) {
                 if (isset($params['error'])) {
                     $msg = $params['error'];
                 } else {
                     $msg = _et('Please specify file whose size is more than %d KB.');
                 }
                 return Ethna::raiseNotice($msg, E_FORM_MIN_FILE, array($params['min']));
             }
             break;
         case VAR_TYPE_STRING:
             $params['mbstrmin'] = $params['min'];
             unset($params['min']);
             $vld = $this->plugin->getPlugin('Validator', 'Mbstrmin');
             return $vld->validate($name, $var, $params);
             break;
     }
     return $true;
 }
开发者ID:dqneo,项目名称:ethnam,代码行数:68,代码来源:Min.php


示例9: perform

 /**
  *  @access public
  */
 function perform()
 {
     $args =& $this->_parseArgList();
     if (Ethna::isError($args)) {
         return $args;
     }
     $pear =& new Ethna_PearWrapper();
     if (isset($args['pearopt'])) {
         $pear->setPearOpt($args['pearopt']);
     }
     if (isset($args['type']) && isset($args['name'])) {
         $target = isset($args['target']) ? $args['target'] : null;
         $channel = isset($args['channel']) ? $args['channel'] : null;
         $basedir = isset($args['basedir']) ? realpath($args['basedir']) : getcwd();
         if ($target == 'master') {
             $pkg_name = sprintf('Ethna_Plugin_%s_%s', $args['type'], $args['name']);
         } else {
             $pkg_name = sprintf('App_Plugin_%s_%s', $args['type'], $args['name']);
         }
         $r =& $pear->init($target, $basedir, $channel);
         if (Ethna::isError($r)) {
             return $r;
         }
         $r =& $pear->doInfo($pkg_name);
         if (Ethna::isError($r)) {
             return $r;
         }
     } else {
         return Ethna::raiseError('invalid arguments', 'usage');
     }
     return true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:35,代码来源:Ethna_Plugin_Handle_InfoPlugin.php


示例10: perform

 /**
  *  add project:)
  *
  *  @access public
  */
 function perform()
 {
     $r = $this->_getopt(array('basedir='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // app_id
     $app_id = array_shift($arg_list);
     if ($app_id == null) {
         return Ethna::raiseError('project id isn\'t set.', 'usage');
     }
     $r = Ethna_Controller::checkAppId($app_id);
     if (Ethna::isError($r)) {
         return $r;
     }
     // basedir
     if (isset($opt_list['basedir'])) {
         $basedir = realpath(end($opt_list['basedir']));
     } else {
         $basedir = getcwd();
     }
     $r = Ethna_Generator::generate('Project', null, $app_id, $basedir);
     if (Ethna::isError($r)) {
         printf("error occurred while generating skelton. please see also error messages given above\n\n");
         return $r;
     }
     printf("\nproject skelton for [%s] is successfully generated at [%s]\n\n", $app_id, $basedir);
     return true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:35,代码来源:Ethna_Plugin_Handle_AddProject.php


示例11: test_cmd_option

 function test_cmd_option()
 {
     //    unrecognized option
     $r = $this->proj->runCmd('add-template', array('-k'));
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('unrecognized option -k', $r->getMessage());
     //    skel requires an argument
     $r = $this->proj->runCmd('add-template', array('-s'));
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('option -s requires an argument', $r->getMessage());
     $r = $this->proj->runCmd('add-template', array('--skelfile'));
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('option --skelfile requires an argument', $r->getMessage());
     //    locale requires an argument
     $r = $this->proj->runCmd('add-template', array('-l'));
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('option -l requires an argument', $r->getMessage());
     $r = $this->proj->runCmd('add-template', array('--locale'));
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('option --locale requires an argument', $r->getMessage());
     //    template name isn't set
     $r = $this->proj->runCmd('add-template', array());
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('template name isn\'t set.', $r->getMessage());
     //    invalid locale
     $r = $this->proj->runCmd('add-template', array('-l', 'invalid::locale', 'test'));
     $this->assertTrue(Ethna::isError($r));
     $this->assertEqual('You specified locale, but invalid : invalid::locale', $r->getMessage());
     //    normal command exexute
     $r = $this->proj->runCmd('add-template', array('-l', 'ja_JP', 'test'));
     $this->assertFalse(Ethna::isError($r));
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:32,代码来源:Ethna_Plugin_Handle_AddTemplate_Test.php


示例12: preforward

 function preforward()
 {
     $item_manager = $this->backend->getManager('Item');
     $filter = array('price' => new Ethna_AppSearchObject(0, OBJECT_CONDITION_GE));
     $order = array('price' => OBJECT_SORT_DESC);
     $offset = 0;
     $count = 10;
     $object_list_result = $item_manager->getObjectList('Item', $filter, $order, $offset, $count);
     if (Ethna::isError($object_list_result)) {
         $this->ae->addObject(null, $object_list_result);
         return;
     }
     $item_list = array();
     foreach ($object_list_result[1] as $item_object) {
         if ($item_object->get('type') == ITEM_TYPE_BEER) {
             $type_name = 'ビール';
         } else {
             if ($item_object->get('type') == ITEM_TYPE_SNACK) {
                 $type_name = 'お菓子';
             }
         }
         $item_tmp = $item_object->getNameObject();
         $item_tmp['type_name'] = $type_name;
         $item_list[] = $item_tmp;
     }
     $this->af->setApp('item_list', $item_list);
     $this->session->start();
     // omajinai
     $user_object = $this->backend->getObject('User', 'id', $this->session->get('id'));
     if ($user_object->isValid()) {
         $this->af->setApp('user', $user_object->getNameObject());
     }
 }
开发者ID:nulltask,项目名称:sampleshop,代码行数:33,代码来源:Shop.php


示例13: perform

 /**
  *  add action entry point
  *
  *  @access public
  */
 function perform()
 {
     $r = $this->_getopt(array('basedir=', 'skelfile=', 'gateway='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // action_name
     $action_name = array_shift($arg_list);
     if ($action_name == null) {
         return Ethna::raiseError('action name isn\'t set.', 'usage');
     }
     $r = Ethna_Controller::checkActionName($action_name);
     if (Ethna::isError($r)) {
         return $r;
     }
     // add entry point
     $ret = $this->_perform('EntryPoint', $action_name, $opt_list);
     if (Ethna::isError($ret) || $ret === false) {
         return $ret;
     }
     // add action (no effects if already exists.)
     $ret = $this->_perform('Action', $action_name, $opt_list);
     if (Ethna::isError($ret) || $ret === false) {
         return $ret;
     }
     return true;
 }
开发者ID:ethna,项目名称:ethna-cli,代码行数:33,代码来源:AddEntryPoint.php


示例14: Ethna_Error

 /**
  *	Ethna_Errorクラスのコンストラクタ
  *
  *	@access	public
  *	@param	int		$level				エラーレベル
  *	@param	string	$message			エラーメッセージ
  *	@param	int		$code				エラーコード
  *	@param	array	$userinfo			エラー追加情報(エラーコード以降の全ての引数)
  */
 function Ethna_Error($message = null, $code = null, $mode = null, $options = null)
 {
     $controller =& Ethna_Controller::getInstance();
     if ($controller !== null) {
         $this->i18n =& $controller->getI18N();
     }
     // $options以降の引数->$userinfo
     if (func_num_args() > 4) {
         $userinfo = array_slice(func_get_args(), 4);
         if (count($userinfo) == 1) {
             if (is_array($userinfo[0])) {
                 $userinfo = $userinfo[0];
             } else {
                 if (is_null($userinfo[0])) {
                     $userinfo = array();
                 }
             }
         }
     } else {
         $userinfo = array();
     }
     // メッセージ補正処理
     if (is_null($message)) {
         // $codeからメッセージを取得する
         $message = $controller->getErrorMessage($code);
         if (is_null($message)) {
             $message = 'unkown error';
         }
     }
     parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
     // Ethnaフレームワークのエラーハンドラ(PEAR_Errorのコールバックとは異なる)
     Ethna::handleError($this);
 }
开发者ID:BackupTheBerlios,项目名称:delphinus-svn,代码行数:42,代码来源:Ethna_Error.php


示例15: func_get_args

 /**
  *  スケルトンを削除する
  *
  *  @access public
  *  @param  string  $type       生成する対象
  *  @param  string  $app_dir    アプリケーションのディレクトリ
  *                              (nullのときはアプリケーションを特定しない)
  *  @param  mixed   residue     プラグインのremove()にそのまま渡す
  *  @static
  */
 function &remove()
 {
     $arg_list = func_get_args();
     $type = array_shift($arg_list);
     $app_dir = array_shift($arg_list);
     if ($app_dir === null) {
         $ctl =& Ethna_Handle::getEthnaController();
     } else {
         $ctl =& Ethna_Handle::getAppController($app_dir);
     }
     if (Ethna::isError($ctl)) {
         return $ctl;
     }
     $plugin_manager =& $ctl->getPlugin();
     if (Ethna::isError($plugin_manager)) {
         return $plugin_manager;
     }
     $generator =& $plugin_manager->getPlugin('Generator', $type);
     if (Ethna::isError($generator)) {
         return $generator;
     }
     // 引数はプラグイン依存とする
     $ret = call_user_func_array(array(&$generator, 'remove'), $arg_list);
     return $ret;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:35,代码来源:Ethna_Generator.php


示例16: perform

 /**
  * @access public
  */
 function perform()
 {
     $r = $this->_getopt(array('basedir=', 'type=', 'plugin-package'));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     //  plugin name
     $plugin_name = array_shift($arg_list);
     if (empty($plugin_name)) {
         return Ethna::raiseError('Please specify plugin Name.', 'usage');
     }
     //  plugin types
     $type = end($opt_list['type']);
     $types = explode(',', $type);
     if (empty($type)) {
         $types = array('v', 'f', 'sm');
         // Validator, Filter, Smarty modifier.
     }
     //  basedir
     if (isset($opt_list['basedir'])) {
         $basedir = realpath(end($opt_list['basedir']));
     } else {
         $basedir = getcwd();
     }
     //  no-ini file flag.
     $forpackage = isset($opt_list['plugin-package']) ? true : false;
     $r = Ethna_Generator::generate('CreatePlugin', NULL, $basedir, $types, $forpackage, $plugin_name);
     if (Ethna::isError($r)) {
         printf("error occurred while generating plugin skelton. please see also error messages given above\n\n");
         return $r;
     }
     printf("\nplugin skelton for [%s] is successfully generated.\n\n", $plugin_name);
     return true;
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:38,代码来源:CreatePlugin.php


示例17: perform

 function perform()
 {
     $item_id = $this->af->get('id');
     $item_object = $this->backend->getObject('Item', 'id', $item_id);
     $item_count = $this->af->get('count');
     $sugoi_manager = $this->backend->getManager('Sugoi');
     $login_user_object = $sugoi_manager->getLoginUserObject();
     // 本当はベースクラスの authenticate() ですべき
     if (Ethna::isError($login_user_object)) {
         $this->ae->addObject(null, $login_user_object);
         return 'error';
     }
     // Confirm でもやってるけど、ずるするやついるので
     $validate_result = $sugoi_manager->validateShop($login_user_object, $item_object, $item_count);
     if (Ethna::isError($validate_result)) {
         $this->ae->addObject(null, $validate_result);
         return 'error';
     }
     $sugoi_manager->db->begin();
     // ここのインデントは本当はいらないです。が、個人的にトランザクション中であることが分かりやすいようにブロックで囲みます。
     $update_result = $sugoi_manager->completeShop($login_user_object, $item_object, $item_count, true);
     if (Ethna::isError($update_result)) {
         $this->ae->addObject(null, $update_result);
         return 'error';
         // エラーしたらここで perform() が終了するので commit() は呼び出されない。めでたし。
     }
     $sugoi_manager->db->commit();
     $this->af->setApp('user', $login_user_object->getNameObject());
     $this->af->setApp('item', $item_object->getNameObject());
     $this->af->setApp('cost', $item_object->getCost($item_count));
     return 'good_shop_complete';
 }
开发者ID:nulltask,项目名称:sampleshop,代码行数:32,代码来源:Complete.php


示例18: list

 /**
  * コマンドの実装部分
  * 
  * テストケースファイル生成を行う
  * 
  * @access protected
  * @return mixed 実行結果: TRUE: 成功
  *                         Ethna_Error: エラー
  */
 function &perform()
 {
     // get args.
     $r = $this->_getopt(array('basedir=', 'skelfile='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($optlist, $arglist) = $r;
     $num = count($arglist);
     if ($num < 1 || $num > 3) {
         return Ethna::raiseError("Invalid Arguments.", 'usage');
     }
     if (isset($optlist['skelfile'])) {
         $skelfile = end($optlist['skelfile']);
     } else {
         $skelfile = null;
     }
     $baseDir = isset($optlist['basedir']) ? $optlist['basedir'] : getcwd();
     $name = $arglist[0];
     $r =& Ethna_Generator::generate('Test', $baseDir, $skelfile, $name);
     if (Ethna::isError($r)) {
         return $r;
     }
     $true = true;
     return $true;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:35,代码来源:Ethna_Plugin_Handle_AddTest.php


示例19: perform

 /**
  *  generate message catalog.
  *
  *  @access public
  */
 function perform()
 {
     $r = $this->_getopt(array('basedir=', 'locale=', 'gettext'));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // basedir
     if (isset($opt_list['basedir'])) {
         $basedir = realpath(end($opt_list['basedir']));
     } else {
         $basedir = getcwd();
     }
     // locale
     if (isset($opt_list['locale'])) {
         $locale = end($opt_list['locale']);
         if (!preg_match('/^[A-Za-z_]+$/', $locale)) {
             return Ethna::raiseError("You specified locale, but invalid : {$locale}", 'usage');
         }
     } else {
         $locale = 'ja_JP';
         //  default locale.
     }
     //  use gettext ?
     $use_gettext = isset($opt_list['gettext']) ? true : false;
     //  generate message catalog.
     $ret =& Ethna_Generator::generate('I18n', $basedir, $locale, $use_gettext, $arg_list);
     if (Ethna::isError($ret)) {
         printf("error occurred while generating skelton. please see also following error message(s)\n\n");
         return $ret;
     }
     return $ret;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:38,代码来源:Ethna_Plugin_Handle_I18n.php


示例20: validate

 /**
  *  最大値のチェックを行う
  *
  *  @access public
  *  @param  string  $name       フォームの名前
  *  @param  mixed   $var        フォームの値
  *  @param  array   $params     プラグインのパラメータ
  *  @return true: 成功  Ethna_Error: エラー
  */
 public function validate($name, $var, $params)
 {
     $true = true;
     $type = $this->getFormType($name);
     if (isset($params['strmaxcompat']) == false || $this->isEmpty($var, $type)) {
         return $true;
     }
     $ctl = $this->backend->getController();
     $client_enc = $ctl->getClientEncoding();
     if (mb_enabled() && (strcasecmp('EUC-JP', $client_enc) != 0 && strcasecmp('eucJP-win', $client_enc) != 0)) {
         $var = mb_convert_encoding($var, 'EUC-JP', $client_enc);
     }
     if ($type == VAR_TYPE_STRING) {
         $max_param = $params['strmaxcompat'];
         if (strlen($var) > $max_param) {
             if (isset($params['error'])) {
                 $msg = $params['error'];
             } else {
                 $msg = _et('Please input less than %d full-size (%d half-size) characters to {form}.');
             }
             return Ethna::raiseNotice($msg, E_FORM_MAX_STRING, array(intval($max_param / 2), $max_param));
         }
     }
     return $true;
 }
开发者ID:t-f-m,项目名称:ethna,代码行数:34,代码来源:Strmaxcompat.php



注:本文中的Ethna类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Ethna_Controller类代码示例发布时间:2022-05-23
下一篇:
PHP Estado类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap