當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。