當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FrmFieldsHelper::setup_new_vars方法代碼示例

本文整理匯總了PHP中FrmFieldsHelper::setup_new_vars方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrmFieldsHelper::setup_new_vars方法的具體用法?PHP FrmFieldsHelper::setup_new_vars怎麽用?PHP FrmFieldsHelper::setup_new_vars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FrmFieldsHelper的用法示例。


在下文中一共展示了FrmFieldsHelper::setup_new_vars方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: include_new_field

 /**
  * @param integer $form_id
  */
 public static function include_new_field($field_type, $form_id)
 {
     $values = array();
     if (FrmAppHelper::pro_is_installed()) {
         $values['post_type'] = FrmProFormsHelper::post_type($form_id);
     }
     $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_type, $form_id));
     $field_id = FrmField::create($field_values);
     if (!$field_id) {
         return false;
     }
     $field = self::include_single_field($field_id, $values, $form_id);
     return $field;
 }
開發者ID:EyesX,項目名稱:formidable-forms,代碼行數:17,代碼來源:FrmFieldsController.php

示例2: create

 public static function create()
 {
     $field_data = $_POST['field'];
     $form_id = $_POST['form_id'];
     $values = array();
     if (class_exists('FrmProForm')) {
         $values['post_type'] = FrmProFormsHelper::post_type($form_id);
     }
     $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_data, $form_id));
     $frm_field = new FrmField();
     $field_id = $frm_field->create($field_values);
     if ($field_id) {
         $field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
         $field_name = "item_meta[{$field_id}]";
         $id = $form_id;
         require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php';
     }
     die;
 }
開發者ID:amit0773,項目名稱:manaslake,代碼行數:19,代碼來源:FrmFieldsController.php

示例3: create

 function create()
 {
     global $frm_field, $frm_ajax_url;
     $field_data = $_POST['field'];
     $form_id = $_POST['form_id'];
     $values = array();
     if (class_exists('FrmProForm')) {
         $values['post_type'] = FrmProForm::post_type($form_id);
     }
     $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_data, $form_id));
     $field_id = $frm_field->create($field_values);
     if ($field_id) {
         $field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
         $field_name = "item_meta[{$field_id}]";
         $id = $form_id;
         require FRM_VIEWS_PATH . '/frm-forms/add_field.php';
         require FRM_VIEWS_PATH . '/frm-forms/new-field-js.php';
     }
     die;
 }
開發者ID:edelkevis,項目名稱:git-plus-wordpress,代碼行數:20,代碼來源:FrmFieldsController.php

示例4: create_object

 function create_object($args)
 {
     $field_values = FrmFieldsHelper::setup_new_vars($args['type'], $args['form_id']);
     return FrmField::create($field_values);
 }
開發者ID:knightzac19,項目名稱:formidable-forms,代碼行數:5,代碼來源:frm_factory.php

示例5: serialize

$field_values['options'] = serialize(array('', 'AL', 'AK', 'AS', 'AZ', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MH', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'));
$field_values['field_options']['classes'] = 'frm_fourth';
$frm_field->create($field_values);
unset($field_values);
$field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
$field_values['name'] = 'Postal Code';
$field_values['field_order'] = '10';
$field_values['field_options']['classes'] = 'frm_right_fourth';
$frm_field->create($field_values);
unset($field_values);
$field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('select', $form_id));
$field_values['name'] = 'Country';
$field_values['required'] = 1;
$field_values['field_order'] = '11';
$field_values['field_options']['size'] = 1;
$field_values['options'] = serialize(array('', 'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island', 'Brazil', 'British Indian Ocean Territory', 'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo', 'Cook Islands', 'Costa Rica', 'Côte d\'Ivoire', 'Croatia (Hrvatska)', 'Cuba', 'Cyprus', 'Czech Republic', 'Congo (DRC)', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Falkland Islands (Islas Malvinas)', 'Faroe Islands', 'Fiji Islands', 'Finland', 'France', 'French Guiana', 'French Polynesia', 'French Southern and Antarctic Lands', 'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', 'Hong Kong SAR', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy', 'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Korea', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macao SAR', 'Macedonia, Former Yugoslav Republic of', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palestine', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Puerto Rico', 'Qatar', 'Romania', 'Russia', 'Rwanda', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia and Montenegro', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Togo', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', 'Venezuela', 'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe'));
$frm_field->create($field_values);
unset($field_values);
$field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('radio', $form_id));
$field_values['name'] = 'Employment Desired';
$field_values['required'] = 1;
$field_values['field_order'] = '12';
$field_values['options'] = serialize(array('Full-time', 'Part-time', 'Full- or Part- time'));
$frm_field->create($field_values);
unset($field_values);
$field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('file', $form_id));
$field_values['name'] = 'Attach Resume';
$field_values['field_order'] = '13';
$field_values['field_options']['attach'] = 1;
$frm_field->create($field_values);
unset($field_values);
開發者ID:edelkevis,項目名稱:git-plus-wordpress,代碼行數:31,代碼來源:frmproapplication.php

示例6: auto_add_end_section_fields

 /**
  * Automatically add end section fields if they don't exist (2.0 migration)
  * @since 2.0
  *
  * @param boolean $reset_fields
  */
 public static function auto_add_end_section_fields($form, $fields, &$reset_fields)
 {
     if (empty($fields)) {
         return;
     }
     $end_section_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('end_divider', $form->id));
     $open = $prev_order = false;
     $add_order = 0;
     $last_field = false;
     foreach ($fields as $field) {
         if ($prev_order === $field->field_order) {
             $add_order++;
         }
         if ($add_order) {
             $reset_fields = true;
             $field->field_order = $field->field_order + $add_order;
             FrmField::update($field->id, array('field_order' => $field->field_order));
         }
         switch ($field->type) {
             case 'divider':
                 // create an end section if open
                 self::maybe_create_end_section($open, $reset_fields, $add_order, $end_section_values, $field, 'move');
                 // mark it open for the next end section
                 $open = true;
                 break;
             case 'break':
                 self::maybe_create_end_section($open, $reset_fields, $add_order, $end_section_values, $field, 'move');
                 break;
             case 'end_divider':
                 if (!$open) {
                     // the section isn't open, so this is an extra field that needs to be removed
                     FrmField::destroy($field->id);
                     $reset_fields = true;
                 }
                 // There is already an end section here, so there is no need to create one
                 $open = false;
         }
         $prev_order = $field->field_order;
         $last_field = $field;
         unset($field);
     }
     self::maybe_create_end_section($open, $reset_fields, $add_order, $end_section_values, $last_field);
 }
開發者ID:knightzac19,項目名稱:formidable-forms,代碼行數:49,代碼來源:FrmFormsHelper.php

示例7: validate

 function validate($errors, $values)
 {
     global $frm_field;
     /*
     if (isset($values['item_meta'])){    
         foreach($values['item_meta'] as $key => $value){
             $field = $frm_field->getOne($key);  
             if ($field && $field->type == 'hidden' and empty($value))
                 $errors[] = __("Hidden fields must have a value.", 'formidable');
         }
     
     }
     */
     // add a user id field if the form requires one
     if (isset($values['logged_in']) || isset($values['editable']) || isset($values['single_entry']) && isset($values['options']['single_entry_type']) && $values['options']['single_entry_type'] == 'user' || isset($values['options']['save_draft']) && $values['options']['save_draft'] == 1) {
         $form_id = $values['id'];
         $user_field = $frm_field->getAll(array('fi.form_id' => $form_id, 'type' => 'user_id'));
         if (!$user_field) {
             $new_values = FrmFieldsHelper::setup_new_vars('user_id', $form_id);
             $new_values['name'] = __('User ID', 'formidable');
             $frm_field->create($new_values);
         }
     }
     if (isset($values['options']['auto_responder'])) {
         if (!isset($values['options']['ar_email_message']) or $values['options']['ar_email_message'] == '') {
             $errors[] = __("Please insert a message for your auto responder.", 'formidable');
         }
         if (isset($values['options']['ar_reply_to']) and !is_email(trim($values['options']['ar_reply_to']))) {
             $errors[] = __("That is not a valid reply-to email address for your auto responder.", 'formidable');
         }
     }
     return $errors;
 }
開發者ID:amit0773,項目名稱:manaslake,代碼行數:33,代碼來源:FrmProForm.php

示例8: validate

 public static function validate($errors, $values)
 {
     /*
     if (isset($values['item_meta'])){
     			foreach( $values['item_meta'] as $key => $value ) {
             $field = FrmField::getOne($key);
             if ($field && $field->type == 'hidden' and empty($value))
                 $errors[] = __( 'Hidden fields must have a value.', 'formidable' );
         }
     
     }
     */
     // add a user id field if the form requires one
     if (isset($values['logged_in']) || isset($values['editable']) || isset($values['single_entry']) && isset($values['options']['single_entry_type']) && $values['options']['single_entry_type'] == 'user' || isset($values['options']['save_draft']) && $values['options']['save_draft'] == 1) {
         $form_id = $values['id'];
         $user_field = FrmField::get_all_types_in_form($form_id, 'user_id', 1);
         if (!$user_field) {
             $new_values = FrmFieldsHelper::setup_new_vars('user_id', $form_id);
             $new_values['name'] = __('User ID', 'formidable');
             FrmField::create($new_values);
         }
     }
     if (isset($values['options']['auto_responder'])) {
         if (!isset($values['options']['ar_email_message']) || $values['options']['ar_email_message'] == '') {
             $errors[] = __('Please insert a message for your auto responder.', 'formidable');
         }
         if (isset($values['options']['ar_reply_to']) && !is_email(trim($values['options']['ar_reply_to']))) {
             $errors[] = __('That is not a valid reply-to email address for your auto responder.', 'formidable');
         }
     }
     return $errors;
 }
開發者ID:swc-dng,項目名稱:swcsandbox,代碼行數:32,代碼來源:FrmProForm.php


注:本文中的FrmFieldsHelper::setup_new_vars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。