Version Description
- BUG: Fixed bug in the Payflow gateway class that was breaking API calls and checkout.
Download this release
Release Info
Developer | strangerstudios |
Plugin | Paid Memberships Pro |
Version | 1.8.6.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.8.6.7 to 1.8.6.8.1
- adminpages/reports.php +1 -1
- adminpages/reports/login.php +2 -2
- adminpages/reports/memberships.php +96 -48
- adminpages/reports/sales.php +2 -2
- classes/gateways/class.pmprogateway_braintree.php +2 -0
- classes/gateways/class.pmprogateway_payflowpro.php +17 -37
- classes/gateways/class.pmprogateway_paypal.php +19 -35
- classes/gateways/class.pmprogateway_paypalexpress.php +20 -36
- classes/gateways/class.pmprogateway_paypalstandard.php +18 -36
- classes/gateways/class.pmprogateway_stripe.php +6 -0
- includes/functions.php +3 -3
- includes/https.php +1 -5
- includes/login.php +0 -4
- pages/billing.php +4 -0
- pages/checkout.php +10 -2
- paid-memberships-pro.php +2 -2
- preheaders/checkout.php +1 -1
- readme.txt +11 -2
adminpages/reports.php
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
}
|
34 |
?>
|
35 |
<div id="pmpro_report_<?php echo $report; ?>" class="postbox pmpro_clickable" onclick="location.href='<?php echo admin_url("admin.php?page=pmpro-reports&report=" . $report);?>';">
|
36 |
-
<
|
37 |
<div class="inside">
|
38 |
<?php call_user_func("pmpro_report_" . $report . "_widget"); ?>
|
39 |
<p style="text-align:center;">
|
33 |
}
|
34 |
?>
|
35 |
<div id="pmpro_report_<?php echo $report; ?>" class="postbox pmpro_clickable" onclick="location.href='<?php echo admin_url("admin.php?page=pmpro-reports&report=" . $report);?>';">
|
36 |
+
<h2 class="hndle"><span><?php echo $title; ?></span></h2>
|
37 |
<div class="inside">
|
38 |
<?php call_user_func("pmpro_report_" . $report . "_widget"); ?>
|
39 |
<p style="text-align:center;">
|
adminpages/reports/login.php
CHANGED
@@ -75,9 +75,9 @@ function pmpro_report_login_page()
|
|
75 |
$l = "";
|
76 |
?>
|
77 |
<form id="posts-filter" method="get" action="">
|
78 |
-
<
|
79 |
<?php _e('Visits, Views, and Logins Report', 'pmpro');?>
|
80 |
-
</
|
81 |
<ul class="subsubsub">
|
82 |
<li>
|
83 |
<?php _ex('Show', 'Dropdown label, e.g. Show All Users', 'pmpro')?> <select name="l" onchange="jQuery('#posts-filter').submit();">
|
75 |
$l = "";
|
76 |
?>
|
77 |
<form id="posts-filter" method="get" action="">
|
78 |
+
<h1>
|
79 |
<?php _e('Visits, Views, and Logins Report', 'pmpro');?>
|
80 |
+
</h1>
|
81 |
<ul class="subsubsub">
|
82 |
<li>
|
83 |
<?php _ex('Show', 'Dropdown label, e.g. Show All Users', 'pmpro')?> <select name="l" onchange="jQuery('#posts-filter').submit();">
|
adminpages/reports/memberships.php
CHANGED
@@ -35,7 +35,7 @@ function pmpro_report_memberships_widget() {
|
|
35 |
<tr>
|
36 |
<th scope="col"> </th>
|
37 |
<th scope="col"><?php _e('Signups','pmpro'); ?></th>
|
38 |
-
<th scope="col"><?php _e('Cancellations','pmpro'); ?></th>
|
39 |
</tr>
|
40 |
</thead>
|
41 |
<tbody>
|
@@ -73,7 +73,7 @@ function pmpro_report_memberships_page()
|
|
73 |
if(isset($_REQUEST['type']))
|
74 |
$type = sanitize_text_field($_REQUEST['type']);
|
75 |
else
|
76 |
-
$type = "
|
77 |
|
78 |
if(isset($_REQUEST['period']))
|
79 |
$period = sanitize_text_field($_REQUEST['period']);
|
@@ -112,6 +112,7 @@ function pmpro_report_memberships_page()
|
|
112 |
elseif($period == "annual")
|
113 |
{
|
114 |
$startdate = '1960-01-01'; //all time
|
|
|
115 |
$date_function = 'YEAR';
|
116 |
}
|
117 |
|
@@ -119,7 +120,7 @@ function pmpro_report_memberships_page()
|
|
119 |
$gateway_environment = pmpro_getOption("gateway_environment");
|
120 |
|
121 |
//get data
|
122 |
-
if ( $type === "signup_v_cancel" ) {
|
123 |
$sqlQuery = "SELECT $date_function(startdate) as date, COUNT(DISTINCT user_id) as signups
|
124 |
FROM $wpdb->pmpro_memberships_users WHERE startdate >= '" . $startdate . "' ";
|
125 |
|
@@ -157,8 +158,8 @@ function pmpro_report_memberships_page()
|
|
157 |
|
158 |
for($i = 1; $i <= $lastday; $i++)
|
159 |
{
|
160 |
-
// Signups vs. Cancellations
|
161 |
-
if ( $type === "signup_v_cancel" ) {
|
162 |
$cols[$i] = new stdClass();
|
163 |
$cols[$i]->signups = 0;
|
164 |
foreach($dates as $date)
|
@@ -174,8 +175,8 @@ function pmpro_report_memberships_page()
|
|
174 |
{
|
175 |
for($i = 1; $i < 13; $i++)
|
176 |
{
|
177 |
-
// Signups vs. Cancellations
|
178 |
-
if ( $type === "signup_v_cancel" ) {
|
179 |
$cols[$i] = new stdClass();
|
180 |
$cols[$i]->date = $i;
|
181 |
$cols[$i]->signups = 0;
|
@@ -208,16 +209,22 @@ function pmpro_report_memberships_page()
|
|
208 |
|
209 |
$dates = ( ! empty( $cols ) ) ? $cols : $dates;
|
210 |
|
211 |
-
// Signups vs.
|
212 |
-
if ( $type === "signup_v_cancel" )
|
213 |
{
|
214 |
$sqlQuery = "SELECT $date_function(mu1.modified) as date, COUNT(DISTINCT mu1.user_id) as cancellations
|
215 |
FROM $wpdb->pmpro_memberships_users mu1
|
216 |
LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON mu1.user_id = mu2.user_id AND
|
217 |
mu2.modified > mu1.enddate AND
|
218 |
-
DATE_ADD(mu1.modified, INTERVAL 1 DAY) > mu2.startdate
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
AND mu1.startdate >= '" . $startdate . "'
|
222 |
AND mu1.startdate < '" . $enddate . "' ";
|
223 |
|
@@ -248,9 +255,9 @@ function pmpro_report_memberships_page()
|
|
248 |
}
|
249 |
?>
|
250 |
<form id="posts-filter" method="get" action="">
|
251 |
-
<
|
252 |
<?php _e('Membership Stats', 'pmpro');?>
|
253 |
-
</
|
254 |
<ul class="subsubsub">
|
255 |
<li>
|
256 |
<?php _ex('Show', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?>
|
@@ -260,7 +267,9 @@ function pmpro_report_memberships_page()
|
|
260 |
<option value="annual" <?php selected($period, "annual");?>><?php _e('Annual', 'pmpro');?></option>
|
261 |
</select>
|
262 |
<select id="type" name="type">
|
|
|
263 |
<option value="signup_v_cancel" <?php selected($type, "signup_v_cancel");?>><?php _e('Signups vs. Cancellations', 'pmpro');?></option>
|
|
|
264 |
<?php /*
|
265 |
<option value="mrr_ltv" <?php selected($type, "mrr_ltv");?>><?php _e('MRR & LTV', 'pmpro');?></option>
|
266 |
*/ ?>
|
@@ -292,7 +301,7 @@ function pmpro_report_memberships_page()
|
|
292 |
|
293 |
<input type="hidden" name="page" value="pmpro-reports" />
|
294 |
<input type="hidden" name="report" value="memberships" />
|
295 |
-
<input type="submit" value="<?php _ex('Generate Report', 'Submit button value.', 'pmpro');?>" />
|
296 |
</li>
|
297 |
</ul>
|
298 |
|
@@ -337,14 +346,28 @@ function pmpro_report_memberships_page()
|
|
337 |
function drawChart() {
|
338 |
|
339 |
var data = google.visualization.arrayToDataTable([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
|
341 |
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
|
342 |
<?php foreach($dates as $key => $value) { ?>
|
343 |
['<?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; ?>],
|
344 |
<?php } ?>
|
345 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
-
<?php if ( $type === "mrr_ltv" ) :
|
348 |
['<?php echo $date_function;?>', 'MRR', 'LTV'],
|
349 |
<?php foreach($dates as $key => $value) { ?>
|
350 |
['<?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 ); ?>],
|
@@ -358,8 +381,9 @@ function pmpro_report_memberships_page()
|
|
358 |
vAxis: {color: 'green', titleTextStyle: {color: '#51a351'}},
|
359 |
};
|
360 |
|
361 |
-
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
|
362 |
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
|
|
|
363 |
<?php elseif ( $type === "mrr_ltv" ) : // MRR & LTV ?>
|
364 |
|
365 |
<?php
|
@@ -434,56 +458,75 @@ function pmpro_getSignups($period = false, $levels = 'all')
|
|
434 |
return $signups;
|
435 |
}
|
436 |
|
437 |
-
//get cancellations
|
438 |
-
function pmpro_getCancellations($period = false, $levels = 'all')
|
439 |
{
|
|
|
|
|
|
|
|
|
440 |
//check for a transient
|
441 |
$cache = get_transient( 'pmpro_report_memberships_cancellations' );
|
442 |
-
|
443 |
-
|
444 |
-
|
|
|
445 |
//figure out start date
|
|
|
|
|
446 |
if( $period == 'today' )
|
447 |
-
|
|
|
|
|
|
|
448 |
elseif( $period == 'this month')
|
449 |
-
|
|
|
|
|
|
|
450 |
elseif( $period == 'this year')
|
451 |
-
|
|
|
|
|
|
|
452 |
else
|
453 |
-
|
454 |
-
|
455 |
-
$
|
456 |
-
|
|
|
|
|
457 |
/*
|
458 |
-
build query.
|
459 |
-
cancellations are marked in the memberships users table with status
|
460 |
we try to ignore cancellations when the user gets a new level with 24 hours (probably an upgrade or downgrade)
|
461 |
*/
|
462 |
global $wpdb;
|
463 |
|
464 |
-
//$sqlQuery = "SELECT mu1.user_id, mu2.user_id FROM $wpdb->pmpro_memberships_users mu1 LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON mu1.user_id = mu2.user_id AND mu2.status = 'inactive' AND mu2.startdate > mu1.startdate";
|
465 |
$sqlQuery = "SELECT COUNT(mu1.id)
|
466 |
-
FROM $wpdb->pmpro_memberships_users mu1
|
467 |
-
LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON mu1.user_id = mu2.user_id AND
|
468 |
-
mu2.modified > mu1.enddate AND
|
469 |
-
DATE_ADD(mu1.modified, INTERVAL 1 DAY) > mu2.startdate
|
470 |
-
WHERE mu1.status
|
471 |
-
AND mu2.id IS NULL
|
472 |
-
AND mu1.
|
|
|
|
|
473 |
|
474 |
//restrict by level
|
475 |
if(!empty($levels) && $levels != 'all')
|
476 |
$sqlQuery .= "AND membership_id IN(" . $levels . ") ";
|
477 |
|
478 |
$cancellations = $wpdb->get_var($sqlQuery);
|
479 |
-
|
480 |
//save in cache
|
481 |
-
if(!empty($cache) && !empty($cache[$
|
482 |
-
$cache[$
|
483 |
elseif(!empty($cache))
|
484 |
-
$cache[$
|
485 |
else
|
486 |
-
$cache = array($
|
487 |
|
488 |
set_transient("pmpro_report_memberships_cancellations", $cache, 3600*24);
|
489 |
|
@@ -557,15 +600,20 @@ function pmpro_getMRR($period, $levels = 'all')
|
|
557 |
}
|
558 |
|
559 |
//get Cancellation Rate
|
560 |
-
function pmpro_getCancellationRate($period, $levels = 'all')
|
561 |
{
|
|
|
|
|
|
|
|
|
562 |
//check for a transient
|
563 |
$cache = get_transient("pmpro_report_cancellation_rate");
|
564 |
-
|
565 |
-
|
|
|
566 |
|
567 |
$signups = pmpro_getSignups($period, $levels);
|
568 |
-
$cancellations = pmpro_getCancellations($period, $levels);
|
569 |
|
570 |
if(empty($signups))
|
571 |
return false;
|
35 |
<tr>
|
36 |
<th scope="col"> </th>
|
37 |
<th scope="col"><?php _e('Signups','pmpro'); ?></th>
|
38 |
+
<th scope="col"><?php _e('All Cancellations','pmpro'); ?></th>
|
39 |
</tr>
|
40 |
</thead>
|
41 |
<tbody>
|
73 |
if(isset($_REQUEST['type']))
|
74 |
$type = sanitize_text_field($_REQUEST['type']);
|
75 |
else
|
76 |
+
$type = "signup_v_all";
|
77 |
|
78 |
if(isset($_REQUEST['period']))
|
79 |
$period = sanitize_text_field($_REQUEST['period']);
|
112 |
elseif($period == "annual")
|
113 |
{
|
114 |
$startdate = '1960-01-01'; //all time
|
115 |
+
$enddate = strval(intval($year)+1) . '-01-01';
|
116 |
$date_function = 'YEAR';
|
117 |
}
|
118 |
|
120 |
$gateway_environment = pmpro_getOption("gateway_environment");
|
121 |
|
122 |
//get data
|
123 |
+
if ( $type === "signup_v_cancel" || $type === "signup_v_expiration" || $type === "signup_v_all") {
|
124 |
$sqlQuery = "SELECT $date_function(startdate) as date, COUNT(DISTINCT user_id) as signups
|
125 |
FROM $wpdb->pmpro_memberships_users WHERE startdate >= '" . $startdate . "' ";
|
126 |
|
158 |
|
159 |
for($i = 1; $i <= $lastday; $i++)
|
160 |
{
|
161 |
+
// Signups vs. Cancellations, Expirations, or All
|
162 |
+
if ( $type === "signup_v_cancel" || $type === "signup_v_expiration" || $type === "signup_v_all" ) {
|
163 |
$cols[$i] = new stdClass();
|
164 |
$cols[$i]->signups = 0;
|
165 |
foreach($dates as $date)
|
175 |
{
|
176 |
for($i = 1; $i < 13; $i++)
|
177 |
{
|
178 |
+
// Signups vs. Cancellations, Expirations, or All
|
179 |
+
if ( $type === "signup_v_cancel" || $type === "signup_v_expiration" || $type === "signup_v_all" ) {
|
180 |
$cols[$i] = new stdClass();
|
181 |
$cols[$i]->date = $i;
|
182 |
$cols[$i]->signups = 0;
|
209 |
|
210 |
$dates = ( ! empty( $cols ) ) ? $cols : $dates;
|
211 |
|
212 |
+
// Signups vs. all
|
213 |
+
if ( $type === "signup_v_cancel" || $type === "signup_v_expiration" || $type === "signup_v_all" )
|
214 |
{
|
215 |
$sqlQuery = "SELECT $date_function(mu1.modified) as date, COUNT(DISTINCT mu1.user_id) as cancellations
|
216 |
FROM $wpdb->pmpro_memberships_users mu1
|
217 |
LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON mu1.user_id = mu2.user_id AND
|
218 |
mu2.modified > mu1.enddate AND
|
219 |
+
DATE_ADD(mu1.modified, INTERVAL 1 DAY) > mu2.startdate ";
|
220 |
+
if ( $type === "signup_v_cancel")
|
221 |
+
$sqlQuery .= "WHERE mu1.status IN('inactive','cancelled','cancelled_admin') ";
|
222 |
+
elseif($type === "signup_v_expiration")
|
223 |
+
$sqlQuery .= "WHERE mu1.status IN('expired') ";
|
224 |
+
else
|
225 |
+
$sqlQuery .= "WHERE mu1.status IN('inactive','expired','cancelled','cancelled_admin') ";
|
226 |
+
|
227 |
+
$sqlQuery .= "AND mu2.id IS NULL
|
228 |
AND mu1.startdate >= '" . $startdate . "'
|
229 |
AND mu1.startdate < '" . $enddate . "' ";
|
230 |
|
255 |
}
|
256 |
?>
|
257 |
<form id="posts-filter" method="get" action="">
|
258 |
+
<h1>
|
259 |
<?php _e('Membership Stats', 'pmpro');?>
|
260 |
+
</h1>
|
261 |
<ul class="subsubsub">
|
262 |
<li>
|
263 |
<?php _ex('Show', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?>
|
267 |
<option value="annual" <?php selected($period, "annual");?>><?php _e('Annual', 'pmpro');?></option>
|
268 |
</select>
|
269 |
<select id="type" name="type">
|
270 |
+
<option value="signup_v_all" <?php selected($type, "signup_v_all");?>><?php _e('Signups vs. All Cancellations', 'pmpro');?></option>
|
271 |
<option value="signup_v_cancel" <?php selected($type, "signup_v_cancel");?>><?php _e('Signups vs. Cancellations', 'pmpro');?></option>
|
272 |
+
<option value="signup_v_expiration" <?php selected($type, "signup_v_expiration");?>><?php _e('Signups vs. Expirations', 'pmpro');?></option>
|
273 |
<?php /*
|
274 |
<option value="mrr_ltv" <?php selected($type, "mrr_ltv");?>><?php _e('MRR & LTV', 'pmpro');?></option>
|
275 |
*/ ?>
|
301 |
|
302 |
<input type="hidden" name="page" value="pmpro-reports" />
|
303 |
<input type="hidden" name="report" value="memberships" />
|
304 |
+
<input type="submit" class="button" value="<?php _ex('Generate Report', 'Submit button value.', 'pmpro');?>" />
|
305 |
</li>
|
306 |
</ul>
|
307 |
|
346 |
function drawChart() {
|
347 |
|
348 |
var data = google.visualization.arrayToDataTable([
|
349 |
+
<?php if ( $type === "signup_v_all" ) : // Signups vs. all cancellations ?>
|
350 |
+
['<?php echo $date_function;?>', 'Signups', 'All Cancellations'],
|
351 |
+
<?php foreach($dates as $key => $value) { ?>
|
352 |
+
['<?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; ?>],
|
353 |
+
<?php } ?>
|
354 |
+
<?php endif; ?>
|
355 |
+
|
356 |
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
|
357 |
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
|
358 |
<?php foreach($dates as $key => $value) { ?>
|
359 |
['<?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; ?>],
|
360 |
<?php } ?>
|
361 |
<?php endif; ?>
|
362 |
+
|
363 |
+
<?php if ( $type === "signup_v_expiration" ) : // Signups vs. expirations ?>
|
364 |
+
['<?php echo $date_function;?>', 'Signups', 'Expirations'],
|
365 |
+
<?php foreach($dates as $key => $value) { ?>
|
366 |
+
['<?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; ?>],
|
367 |
+
<?php } ?>
|
368 |
+
<?php endif; ?>
|
369 |
|
370 |
+
<?php if ( $type === "mrr_ltv" ) : ?>
|
371 |
['<?php echo $date_function;?>', 'MRR', 'LTV'],
|
372 |
<?php foreach($dates as $key => $value) { ?>
|
373 |
['<?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 ); ?>],
|
381 |
vAxis: {color: 'green', titleTextStyle: {color: '#51a351'}},
|
382 |
};
|
383 |
|
384 |
+
<?php if ( $type === "signup_v_cancel" || $type === "signup_v_expiration" || $type === "signup_v_all" ) : // Signups vs. cancellations ?>
|
385 |
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
|
386 |
+
|
387 |
<?php elseif ( $type === "mrr_ltv" ) : // MRR & LTV ?>
|
388 |
|
389 |
<?php
|
458 |
return $signups;
|
459 |
}
|
460 |
|
461 |
+
//get cancellations by status
|
462 |
+
function pmpro_getCancellations($period = false, $levels = 'all', $status = array('inactive','expired','cancelled','cancelled_admin') )
|
463 |
{
|
464 |
+
//make sure status is an array
|
465 |
+
if(!is_array($status))
|
466 |
+
$status = array($status);
|
467 |
+
|
468 |
//check for a transient
|
469 |
$cache = get_transient( 'pmpro_report_memberships_cancellations' );
|
470 |
+
$hash = md5($period . $levels . implode(',', $status));
|
471 |
+
if( ! empty( $cache ) && ! empty( $cache[$hash] ) )
|
472 |
+
return $cache[$hash];
|
473 |
+
|
474 |
//figure out start date
|
475 |
+
$now = current_time('timestamp');
|
476 |
+
$year = date("Y", $now);
|
477 |
if( $period == 'today' )
|
478 |
+
{
|
479 |
+
$startdate = date('Y-m-d', $now) . " 00:00:00";
|
480 |
+
$enddate = date('Y-m-d', $now) . " 23:59:59";
|
481 |
+
}
|
482 |
elseif( $period == 'this month')
|
483 |
+
{
|
484 |
+
$startdate = date( 'Y-m', $now ) . '-01 00:00:00';
|
485 |
+
$enddate = date( 'Y-m', $now ) . '-32 00:00:00';
|
486 |
+
}
|
487 |
elseif( $period == 'this year')
|
488 |
+
{
|
489 |
+
$startdate = date( 'Y', $now ) . '-01-01 00:00:00';
|
490 |
+
$enddate = date( 'Y', $now ) . '-12-32 00:00:00';
|
491 |
+
}
|
492 |
else
|
493 |
+
{
|
494 |
+
//all time
|
495 |
+
$startdate = '1960-01-01'; //all time
|
496 |
+
$enddate = strval(intval($year)+1) . '-01-01';
|
497 |
+
}
|
498 |
+
|
499 |
/*
|
500 |
+
build query.
|
501 |
+
cancellations are marked in the memberships users table with status 'inactive', 'expired', 'cancelled', 'cancelled_admin'
|
502 |
we try to ignore cancellations when the user gets a new level with 24 hours (probably an upgrade or downgrade)
|
503 |
*/
|
504 |
global $wpdb;
|
505 |
|
|
|
506 |
$sqlQuery = "SELECT COUNT(mu1.id)
|
507 |
+
FROM $wpdb->pmpro_memberships_users mu1
|
508 |
+
LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON mu1.user_id = mu2.user_id AND
|
509 |
+
mu2.modified > mu1.enddate AND
|
510 |
+
DATE_ADD(mu1.modified, INTERVAL 1 DAY) > mu2.startdate
|
511 |
+
WHERE mu1.status IN('" . implode("','", $status) . "')
|
512 |
+
AND mu2.id IS NULL
|
513 |
+
AND mu1.enddate >= '" . $startdate . "'
|
514 |
+
AND mu1.enddate <= '" . $enddate . "'
|
515 |
+
";
|
516 |
|
517 |
//restrict by level
|
518 |
if(!empty($levels) && $levels != 'all')
|
519 |
$sqlQuery .= "AND membership_id IN(" . $levels . ") ";
|
520 |
|
521 |
$cancellations = $wpdb->get_var($sqlQuery);
|
522 |
+
|
523 |
//save in cache
|
524 |
+
if(!empty($cache) && !empty($cache[$hash]))
|
525 |
+
$cache[$hash] = $cancellations;
|
526 |
elseif(!empty($cache))
|
527 |
+
$cache[$hash] = $cancellations;
|
528 |
else
|
529 |
+
$cache = array($hash => $cancellations);
|
530 |
|
531 |
set_transient("pmpro_report_memberships_cancellations", $cache, 3600*24);
|
532 |
|
600 |
}
|
601 |
|
602 |
//get Cancellation Rate
|
603 |
+
function pmpro_getCancellationRate($period, $levels = 'all', $status = NULL)
|
604 |
{
|
605 |
+
//make sure status is an array
|
606 |
+
if(!is_array($status))
|
607 |
+
$status = array($status);
|
608 |
+
|
609 |
//check for a transient
|
610 |
$cache = get_transient("pmpro_report_cancellation_rate");
|
611 |
+
$hash = md5($period . $levels . implode('',$status));
|
612 |
+
if(!empty($cache) && !empty($cache[$hash]))
|
613 |
+
return $cache[$hash];
|
614 |
|
615 |
$signups = pmpro_getSignups($period, $levels);
|
616 |
+
$cancellations = pmpro_getCancellations($period, $levels, $status);
|
617 |
|
618 |
if(empty($signups))
|
619 |
return false;
|
adminpages/reports/sales.php
CHANGED
@@ -194,9 +194,9 @@ function pmpro_report_sales_page()
|
|
194 |
}
|
195 |
?>
|
196 |
<form id="posts-filter" method="get" action="">
|
197 |
-
<
|
198 |
<?php _e('Sales and Revenue', 'pmpro');?>
|
199 |
-
</
|
200 |
|
201 |
<div class="tablenav top">
|
202 |
<?php _ex('Show', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?>
|
194 |
}
|
195 |
?>
|
196 |
<form id="posts-filter" method="get" action="">
|
197 |
+
<h1>
|
198 |
<?php _e('Sales and Revenue', 'pmpro');?>
|
199 |
+
</h1>
|
200 |
|
201 |
<div class="tablenav top">
|
202 |
<?php _ex('Show', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?>
|
classes/gateways/class.pmprogateway_braintree.php
CHANGED
@@ -234,6 +234,7 @@
|
|
234 |
<input type='hidden' name='AccountNumber' id='BraintreeAccountNumber' />
|
235 |
<script type="text/javascript" src="https://js.braintreegateway.com/v1/braintree.js"></script>
|
236 |
<script type="text/javascript">
|
|
|
237 |
//set up braintree encryption
|
238 |
var braintree = Braintree.create('<?php echo pmpro_getOption("braintree_encryptionkey"); ?>');
|
239 |
braintree.onSubmitEncryptForm('pmpro_form');
|
@@ -257,6 +258,7 @@
|
|
257 |
pmpro_updateBraintreeAccountNumber();
|
258 |
});
|
259 |
pmpro_updateBraintreeAccountNumber();
|
|
|
260 |
</script>
|
261 |
<?php
|
262 |
}
|
234 |
<input type='hidden' name='AccountNumber' id='BraintreeAccountNumber' />
|
235 |
<script type="text/javascript" src="https://js.braintreegateway.com/v1/braintree.js"></script>
|
236 |
<script type="text/javascript">
|
237 |
+
<!--
|
238 |
//set up braintree encryption
|
239 |
var braintree = Braintree.create('<?php echo pmpro_getOption("braintree_encryptionkey"); ?>');
|
240 |
braintree.onSubmitEncryptForm('pmpro_form');
|
258 |
pmpro_updateBraintreeAccountNumber();
|
259 |
});
|
260 |
pmpro_updateBraintreeAccountNumber();
|
261 |
+
-->
|
262 |
</script>
|
263 |
<?php
|
264 |
}
|
classes/gateways/class.pmprogateway_payflowpro.php
CHANGED
@@ -581,51 +581,31 @@
|
|
581 |
}
|
582 |
|
583 |
$version = urlencode('4');
|
584 |
-
|
585 |
-
// setting the curl parameters.
|
586 |
-
$ch = curl_init();
|
587 |
-
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
|
588 |
-
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
589 |
-
|
590 |
-
// turning off the server and peer verification(TrustManager Concept).
|
591 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
592 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
593 |
-
|
594 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
595 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
596 |
-
|
597 |
-
curl_setopt($ch, CURLOPT_USERAGENT, PMPRO_USER_AGENT); //set user agent
|
598 |
|
599 |
// NVPRequest for submitting to server
|
600 |
$nvpreq = "TRXTYPE=" . $methodName_ . "&TENDER=C&PARTNER=" . $PARTNER . "&VENDOR=" . $VENDOR . "&USER=" . $USER . "&PWD=" . $PWD . "&VERBOSITY=medium" . "&BUTTONSOURCE=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
601 |
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
$httpResponse = curl_exec($ch);
|
609 |
-
|
610 |
-
if(empty($httpResponse)) {
|
611 |
-
exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
|
612 |
-
}
|
613 |
-
|
614 |
-
// Extract the RefundTransaction response details
|
615 |
-
$httpResponseAr = explode("&", $httpResponse);
|
616 |
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
}
|
623 |
}
|
624 |
|
625 |
-
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('RESULT', $httpParsedResponseAr)) {
|
626 |
-
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
627 |
-
}
|
628 |
-
|
629 |
return $httpParsedResponseAr;
|
630 |
}
|
631 |
}
|
581 |
}
|
582 |
|
583 |
$version = urlencode('4');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
// NVPRequest for submitting to server
|
586 |
$nvpreq = "TRXTYPE=" . $methodName_ . "&TENDER=C&PARTNER=" . $PARTNER . "&VENDOR=" . $VENDOR . "&USER=" . $USER . "&PWD=" . $PWD . "&VERBOSITY=medium" . "&BUTTONSOURCE=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
587 |
|
588 |
+
//post to PayPal
|
589 |
+
$response = wp_remote_post( $API_Endpoint, array(
|
590 |
+
'sslverify' => FALSE,
|
591 |
+
'body' => $nvpreq
|
592 |
+
)
|
593 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
|
595 |
+
if ( is_wp_error( $response ) ) {
|
596 |
+
$error_message = $response->get_error_message();
|
597 |
+
die( "methodName_ failed: $error_message" );
|
598 |
+
} else {
|
599 |
+
//extract the response details
|
600 |
+
$httpParsedResponseAr = array();
|
601 |
+
parse_str(wp_remote_retrieve_body($response), $httpParsedResponseAr);
|
602 |
+
|
603 |
+
//check for valid response
|
604 |
+
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('RESULT', $httpParsedResponseAr)) {
|
605 |
+
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
606 |
}
|
607 |
}
|
608 |
|
|
|
|
|
|
|
|
|
609 |
return $httpParsedResponseAr;
|
610 |
}
|
611 |
}
|
classes/gateways/class.pmprogateway_paypal.php
CHANGED
@@ -198,6 +198,7 @@
|
|
198 |
{
|
199 |
?>
|
200 |
<script>
|
|
|
201 |
//choosing payment method
|
202 |
jQuery('input[name=gateway]').click(function() {
|
203 |
if(jQuery(this).val() == 'paypal')
|
@@ -220,6 +221,7 @@
|
|
220 |
jQuery('a.pmpro_radio').click(function() {
|
221 |
jQuery(this).prev().click();
|
222 |
});
|
|
|
223 |
</script>
|
224 |
<?php
|
225 |
}
|
@@ -630,49 +632,31 @@
|
|
630 |
}
|
631 |
|
632 |
$version = urlencode('72.0');
|
633 |
-
|
634 |
-
// setting the curl parameters.
|
635 |
-
$ch = curl_init();
|
636 |
-
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
|
637 |
-
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
638 |
-
|
639 |
-
// turning off the server and peer verification(TrustManager Concept).
|
640 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
641 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
642 |
-
|
643 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
644 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
645 |
-
|
646 |
-
curl_setopt($ch, CURLOPT_USERAGENT, PMPRO_USER_AGENT); //set user agent
|
647 |
|
648 |
// NVPRequest for submitting to server
|
649 |
$nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . "&BUTTONSOURCE=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
650 |
|
651 |
-
//
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
if(empty($httpResponse)) {
|
658 |
-
exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
|
659 |
-
}
|
660 |
-
|
661 |
-
// Extract the RefundTransaction response details
|
662 |
-
$httpResponseAr = explode("&", $httpResponse);
|
663 |
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
}
|
670 |
}
|
671 |
|
672 |
-
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
|
673 |
-
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
674 |
-
}
|
675 |
-
|
676 |
return $httpParsedResponseAr;
|
677 |
}
|
678 |
}
|
198 |
{
|
199 |
?>
|
200 |
<script>
|
201 |
+
<!--
|
202 |
//choosing payment method
|
203 |
jQuery('input[name=gateway]').click(function() {
|
204 |
if(jQuery(this).val() == 'paypal')
|
221 |
jQuery('a.pmpro_radio').click(function() {
|
222 |
jQuery(this).prev().click();
|
223 |
});
|
224 |
+
-->
|
225 |
</script>
|
226 |
<?php
|
227 |
}
|
632 |
}
|
633 |
|
634 |
$version = urlencode('72.0');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
635 |
|
636 |
// NVPRequest for submitting to server
|
637 |
$nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . "&BUTTONSOURCE=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
638 |
|
639 |
+
//post to PayPal
|
640 |
+
$response = wp_remote_post( $API_Endpoint, array(
|
641 |
+
'sslverify' => FALSE,
|
642 |
+
'body' => $nvpreq
|
643 |
+
)
|
644 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
|
646 |
+
if ( is_wp_error( $response ) ) {
|
647 |
+
$error_message = $response->get_error_message();
|
648 |
+
die( "methodName_ failed: $error_message" );
|
649 |
+
} else {
|
650 |
+
//extract the response details
|
651 |
+
$httpParsedResponseAr = array();
|
652 |
+
parse_str(wp_remote_retrieve_body($response), $httpParsedResponseAr);
|
653 |
+
|
654 |
+
//check for valid response
|
655 |
+
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
|
656 |
+
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
657 |
}
|
658 |
}
|
659 |
|
|
|
|
|
|
|
|
|
660 |
return $httpParsedResponseAr;
|
661 |
}
|
662 |
}
|
classes/gateways/class.pmprogateway_paypalexpress.php
CHANGED
@@ -432,6 +432,7 @@
|
|
432 |
{
|
433 |
?>
|
434 |
<script>
|
|
|
435 |
//choosing payment method
|
436 |
jQuery('input[name=gateway]').click(function() {
|
437 |
if(jQuery(this).val() == 'paypal')
|
@@ -454,6 +455,7 @@
|
|
454 |
jQuery('a.pmpro_radio').click(function() {
|
455 |
jQuery(this).prev().click();
|
456 |
});
|
|
|
457 |
</script>
|
458 |
<?php
|
459 |
}
|
@@ -842,48 +844,30 @@
|
|
842 |
|
843 |
$version = urlencode('72.0');
|
844 |
|
845 |
-
//
|
846 |
-
$ch = curl_init();
|
847 |
-
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
|
848 |
-
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
849 |
-
|
850 |
-
// turning off the server and peer verification(TrustManager Concept).
|
851 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
852 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
853 |
-
|
854 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
855 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
856 |
-
|
857 |
-
curl_setopt($ch, CURLOPT_USERAGENT, PMPRO_USER_AGENT); //set user agent
|
858 |
-
|
859 |
-
// NVPRequest for submitting to server
|
860 |
$nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . "&BUTTONSOURCE=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
861 |
|
862 |
-
//
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
if(!$httpResponse) {
|
869 |
-
exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
|
870 |
-
}
|
871 |
-
|
872 |
-
// Extract the RefundTransaction response details
|
873 |
-
$httpResponseAr = explode("&", $httpResponse);
|
874 |
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
880 |
}
|
881 |
}
|
882 |
|
883 |
-
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
|
884 |
-
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
885 |
-
}
|
886 |
-
|
887 |
return $httpParsedResponseAr;
|
888 |
}
|
889 |
}
|
432 |
{
|
433 |
?>
|
434 |
<script>
|
435 |
+
<!--
|
436 |
//choosing payment method
|
437 |
jQuery('input[name=gateway]').click(function() {
|
438 |
if(jQuery(this).val() == 'paypal')
|
455 |
jQuery('a.pmpro_radio').click(function() {
|
456 |
jQuery(this).prev().click();
|
457 |
});
|
458 |
+
-->
|
459 |
</script>
|
460 |
<?php
|
461 |
}
|
844 |
|
845 |
$version = urlencode('72.0');
|
846 |
|
847 |
+
//NVPRequest for submitting to server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
848 |
$nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . "&BUTTONSOURCE=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
849 |
|
850 |
+
//post to PayPal
|
851 |
+
$response = wp_remote_post( $API_Endpoint, array(
|
852 |
+
'sslverify' => FALSE,
|
853 |
+
'body' => $nvpreq
|
854 |
+
)
|
855 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
|
857 |
+
if ( is_wp_error( $response ) ) {
|
858 |
+
$error_message = $response->get_error_message();
|
859 |
+
die( "methodName_ failed: $error_message" );
|
860 |
+
} else {
|
861 |
+
//extract the response details
|
862 |
+
$httpParsedResponseAr = array();
|
863 |
+
parse_str(wp_remote_retrieve_body($response), $httpParsedResponseAr);
|
864 |
+
|
865 |
+
//check for valid response
|
866 |
+
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
|
867 |
+
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
868 |
}
|
869 |
}
|
870 |
|
|
|
|
|
|
|
|
|
871 |
return $httpParsedResponseAr;
|
872 |
}
|
873 |
}
|
classes/gateways/class.pmprogateway_paypalstandard.php
CHANGED
@@ -492,48 +492,30 @@
|
|
492 |
|
493 |
$version = urlencode('72.0');
|
494 |
|
495 |
-
// setting the curl parameters.
|
496 |
-
$ch = curl_init();
|
497 |
-
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
|
498 |
-
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
499 |
-
|
500 |
-
// turning off the server and peer verification(TrustManager Concept).
|
501 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
502 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
503 |
-
|
504 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
505 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
506 |
-
|
507 |
-
curl_setopt($ch, CURLOPT_USERAGENT, PMPRO_USER_AGENT); //set user agent
|
508 |
-
|
509 |
// NVPRequest for submitting to server
|
510 |
$nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . "&bn=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
511 |
|
512 |
-
//
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
if(sizeof($
|
529 |
-
$
|
530 |
}
|
531 |
}
|
532 |
|
533 |
-
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
|
534 |
-
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
535 |
-
}
|
536 |
-
|
537 |
return $httpParsedResponseAr;
|
538 |
}
|
539 |
}
|
492 |
|
493 |
$version = urlencode('72.0');
|
494 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
// NVPRequest for submitting to server
|
496 |
$nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . "&bn=" . urlencode(PAYPAL_BN_CODE) . $nvpStr_;
|
497 |
|
498 |
+
//post to PayPal
|
499 |
+
$response = wp_remote_post( $API_Endpoint, array(
|
500 |
+
'sslverify' => FALSE,
|
501 |
+
'body' => $nvpreq
|
502 |
+
)
|
503 |
+
);
|
504 |
+
|
505 |
+
if ( is_wp_error( $response ) ) {
|
506 |
+
$error_message = $response->get_error_message();
|
507 |
+
die( "methodName_ failed: $error_message" );
|
508 |
+
} else {
|
509 |
+
//extract the response details
|
510 |
+
$httpParsedResponseAr = array();
|
511 |
+
parse_str(wp_remote_retrieve_body($response), $httpParsedResponseAr);
|
512 |
+
|
513 |
+
//check for valid response
|
514 |
+
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
|
515 |
+
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
|
516 |
}
|
517 |
}
|
518 |
|
|
|
|
|
|
|
|
|
519 |
return $httpParsedResponseAr;
|
520 |
}
|
521 |
}
|
classes/gateways/class.pmprogateway_stripe.php
CHANGED
@@ -218,6 +218,7 @@
|
|
218 |
global $pmpro_gateway, $pmpro_level, $pmpro_stripe_lite;
|
219 |
?>
|
220 |
<script type="text/javascript">
|
|
|
221 |
// this identifies your website in the createToken call below
|
222 |
Stripe.setPublishableKey('<?php echo pmpro_getOption("stripe_publishablekey"); ?>');
|
223 |
|
@@ -302,6 +303,7 @@
|
|
302 |
form$.get(0).submit();
|
303 |
}
|
304 |
}
|
|
|
305 |
</script>
|
306 |
<?php
|
307 |
}
|
@@ -434,6 +436,7 @@
|
|
434 |
?>
|
435 |
<input type="hidden" id="CardType" name="CardType" value="<?php echo esc_attr($CardType);?>" />
|
436 |
<script>
|
|
|
437 |
jQuery(document).ready(function() {
|
438 |
jQuery('#AccountNumber').validateCreditCard(function(result) {
|
439 |
var cardtypenames = {
|
@@ -455,6 +458,7 @@
|
|
455 |
jQuery('#CardType').val('Unknown Card Type');
|
456 |
});
|
457 |
});
|
|
|
458 |
</script>
|
459 |
<?php
|
460 |
}
|
@@ -655,6 +659,7 @@
|
|
655 |
</tr>
|
656 |
</table>
|
657 |
<script>
|
|
|
658 |
jQuery(document).ready(function() {
|
659 |
//function to update dropdowns/etc based on when field
|
660 |
function updateSubscriptionUpdateFields(when)
|
@@ -707,6 +712,7 @@
|
|
707 |
}
|
708 |
addUpdateEvents();
|
709 |
});
|
|
|
710 |
</script>
|
711 |
<?php
|
712 |
}
|
218 |
global $pmpro_gateway, $pmpro_level, $pmpro_stripe_lite;
|
219 |
?>
|
220 |
<script type="text/javascript">
|
221 |
+
<!--
|
222 |
// this identifies your website in the createToken call below
|
223 |
Stripe.setPublishableKey('<?php echo pmpro_getOption("stripe_publishablekey"); ?>');
|
224 |
|
303 |
form$.get(0).submit();
|
304 |
}
|
305 |
}
|
306 |
+
-->
|
307 |
</script>
|
308 |
<?php
|
309 |
}
|
436 |
?>
|
437 |
<input type="hidden" id="CardType" name="CardType" value="<?php echo esc_attr($CardType);?>" />
|
438 |
<script>
|
439 |
+
<!--
|
440 |
jQuery(document).ready(function() {
|
441 |
jQuery('#AccountNumber').validateCreditCard(function(result) {
|
442 |
var cardtypenames = {
|
458 |
jQuery('#CardType').val('Unknown Card Type');
|
459 |
});
|
460 |
});
|
461 |
+
-->
|
462 |
</script>
|
463 |
<?php
|
464 |
}
|
659 |
</tr>
|
660 |
</table>
|
661 |
<script>
|
662 |
+
<!--
|
663 |
jQuery(document).ready(function() {
|
664 |
//function to update dropdowns/etc based on when field
|
665 |
function updateSubscriptionUpdateFields(when)
|
712 |
}
|
713 |
addUpdateEvents();
|
714 |
});
|
715 |
+
-->
|
716 |
</script>
|
717 |
<?php
|
718 |
}
|
includes/functions.php
CHANGED
@@ -178,7 +178,7 @@ function pmpro_isLevelRecurring(&$level)
|
|
178 |
|
179 |
function pmpro_isLevelTrial(&$level)
|
180 |
{
|
181 |
-
if($level->trial_limit > 0)
|
182 |
{
|
183 |
return true;
|
184 |
}
|
@@ -188,7 +188,7 @@ function pmpro_isLevelTrial(&$level)
|
|
188 |
|
189 |
function pmpro_isLevelExpiring(&$level)
|
190 |
{
|
191 |
-
if($level->expiration_number > 0)
|
192 |
return true;
|
193 |
else
|
194 |
return false;
|
@@ -224,7 +224,7 @@ function pmpro_isLevelExpiringSoon( &$level ) {
|
|
224 |
//are we within the days til expiration?
|
225 |
$now = current_time('timestamp');
|
226 |
|
227 |
-
if( $now + ($days*3600*24)
|
228 |
$r = true;
|
229 |
else
|
230 |
$r = false;
|
178 |
|
179 |
function pmpro_isLevelTrial(&$level)
|
180 |
{
|
181 |
+
if(!empty($level) && !empty($level->trial_limit) && $level->trial_limit > 0)
|
182 |
{
|
183 |
return true;
|
184 |
}
|
188 |
|
189 |
function pmpro_isLevelExpiring(&$level)
|
190 |
{
|
191 |
+
if(!empty($level) && !empty($level->expiration_number) && $level->expiration_number > 0)
|
192 |
return true;
|
193 |
else
|
194 |
return false;
|
224 |
//are we within the days til expiration?
|
225 |
$now = current_time('timestamp');
|
226 |
|
227 |
+
if( $now + ($days*3600*24) >= $level->enddate )
|
228 |
$r = true;
|
229 |
else
|
230 |
$r = false;
|
includes/https.php
CHANGED
@@ -38,7 +38,7 @@ add_filter('home_url', 'pmpro_https_filter');
|
|
38 |
function pmpro_besecure_set()
|
39 |
{
|
40 |
global $besecure;
|
41 |
-
if(force_ssl_admin() ||
|
42 |
$besecure = true;
|
43 |
|
44 |
$besecure = apply_filters("pmpro_besecure", $besecure);
|
@@ -59,10 +59,6 @@ function pmpro_besecure()
|
|
59 |
if(!$besecure && force_ssl_admin() && (is_admin() || pmpro_is_login_page()))
|
60 |
$besecure = true;
|
61 |
|
62 |
-
//if forcing ssl on login, be secure on the login page
|
63 |
-
if(!$besecure && force_ssl_login() && pmpro_is_login_page())
|
64 |
-
$besecure = true;
|
65 |
-
|
66 |
$besecure = apply_filters("pmpro_besecure", $besecure);
|
67 |
|
68 |
$use_ssl = pmpro_getOption("use_ssl");
|
38 |
function pmpro_besecure_set()
|
39 |
{
|
40 |
global $besecure;
|
41 |
+
if(force_ssl_admin() || is_ssl())
|
42 |
$besecure = true;
|
43 |
|
44 |
$besecure = apply_filters("pmpro_besecure", $besecure);
|
59 |
if(!$besecure && force_ssl_admin() && (is_admin() || pmpro_is_login_page()))
|
60 |
$besecure = true;
|
61 |
|
|
|
|
|
|
|
|
|
62 |
$besecure = apply_filters("pmpro_besecure", $besecure);
|
63 |
|
64 |
$use_ssl = pmpro_getOption("use_ssl");
|
includes/login.php
CHANGED
@@ -32,10 +32,6 @@ function pmpro_login_redirect($redirect_to, $request, $user)
|
|
32 |
//not logging in (login form) so return what was given
|
33 |
}
|
34 |
|
35 |
-
//let's strip the https if force_ssl_login is set, but force_ssl_admin is not
|
36 |
-
if(force_ssl_login() && !force_ssl_admin())
|
37 |
-
$redirect_to = str_replace("https:", "http:", $redirect_to);
|
38 |
-
|
39 |
return apply_filters("pmpro_login_redirect_url", $redirect_to, $request, $user);
|
40 |
}
|
41 |
add_filter('login_redirect','pmpro_login_redirect', 10, 3);
|
32 |
//not logging in (login form) so return what was given
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
35 |
return apply_filters("pmpro_login_redirect_url", $redirect_to, $request, $user);
|
36 |
}
|
37 |
add_filter('login_redirect','pmpro_login_redirect', 10, 3);
|
pages/billing.php
CHANGED
@@ -310,6 +310,7 @@
|
|
310 |
<input type='hidden' name='AccountNumber' id='BraintreeAccountNumber' />
|
311 |
<script type="text/javascript" src="https://js.braintreegateway.com/v1/braintree.js"></script>
|
312 |
<script type="text/javascript">
|
|
|
313 |
//setup braintree encryption
|
314 |
var braintree = Braintree.create('<?php echo pmpro_getOption("braintree_encryptionkey"); ?>');
|
315 |
braintree.onSubmitEncryptForm('pmpro_form');
|
@@ -333,6 +334,7 @@
|
|
333 |
pmpro_updateBraintreeAccountNumber();
|
334 |
});
|
335 |
pmpro_updateBraintreeAccountNumber();
|
|
|
336 |
</script>
|
337 |
<?php } ?>
|
338 |
|
@@ -344,12 +346,14 @@
|
|
344 |
|
345 |
</form>
|
346 |
<script>
|
|
|
347 |
// Find ALL <form> tags on your page
|
348 |
jQuery('form').submit(function(){
|
349 |
// On submit disable its submit button
|
350 |
jQuery('input[type=submit]', this).attr('disabled', 'disabled');
|
351 |
jQuery('input[type=image]', this).attr('disabled', 'disabled');
|
352 |
});
|
|
|
353 |
</script>
|
354 |
<?php } ?>
|
355 |
<?php } else { ?>
|
310 |
<input type='hidden' name='AccountNumber' id='BraintreeAccountNumber' />
|
311 |
<script type="text/javascript" src="https://js.braintreegateway.com/v1/braintree.js"></script>
|
312 |
<script type="text/javascript">
|
313 |
+
<!--
|
314 |
//setup braintree encryption
|
315 |
var braintree = Braintree.create('<?php echo pmpro_getOption("braintree_encryptionkey"); ?>');
|
316 |
braintree.onSubmitEncryptForm('pmpro_form');
|
334 |
pmpro_updateBraintreeAccountNumber();
|
335 |
});
|
336 |
pmpro_updateBraintreeAccountNumber();
|
337 |
+
-->
|
338 |
</script>
|
339 |
<?php } ?>
|
340 |
|
346 |
|
347 |
</form>
|
348 |
<script>
|
349 |
+
<!--
|
350 |
// Find ALL <form> tags on your page
|
351 |
jQuery('form').submit(function(){
|
352 |
// On submit disable its submit button
|
353 |
jQuery('input[type=submit]', this).attr('disabled', 'disabled');
|
354 |
jQuery('input[type=image]', this).attr('disabled', 'disabled');
|
355 |
});
|
356 |
+
-->
|
357 |
</script>
|
358 |
<?php } ?>
|
359 |
<?php } else { ?>
|
pages/checkout.php
CHANGED
@@ -95,6 +95,7 @@
|
|
95 |
|
96 |
<?php if($pmpro_show_discount_code) { ?>
|
97 |
<script>
|
|
|
98 |
//update discount code link to show field at top of form
|
99 |
jQuery('#other_discount_code_a').attr('href', 'javascript:void(0);');
|
100 |
jQuery('#other_discount_code_a').click(function() {
|
@@ -158,6 +159,7 @@
|
|
158 |
});
|
159 |
}
|
160 |
});
|
|
|
161 |
</script>
|
162 |
<?php } ?>
|
163 |
|
@@ -536,6 +538,7 @@
|
|
536 |
?>
|
537 |
<input type="hidden" id="CardType" name="CardType" value="<?php echo esc_attr($CardType);?>" />
|
538 |
<script>
|
|
|
539 |
jQuery(document).ready(function() {
|
540 |
jQuery('#AccountNumber').validateCreditCard(function(result) {
|
541 |
var cardtypenames = {
|
@@ -557,6 +560,7 @@
|
|
557 |
jQuery('#CardType').val('Unknown Card Type');
|
558 |
});
|
559 |
});
|
|
|
560 |
</script>
|
561 |
<?php
|
562 |
}
|
@@ -622,6 +626,7 @@
|
|
622 |
</table>
|
623 |
<?php } ?>
|
624 |
<script>
|
|
|
625 |
//checking a discount code
|
626 |
jQuery('#discount_code_button').click(function() {
|
627 |
var code = jQuery('#discount_code').val();
|
@@ -661,6 +666,7 @@
|
|
661 |
});
|
662 |
}
|
663 |
});
|
|
|
664 |
</script>
|
665 |
|
666 |
<?php
|
@@ -799,6 +805,8 @@
|
|
799 |
-->
|
800 |
</script>
|
801 |
<script>
|
802 |
-
|
803 |
-
|
|
|
|
|
804 |
</script>
|
95 |
|
96 |
<?php if($pmpro_show_discount_code) { ?>
|
97 |
<script>
|
98 |
+
<!--
|
99 |
//update discount code link to show field at top of form
|
100 |
jQuery('#other_discount_code_a').attr('href', 'javascript:void(0);');
|
101 |
jQuery('#other_discount_code_a').click(function() {
|
159 |
});
|
160 |
}
|
161 |
});
|
162 |
+
-->
|
163 |
</script>
|
164 |
<?php } ?>
|
165 |
|
538 |
?>
|
539 |
<input type="hidden" id="CardType" name="CardType" value="<?php echo esc_attr($CardType);?>" />
|
540 |
<script>
|
541 |
+
<!--
|
542 |
jQuery(document).ready(function() {
|
543 |
jQuery('#AccountNumber').validateCreditCard(function(result) {
|
544 |
var cardtypenames = {
|
560 |
jQuery('#CardType').val('Unknown Card Type');
|
561 |
});
|
562 |
});
|
563 |
+
-->
|
564 |
</script>
|
565 |
<?php
|
566 |
}
|
626 |
</table>
|
627 |
<?php } ?>
|
628 |
<script>
|
629 |
+
<!--
|
630 |
//checking a discount code
|
631 |
jQuery('#discount_code_button').click(function() {
|
632 |
var code = jQuery('#discount_code').val();
|
666 |
});
|
667 |
}
|
668 |
});
|
669 |
+
-->
|
670 |
</script>
|
671 |
|
672 |
<?php
|
805 |
-->
|
806 |
</script>
|
807 |
<script>
|
808 |
+
<!--
|
809 |
+
//add javascriptok hidden field to checkout
|
810 |
+
jQuery("input[name=submit-checkout]").after('<input type="hidden" name="javascriptok" value="1" />');
|
811 |
+
-->
|
812 |
</script>
|
paid-memberships-pro.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Paid Memberships Pro
|
4 |
Plugin URI: http://www.paidmembershipspro.com
|
5 |
Description: Plugin to Handle Memberships
|
6 |
-
Version: 1.8.6.
|
7 |
Author: Stranger Studios
|
8 |
Author URI: http://www.strangerstudios.com
|
9 |
*/
|
@@ -13,7 +13,7 @@ Author URI: http://www.strangerstudios.com
|
|
13 |
*/
|
14 |
|
15 |
//version constant
|
16 |
-
define("PMPRO_VERSION", "1.8.6.
|
17 |
define("PMPRO_USER_AGENT", "Paid Memberships Pro v" . PMPRO_VERSION . "; " . site_url());
|
18 |
|
19 |
//if the session has been started yet, start it (ignore if running from command line)
|
3 |
Plugin Name: Paid Memberships Pro
|
4 |
Plugin URI: http://www.paidmembershipspro.com
|
5 |
Description: Plugin to Handle Memberships
|
6 |
+
Version: 1.8.6.8.1
|
7 |
Author: Stranger Studios
|
8 |
Author URI: http://www.strangerstudios.com
|
9 |
*/
|
13 |
*/
|
14 |
|
15 |
//version constant
|
16 |
+
define("PMPRO_VERSION", "1.8.6.8.1");
|
17 |
define("PMPRO_USER_AGENT", "Paid Memberships Pro v" . PMPRO_VERSION . "; " . site_url());
|
18 |
|
19 |
//if the session has been started yet, start it (ignore if running from command line)
|
preheaders/checkout.php
CHANGED
@@ -598,7 +598,7 @@
|
|
598 |
|
599 |
//setting some cookies
|
600 |
wp_set_current_user($user_id, $username);
|
601 |
-
wp_set_auth_cookie($user_id, true, apply_filters('pmpro_checkout_signon_secure',
|
602 |
}
|
603 |
}
|
604 |
else
|
598 |
|
599 |
//setting some cookies
|
600 |
wp_set_current_user($user_id, $username);
|
601 |
+
wp_set_auth_cookie($user_id, true, apply_filters('pmpro_checkout_signon_secure', force_ssl_admin()));
|
602 |
}
|
603 |
}
|
604 |
else
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: strangerstudios
|
3 |
Tags: memberships, membership, authorize.net, ecommerce, paypal, stripe, braintree, restrict access, restrict content, directory site, payflow
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.8.6.
|
7 |
|
8 |
A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
|
9 |
|
@@ -115,6 +115,15 @@ Not sure? You can find out by doing a bit a research.
|
|
115 |
[View All Screenshots](http://www.paidmembershipspro.com/features/screenshots/)
|
116 |
|
117 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
= 1.8.6.7 =
|
119 |
* BUG: Fixed issue with prices over $1000 when using TwoCheckout. (Thanks, BigBradBrown and others.)
|
120 |
* ENHANCEMENT: Removed the API Private Key option from 2Checkout setup since we don't actually use that in the API.
|
2 |
Contributors: strangerstudios
|
3 |
Tags: memberships, membership, authorize.net, ecommerce, paypal, stripe, braintree, restrict access, restrict content, directory site, payflow
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 4.4
|
6 |
+
Stable tag: 1.8.6.8.1
|
7 |
|
8 |
A revenue-generating machine for membership sites. Unlimited levels with recurring payment, protected content and member management.
|
9 |
|
115 |
[View All Screenshots](http://www.paidmembershipspro.com/features/screenshots/)
|
116 |
|
117 |
== Changelog ==
|
118 |
+
= 1.8.6.8.1 =
|
119 |
+
* BUG: Fixed bug in the Payflow gateway class that was breaking API calls and checkout.
|
120 |
+
|
121 |
+
= 1.8.6.8 =
|
122 |
+
* BUG/ENHANCEMENT: Adding <!-- comment markup --> to inline JavaScript to avoid issues where themes/plugins were adding formatting into the JavaScript code. (Thanks, Isabelle Couillard)
|
123 |
+
* BUG: Removed calls to force_ssl_login(), which has been deprecated in WP 4.4+. We are using force_ssl_admin() instead.
|
124 |
+
* BUG: Fixed issue in pmpro_isLevelExpiringSoon() which controls when "renew" links are shown to users. (Thanks, Thomas Sjolshagen)
|
125 |
+
* ENHANCEMENT: Updated PayPal gateway classes to use the WP HTTP API instead of CURL directly.
|
126 |
+
|
127 |
= 1.8.6.7 =
|
128 |
* BUG: Fixed issue with prices over $1000 when using TwoCheckout. (Thanks, BigBradBrown and others.)
|
129 |
* ENHANCEMENT: Removed the API Private Key option from 2Checkout setup since we don't actually use that in the API.
|