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


PHP FrmFieldsHelper::get_error_msg方法代码示例

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


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

示例1: validate_phone_field

 public static function validate_phone_field(&$errors, $field, $value, $args)
 {
     if ($field->type != 'phone') {
         return;
     }
     $pattern = self::phone_format($field);
     if (!preg_match($pattern, $value)) {
         $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg($field, 'invalid');
     }
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:10,代码来源:FrmEntryValidate.php

示例2: validate_email_field

 public static function validate_email_field(&$errors, $field, $value, $args)
 {
     if ($value == '' || $field->type != 'email') {
         return;
     }
     //validate the email format
     if (!is_email($value)) {
         $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg($field, 'invalid');
     }
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:10,代码来源:FrmEntryValidate.php

示例3: add_validation_messages

 private static function add_validation_messages($field, array &$add_html)
 {
     if (FrmField::is_required($field)) {
         $required_message = FrmFieldsHelper::get_error_msg($field, 'blank');
         $add_html['data-reqmsg'] = 'data-reqmsg="' . esc_attr($required_message) . '"';
     }
     if (!FrmField::is_option_empty($field, 'invalid')) {
         $invalid_message = FrmFieldsHelper::get_error_msg($field, 'invalid');
         $add_html['data-invmsg'] = 'data-invmsg="' . esc_attr($invalid_message) . '"';
     }
     if ($field['type'] == 'tel') {
         $format = FrmEntryValidate::phone_format($field);
         $format = substr($format, 2, -2);
         $key = 'pattern';
         $add_html[$key] = $key . '="' . esc_attr($format) . '"';
     }
 }
开发者ID:LeanderWesterhout,项目名称:leander,代码行数:17,代码来源:FrmFieldsController.php

示例4: get_error_msg

 public static function get_error_msg($field, $error)
 {
     _deprecated_function(__FUNCTION__, '2.0', 'FrmFieldsHelper::get_error_msg');
     return FrmFieldsHelper::get_error_msg($field, $error);
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:5,代码来源:FrmProFieldsHelper.php

示例5: validate_date_field

 public static function validate_date_field(&$errors, $field, $value)
 {
     if ($field->type != 'date') {
         return;
     }
     if (!preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $value)) {
         $frmpro_settings = new FrmProSettings();
         $formated_date = FrmProAppHelper::convert_date($value, $frmpro_settings->date_format, 'Y-m-d');
         //check format before converting
         if ($value != date($frmpro_settings->date_format, strtotime($formated_date))) {
             $errors['field' . $field->temp_id] = FrmFieldsHelper::get_error_msg($field, 'invalid');
         }
         $value = $formated_date;
         unset($formated_date);
     }
     $date = explode('-', $value);
     if (count($date) != 3 || !checkdate((int) $date[1], (int) $date[2], (int) $date[0])) {
         $errors['field' . $field->temp_id] = FrmFieldsHelper::get_error_msg($field, 'invalid');
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:20,代码来源:FrmProEntryMeta.php

示例6: validate_phone_field

 public static function validate_phone_field(&$errors, $field, $value, $args)
 {
     if ($field->type == 'phone' || $field->type == 'text' && FrmField::is_option_true_in_object($field, 'format')) {
         $pattern = self::phone_format($field);
         if (!preg_match($pattern, $value)) {
             $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg($field, 'invalid');
         }
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:9,代码来源:FrmEntryValidate.php

示例7: add_validation_messages

 private static function add_validation_messages($field, array &$add_html)
 {
     if (FrmField::is_required($field)) {
         $required_message = FrmFieldsHelper::get_error_msg($field, 'blank');
         $add_html['data-reqmsg'] = 'data-reqmsg="' . esc_attr($required_message) . '"';
     }
     if (!FrmField::is_option_empty($field, 'invalid')) {
         $invalid_message = FrmFieldsHelper::get_error_msg($field, 'invalid');
         $add_html['data-invmsg'] = 'data-invmsg="' . esc_attr($invalid_message) . '"';
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:11,代码来源:FrmFieldsController.php

示例8: set_post_fields

 public static function set_post_fields($field, $value, $errors)
 {
     // save file ids for later use
     if ('file' == $field->type) {
         global $frm_vars;
         if (!isset($frm_vars['media_id'])) {
             $frm_vars['media_id'] = array();
         }
         $frm_vars['media_id'][$field->id] = $value;
     }
     if (empty($value) || !FrmField::is_option_true($field, 'unique')) {
         return $errors;
     }
     $post_form_action = FrmFormAction::get_action_for_form($field->form_id, 'wppost', 1);
     if (!$post_form_action) {
         return $errors;
     }
     // check if this is a regular post field
     $post_field = array_search($field->id, $post_form_action->post_content);
     $custom_field = '';
     if (!$post_field) {
         // check if this is a custom field
         foreach ($post_form_action->post_content['post_custom_fields'] as $custom_field) {
             if (isset($custom_field['field_id']) && !empty($custom_field['field_id']) && isset($custom_field['meta_name']) && !empty($custom_field['meta_name']) && $field->id == $custom_field['field_id']) {
                 $post_field = 'post_custom';
                 $custom_field = $custom_field['meta_name'];
             }
         }
         if (!$post_field) {
             return $errors;
         }
     }
     // check for unique values in post fields
     $entry_id = $_POST && isset($_POST['id']) ? $_POST['id'] : false;
     $post_id = false;
     if ($entry_id) {
         global $wpdb;
         $post_id = FrmDb::get_var($wpdb->prefix . 'frm_items', array('id' => $entry_id), 'post_id');
     }
     if (self::post_value_exists($post_field, $value, $post_id, $custom_field)) {
         $errors['field' . $field->id] = FrmFieldsHelper::get_error_msg($field, 'unique_msg');
     }
     return $errors;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:44,代码来源:FrmProEntryMetaHelper.php


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