Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

View File

@ -0,0 +1,345 @@
<?php
/**
* Coupon code view.
*
* @since 2.0.0
*/
?>
<?php
if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset($_GET['step']) && $_GET['step'] == 'plan') :
$coupon = wu_get_coupon($_GET['coupon']);
?>
<div id="coupon-code-app">
</div>
<script>
(function($) {
var coupon_app = new Vue({
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)); ?>',
success: false,
},
mounted: function() {
this.apply_coupon();
this.add_event_tabs();
},
methods: {
add_event_tabs: function() {
$('.wu-plans-frequency-selector li a').each(function() {
this.addEventListener('click',function() {
coupon_app.apply_coupon();
});
});
},
apply_coupon: function() {
if(this.coupon) {
$("body").block({
message: null,
overlayCSS: {
background: "#F1F1F1",
opacity: 0.6
}
});
this.coupon_id = this.coupon.id;
var coupon_type = this.type;
var coupon_value = this.value;
var applies_to_setup_fee = this.applies_to_setup_fee;
var setup_fee_discount_value = this.setup_fee_discount_value;
var setup_fee_discount_type = this.setup_fee_discount_type;
var allowed_plans = $.parseJSON(this.allowed_plans);
var allowed_freqs = $.parseJSON(this.allowed_freqs);
//$('#signupform').append($('#coupon_id'));
$('.superscript').show();
$('h5 sub').show();
setTimeout( function() { $('.wu-plan').each(function() {
if (!$(this).find('.old-price').get(0)) {
$(this).find('h4').after('<div class="old-price">--</div>');
} // end if;
let plan_id = $(this).data('plan');
let is_allowed_plan = false;
let is_allowed_freq = false;
// check plan is_allowed
if (typeof allowed_plans === 'object'){
for (var each_plan of allowed_plans) {
if (parseInt(each_plan) == plan_id) {
is_allowed_plan = true;
}
} // end for;
} else {
is_allowed_plan = true;
}
// check freq is_allowed
if (typeof allowed_freqs === 'object'){
for (var each_freq of allowed_freqs) {
if (each_freq == $('#wu_plan_freq').val()) {
is_allowed_freq = true;
}
} // end for;
} else {
is_allowed_freq = true;
}
if (!is_allowed_plan) {
$("body").unblock();
return;
} // end if;
if (!is_allowed_freq) {
$("body").unblock();
$(".old-price").hide();
$(".off-value").hide();
return;
} else {
$(".old-price").show();
$(".off-value").show();
}
let old_price = $(this).data('price-' + $('#wu_plan_freq').val());
old_price = wu_fix_money_string(old_price);
let new_price = 0;
let old_yearly_value = old_price * jQuery('#wu_plan_freq').val();
let new_yearly_value = 0;
let old_setupfee = $(this).find('.pricing-table-setupfee') ? $(this).find('.pricing-table-setupfee').attr('data-value') : 0;
let new_setupfee = 0;
let off_with_symbol = '';
// OFF RENDER
if (coupon_type != '"absolute"')
off_with_symbol = ''.concat(coupon_value, '%');
else
off_with_symbol = accounting.formatMoney(parseFloat(coupon_value));
$(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>');
}
if(applies_to_setup_fee) {
if (setup_fee_discount_type != '"absolute"')
setupfee_off_with_symbol = ''.concat(setup_fee_discount_value, '%');
else
setupfee_off_with_symbol = accounting.formatMoney(parseFloat(setup_fee_discount_value));
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>');
}
}
// END OFF RENDER
if(coupon_type != '"absolute"') {
new_price = old_price * ((100 - coupon_value) / 100);
new_yearly_value = old_yearly_value * ((100 - coupon_value) / 100);
} else {
if(jQuery('#wu_plan_freq').val() > 1){
new_price = ((old_price * jQuery('#wu_plan_freq').val()) - parseFloat(coupon_value)) / jQuery('#wu_plan_freq').val();
new_yearly_value = old_yearly_value - parseFloat(coupon_value);
} else {
new_price = old_price - parseFloat(coupon_value);
new_yearly_value = old_yearly_value - parseFloat(coupon_value);
}
} // end if;
if (applies_to_setup_fee) {
if (setup_fee_discount_type != '"absolute"') {
new_setupfee = old_setupfee * ((100 - setup_fee_discount_value) / 100);
} else {
new_setupfee = old_setupfee - parseFloat(setup_fee_discount_value);
} // end if;
} else {
new_setupfee = old_setupfee;
} // end if;
if (new_yearly_value > 0) {
wu_set_yearly_value(this, new_yearly_value);
} else {
$(this).find('.total-price.total-price-' + $('#wu_plan_freq').val() ).html(' <?php esc_js(_e('Free!', 'wp-ultimo')); ?>');
}
if (new_setupfee > 0) {
wu_set_setupfee_value(this, new_setupfee);
} else {
$(this).find('.pricing-table-setupfee').html(' <?php esc_js(_e('No Setup Fee', 'wp-ultimo')); ?>');
}
if (new_price > 0) {
$(this).find('.plan-price').html( accounting.formatMoney( parseFloat(new_price) ) );
if ( $(this).find('.plan-price').html().indexOf(wpu.currency_symbol) !== -1 ) {
$(this).find('.plan-price').html($(this).find('.plan-price').html().replace(wpu.currency_symbol, ''));
}
} else {
let plan_price = $(this).find('.plan-price');
plan_price.html(' <?php esc_js(_e('Free!', 'wp-ultimo')); ?>');
let hagacinco = $(this).find('h5');
hagacinco.find('sub').hide();
hagacinco.find('.superscript').hide();
}
$("body").unblock();
}); }, 400);
} else {
$('.old-price').hide();
this.coupon_id = '';
$('.wu-plan').each(function() {
var price = $(this).data('price-' + $('#wu_plan_freq').val());
$(this).find('.plan-price').html( price );
});
}
}
}
});
})(jQuery);
function wu_fix_money_string(value) {
if(typeof value == 'number'){
value = value.toString();
}
return parseFloat(value.replace(wpu.thousand_separator, '').replace(wpu.decimal_separator, '.'));
}
function wu_set_setupfee_value(list, value) {
jQuery(list).find('.pricing-table-setupfee').html( accounting.formatMoney(value));
}
function wu_set_yearly_value(list, value) {
var current_freq = jQuery('#wu_plan_freq').val();
var string = jQuery(list).find('.total-price.total-price-' + current_freq).html();
if (string) {
var parts = string.split(',');
var result = accounting.formatMoney(parseFloat(value)) + ', ' + parts[1];
jQuery(list).find('.total-price.total-price-' + current_freq).html(result);
}
}
</script>
<?php
endif;
// wp_enqueue_style('wub-checkout', WP_Ultimo_Billwerk()->get_asset('checkout.min.css', 'css'), false); ?>

View File

@ -0,0 +1,54 @@
<?php
/**
* Displays the frequency selector for the pricing tables
*
* This template can be overridden by copying it to yourtheme/wp-ultimo/signup/pricing-table/frequency-selector.php.
*
* HOWEVER, on occasion WP Ultimo will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @author NextPress
* @package WP_Ultimo/Views
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
?>
<?php if (wu_get_setting('enable_price_3', true) || wu_get_setting('enable_price_12', true)) : ?>
<ul class="wu-plans-frequency-selector">
<?php
$prices = array(
1 => __('Monthly', 'wp-ultimo'),
3 => __('Quarterly', 'wp-ultimo'),
12 => __('Yearly', 'wp-ultimo'),
);
$first = true;
foreach ($prices as $type => $name) :
if (!wu_get_setting('enable_price_'.$type, true)) continue;
?>
<li>
<a class="<?php echo $first ? 'active first' : ''; ?>" data-frequency-selector="<?php echo $type; ?>" href="#">
<?php echo $name; ?>
</a>
</li>
<?php $first = false; endforeach; ?>
</ul>
<?php endif; ?>

View File

@ -0,0 +1,26 @@
<?php
/**
* Displays the error message in case there are no plans availabe for subscription
*
* This template can be overridden by copying it to yourtheme/wp-ultimo/signup/no-plan.php.
*
* HOWEVER, on occasion WP Ultimo will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @author NextPress
* @package WP_Ultimo/Views
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
?>
<div class="wu-setup-content-error">
<p><?php _e('There are no Plans created in the platform.', 'wp-ultimo'); ?></p><br>
</div>

View File

@ -0,0 +1,141 @@
<?php
/**
* Displays each individual plan on the pricing table loop
*
* This template can be overridden by copying it to yourtheme/wp-ultimo/signup/plan.php.
*
* HOWEVER, on occasion WP Ultimo will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @author NextPress
* @package WP_Ultimo/Views
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
?>
<?php
/**
* Set plan attributes
* @var string
*/
$plan_attrs = '';
foreach (array(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)));
$plan_attrs .= " data-price-$type='$price'";
} // end foreach;
$plan_attrs = apply_filters("wu_pricing_table_plan", $plan_attrs, $plan);
?>
<div id="plan-<?php echo $plan->get_id(); ?>" data-plan="<?php echo $plan->get_id(); ?>" <?php echo $plan_attrs; ?> class="<?php echo "wu-product-{$plan->get_id()}"; ?> lift wu-plan plan-tier <?php echo $plan->is_featured_plan() ? 'callout' : ''; ?> wu-col-sm-<?php echo $columns; ?> wu-col-xs-12">
<?php if ($plan->is_featured_plan()) : ?>
<h6><?php echo apply_filters('wu_featured_plan_label', __('Featured Plan', 'wp-ultimo'), $plan); ?></h6>
<?php endif; ?>
<h4 class="wp-ui-primary"><?php echo $plan->get_name(); ?></h4>
<!-- Price -->
<?php if ($plan->is_free()) : ?>
<h5>
<span class="plan-price"><?php _e('Free!', 'wp-ultimo'); ?></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>
</h5>
<?php else : ?>
<h5>
<?php $symbol_left = in_array(wu_get_setting('currency_position', '%s%v'), array('%s%v', '%s %v')); ?>
<?php if ($symbol_left) : ?><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>
</h5>
<?php endif; ?>
<!-- end Price -->
<p class="early-adopter-price"><?php echo $plan->get_description(); ?>&nbsp;</p><br>
<!-- Feature List Begins -->
<ul>
<?php
/**
*
* Display quarterly and Annually plans, to be hidden
*
*/
$prices_total = array(
3 => __('every 3 months', 'wp-ultimo'),
12 => __('yearly', 'wp-ultimo'),
);
foreach ($prices_total as $freq => $string) {
$text = sprintf(__('%1$s, billed %2$s', 'wp-ultimo'), 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
*/
foreach ($plan->get_pricing_table_lines() as $key => $line) : ?>
<li class="<?php echo str_replace('_', '-', $key); ?>"><?php echo $line; ?></li>
<?php endforeach; ?>
<?php
$button_attrubutes = apply_filters('wu_plan_select_button_attributes', "", $plan, $current_plan);
$button_label = $current_plan != null && $current_plan->id == $plan->get_id() ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
$button_label = apply_filters('wu_plan_select_button_label', $button_label, $plan, $current_plan);
?>
<?php if ($plan->is_contact_us()) : ?>
<li class="wu-cta">
<a href="<?php echo $plan->contact_us_link; ?>" class="button button-primary">
<?php echo $plan->get_contact_us_label(); ?>
</a>
</li>
<?php else : ?>
<li class="wu-cta">
<button type="submit" name="plan_id" class="button button-primary button-next" value="<?php echo $plan->get_id(); ?>" <?php echo $button_attrubutes; ?>>
<?php echo $button_label; ?>
</button>
</li>
<?php endif; ?>
</ul>
<!-- Feature List Begins -->
</div>

View File

@ -0,0 +1,138 @@
<?php
/**
* Displays the pricing tables
*
* This template can be overridden by copying it to yourtheme/wp-ultimo/signup/princing-table/princing-table.php.
*
* HOWEVER, on occasion WP Ultimo will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @author NextPress
* @package WP_Ultimo/Views
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
?>
<?php
/**
* Get the Colors to be used
*/
$primary_color = wu_color($atts['primary_color']);
$accent_color = wu_color($atts['accent_color']);
$accent_color_2 = wu_color($accent_color->darken(4));
?>
<style>
.wu-content-plan .plan-tier h4 {
background-color: #<?php echo $primary_color->getHex(); ?>;
color: <?php echo $primary_color->isDark() ? "white" : "#333"; ?> !important;
}
.wu-content-plan .plan-tier.callout h6 {
background-color: #<?php echo $accent_color->getHex(); ?>;
color: <?php echo $accent_color->isDark() ? "#f9f9f9" : "rgba(39,65,90,.5)"; ?> !important;
}
.wu-content-plan .plan-tier.callout h4 {
background-color: #<?php echo $accent_color_2->getHex(); ?>;
color: <?php echo $accent_color->isDark() ? "white" : "#333"; ?> !important;
}
</style>
<div class="wu-setup-content wu-content-<?php echo isset($is_shortcode) && $is_shortcode ? 'shortcode-plan' : 'plan'; ?>">
<?php
/**
* Display the frequency selector
*/
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
*/
if (empty($plans)) {
wu_get_template('legacy/signup/pricing-table/no-plans');
} else { ?>
<form id="signupform" method="post">
<?php
/**
* Required: Prints the essential fields necessary to this form to work properly
*/
$signup->form_fields($current_plan);
?>
<div class="layer plans">
<?php
/**
* Display the plan table
*/
$count = count($plans);
$columns = $count == 5 ? '2-4' : 12 / $count;
foreach ($plans as $plan) {
wu_get_template('legacy/signup/pricing-table/plan', array(
'plan' => $plan,
'count' => $count,
'columns' => $columns,
'current_plan' => $current_plan,
));
} // end foreach;
?>
<div style="clear: both"></div>
</div>
</form>
<?php } // end if no-plans; ?>
</div>
<script type="text/javascript">
(function ($) {
$(document).ready(function () {
/**
* Select the default pricing option
*/
setTimeout(function() {
$('[data-frequency-selector="<?php echo wu_get_setting('default_pricing_option', 1); ?>"]').click();
}, 100);
});
})(jQuery);
</script>