本文整理匯總了PHP中GFCommon::get_tabindex方法的典型用法代碼示例。如果您正苦於以下問題:PHP GFCommon::get_tabindex方法的具體用法?PHP GFCommon::get_tabindex怎麽用?PHP GFCommon::get_tabindex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GFCommon
的用法示例。
在下文中一共展示了GFCommon::get_tabindex方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: acquirer_field_input
/**
* Acquirrer field input
*
* @param string $field_content
* @param string $field
* @param string $value
* @param string $lead_id
* @param string $form_id
*/
public static function acquirer_field_input($field_content, $field, $value, $lead_id, $form_id)
{
$type = RGFormsModel::get_input_type($field);
if (Pronamic_WP_Pay_Extensions_GravityForms_IssuerDropDown::TYPE === $type) {
$id = $field['id'];
$field_id = IS_ADMIN || 0 === $form_id ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
$class_suffix = RG_CURRENT_VIEW === 'entry' ? '_admin' : '';
$size = rgar($field, 'size');
$class = $size . $class_suffix;
$css_class = trim(esc_attr($class) . ' gfield_ideal_acquirer_select');
$tab_index = GFCommon::get_tabindex();
$disabled_text = IS_ADMIN && 'entry' !== RG_CURRENT_VIEW ? "disabled='disabled'" : '';
$html = '';
$feed = get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id, true);
/**
* Developing warning:
* Don't use single quotes in the HTML you output, it is buggy in combination with SACK
*/
if (IS_ADMIN) {
if (null === $feed) {
$html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", add_query_arg('post_type', 'pronamic_pay_gf', admin_url('post-new.php')), __('Create iDEAL feed', 'pronamic_ideal'));
} else {
$html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", get_edit_post_link($feed->id), __('Edit iDEAL feed', 'pronamic_ideal'));
}
}
$html_input = '';
$html_error = '';
if (null !== $feed) {
$gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id);
if ($gateway) {
$issuer_field = $gateway->get_issuer_field();
$error = $gateway->get_error();
if (is_wp_error($error)) {
$html_error .= Pronamic_WP_Pay_Plugin::get_default_error_message();
$html_error .= '<br /><em>' . $error->get_error_message() . '</em>';
} elseif ($issuer_field) {
$choices = $issuer_field['choices'];
$options = Pronamic_WP_HTML_Helper::select_options_grouped($choices, $value);
// Double quotes are not working, se we replace them with an single quote
$options = str_replace('"', '\'', $options);
$html_input = '';
$html_input .= sprintf("<select name='input_%d' id='%s' class='%s' %s %s>", $id, $field_id, $css_class, $tab_index, $disabled_text);
$html_input .= sprintf('%s', $options);
$html_input .= sprintf('</select>');
}
}
}
if ($html_error) {
$html .= sprintf("<div class='gfield_description validation_message'>");
$html .= sprintf('%s', $html_error);
$html .= sprintf('</div>');
} else {
$html .= sprintf("<div class='ginput_container ginput_ideal'>");
$html .= sprintf('%s', $html_input);
$html .= sprintf('</div>');
}
$field_content = $html;
}
return $field_content;
}
示例2: get_field_content
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;
}
示例3: bb_click_array_field_input
function bb_click_array_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($field["type"] == "bb_click_array") {
$field_id = IS_ADMIN || $form_id == 0 ? "input_{$id}" : "input_" . $form_id . "_{$id}";
$input_name = $form_id . '_' . $field["id"];
$css = isset($field['cssClass']) ? $field['cssClass'] : "";
$disabled_text = IS_ADMIN && RG_CURRENT_VIEW != "entry" ? "disabled='disabled'" : "";
$amount = '';
$clicked = '';
if (is_array($value)) {
$amount = esc_attr(rgget($field["id"] . ".1", $value));
$clicked = rgget($field["id"] . ".5", $value);
}
$html = "<div id='{$field_id}' class='ginput_container bb-click-array-" . count($field['choices']) . " " . esc_attr($css) . "'>" . "\n";
if (is_array($field["choices"])) {
$choice_id = 0;
$tabindex = GFCommon::get_tabindex();
foreach ($field["choices"] as $choice) {
$id = $field["id"] . '_' . $choice_id;
$field_value = !empty($choice["value"]) || rgar($field, "enableChoiceValue") ? $choice["value"] : $choice["text"];
if (rgblank($amount) && RG_CURRENT_VIEW != "entry") {
$active = rgar($choice, "isSelected") ? "checked='checked'" : "";
} else {
$active = RGFormsModel::choice_value_match($field, $choice, $amount) ? "checked='checked'" : "";
}
if ($active) {
$amount = $field_value;
}
$field_class = $active ? 's-active' : 's-passive';
if (rgar($field, 'field_bb_click_array_is_product')) {
require_once GFCommon::get_base_path() . '/currency.php';
$currency = new RGCurrency(GFCommon::get_currency());
$field_value = $currency->to_money($field_value);
$field_class .= ' s-currency';
}
$html .= sprintf('<div data-clickarray-value="%s" data-choice-id="%s" class="s-html-wrapper %s" id="%s">', esc_attr($field_value), $choice_id, $field_class, $id);
$html .= sprintf('<div class="s-html-value">%s</div>', $field_value);
$html .= sprintf("<label for='choice_%s' id='label_%s'>%s</label>", $id, $id, $choice["text"]);
$html .= '</div>';
$choice_id++;
}
$onblur = !IS_ADMIN ? 'if(jQuery(this).val().replace(" ", "") == "") { jQuery(this).val("' . $other_default_value . '"); }' : '';
$onkeyup = empty($field["conditionalLogicFields"]) || IS_ADMIN ? '' : "onchange='gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ");' onkeyup='clearTimeout(__gf_timeout_handle); __gf_timeout_handle = setTimeout(\"gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ")\", 300);'";
$value_exists = RGFormsModel::choices_value_match($field, $field["choices"], $value);
$other_label = empty($field['field_bb_click_array_other_label']) ? 'My Best Gift' : $field['field_bb_click_array_other_label'];
$other_class = rgar($field, 'enableOtherChoice') ? '' : 'hide';
$html .= "<label for='input_{$field["formId"]}_{$field["id"]}_1' class='ginput_bb_click_array_other_label " . $other_class . "'>" . $other_label . "</label>";
$other_class .= rgar($field, 'field_bb_click_array_is_product') ? ' ginput_amount gfield_price gfield_price_' . $field['formId'] . '_' . $field['id'] . '_1 gfield_product_' . $field['formId'] . '_' . $field['id'] . '_1' : '';
$html .= "<input id='input_{$field["formId"]}_{$field["id"]}_1' name='input_{$field["id"]}_1' type='text' value='" . esc_attr($amount) . "' class='ginput_bb ginput_click_array_other " . $other_class . " " . $field['size'] . "' onblur='{$onblur}' {$tabindex} {$onkeyup} {$disabled_text}>";
$html .= "<input id='input_{$field["formId"]}_{$field["id"]}_5' name='input_{$field["id"]}_5' type='hidden' value='" . esc_attr($clicked) . "' class='ginput_bb ginput_click_array_clicked'>";
}
$html .= "</div>";
return $html;
}
return $input;
}
示例4: wps_tos_field_input
function wps_tos_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($field["type"] == "tos") {
$max_chars = "";
if (!IS_ADMIN && !empty($field["maxLength"]) && is_numeric($field["maxLength"])) {
$max_chars = self::get_counter_script($form_id, $field_id, $field["maxLength"]);
}
$input_name = $form_id . '_' . $field["id"];
$tabindex = GFCommon::get_tabindex();
$css = isset($field['cssClass']) ? $field['cssClass'] : '';
return sprintf("<div class='ginput_container'><textarea readonly name='input_%s' id='%s' class='textarea gform_tos %s' {$tabindex} rows='10' cols='50'>%s</textarea></div>{$max_chars}", $field["id"], 'tos-' . $field['id'], $field["type"] . ' ' . esc_attr($css) . ' ' . $field['size'], esc_html($value));
}
return $input;
}
示例5: wysiwyg_field_input
function wysiwyg_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($this->is_wysiwyg($field)) {
$input_id = 'input_' . $form_id . '_' . $field["id"];
if (is_admin()) {
$tabindex = GFCommon::get_tabindex();
return sprintf("<div class='ginput_container'><textarea readonly name='input_%s' id='input_%s' class='textarea gform_wysiwyg' {$tabindex} rows='10' cols='50'>WYSIWYG editor</textarea></div>", $field["id"], 'wysiwyg-' . $field['id']);
} else {
if (array_key_exists($field["id"], $this->_wysiwygs)) {
return $this->_wysiwygs[$field["id"]];
}
return "";
}
}
return false;
}
示例6: wysiwyg_field_input
function wysiwyg_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($this->is_wysiwyg($field)) {
$input_id = 'input_' . $form_id . '_' . $field["id"];
if (is_admin()) {
$tabindex = GFCommon::get_tabindex();
return sprintf("<div class='ginput_container'><textarea readonly name='input_%s' id='input_%s' class='textarea gform_wysiwyg' {$tabindex} rows='10' cols='50'>WYSIWYG editor</textarea></div>", $field["id"], 'wysiwyg-' . $field['id']);
} else {
$media_buttons = strpos($field["cssClass"], 'media_buttons') !== false;
$args = array('textarea_name' => 'input_' . $field["id"], 'wpautop' => true, 'media_buttons' => $media_buttons, 'editor_class' => 'frontend', 'textarea_rows' => 5, 'tabindex' => 0);
ob_start();
wp_editor($value, $input_id, $args);
$html = ob_get_contents();
ob_end_clean();
return "<div class='ginput_container'>" . $html . "</div>";
}
}
return false;
}
示例7: deprecated_envoy_field_field_input
function deprecated_envoy_field_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($field["type"] == "envoyrecharge") {
$max_chars = "";
if (!IS_ADMIN && !empty($field["maxLength"]) && is_numeric($field["maxLength"])) {
$max_chars = self::get_counter_script($form_id, $field_id, $field["maxLength"]);
}
$input_name = $form_id . '_' . $field["id"];
$tabindex = GFCommon::get_tabindex();
$css = isset($field['cssClass']) ? $field['cssClass'] : "";
//add a variable to disable a select field if admin dashboard is opened
if (IS_ADMIN) {
$disabled = 'disabled';
} else {
$disabled = '';
}
$amount = '';
$frequency = '';
$recurring = '';
if (is_array($value)) {
$amount = esc_attr(rgget($field["id"] . ".1", $value));
$frequency = rgget($field["id"] . ".2", $value);
$recurring = rgget('input_' . $field['id'] . '.5') == "recurring" ? "checked='checked'" : "";
}
$recur_label = empty($field['field_envoyrecharge_recur_label']) ? 'Yes, I want to make a recurring donation' : $field['field_envoyrecharge_recur_label'];
$recur_hidden = !empty($field['field_envoyrecharge_recurring_disabled']) ? ' style="display: none;"' : '';
$html = "<div class='ginput_container'>" . "\n";
$html .= '<input name="input_' . $field['id'] . '.1" id="input_' . $input_name . '_1" class="gform_ech ginput_amount ' . $field["type"] . ' ' . esc_attr($css) . ' ' . $field['size'] . '" type="text" ' . $disabled . ' value="' . $amount . '">';
$html .= '<div class="gform_envoyrecharge_recurring envoyrecharge_recur_setting"' . $recur_hidden . '><input name="input_' . $field['id'] . '.5" id="ginput_envoyrecharge_recurring_' . $field['id'] . '" type="checkbox" ' . $disabled . ' value="recurring" ' . $recurring . ' onclick="EnvoyToggleRecurring(jQuery(this));">
<label class="ginput_envoyrecharge_label" id="ginput_envoyrecharge_label_' . $field['id'] . '" for="ginput_envoyrecharge_recurring_' . $field['id'] . '">' . $recur_label . '</label></div>';
$html .= "\n <select {$disabled} data-checkbox='ginput_envoyrecharge_recurring_" . $field['id'] . "' name='input_" . $field['id'] . ".2' id='input_" . $input_name . "_2' class='select envoyrecharge_recur_setting envoyrecharge_recur_frequency gform_ech " . $field["type"] . ' ' . esc_attr($css) . ' ' . $field['size'] . "'{$recur_hidden}>" . GFCommon::get_select_choices($field, $value) . "</select>";
$html .= "</div>";
return $html;
}
return $input;
}
示例8: get_list_input
private static function get_list_input($field, $has_columns, $column, $value, $form_id)
{
$tabindex = GFCommon::get_tabindex();
$column_index = 1;
if ($has_columns && is_array(rgar($field, "choices"))) {
foreach ($field["choices"] as $choice) {
if ($choice["text"] == $column["text"]) {
break;
}
$column_index++;
}
}
$input_info = array("type" => "text");
$input_info = apply_filters("gform_column_input_{$form_id}_{$field["id"]}_{$column_index}", apply_filters("gform_column_input", $input_info, $field, rgar($column, "text"), $value, $form_id), $field, rgar($column, "text"), $value, $form_id);
switch ($input_info["type"]) {
case "select":
$input = "<select name='input_{$field["id"]}[]' {$tabindex} >";
if (!is_array($input_info["choices"])) {
$input_info["choices"] = explode(",", $input_info["choices"]);
}
foreach ($input_info["choices"] as $choice) {
if (is_array($choice)) {
$choice_value = $choice["value"];
$choice_text = $choice["text"];
$choice_selected = $choice["isSelected"];
} else {
$choice_value = $choice;
$choice_text = $choice;
$choice_selected = false;
}
$is_selected = empty($value) ? $choice_selected : $choice_value == $value;
$selected = $is_selected ? "selected='selected'" : "";
$input .= "<option value='" . esc_attr($choice_value) . "' {$selected}>" . esc_html($choice_text) . "</option>";
}
$input .= "</select>";
break;
default:
$input = "<input type='text' name='input_{$field["id"]}[]' value='" . esc_attr($value) . "' {$tabindex}/>";
break;
}
return apply_filters("gform_column_input_content_{$form_id}_{$field["id"]}_{$column_index}", apply_filters("gform_column_input_content", $input, $input_info, $field, rgar($column, "text"), $value, $form_id), $input_info, $field, rgar($column, "text"), $value, $form_id);
}
示例9: get_form_button
private static function get_form_button($form_id, $button_input_id, $button, $default_text, $class, $alt, $target_page_number)
{
$tabindex = GFCommon::get_tabindex();
$input_type = 'submit';
$onclick = "";
if (!empty($target_page_number)) {
//$onclick = "onclick='jQuery(\"#gform_target_page_number_{$form_id}\").val(\"{$target_page_number}\"); jQuery(\"#gform_{$form_id}\").trigger(\"submit\",[true]); '";
$input_type = 'button';
} else {
//to prevent multiple form submissions when button is pressed multiple times
if (GFFormsModel::is_html5_enabled()) {
$set_submitting = "if( jQuery(this).hasClass(\".disabled\") ){ window[\"gf_submitting_{$form_id}\"]=true;}";
} else {
$set_submitting = "window[\"gf_submitting_{$form_id}\"]=true;";
}
//$onclick="onclick='if(window[\"gf_submitting_{$form_id}\"]){return false;} $set_submitting '";
}
if ($button["type"] == "text" || empty($button["imageUrl"])) {
$button_text = !empty($button["text"]) ? $button["text"] : $default_text;
if (function_exists('qtranxf_getLanguage') && !empty($button["text"])) {
$button_text = apply_filters('the_title', $button_text);
}
$button_input = "<input type='{$input_type}' id='{$button_input_id}' class='{$class} btn btn-default' value='" . esc_attr($button_text) . "' {$tabindex} {$onclick}/>";
} else {
$imageUrl = $button["imageUrl"];
$button_input = "<input type='image' src='{$imageUrl}' id='{$button_input_id}' class='gform_image_button' alt='{$alt}' {$tabindex} {$onclick}/>";
}
return $button_input;
}
示例10: get_form_button
private static function get_form_button($form_id, $button_input_id, $button, $default_text, $class, $alt, $target_page_number){
$tabindex = GFCommon::get_tabindex();
$input_type='submit';
$onclick="";
if(!empty($target_page_number)){
$onclick = "onclick='jQuery(\"#gform_target_page_number_{$form_id}\").val(\"{$target_page_number}\"); jQuery(\"#gform_{$form_id}\").trigger(\"submit\",[true]); '";
$input_type='button';
}
else{
//to prevent multiple form submissions when button is pressed multiple times
if(GFFormsModel::is_html5_enabled())
$set_submitting = "if( !jQuery(\"#gform_{$form_id}\")[0].checkValidity || jQuery(\"#gform_{$form_id}\")[0].checkValidity()){window[\"gf_submitting_{$form_id}\"]=true;}";
else
$set_submitting = "window[\"gf_submitting_{$form_id}\"]=true;";
$onclick="onclick='if(window[\"gf_submitting_{$form_id}\"]){return false;} $set_submitting '";
}
if($button["type"] == "text" || empty($button["imageUrl"])){
$button_text = !empty($button["text"]) ? $button["text"] : $default_text;
$button_input = "<input type='{$input_type}' id='{$button_input_id}' class='{$class}' value='" . esc_attr($button_text) . "' {$tabindex} {$onclick}/>";
}
else{
$imageUrl = $button["imageUrl"];
$button_input= "<input type='image' src='{$imageUrl}' id='{$button_input_id}' class='gform_image_button' alt='{$alt}' {$tabindex} {$onclick}/>";
}
return $button_input;
}
示例11: get_list_input
public function get_list_input($has_columns, $column, $value, $form_id)
{
$tabindex = GFCommon::get_tabindex();
$disabled = $this->is_form_editor() ? 'disabled' : '';
$column_index = 1;
if ($has_columns && is_array($this->choices)) {
foreach ($this->choices as $choice) {
if ($choice['text'] == $column['text']) {
break;
}
$column_index++;
}
}
$input_info = array('type' => 'text');
$input_info = apply_filters("gform_column_input_{$form_id}_{$this->id}_{$column_index}", apply_filters('gform_column_input', $input_info, $this, rgar($column, 'text'), $value, $form_id), $this, rgar($column, 'text'), $value, $form_id);
switch ($input_info['type']) {
case 'select':
$input = "<select name='input_{$this->id}[]' {$tabindex} {$disabled} >";
if (!is_array($input_info['choices'])) {
$input_info['choices'] = explode(',', $input_info['choices']);
}
foreach ($input_info['choices'] as $choice) {
if (is_array($choice)) {
$choice_value = $choice['value'];
$choice_text = $choice['text'];
$choice_selected = array_key_exists('isSelected', $choice) ? $choice['isSelected'] : false;
} else {
$choice_value = $choice;
$choice_text = $choice;
$choice_selected = false;
}
$is_selected = empty($value) ? $choice_selected : $choice_value == $value;
$selected = $is_selected ? "selected='selected'" : '';
$input .= "<option value='" . esc_attr($choice_value) . "' {$selected}>" . esc_html($choice_text) . '</option>';
}
$input .= '</select>';
break;
default:
$input = "<input type='text' name='input_{$this->id}[]' value='" . esc_attr($value) . "' {$tabindex} {$disabled}/>";
break;
}
return apply_filters("gform_column_input_content_{$form_id}_{$this->id}_{$column_index}", apply_filters('gform_column_input_content', $input, $input_info, $this, rgar($column, 'text'), $value, $form_id), $input_info, $this, rgar($column, 'text'), $value, $form_id);
}
示例12: pluploader_field_input
/**
* pluploader_field_input
*
* Called by 'gform_field_input' gravity forms action.
* Add html required to render custom field
*
* @access public
* @author Ben Moody
*/
public function pluploader_field_input($input, $field, $value, $lead_id, $form_id)
{
//Init vars
$max_chars = NULL;
$container = NULL;
$plupload_container = NULL;
if ($field["type"] == "prso_gform_pluploader") {
if (!empty($field["maxLength"]) && is_numeric($field["maxLength"])) {
$max_chars = self::get_counter_script($form_id, $field_id, $field["maxLength"]);
}
$input_name = $form_id . '_' . $field["id"];
$tabindex = GFCommon::get_tabindex();
$css = isset($field['cssClass']) ? $field['cssClass'] : '';
//Cache the hidden field taht will store data on uploaded files
if (is_admin()) {
$input = "<div class='ginput_container prso_plupload'><span class='gform_drop_instructions'>Advanced Uploader</span></div>";
} else {
ob_start();
?>
<div class='ginput_container prso_plupload'><input name='input_%s' id='%s' type='hidden' /></div>
<?php
echo $this->get_exisiting_file_input_html($field["id"]);
$input = ob_get_contents();
ob_end_clean();
}
$input = sprintf($input, $field["id"], 'prso_form_pluploader_' . $field['id']);
//Cache the div element used by pluploader jquery plugin
if (!is_admin()) {
switch ($this->user_interface) {
case 'custom':
ob_start();
?>
<div id="filelist"><?php
_ex("Your browser doesn't have Flash, Silverlight or HTML5 support.", 'user alert message', 'prso_gform_pluploader');
?>
</div>
<div id='pluploader_%s'>
<a id="pickfiles" href="javascript:;">[Select files]</a>
<a id="uploadfiles" href="javascript:;">[Upload files]</a>
</div>
<?php
$container = ob_get_contents();
ob_end_clean();
break;
default:
ob_start();
?>
<div id="filelist"><?php
_ex("Your browser doesn't have Flash, Silverlight or HTML5 support.", 'user alert message', 'prso_gform_pluploader');
?>
</div>
<div id='pluploader_%s'></div>
<?php
$container = ob_get_contents();
ob_end_clean();
break;
}
$plupload_container = sprintf($container, $field["id"]);
}
//Run through filter to allow devs to move the div outside the form it they wish
$input .= apply_filters('prso_gform_pluploader_container', $plupload_container, $field, $form_id);
}
return $input;
}
示例13: get_form_button
private static function get_form_button($form_id, $button_input_id, $button, $default_text, $class, $alt, $target_page_number)
{
$tabindex = GFCommon::get_tabindex();
$input_type = 'submit';
$onclick = "";
if (!empty($target_page_number)) {
$onclick = "onclick='jQuery(\"#gform_target_page_number_{$form_id}\").val(\"{$target_page_number}\"); jQuery(\"#gform_{$form_id}\").trigger(\"submit\",[true]); '";
$input_type = 'button';
}
if ($button["type"] == "text" || empty($button["imageUrl"])) {
$button_text = !empty($button["text"]) ? $button["text"] : $default_text;
$button_input = "<input type='{$input_type}' id='{$button_input_id}' class='{$class}' value='" . esc_attr($button_text) . "' {$tabindex} {$onclick}/>";
} else {
$imageUrl = $button["imageUrl"];
$button_input = "<input type='image' src='{$imageUrl}' id='{$button_input_id}' class='gform_image_button' alt='{$alt}' {$tabindex} {$onclick}/>";
}
return $button_input;
}
示例14: get_field_input
public function get_field_input($form, $value = '', $entry = null)
{
$is_entry_detail = $this->is_entry_detail();
$is_form_editor = $this->is_form_editor();
$is_admin = $is_entry_detail || $is_form_editor;
$form_id = $form['id'];
$id = intval($this->id);
$field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
$form_id = ($is_entry_detail || $is_form_editor) && empty($form_id) ? rgget('id') : $form_id;
$disabled_text = $is_form_editor ? "disabled='disabled'" : '';
$class_suffix = $is_entry_detail ? '_admin' : '';
$form_sub_label_placement = rgar($form, 'subLabelPlacement');
$field_sub_label_placement = $this->subLabelPlacement;
$is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above';
$sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label'" : '';
$street_value = '';
$street2_value = '';
$city_value = '';
$state_value = '';
$zip_value = '';
$country_value = '';
if (is_array($value)) {
$street_value = esc_attr(rgget($this->id . '.1', $value));
$street2_value = esc_attr(rgget($this->id . '.2', $value));
$city_value = esc_attr(rgget($this->id . '.3', $value));
$state_value = esc_attr(rgget($this->id . '.4', $value));
$zip_value = esc_attr(rgget($this->id . '.5', $value));
$country_value = esc_attr(rgget($this->id . '.6', $value));
}
//Inputs
$address_street_field_input = GFFormsModel::get_input($this, $this->id . '.1');
$address_street2_field_input = GFFormsModel::get_input($this, $this->id . '.2');
$address_city_field_input = GFFormsModel::get_input($this, $this->id . '.3');
$address_state_field_input = GFFormsModel::get_input($this, $this->id . '.4');
$address_zip_field_input = GFFormsModel::get_input($this, $this->id . '.5');
$address_country_field_input = GFFormsModel::get_input($this, $this->id . '.6');
//Placeholders
$street_placeholder_attribute = GFCommon::get_input_placeholder_attribute($address_street_field_input);
$street2_placeholder_attribute = GFCommon::get_input_placeholder_attribute($address_street2_field_input);
$city_placeholder_attribute = GFCommon::get_input_placeholder_attribute($address_city_field_input);
$zip_placeholder_attribute = GFCommon::get_input_placeholder_attribute($address_zip_field_input);
$address_types = $this->get_address_types($form_id);
$addr_type = empty($this->addressType) ? 'international' : $this->addressType;
$address_type = $address_types[$addr_type];
$state_label = empty($address_type['state_label']) ? __('State', 'gravityforms') : $address_type['state_label'];
$zip_label = empty($address_type['zip_label']) ? __('Zip Code', 'gravityforms') : $address_type['zip_label'];
$hide_country = !empty($address_type['country']) || $this->hideCountry || rgar($address_country_field_input, 'isHidden');
if (empty($country_value)) {
$country_value = $this->defaultCountry;
}
if (empty($state_value)) {
$state_value = $this->defaultState;
}
$country_placeholder = GFCommon::get_input_placeholder_value($address_country_field_input);
$country_list = $this->get_country_dropdown($country_value, $country_placeholder);
//changing css classes based on field format to ensure proper display
$address_display_format = apply_filters('gform_address_display_format', 'default', $this);
$city_location = $address_display_format == 'zip_before_city' ? 'right' : 'left';
$zip_location = $address_display_format != 'zip_before_city' && ($this->hideState || rgar($address_state_field_input, 'isHidden')) ? 'right' : 'left';
// support for $this->hideState legacy property
$state_location = $address_display_format == 'zip_before_city' ? 'left' : 'right';
$country_location = $this->hideState || rgar($address_state_field_input, 'isHidden') ? 'left' : 'right';
// support for $this->hideState legacy property
//labels
$address_street_sub_label = rgar($address_street_field_input, 'customLabel') != '' ? $address_street_field_input['customLabel'] : __('Street Address', 'gravityforms');
$address_street_sub_label = apply_filters('gform_address_street_{$form_id}', apply_filters('gform_address_street', $address_street_sub_label, $form_id), $form_id);
$address_street2_sub_label = rgar($address_street2_field_input, 'customLabel') != '' ? $address_street2_field_input['customLabel'] : __('Address Line 2', 'gravityforms');
$address_street2_sub_label = apply_filters("gform_address_street2_{$form_id}", apply_filters('gform_address_street2', $address_street2_sub_label, $form_id), $form_id);
$address_zip_sub_label = rgar($address_zip_field_input, 'customLabel') != '' ? $address_zip_field_input['customLabel'] : $zip_label;
$address_zip_sub_label = apply_filters("gform_address_zip_{$form_id}", apply_filters('gform_address_zip', $address_zip_sub_label, $form_id), $form_id);
$address_city_sub_label = rgar($address_city_field_input, 'customLabel') != '' ? $address_city_field_input['customLabel'] : __('City', 'gravityforms');
$address_city_sub_label = apply_filters("gform_address_city_{$form_id}", apply_filters('gform_address_city', $address_city_sub_label, $form_id), $form_id);
$address_state_sub_label = rgar($address_state_field_input, 'customLabel') != '' ? $address_state_field_input['customLabel'] : $state_label;
$address_state_sub_label = apply_filters("gform_address_state_{$form_id}", apply_filters('gform_address_state', $address_state_sub_label, $form_id), $form_id);
$address_country_sub_label = rgar($address_country_field_input, 'customLabel') != '' ? $address_country_field_input['customLabel'] : __('Country', 'gravityforms');
$address_country_sub_label = apply_filters("gform_address_country_{$form_id}", apply_filters('gform_address_country', $address_country_sub_label, $form_id), $form_id);
//address field
$street_address = '';
$tabindex = $this->get_tabindex();
$style = $is_admin && rgar($address_street_field_input, 'isHidden') ? "style='display:none;'" : '';
if ($is_admin || !rgar($address_street_field_input, 'isHidden')) {
if ($is_sub_label_above) {
$street_address = " <span class='ginput_full{$class_suffix}' id='{$field_id}_1_container' {$style}>\n <label for='{$field_id}_1' id='{$field_id}_1_label' {$sub_label_class_attribute}>{$address_street_sub_label}</label>\n <input type='text' name='input_{$id}.1' id='{$field_id}_1' value='{$street_value}' {$tabindex} {$disabled_text} {$street_placeholder_attribute}/>\n </span>";
} else {
$street_address = " <span class='ginput_full{$class_suffix}' id='{$field_id}_1_container' {$style}>\n <input type='text' name='input_{$id}.1' id='{$field_id}_1' value='{$street_value}' {$tabindex} {$disabled_text} {$street_placeholder_attribute}/>\n <label for='{$field_id}_1' id='{$field_id}_1_label' {$sub_label_class_attribute}>{$address_street_sub_label}</label>\n </span>";
}
}
//address line 2 field
$street_address2 = '';
$style = $is_admin && ($this->hideAddress2 || rgar($address_street2_field_input, 'isHidden')) ? "style='display:none;'" : '';
// support for $this->hideAddress2 legacy property
if ($is_admin || !$this->hideAddress2 && !rgar($address_street2_field_input, 'isHidden')) {
$tabindex = $this->get_tabindex();
if ($is_sub_label_above) {
$street_address2 = "<span class='ginput_full{$class_suffix}' id='{$field_id}_2_container' {$style}>\n <label for='{$field_id}_2' id='{$field_id}_2_label' {$sub_label_class_attribute}>{$address_street2_sub_label}</label>\n <input type='text' name='input_{$id}.2' id='{$field_id}_2' value='{$street2_value}' {$tabindex} {$disabled_text} {$street2_placeholder_attribute}/>\n </span>";
} else {
$street_address2 = "<span class='ginput_full{$class_suffix}' id='{$field_id}_2_container' {$style}>\n <input type='text' name='input_{$id}.2' id='{$field_id}_2' value='{$street2_value}' {$tabindex} {$disabled_text} {$street2_placeholder_attribute}/>\n <label for='{$field_id}_2' id='{$field_id}_2_label' {$sub_label_class_attribute}>{$address_street2_sub_label}</label>\n </span>";
}
}
if ($address_display_format == 'zip_before_city') {
//.........這裏部分代碼省略.........
示例15: math_captcha_field_input
/**
* Adds the Math Captcha input area to the site.
*
* @since 1.0.0
*/
public function math_captcha_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($field['type'] == 'math_captcha') {
// Render the math challenge question.
$display_type = isset($field['field_math_captcha_type']) ? $field['field_math_captcha_type'] : 'mixed';
$equation = $this->generate_equation($display_type);
$question = $equation[0] . ' ' . $equation[1] . ' ' . $equation[2];
// Store the solution in a hex-encoded string.
$answers = $equation[3] . ',' . $equation[4];
$answers_no_spam = '';
for ($i = 0; $i < strlen($answers); $i++) {
$answers_no_spam .= '%' . zeroise(dechex(ord($answers[$i])), 2);
}
// Get the form/field properties to construct the input.
$input_id = $form_id . '_' . $field['id'];
$tab_index = GFCommon::get_tabindex();
$css = !empty($field['cssClass']) ? ' ' . $field['cssClass'] : '';
return sprintf("<div class='ginput_container'>%s = <input name='input_%d' id='input_%s' type='text' class='%s' %s ><input name='math_captcha_answers_%d' type='hidden' value='%s'></div>", $question, $field['id'], $input_id, $field['type'] . ' small' . esc_attr($css), $tab_index, $field['id'], $answers_no_spam);
}
return $input;
}
開發者ID:projoktibangla,項目名稱:gravity-forms-math-captcha,代碼行數:26,代碼來源:class-gravity-forms-math-captcha.php