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


PHP GF_Fields类代码示例

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


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

示例1: get_field_array

 /**
  * Return a Gravity Forms field array, whether using GF 1.9 or not
  *
  * @since 1.7
  *
  * @param array|GF_Fields $field Gravity Forms field or array
  * @return array Array version of $field
  */
 public static function get_field_array($field)
 {
     if (class_exists('GF_Fields')) {
         $field_object = GF_Fields::create($field);
         // Convert the field object in 1.9 to an array for backward compatibility
         $field_array = get_object_vars($field_object);
     } else {
         $field_array = $field;
     }
     return $field_array;
 }
开发者ID:roarmoser,项目名称:gv1,代码行数:19,代码来源:class-common.php

示例2: __construct

 /**
  * Construct and intialize custom Gravity Forms fields.
  */
 public function __construct()
 {
     // Enable credit card field
     add_filter('gform_enable_credit_card_field', '__return_true');
     // Register custom fields
     if (Pronamic_WP_Pay_Class::method_exists('GF_Fields', 'register')) {
         GF_Fields::register(new Pronamic_WP_Pay_Extensions_GravityForms_PaymentMethodsField());
         GF_Fields::register(new Pronamic_WP_Pay_Extensions_GravityForms_IssuersField());
     }
     // Add extra fields settings
     add_action('gform_field_standard_settings', array($this, 'field_standard_settings'), 10, 2);
 }
开发者ID:wp-pay-extensions,项目名称:gravityforms,代码行数:15,代码来源:Fields.php

示例3: init

 /**
  * Hook some stuffs!
  */
 static function init()
 {
     add_filter('gform_add_field_buttons', [__CLASS__, 'add_field_buttons']);
     add_filter('gform_field_type_title', [__CLASS__, 'field_title']);
     add_filter('gform_field_input', [__CLASS__, 'field'], 10, 5);
     add_action('gform_field_standard_settings', [__CLASS__, 'settings'], 10, 2);
     add_action('gform_editor_js_set_default_values', [__CLASS__, 'field_edit_defaults']);
     add_action('gform_editor_js', [__CLASS__, 'editor_js']);
     add_action('gform_enqueue_scripts', [__CLASS__, 'enqueue_scripts'], 10, 2);
     add_action('gform_after_submission', [__CLASS__, 'after_submission'], 1, 2);
     add_filter('gform_save_field_value', [__CLASS__, 'save_field_value'], 10, 5);
     add_action('gform_update_post/setup_form', [__CLASS__, 'capture_post_id']);
     add_action('gform_loaded', function () {
         require __DIR__ . '/TermSelectField.php';
         \GF_Fields::register(new TermSelectField());
     });
 }
开发者ID:oomphinc,项目名称:gravity-forms-term-select,代码行数:20,代码来源:Plugin.php

示例4: array

        return array('conditional_logic_field_setting', 'prepopulate_field_setting', 'error_message_setting', 'label_setting', 'label_placement_setting', 'admin_label_setting', 'post_title_template_setting', 'post_status_setting', 'post_category_setting', 'size_setting', 'rules_setting', 'visibility_setting', 'default_value_setting', 'placeholder_setting', 'description_setting', 'css_class_setting', 'post_author_setting', 'post_format_setting');
    }
    public function is_conditional_logic_supported()
    {
        return true;
    }
    public function get_field_input($form, $value = '', $entry = null)
    {
        $form_id = $form['id'];
        $is_entry_detail = $this->is_entry_detail();
        $is_form_editor = $this->is_form_editor();
        $id = (int) $this->id;
        $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
        $value = esc_attr($value);
        $size = $this->size;
        $class_suffix = $is_entry_detail ? '_admin' : '';
        $class = $size . $class_suffix;
        $class = esc_attr($class);
        $disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
        $tabindex = $this->get_tabindex();
        $logic_event = $this->get_conditional_logic_event('keyup');
        $placeholder_attribute = $this->get_field_placeholder_attribute();
        return "<div class='ginput_container ginput_container_post_title'>\n\t\t\t\t\t<input name='input_{$id}' id='{$field_id}' type='text' value='{$value}' class='{$class}' {$tabindex} {$logic_event} {$placeholder_attribute} {$disabled_text}/>\n\t\t\t\t</div>";
    }
    public function allow_html()
    {
        return true;
    }
}
GF_Fields::register(new GF_Field_Post_Title());
开发者ID:arobbins,项目名称:davis,代码行数:30,代码来源:class-gf-field-post-title.php

示例5: Choice

?>
), new Choice(<?php 
echo json_encode(esc_html__('Third Choice', 'gravityforms'));
?>
));
				}
				break;
			case "address" :

				if (!field.label)
					field.label = <?php 
echo json_encode(esc_html__('Address', 'gravityforms'));
?>
;
				field.addressType = <?php 
echo json_encode(GF_Fields::get('address')->get_default_address_type(rgget('id')));
?>
;
				field.inputs = [new Input(field.id + 0.1, <?php 
echo json_encode(gf_apply_filters(array('gform_address_street', rgget('id')), esc_html__('Street Address', 'gravityforms'), rgget('id')));
?>
), new Input(field.id + 0.2, <?php 
echo json_encode(gf_apply_filters(array('gform_address_street2', rgget('id')), esc_html__('Address Line 2', 'gravityforms'), rgget('id')));
?>
), new Input(field.id + 0.3, <?php 
echo json_encode(gf_apply_filters(array('gform_address_city', rgget('id')), esc_html__('City', 'gravityforms'), rgget('id')));
?>
),
					new Input(field.id + 0.4, <?php 
echo json_encode(gf_apply_filters(array('gform_address_state', rgget('id')), __('State / Province', 'gravityforms'), rgget('id')));
?>
开发者ID:Garth619,项目名称:Femi9,代码行数:31,代码来源:js.php

示例6: array

    {
        return array();
    }
    public function get_field_input($form, $value = '', $entry = null)
    {
        $form_id = $form['id'];
        $is_entry_detail = $this->is_entry_detail();
        $is_form_editor = $this->is_form_editor();
        $id = (int) $this->id;
        $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
        $currency = $is_entry_detail && !empty($entry) ? $entry['currency'] : '';
        $price = !empty($value) ? $value : $this->basePrice;
        if (empty($price)) {
            $price = 0;
        }
        return "<div class='ginput_container'>\n\t\t\t\t\t<input type='hidden' name='input_{$id}' value='{$price}' class='gform_hidden'/>\n\t\t\t\t\t<span class='ginput_shipping_price' id='{$field_id}'>" . GFCommon::to_money($price, $currency) . '</span>
				</div>';
    }
    public function get_value_entry_detail($value, $currency = '', $use_text = false, $format = 'html', $media = 'screen')
    {
        return GFCommon::to_money($value, $currency);
    }
    public function sanitize_settings()
    {
        parent::sanitize_settings();
        $price_number = GFCommon::to_number($this->basePrice);
        $this->basePrice = GFCommon::to_money($price_number);
    }
}
GF_Fields::register(new GF_Field_SingleShipping());
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:30,代码来源:class-gf-field-singleshipping.php

示例7: captcha_image

 public static function captcha_image()
 {
     $field_properties = array('type' => 'captcha', 'simpleCaptchaSize' => $_GET['size'], 'simpleCaptchaFontColor' => $_GET['fg'], 'simpleCaptchaBackgroundColor' => $_GET['bg']);
     /* @var GF_Field_CAPTCHA $field */
     $field = GF_Fields::create($field_properties);
     if ($_GET['type'] == 'math') {
         $captcha = $field->get_math_captcha($_GET['pos']);
     } else {
         $captcha = $field->get_captcha();
     }
     @ini_set('memory_limit', '256M');
     $image = imagecreatefrompng($captcha['path']);
     include_once ABSPATH . 'wp-admin/includes/image-edit.php';
     wp_stream_image($image, 'image/png', 0);
     imagedestroy($image);
     die;
 }
开发者ID:kidaak,项目名称:gravityforms,代码行数:17,代码来源:gravityforms.php

示例8: get_honeypot_field

 private static function get_honeypot_field($form)
 {
     $max_id = self::get_max_field_id($form);
     $labels = self::get_honeypot_labels();
     $properties = array('type' => 'honeypot', 'label' => $labels[rand(0, 3)], 'id' => $max_id + 1, 'cssClass' => 'gform_validation_container', 'description' => __('This field is for validation purposes and should be left unchanged.', 'gravityforms'));
     $field = GF_Fields::create($properties);
     return $field;
 }
开发者ID:timk85,项目名称:DIT,代码行数:8,代码来源:form_display.php

示例9: absint

        parent::sanitize_settings();
        $this->maxRows = absint($this->maxRows);
    }
    public function get_value_export($entry, $input_id = '', $use_text = false, $is_csv = false)
    {
        if (empty($input_id)) {
            $input_id = $this->id;
        } elseif (!ctype_digit($input_id)) {
            $field_id_array = explode('.', $input_id);
            $input_id = rgar($field_id_array, 0);
            $column_num = rgar($field_id_array, 1);
        }
        $value = rgar($entry, $input_id);
        if (empty($value) || $is_csv) {
            return $value;
        }
        $list_values = $column_values = unserialize($value);
        if (isset($column_num) && is_numeric($column_num) && $this->enableColumns) {
            $column = rgars($this->choices, "{$column_num}/text");
            $column_values = array();
            foreach ($list_values as $value) {
                $column_values[] = rgar($value, $column);
            }
        } elseif ($this->enableColumns) {
            return json_encode($list_values);
        }
        return GFCommon::implode_non_blank(', ', $column_values);
    }
}
GF_Fields::register(new GF_Field_List());
开发者ID:brendo10x,项目名称:site-estagio,代码行数:30,代码来源:class-gf-field-list.php

示例10: get_full_name

 /**
  * Returns the combined value of the specified Name field.
  *
  * @param array $entry
  * @param string $field_id
  *
  * @return string
  */
 public function get_full_name($entry, $field_id)
 {
     return GF_Fields::get('name')->get_value_export($entry, $field_id);
 }
开发者ID:fjbeteiligung,项目名称:development,代码行数:12,代码来源:class-gf-addon.php

示例11: get_field_input

    }
    public function get_field_input($form, $value = '', $entry = null)
    {
        $form_id = absint($form['id']);
        $is_entry_detail = $this->is_entry_detail();
        $is_form_editor = $this->is_form_editor();
        $html_input_type = 'text';
        if ($this->enablePasswordInput && !$is_entry_detail) {
            $html_input_type = 'password';
        }
        $logic_event = !$is_form_editor && !$is_entry_detail ? $this->get_conditional_logic_event('keyup') : '';
        $id = (int) $this->id;
        $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
        $value = esc_attr($value);
        $size = $this->size;
        $class_suffix = $is_entry_detail ? '_admin' : '';
        $class = $size . $class_suffix;
        $max_length = is_numeric($this->maxLength) ? "maxlength='{$this->maxLength}'" : '';
        $tabindex = $this->get_tabindex();
        $disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
        $placeholder_attribute = $this->get_field_placeholder_attribute();
        $input = "<input name='input_{$id}' id='{$field_id}' type='{$html_input_type}' value='{$value}' class='{$class}' {$max_length} {$tabindex} {$logic_event} {$placeholder_attribute} {$disabled_text}/>";
        return sprintf("<div class='ginput_container'>%s</div>", $input);
    }
    public function allow_html()
    {
        return in_array($this->type, array('post_custom_field', 'post_tags')) ? true : false;
    }
}
GF_Fields::register(new GF_Field_Text());
开发者ID:beyond-z,项目名称:braven,代码行数:30,代码来源:class-gf-field-text.php

示例12: get_field_content

        $tooltips['form_field_repeater_end_hideButtons'] = "If enabled, no add and remove buttons will be displayed. This is useful if you plan on using custom javascript to trigger the repeater.";
        return $tooltips;
    }
    public function get_field_content($value, $force_frontend_label, $form)
    {
        if (is_admin()) {
            $admin_buttons = $this->get_admin_buttons();
            $field_content = "{$admin_buttons}\n\t\t\t\t\t\t\t<div class=\"gf-pagebreak-end gf-pagebreak-container gf-repeater-end\">\n\t\t\t\t\t\t\t\t<div class=\"gf-pagebreak-text-before\">end repeater</div>\n\t\t\t\t\t\t\t\t<div class=\"gf-pagebreak-text-main\"><span>REPEATER</span></div>\n\t\t\t\t\t\t\t\t<div class=\"gf-pagebreak-text-after\">end of repeater</div>\n\t\t\t\t\t\t\t</div>";
        } else {
            $add_html = $this->add;
            $remove_html = $this->remove;
            $hideButtons = $this->hideButtons;
            $tabindex = GFCommon::get_tabindex();
            if (empty($add_html)) {
                $add_html = "<img class=\"gf_repeater_add_default\" alt=\"+\" src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\">";
            }
            if (empty($remove_html)) {
                $remove_html = "<img class=\"gf_repeater_remove_default\" alt=\"-\" src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\">";
            }
            $field_content = "<div class=\"ginput_container ginput_container_repeater-end\">\n";
            if (!$hideButtons) {
                $field_content .= "<span class=\"gf_repeater_remove\" {$tabindex}>{$remove_html}</span>";
                $field_content .= "<span class=\"gf_repeater_add\" {$tabindex}>{$add_html}</span>";
            }
            $field_content .= "</div>";
        }
        return $field_content;
    }
}
GF_Fields::register(new GF_Field_Repeater_End());
开发者ID:kodie,项目名称:gravityforms-repeater,代码行数:30,代码来源:class-gf-field-repeater-end.php

示例13: str_replace

                $address_qs = str_replace($line_break, ' ', $address);
                //replacing <br/> and \n with spaces
                $address_qs = urlencode($address_qs);
                $address .= "<br/><a href='http://maps.google.com/maps?q={$address_qs}' target='_blank' class='map-it-link'>Map It</a>";
            }
            return $address;
        } else {
            return '';
        }
    }
    public function get_input_property($input_id, $property_name)
    {
        $input = GFFormsModel::get_input($this, $input_id);
        return rgar($input, $property_name);
    }
    public function sanitize_settings()
    {
        parent::sanitize_settings();
        if ($this->addressType) {
            $this->addressType = wp_strip_all_tags($this->addressType);
        }
        if ($this->defaultCountry) {
            $this->defaultCountry = wp_strip_all_tags($this->defaultCountry);
        }
        if ($this->defaultProvince) {
            $this->defaultProvince = wp_strip_all_tags($this->defaultProvince);
        }
    }
}
GF_Fields::register(new GF_Field_Address());
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:30,代码来源:class-gf-field-address.php

示例14: get_field_input

        return true;
    }
    public function get_field_input($form, $value = '', $entry = null)
    {
        $form_id = $form['id'];
        $is_entry_detail = $this->is_entry_detail();
        $is_form_editor = $this->is_form_editor();
        $id = (int) $this->id;
        $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
        $value = esc_textarea($value);
        $size = $this->size;
        $class_suffix = $is_entry_detail ? '_admin' : '';
        $class = $size . $class_suffix;
        $class = esc_attr($class);
        $disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
        $tabindex = $this->get_tabindex();
        $logic_event = $this->get_conditional_logic_event('keyup');
        $placeholder_attribute = $this->get_field_placeholder_attribute();
        return "<div class='ginput_container'>\n\t\t\t\t\t<textarea name='input_{$id}' id='{$field_id}' class='textarea {$class}' {$tabindex} {$logic_event} {$placeholder_attribute} {$disabled_text} rows='10' cols='50'>{$value}</textarea>\n\t\t\t\t</div>";
    }
    public function allow_html()
    {
        return true;
    }
    public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br)
    {
        return $format == 'html' && !$nl2br ? nl2br($value) : $value;
    }
}
GF_Fields::register(new GF_Field_Post_Content());
开发者ID:ronenrer,项目名称:litaf,代码行数:30,代码来源:class-gf-field-post-content.php

示例15: mt_rand

        }
        $word = $captcha->generate_random_word();
        $prefix = mt_rand();
        $filename = $captcha->generate_image($prefix, $word);
        $url = RGFormsModel::get_upload_url('captcha') . '/' . $filename;
        $path = $captcha->tmp_dir . $filename;
        if (GFCommon::is_ssl() && strpos($url, 'http:') !== false) {
            $url = str_replace('http:', 'https:', $url);
        }
        return array('path' => $path, 'url' => $url, 'height' => $captcha->img_size[1], 'width' => $captcha->img_size[0], 'prefix' => $prefix);
    }
    private function hex2rgb($color)
    {
        if ($color[0] == '#') {
            $color = substr($color, 1);
        }
        if (strlen($color) == 6) {
            list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
        } elseif (strlen($color) == 3) {
            list($r, $g, $b) = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]);
        } else {
            return false;
        }
        $r = hexdec($r);
        $g = hexdec($g);
        $b = hexdec($b);
        return array($r, $g, $b);
    }
}
GF_Fields::register(new GF_Field_CAPTCHA());
开发者ID:renztoygwapo,项目名称:lincoln,代码行数:30,代码来源:class-gf-field-captcha.php


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