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


PHP validate::setError方法代码示例

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


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

示例1: _is_unique_keyword

 public function _is_unique_keyword($keyword, $language)
 {
     // Get languages
     $languages = $this->languages_model->scanLanguages();
     // Check if keyword already exists
     if ($keyword != $language && isset($languages[$keyword])) {
         validate::setError('_is_unique_keyword', __('duplicate_keyword', 'system_languages'));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:11,代码来源:languages.php

示例2: _is_valid_license

 public function _is_valid_license($license)
 {
     if (strlen($license) != 19 || !preg_match('/[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}/i', $license)) {
         validate::setError('_is_valid_license', __('license_invalid', 'system_license'));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:8,代码来源:users.php

示例3: _is_valid_login

 public function _is_valid_login($user)
 {
     if (($return = $this->users_model->isValidLogin($user)) !== true) {
         validate::setError('_is_valid_login', $return);
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:8,代码来源:login.php

示例4: _is_valid_file_name

 public function _is_valid_file_name($file)
 {
     $path1 = DOCPATH . 'views/pages/' . $file . EXT;
     $path2 = BASEPATH . 'templates/' . session::item('template') . '/' . $file . EXT;
     if ($file && !is_file($path1) && !is_file($path2)) {
         validate::setError('_is_valid_file_name', __('page_custom_file_missing', 'pages', array('%1' => '<br/>' . $path1, '%2' => '<br/>' . $path2)));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:10,代码来源:pages.php

示例5: _is_unique_keyword

 public function _is_unique_keyword($keyword, $plugin, $categoryID, $fieldID)
 {
     // Get fields
     $fields = $this->fields_model->getFields($plugin, $categoryID, 'edit');
     // Check that keyword is unique
     foreach ($fields as $field) {
         if ($field['keyword'] == $keyword && $field['field_id'] != $fieldID) {
             validate::setError('_is_unique_keyword', __('duplicate_keyword', 'system_fields'));
             return false;
         }
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:13,代码来源:system.php

示例6: _is_valid_field_name

 public function _is_valid_field_name($field, $keyword, $fields)
 {
     if (count($fields) > 1 && $field) {
         if (!isset($fields[$field])) {
             validate::setError('_is_valid_field_name', __('type_name_field_invalid', 'users_types'));
             return false;
         } elseif ($keyword == 'field_name_2' && input::post('field_name_1') && $field == input::post('field_name_1')) {
             validate::setError('_is_valid_field_name', __('type_duplicate_field_name', 'users_types'));
             return false;
         } elseif ($keyword == 'field_name_2' && !input::post('field_name_1')) {
             return '';
         }
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:15,代码来源:types.php

示例7: _is_comments_delay

 public function _is_comments_delay()
 {
     if (session::permission('comments_delay_limit', 'comments')) {
         $comments = $this->comments_model->countRecentComments();
         if ($comments >= session::permission('comments_delay_limit', 'comments')) {
             validate::setError('_is_comments_delay', __('comments_delay_reached', 'comments', array('%comments' => session::permission('comments_delay_limit', 'comments'), '%time' => session::permission('comments_delay_time', 'comments'), '%type' => utf8::strtolower(__((session::permission('comments_delay_type', 'comments') == 'minutes' ? 'minute' : 'hour') . (session::permission('comments_delay_time', 'comments') > 1 ? 's' : ''), 'date')))));
             return false;
         }
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:11,代码来源:comments.php

示例8: _is_valid_subject

 public function _is_valid_subject($subjectID, $subjects)
 {
     if ($subjects && !isset($subjects[$subjectID])) {
         validate::setError('_is_valid_subject', __('subject_invalid', 'reports'));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:8,代码来源:report.php

示例9: _is_unique_keyword

 public function _is_unique_keyword($keyword, $groupID)
 {
     // Get banner groups
     $groups = $this->banners_groups_model->getGroups();
     // Check if keyword already exists
     foreach ($groups as $group) {
         if ($group['keyword'] == $keyword && $group['group_id'] != $groupID) {
             validate::setError('_is_unique_keyword', __('group_keyword_duplicate', 'banners'));
             return false;
         }
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:13,代码来源:groups.php

示例10: _is_unique_keyword

 public function _is_unique_keyword($keyword, $groupID, $bannerID)
 {
     // Check if keyword already exists
     if (!$this->banners_model->isUniqueKeyword($groupID, $keyword, $bannerID)) {
         validate::setError('_is_unique_keyword', __('banner_keyword_duplicate', 'banners'));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:9,代码来源:banners.php

示例11: addslashes

 $t_address2 = addslashes(trim($address2));
 $t_city = addslashes(trim($city));
 $t_state = addslashes(trim($state));
 $t_zipcode = addslashes(trim($zipcode));
 $zipcount = strlen($zipcode);
 if ($isBackedClick == 1) {
     include $form;
 } else {
     $validator->checkField($firstname, "", "Please enter your first name.");
     $validator->checkField($lastname, "", "Please enter your last name.");
     $validator->checkField($address1, "", "Please enter your address1.");
     $validator->checkField($city, "", "Please enter your first city.");
     $validator->checkField($state, "", "Please select your state.");
     $validator->checkField($zipcode, "", "Please enter your zip code.");
     if (!empty($zipcode) && ($zipcount != 5 && $zipcount != 9)) {
         $validator->setError("Please enter your zip code with 5 or 9 digits.");
     }
     $errorMsg = $validator->getErrors();
     $dataValid = $validator->isDataValid();
     if ($dataValid) {
         //ADDING IN DATABASE
         $query = "INSERT INTO users SET firstname='{$firstname}',lastname='{$lastname}',address1='{$address1}',address2='{$address2}',city='{$city}',state='{$state}',zipcode={$zipcode},visitorIP='" . VISITOR_IP_ADDRESS . "',registeredOn='" . CURRENT_DATE_CUSTOMER_ZONE . "',registeredTime='" . CURRENT_TIME_CUSTOMER_ZONE . "'";
         mysql_query($query);
         $_SESSION['success'] = 1;
         ob_clean();
         header("Location: " . SITE_URL);
         exit;
     } else {
         include $form;
     }
 }
开发者ID:KhushiNoheria,项目名称:HelloW,代码行数:31,代码来源:index.php

示例12: validateValues

 public function validateValues($fields, $rules = array())
 {
     // Loop through fields
     foreach ($fields as $field) {
         // Is this a data field?
         if (isset($field['system'])) {
             // Is this a multi language field?
             if ($field['multilang']) {
                 $languages = array();
                 foreach (config::item('languages', 'core', 'keywords') as $languageID => $languageKey) {
                     $languages[] = array('keyword' => '_' . $languageKey, 'language' => config::item('languages', 'core', 'names', $languageID));
                 }
             } else {
                 $languages = array(array('keyword' => '', 'language' => ''));
             }
             // Loop through fields
             foreach ($languages as $param) {
                 // Is this a section divider?
                 if ($field['type'] != 'section') {
                     $keyword = 'data_' . $field['keyword'] . $param['keyword'];
                     // Create basic rule
                     $rules[$keyword] = array('label' => text_helper::entities($field['name']) . ($param['language'] ? count($languages) > 1 ? ' [' . $param['language'] . ']' : '' : ''), 'rules' => array());
                     // Required
                     if ($field['required']) {
                         if ($field['type'] == 'birthday') {
                             foreach (array('day', 'month', 'year') as $index) {
                                 $rules['data_' . $field['keyword'] . $param['keyword'] . '[' . $index . ']']['label'] = $field['name'];
                                 $rules['data_' . $field['keyword'] . $param['keyword'] . '[' . $index . ']']['rules'][] = 'required';
                             }
                             $value = input::post($keyword);
                         } elseif ($field['type'] == 'location') {
                             foreach (array('country', 'state', 'city') as $index) {
                                 $rules['data_' . $field['keyword'] . $param['keyword'] . '[' . $index . ']']['label'] = $field['name'];
                                 $rules['data_' . $field['keyword'] . $param['keyword'] . '[' . $index . ']']['rules'][] = 'required';
                             }
                             $value = input::post($keyword);
                         } else {
                             $rules[$keyword]['rules'][] = 'required';
                         }
                     }
                     // Field types
                     if ($this->getValueFormat($field['type']) == 'text') {
                         $rules[$keyword]['rules'][] = 'is_string';
                     } elseif ($this->getValueFormat($field['type']) == 'number') {
                         $rules[$keyword]['rules'][] = 'intval';
                         $rules[$keyword]['rules'][] = 'is_numeric';
                     } elseif ($this->getValueFormat($field['type']) == 'double') {
                         $rules[$keyword]['rules'][] = 'is_numeric';
                     }
                     if ($field['type'] == 'website') {
                         $rules[$keyword]['rules']['valid_url'] = array(array('http://', 'https://'));
                     }
                     // Min/max rules
                     foreach (array('min_length', 'max_length', 'min_value', 'max_value') as $rule) {
                         if (isset($field['config'][$rule]) && $field['config'][$rule]) {
                             $rules[$keyword]['rules'][$rule] = array($field['config'][$rule]);
                         }
                     }
                     // Validation
                     if (isset($field['validate']) && $field['validate']) {
                         $rules[$keyword]['rules']['regex'] = array($field['validate']);
                         validate::setError('data_' . $field['keyword'] . '_regex', $field['validate_error'], $field['keyword'] . $param['keyword']);
                     }
                 }
             }
         }
     }
     // Set rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:75,代码来源:fields.php

示例13: _is_valid_username

 public function _is_valid_username($username)
 {
     if (($return = $this->users_model->isValidUsername($username, session::item('user_id'))) !== true) {
         validate::setError('_is_valid_username', $return);
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:8,代码来源:settings.php

示例14: _is_valid_default

 public function _is_valid_default($value, $default)
 {
     if ($default && !$value) {
         validate::setError('_is_valid_default', __('captcha_default', 'security_forms'));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:8,代码来源:forms.php

示例15: _is_terms

 public function _is_terms($value)
 {
     if (!$value) {
         validate::setError('_is_terms', __('no_terms', 'users_signup'));
         return false;
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:8,代码来源:signup.php


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