Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
1.7.15 Critical Security Fix. Stripe and Braintree updates. Other bug…
Browse files Browse the repository at this point in the history
… fixes and minor enhancements.

git-svn-id: https://plugins.svn.wordpress.org/paid-memberships-pro/trunk@1025896 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
strangerstudios committed Nov 14, 2014
1 parent 9751de7 commit a10898c
Show file tree
Hide file tree
Showing 45 changed files with 1,774 additions and 971 deletions.
34 changes: 31 additions & 3 deletions adminpages/discountcodes.php
Expand Up @@ -428,7 +428,18 @@
<tbody>
<tr>
<th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
<td><?php echo $pmpro_currency_symbol?><input name="initial_payment[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" /> <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
<td>
<?php
if(pmpro_getCurrencyPosition() == "left")
echo $pmpro_currency_symbol;
?>
<input name="initial_payment[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" />
<?php
if(pmpro_getCurrencyPosition() == "right")
echo $pmpro_currency_symbol;
?>
<small><?php _e('The initial amount collected at registration.', 'pmpro');?></small>
</td>
</tr>

<tr>
Expand All @@ -439,7 +450,16 @@
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
<td>
<?php echo $pmpro_currency_symbol?><input name="billing_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" /> <small>per</small>
<?php
if(pmpro_getCurrencyPosition() == "left")
echo $pmpro_currency_symbol;
?>
<input name="billing_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" />
<?php
if(pmpro_getCurrencyPosition() == "right")
echo $pmpro_currency_symbol;
?>
<small>per</small>
<input name="cycle_number[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
<select name="cycle_period[]" onchange="updateCyclePeriod();">
<?php
Expand Down Expand Up @@ -471,7 +491,15 @@
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
<th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
<td>
<?php echo $pmpro_currency_symbol?><input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
<?php
if(pmpro_getCurrencyPosition() == "left")
echo $pmpro_currency_symbol;
?>
<input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
<?php
if(pmpro_getCurrencyPosition() == "right")
echo $pmpro_currency_symbol;
?>
<small><?php _e('for the first', 'pmpro');?></small>
<input name="trial_limit[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
<small><?php _e('subscription payments', 'pmpro');?>.</small>
Expand Down
9 changes: 3 additions & 6 deletions adminpages/functions.php
Expand Up @@ -39,12 +39,10 @@ function pmpro_checkLevelForStripeCompatibility($level = NULL)
{
/*
Stripe currently does not support:
* Trial Amounts > 0.
* Daily billing periods.
* Trial Amounts > 0.
* Billing Limits.
*/
if($level->trial_amount > 0 ||
($level->cycle_number > 0 && $level->cycle_period == "Day") ||
if($level->trial_amount > 0 ||
$level->billing_limit > 0)
{
return false;
Expand Down Expand Up @@ -97,8 +95,7 @@ function pmpro_checkLevelForPayflowCompatibility($level = NULL)
*/

if($level->trial_amount > 0 ||
$level->cycle_number > 1 ||
($level->cycle_number == 1 && $level->cycle_period == "Day"))
$level->cycle_number > 1)
{
return false;
}
Expand Down
39 changes: 33 additions & 6 deletions adminpages/membershiplevels.php
Expand Up @@ -337,7 +337,17 @@
<tbody>
<tr>
<th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
<td><?php echo $pmpro_currency_symbol?><input name="initial_payment" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" /> <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
<td>
<?php
if(pmpro_getCurrencyPosition() == "left")
echo $pmpro_currency_symbol;
?>
<input name="initial_payment" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" />
<?php
if(pmpro_getCurrencyPosition() == "right")
echo $pmpro_currency_symbol;
?>
<small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
</tr>

<tr>
Expand All @@ -348,7 +358,16 @@
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
<td>
<?php echo $pmpro_currency_symbol?><input name="billing_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" /> <small><?php _e('per', 'pmpro');?></small>
<?php
if(pmpro_getCurrencyPosition() == "left")
echo $pmpro_currency_symbol;
?>
<input name="billing_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" />
<?php
if(pmpro_getCurrencyPosition() == "right")
echo $pmpro_currency_symbol;
?>
<small><?php _e('per', 'pmpro');?></small>
<input id="cycle_number" name="cycle_number" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
<select id="cycle_period" name="cycle_period">
<?php
Expand Down Expand Up @@ -405,7 +424,15 @@
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
<th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
<td>
<?php echo $pmpro_currency_symbol?><input name="trial_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
<?php
if(pmpro_getCurrencyPosition() == "left")
echo $pmpro_currency_symbol;
?>
<input name="trial_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
<?php
if(pmpro_getCurrencyPosition() == "right")
echo $pmpro_currency_symbol;
?>
<small><?php _e('for the first', 'pmpro');?></small>
<input name="trial_limit" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
<small><?php _e('subscription payments', 'pmpro');?>.</small>
Expand Down Expand Up @@ -541,14 +568,14 @@
<?php if(pmpro_isLevelFree($level)) { ?>
<?php _e('FREE', 'pmpro');?>
<?php } else { ?>
<?php echo $pmpro_currency_symbol?><?php echo $level->initial_payment?>
<?php echo pmpro_formatPrice($level->initial_payment);?>
<?php } ?>
</td>
<td>
<?php if(!pmpro_isLevelRecurring($level)) { ?>
--
<?php } else { ?>
<?php echo $pmpro_currency_symbol?><?php echo $level->billing_amount?> <?php _e('every', 'pmpro');?> <?php echo $level->cycle_number.' '.pmpro_translate_billing_period($level->cycle_period,$level->cycle_number)?>
<?php echo pmpro_formatPrice($level->billing_amount);?> <?php _e('every', 'pmpro');?> <?php echo $level->cycle_number.' '.pmpro_translate_billing_period($level->cycle_period,$level->cycle_number)?>

<?php if($level->billing_limit) { ?>(<?php _e('for', 'pmpro');?> <?php echo $level->billing_limit?> <?php echo sornot($level->cycle_period,$level->billing_limit)?>)<?php } ?>

Expand All @@ -558,7 +585,7 @@
<?php if(!pmpro_isLevelTrial($level)) { ?>
--
<?php } else { ?>
<?php echo $pmpro_currency_symbol?><?php echo $level->trial_amount?> <?php _e('for', 'pmpro');?> <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?>
<?php echo pmpro_formatPrice($level->trial_amount);?> <?php _e('for', 'pmpro');?> <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?>
<?php } ?>
</td>
<td>
Expand Down
6 changes: 3 additions & 3 deletions adminpages/memberslist.php
Expand Up @@ -6,7 +6,7 @@
}

//vars
global $wpdb, $pmpro_currency_symbol;
global $wpdb;
if(isset($_REQUEST['s']))
$s = $_REQUEST['s'];
else
Expand Down Expand Up @@ -193,11 +193,11 @@
<td><?php echo $auser->membership?></td>
<td>
<?php if((float)$auser->initial_payment > 0) { ?>
<?php echo $pmpro_currency_symbol; ?><?php echo $auser->initial_payment?>
<?php echo pmpro_formatPrice($auser->initial_payment);?>
<?php } ?>
<?php if((float)$auser->initial_payment > 0 && (float)$auser->billing_amount > 0) { ?>+<br /><?php } ?>
<?php if((float)$auser->billing_amount > 0) { ?>
<?php echo $pmpro_currency_symbol; ?><?php echo $auser->billing_amount?>/<?php echo $auser->cycle_period?>
<?php echo pmpro_formatPrice($auser->billing_amount);?>/<?php if($auser->cycle_number > 1) { echo $auser->cycle_number . " " . $auser->cycle_period . "s"; } else { echo $auser->cycle_period; } ?>
<?php } ?>
<?php if((float)$auser->initial_payment <= 0 && (float)$auser->billing_amount <= 0) { ?>
-
Expand Down
10 changes: 5 additions & 5 deletions adminpages/orders.php
Expand Up @@ -6,7 +6,7 @@
}

//vars
global $wpdb, $pmpro_currency_symbol;
global $wpdb;
if(isset($_REQUEST['s']))
$s = $_REQUEST['s'];
else
Expand Down Expand Up @@ -425,7 +425,7 @@
<?php if(in_array("status", $read_only_fields) && $order_id > 0) { echo $order->status; } else { ?>
<?php
$statuses = array();
$default_statuses = array("", "success", "cancelled", "review", "token", "refunded");
$default_statuses = array("", "success", "cancelled", "review", "token", "refunded", "pending");
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
asort($statuses);
Expand Down Expand Up @@ -613,7 +613,7 @@

<select id="start-month" name="start-month">
<?php for($i = 1; $i < 13; $i++) { ?>
<option value="<?php echo $i;?>" <?php selected($start_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
<option value="<?php echo $i;?>" <?php selected($start_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
<?php } ?>
</select>

Expand All @@ -625,7 +625,7 @@

<select id="end-month" name="end-month">
<?php for($i = 1; $i < 13; $i++) { ?>
<option value="<?php echo $i;?>" <?php selected($end_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
<option value="<?php echo $i;?>" <?php selected($end_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i,2));?></option>
<?php } ?>
</select>

Expand Down Expand Up @@ -935,7 +935,7 @@ function pmpro_ShowMonthOrYear()
</td>
<?php do_action("pmpro_orders_extra_cols_body", $order);?>
<td><?php echo $order->membership_id;?></td>
<td><?php echo $pmpro_currency_symbol . $order->total;?></td>
<td><?php echo pmpro_formatPrice($order->total);?></td>
<td>
<?php if(!empty($order->payment_type)) echo $order->payment_type . "<br />";?>
<?php if(!empty($order->accountnumber)) { ?>
Expand Down
2 changes: 2 additions & 0 deletions adminpages/paymentsettings.php
Expand Up @@ -391,6 +391,8 @@ function pmpro_changeGateway(gateway)
global $pmpro_currencies;
foreach($pmpro_currencies as $ccode => $cdescription)
{
if(is_array($cdescription))
$cdescription = $cdescription['name'];
?>
<option value="<?php echo $ccode?>" <?php if($currency == $ccode) { ?>selected="selected"<?php } ?>><?php echo $cdescription?></option>
<?php
Expand Down
25 changes: 17 additions & 8 deletions adminpages/reports/memberships.php
Expand Up @@ -86,15 +86,15 @@ function pmpro_report_memberships_widget() {
<label class="section-label"><?php _e('Other Stats', 'pmpro');?>:</label>
<div style="width: 33%; float: left;">
<label><?php _e('Monthly Recurring Revenue (MRR)', 'pmpro');?></label>
<em><?php echo $pmpro_currency_symbol . $pmpro_mrr = number_format(pmpro_getMRR( 'all time' ), 2); ?></em>
<em><?php echo pmpro_formatPrice(pmpro_getMRR( 'all time' )); ?></em>
</div>
<div style="width: 33%; float: left;">
<label><?php _e('Cancellation Rate', 'pmpro');?></label>
<em><?php echo pmpro_getCancellationRate('all time' ); ?>%</em>
</div>
<div style="width: 33%; float: left;">
<label><?php _e('Lifetime Value (LTV)', 'pmpro');?></label>
<em><?php echo $pmpro_currency_symbol . number_format(pmpro_getLTV('all time' ), 2); ?></em>
<em><?php echo pmpro_formatPrice(pmpro_getLTV('all time')); ?></em>
</div>
<div class="clear"></div>
</span>
Expand Down Expand Up @@ -189,7 +189,7 @@ function pmpro_report_memberships_page()
$cols = array();
if($period == "daily")
{
$lastday = date("t", $startdate);
$lastday = date("t", strtotime($startdate, current_time("timestamp")));

for($i = 1; $i <= $lastday; $i++)
{
Expand Down Expand Up @@ -304,7 +304,7 @@ function pmpro_report_memberships_page()
<span id="for"><?php _ex('for', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?></span>
<select id="month" name="month">
<?php for($i = 1; $i < 13; $i++) { ?>
<option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
<option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
<?php } ?>
</select>
<select id="year" name="year">
Expand Down Expand Up @@ -376,14 +376,14 @@ function drawChart() {
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
<?php foreach($dates as $key => $value) { ?>
['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$value->date)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo $value->signups; ?>, <?php echo $value->cancellations; ?>],
['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$value->date,2)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo $value->signups; ?>, <?php echo $value->cancellations; ?>],
<?php } ?>
<?php endif; ?>

<?php if ( $type === "mrr_ltv" ) : // Signups vs. cancellations ?>
['<?php echo $date_function;?>', 'MRR', 'LTV'],
<?php foreach($dates as $key => $value) { ?>
['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$value->date)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo (($mrr = $value->total / $value->months) && $mrr != 0) ? $mrr : 0; ?>, <?php echo pmpro_getLTV($period, NULL, $mrr ); ?>],
['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$value->date,2)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo (($mrr = $value->total / $value->months) && $mrr != 0) ? $mrr : 0; ?>, <?php echo pmpro_getLTV($period, NULL, $mrr ); ?>],
<?php } ?>
<?php endif; ?>
]);
Expand All @@ -397,9 +397,18 @@ function drawChart() {
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
<?php elseif ( $type === "mrr_ltv" ) : // MRR & LTV ?>
var formatter = new google.visualization.NumberFormat({prefix: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});

<?php
//prefix or suffix?
if(pmpro_getCurrencyPosition() == "right")
$position = "suffix";
else
$position = "prefix";
?>

var formatter = new google.visualization.NumberFormat({<?php echo $position;?>: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
formatter.format(data, 2);
var formatter = new google.visualization.NumberFormat({prefix: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
var formatter = new google.visualization.NumberFormat({<?php echo $position;?>: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
formatter.format(data, 1);

var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
Expand Down

0 comments on commit a10898c

Please sign in to comment.