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


PHP GFCommon::get_other_choice_value方法代码示例

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


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

示例1: validate


//.........这里部分代码省略.........
                                     //finding first number
                                     $first = 0;
                                     for ($first = 0; $first < 10; $first++) {
                                         if ($captcha_obj->check($prefixes[0], $first)) {
                                             break;
                                         }
                                     }
                                     //finding second number
                                     $second = 0;
                                     for ($second = 0; $second < 10; $second++) {
                                         if ($captcha_obj->check($prefixes[2], $second)) {
                                             break;
                                         }
                                     }
                                     //if it is a +, perform the sum
                                     if ($captcha_obj->check($prefixes[1], "+")) {
                                         $result = $first + $second;
                                     } else {
                                         $result = $first - $second;
                                     }
                                     if (intval($result) != intval($value)) {
                                         $field["failed_validation"] = true;
                                         $field["validation_message"] = empty($field["errorMessage"]) ? __("The CAPTCHA wasn't entered correctly. Go back and try it again.", "gravityforms") : $field["errorMessage"];
                                     }
                                     //removes old files in captcha folder (older than 1 hour);
                                     $captcha_obj->cleanup();
                                     break;
                                 default:
                                     if (!function_exists("recaptcha_get_html")) {
                                         require_once GFCommon::get_base_path() . '/recaptchalib.php';
                                     }
                                     $privatekey = get_option("rg_gforms_captcha_private_key");
                                     $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
                                     if (!$resp->is_valid) {
                                         $field["failed_validation"] = true;
                                         $field["validation_message"] = empty($field["errorMessage"]) ? __("The reCAPTCHA wasn't entered correctly. Go back and try it again.", "gravityforms") : $field["errorMessage"];
                                     }
                             }
                             break;
                         case "fileupload":
                         case "post_image":
                             $info = pathinfo($_FILES["input_" . $field["id"]]["name"]);
                             $allowedExtensions = self::clean_extensions(explode(",", strtolower($field["allowedExtensions"])));
                             $extension = strtolower(rgget("extension", $info));
                             if (empty($field["allowedExtensions"]) && in_array($extension, array("php", "asp", "exe", "com", "htaccess"))) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = empty($field["errorMessage"]) ? __("The uploaded file type is not allowed.", "gravityforms") : $field["errorMessage"];
                             } else {
                                 if (!empty($field["allowedExtensions"]) && !empty($info["basename"]) && !in_array($extension, $allowedExtensions)) {
                                     $field["failed_validation"] = true;
                                     $field["validation_message"] = empty($field["errorMessage"]) ? sprintf(__("The uploaded file type is not allowed. Must be one of the following: %s", "gravityforms"), strtolower($field["allowedExtensions"])) : $field["errorMessage"];
                                 }
                             }
                             break;
                         case "calculation":
                         case "singleproduct":
                         case "hiddenproduct":
                             $quantity_id = $field["id"] . ".3";
                             $quantity = rgget($quantity_id, $value);
                             if ($field["isRequired"] && rgblank($quantity) && !rgar($field, "disableQuantity")) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = rgempty("errorMessage", $field) ? __("This field is required.", "gravityforms") : rgar($field, "errorMessage");
                             } else {
                                 if (!empty($quantity) && (!is_numeric($quantity) || intval($quantity) != floatval($quantity))) {
                                     $field["failed_validation"] = true;
                                     $field["validation_message"] = __("Please enter a valid quantity", "gravityforms");
                                 }
                             }
                             break;
                         case "radio":
                             if (rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') {
                                 $value = rgpost("input_{$field['id']}_other");
                             }
                             if ($field["isRequired"] && rgar($field, 'enableOtherChoice') && $value == GFCommon::get_other_choice_value()) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required.", "gravityforms") : $field["errorMessage"];
                             }
                             break;
                     }
                 }
             }
         }
         $custom_validation_result = apply_filters("gform_field_validation", array("is_valid" => rgar($field, "failed_validation") ? false : true, "message" => rgar($field, "validation_message")), $value, $form, $field);
         $custom_validation_result = apply_filters("gform_field_validation_{$form["id"]}", $custom_validation_result, $value, $form, $field);
         $custom_validation_result = apply_filters("gform_field_validation_{$form["id"]}_{$field["id"]}", $custom_validation_result, $value, $form, $field);
         $field["failed_validation"] = rgar($custom_validation_result, "is_valid") ? false : true;
         $field["validation_message"] = rgar($custom_validation_result, "message");
     }
     $is_valid = true;
     foreach ($form["fields"] as $f) {
         if (rgar($f, "failed_validation")) {
             $is_valid = false;
             break;
         }
     }
     $validation_result = apply_filters("gform_validation_{$form["id"]}", apply_filters("gform_validation", array("is_valid" => $is_valid, "form" => $form)));
     $is_valid = $validation_result["is_valid"];
     $form = $validation_result["form"];
     return $is_valid;
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:101,代码来源:form_display.php

示例2: gf_vars

 public static function gf_vars($echo = true)
 {
     if (!class_exists("RGCurrency")) {
         require_once "currency.php";
     }
     $gf_vars = array();
     $gf_vars["active"] = __("Active", "gravityforms");
     $gf_vars["inactive"] = __("Inactive", "gravityforms");
     $gf_vars["save"] = __("Save", "gravityforms");
     $gf_vars["update"] = __("Update", "gravityforms");
     $gf_vars["previousLabel"] = __("Previous", "gravityforms");
     $gf_vars["selectFormat"] = __("Select a format", "gravityforms");
     $gf_vars["editToViewAll"] = __("5 of %d items shown. Edit field to view all", "gravityforms");
     $gf_vars["enterValue"] = __("Enter a value", "gravityforms");
     $gf_vars["formTitle"] = __("Untitled Form", "gravityforms");
     $gf_vars["formDescription"] = __("We would love to hear from you! Please fill out this form and we will get in touch with you shortly.", "gravityforms");
     $gf_vars["formConfirmationMessage"] = __("Thanks for contacting us! We will get in touch with you shortly.", "gravityforms");
     $gf_vars["buttonText"] = __("Submit", "gravityforms");
     $gf_vars["loading"] = __("Loading...", "gravityforms");
     $gf_vars["thisFieldIf"] = __('this field if', 'gravityforms');
     $gf_vars["thisPage"] = __("this page", "gravityforms");
     $gf_vars["thisFormButton"] = __('this form button', 'gravityforms');
     $gf_vars["show"] = __('Show', 'gravityforms');
     $gf_vars["hide"] = __('Hide', 'gravityforms');
     $gf_vars["all"] = __('All', 'gravityforms');
     $gf_vars["any"] = __('Any', 'gravityforms');
     $gf_vars["ofTheFollowingMatch"] = __('of the following match:', 'gravityforms');
     $gf_vars["is"] = __('is', 'gravityforms');
     $gf_vars["isNot"] = __('is not', 'gravityforms');
     $gf_vars["greaterThan"] = __('greater than', 'gravityforms');
     $gf_vars["lessThan"] = __('less than', 'gravityforms');
     $gf_vars["contains"] = __('contains', 'gravityforms');
     $gf_vars["startsWith"] = __('starts with', 'gravityforms');
     $gf_vars["endsWith"] = __('ends with', 'gravityforms');
     $gf_vars["thisConfirmation"] = __('Use this confirmation if', 'gravityforms');
     $gf_vars["thisNotification"] = __('Send this notification if', 'gravityforms');
     $gf_vars["confirmationSave"] = __('Save', 'gravityforms');
     $gf_vars["confirmationSaving"] = __('Saving...', 'gravityforms');
     $gf_vars["confirmationAreYouSure"] = __('Are you sure you wish to cancel these changes?', 'gravityforms');
     $gf_vars["confirmationIssueSaving"] = __('There was an issue saving this confirmation.', 'gravityforms');
     $gf_vars["confirmationConfirmDelete"] = __('Are you sure you wish to delete this confirmation?', 'gravityforms');
     $gf_vars["confirmationIssueDeleting"] = __('There was an issue deleting this confirmation.', 'gravityforms');
     $gf_vars["confirmationConfirmDiscard"] = __('There are unsaved changes to the current confirmation. Would you like to discard these changes?', 'gravityforms');
     $gf_vars["confirmationDefaultName"] = __('Untitled Confirmation', 'gravityforms');
     $gf_vars["confirmationDefaultMessage"] = __('Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms');
     $gf_vars["confirmationInvalidPageSelection"] = __('Please select a page.', "gravityforms");
     $gf_vars["confirmationInvalidRedirect"] = __('Please enter a URL.', "gravityforms");
     $gf_vars["confirmationInvalidName"] = __('Please enter a confirmation name.', "gravityforms");
     $gf_vars["conditionalLogicDependency"] = __('This form contains conditional logic dependent upon this field. Are you sure you want to delete this field? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms');
     $gf_vars["conditionalLogicDependencyChoice"] = __('This form contains conditional logic dependent upon this choice. Are you sure you want to delete this choice? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms');
     $gf_vars["conditionalLogicDependencyChoiceEdit"] = __('This form contains conditional logic dependent upon this choice. Are you sure you want to modify this choice? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms');
     $gf_vars["mergeTagsTooltip"] = __('<h6>Merge Tags</h6>Merge tags allow you to dynamically populate submitted field values in your form content wherever this merge tag icon is present.', 'gravityforms');
     $gf_vars["baseUrl"] = GFCommon::get_base_url();
     $gf_vars["gf_currency_config"] = RGCurrency::get_currency(GFCommon::get_currency());
     $gf_vars["otherChoiceValue"] = GFCommon::get_other_choice_value();
     $gf_vars["isFormDelete"] = false;
     if (is_admin() && rgget('id')) {
         $form = RGFormsModel::get_form_meta(rgget('id'));
         $gf_vars["mergeTags"] = GFCommon::get_merge_tags($form['fields'], '', false);
     }
     $gf_vars_json = 'var gf_vars = ' . json_encode($gf_vars) . ';';
     if (!$echo) {
         return $gf_vars_json;
     } else {
         echo $gf_vars_json;
     }
 }
开发者ID:ascarius,项目名称:wordpress-bootstrap,代码行数:67,代码来源:common.php

示例3: get_radio_choices

 public static function get_radio_choices($field, $value = "", $disabled_text)
 {
     $choices = "";
     if (is_array($field["choices"])) {
         $choice_id = 0;
         // add "other" choice to choices if enabled
         if (rgar($field, 'enableOtherChoice')) {
             $other_default_value = GFCommon::get_other_choice_value();
             $field["choices"][] = array('text' => $other_default_value, 'value' => 'gf_other_choice', 'isSelected' => false, 'isOtherChoice' => true);
         }
         $logic_event = self::get_logic_event($field, "click");
         $count = 1;
         foreach ($field["choices"] as $choice) {
             $id = $field["id"] . '_' . $choice_id++;
             $field_value = !empty($choice["value"]) || rgar($field, "enableChoiceValue") ? $choice["value"] : $choice["text"];
             if (rgget("enablePrice", $field)) {
                 $field_value .= "|" . GFCommon::to_number(rgar($choice, "price"));
             }
             if (rgblank($value) && RG_CURRENT_VIEW != "entry") {
                 $checked = rgar($choice, "isSelected") ? "checked='checked'" : "";
             } else {
                 $checked = RGFormsModel::choice_value_match($field, $choice, $value) ? "checked='checked'" : "";
             }
             $tabindex = self::get_tabindex();
             $label = sprintf("<label for='choice_%s'>%s</label>", $id, $choice["text"]);
             $input_focus = '';
             // handle "other" choice
             if (rgar($choice, 'isOtherChoice')) {
                 $onfocus = !IS_ADMIN ? 'jQuery(this).prev("input").attr("checked", true); if(jQuery(this).val() == "' . $other_default_value . '") { jQuery(this).val(""); }' : '';
                 $onblur = !IS_ADMIN ? 'if(jQuery(this).val().replace(" ", "") == "") { jQuery(this).val("' . $other_default_value . '"); }' : '';
                 $input_focus = !IS_ADMIN ? "onfocus=\"jQuery(this).next('input').focus();\"" : "";
                 $value_exists = RGFormsModel::choices_value_match($field, $field["choices"], $value);
                 if ($value == 'gf_other_choice' && rgpost("input_{$field["id"]}_other")) {
                     $other_value = rgpost("input_{$field["id"]}_other");
                 } else {
                     if (!$value_exists && !empty($value)) {
                         $other_value = $value;
                         $value = 'gf_other_choice';
                         $checked = "checked='checked'";
                     } else {
                         $other_value = $other_default_value;
                     }
                 }
                 $label = "<input name='input_{$field["id"]}_other' type='text' value='" . esc_attr($other_value) . "' onfocus='{$onfocus}' onblur='{$onblur}' {$tabindex} {$disabled_text} />";
             }
             $choices .= sprintf("<li class='gchoice_{$id}'><input name='input_%d' type='radio' value='%s' %s id='choice_%s' {$tabindex} %s {$logic_event} %s />%s</li>", $field["id"], esc_attr($field_value), $checked, $id, $disabled_text, $input_focus, $label);
             if (IS_ADMIN && RG_CURRENT_VIEW != "entry" && $count >= 5) {
                 break;
             }
             $count++;
         }
         $total = sizeof($field["choices"]);
         if ($count < $total) {
             $choices .= "<li class='gchoice_total'>" . sprintf(__("%d of %d items shown. Edit field to view all", "gravityforms"), $count, $total) . "</li>";
         }
     }
     return apply_filters("gform_field_choices_" . rgget("formId", $field), apply_filters("gform_field_choices", $choices, $field), $field);
 }
开发者ID:ipman3,项目名称:Mediassociates-wp,代码行数:58,代码来源:common.php

示例4: forms_page

    public static function forms_page($form_id)
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        $update_result = "";
        if (rgpost("operation") == "delete") {
            check_admin_referer('gforms_delete_form', 'gforms_delete_form');
            RGFormsModel::delete_form($form_id);
            ?>
                <script type="text/javascript">
                jQuery(document).ready(
                    function(){document.location.href="?page=gf_edit_forms";}
                );
                </script>
            <?php 
            exit;
        } else {
            if (!rgempty("gform_meta")) {
                check_admin_referer("gforms_update_form_{$form_id}", 'gforms_update_form');
                $update_result = self::save_form_info($form_id, rgpost("gform_meta", false));
            }
        }
        if (!GFCommon::is_wp_version("3.3")) {
            ?>
            <script type='text/javascript'>
                /* <![CDATA[
                *Needed for custom version of thickbox
                */
                var thickboxL10n = {
                    loadingAnimation: "<?php 
            echo includes_url();
            ?>
js/thickbox/loadingAnimation.gif",
                    closeImage: "<?php 
            echo includes_url();
            ?>
js/thickbox/tb-close.png"
                };
                try{convertEntities(thickboxL10n);}catch(e){};
                /* ]]> */
            </script>
            <?php 
            wp_register_script("gf_thickbox", GFCommon::get_base_url() . "/js/thickbox.js", null, GFCommon::$version);
            wp_register_style("gf_thickbox", GFCommon::get_base_url() . "/js/thickbox.css", null, GFCommon::$version);
            wp_print_scripts(array("gf_thickbox"));
            wp_print_styles(array("gf_thickbox"));
        } else {
            wp_print_scripts(array("thickbox"));
            wp_print_styles(array("thickbox"));
        }
        wp_register_script("gforms_gravityforms", GFCommon::get_base_url() . "/js/gravityforms.js", null, GFCommon::$version);
        wp_print_scripts(array("jquery-ui-core", "jquery-ui-sortable", "jquery-ui-tabs", "sack", "gforms_gravityforms"));
        require_once GFCommon::get_base_path() . '/currency.php';
        ?>
        <script type="text/javascript">
            var gf_global = {
                "gf_currency_config" : <?php 
        echo json_encode(RGCurrency::get_currency(GFCommon::get_currency()));
        ?>
            };

            var gf_vars = {
                "save": "<?php 
        _e("Save", "gravityforms");
        ?>
",
                "update": "<?php 
        _e("Update", "gravityforms");
        ?>
",
                "baseUrl": "<?php 
        echo GFCommon::get_base_url();
        ?>
",
                "previousLabel" : "<?php 
        _e("Previous", "gravityforms");
        ?>
",
                "selectFormat" : "<?php 
        _e("Select a format", "gravityforms");
        ?>
",
                "otherChoiceValue" : "<?php 
        echo GFCommon::get_other_choice_value();
        ?>
",
                "editToViewAll" : "<?php 
        _e("5 of %d items shown. Edit field to view all", "gravityforms");
        ?>
",
                "enterValue" : "<?php 
        _e("Enter a value", "gravityforms");
        ?>
",
                "formTitle" : "<?php 
        _e("Untitled Form", "gravityforms");
        ?>
",
//.........这里部分代码省略.........
开发者ID:ipman3,项目名称:Mediassociates-wp,代码行数:101,代码来源:form_detail.php

示例5: gf_vars

 public static function gf_vars($echo = true)
 {
     if (!class_exists('RGCurrency')) {
         require_once 'currency.php';
     }
     $gf_vars = array();
     $gf_vars['active'] = esc_attr__('Active', 'gravityforms');
     $gf_vars['inactive'] = esc_attr__('Inactive', 'gravityforms');
     $gf_vars['save'] = esc_html__('Save', 'gravityforms');
     $gf_vars['update'] = esc_html__('Update', 'gravityforms');
     $gf_vars['previousLabel'] = esc_html__('Previous', 'gravityforms');
     $gf_vars['selectFormat'] = esc_html__('Select a format', 'gravityforms');
     $gf_vars['editToViewAll'] = esc_html__('5 of %d items shown. Edit field to view all', 'gravityforms');
     $gf_vars['enterValue'] = esc_html__('Enter a value', 'gravityforms');
     $gf_vars['formTitle'] = esc_html__('Untitled Form', 'gravityforms');
     $gf_vars['formDescription'] = esc_html__('We would love to hear from you! Please fill out this form and we will get in touch with you shortly.', 'gravityforms');
     $gf_vars['formConfirmationMessage'] = esc_html__('Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms');
     $gf_vars['buttonText'] = esc_html__('Submit', 'gravityforms');
     $gf_vars['loading'] = esc_html__('Loading...', 'gravityforms');
     $gf_vars['thisFieldIf'] = esc_html__('this field if', 'gravityforms');
     $gf_vars['thisPage'] = esc_html__('this page', 'gravityforms');
     $gf_vars['thisFormButton'] = esc_html__('this form button if', 'gravityforms');
     $gf_vars['show'] = esc_html__('Show', 'gravityforms');
     $gf_vars['hide'] = esc_html__('Hide', 'gravityforms');
     $gf_vars['all'] = esc_html(_x('All', 'Conditional Logic', 'gravityforms'));
     $gf_vars['any'] = esc_html(_x('Any', 'Conditional Logic', 'gravityforms'));
     $gf_vars['ofTheFollowingMatch'] = esc_html('of the following match:', 'gravityforms');
     $gf_vars['is'] = esc_html('is', 'gravityforms');
     $gf_vars['isNot'] = esc_html('is not', 'gravityforms');
     $gf_vars['greaterThan'] = esc_html('greater than', 'gravityforms');
     $gf_vars['lessThan'] = esc_html('less than', 'gravityforms');
     $gf_vars['contains'] = esc_html('contains', 'gravityforms');
     $gf_vars['startsWith'] = esc_html('starts with', 'gravityforms');
     $gf_vars['endsWith'] = esc_html('ends with', 'gravityforms');
     $gf_vars['thisConfirmation'] = esc_html('Use this confirmation if', 'gravityforms');
     $gf_vars['thisNotification'] = esc_html('Send this notification if', 'gravityforms');
     $gf_vars['confirmationSave'] = esc_html('Save', 'gravityforms');
     $gf_vars['confirmationSaving'] = esc_html('Saving...', 'gravityforms');
     $gf_vars['confirmationAreYouSure'] = __('Are you sure you wish to cancel these changes?', 'gravityforms');
     $gf_vars['confirmationIssueSaving'] = __('There was an issue saving this confirmation.', 'gravityforms');
     $gf_vars['confirmationConfirmDelete'] = __('Are you sure you wish to delete this confirmation?', 'gravityforms');
     $gf_vars['confirmationIssueDeleting'] = __('There was an issue deleting this confirmation.', 'gravityforms');
     $gf_vars['confirmationConfirmDiscard'] = __('There are unsaved changes to the current confirmation. Would you like to discard these changes?', 'gravityforms');
     $gf_vars['confirmationDefaultName'] = __('Untitled Confirmation', 'gravityforms');
     $gf_vars['confirmationDefaultMessage'] = __('Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms');
     $gf_vars['confirmationInvalidPageSelection'] = __('Please select a page.', 'gravityforms');
     $gf_vars['confirmationInvalidRedirect'] = __('Please enter a URL.', 'gravityforms');
     $gf_vars['confirmationInvalidName'] = __('Please enter a confirmation name.', 'gravityforms');
     $gf_vars['conditionalLogicDependency'] = __("This form contains conditional logic dependent upon this field. Are you sure you want to delete this field? 'OK' to delete, 'Cancel' to abort.", 'gravityforms');
     $gf_vars['conditionalLogicDependencyChoice'] = __("This form contains conditional logic dependent upon this choice. Are you sure you want to delete this choice? 'OK' to delete, 'Cancel' to abort.", 'gravityforms');
     $gf_vars['conditionalLogicDependencyChoiceEdit'] = __("This form contains conditional logic dependent upon this choice. Are you sure you want to modify this choice? 'OK' to delete, 'Cancel' to abort.", 'gravityforms');
     $gf_vars['mergeTagsTooltip'] = '<h6>' . esc_html__('Merge Tags', 'gravityforms') . '</h6>' . esc_html__('Merge tags allow you to dynamically populate submitted field values in your form content wherever this merge tag icon is present.', 'gravityforms');
     $gf_vars['baseUrl'] = GFCommon::get_base_url();
     $gf_vars['gf_currency_config'] = RGCurrency::get_currency(GFCommon::get_currency());
     $gf_vars['otherChoiceValue'] = GFCommon::get_other_choice_value();
     $gf_vars['isFormTrash'] = false;
     $gf_vars['currentlyAddingField'] = false;
     $gf_vars['addFieldFilter'] = esc_html__('Add a condition', 'gravityforms');
     $gf_vars['removeFieldFilter'] = esc_html__('Remove a condition', 'gravityforms');
     $gf_vars['filterAndAny'] = esc_html__('Include results if {0} match:', 'gravityforms');
     $gf_vars['customChoices'] = esc_html__('Custom Choices', 'gravityforms');
     $gf_vars['predefinedChoices'] = esc_html__('Predefined Choices', 'gravityforms');
     if (is_admin() && rgget('id')) {
         $form = RGFormsModel::get_form_meta(rgget('id'));
         $gf_vars['mergeTags'] = GFCommon::get_merge_tags($form['fields'], '', false);
     }
     $gf_vars_json = 'var gf_vars = ' . json_encode($gf_vars) . ';';
     if (!$echo) {
         return $gf_vars_json;
     } else {
         echo $gf_vars_json;
     }
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:73,代码来源:common.php

示例6: _e

?>
",
    "baseUrl": "<?php 
echo GFCommon::get_base_url();
?>
",
    "previousLabel" : "<?php 
_e("Previous", "gravityforms");
?>
",
    "selectFormat" : "<?php 
_e("Select a format", "gravityforms");
?>
",
    "otherChoiceValue" : "<?php 
echo GFCommon::get_other_choice_value();
?>
",
    "editToViewAll" : "<?php 
_e("5 of %d items shown. Edit field to view all", "gravityforms");
?>
"
};

function DeleteCustomChoice(){
    if(!confirm("<?php 
_e("Delete this custom choice list? 'OK' to delete, 'Cancel' to abort.", "gravityforms");
?>
"))
        return;
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:30,代码来源:js.php

示例7: get_radio_choices

 public function get_radio_choices($value = '', $disabled_text, $form_id = 0)
 {
     $choices = '';
     $is_entry_detail = $this->is_entry_detail();
     $is_form_editor = $this->is_form_editor();
     $is_admin = $is_entry_detail || $is_form_editor;
     if (is_array($this->choices)) {
         $choice_id = 0;
         $other_default_value = '';
         // add 'other' choice to choices if enabled
         if ($this->enableOtherChoice) {
             $other_default_value = GFCommon::get_other_choice_value();
             $this->choices[] = array('text' => $other_default_value, 'value' => 'gf_other_choice', 'isSelected' => false, 'isOtherChoice' => true);
         }
         $logic_event = $this->get_conditional_logic_event('click');
         $count = 1;
         foreach ($this->choices as $choice) {
             if ($is_entry_detail || $is_form_editor || $form_id == 0) {
                 $id = $this->id . '_' . $choice_id++;
             } else {
                 $id = $form_id . '_' . $this->id . '_' . $choice_id++;
             }
             $field_value = !empty($choice['value']) || $this->enableChoiceValue ? $choice['value'] : $choice['text'];
             if ($this->enablePrice) {
                 $price = rgempty('price', $choice) ? 0 : GFCommon::to_number(rgar($choice, 'price'));
                 $field_value .= '|' . $price;
             }
             if (rgblank($value) && RG_CURRENT_VIEW != 'entry') {
                 $checked = rgar($choice, 'isSelected') ? "checked='checked'" : '';
             } else {
                 $checked = RGFormsModel::choice_value_match($this, $choice, $value) ? "checked='checked'" : '';
             }
             $tabindex = $this->get_tabindex();
             $label = sprintf("<label for='choice_%s' id='label_%s'>%s</label>", $id, $id, $choice['text']);
             $input_focus = '';
             // handle 'other' choice
             if (rgar($choice, 'isOtherChoice')) {
                 $onfocus = !$is_admin ? 'jQuery(this).prev("input")[0].click(); if(jQuery(this).val() == "' . $other_default_value . '") { jQuery(this).val(""); }' : '';
                 $onblur = !$is_admin ? 'if(jQuery(this).val().replace(" ", "") == "") { jQuery(this).val("' . $other_default_value . '"); }' : '';
                 $onkeyup = $this->get_conditional_logic_event('keyup');
                 $input_focus = !$is_admin ? "onfocus=\"jQuery(this).next('input').focus();\"" : '';
                 $value_exists = RGFormsModel::choices_value_match($this, $this->choices, $value);
                 if ($value == 'gf_other_choice' && rgpost("input_{$this->id}_other")) {
                     $other_value = rgpost("input_{$this->id}_other");
                 } elseif (!$value_exists && !empty($value)) {
                     $other_value = $value;
                     $value = 'gf_other_choice';
                     $checked = "checked='checked'";
                 } else {
                     $other_value = $other_default_value;
                 }
                 $label = "<input id='input_{$this->formId}_{$this->id}_other' name='input_{$this->id}_other' type='text' value='" . esc_attr($other_value) . "' aria-label='" . esc_attr__('Other', 'gravityforms') . "' onfocus='{$onfocus}' onblur='{$onblur}' {$tabindex} {$onkeyup} {$disabled_text} />";
             }
             $choice_markup = sprintf("<li class='gchoice_{$id}'><input name='input_%d' type='radio' value='%s' %s id='choice_%s' {$tabindex} %s {$logic_event} %s />%s</li>", $this->id, esc_attr($field_value), $checked, $id, $disabled_text, $input_focus, $label);
             $choices .= gf_apply_filters(array('gform_field_choice_markup_pre_render', $this->formId, $this->id), $choice_markup, $choice, $this, $value);
             if ($is_form_editor && $count >= 5) {
                 break;
             }
             $count++;
         }
         $total = sizeof($this->choices);
         if ($count < $total) {
             $choices .= "<li class='gchoice_total'>" . sprintf(esc_html__('%d of %d items shown. Edit field to view all', 'gravityforms'), $count, $total) . '</li>';
         }
     }
     return gf_apply_filters(array('gform_field_choices', $this->formId), $choices, $this);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:67,代码来源:class-gf-field-radio.php

示例8: validate


//.........这里部分代码省略.........
                                             break;
                                         case "dmy_dash":
                                             $format_name = "dd-mm-yyyy";
                                             break;
                                         case "dmy_dot":
                                             $format_name = "dd.mm.yyyy";
                                             break;
                                         case "ymd_slash":
                                             $format_name = "yyyy/mm/dd";
                                             break;
                                         case "ymd_dash":
                                             $format_name = "yyyy-mm-dd";
                                             break;
                                         case "ymd_dot":
                                             $format_name = "yyyy.mm.dd";
                                             break;
                                     }
                                     $message = $field["dateType"] == "datepicker" ? sprintf(__("Please enter a valid date in the format (%s).", "gravityforms"), $format_name) : __("Please enter a valid date.", "gravityforms");
                                     $field["validation_message"] = empty($field["errorMessage"]) ? $message : $field["errorMessage"];
                                 }
                             }
                             break;
                         case "time":
                             //create variable values if time came in one field
                             if (!is_array($value) && !empty($value)) {
                                 preg_match('/^(\\d*):(\\d*) ?(.*)$/', $value, $matches);
                                 $value = array();
                                 $value[0] = $matches[1];
                                 $value[1] = $matches[2];
                             }
                             $hour = $value[0];
                             $minute = $value[1];
                             if (empty($hour) && empty($minute)) {
                                 break;
                             }
                             $is_valid_format = is_numeric($hour) && is_numeric($minute);
                             $min_hour = rgar($field, "timeFormat") == "24" ? 0 : 1;
                             $max_hour = rgar($field, "timeFormat") == "24" ? 23 : 12;
                             if (!$is_valid_format || $hour < $min_hour || $hour > $max_hour || $minute < 0 || $minute >= 60) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter a valid time.", "gravityforms") : $field["errorMessage"];
                             }
                             break;
                         case "website":
                             if (empty($value) || $value == "http://") {
                                 $value = "";
                                 if ($field["isRequired"]) {
                                     $field["failed_validation"] = true;
                                     $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required.", "gravityforms") : $field["errorMessage"];
                                 }
                             }
                             if (!empty($value) && !GFCommon::is_valid_url($value)) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter a valid Website URL (i.e. http://www.gravityforms.com).", "gravityforms") : $field["errorMessage"];
                             }
                             break;
                         case "calculation":
                             $quantity_id = $field["id"] . ".3";
                             $quantity = rgget($quantity_id, $value);
                             if ($field["isRequired"] && rgblank($quantity) && !rgar($field, "disableQuantity")) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = rgempty("errorMessage", $field) ? __("This field is required.", "gravityforms") : rgar($field, "errorMessage");
                             } else {
                                 if (!empty($quantity) && (!is_numeric($quantity) || intval($quantity) != floatval($quantity) || intval($quantity) < 0)) {
                                     $field["failed_validation"] = true;
                                     $field["validation_message"] = __("Please enter a valid quantity", "gravityforms");
                                 }
                             }
                             break;
                         case "radio":
                             if (rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') {
                                 $value = rgpost("input_{$field['id']}_other");
                             }
                             if ($field["isRequired"] && rgar($field, 'enableOtherChoice') && $value == GFCommon::get_other_choice_value()) {
                                 $field["failed_validation"] = true;
                                 $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required.", "gravityforms") : $field["errorMessage"];
                             }
                             break;
                     }
                 }
             }
         }
         $custom_validation_result = apply_filters("gform_field_validation", array("is_valid" => rgar($field, "failed_validation") ? false : true, "message" => rgar($field, "validation_message")), $value, $form, $field);
         $custom_validation_result = apply_filters("gform_field_validation_{$form["id"]}", $custom_validation_result, $value, $form, $field);
         $custom_validation_result = apply_filters("gform_field_validation_{$form["id"]}_{$field["id"]}", $custom_validation_result, $value, $form, $field);
         $field["failed_validation"] = rgar($custom_validation_result, "is_valid") ? false : true;
         $field["validation_message"] = rgar($custom_validation_result, "message");
     }
     $is_valid = true;
     foreach ($form["fields"] as $f) {
         if (rgar($f, "failed_validation")) {
             $is_valid = false;
             break;
         }
     }
     $validation_result = apply_filters("gform_validation_{$form["id"]}", apply_filters("gform_validation", array("is_valid" => $is_valid, "form" => $form)));
     $is_valid = $validation_result["is_valid"];
     $form = $validation_result["form"];
     return $is_valid;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:101,代码来源:entry-edit-logic.php


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