本文整理汇总了PHP中RGCurrency::get_currency方法的典型用法代码示例。如果您正苦于以下问题:PHP RGCurrency::get_currency方法的具体用法?PHP RGCurrency::get_currency怎么用?PHP RGCurrency::get_currency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGCurrency
的用法示例。
在下文中一共展示了RGCurrency::get_currency方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _e
}
else {
jQuery("#" + objectType + "_conditional_logic").prop("disabled", true).prop("checked", false);
jQuery("#" + objectType + "_conditional_logic_container").show().html("<span class='instruction' style='margin-left:0'><?php
_e('To use conditional logic, please create a field that supports conditional logic.', 'gravityforms');
?>
</span>");
}
}
function GetCurrentCurrency() {
<?php
require_once 'currency.php';
$current_currency = RGCurrency::get_currency(GFCommon::get_currency());
?>
var currency = new Currency(<?php
echo GFCommon::json_encode($current_currency);
?>
);
return currency;
}
function ToggleColumns(isInit) {
var speed = isInit ? "" : "slow";
var field = GetSelectedField();
if (jQuery('#field_columns_enabled').is(":checked")) {
jQuery('#gfield_settings_columns_container').show(speed);
示例2: get_number_formats_script
/**
* Generates a map of fields IDs and their corresponding number formats used by the GFCalc JS object for correctly
* converting field values to clean numbers.
*
* - Number fields have a 'numberFormat' setting (w/ UI).
* - Single-input product fields (i.e. 'singleproduct', 'calculation', 'price' and 'hiddenproduct') should default to
* the number format of the configured currency.
* - All other product fields will default to 'decimal_dot' for the number format.
* - All other fields will have no format (false) and inherit the format of the formula field when the formula is
* calculated.
*
* @param mixed $form
* @return string
*/
public static function get_number_formats_script($form)
{
require_once GFCommon::get_base_path() . '/currency.php';
$number_formats = array();
$currency = RGCurrency::get_currency(GFCommon::get_currency());
foreach ($form['fields'] as $field) {
// default format is false, fields with no format will inherit the format of the formula field when calculated
$format = false;
switch (GFFormsModel::get_input_type($field)) {
case 'number':
$format = $field->numberFormat ? $field->numberFormat : 'decimal_dot';
break;
case 'singleproduct':
case 'calculation':
case 'price':
case 'hiddenproduct':
case 'singleshipping':
$format = $currency['decimal_separator'] == ',' ? 'decimal_comma' : 'decimal_dot';
break;
default:
// we check above for all single-input product types, for all other products, assume decimal format
if (in_array($field->type, array('product', 'option', 'shipping'))) {
$format = 'decimal_dot';
}
}
$number_formats[$field->id] = $format;
}
return 'gf_global["number_formats"][' . $form['id'] . '] = ' . json_encode($number_formats) . ';';
}
示例3: get_form_init_scripts
public static function get_form_init_scripts($form)
{
$script_string = '';
// temporary solution for output gf_global obj until wp min version raised to 3.3
if (wp_script_is("gforms_gravityforms")) {
require_once GFCommon::get_base_path() . '/currency.php';
$gf_global_script = "if(typeof gf_global == 'undefined') var gf_global = {gf_currency_config: " . json_encode(RGCurrency::get_currency(GFCommon::get_currency())) . " };";
}
/* rendering initialization scripts */
$init_scripts = rgar(self::$init_scripts, $form["id"]);
if (!empty($init_scripts)) {
$script_string = "<script type='text/javascript'>" . apply_filters("gform_cdata_open", "") . " ";
$script_string .= isset($gf_global_script) ? $gf_global_script : '';
$script_string .= "jQuery(document).bind('gform_post_render', function(event, formId, currentPage){" . "if(formId == {$form['id']}) {";
foreach ($init_scripts as $init_script) {
if ($init_script["location"] == self::ON_PAGE_RENDER) {
$script_string .= $init_script["script"];
}
}
$script_string .= "} " . "} );" . "jQuery(document).bind('gform_post_conditional_logic', function(event, formId, fields, isInit){";
foreach ($init_scripts as $init_script) {
if ($init_script["location"] == self::ON_CONDITIONAL_LOGIC) {
$script_string .= $init_script["script"];
}
}
$script_string .= "} );" . apply_filters("gform_cdata_close", "") . "</script>";
}
return $script_string;
}
示例4: 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;
}
}
示例5: stats_page
//.........这里部分代码省略.........
display: 'none',
opacity: 0.90,
width:'150px',
height:'<?php
echo $config["meta"]["type"] == "subscription" ? "75px" : "60px";
?>
',
top: y - <?php
echo $config["meta"]["type"] == "subscription" ? "100" : "89";
?>
,
left: x - 79
}).appendTo("body").fadeIn(200);
}
function convertToMoney(number){
var currency = getCurrentCurrency();
return currency.toMoney(number);
}
function formatWeeks(number){
number = number + "";
return "<?php
_e("Week ", "gravityformspaypal");
?>
" + number.substring(number.length-2);
}
function getCurrentCurrency(){
<?php
if (!class_exists("RGCurrency")) {
require_once ABSPATH . "/" . PLUGINDIR . "/gravityforms/currency.php";
}
$current_currency = RGCurrency::get_currency(GFCommon::get_currency());
?>
var currency = new Currency(<?php
echo GFCommon::json_encode($current_currency);
?>
);
return currency;
}
</script>
<?php
}
$payment_totals = RGFormsModel::get_form_payment_totals($config["form_id"]);
$transaction_totals = GFPayPalData::get_transaction_totals($config["form_id"]);
switch ($config["meta"]["type"]) {
case "product":
$total_sales = $payment_totals["orders"];
$sales_label = __("Total Orders", "gravityformspaypal");
break;
case "donation":
$total_sales = $payment_totals["orders"];
$sales_label = __("Total Donations", "gravityformspaypal");
break;
case "subscription":
$total_sales = $payment_totals["active"];
$sales_label = __("Active Subscriptions", "gravityformspaypal");
break;
}
$total_revenue = empty($transaction_totals["payment"]["revenue"]) ? 0 : $transaction_totals["payment"]["revenue"];
?>
<div class="paypal_summary_container">
<div class="paypal_summary_item">
<div class="paypal_summary_title"><?php
_e("Total Revenue", "gravityformspaypal");
示例6: 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");
?>
",
//.........这里部分代码省略.........
示例7: get_form
//.........这里部分代码省略.........
$color = $style == "custom" ? " color:{$form["pagination"]["color"]};" : "";
$bgcolor = $style == "custom" ? " background-color:{$form["pagination"]["backgroundColor"]};" : "";
$form_string .= "\n <div id='gf_progressbar_wrapper_{$form_id}' class='gf_progressbar_wrapper'>\n <h3 class='gf_progressbar_title'>" . __("Step", "gravityforms") . " {$current_page} " . __("of", "gravityforms") . " {$page_count}{$page_name}</h3>\n <div class='gf_progressbar'>\n <div class='gf_progressbar_percentage percentbar_{$style}' style='width:{$percent};{$color}{$bgcolor}'><span>{$percent}</span></div>\n </div>\n </div>";
} else {
if ($form["pagination"]["type"] == "steps") {
$form_string .= "\n <div id='gf_page_steps_{$form_id}' class='gf_page_steps'>";
for ($i = 0, $count = sizeof($form["pagination"]["pages"]); $i < $count; $i++) {
$step_number = $i + 1;
$active_class = $step_number == $current_page ? " gf_step_active" : "";
$first_class = $i == 0 ? " gf_step_first" : "";
$last_class = $i + 1 == $count ? " gf_step_last" : "";
$complete_class = $step_number < $current_page ? " gf_step_completed" : "";
$previous_class = $step_number + 1 == $current_page ? " gf_step_previous" : "";
$next_class = $step_number - 1 == $current_page ? " gf_step_next" : "";
$pending_class = $step_number > $current_page ? " gf_step_pending" : "";
$classes = "gf_step" . $active_class . $first_class . $last_class . $complete_class . $previous_class . $next_class . $pending_class;
$classes = GFCommon::trim_all($classes);
$form_string .= "\n <div id='gf_step_{$form_id}_{$step_number}' class='{$classes}'><span class='gf_step_number'>{$step_number}</span> {$form["pagination"]["pages"][$i]}</div>";
}
$form_string .= "\n <div class='gf_step_clear'></div>\n </div>";
}
}
}
if ($is_postback && !$is_valid) {
$validation_message = "<div class='validation_error'>" . __("There was a problem with your submission.", "gravityforms") . " " . __("Errors have been highlighted below.", "gravityforms") . "</div>";
$form_string .= apply_filters("gform_validation_message_{$form["id"]}", apply_filters("gform_validation_message", $validation_message, $form), $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"]}" : "";
$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";
$form_string .= "\n <ul id='gform_fields_{$form_id}' class='gform_fields {$form['labelPlacement']} {$description_class}'>";
if (is_array($form['fields'])) {
foreach ($form['fields'] as $field) {
$field["conditionalLogicFields"] = self::get_conditional_logic_fields($form, $field["id"]);
$form_string .= self::get_field($field, RGFormsModel::get_field_value($field, $field_values), false, $form, $field_values);
}
}
$form_string .= "\n </ul>";
if ($has_pages) {
$previous_button = self::get_form_button($form["id"], "gform_previous_button_{$form["id"]}", $form["lastPageButton"], __("Previous", "gravityforms"), "button gform_previous_button", __("Previous Page", "gravityforms"), self::get_current_page($form_id) - 1);
$form_string .= "</div>" . self::gform_footer($form, "gform_page_footer " . $form['labelPlacement'], $ajax, $field_values, $previous_button, $display_title, $display_description, $is_postback) . "\n </div>";
//closes gform_page
}
$form_string .= "</div>";
//closes gform_body
//suppress form footer for multi-page forms (footer will be included on the last page
if (!$has_pages) {
$form_string .= self::gform_footer($form, "gform_footer " . $form['labelPlacement'], $ajax, $field_values, "", $display_title, $display_description, $is_postback);
}
$form_string .= "\n </form>\n </div>";
//adding conditional logic script if conditional logic is configured for this form.
//get_conditional_logic also adds the chosen script for the enhanced dropdown option.
//if this form does not have conditional logic, add chosen script separately
if (self::has_conditional_logic($form)) {
$form_string .= self::get_conditional_logic($form);
} else {
if (self::has_enhanced_dropdown($form)) {
$form_string .= "<script type='text/javascript'>//<![CDATA[\n" . self::get_chosen_init_script($form) . "\n//]]></script>";
}
}
//adding currency config if there are any product fields in the form
if (self::has_price_field($form)) {
if (!class_exists("RGCurrency")) {
require_once "currency.php";
}
$form_string .= "<script type='text/javascript'>//<![CDATA[\n if(window[\"gformInitPriceFields\"]) jQuery(document).ready(function(){gformInitPriceFields();}); window['gf_currency_config'] = " . GFCommon::json_encode(RGCurrency::get_currency(GFCommon::get_currency())) . "; \n//]]></script>";
}
if (self::has_password_strength($form)) {
$form_string .= "<script type='text/javascript'>//<![CDATA[\nif(!window['gf_text']){window['gf_text'] = new Array();} window['gf_text']['password_blank'] = '" . __("Strength indicator", "gravityforms") . "'; window['gf_text']['password_mismatch'] = '" . __("Mismatch", "gravityforms") . "';window['gf_text']['password_bad'] = '" . __("Bad", "gravityforms") . "'; window['gf_text']['password_short'] = '" . __("Short", "gravityforms") . "'; window['gf_text']['password_good'] = '" . __("Good", "gravityforms") . "'; window['gf_text']['password_strong'] = '" . __("Strong", "gravityforms") . "';\n//]]></script>";
}
if (GFCommon::has_credit_card_field($form)) {
$card_rules = self::get_credit_card_rules();
$form_string .= "<script type='text/javascript'>//<![CDATA[\n if(!window['gf_cc_rules']){window['gf_cc_rules'] = new Array(); } window['gf_cc_rules'] = " . GFCommon::json_encode($card_rules) . "; \n//]]></script>";
}
if ($ajax && $is_postback) {
global $wp_scripts;
$form_string = "<!DOCTYPE html><html><head>" . "<script type='text/javascript' src='" . $wp_scripts->base_url . $wp_scripts->registered["jquery"]->src . "'></script>" . "<script type='text/javascript' src='" . GFCommon::get_base_url() . "/js/conditional_logic.js'></script>" . "<meta charset='UTF-8' /></head><body>" . $form_string . "</body></html>";
}
if ($ajax && !$is_postback) {
$spinner_url = apply_filters("gform_ajax_spinner_url_{$form_id}", apply_filters("gform_ajax_spinner_url", GFCommon::get_base_url() . "/images/spinner.gif", $form), $form);
$scroll_position = array('default' => '', 'confirmation' => '');
if ($use_anchor !== false) {
$scroll_position['default'] = is_numeric($use_anchor) ? "jQuery(document).scrollTop(" . intval($use_anchor) . ");" : "jQuery(document).scrollTop(jQuery('#gform_wrapper_{$form_id}').offset().top);";
$scroll_position['confirmation'] = is_numeric($use_anchor) ? "jQuery(document).scrollTop(" . intval($use_anchor) . ");" : "jQuery(document).scrollTop(jQuery('#gforms_confirmation_message').offset().top);";
}
$form_string .= "\n <iframe style='display:none;width:0px; height:0px;' src='about:blank' name='gform_ajax_frame_{$form_id}' id='gform_ajax_frame_{$form_id}'></iframe>\n <script type='text/javascript'>//<![CDATA[\n" . "function gformInitSpinner(){" . "jQuery('#gform_{$form_id}').submit(function(){" . "jQuery('#gform_submit_button_{$form_id}').attr('disabled', true).after('<' + 'img id=\"gform_ajax_spinner_{$form_id}\" class=\"gform_ajax_spinner\" src=\"{$spinner_url}\" alt=\"\" />');" . "jQuery('#gform_wrapper_{$form_id} .gform_previous_button').attr('disabled', true); " . "jQuery('#gform_wrapper_{$form_id} .gform_next_button').attr('disabled', true).after('<' + 'img id=\"gform_ajax_spinner_{$form_id}\" class=\"gform_ajax_spinner\" src=\"{$spinner_url}\" alt=\"\" />');" . "});" . "}" . "jQuery(document).ready(function(\$){" . "gformInitSpinner();" . "jQuery('#gform_ajax_frame_{$form_id}').load( function(){" . "var form_content = jQuery(this).contents().find('#gform_wrapper_{$form_id}');" . "var confirmation_content = jQuery(this).contents().find('#gforms_confirmation_message');" . "jQuery('#gform_submit_button_{$form_id}').removeAttr('disabled');" . "if(form_content.length > 0){" . "jQuery('#gform_wrapper_{$form_id}').html(form_content.html());" . "{$scroll_position['default']}" . "if(window['gformInitDatepicker']) {gformInitDatepicker();}" . "if(window['gformInitPriceFields']) {gformInitPriceFields();}" . "var current_page = jQuery('#gform_source_page_number_{$form_id}').val();" . "gformInitSpinner();" . "jQuery(document).trigger('gform_page_loaded', [{$form_id}, current_page]);" . "}" . "else if(confirmation_content.length > 0){" . "setTimeout(function(){" . "jQuery('#gform_wrapper_{$form_id}').replaceWith('<' + 'div id=\\'gforms_confirmation_message\\' class=\\'gform_confirmation_message_{$form_id}\\'' + '>' + confirmation_content.html() + '<' + '/div' + '>');" . "{$scroll_position['confirmation']}" . "jQuery(document).trigger('gform_confirmation_loaded', [{$form_id}]);" . "}, 50);" . "}" . "else{" . "jQuery('#gform_{$form_id}').append(jQuery(this).contents().find('*').html());" . "if(window['gformRedirect']) gformRedirect();" . "}" . "jQuery(document).trigger('gform_post_render', [{$form_id}, current_page]);" . "});" . "});" . "\n//]]></script>";
}
return apply_filters('gform_get_form_filter', $form_string);
} else {
if ($ajax) {
$confirmation_message = "<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body>" . $confirmation_message . "</body></html>";
}
return $confirmation_message;
}
}
示例8: 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;
}
}
示例9: edit_page
private static function edit_page()
{
require_once GFCommon::get_base_path() . "/currency.php";
?>
<style>
#authorizenet_submit_container{clear:both;}
.authorizenet_col_heading{padding-bottom:2px; border-bottom: 1px solid #ccc; font-weight:bold; width:120px;}
.authorizenet_field_cell {padding: 6px 17px 0 0; margin-right:15px;}
.authorizenet_validation_error{ background-color:#FFDFDF; margin-top:4px; margin-bottom:6px; padding-top:6px; padding-bottom:6px; border:1px dotted #C89797;}
.authorizenet_validation_error span {color: red;}
.left_header{float:left; width:200px;}
.margin_vertical_10{margin: 10px 0; padding-left:5px;}
.margin_vertical_30{margin: 30px 0; padding-left:5px;}
.width-1{width:300px;}
.gf_authorizenet_invalid_form{margin-top:30px; background-color:#FFEBE8;border:1px solid #CC0000; padding:10px; width:600px;}
</style>
<script type="text/javascript" src="<?php
echo GFCommon::get_base_url();
?>
/js/gravityforms.js"> </script>
<script type="text/javascript">
var form = Array();
window['gf_currency_config'] = <?php
echo json_encode(RGCurrency::get_currency("USD"));
?>
;
function FormatCurrency(element){
var val = jQuery(element).val();
jQuery(element).val(gformFormatMoney(val));
}
function ToggleSetupFee(){
if(jQuery('#gf_authorizenet_setup_fee').is(':checked')){
jQuery('#authorizenet_setup_fee_container').show('slow');
jQuery('#authorizenet_enable_trial_container, #authorizenet_trial_period_container').slideUp();
}
else{
jQuery('#authorizenet_setup_fee_container').hide('slow');
jQuery('#authorizenet_enable_trial_container').slideDown();
ToggleTrial();
}
}
function ToggleTrial(){
if(jQuery('#gf_authorizenet_trial_period').is(':checked'))
jQuery('#authorizenet_trial_period_container').show('slow');
else
jQuery('#authorizenet_trial_period_container').hide('slow');
}
</script>
<div class="wrap">
<img alt="<?php
_e("Authorize.Net", "gravityformsauthorizenet");
?>
" style="margin: 15px 7px 0pt 0pt; float: left;" src="<?php
echo self::get_base_url();
?>
/images/authorizenet_wordpress_icon_32.png"/>
<h2><?php
_e("Authorize.Net Transaction Settings", "gravityformsauthorizenet");
?>
</h2>
<?php
//getting setting id (0 when creating a new one)
$id = !empty($_POST["authorizenet_setting_id"]) ? $_POST["authorizenet_setting_id"] : absint($_GET["id"]);
$config = empty($id) ? array("meta" => array(), "is_active" => true) : GFAuthorizeNetData::get_feed($id);
$setup_fee_field_conflict = false;
//initialize variable
//updating meta information
if (rgpost("gf_authorizenet_submit")) {
$config["form_id"] = absint(rgpost("gf_authorizenet_form"));
$config["meta"]["type"] = rgpost("gf_authorizenet_type");
$config["meta"]["enable_receipt"] = rgpost('gf_authorizenet_enable_receipt');
$config["meta"]["update_post_action"] = rgpost('gf_authorizenet_update_action');
// authorizenet conditional
$config["meta"]["authorizenet_conditional_enabled"] = rgpost('gf_authorizenet_conditional_enabled');
$config["meta"]["authorizenet_conditional_field_id"] = rgpost('gf_authorizenet_conditional_field_id');
$config["meta"]["authorizenet_conditional_operator"] = rgpost('gf_authorizenet_conditional_operator');
$config["meta"]["authorizenet_conditional_value"] = rgpost('gf_authorizenet_conditional_value');
//recurring fields
$config["meta"]["recurring_amount_field"] = rgpost("gf_authorizenet_recurring_amount");
$config["meta"]["billing_cycle_number"] = rgpost("gf_authorizenet_billing_cycle_number");
$config["meta"]["billing_cycle_type"] = rgpost("gf_authorizenet_billing_cycle_type");
$config["meta"]["recurring_times"] = rgpost("gf_authorizenet_recurring_times");
$config["meta"]["recurring_retry"] = rgpost('gf_authorizenet_recurring_retry');
$config["meta"]["setup_fee_enabled"] = rgpost('gf_authorizenet_setup_fee');
$config["meta"]["setup_fee_amount_field"] = rgpost('gf_authorizenet_setup_fee_amount');
$has_setup_fee = $config["meta"]["setup_fee_enabled"];
$config["meta"]["trial_period_enabled"] = $has_setup_fee ? false : rgpost('gf_authorizenet_trial_period');
$config["meta"]["trial_amount"] = $has_setup_fee ? "" : rgpost('gf_authorizenet_trial_amount');
$config["meta"]["trial_period_number"] = "1";
//$has_setup_fee ? "" : rgpost('gf_authorizenet_trial_period_number');
//api settings fields
$config["meta"]["api_settings_enabled"] = rgpost('gf_authorizenet_api_settings');
//.........这里部分代码省略.........
示例10: is_currency_decimal_dot
/**
* Add backwards compatibility to users running Gravity Forms 1.8.3 or below
* which don't have this function built in.
* Once support is dropped for Gravity Forms 1.8.x this function can be removed.
* Added in v3.7.1
* @param Array $currency A currency type
* @return String Whether currency should be displayed as 'decimal_dot' or 'decimal_comma'
*/
public static function is_currency_decimal_dot($currency = null)
{
if ($currency == null) {
$code = GFCommon::get_currency();
if (empty($code)) {
$code = "USD";
}
$currency = RGCurrency::get_currency($code);
}
return rgar($currency, "decimal_separator") == ".";
}
示例11: register_scripts
/**
* Register scripts and init the gperk object
*
*/
public static function register_scripts()
{
wp_register_style('gwp-admin', self::get_base_url() . '/styles/admin.css');
wp_register_script('gwp-common', self::get_base_url() . '/scripts/common.js', array('jquery'), GravityPerks::$version);
wp_register_script('gwp-admin', self::get_base_url() . '/scripts/admin.js', array('jquery', 'gwp-common'), GravityPerks::$version);
wp_register_script('gwp-frontend', self::get_base_url() . '/scripts/frontend.js', array('jquery', 'gwp-common'), GravityPerks::$version);
wp_register_script('gwp-repeater', self::get_base_url() . '/scripts/repeater.js', array('jquery'), GravityPerks::$version);
// register our scripts with Gravity Forms so they are not blocked when noconflict mode is enabled
add_filter('gform_noconflict_scripts', create_function('$scripts', 'return array_merge($scripts, array("gwp-admin", "gwp-frontend", "gwp-common"));'));
add_filter('gform_noconflict_styles', create_function('$styles', 'return array_merge($styles, array("gwp-admin"));'));
require_once GFCommon::get_base_path() . '/currency.php';
wp_localize_script('gwp-common', 'gperk', array('baseUrl' => self::get_base_url(), 'gformBaseUrl' => GFCommon::get_base_url(), 'currency' => RGCurrency::get_currency(GFCommon::get_currency())));
add_action('admin_enqueue_scripts', array('GWPerks', 'enqueue_scripts'));
}
示例12: settings_coupon_amount_type
/**
* Renders the couponAmountType setting.
*
* @param array $field The setting properties.
* @param bool|true $echo
*
* @return string
*/
public function settings_coupon_amount_type($field, $echo = true)
{
require_once GFCommon::get_base_path() . '/currency.php';
$currency = RGCurrency::get_currency(GFCommon::get_currency());
$currency_symbol = !empty($currency['symbol_left']) ? $currency['symbol_left'] : $currency['symbol_right'];
wp_enqueue_script(array('jquery-ui-datepicker'));
$styles = '<style type="text/css">
td img.ui-datepicker-trigger {
position: relative;
top: 4px;
}
</style>';
$js_script = '<script type="text/javascript">
var currency_config = ' . json_encode(RGCurrency::get_currency(GFCommon::get_currency())) . ';
var form = Array();
jQuery(document).on(\'change\', \'.gf_format_money\', function(){
var cur = new Currency(currency_config)
jQuery(this).val(cur.toMoney(jQuery(this).val()));
});
jQuery(document).on(\'change\', \'.gf_format_percentage\', function(event){
var cur = new Currency(currency_config)
var value = cur.toNumber(jQuery(this).val()) ? cur.toNumber(jQuery(this).val()) + \'%\' : \'\';
jQuery(this).val( value );
});
function SetCouponType(elem) {
var type = elem.val();
var formatClass = type == \'flat\' ? \'gf_format_money\' : \'gf_format_percentage\';
jQuery(\'#couponAmount\').removeClass(\'gf_format_money gf_format_percentage\').addClass(formatClass).trigger(\'change\');
var placeholderText = type == \'flat\' ? \'' . html_entity_decode(GFCommon::to_money(1)) . '\' : \'1%\';
jQuery(\'#couponAmount\').attr("placeholder",placeholderText);
}
jQuery(document).ready(function($){
//set placeholder text for initial load
var type = jQuery(\'#couponAmountType\').val();
var placeholderText = type == \'flat\' ? \'' . html_entity_decode(GFCommon::to_money(1)) . '\' : \'1%\';
jQuery(\'#couponAmount\').attr("placeholder",placeholderText);
//format initial coupon amount value when there is one and it is currency
var currency_config = ' . json_encode(RGCurrency::get_currency(GFCommon::get_currency())) . ';
var cur = new Currency(currency_config);
couponAmount = jQuery(\'#couponAmount\').val();
if ( couponAmount ){
if (type == \'flat\'){
couponAmount = cur.toMoney(couponAmount);
}
else{
couponAmount = cur.toNumber(couponAmount) + \'%\';
}
jQuery(\'#couponAmount\').val(couponAmount);
}
jQuery(\'.datepicker\').each(
function (){
var image = "' . $this->get_base_url() . '/images/calendar.png";
jQuery(this).datepicker({showOn: "both", buttonImage: image, buttonImageOnly: true, dateFormat: "mm/dd/yy" });
}
);
});
</script>';
$field['type'] = 'select';
$field['choices'] = array(array('label' => esc_html__('Flat', 'gravityformscoupons') . '(' . $currency_symbol . ')', 'name' => 'flat', 'value' => 'flat'), array('label' => esc_html__('Percentage(%)', 'gravityformscoupons'), 'name' => 'percentage', 'value' => 'percentage'));
$field['onchange'] = 'SetCouponType(jQuery(this))';
$html = $this->settings_select($field, false);
$field2 = array();
$field2['type'] = 'text';
$field2['name'] = 'couponAmount';
$field2['required'] = true;
$field2['class'] = $this->get_setting('couponAmountType') == 'percentage' ? 'gf_format_percentage' : 'gf_format_money';
$html2 = $this->settings_text($field2, false);
if ($echo) {
echo $styles . $js_script . $html . $html2;
}
return $styles . $js_script . $html . $html2;
}