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


PHP GFFormDisplay类代码示例

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


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

示例1: add_page_script

 public static function add_page_script($form)
 {
     self::log_debug('Adding page script to ' . $form['id']);
     $script = "(function(\$){" . "\$('#gform_" . $form['id'] . "').sisyphus();" . "})(jQuery);";
     GFFormDisplay::add_init_script($form['id'], 'gravity-forms-js-validate', GFFormDisplay::ON_PAGE_RENDER, $script);
     return $form;
 }
开发者ID:jasondavis,项目名称:gravity-forms-sisyphus,代码行数:7,代码来源:gravity-forms-sisyphus.php

示例2: __construct

 /**
  * initialise instance
  * @param array $form
  */
 public function __construct(&$form)
 {
     // check for last page
     $current_page = GFFormDisplay::get_source_page($form['id']);
     $target_page = GFFormDisplay::get_target_page($form, $current_page, rgpost('gform_field_values'));
     $this->isLastPageFlag = $target_page == 0;
     // load the form data
     $this->loadForm($form);
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:13,代码来源:class.GFEwayFormData.php

示例3: register_init_scripts

 public function register_init_scripts($form)
 {
     if (!$this->has_copy_cat_field($form)) {
         return;
     }
     $copy_fields = $this->get_copy_cat_fields($form);
     $enable_overwrite = gf_apply_filters('gpcc_overwrite_existing_values', $form['id'], false, $form);
     $script = 'new gwCopyObj( ' . $form['id'] . ', ' . json_encode($copy_fields) . ', ' . ($enable_overwrite ? 'true' : 'false') . ' );';
     GFFormDisplay::add_init_script($form['id'], 'gp-copy-cat', GFFormDisplay::ON_PAGE_RENDER, $script);
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:10,代码来源:gwcopycat.php

示例4: sticky_pre_populate_the_form

function sticky_pre_populate_the_form($form)
{
    if ($form['isSticky']) {
        $current_page = GFFormDisplay::get_current_page($form["id"]);
        if ($current_page == 1) {
            global $valid;
            // Get the stored entry ID
            $entry_id = sticky_getEntryOptionKeyForGF($form);
            // If the form has been submited, is valid and we are not in the preview area
            if ($valid && strpos($_SERVER['REQUEST_URI'], 'preview') == false) {
                // We have a previously saved entry
                if (get_option($entry_id)) {
                    // Get the entry
                    $form_fields = RGFormsModel::get_lead(get_option($entry_id));
                    // If an entry is found we need prepare if for insertion into the form
                    if ($form_fields && $form_fields["status"] != "trash") {
                        // Create new correctly formated keys and get rid of the old ones
                        foreach ($form_fields as $key => &$value) {
                            // If the key is numeric we need to change it from [X.X] to [input_X_X]
                            if (is_numeric($key)) {
                                $new_key = str_replace(".", "_", "input_{$key}");
                                $form_fields[$new_key] = $form_fields[$key];
                                unset($form_fields[$key]);
                                // If we have an upload field
                                if (strpos($value, "uploads/")) {
                                    $upload = $value;
                                }
                            }
                        }
                        // Add is_submit_id field
                        $form_id = $form['id'];
                        $form_fields["is_submit_{$form_id}"] = "1";
                        $_POST = $form_fields;
                        // If no entry is found; unset the stored entry ID
                    } else {
                        update_option($entry_id, "");
                    }
                }
            }
        }
    }
    // Replace {upload} with reference to uploaded file
    if (isset($upload)) {
        foreach ($form["fields"] as &$field) {
            foreach ($field as $key => &$value) {
                if ($key == "content") {
                    $value = str_replace("{upload}", $upload, $value);
                }
            }
        }
    }
    return $form;
}
开发者ID:jgryn,项目名称:gravity-forms-sticky-form,代码行数:53,代码来源:sticky-form.php

示例5: getFormInitScripts

function getFormInitScripts()
{
    if (intval(get_query_var('getFormInitScripts')) != '') {
        require_once GFCommon::get_base_path() . '/form_display.php';
        $form = GFAPI::get_form(get_query_var('getFormInitScripts'));
        $field_values = array();
        // the array of parameter names and values if any fields are being populated
        GFFormDisplay::register_form_init_scripts($form, $field_values);
        $form_string = GFFormDisplay::get_form_init_scripts($form);
        echo strip_tags($form_string);
        exit;
    }
}
开发者ID:afgarcia86,项目名称:react-wordpress-theme-boilerplate,代码行数:13,代码来源:functions.php

示例6: render

 public function render($form, $ajax)
 {
     if (!class_exists('GFFormDisplay') || self::isDisabled()) {
         return $form;
     }
     self::enqueueScripts($form, $ajax);
     self::updateRenderedCount();
     $next = GFFormDisplay::get_max_field_id($form) + 1;
     $template = sprintf($this->template, get_option('rg_gforms_captcha_public_key'));
     $opts = array('type' => 'section', '_is_entry_detail' => NULL, 'id' => $next, 'label' => '', 'adminLabel' => '', 'isRequired' => false, 'size' => 'medium', 'errorMessage' => '', 'inputs' => NULL, 'displayOnly' => true, 'labelPlacement' => '', 'content' => '', 'formId' => $form['id'], 'pageNumber' => GFFormDisplay::get_current_page($form['id']), 'conditionalLogic' => '', 'cssClass' => $this->buCAPTCHAIdentifier . '_section');
     $form['fields'][] = GF_Fields::create($opts);
     $captcha_opts = array('type' => 'html', 'id' => $next + 1, 'content' => apply_filters('bu_gravityforms_global_recaptcha_div', $template), 'cssClass' => $this->buCAPTCHAIdentifier);
     $form['fields'][] = GF_Fields::create(array_merge($opts, $captcha_opts));
     return $form;
 }
开发者ID:bu-ist,项目名称:gravityforms-require-captcha,代码行数:15,代码来源:class-bu-gf-recaptcha.php

示例7: is_applicable_field

 function is_applicable_field($field, $form)
 {
     if ($field['pageNumber'] != GFFormDisplay::get_source_page($form['id'])) {
         return false;
     }
     if ($field['type'] != 'list' || RGFormsModel::is_field_hidden($form, $field, array())) {
         return false;
     }
     // if the field has already failed validation, we don't need to fail it again
     if (!$field['isRequired'] || $field['failed_validation']) {
         return false;
     }
     if (empty($this->field_ids)) {
         return true;
     }
     return in_array($field['id'], $this->field_ids);
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:17,代码来源:gwReqColumns.php

示例8: add_page_script

 public static function add_page_script($form)
 {
     self::log_debug('Adding page script to ' . $form['id']);
     $script = "(function(\$){" . "var container;" . "\$('.gfield_contains_required').each(function(i, e){" . "\$(e).find('input, select, textarea').attr('required', true);" . "});" . "\$('#gform_" . $form['id'] . "').validate({" . "debug: true," . "errorElement: 'div'," . "errorClass: 'gfield_error'," . "errorPlacement: function(error, element){" . "container = element.closest('.gfield');" . "},";
     // Get messages for each input
     $script .= "messages: {";
     foreach ($form['fields'] as $field) {
         $field_name = 'input_' . $field['id'];
         // test
         $field_errorMessage = "'" . $field['errorMessage'] . "',";
         if ($field['errorMessage'] !== '') {
             $script = $script . $field_name . ": " . $field_errorMessage;
         }
     }
     $script .= "},";
     $script .= "groups: getGroups()," . "focusCleanup: true," . "highlight: function(element, errorClass, validClass) {" . "\$(element).closest('.gfield').addClass(errorClass).removeClass(validClass);" . "}," . "unhighlight: function(element, errorClass, validClass) {" . "\$(element).closest('.gfield').removeClass(errorClass).addClass(validClass);" . "}," . "invalidHandler: function(event, validator) {" . "gf_submitting_" . $form['id'] . " = false;" . "}" . "});" . "})(jQuery);";
     self::log_debug('Script is: ' . $script);
     GFFormDisplay::add_init_script($form['id'], 'gf_js_validate', GFFormDisplay::ON_PAGE_RENDER, $script);
     return $form;
 }
开发者ID:cubetech,项目名称:wpplugin.gravity-forms-javascript-validation,代码行数:20,代码来源:gravity-forms-js-validate.php

示例9: validation

 public function validation($validation_result)
 {
     if (!GFFormDisplay::is_last_page($validation_result['form'])) {
         return $validation_result;
     }
     $has_authorize = $this->payment_method_is_overridden('authorize');
     $has_subscribe = $this->payment_method_is_overridden('subscribe');
     if (!$has_authorize && !$has_subscribe) {
         return $validation_result;
     }
     //Getting submission data
     $form = $validation_result["form"];
     $entry = GFFormsModel::create_lead($form);
     $feed = $this->get_payment_feed($entry, $form);
     if (!$feed) {
         return $validation_result;
     }
     $do_authorization = $has_authorize && $feed["meta"]["transactionType"] == "product";
     $do_subscription = $has_subscribe && $feed["meta"]["transactionType"] == "subscription";
     if (!$do_authorization && !$do_subscription) {
         return $validation_result;
     }
     $submission_data = $this->get_submission_data($feed, $form, $entry);
     //Running an authorization only transaction if function is implemented and this is a single payment
     if ($do_authorization) {
         $this->authorization = $this->authorize($feed, $submission_data, $form, $entry);
     } else {
         if ($do_subscription) {
             $subscription = $this->subscribe($feed, $submission_data, $form, $entry);
             $this->authorization["is_authorized"] = $subscription["is_success"];
             $this->authorization["error_message"] = rgar($subscription, "error_message");
             $this->authorization["subscription"] = $subscription;
         }
     }
     $this->authorization["feed"] = $feed;
     $this->authorization["submission_data"] = $submission_data;
     if (!$this->authorization["is_authorized"]) {
         $validation_result = $this->get_validation_result($validation_result, $this->authorization);
         //Setting up current page to point to the credit card page since that will be the highlighted field
         GFFormDisplay::set_current_page($validation_result["form"]["id"], $validation_result["credit_card_page"]);
     }
     return $validation_result;
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:43,代码来源:class-gf-payment-addon.php

示例10: refresh_field_preview

 public static function refresh_field_preview()
 {
     check_ajax_referer('rg_refresh_field_preview', 'rg_refresh_field_preview');
     $field_json = stripslashes_deep($_POST['field']);
     $field_properties = GFCommon::json_decode($field_json, true);
     $field = GF_Fields::create($field_properties);
     $form_id = absint($_POST['formId']);
     $form = GFFormsModel::get_form_meta($form_id);
     require_once GFCommon::get_base_path() . '/form_display.php';
     $field_content = GFFormDisplay::get_field_content($field, '', true, $form_id, $form);
     $args['fieldString'] = $field_content;
     $args_json = json_encode($args);
     die($args_json);
 }
开发者ID:sbayer55,项目名称:The-Road-Gallery,代码行数:14,代码来源:form_detail.php

示例11: get_form


//.........这里部分代码省略.........
             // Separate the CSS classes.
             $form_css_classes = explode(' ', $form_css_class);
             // Append _wrapper to each class.
             foreach ($form_css_classes as &$wrapper_class) {
                 $wrapper_class .= '_wrapper';
             }
             // Merge back into a string.
             $custom_wrapper_css_class = ' ' . implode(' ', $form_css_classes);
         }
         $form_string .= "\n                <div class='{$wrapper_css_class}{$custom_wrapper_css_class}' id='gform_wrapper_{$form_id}' " . $style . '>';
         $default_anchor = $has_pages || $ajax ? true : false;
         $use_anchor = gf_apply_filters(array('gform_confirmation_anchor', $form_id), $default_anchor, $form);
         if ($use_anchor !== false) {
             $form_string .= "<a id='gf_{$form_id}' class='gform_anchor' ></a>";
             $action .= "#gf_{$form_id}";
         }
         $target = $ajax ? "target='gform_ajax_frame_{$form_id}'" : '';
         $form_css_class = !empty($form['cssClass']) ? "class='{$form_css_class}'" : '';
         $action = esc_url($action);
         $form_string .= gf_apply_filters(array('gform_form_tag', $form_id), "<form method='post' enctype='multipart/form-data' {$target} id='gform_{$form_id}' {$form_css_class} action='{$action}'>", $form);
         if ($display_title || $display_description) {
             $form_string .= "\n                        <div class='gform_heading'>";
             if ($display_title) {
                 $form_string .= "\n                            <h3 class='gform_title'>" . $form['title'] . '</h3>';
             }
             if ($display_description) {
                 $form_string .= "\n                            <span class='gform_description'>" . rgar($form, 'description') . '</span>';
             }
             $form_string .= '
                     </div>';
         }
         /* If the form was submitted, has multiple pages and is invalid, set the current page to the first page with an invalid field. */
         if ($has_pages && $is_postback && !$is_valid) {
             self::set_current_page($form_id, GFFormDisplay::get_first_page_with_error($form));
         }
         $current_page = self::get_current_page($form_id);
         if ($has_pages && !$is_admin) {
             if ($form['pagination']['type'] == 'percentage') {
                 $form_string .= self::get_progress_bar($form, $current_page, $confirmation_message);
             } else {
                 if ($form['pagination']['type'] == 'steps') {
                     $form_string .= self::get_progress_steps($form, $current_page);
                 }
             }
         }
         if ($is_postback && !$is_valid) {
             $validation_message = "<div class='validation_error'>" . esc_html__('There was a problem with your submission.', 'gravityforms') . ' ' . esc_html__('Errors have been highlighted below.', 'gravityforms') . '</div>';
             $form_string .= gf_apply_filters(array('gform_validation_message', $form_id), $validation_message, $form);
         }
         $form_string .= "\n                        <div class='gform_body'>";
         //add first page if this form has any page fields
         if ($has_pages) {
             $style = self::is_page_active($form_id, 1) ? '' : "style='display:none;'";
             $class = !empty($form['firstPageCssClass']) ? " {$form['firstPageCssClass']}" : '';
             $class = esc_attr($class);
             $form_string .= "<div id='gform_page_{$form_id}_1' class='gform_page{$class}' {$style}>\n                                    <div class='gform_page_fields'>";
         }
         $description_class = rgar($form, 'descriptionPlacement') == 'above' ? 'description_above' : 'description_below';
         $sublabel_class = rgar($form, 'subLabelPlacement') == 'above' ? 'form_sublabel_above' : 'form_sublabel_below';
         $form_string .= "<ul id='gform_fields_{$form_id}' class='" . GFCommon::get_ul_classes($form) . "'>";
         if (is_array($form['fields'])) {
             foreach ($form['fields'] as $field) {
                 /* @var GF_Field $field */
                 $field->conditionalLogicFields = self::get_conditional_logic_fields($form, $field->id);
                 if (is_array($submitted_values)) {
                     $field_value = rgar($submitted_values, $field->id);
开发者ID:fjbeteiligung,项目名称:development,代码行数:67,代码来源:form_display.php

示例12: should_field_be_validated

 function should_field_be_validated($form, $field)
 {
     if ($field['pageNumber'] != GFFormDisplay::get_source_page($form['id'])) {
         return false;
     }
     // if no limits provided for this field
     if (!$this->get_field_limits($field['id'])) {
         return false;
     }
     // or if this field is not a checkbox
     if (RGFormsModel::get_input_type($field) != 'checkbox') {
         return false;
     }
     // or if this field is hidden
     if (RGFormsModel::is_field_hidden($form, $field, array())) {
         return false;
     }
     return true;
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:19,代码来源:gf-limit-checkboxes.php

示例13: add_init_script

 function add_init_script($return)
 {
     $start_field_format = false;
     $end_field_format = false;
     foreach ($this->form['fields'] as &$field) {
         if ($field['id'] == $this->start_field_id) {
             $start_field_format = $field['dateFormat'] ? $field['dateFormat'] : 'mdy';
         }
         if ($field['id'] == $this->end_field_id) {
             $end_field_format = $field['dateFormat'] ? $field['dateFormat'] : 'mdy';
         }
     }
     $script = " \n\t\t\n\t\tnew gwdc({\n                formId:             {$this->form['id']},\n                startFieldId:       {$this->start_field_id},\n                startDateFormat:    '{$start_field_format}',\n                endFieldId:         {$this->end_field_id},\n                endDateFormat:      '{$end_field_format}',\n                countFieldId:       {$this->count_field_id},\n                countAdjust:        {$this->count_adjust}\n            });\n\t\t\t\n\t\t\t";
     $slug = implode('_', array('gw_display_count', $this->start_field_id, $this->end_field_id, $this->count_field_id));
     // GFFormDisplay::add_init_script( $this->form['id'], 'gw_display_count_' . $this->count_field_id, GFFormDisplay::ON_PAGE_RENDER, $script );
     GFFormDisplay::add_init_script($this->form['id'], $slug, GFFormDisplay::ON_PAGE_RENDER, $script);
     // remove filter so init script is not output on subsequent forms
     remove_filter('gform_init_scripts_footer', array(&$this, 'add_init_script'));
     return $return;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:20,代码来源:yearsBetweenDates.php

示例14: get_form

    function get_form($options)
    {
        global $woocommerce;
        $product = null;
        if (function_exists('get_product')) {
            $product = get_product($this->product_id);
        } else {
            $product = new WC_Product($this->product_id);
        }
        extract(shortcode_atts(array('display_title' => true, 'display_description' => true, 'display_inactive' => false, 'field_values' => false, 'ajax' => false, 'tabindex' => 1, 'label_subtotal' => __('Subtotal', 'wc_gf_addons'), 'label_options' => __('Options', 'wc_gf_addons'), 'label_total' => __('Total', 'wc_gf_addons'), 'disable_label_subtotal' => 'no', 'disable_label_options' => 'no', 'disable_label_total' => 'no', 'disable_calculations' => 'no'), $options));
        //Get the form meta so we can make sure the form exists.
        $form_meta = RGFormsModel::get_form_meta($this->form_id);
        if (!empty($form_meta)) {
            if (!empty($_POST)) {
                $_POST['gform_submit'] = isset($_POST['gform_old_submit']) ? $_POST['gform_old_submit'] : '';
                $_POST['gform_old_submit'] = $_POST['gform_submit'];
            }
            $form = RGForms::get_form($this->form_id, $display_title, $display_description, $display_inactive, $field_values, $ajax, $tabindex);
            unset($_POST['gform_submit']);
            $form = str_replace('</form>', '', $form);
            $form = str_replace('gform_submit', 'gform_old_submit', $form);
            $this->current_page = GFFormDisplay::get_current_page($this->form_id);
            $this->next_page = $this->current_page + 1;
            $this->previous_page = $this->current_page - 1;
            $this->next_page = $this->next_page > $this->get_max_page_number($form_meta) ? 0 : $this->next_page;
            if ($product->product_type == 'variable' || $product->product_type == 'variable-subscription') {
                echo '<div class="gform_variation_wrapper gform_wrapper single_variation_wrap">';
            } else {
                echo '<div class="gform_variation_wrapper gform_wrapper">';
            }
            if ($product->is_type('variable')) {
                //echo '<input type="hidden" name="add-to-cart" value="variation" />';
                echo '<input type="hidden" id="product_id" name="product_id" value="' . $this->product_id . '" />';
            } elseif ($product->has_child()) {
                //echo '<input type="hidden" name="add-to-cart" value="group" />';
                echo '<input type="hidden" id="product_id" name="product_id" value="' . $this->product_id . '" />';
            } else {
                //echo '<input type="hidden" name="add-to-cart" value="' . $this->product_id . '" />';
                echo '<input type="hidden" id="product_id" name="product_id" value="' . $this->product_id . '" />';
            }
            if (wc_is_21x()) {
                wp_nonce_field('add_to_cart');
            } else {
                $woocommerce->nonce_field('add_to_cart');
            }
            echo '<a id="_form_' . $this->form_id . '" href="#_form_' . $this->form_id . '" class="gform_anchor"></a>';
            echo $form;
            echo '<input type="hidden" name="gform_form_id" id="gform_form_id" value="' . $this->form_id . '" />';
            echo '<input type="hidden" id="woocommerce_get_action" value="" />';
            echo '<input type="hidden" id="woocommerce_product_base_price" value="' . $product->get_price() . '" />';
            $description_class = rgar($form_meta, "descriptionPlacement") == "above" ? "description_above" : "description_below";
            ?>

			<?php 
            $this->on_print_scripts();
            if ($disable_calculations == 'no') {
                ?>

				<div class="product_totals">
					<ul id="gform_totals_<?php 
                echo $this->form_id;
                ?>
" class="gform_fields <?php 
                echo $form_meta['labelPlacement'] . ' ' . $description_class;
                ?>
">
						<li class="gfield" <?php 
                if ($disable_label_subtotal == 'yes') {
                    echo 'style="display:none;"';
                }
                ?>
 >
							<label class="gfield_label"><?php 
                echo $label_subtotal;
                ?>
</label>
							<div class="ginput_container">
								<span class="formattedBasePrice ginput_total"></span>
							</div>
						</li>
						<li class="gfield" <?php 
                if ($disable_label_options == 'yes') {
                    echo 'style="display:none;"';
                }
                ?>
 >
							<label class="gfield_label"><?php 
                echo $label_options;
                ?>
</label>
							<div class="ginput_container">
								<span class="formattedVariationTotal ginput_total"></span>
							</div>
						</li>
						<li class="gfield" <?php 
                if ($disable_label_total == 'yes') {
                    echo 'style="display:none;"';
                }
                ?>
 >
//.........这里部分代码省略.........
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:101,代码来源:gravityforms-product-addons-form.php

示例15: esc_html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php 
echo esc_html($form['title']);
?>
</title>
<style type="text/css">
body {
	padding: 0;
	font-family: sans-serif;
	font-size: 13px;
}
</style>
</head>
<body>
<?php 
GFFormDisplay::print_form_scripts($form_id, false);
// ajax = false
gravity_form($form_id, $display_title, $display_description);
wp_footer();
?>
</body>
</html>
开发者ID:goapp-ro,项目名称:gravity-forms-iframe,代码行数:25,代码来源:gravity-forms-iframe.php


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