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


PHP GFFormDisplay::process_form方法代码示例

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


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

示例1: maybe_process_form

 public static function maybe_process_form()
 {
     $form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0;
     if ($form_id) {
         require_once GFCommon::get_base_path() . "/form_display.php";
         GFFormDisplay::process_form($form_id);
     }
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:8,代码来源:gravityforms.php

示例2: maybe_process_form

 public static function maybe_process_form()
 {
     $form_id = isset($_POST['gform_submit']) ? absint($_POST['gform_submit']) : 0;
     if ($form_id) {
         $form_info = RGFormsModel::get_form($form_id);
         $is_valid_form = $form_info && $form_info->is_active;
         if ($is_valid_form) {
             require_once GFCommon::get_base_path() . '/form_display.php';
             GFFormDisplay::process_form($form_id);
         }
     } elseif (isset($_POST['gform_send_resume_link'])) {
         require_once GFCommon::get_base_path() . '/form_display.php';
         GFFormDisplay::process_send_resume_link();
     }
 }
开发者ID:kidaak,项目名称:gravityforms,代码行数:15,代码来源:gravityforms.php

示例3: maybe_process_form

 public static function maybe_process_form()
 {
     $form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0;
     if ($form_id) {
         $form_info = RGFormsModel::get_form($form_id);
         $is_valid_form = $form_info && $form_info->is_active;
         if ($is_valid_form) {
             require_once GFCommon::get_base_path() . "/form_display.php";
             GFFormDisplay::process_form($form_id);
         }
     }
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:12,代码来源:gravityforms.php

示例4: submit_form

 /**
  * Submits a form. Use this function to send input values through the complete form submission process.
  * Supports field validation, notifications, confirmations, multiple-pages and save & continue.
  *
  * Example usage:
  * $input_values['input_1']   = 'Single line text';
  * $input_values['input_2_3'] = 'First name';
  * $input_values['input_2_6'] = 'Last name';
  * $input_values['input_5']   = 'A paragraph of text.';
  * //$input_values['gform_save'] = true; // support for save and continue
  *
  * $result = GFAPI::submit_form( 52, $input_values );
  *
  * Example output for a successful submission:
  * 'is_valid' => boolean true
  * 'page_number' => int 0
  * 'source_page_number' => int 1
  * 'confirmation_message' => string 'confirmation message [snip]'
  *
  * Example output for failed validation:
  * 'is_valid' => boolean false
  * 'validation_messages' =>
  *      array (size=1)
  *          2 => string 'This field is required. Please enter the first and last name.'
  *	'page_number' => int 1
  *  'source_page_number' => int 1
  *	'confirmation_message' => string ''
  *
  *
  * Example output for save and continue:
  * 'is_valid' => boolean true
  * 'page_number' => int 1
  * 'source_page_number' => int 1
  * 'confirmation_message' => string 'Please use the following link to return to your form from any computer. [snip]'
  * 'resume_token' => string '045f941cc4c04d479556bab1db6d3495'
  *
  *
  * @param int $form_id The Form ID
  * @param array $input_values An array of values. Not $_POST, that will be automatically merged with the $input_values.
  * @param array $field_values Optional.
  * @param int $target_page Optional.
  * @param int $source_page Optional.
  *
  * @return array An array containing the result of the submission.
  */
 public static function submit_form($form_id, $input_values, $field_values = array(), $target_page = 0, $source_page = 1)
 {
     $form_id = absint($form_id);
     $form = GFAPI::get_form($form_id);
     if (empty($form) || !$form['is_active'] || $form['is_trash']) {
         return new WP_Error('form_not_found', __('Your form could not be found', 'gravityforms'));
     }
     $input_values['is_submit_' . $form_id] = true;
     $input_values['gform_submit'] = $form_id;
     $input_values['gform_target_page_number_' . $form_id] = absint($target_page);
     $input_values['gform_source_page_number_' . $form_id] = absint($source_page);
     $input_values['gform_field_values'] = $field_values;
     require_once GFCommon::get_base_path() . '/form_display.php';
     if (!isset($_POST)) {
         $_POST = array();
     }
     $_POST = array_merge_recursive($_POST, $input_values);
     try {
         GFFormDisplay::process_form($form_id);
     } catch (Exception $ex) {
         return new WP_Error('error_processing_form', __('There was an error while processing the form:', 'gravityforms') . ' ' . $ex->getCode() . ' ' . $ex->getMessage());
     }
     if (empty(GFFormDisplay::$submission)) {
         return new WP_Error('error_processing_form', __('There was an error while processing the form:', 'gravityforms'));
     }
     $submissions_array = GFFormDisplay::$submission;
     $submission_details = $submissions_array[$form_id];
     $result = array();
     $result['is_valid'] = $submission_details['is_valid'];
     if ($result['is_valid'] == false) {
         $validation_messages = array();
         foreach ($submission_details['form']['fields'] as $field) {
             if ($field->failed_validation) {
                 $validation_messages[$field->id] = $field->validation_message;
             }
         }
         $result['validation_messages'] = $validation_messages;
     }
     $result['page_number'] = $submission_details['page_number'];
     $result['source_page_number'] = $submission_details['source_page_number'];
     $result['confirmation_message'] = $submission_details['confirmation_message'];
     if (isset($submission_details['resume_token'])) {
         $result['resume_token'] = $submission_details['resume_token'];
         $form = self::get_form($form_id);
         $result['confirmation_message'] = GFFormDisplay::replace_save_variables($result['confirmation_message'], $form, $result['resume_token']);
     }
     return $result;
 }
开发者ID:fjbeteiligung,项目名称:development,代码行数:93,代码来源:api.php

示例5: maybe_save_confirmation

 public function maybe_save_confirmation()
 {
     /* On paged forms all processing is suppressed, so we still need to do something */
     $form_id = isset($_POST['gform_submit']) ? $_POST['gform_submit'] : 0;
     if (!$form_id) {
         return;
     }
     if (!isset($_POST['gform_save_state_' . $form_id])) {
         return;
     }
     $form_info = RGFormsModel::get_form($form_id);
     $is_valid_form = $form_info && $form_info->is_active;
     if (!$is_valid_form) {
         return;
     }
     $form = RGFormsModel::get_form_meta($form_id);
     if (!isset($form['requireLogin']) || !isset($form['enableFormState'])) {
         return;
     }
     if (!$form['requireLogin'] || !$form['enableFormState']) {
         return;
     }
     if (!GFCommon::has_pages($form)) {
         return;
     }
     /* Spoof the page number and make-believe */
     $_POST["gform_target_page_number_{$form_id}"] = 65535;
     require_once GFCommon::get_base_path() . '/form_display.php';
     GFFormDisplay::process_form($form_id);
 }
开发者ID:siafaalvin,项目名称:Gravity-Forms-Saved-Forms-Addon,代码行数:30,代码来源:gravityforms-savedforms.php

示例6: add_cart_item_data

 function add_cart_item_data($cart_item_meta, $product_id)
 {
     global $woocommerce;
     if (isset($cart_item_meta['_gravity_form_data']) && isset($cart_item_meta['_gravity_form_lead'])) {
         return $cart_item_meta;
     }
     $gravity_form_data = get_post_meta($product_id, '_gravity_form_data', true);
     $cart_item_meta['_gravity_form_data'] = $gravity_form_data;
     if ($gravity_form_data && is_array($gravity_form_data) && isset($gravity_form_data['id']) && intval($gravity_form_data['id']) > 0) {
         $form_id = $gravity_form_data['id'];
         $form_meta = RGFormsModel::get_form_meta($form_id);
         //Gravity forms generates errors and warnings.  To prevent these from conflicting with other things, we are going to disable warnings and errors.
         $err_level = error_reporting();
         error_reporting(0);
         //MUST disable notifications manually.
         add_filter('gform_disable_user_notification_' . $form_id, array(&$this, 'disable_notifications'), 10, 3);
         add_filter('gform_disable_admin_notification_' . $form_id, array(&$this, 'disable_notifications'), 10, 3);
         add_filter('gform_disable_notification_' . $form_id, array(&$this, 'disable_notifications'), 10, 3);
         add_filter("gform_confirmation_" . $form_id, array($this, "disable_confirmation"), 10, 4);
         if (empty($form_meta)) {
             return $cart_item_meta;
         }
         require_once GFCommon::get_base_path() . "/form_display.php";
         $_POST['gform_submit'] = $_POST['gform_old_submit'];
         GFFormDisplay::process_form($form_id);
         $_POST['gform_old_submit'] = $_POST['gform_submit'];
         unset($_POST['gform_submit']);
         $lead = GFFormDisplay::$submission[$form_id]['lead'];
         $cart_item_meta['_gravity_form_lead'] = array();
         foreach ($form_meta['fields'] as $field) {
             if (isset($field['displayOnly']) && $field['displayOnly']) {
                 continue;
             }
             $value = RGFormsModel::get_lead_field_value($lead, $field);
             if (isset($field['inputs']) && is_array($field['inputs'])) {
                 foreach ($field['inputs'] as $input) {
                     $cart_item_meta['_gravity_form_lead'][strval($input['id'])] = $value[strval($input['id'])];
                 }
             } else {
                 $cart_item_meta['_gravity_form_lead'][strval($field['id'])] = $value;
             }
         }
         if (GFFormDisplay::$submission[$form_id]['is_valid']) {
             add_filter('add_to_cart_redirect', array(&$this, 'get_redirect_url'), 99);
             if (get_option('woocommerce_cart_redirect_after_add') == 'yes') {
                 $_SERVER['REQUEST_URI'] = add_query_arg(array('invalid' => 1));
             }
         }
         error_reporting($err_level);
     }
     return $cart_item_meta;
 }
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:52,代码来源:gravityforms-product-addons.php


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