当前位置: 首页>>代码示例>>PHP>>正文


PHP Validation::active方法代码示例

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


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

示例1: _validation_unique

 public static function _validation_unique($val, $options)
 {
     list($table, $field) = explode('.', $options);
     $result = DB::select("LOWER (\"{$field}\")")->where($field, '=', Str::lower($val))->from($table)->execute();
     return !($result->count() > 0);
     Validation::active()->set_message('unique', 'The field :label must be unique, but :value has already been used');
 }
开发者ID:sajans,项目名称:cms,代码行数:7,代码来源:validationrules.php

示例2: _validation_valid_location

 /**
  * A validation function which checks if the number passed 
  * to it is a valid location ID.
  * @param type $val
  * @return boolean
  */
 public static function _validation_valid_location($val)
 {
     if (Model_Orm_Location::find($val) == null) {
         Validation::active()->set_message('valid_location', 'The field "location" must refer to a valid location.');
         return false;
     }
     return true;
 }
开发者ID:beingsane,项目名称:TTII_2012,代码行数:14,代码来源:location.php

示例3: _validation_noSpaceBetweenText

 /**
  * validate no space between text.
  *
  * @param mixed $val
  * @return boolean
  */
 public function _validation_noSpaceBetweenText($val)
 {
     \Validation::active()->set_message('noSpaceBetweenText', __('account_invalid_space_between_text'));
     if (preg_match('/\\s/', $val) == false) {
         // not found space, return true.
         return true;
     } else {
         // found space, return false.
         return false;
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:17,代码来源:fsvalidate.php

示例4: _validation_current_password

 public static function _validation_current_password($val, $options)
 {
     $encode_password = \Auth::hash_password($val);
     $arrOption = explode('.', $options);
     $table = $arrOption[0];
     $pk = $arrOption[1];
     $field = $arrOption[2];
     $id = isset($arrOption[3]) ? $arrOption[3] : '';
     $result = DB::select("LOWER (\"{$field}\"), {$pk}")->where($pk, '=', $id)->and_where($field, '=', $encode_password)->from($table)->execute()->current();
     Validation::active()->set_message('current_password', 'パスワードが異なります。');
     return !empty($result) ? true : false;
 }
开发者ID:khoapossible,项目名称:vision_system,代码行数:12,代码来源:myrule.php

示例5: _validation_unique

 /**
  * Check if a value is unique in column
  *
  * @param   string   $val
  * @param   array    $options   keys are 0:table, 1:field, 2:id field value, 3:id field. Default id field is id
  */
 public function _validation_unique($val, $options = array())
 {
     Validation::active()->set_message('unique', 'It appears you have already registered using this email address.');
     $result = \DB::select("LOWER (\"{$options['1']}\")")->from($options['0'])->where($options['1'], '=', Str::lower($val));
     if (!empty($options['2']) && is_numeric($options['2'])) {
         $id = empty($options['3']) ? 'id' : $options['3'];
         $result->where($id, '!=', $options['2']);
     }
     if (count($result->execute()) > 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:20,代码来源:CustomValidation.php

示例6: _validation_sanpham_number

 /**
  * Validate number of product in one row
  *
  * @return boolean result of validation
  *
  * @since 1.0
  * @version 1.0
  * @access public
  * @author Dao Anh Minh
  */
 public static function _validation_sanpham_number($number)
 {
     Validation::active()->set_message('sanpham_number', 'Chỉ chấp nhận hiển thị 3 hoặc 4 sản phẩm trong 1 dòng');
     return $number == 3 or $number == 4;
 }
开发者ID:aminh047,项目名称:pepperyou,代码行数:15,代码来源:validation.php

示例7: _validation_date_greater

 public static function _validation_date_greater($val, $table_field)
 {
     Validation::active()->set_message('date_greater', ':label should be greater than ' . Validation::active()->field($table_field)->label . '.');
     return !Validation::active()->input($table_field) || !$val || $val > Validation::active()->input($table_field);
 }
开发者ID:xXLXx,项目名称:ddc,代码行数:5,代码来源:rules.php

示例8: _validation_required_not_zero

 /**
  * Required but not zero
  *
  * Value may not be empty
  *
  * @param   mixed
  * @return  bool
  */
 public function _validation_required_not_zero($val)
 {
     Validation::active()->set_message('required_not_zero', 'The field :label is required and must contain a value.');
     return !($this->_empty($val) || $val == '0');
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:13,代码来源:validation.php


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