Prep Plugin for release on WordPress.org (#23)
* Update translation text domain * Escape everything that should be escaped. * Add nonce checks where needed. * Sanitize all inputs. * Apply Code style changes across the codebase. * Correct many deprecation notices. * Optimize load order of many filters. * Add Proper Build script * Use emojii flags * Fix i18n deprecation notice for translating too early * Put all scripts in footer and load async
This commit is contained in:
@ -21,14 +21,14 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
el: "#coupon-code-app",
|
||||
data: {
|
||||
coupon_id: '',
|
||||
coupon: '<?php echo json_encode($coupon); ?>',
|
||||
type : '<?php echo json_encode(get_post_meta($coupon->id, 'wpu_type', true)); ?>',
|
||||
value : parseFloat(<?php echo json_encode(get_post_meta($coupon->id, 'wpu_value', true)); ?>),
|
||||
applies_to_setup_fee : <?php echo json_encode(get_post_meta($coupon->id, 'wpu_applies_to_setup_fee', true)); ?>,
|
||||
setup_fee_discount_value : parseFloat(<?php echo json_encode(get_post_meta($coupon->id, 'wpu_setup_fee_discount_value', true)); ?>),
|
||||
setup_fee_discount_type : '<?php echo json_encode(get_post_meta($coupon->id, 'wpu_setup_fee_discount_type', true)); ?>',
|
||||
allowed_plans : '<?php echo json_encode(get_post_meta($coupon->id, 'wpu_allowed_plans', true)); ?>',
|
||||
allowed_freqs : '<?php echo json_encode(get_post_meta($coupon->id, 'wpu_allowed_freqs', true)); ?>',
|
||||
coupon: '<?php echo wp_json_encode($coupon); ?>',
|
||||
type : '<?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_type', true)); ?>',
|
||||
value : parseFloat(<?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_value', true)); ?>),
|
||||
applies_to_setup_fee : <?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_applies_to_setup_fee', true)); ?>,
|
||||
setup_fee_discount_value : parseFloat(<?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_setup_fee_discount_value', true)); ?>),
|
||||
setup_fee_discount_type : '<?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_setup_fee_discount_type', true)); ?>',
|
||||
allowed_plans : '<?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_allowed_plans', true)); ?>',
|
||||
allowed_freqs : '<?php echo wp_json_encode(get_post_meta($coupon->id, 'wpu_allowed_freqs', true)); ?>',
|
||||
success: false,
|
||||
},
|
||||
mounted: function() {
|
||||
@ -87,7 +87,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
|
||||
$(this).find('h4').after('<div class="old-price">--</div>');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
let plan_id = $(this).data('plan');
|
||||
|
||||
@ -104,7 +104,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
is_allowed_plan = true;
|
||||
}
|
||||
|
||||
} // end for;
|
||||
}
|
||||
|
||||
} else {
|
||||
is_allowed_plan = true;
|
||||
@ -120,7 +120,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
is_allowed_freq = true;
|
||||
}
|
||||
|
||||
} // end for;
|
||||
}
|
||||
|
||||
} else {
|
||||
is_allowed_freq = true;
|
||||
@ -131,7 +131,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
$("body").unblock();
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (!is_allowed_freq) {
|
||||
|
||||
@ -172,7 +172,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
$(this).find('.old-price').html(accounting.formatMoney(parseFloat(old_price)));
|
||||
if (!$(this).find('.off-value').get(0)) {
|
||||
|
||||
$(this).find('.old-price').after('<div class="off-value">(' + off_with_symbol + ' ' + '<?php _e('OFF', 'wp-ultimo'); ?>' + ')</div>');
|
||||
$(this).find('.old-price').after('<div class="off-value">(' + off_with_symbol + ' ' + '<?php esc_html_e('OFF', 'wp-multisite-waas'); ?>' + ')</div>');
|
||||
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
|
||||
if (!$(this).find('.setupfee-off-value').get(0)) {
|
||||
|
||||
$(this).find('.pricing-table-setupfee').after('<span class="setupfee-off-value"> (' + setupfee_off_with_symbol + ' ' + '<?php _e('OFF', 'wp-ultimo'); ?>' + ')</span>');
|
||||
$(this).find('.pricing-table-setupfee').after('<span class="setupfee-off-value"> (' + setupfee_off_with_symbol + ' ' + '<?php esc_html_e('OFF', 'wp-multisite-waas'); ?>' + ')</span>');
|
||||
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
|
||||
}
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (applies_to_setup_fee) {
|
||||
|
||||
@ -227,13 +227,13 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
|
||||
new_setupfee = old_setupfee - parseFloat(setup_fee_discount_value);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
new_setupfee = old_setupfee;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (new_yearly_value > 0) {
|
||||
|
||||
@ -241,7 +241,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
|
||||
} else {
|
||||
|
||||
$(this).find('.total-price.total-price-' + $('#wu_plan_freq').val() ).html(' <?php esc_js(_e('Free!', 'wp-ultimo')); ?>');
|
||||
$(this).find('.total-price.total-price-' + $('#wu_plan_freq').val() ).html(' <?php esc_js(_e('Free!', 'wp-multisite-waas')); ?>');
|
||||
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
|
||||
} else {
|
||||
|
||||
$(this).find('.pricing-table-setupfee').html(' <?php esc_js(_e('No Setup Fee', 'wp-ultimo')); ?>');
|
||||
$(this).find('.pricing-table-setupfee').html(' <?php esc_js(_e('No Setup Fee', 'wp-multisite-waas')); ?>');
|
||||
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset(
|
||||
} else {
|
||||
|
||||
let plan_price = $(this).find('.plan-price');
|
||||
plan_price.html(' <?php esc_js(_e('Free!', 'wp-ultimo')); ?>');
|
||||
plan_price.html(' <?php esc_js(_e('Free!', 'wp-multisite-waas')); ?>');
|
||||
let hagacinco = $(this).find('h5');
|
||||
hagacinco.find('sub').hide();
|
||||
hagacinco.find('.superscript').hide();
|
||||
|
@ -28,9 +28,9 @@ if ( ! defined('ABSPATH')) {
|
||||
<?php
|
||||
|
||||
$prices = [
|
||||
1 => __('Monthly', 'wp-ultimo'),
|
||||
3 => __('Quarterly', 'wp-ultimo'),
|
||||
12 => __('Yearly', 'wp-ultimo'),
|
||||
1 => __('Monthly', 'wp-multisite-waas'),
|
||||
3 => __('Quarterly', 'wp-multisite-waas'),
|
||||
12 => __('Yearly', 'wp-multisite-waas'),
|
||||
];
|
||||
|
||||
$first = true;
|
||||
|
@ -22,5 +22,5 @@ if ( ! defined('ABSPATH')) {
|
||||
?>
|
||||
|
||||
<div class="wu-setup-content-error">
|
||||
<p><?php _e('There are no Plans created in the platform.', 'wp-ultimo'); ?></p><br>
|
||||
<p><?php esc_html_e('There are no Plans created in the platform.', 'wp-multisite-waas'); ?></p><br>
|
||||
</div>
|
||||
|
@ -31,9 +31,9 @@ if ( ! defined('ABSPATH')) {
|
||||
$plan_attrs = '';
|
||||
|
||||
foreach ([1, 3, 12] as $type) {
|
||||
$price = $plan->free ? __('Free!', 'wp-ultimo') : str_replace(wu_get_currency_symbol(), '', wu_format_currency((((float) $plan->{'price_' . $type}) / $type)));
|
||||
$price = $plan->free ? __('Free!', 'wp-multisite-waas') : str_replace(wu_get_currency_symbol(), '', wu_format_currency((((float) $plan->{'price_' . $type}) / $type)));
|
||||
$plan_attrs .= " data-price-$type='$price'";
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
$plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
|
||||
@ -43,7 +43,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
|
||||
<?php if ($plan->is_featured_plan()) : ?>
|
||||
|
||||
<h6><?php echo apply_filters('wu_featured_plan_label', __('Featured Plan', 'wp-ultimo'), $plan); ?></h6>
|
||||
<h6><?php echo apply_filters('wu_featured_plan_label', __('Featured Plan', 'wp-multisite-waas'), $plan); ?></h6>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
@ -53,13 +53,13 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
<?php if ($plan->is_free()) : ?>
|
||||
|
||||
<h5>
|
||||
<span class="plan-price"><?php _e('Free!', 'wp-ultimo'); ?></span>
|
||||
<span class="plan-price"><?php esc_html_e('Free!', 'wp-multisite-waas'); ?></span>
|
||||
</h5>
|
||||
|
||||
<?php elseif ($plan->is_contact_us()) : ?>
|
||||
|
||||
<h5>
|
||||
<span class="plan-price-contact-us"><?php echo apply_filters('wu_plan_contact_us_price_line', __('--', 'wp-ultimo')); ?></span>
|
||||
<span class="plan-price-contact-us"><?php echo apply_filters('wu_plan_contact_us_price_line', __('--', 'wp-multisite-waas')); ?></span>
|
||||
</h5>
|
||||
|
||||
<?php else : ?>
|
||||
@ -71,7 +71,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
?>
|
||||
<sup class="superscript"><?php echo wu_get_currency_symbol(); ?></sup><?php endif; ?>
|
||||
<span class="plan-price"><?php echo str_replace(wu_get_currency_symbol(), '', wu_format_currency($plan->price_1)); ?></span>
|
||||
<sub> <?php echo (! $symbol_left ? wu_get_currency_symbol() : '') . ' ' . __('/mo', 'wp-ultimo'); ?></sub>
|
||||
<sub> <?php echo (! $symbol_left ? wu_get_currency_symbol() : '') . ' ' . __('/mo', 'wp-multisite-waas'); ?></sub>
|
||||
</h5>
|
||||
|
||||
<?php endif; ?>
|
||||
@ -89,19 +89,19 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
* Display quarterly and Annually plans, to be hidden
|
||||
*/
|
||||
$prices_total = [
|
||||
3 => __('every 3 months', 'wp-ultimo'),
|
||||
12 => __('yearly', 'wp-ultimo'),
|
||||
3 => __('every 3 months', 'wp-multisite-waas'),
|
||||
12 => __('yearly', 'wp-multisite-waas'),
|
||||
];
|
||||
|
||||
foreach ($prices_total as $freq => $string) {
|
||||
$text = sprintf(__('%1$s, billed %2$s', 'wp-ultimo'), wu_format_currency($plan->{"price_$freq"}), $string);
|
||||
$text = sprintf(__('%1$s, billed %2$s', 'wp-multisite-waas'), wu_format_currency($plan->{"price_$freq"}), $string);
|
||||
|
||||
if ($plan->free || $plan->is_contact_us()) {
|
||||
echo "<li class='total-price total-price-$freq'>-</li>";
|
||||
} else {
|
||||
echo "<li class='total-price total-price-$freq'>$text</li>";
|
||||
}
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop and Displays Pricing Table Lines
|
||||
@ -115,7 +115,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
|
||||
<?php
|
||||
$button_attrubutes = apply_filters('wu_plan_select_button_attributes', '', $plan, $current_plan);
|
||||
$button_label = null != $current_plan && $plan->get_id() == $current_plan->id ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
|
||||
$button_label = null != $current_plan && $plan->get_id() == $current_plan->id ? __('This is your current plan', 'wp-multisite-waas') : __('Select Plan', 'wp-multisite-waas');
|
||||
$button_label = apply_filters('wu_plan_select_button_label', $button_label, $plan, $current_plan);
|
||||
?>
|
||||
|
||||
|
@ -60,7 +60,7 @@ $accent_color_2 = wu_color($accent_color->darken(4));
|
||||
*/
|
||||
if ( ! isset($is_shortcode) || ! $is_shortcode || $atts['show_selector']) {
|
||||
wu_get_template('/legacy/signup/pricing-table/frequency-selector');
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays error message if there are no plans
|
||||
@ -103,7 +103,7 @@ if (empty($plans)) {
|
||||
'current_plan' => $current_plan,
|
||||
]
|
||||
);
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -45,9 +45,9 @@ foreach ($admin_actions as $action => $handlers) {
|
||||
foreach ($handlers as $handler => $priority) {
|
||||
if ( ! has_action($action, $handler) && function_exists($handler)) {
|
||||
add_action($action, $handler, $priority);
|
||||
} // end foreach;
|
||||
} // end foreach;
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do_action('wu_checkout_scripts');
|
||||
|
||||
@ -60,7 +60,7 @@ do_action('wu_checkout_scripts');
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>
|
||||
<?php echo apply_filters('wu_signup_page_title', sprintf(__('%s - Signup', 'wp-ultimo'), get_bloginfo('Name'), get_bloginfo('Name'))); ?>
|
||||
<?php echo apply_filters('wu_signup_page_title', sprintf(__('%s - Signup', 'wp-multisite-waas'), get_bloginfo('Name'), get_bloginfo('Name'))); ?>
|
||||
</title>
|
||||
|
||||
<?php // Signup do action, like the default ?>
|
||||
@ -97,7 +97,7 @@ do_action('wu_checkout_scripts');
|
||||
|
||||
<h1 id="wu-setup-logo">
|
||||
<a href="<?php echo get_site_url(get_current_site()->blog_id); ?>">
|
||||
<?php printf(__('%s - Signup', 'wp-ultimo'), get_bloginfo('Name')); ?>
|
||||
<?php printf(__('%s - Signup', 'wp-multisite-waas'), get_bloginfo('Name')); ?>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
|
@ -31,14 +31,14 @@ if ( ! defined('ABSPATH')) {
|
||||
$nav_links = apply_filters(
|
||||
'wu_signup_form_nav_links',
|
||||
[
|
||||
home_url() => __('Return to Home', 'wp-ultimo'),
|
||||
wp_login_url() => sprintf('<strong>%s</strong>', __('Log In', 'wp-ultimo')),
|
||||
home_url() => __('Return to Home', 'wp-multisite-waas'),
|
||||
wp_login_url() => sprintf('<strong>%s</strong>', __('Log In', 'wp-multisite-waas')),
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! isset($signup->step)) {
|
||||
return;
|
||||
} // end if;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -21,7 +21,7 @@ if ( ! defined('ABSPATH')) {
|
||||
|
||||
if ( ! $signup) {
|
||||
return;
|
||||
} // end if;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -52,7 +52,7 @@ $percent = 100 / $count;
|
||||
$class = 'active';
|
||||
} elseif (array_search($signup->step, array_keys($signup->steps)) > array_search($step_key, array_keys($signup->steps))) {
|
||||
$class = 'done';
|
||||
} // end if;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -72,7 +72,7 @@ $percent = 100 / $count;
|
||||
|
||||
<a class="wu-signup-back-link" href="<?php echo $prev_link; ?>">
|
||||
|
||||
<?php _e('← Go Back to Previous Step', 'wp-ultimo'); ?>
|
||||
<?php esc_html_e('← Go Back to Previous Step', 'wp-multisite-waas'); ?>
|
||||
|
||||
</a>
|
||||
|
||||
|
@ -21,7 +21,7 @@ if ( ! defined('ABSPATH')) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="wu-setup-content wu-content-<?php echo $signup->step; ?>">
|
||||
<div class="wu-setup-content wu-content-<?php echo esc_attr($signup->step); ?>">
|
||||
|
||||
<!-- <p class="message" style="width: 320px; margin-left: auto; margin-right: auto; box-sizing: border-box;">
|
||||
Please enter your username or email address. You will receive a link to create a new password via email.
|
||||
@ -37,7 +37,7 @@ if ( ! defined('ABSPATH')) {
|
||||
* Prints each of our fields using a helper function
|
||||
*/
|
||||
wu_print_signup_field($field_slug, $field, $results);
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -23,7 +23,7 @@ if ( ! defined('ABSPATH')) {
|
||||
|
||||
<div id="wu-your-site-block">
|
||||
|
||||
<small><?php _e('Your URL will be', 'wp-ultimo'); ?></small><br>
|
||||
<small><?php esc_html_e('Your URL will be', 'wp-multisite-waas'); ?></small><br>
|
||||
|
||||
<?php
|
||||
/**
|
||||
@ -31,7 +31,7 @@ if ( ! defined('ABSPATH')) {
|
||||
*/
|
||||
$dynamic_part = '<strong id="wu-your-site" v-html="site_url ? site_url : \'yoursite\'">';
|
||||
// This is used on the yoursite.network.com during sign-up
|
||||
$dynamic_part .= $signup->results['blogname'] ?? __('yoursite', 'wp-ultimo');
|
||||
$dynamic_part .= $signup->results['blogname'] ?? __('yoursite', 'wp-multisite-waas');
|
||||
$dynamic_part .= '</strong>';
|
||||
|
||||
$site_url = preg_replace('#^https?://#', '', WU_Signup()->get_site_url_for_previewer());
|
||||
|
Reference in New Issue
Block a user