Paid Memberships Pro - Version 1.8.12

Version Description

  • BUG: Fixed issue where "expiring soon" emails were sometimes sent more than needed.
  • BUG: Fixed issue where PayPal Standard IPN requests were being rejected if a tax amount was set in PayPal.
  • BUG: Fixed issue with Stripe subscription "updates" that were set to fire on "next payment", e.g. if you used Stripe with levels with a non-zero trial amount. When the update processed and created a new subscription, the old subscription was not being deleted and the new subscription ID was not being saved as a new order for future tracking purposes. If you use this feature, please check in Stripe to make sure your users don't have extra subscriptions.
  • BUG: Fixed setting in PayPal/PayPal Express API calls from AUTOBILLAMT to AUTOBILLOUTAMT. This setting is set to AddToNextBilling, meaning that failed payment amounts are added to the next billing cycle's amount if left unpaid. In most cases, a retry of the original billed amount goes through or the user's subscription is cancelled. But just in case, this makes sure that outstanding balances are paid. (Thanks, jubstuff on GitHub)
  • BUG: Fixed warnings in the setGateway method of the MemberOrder class for cases where the gateway is missing or the class file is not found.
  • BUG/ENHANCEMENT: Moved the pmpro_before_change_membership_level hook to fire a little bit earlier to make it easier to determine the old level status/end date/etc before it gets updated. (Thanks, MrVibe on GitHub)
  • ENHANCEMENT: Replaced the Force SSL option with an explanation if the entire site is over HTTPS. We are already ignoring the option in these cases.
Download this release

Release Info

Developer strangerstudios
Plugin Icon 128x128 Paid Memberships Pro
Version 1.8.12
Comparing to
See all releases

Code changes from version 1.8.11.2 to 1.8.12

Files changed (101) hide show
  1. adminpages/addons.php +1 -1
  2. adminpages/admin_footer.php +1 -1
  3. adminpages/discountcodes.php +17 -17
  4. adminpages/membershiplevels.php +6 -6
  5. adminpages/memberslist-csv.php +5 -5
  6. adminpages/memberslist.php +2 -2
  7. adminpages/orders-csv.php +17 -17
  8. adminpages/orders.php +24 -24
  9. adminpages/pagesettings.php +1 -1
  10. adminpages/paymentsettings.php +18 -6
  11. adminpages/reports.php +1 -1
  12. adminpages/reports/login.php +16 -16
  13. adminpages/reports/memberships.php +25 -25
  14. adminpages/reports/sales.php +11 -11
  15. adminpages/templates/orders-email.php +2 -2
  16. adminpages/templates/orders-print.php +2 -2
  17. adminpages/updates.php +1 -1
  18. classes/class.memberorder.php +15 -12
  19. classes/class.mimetype.php +1 -1
  20. classes/gateways/class.pmprogateway.php +7 -7
  21. classes/gateways/class.pmprogateway_authorizenet.php +6 -6
  22. classes/gateways/class.pmprogateway_braintree.php +3 -3
  23. classes/gateways/class.pmprogateway_check.php +7 -7
  24. classes/gateways/class.pmprogateway_cybersource.php +9 -9
  25. classes/gateways/class.pmprogateway_payflowpro.php +14 -10
  26. classes/gateways/class.pmprogateway_paypal.php +4 -4
  27. classes/gateways/class.pmprogateway_paypalexpress.php +6 -6
  28. classes/gateways/class.pmprogateway_paypalstandard.php +1 -1
  29. classes/gateways/class.pmprogateway_stripe.php +22 -23
  30. classes/gateways/class.pmprogateway_twocheckout.php +1 -1
  31. includes/addons.php +1 -1
  32. includes/cleanup.php +1 -1
  33. includes/content.php +3 -2
  34. includes/countries.php +1 -1
  35. includes/email.php +1 -1
  36. includes/filters.php +1 -1
  37. includes/functions.php +34 -30
  38. includes/https.php +1 -1
  39. includes/init.php +2 -1
  40. includes/lib/Braintree/Braintree/CreditCard.php +2 -2
  41. includes/lib/CyberSource/cyber_source_soap_client.php +1 -1
  42. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutAccount.php +1 -1
  43. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutCoupon.php +1 -1
  44. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutOption.php +1 -1
  45. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutPayment.php +1 -1
  46. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutProduct.php +1 -1
  47. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutSale.php +1 -1
  48. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutUtil.php +1 -1
  49. includes/lib/Twocheckout/Twocheckout/TwocheckoutMessage.php +1 -1
  50. includes/lib/Twocheckout/Twocheckout/TwocheckoutReturn.php +1 -1
  51. includes/lib/recaptchalib.php +1 -1
  52. includes/license.php +1 -1
  53. includes/localization.php +1 -1
  54. includes/login.php +1 -1
  55. includes/notifications.php +1 -1
  56. includes/profile.php +9 -9
  57. includes/reports.php +1 -1
  58. includes/services.php +1 -1
  59. includes/states.php +1 -1
  60. includes/updates.php +1 -1
  61. includes/updates/upgrade_1.php +1 -1
  62. includes/updates/upgrade_1_1_15.php +1 -1
  63. includes/updates/upgrade_1_2_3.php +1 -1
  64. includes/updates/upgrade_1_3_18.php +1 -1
  65. includes/updates/upgrade_1_4.php +1 -1
  66. includes/updates/upgrade_1_4_2.php +1 -1
  67. includes/updates/upgrade_1_4_8.php +1 -1
  68. includes/updates/upgrade_1_5.php +1 -1
  69. includes/updates/upgrade_1_5_9.php +1 -1
  70. includes/updates/upgrade_1_6.php +1 -1
  71. includes/updates/upgrade_1_7.php +1 -1
  72. includes/updates/upgrade_1_8_6_9.php +1 -1
  73. includes/updates/upgrade_1_8_7.php +1 -1
  74. includes/updates/upgrade_1_8_8.php +1 -1
  75. includes/updates/upgrade_1_8_9_1.php +1 -1
  76. includes/updates/upgrade_1_8_9_3.php +3 -3
  77. includes/xmlrpc.php +1 -1
  78. js/paid-memberships-pro.js +4 -3
  79. languages/pmpro.mo +0 -0
  80. languages/pmpro.po +563 -417
  81. languages/pmpro.pot +563 -417
  82. pages/billing.php +1 -1
  83. pages/cancel.php +1 -1
  84. pages/checkout.php +1 -1
  85. paid-memberships-pro.php +2 -2
  86. preheaders/cancel.php +1 -1
  87. preheaders/checkout.php +2 -2
  88. preheaders/levels.php +1 -1
  89. readme.txt +10 -1
  90. scheduled/creditcardexpiringwarnings.php +1 -1
  91. scheduled/crons.php +31 -25
  92. scheduled/expirationwarnings.php +1 -1
  93. scheduled/expirememberships.php +1 -1
  94. scheduled/trialendingwarnings.php +1 -1
  95. services/braintree-webhook.php +1 -1
  96. services/ipnhandler.php +18 -2
  97. services/stripe-webhook.php +20 -9
  98. services/twocheckout-ins.php +2 -2
  99. shortcodes/checkout_button.php +1 -1
  100. shortcodes/membership.php +1 -1
  101. shortcodes/pmpro_account.php +4 -4
adminpages/addons.php CHANGED
@@ -71,7 +71,7 @@
71
?>
72
73
<p>
74
- <?php printf(__('Last checked on %s at %s.', 'pmpro'), date(get_option('date_format'), $addons_timestamp), date(get_option('time_format'), $addons_timestamp));?> &nbsp;
75
<a class="button" href="<?php echo admin_url("admin.php?page=pmpro-addons&force-check=1&plugin_status=" . $status);?>"><?php _e('Check Again', 'pmpro'); ?></a>
76
</p>
77
71
?>
72
73
<p>
74
+ <?php printf(__('Last checked on %s at %s.', 'pmpro'), date_i18n(get_option('date_format'), $addons_timestamp), date_i18n(get_option('time_format'), $addons_timestamp));?> &nbsp;
75
<a class="button" href="<?php echo admin_url("admin.php?page=pmpro-addons&force-check=1&plugin_status=" . $status);?>"><?php _e('Check Again', 'pmpro'); ?></a>
76
</p>
77
adminpages/admin_footer.php CHANGED
@@ -1,2 +1,2 @@
1
<div class="clear"></div>
2
- </div>
1
<div class="clear"></div>
2
+ </div>
adminpages/discountcodes.php CHANGED
@@ -37,8 +37,8 @@
37
$uses = intval($_POST['uses']);
38
39
//fix up dates
40
- $starts = date("Y-m-d", strtotime($starts_month . "/" . $starts_day . "/" . $starts_year, current_time("timestamp")));
41
- $expires = date("Y-m-d", strtotime($expires_month . "/" . $expires_day . "/" . $expires_year, current_time("timestamp")));
42
43
//updating or new?
44
if($saveid > 0)
@@ -319,33 +319,33 @@
319
320
<?php
321
//some vars for the dates
322
- $current_day = date("j");
323
if(!empty($code->starts))
324
- $selected_starts_day = date("j", $code->starts);
325
else
326
$selected_starts_day = $current_day;
327
if(!empty($code->expires))
328
- $selected_expires_day = date("j", $code->expires);
329
else
330
$selected_expires_day = $current_day;
331
332
- $current_month = date("M");
333
if(!empty($code->starts))
334
- $selected_starts_month = date("m", $code->starts);
335
else
336
- $selected_starts_month = date("m");
337
if(!empty($code->expires))
338
- $selected_expires_month = date("m", $code->expires);
339
else
340
- $selected_expires_month = date("m");
341
342
- $current_year = date("Y");
343
if(!empty($code->starts))
344
- $selected_starts_year = date("Y", $code->starts);
345
else
346
$selected_starts_year = $current_year;
347
if(!empty($code->expires))
348
- $selected_expires_year = date("Y", $code->expires);
349
else
350
$selected_expires_year = (int)$current_year + 1;
351
?>
@@ -358,7 +358,7 @@
358
for($i = 1; $i < 13; $i++)
359
{
360
?>
361
- <option value="<?php echo $i?>" <?php if($i == $selected_starts_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year, current_time("timestamp")))?></option>
362
<?php
363
}
364
?>
@@ -376,7 +376,7 @@
376
for($i = 1; $i < 13; $i++)
377
{
378
?>
379
- <option value="<?php echo $i?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year, current_time("timestamp")))?></option>
380
<?php
381
}
382
?>
@@ -617,10 +617,10 @@
617
<a href="?page=pmpro-discountcodes&edit=<?php echo $code->id?>"><?php echo $code->code?></a>
618
</td>
619
<td>
620
- <?php echo date(get_option('date_format'), $code->starts)?>
621
</td>
622
<td>
623
- <?php echo date(get_option('date_format'), $code->expires)?>
624
</td>
625
<td>
626
<?php
37
$uses = intval($_POST['uses']);
38
39
//fix up dates
40
+ $starts = date_i18n("Y-m-d", strtotime($starts_month . "/" . $starts_day . "/" . $starts_year, current_time("timestamp")));
41
+ $expires = date_i18n("Y-m-d", strtotime($expires_month . "/" . $expires_day . "/" . $expires_year, current_time("timestamp")));
42
43
//updating or new?
44
if($saveid > 0)
319
320
<?php
321
//some vars for the dates
322
+ $current_day = date_i18n("j");
323
if(!empty($code->starts))
324
+ $selected_starts_day = date_i18n("j", $code->starts);
325
else
326
$selected_starts_day = $current_day;
327
if(!empty($code->expires))
328
+ $selected_expires_day = date_i18n("j", $code->expires);
329
else
330
$selected_expires_day = $current_day;
331
332
+ $current_month = date_i18n("M");
333
if(!empty($code->starts))
334
+ $selected_starts_month = date_i18n("m", $code->starts);
335
else
336
+ $selected_starts_month = date_i18n("m");
337
if(!empty($code->expires))
338
+ $selected_expires_month = date_i18n("m", $code->expires);
339
else
340
+ $selected_expires_month = date_i18n("m");
341
342
+ $current_year = date_i18n("Y");
343
if(!empty($code->starts))
344
+ $selected_starts_year = date_i18n("Y", $code->starts);
345
else
346
$selected_starts_year = $current_year;
347
if(!empty($code->expires))
348
+ $selected_expires_year = date_i18n("Y", $code->expires);
349
else
350
$selected_expires_year = (int)$current_year + 1;
351
?>
358
for($i = 1; $i < 13; $i++)
359
{
360
?>
361
+ <option value="<?php echo $i?>" <?php if($i == $selected_starts_month) { ?>selected="selected"<?php } ?>><?php echo date_i18n("M", strtotime($i . "/1/" . $current_year, current_time("timestamp")))?></option>
362
<?php
363
}
364
?>
376
for($i = 1; $i < 13; $i++)
377
{
378
?>
379
+ <option value="<?php echo $i?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo date_i18n("M", strtotime($i . "/1/" . $current_year, current_time("timestamp")))?></option>
380
<?php
381
}
382
?>
617
<a href="?page=pmpro-discountcodes&edit=<?php echo $code->id?>"><?php echo $code->code?></a>
618
</td>
619
<td>
620
+ <?php echo date_i18n(get_option('date_format'), $code->starts)?>
621
</td>
622
<td>
623
+ <?php echo date_i18n(get_option('date_format'), $code->expires)?>
624
</td>
625
<td>
626
<?php
adminpages/membershiplevels.php CHANGED
@@ -505,7 +505,7 @@
505
</table>
506
<p class="submit topborder">
507
<input name="save" type="submit" class="button-primary" value="<?php _e('Save Level', 'pmpro'); ?>" />
508
- <input name="cancel" type="button" value="<?php _e('Cancel', 'pmpro'); ?>" onclick="location.href='<?php echo get_admin_url(NULL, '/admin.php?page=pmpro-membershiplevels')?>';" />
509
</p>
510
</form>
511
</div>
@@ -606,7 +606,7 @@
606
}
607
?>
608
609
- <h2 class="alignleft"><?php _e('Membership Levels', 'pmpro');?> <a href="admin.php?page=pmpro-membershiplevels&edit=-1" class="add-new-h2"><?php _e('Add New Level', 'pmpro');?></a></h2>
610
<form id="posts-filter" method="get" action="">
611
<p class="search-box">
612
<label class="screen-reader-text" for="post-search-input"><?php _e('Search Levels', 'pmpro');?>:</label>
@@ -644,7 +644,7 @@
644
?>
645
<tr class="<?php if($count++ % 2 == 1) { ?>alternate<?php } ?> <?php if(!$level->allow_signups) { ?>pmpro_gray<?php } ?> <?php if(!pmpro_checkLevelForStripeCompatibility($level) || !pmpro_checkLevelForBraintreeCompatibility($level) || !pmpro_checkLevelForPayflowCompatibility($level) || !pmpro_checkLevelForTwoCheckoutCompatibility($level)) { ?>pmpro_error<?php } ?>">
646
<td><?php echo $level->id?></td>
647
- <td class="level_name"><a href="admin.php?page=pmpro-membershiplevels&edit=<?php echo $level->id?>"><?php echo $level->name?></a></td>
648
<td>
649
<?php if(pmpro_isLevelFree($level)) { ?>
650
<?php _e('FREE', 'pmpro');?>
@@ -659,9 +659,9 @@
659
<?php _e('After', 'pmpro');?> <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?>
660
<?php } ?>
661
</td>
662
- <td><?php if($level->allow_signups) { ?><a href="<?php echo pmpro_url("checkout", "?level=" . $level->id);?>"><?php _e('Yes', 'pmpro');?></a><?php } else { ?><?php _e('No', 'pmpro');?><?php } ?></td>
663
664
- <td><a title="<?php _e('edit','pmpro'); ?>" href="admin.php?page=pmpro-membershiplevels&edit=<?php echo $level->id?>" class="button-primary"><?php _e('edit','pmpro'); ?></a>&nbsp;<a title="<?php _e('copy','pmpro'); ?>" href="admin.php?page=pmpro-membershiplevels&copy=<?php echo $level->id?>&edit=-1" class="button-secondary"><?php _e('copy','pmpro'); ?></a>&nbsp;<a title="<?php _e('delete','pmpro'); ?>" href="javascript: askfirst('<?php echo str_replace("'", "\'", sprintf(__("Are you sure you want to delete membership level %s? All subscriptions will be cancelled.", "pmpro"), $level->name));?>','admin.php?page=pmpro-membershiplevels&action=delete_membership_level&deleteid=<?php echo $level->id?>'); void(0);" class="button-secondary"><?php _e('delete','pmpro'); ?></a></td>
665
</tr>
666
<?php
667
}
@@ -686,4 +686,4 @@
686
687
<?php
688
require_once(dirname(__FILE__) . "/admin_footer.php");
689
- ?>
505
</table>
506
<p class="submit topborder">
507
<input name="save" type="submit" class="button-primary" value="<?php _e('Save Level', 'pmpro'); ?>" />
508
+ <input name="cancel" type="button" value="<?php _e('Cancel', 'pmpro'); ?>" onclick="location.href='<?php echo add_query_arg( 'page', 'pmpro-membershiplevels' , get_admin_url(NULL, '/admin.php') ); ?>';" />
509
</p>
510
</form>
511
</div>
606
}
607
?>
608
609
+ <h2 class="alignleft"><?php _e('Membership Levels', 'pmpro');?> <a href="<?php echo add_query_arg( array( 'page' => 'pmpro-membershiplevels', 'edit' => -1 ), get_admin_url(null, 'admin.php' ) ); ?>" class="add-new-h2"><?php _e('Add New Level', 'pmpro');?></a></h2>
610
<form id="posts-filter" method="get" action="">
611
<p class="search-box">
612
<label class="screen-reader-text" for="post-search-input"><?php _e('Search Levels', 'pmpro');?>:</label>
644
?>
645
<tr class="<?php if($count++ % 2 == 1) { ?>alternate<?php } ?> <?php if(!$level->allow_signups) { ?>pmpro_gray<?php } ?> <?php if(!pmpro_checkLevelForStripeCompatibility($level) || !pmpro_checkLevelForBraintreeCompatibility($level) || !pmpro_checkLevelForPayflowCompatibility($level) || !pmpro_checkLevelForTwoCheckoutCompatibility($level)) { ?>pmpro_error<?php } ?>">
646
<td><?php echo $level->id?></td>
647
+ <td class="level_name"><a href="<?php echo add_query_arg( array( 'page' => 'pmpro-membershiplevels', 'edit' => $level->id ), admin_url( 'admin.php' ) ); ?>"><?php esc_attr_e( $level->name ); ?></a></td>
648
<td>
649
<?php if(pmpro_isLevelFree($level)) { ?>
650
<?php _e('FREE', 'pmpro');?>
659
<?php _e('After', 'pmpro');?> <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?>
660
<?php } ?>
661
</td>
662
+ <td><?php if($level->allow_signups) { ?><a href="<?php echo add_query_arg( 'level', $level->id, pmpro_url("checkout") );?>"><?php _e('Yes', 'pmpro');?></a><?php } else { ?><?php _e('No', 'pmpro');?><?php } ?></td>
663
664
+ <td><a title="<?php _e('edit','pmpro'); ?>" href="<?php echo add_query_arg( array( 'page' => 'pmpro-membershiplevels', 'edit' => $level->id ), admin_url('admin.php' ) ); ?>" class="button-primary"><?php _e('edit','pmpro'); ?></a>&nbsp;<a title="<?php _e('copy','pmpro'); ?>" href="<?php echo add_query_arg( array( 'page' => 'pmpro-membershiplevels', 'edit' => -1, 'copy' => $level->id ), admin_url( 'admin.php' ) ); ?>" class="button-secondary"><?php _e('copy','pmpro'); ?></a>&nbsp;<a title="<?php _e('delete','pmpro'); ?>" href="javascript:askfirst('<?php echo str_replace("'", "\'", sprintf(__("Are you sure you want to delete membership level %s? All subscriptions will be cancelled.", "pmpro"), $level->name));?>', '<?php echo add_query_arg( array( 'page' => 'pmpro-membershiplevels', 'action' => 'delete_membership_level', 'deleteid' => $level->id ), admin_url( 'admin.php' ) ); ?>'); void(0);" class="button-secondary"><?php _e('delete','pmpro'); ?></a></td>
665
</tr>
666
<?php
667
}
686
687
<?php
688
require_once(dirname(__FILE__) . "/admin_footer.php");
689
+ ?>
adminpages/memberslist-csv.php CHANGED
@@ -10,7 +10,7 @@
10
11
if (PMPRO_BENCHMARK)
12
{
13
- error_log(str_repeat('-', 10) . date('Y-m-d H:i:s') . str_repeat('-', 10));
14
$start_time = microtime(true);
15
$start_memory = memory_get_usage(true);
16
}
@@ -401,7 +401,7 @@
401
if($theuser->membership_id)
402
{
403
if($theuser->enddate)
404
- array_push($csvoutput, pmpro_enclose(apply_filters("pmpro_memberslist_expires_column", date($dateformat, $theuser->enddate), $theuser)));
405
else
406
array_push($csvoutput, pmpro_enclose(apply_filters("pmpro_memberslist_expires_column", "Never", $theuser)));
407
}
@@ -463,9 +463,9 @@
463
$memory_used = $end_of_iteration_memory - $start_iteration_memory;
464
465
error_log("PMPRO_BENCHMARK - For iteration #{$ic} of {$iterations} - Records processed: " . count($usr_data));
466
- error_log("PMPRO_BENCHMARK - \tTime processing whole iteration: " . date("H:i:s", $iteration_sec) . ".{$iteration_sec}");
467
- error_log("PMPRO_BENCHMARK - \tTime processing user data for iteration: " . date("H:i:s", $udata_sec) . ".{$udata_sec}");
468
- error_log("PMPRO_BENCHMARK - \tTime flushing cache: " . date("H:i:s", $flush_sec) . ".{$flush_usec}");
469
error_log("PMPRO_BENCHMARK - \tAdditional memory used during iteration: ".number_format($memory_used, 2, '.', ',') . " bytes");
470
}
471
10
11
if (PMPRO_BENCHMARK)
12
{
13
+ error_log(str_repeat('-', 10) . date_i18n('Y-m-d H:i:s') . str_repeat('-', 10));
14
$start_time = microtime(true);
15
$start_memory = memory_get_usage(true);
16
}
401
if($theuser->membership_id)
402
{
403
if($theuser->enddate)
404
+ array_push($csvoutput, pmpro_enclose(apply_filters("pmpro_memberslist_expires_column", date_i18n($dateformat, $theuser->enddate), $theuser)));
405
else
406
array_push($csvoutput, pmpro_enclose(apply_filters("pmpro_memberslist_expires_column", "Never", $theuser)));
407
}
463
$memory_used = $end_of_iteration_memory - $start_iteration_memory;
464
465
error_log("PMPRO_BENCHMARK - For iteration #{$ic} of {$iterations} - Records processed: " . count($usr_data));
466
+ error_log("PMPRO_BENCHMARK - \tTime processing whole iteration: " . date_i18n("H:i:s", $iteration_sec) . ".{$iteration_sec}");
467
+ error_log("PMPRO_BENCHMARK - \tTime processing user data for iteration: " . date_i18n("H:i:s", $udata_sec) . ".{$udata_sec}");
468
+ error_log("PMPRO_BENCHMARK - \tTime flushing cache: " . date_i18n("H:i:s", $flush_sec) . ".{$flush_usec}");
469
error_log("PMPRO_BENCHMARK - \tAdditional memory used during iteration: ".number_format($memory_used, 2, '.', ',') . " bytes");
470
}
471
adminpages/memberslist.php CHANGED
@@ -242,11 +242,11 @@
242
-
243
<?php } ?>
244
</td>
245
- <td><?php echo date(get_option("date_format"), strtotime($theuser->user_registered, current_time("timestamp")))?></td>
246
<td>
247
<?php
248
if($auser->enddate)
249
- echo apply_filters("pmpro_memberslist_expires_column", date(get_option('date_format'), $auser->enddate), $auser);
250
else
251
echo __(apply_filters("pmpro_memberslist_expires_column", "Never", $auser), "pmpro");
252
?>
242
-
243
<?php } ?>
244
</td>
245
+ <td><?php echo date_i18n(get_option("date_format"), strtotime($theuser->user_registered, current_time("timestamp")))?></td>
246
<td>
247
<?php
248
if($auser->enddate)
249
+ echo apply_filters("pmpro_memberslist_expires_column", date_i18n(get_option('date_format'), $auser->enddate), $auser);
250
else
251
echo __(apply_filters("pmpro_memberslist_expires_column", "Never", $auser), "pmpro");
252
?>
adminpages/orders-csv.php CHANGED
@@ -14,7 +14,7 @@ $start_time = microtime(true);
14
15
if (true === PMPRO_BENCHMARK)
16
{
17
- error_log(str_repeat('-', 10) . date('Y-m-d H:i:s') . str_repeat('-', 10));
18
}
19
20
/**
@@ -59,25 +59,25 @@ if ( isset( $_REQUEST['start-day'] ) ) {
59
if ( isset( $_REQUEST['start-year'] ) ) {
60
$start_year = intval( $_REQUEST['start-year'] );
61
} else {
62
- $start_year = date( "Y" );
63
}
64
65
if ( isset( $_REQUEST['end-month'] ) ) {
66
$end_month = intval( $_REQUEST['end-month'] );
67
} else {
68
- $end_month = date( "n" );
69
}
70
71
if ( isset( $_REQUEST['end-day'] ) ) {
72
$end_day = intval( $_REQUEST['end-day'] );
73
} else {
74
- $end_day = date( "j" );
75
}
76
77
if ( isset( $_REQUEST['end-year'] ) ) {
78
$end_year = intval( $_REQUEST['end-year'] );
79
} else {
80
- $end_year = date( "Y" );
81
}
82
83
if ( isset( $_REQUEST['predefined-date'] ) ) {
@@ -133,19 +133,19 @@ if ( $filter == "all" || ! $filter ) {
133
$condition = "timestamp BETWEEN '" . $start_date . "' AND '" . $end_date . "'";
134
} elseif ( $filter == "predefined-date-range" ) {
135
if ( $predefined_date == "Last Month" ) {
136
- $start_date = date( "Y-m-d", strtotime( "first day of last month", current_time( "timestamp" ) ) );
137
- $end_date = date( "Y-m-d", strtotime( "last day of last month", current_time( "timestamp" ) ) );
138
} elseif ( $predefined_date == "This Month" ) {
139
- $start_date = date( "Y-m-d", strtotime( "first day of this month", current_time( "timestamp" ) ) );
140
- $end_date = date( "Y-m-d", strtotime( "last day of this month", current_time( "timestamp" ) ) );
141
} elseif ( $predefined_date == "This Year" ) {
142
- $year = date( 'Y' );
143
- $start_date = date( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
144
- $end_date = date( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
145
} elseif ( $predefined_date == "Last Year" ) {
146
- $year = date( 'Y' ) - 1;
147
- $start_date = date( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
148
- $end_date = date( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
149
}
150
151
//add times to dates
@@ -468,7 +468,7 @@ for ( $ic = 1; $ic <= $iterations; $ic ++ ) {
468
}
469
470
//timestamp
471
- $ts = date( $dateformat, $order->timestamp );
472
array_push( $csvoutput, pmpro_enclose( $ts ) );
473
474
//any extra columns
@@ -569,4 +569,4 @@ function pmpro_transmit_order_content( $csv_fh, $filename, $headers = array() )
569
//allow user to clean up after themselves
570
do_action( 'pmpro_after_order_csv_export' );
571
exit;
572
- }
14
15
if (true === PMPRO_BENCHMARK)
16
{
17
+ error_log(str_repeat('-', 10) . date_i18n('Y-m-d H:i:s') . str_repeat('-', 10));
18
}
19
20
/**
59
if ( isset( $_REQUEST['start-year'] ) ) {
60
$start_year = intval( $_REQUEST['start-year'] );
61
} else {
62
+ $start_year = date_i18n( "Y" );
63
}
64
65
if ( isset( $_REQUEST['end-month'] ) ) {
66
$end_month = intval( $_REQUEST['end-month'] );
67
} else {
68
+ $end_month = date_i18n( "n" );
69
}
70
71
if ( isset( $_REQUEST['end-day'] ) ) {
72
$end_day = intval( $_REQUEST['end-day'] );
73
} else {
74
+ $end_day = date_i18n( "j" );
75
}
76
77
if ( isset( $_REQUEST['end-year'] ) ) {
78
$end_year = intval( $_REQUEST['end-year'] );
79
} else {
80
+ $end_year = date_i18n( "Y" );
81
}
82
83
if ( isset( $_REQUEST['predefined-date'] ) ) {
133
$condition = "timestamp BETWEEN '" . $start_date . "' AND '" . $end_date . "'";
134
} elseif ( $filter == "predefined-date-range" ) {
135
if ( $predefined_date == "Last Month" ) {
136
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of last month", current_time( "timestamp" ) ) );
137
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of last month", current_time( "timestamp" ) ) );
138
} elseif ( $predefined_date == "This Month" ) {
139
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of this month", current_time( "timestamp" ) ) );
140
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of this month", current_time( "timestamp" ) ) );
141
} elseif ( $predefined_date == "This Year" ) {
142
+ $year = date_i18n( 'Y' );
143
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
144
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
145
} elseif ( $predefined_date == "Last Year" ) {
146
+ $year = date_i18n( 'Y' ) - 1;
147
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
148
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
149
}
150
151
//add times to dates
468
}
469
470
//timestamp
471
+ $ts = date_i18n( $dateformat, $order->timestamp );
472
array_push( $csvoutput, pmpro_enclose( $ts ) );
473
474
//any extra columns
569
//allow user to clean up after themselves
570
do_action( 'pmpro_after_order_csv_export' );
571
exit;
572
+ }
adminpages/orders.php CHANGED
@@ -33,25 +33,25 @@ if ( isset( $_REQUEST['start-day'] ) ) {
33
if ( isset( $_REQUEST['start-year'] ) ) {
34
$start_year = intval( $_REQUEST['start-year'] );
35
} else {
36
- $start_year = date( "Y" );
37
}
38
39
if ( isset( $_REQUEST['end-month'] ) ) {
40
$end_month = intval( $_REQUEST['end-month'] );
41
} else {
42
- $end_month = date( "n" );
43
}
44
45
if ( isset( $_REQUEST['end-day'] ) ) {
46
$end_day = intval( $_REQUEST['end-day'] );
47
} else {
48
- $end_day = date( "j" );
49
}
50
51
if ( isset( $_REQUEST['end-year'] ) ) {
52
$end_year = intval( $_REQUEST['end-year'] );
53
} else {
54
- $end_year = date( "Y" );
55
}
56
57
if ( isset( $_REQUEST['predefined-date'] ) ) {
@@ -111,19 +111,19 @@ if ( empty( $filter ) || $filter === "all" ) {
111
$condition = "timestamp BETWEEN '" . esc_sql( $start_date ) . "' AND '" . esc_sql( $end_date ) . "'";
112
} elseif ( $filter == "predefined-date-range" ) {
113
if ( $predefined_date == "Last Month" ) {
114
- $start_date = date( "Y-m-d", strtotime( "first day of last month", current_time( "timestamp" ) ) );
115
- $end_date = date( "Y-m-d", strtotime( "last day of last month", current_time( "timestamp" ) ) );
116
} elseif ( $predefined_date == "This Month" ) {
117
- $start_date = date( "Y-m-d", strtotime( "first day of this month", current_time( "timestamp" ) ) );
118
- $end_date = date( "Y-m-d", strtotime( "last day of this month", current_time( "timestamp" ) ) );
119
} elseif ( $predefined_date == "This Year" ) {
120
- $year = date( 'Y' );
121
- $start_date = date( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
122
- $end_date = date( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
123
} elseif ( $predefined_date == "Last Year" ) {
124
- $year = date( 'Y' ) - 1;
125
- $start_date = date( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
126
- $end_date = date( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
127
}
128
129
//add times to dates
@@ -167,7 +167,7 @@ if ( ! empty( $_REQUEST['delete'] ) ) {
167
}
168
}
169
170
- $thisyear = date( "Y" );
171
172
//this array stores fields that should be read only
173
$read_only_fields = apply_filters( "pmpro_orders_read_only_fields", array(
@@ -710,7 +710,7 @@ require_once( dirname( __FILE__ ) . "/admin_header.php" );
710
<th scope="row" valign="top"><label for="ts_month"><?php _e( 'Date', 'pmpro' ); ?>:</label></th>
711
<td>
712
<?php if ( in_array( "timestamp", $read_only_fields ) && $order_id > 0 ) {
713
- echo date( get_option( 'date_format' ) . " " . get_option( 'time_format' ), $order->timestamp );
714
} else { ?>
715
<?php
716
//set up date vars
@@ -719,16 +719,16 @@ require_once( dirname( __FILE__ ) . "/admin_header.php" );
719
} else {
720
$timestamp = current_time( 'timestamp' );
721
}
722
- $year = date( "Y", $timestamp );
723
- $month = date( "n", $timestamp );
724
- $day = date( "j", $timestamp );
725
?>
726
<select id="ts_month" name="ts_month">
727
<?php
728
for ( $i = 1; $i < 13; $i ++ ) {
729
?>
730
<option value="<?php echo $i ?>"
731
- <?php if ( $i == $month ) { ?>selected="selected"<?php } ?>><?php echo date( "M", strtotime( $i . "/1/" . $year, current_time( "timestamp" ) ) ) ?></option>
732
<?php
733
}
734
?>
@@ -894,7 +894,7 @@ require_once( dirname( __FILE__ ) . "/admin_header.php" );
894
<select id="start-month" name="start-month">
895
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
896
<option
897
- value="<?php echo $i; ?>" <?php selected( $start_month, $i ); ?>><?php echo date( "F", mktime( 0, 0, 0, $i, 2 ) ); ?></option>
898
<?php } ?>
899
</select>
900
@@ -909,7 +909,7 @@ require_once( dirname( __FILE__ ) . "/admin_header.php" );
909
<select id="end-month" name="end-month">
910
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
911
<option
912
- value="<?php echo $i; ?>" <?php selected( $end_month, $i ); ?>><?php echo date( "F", mktime( 0, 0, 0, $i, 2 ) ); ?></option>
913
<?php } ?>
914
</select>
915
@@ -1232,8 +1232,8 @@ require_once( dirname( __FILE__ ) . "/admin_header.php" );
1232
</td>
1233
<td><?php echo $order->status; ?></td>
1234
<td>
1235
- <?php echo date( get_option( 'date_format' ), $order->timestamp ); ?><br/>
1236
- <?php echo date( get_option( 'time_format' ), $order->timestamp ); ?>
1237
</td>
1238
<td align="center">
1239
<a href="admin.php?page=pmpro-orders&order=<?php echo $order->id; ?>"><?php _e( 'edit', 'pmpro' ); ?></a>
33
if ( isset( $_REQUEST['start-year'] ) ) {
34
$start_year = intval( $_REQUEST['start-year'] );
35
} else {
36
+ $start_year = date_i18n( "Y" );
37
}
38
39
if ( isset( $_REQUEST['end-month'] ) ) {
40
$end_month = intval( $_REQUEST['end-month'] );
41
} else {
42
+ $end_month = date_i18n( "n" );
43
}
44
45
if ( isset( $_REQUEST['end-day'] ) ) {
46
$end_day = intval( $_REQUEST['end-day'] );
47
} else {
48
+ $end_day = date_i18n( "j" );
49
}
50
51
if ( isset( $_REQUEST['end-year'] ) ) {
52
$end_year = intval( $_REQUEST['end-year'] );
53
} else {
54
+ $end_year = date_i18n( "Y" );
55
}
56
57
if ( isset( $_REQUEST['predefined-date'] ) ) {
111
$condition = "timestamp BETWEEN '" . esc_sql( $start_date ) . "' AND '" . esc_sql( $end_date ) . "'";
112
} elseif ( $filter == "predefined-date-range" ) {
113
if ( $predefined_date == "Last Month" ) {
114
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of last month", current_time( "timestamp" ) ) );
115
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of last month", current_time( "timestamp" ) ) );
116
} elseif ( $predefined_date == "This Month" ) {
117
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of this month", current_time( "timestamp" ) ) );
118
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of this month", current_time( "timestamp" ) ) );
119
} elseif ( $predefined_date == "This Year" ) {
120
+ $year = date_i18n( 'Y' );
121
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
122
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
123
} elseif ( $predefined_date == "Last Year" ) {
124
+ $year = date_i18n( 'Y' ) - 1;
125
+ $start_date = date_i18n( "Y-m-d", strtotime( "first day of January $year", current_time( "timestamp" ) ) );
126
+ $end_date = date_i18n( "Y-m-d", strtotime( "last day of December $year", current_time( "timestamp" ) ) );
127
}
128
129
//add times to dates
167
}
168
}
169
170
+ $thisyear = date_i18n( "Y" );
171
172
//this array stores fields that should be read only
173
$read_only_fields = apply_filters( "pmpro_orders_read_only_fields", array(
710
<th scope="row" valign="top"><label for="ts_month"><?php _e( 'Date', 'pmpro' ); ?>:</label></th>
711
<td>
712
<?php if ( in_array( "timestamp", $read_only_fields ) && $order_id > 0 ) {
713
+ echo date_i18n( get_option( 'date_format' ) . " " . get_option( 'time_format' ), $order->timestamp );
714
} else { ?>
715
<?php
716
//set up date vars
719
} else {
720
$timestamp = current_time( 'timestamp' );
721
}
722
+ $year = date_i18n( "Y", $timestamp );
723
+ $month = date_i18n( "n", $timestamp );
724
+ $day = date_i18n( "j", $timestamp );
725
?>
726
<select id="ts_month" name="ts_month">
727
<?php
728
for ( $i = 1; $i < 13; $i ++ ) {
729
?>
730
<option value="<?php echo $i ?>"
731
+ <?php if ( $i == $month ) { ?>selected="selected"<?php } ?>><?php echo date_i18n( "M", strtotime( $i . "/1/" . $year, current_time( "timestamp" ) ) ) ?></option>
732
<?php
733
}
734
?>
894
<select id="start-month" name="start-month">
895
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
896
<option
897
+ value="<?php echo $i; ?>" <?php selected( $start_month, $i ); ?>><?php echo date_i18n( "F", mktime( 0, 0, 0, $i, 2 ) ); ?></option>
898
<?php } ?>
899
</select>
900
909
<select id="end-month" name="end-month">
910
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
911
<option
912
+ value="<?php echo $i; ?>" <?php selected( $end_month, $i ); ?>><?php echo date_i18n( "F", mktime( 0, 0, 0, $i, 2 ) ); ?></option>
913
<?php } ?>
914
</select>
915
1232
</td>
1233
<td><?php echo $order->status; ?></td>
1234
<td>
1235
+ <?php echo date_i18n( get_option( 'date_format' ), $order->timestamp ); ?><br/>
1236
+ <?php echo date_i18n( get_option( 'time_format' ), $order->timestamp ); ?>
1237
</td>
1238
<td align="center">
1239
<a href="admin.php?page=pmpro-orders&order=<?php echo $order->id; ?>"><?php _e( 'edit', 'pmpro' ); ?></a>
adminpages/pagesettings.php CHANGED
@@ -297,4 +297,4 @@ require_once(dirname(__FILE__) . "/admin_header.php");
297
298
<?php
299
require_once(dirname(__FILE__) . "/admin_footer.php");
300
- ?>
297
298
<?php
299
require_once(dirname(__FILE__) . "/admin_footer.php");
300
+ ?>
adminpages/paymentsettings.php CHANGED
@@ -206,12 +206,24 @@
206
<label for="use_ssl"><?php _e('Force SSL', 'pmpro');?>:</label>
207
</th>
208
<td>
209
- <select id="use_ssl" name="use_ssl">
210
- <option value="0" <?php if(empty($use_ssl)) { ?>selected="selected"<?php } ?>><?php _e('No', 'pmpro');?></option>
211
- <option value="1" <?php if(!empty($use_ssl) && $use_ssl == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes', 'pmpro');?></option>
212
- <option value="2" <?php if(!empty($use_ssl) && $use_ssl == 2) { ?>selected="selected"<?php } ?>><?php _e('Yes (with JavaScript redirects)', 'pmpro');?></option>
213
- </select>
214
- <small><?php _e('Recommended: Yes. Try the JavaScript redirects setting if you are having issues with infinite redirect loops.', 'pmpro'); ?></small>
215
</td>
216
</tr>
217
<tr>
206
<label for="use_ssl"><?php _e('Force SSL', 'pmpro');?>:</label>
207
</th>
208
<td>
209
+ <?php
210
+ if( pmpro_check_site_url_for_https() ) {
211
+ //entire site is over HTTPS
212
+ ?>
213
+ <p><?php _e( 'Your Site URL starts with https:// and so PMPro will allow your entire site to be served over HTTPS.' , 'pmpro' ); ?></p>
214
+ <?php
215
+ } else {
216
+ //site is not over HTTPS, show setting
217
+ ?>
218
+ <select id="use_ssl" name="use_ssl">
219
+ <option value="0" <?php if(empty($use_ssl)) { ?>selected="selected"<?php } ?>><?php _e('No', 'pmpro');?></option>
220
+ <option value="1" <?php if(!empty($use_ssl) && $use_ssl == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes', 'pmpro');?></option>
221
+ <option value="2" <?php if(!empty($use_ssl) && $use_ssl == 2) { ?>selected="selected"<?php } ?>><?php _e('Yes (with JavaScript redirects)', 'pmpro');?></option>
222
+ </select>
223
+ <small><?php _e('Recommended: Yes. Try the JavaScript redirects setting if you are having issues with infinite redirect loops.', 'pmpro'); ?></small>
224
+ <?php
225
+ }
226
+ ?>
227
</td>
228
</tr>
229
<tr>
adminpages/reports.php CHANGED
@@ -63,4 +63,4 @@
63
}
64
65
require_once(dirname(__FILE__) . "/admin_footer.php");
66
- ?>
63
}
64
65
require_once(dirname(__FILE__) . "/admin_footer.php");
66
+ ?>
adminpages/reports/login.php CHANGED
@@ -19,9 +19,9 @@ function pmpro_report_login_widget()
19
{
20
global $wpdb;
21
$now = current_time('timestamp');
22
- $visits = get_option("pmpro_visits", array("today"=>0, "thisday"=>date("Y-m-d", $now), "alltime"=>0, "month"=>0, "thismonth"=>date("n", $now)));
23
- $views = get_option("pmpro_views", array("today"=>0, "thisday"=>date("Y-m-d", $now), "alltime"=>0, "month"=>0, "thismonth"=>date("n", $now)));
24
- $logins = get_option("pmpro_logins", array("today"=>0, "thisday"=>date("Y-m-d", $now), "alltime"=>0, "month"=>0, "thismonth"=>date("n", $now)));
25
?>
26
<span id="pmpro_report_login">
27
<table class="wp-list-table widefat fixed striped">
@@ -200,11 +200,11 @@ function pmpro_report_login_page()
200
<?php echo $theuser->display_name;?>
201
</td>
202
<td><?php echo $auser->membership?></td>
203
- <td><?php echo date("m/d/Y", strtotime($theuser->user_registered, current_time("timestamp")))?></td>
204
<td>
205
<?php
206
if($auser->enddate)
207
- echo date(get_option('date_format'), $auser->enddate);
208
else
209
echo "Never";
210
?>
@@ -273,9 +273,9 @@ function pmpro_report_login_wp_visits()
273
$visits = array("last"=>"N/A", "thisdate"=>NULL, "month"=>0, "thismonth"=>NULL, "alltime"=>0);
274
275
//track logins for user
276
- $visits['last'] = date(get_option("date_format"));
277
$visits['alltime']++;
278
- $thismonth = date("n", $now);
279
if($thismonth == $visits['thismonth'])
280
$visits['month']++;
281
else
@@ -294,7 +294,7 @@ function pmpro_report_login_wp_visits()
294
$visits = array("today"=>0, "thisdate"=>NULL, "month"=>0, "thismonth"=> NULL, "alltime"=>0);
295
296
$visits['alltime']++;
297
- $thisdate = date("Y-d-m", $now);
298
if($thisdate == $visits['thisdate'])
299
$visits['today']++;
300
else
@@ -341,9 +341,9 @@ function pmpro_report_login_wp_views()
341
$views = array("last"=>"N/A", "month"=>0, "alltime"=>0);
342
343
//track logins for user
344
- $views['last'] = date(get_option("date_format"), $now);
345
$views['alltime']++;
346
- $thismonth = date("n", $now);
347
if(isset($views['thismonth']) && $thismonth == $views['thismonth'])
348
$views['month']++;
349
else
@@ -362,7 +362,7 @@ function pmpro_report_login_wp_views()
362
$views = array("today"=>0, "thisdate"=> NULL, "month"=>0, "thismonth"=> NULL, "alltime"=>0);
363
364
$views['alltime']++;
365
- $thisdate = date("Y-d-m", $now);
366
if($thisdate == $views['thisdate'])
367
$views['today']++;
368
else
@@ -370,7 +370,7 @@ function pmpro_report_login_wp_views()
370
$views['today'] = 1;
371
$views['thisdate'] = $thisdate;
372
}
373
- $thismonth = date("n", $now);
374
if(isset($views['thismonth']) && $thismonth == $views['thismonth'])
375
$views['month']++;
376
else
@@ -395,9 +395,9 @@ function pmpro_report_login_wp_login($user_login)
395
$logins = array("last"=>"N/A", "thisdate"=>NULL, "month"=>0, "thismonth"=> NULL, "alltime"=>0);
396
397
//track logins for user
398
- $logins['last'] = date(get_option("date_format"), $now);
399
$logins['alltime']++;
400
- $thismonth = date("n", $now);
401
if($thismonth == $logins['thismonth'])
402
$logins['month']++;
403
else
@@ -415,7 +415,7 @@ function pmpro_report_login_wp_login($user_login)
415
$logins = array("today"=>0, "thisdate"=>NULL, "month"=>0, "thismonth"=>NULL, "alltime"=>0);
416
417
$logins['alltime']++;
418
- $thisdate = date("Y-d-m", $now);
419
if($thisdate == $logins['thisdate'])
420
$logins['today']++;
421
else
@@ -433,4 +433,4 @@ function pmpro_report_login_wp_login($user_login)
433
434
update_option("pmpro_logins", $logins);
435
}
436
- add_action("wp_login", "pmpro_report_login_wp_login");
19
{
20
global $wpdb;
21
$now = current_time('timestamp');
22
+ $visits = get_option("pmpro_visits", array("today"=>0, "thisday"=>date_i18n("Y-m-d", $now), "alltime"=>0, "month"=>0, "thismonth"=>date_i18n("n", $now)));
23
+ $views = get_option("pmpro_views", array("today"=>0, "thisday"=>date_i18n("Y-m-d", $now), "alltime"=>0, "month"=>0, "thismonth"=>date_i18n("n", $now)));
24
+ $logins = get_option("pmpro_logins", array("today"=>0, "thisday"=>date_i18n("Y-m-d", $now), "alltime"=>0, "month"=>0, "thismonth"=>date_i18n("n", $now)));
25
?>
26
<span id="pmpro_report_login">
27
<table class="wp-list-table widefat fixed striped">
200
<?php echo $theuser->display_name;?>
201
</td>
202
<td><?php echo $auser->membership?></td>
203
+ <td><?php echo date_i18n("m/d/Y", strtotime($theuser->user_registered, current_time("timestamp")))?></td>
204
<td>
205
<?php
206
if($auser->enddate)
207
+ echo date_i18n(get_option('date_format'), $auser->enddate);
208
else
209
echo "Never";
210
?>
273
$visits = array("last"=>"N/A", "thisdate"=>NULL, "month"=>0, "thismonth"=>NULL, "alltime"=>0);
274
275
//track logins for user
276
+ $visits['last'] = date_i18n(get_option("date_format"));
277
$visits['alltime']++;
278
+ $thismonth = date_i18n("n", $now);
279
if($thismonth == $visits['thismonth'])
280
$visits['month']++;
281
else
294
$visits = array("today"=>0, "thisdate"=>NULL, "month"=>0, "thismonth"=> NULL, "alltime"=>0);
295
296
$visits['alltime']++;
297
+ $thisdate = date_i18n("Y-d-m", $now);
298
if($thisdate == $visits['thisdate'])
299
$visits['today']++;
300
else
341
$views = array("last"=>"N/A", "month"=>0, "alltime"=>0);
342
343
//track logins for user
344
+ $views['last'] = date_i18n(get_option("date_format"), $now);
345
$views['alltime']++;
346
+ $thismonth = date_i18n("n", $now);
347
if(isset($views['thismonth']) && $thismonth == $views['thismonth'])
348
$views['month']++;
349
else
362
$views = array("today"=>0, "thisdate"=> NULL, "month"=>0, "thismonth"=> NULL, "alltime"=>0);
363
364
$views['alltime']++;
365
+ $thisdate = date_i18n("Y-d-m", $now);
366
if($thisdate == $views['thisdate'])
367
$views['today']++;
368
else
370
$views['today'] = 1;
371
$views['thisdate'] = $thisdate;
372
}
373
+ $thismonth = date_i18n("n", $now);
374
if(isset($views['thismonth']) && $thismonth == $views['thismonth'])
375
$views['month']++;
376
else
395
$logins = array("last"=>"N/A", "thisdate"=>NULL, "month"=>0, "thismonth"=> NULL, "alltime"=>0);
396
397
//track logins for user
398
+ $logins['last'] = date_i18n(get_option("date_format"), $now);
399
$logins['alltime']++;
400
+ $thismonth = date_i18n("n", $now);
401
if($thismonth == $logins['thismonth'])
402
$logins['month']++;
403
else
415
$logins = array("today"=>0, "thisdate"=>NULL, "month"=>0, "thismonth"=>NULL, "alltime"=>0);
416
417
$logins['alltime']++;
418
+ $thisdate = date_i18n("Y-d-m", $now);
419
if($thisdate == $logins['thisdate'])
420
$logins['today']++;
421
else
433
434
update_option("pmpro_logins", $logins);
435
}
436
+ add_action("wp_login", "pmpro_report_login_wp_login");
adminpages/reports/memberships.php CHANGED
@@ -83,13 +83,13 @@ function pmpro_report_memberships_page()
83
if(isset($_REQUEST['month']))
84
$month = intval($_REQUEST['month']);
85
else
86
- $month = date("n");
87
88
- $thisyear = date("Y");
89
if(isset($_REQUEST['year']))
90
$year = intval($_REQUEST['year']);
91
else
92
- $year = date("Y");
93
94
if(isset($_REQUEST['level']))
95
$l = intval($_REQUEST['level']);
@@ -154,7 +154,7 @@ function pmpro_report_memberships_page()
154
$cols = array();
155
if($period == "daily")
156
{
157
- $lastday = date("t", strtotime($startdate, current_time("timestamp")));
158
159
for($i = 1; $i <= $lastday; $i++)
160
{
@@ -290,7 +290,7 @@ function pmpro_report_memberships_page()
290
<span id="for"><?php _e('for', 'pmpro')?></span>
291
<select id="month" name="month">
292
<?php for($i = 1; $i < 13; $i++) { ?>
293
- <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
294
<?php } ?>
295
</select>
296
<select id="year" name="year">
@@ -362,28 +362,28 @@ function pmpro_report_memberships_page()
362
<?php if ( $type === "signup_v_all" ) : // Signups vs. all cancellations ?>
363
['<?php echo $date_function;?>', 'Signups', 'All Cancellations'],
364
<?php foreach($dates as $key => $value) { ?>
365
- ['<?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; ?>],
366
<?php } ?>
367
<?php endif; ?>
368
369
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
370
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
371
<?php foreach($dates as $key => $value) { ?>
372
- ['<?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; ?>],
373
<?php } ?>
374
<?php endif; ?>
375
376
<?php if ( $type === "signup_v_expiration" ) : // Signups vs. expirations ?>
377
['<?php echo $date_function;?>', 'Signups', 'Expirations'],
378
<?php foreach($dates as $key => $value) { ?>
379
- ['<?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; ?>],
380
<?php } ?>
381
<?php endif; ?>
382
383
<?php if ( $type === "mrr_ltv" ) : ?>
384
['<?php echo $date_function;?>', 'MRR', 'LTV'],
385
<?php foreach($dates as $key => $value) { ?>
386
- ['<?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 ); ?>],
387
<?php } ?>
388
<?php endif; ?>
389
]);
@@ -438,11 +438,11 @@ function pmpro_getSignups($period = false, $levels = 'all')
438
439
//a sale is an order with status = success
440
if( $period == 'today' )
441
- $startdate = date(' Y-m-d' );
442
elseif( $period == 'this month')
443
- $startdate = date( 'Y-m' ) . '-01';
444
elseif( $period == 'this year')
445
- $startdate = date( 'Y' ) . '-01-01';
446
else
447
$startdate = '';
448
@@ -494,22 +494,22 @@ function pmpro_getCancellations($period = null, $levels = 'all', $status = array
494
495
//figure out start date
496
$now = current_time('timestamp');
497
- $year = date("Y", $now);
498
499
if( $period == 'today' )
500
{
501
- $startdate = date('Y-m-d', $now) . " 00:00:00";
502
- $enddate = "'" . date('Y-m-d', $now) . " 23:59:59'";
503
}
504
elseif( $period == 'this month')
505
{
506
- $startdate = date( 'Y-m', $now ) . '-01 00:00:00';
507
- $enddate = "CONCAT(LAST_DAY('" . date( 'Y-m', $now ) . '-01' ."'), ' 23:59:59')";
508
}
509
elseif( $period == 'this year')
510
{
511
- $startdate = date( 'Y', $now ) . '-01-01 00:00:00';
512
- $enddate = "'" . date( 'Y', $now ) . "-12-31 23:59:59'";
513
}
514
else
515
{
@@ -546,7 +546,7 @@ function pmpro_getCancellations($period = null, $levels = 'all', $status = array
546
$levels = array($levels);
547
}
548
549
- $sqlQuery .= "AND membership_id IN(" . implode(", ", $levels) . ") ";
550
}
551
552
/**
@@ -586,9 +586,9 @@ function pmpro_getMRR($period, $levels = 'all')
586
587
//a sale is an order with status NOT IN refunded, review, token, error
588
if($period == "this month")
589
- $startdate = date("Y-m") . "-01";
590
elseif($period == "this year")
591
- $startdate = date("Y") . "-01-01";
592
else
593
$startdate = "";
594
@@ -614,11 +614,11 @@ function pmpro_getMRR($period, $levels = 'all')
614
return false;
615
616
//how many months ago was the first order
617
- $months = $wpdb->get_var("SELECT PERIOD_DIFF('" . date("Ym") . "', '" . date("Ym", $first_order_timestamp) . "')");
618
619
/* this works in PHP 5.3+ without using MySQL to get the diff
620
- $date1 = new DateTime(date("Y-m-d", $first_order_timestamp));
621
- $date2 = new DateTime(date("Y-m-d"));
622
$interval = $date1->diff($date2);
623
$years = intval($interval->format('%y'));
624
$months = $years*12 + intval($interval->format('%m'));
83
if(isset($_REQUEST['month']))
84
$month = intval($_REQUEST['month']);
85
else
86
+ $month = date_i18n("n");
87
88
+ $thisyear = date_i18n("Y");
89
if(isset($_REQUEST['year']))
90
$year = intval($_REQUEST['year']);
91
else
92
+ $year = date_i18n("Y");
93
94
if(isset($_REQUEST['level']))
95
$l = intval($_REQUEST['level']);
154
$cols = array();
155
if($period == "daily")
156
{
157
+ $lastday = date_i18n("t", strtotime($startdate, current_time("timestamp")));
158
159
for($i = 1; $i <= $lastday; $i++)
160
{
290
<span id="for"><?php _e('for', 'pmpro')?></span>
291
<select id="month" name="month">
292
<?php for($i = 1; $i < 13; $i++) { ?>
293
+ <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date_i18n("F", mktime(0, 0, 0, $i, 2));?></option>
294
<?php } ?>
295
</select>
296
<select id="year" name="year">
362
<?php if ( $type === "signup_v_all" ) : // Signups vs. all cancellations ?>
363
['<?php echo $date_function;?>', 'Signups', 'All Cancellations'],
364
<?php foreach($dates as $key => $value) { ?>
365
+ ['<?php if($period == "monthly") echo date_i18n("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; ?>],
366
<?php } ?>
367
<?php endif; ?>
368
369
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
370
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
371
<?php foreach($dates as $key => $value) { ?>
372
+ ['<?php if($period == "monthly") echo date_i18n("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; ?>],
373
<?php } ?>
374
<?php endif; ?>
375
376
<?php if ( $type === "signup_v_expiration" ) : // Signups vs. expirations ?>
377
['<?php echo $date_function;?>', 'Signups', 'Expirations'],
378
<?php foreach($dates as $key => $value) { ?>
379
+ ['<?php if($period == "monthly") echo date_i18n("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; ?>],
380
<?php } ?>
381
<?php endif; ?>
382
383
<?php if ( $type === "mrr_ltv" ) : ?>
384
['<?php echo $date_function;?>', 'MRR', 'LTV'],
385
<?php foreach($dates as $key => $value) { ?>
386
+ ['<?php if($period == "monthly") echo date_i18n("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 ); ?>],
387
<?php } ?>
388
<?php endif; ?>
389
]);
438
439
//a sale is an order with status = success
440
if( $period == 'today' )
441
+ $startdate = date_i18n(' Y-m-d' );
442
elseif( $period == 'this month')
443
+ $startdate = date_i18n( 'Y-m' ) . '-01';
444
elseif( $period == 'this year')
445
+ $startdate = date_i18n( 'Y' ) . '-01-01';
446
else
447
$startdate = '';
448
494
495
//figure out start date
496
$now = current_time('timestamp');
497
+ $year = date_i18n("Y", $now);
498
499
if( $period == 'today' )
500
{
501
+ $startdate = date_i18n('Y-m-d', $now) . " 00:00:00";
502
+ $enddate = "'" . date_i18n('Y-m-d', $now) . " 23:59:59'";
503
}
504
elseif( $period == 'this month')
505
{
506
+ $startdate = date_i18n( 'Y-m', $now ) . '-01 00:00:00';
507
+ $enddate = "CONCAT(LAST_DAY('" . date_i18n( 'Y-m', $now ) . '-01' ."'), ' 23:59:59')";
508
}
509
elseif( $period == 'this year')
510
{
511
+ $startdate = date_i18n( 'Y', $now ) . '-01-01 00:00:00';
512
+ $enddate = "'" . date_i18n( 'Y', $now ) . "-12-31 23:59:59'";
513
}
514
else
515
{
546
$levels = array($levels);
547
}
548
549
+ $sqlQuery .= "AND mu1.membership_id IN(" . implode(", ", $levels) . ") ";
550
}
551
552
/**
586
587
//a sale is an order with status NOT IN refunded, review, token, error
588
if($period == "this month")
589
+ $startdate = date_i18n("Y-m") . "-01";
590
elseif($period == "this year")
591
+ $startdate = date_i18n("Y") . "-01-01";
592
else
593
$startdate = "";
594
614
return false;
615
616
//how many months ago was the first order
617
+ $months = $wpdb->get_var("SELECT PERIOD_DIFF('" . date_i18n("Ym") . "', '" . date_i18n("Ym", $first_order_timestamp) . "')");
618
619
/* this works in PHP 5.3+ without using MySQL to get the diff
620
+ $date1 = new DateTime(date_i18n("Y-m-d", $first_order_timestamp));
621
+ $date2 = new DateTime(date_i18n("Y-m-d"));
622
$interval = $date1->diff($date2);
623
$years = intval($interval->format('%y'));
624
$months = $years*12 + intval($interval->format('%m'));
adminpages/reports/sales.php CHANGED
@@ -96,9 +96,9 @@ function pmpro_report_sales_page()
96
if(isset($_REQUEST['month']))
97
$month = intval($_REQUEST['month']);
98
else
99
- $month = date("n", current_time('timestamp'));
100
101
- $thisyear = date("Y", current_time('timestamp'));
102
if(isset($_REQUEST['year']))
103
$year = intval($_REQUEST['year']);
104
else
@@ -148,7 +148,7 @@ function pmpro_report_sales_page()
148
$cols = array();
149
if($period == "daily")
150
{
151
- $lastday = date("t", strtotime($startdate, current_time("timestamp")));
152
153
for($i = 1; $i <= $lastday; $i++)
154
{
@@ -212,7 +212,7 @@ function pmpro_report_sales_page()
212
<span id="for"><?php _e('for', 'pmpro')?></span>
213
<select id="month" name="month">
214
<?php for($i = 1; $i < 13; $i++) { ?>
215
- <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
216
<?php } ?>
217
</select>
218
<select id="year" name="year">
@@ -282,7 +282,7 @@ function pmpro_report_sales_page()
282
var data = google.visualization.arrayToDataTable([
283
['<?php echo $date_function;?>', '<?php echo ucwords($type);?>'],
284
<?php foreach($cols as $date => $value) { ?>
285
- ['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$date,2)); else echo $date;?>', <?php echo $value;?>],
286
<?php } ?>
287
]);
288
@@ -329,11 +329,11 @@ function pmpro_getSales($period, $levels = NULL)
329
330
//a sale is an order with status NOT IN('refunded', 'review', 'token', 'error') with a total > 0
331
if($period == "today")
332
- $startdate = date("Y-m-d", current_time('timestamp'));
333
elseif($period == "this month")
334
- $startdate = date("Y-m", current_time('timestamp')) . "-01";
335
elseif($period == "this year")
336
- $startdate = date("Y", current_time('timestamp')) . "-01-01";
337
else
338
$startdate = "";
339
@@ -372,11 +372,11 @@ function pmpro_getRevenue($period, $levels = NULL)
372
373
//a sale is an order with status NOT IN('refunded', 'review', 'token', 'error')
374
if($period == "today")
375
- $startdate = date("Y-m-d", current_time('timestamp'));
376
elseif($period == "this month")
377
- $startdate = date("Y-m", current_time('timestamp')) . "-01";
378
elseif($period == "this year")
379
- $startdate = date("Y", current_time('timestamp')) . "-01-01";
380
else
381
$startdate = "";
382
96
if(isset($_REQUEST['month']))
97
$month = intval($_REQUEST['month']);
98
else
99
+ $month = date_i18n("n", current_time('timestamp'));
100
101
+ $thisyear = date_i18n("Y", current_time('timestamp'));
102
if(isset($_REQUEST['year']))
103
$year = intval($_REQUEST['year']);
104
else
148
$cols = array();
149
if($period == "daily")
150
{
151
+ $lastday = date_i18n("t", strtotime($startdate, current_time("timestamp")));
152
153
for($i = 1; $i <= $lastday; $i++)
154
{
212
<span id="for"><?php _e('for', 'pmpro')?></span>
213
<select id="month" name="month">
214
<?php for($i = 1; $i < 13; $i++) { ?>
215
+ <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date_i18n("F", mktime(0, 0, 0, $i, 2));?></option>
216
<?php } ?>
217
</select>
218
<select id="year" name="year">
282
var data = google.visualization.arrayToDataTable([
283
['<?php echo $date_function;?>', '<?php echo ucwords($type);?>'],
284
<?php foreach($cols as $date => $value) { ?>
285
+ ['<?php if($period == "monthly") echo date_i18n("M", mktime(0,0,0,$date,2)); else echo $date;?>', <?php echo $value;?>],
286
<?php } ?>
287
]);
288
329
330
//a sale is an order with status NOT IN('refunded', 'review', 'token', 'error') with a total > 0
331
if($period == "today")
332
+ $startdate = date_i18n("Y-m-d", current_time('timestamp'));
333
elseif($period == "this month")
334
+ $startdate = date_i18n("Y-m", current_time('timestamp')) . "-01";
335
elseif($period == "this year")
336
+ $startdate = date_i18n("Y", current_time('timestamp')) . "-01-01";
337
else
338
$startdate = "";
339
372
373
//a sale is an order with status NOT IN('refunded', 'review', 'token', 'error')
374
if($period == "today")
375
+ $startdate = date_i18n("Y-m-d", current_time('timestamp'));
376
elseif($period == "this month")
377
+ $startdate = date_i18n("Y-m", current_time('timestamp')) . "-01";
378
elseif($period == "this year")
379
+ $startdate = date_i18n("Y", current_time('timestamp')) . "-01-01";
380
else
381
$startdate = "";
382
adminpages/templates/orders-email.php CHANGED
@@ -15,7 +15,7 @@
15
</tr>
16
<tr>
17
<td>
18
- <?php echo __( 'Date:', 'pmpro' ) . '&nbsp;' . date( 'Y-m-d', $order->timestamp ) ?>
19
</td>
20
</tr>
21
<?php if(!empty($order->billing->name)): ?>
@@ -68,4 +68,4 @@
68
</td>
69
</tr>
70
</tbody>
71
- </table>
15
</tr>
16
<tr>
17
<td>
18
+ <?php echo __( 'Date:', 'pmpro' ) . '&nbsp;' . date_i18n( 'Y-m-d', $order->timestamp ) ?>
19
</td>
20
</tr>
21
<?php if(!empty($order->billing->name)): ?>
68
</td>
69
</tr>
70
</tbody>
71
+ </table>
adminpages/templates/orders-print.php CHANGED
@@ -51,7 +51,7 @@
51
</tr>
52
<tr>
53
<td>
54
- <?php echo __( 'Date:', 'pmpro' ) . '&nbsp;' . date( 'Y-m-d', $order->timestamp ) ?>
55
</td>
56
</tr>
57
</table>
@@ -96,4 +96,4 @@
96
</table>
97
</main>
98
</body>
99
- </html>
51
</tr>
52
<tr>
53
<td>
54
+ <?php echo __( 'Date:', 'pmpro' ) . '&nbsp;' . date_i18n( 'Y-m-d', $order->timestamp ) ?>
55
</td>
56
</tr>
57
</table>
96
</table>
97
</main>
98
</body>
99
+ </html>
adminpages/updates.php CHANGED
@@ -30,4 +30,4 @@
30
31
<?php
32
require_once(dirname(__FILE__) . "/admin_footer.php");
33
- ?>
30
31
<?php
32
require_once(dirname(__FILE__) . "/admin_footer.php");
33
+ ?>
classes/class.memberorder.php CHANGED
@@ -158,28 +158,31 @@
158
* @param string $gateway Name/label for the gateway to set.
159
*
160
*/
161
- function setGateway($gateway = NULL)
162
- {
163
//set the gateway property
164
- if(isset($gateway))
165
- {
166
$this->gateway = $gateway;
167
}
168
169
//which one to load?
170
$classname = "PMProGateway"; //default test gateway
171
- if(!empty($this->gateway) && $this->gateway != "free")
172
$classname .= "_" . $this->gateway; //adding the gateway suffix
173
174
- if(class_exists($classname))
175
$this->Gateway = new $classname($this->gateway);
176
- else
177
- {
178
$error = new WP_Error("PMPro1001", "Could not locate the gateway class file with class name = " . $classname . ".");
179
- //die("Could not locate the gateway class file with class name = " . $classname . ".");
180
}
181
182
- return $this->Gateway;
183
}
184
185
/**
@@ -515,9 +518,9 @@
515
$this->gateway_environment = pmpro_getOption("gateway_environment");
516
517
if(empty($this->datetime) && empty($this->timestamp))
518
- $this->datetime = date("Y-m-d H:i:s", current_time("timestamp")); //use current time
519
elseif(empty($this->datetime) && !empty($this->timestamp) && is_numeric($this->timestamp))
520
- $this->datetime = date("Y-m-d H:i:s", $this->timestamp); //get datetime from timestamp
521
elseif(empty($this->datetime) && !empty($this->timestamp))
522
$this->datetime = $this->timestamp; //must have a datetime in it
523
158
* @param string $gateway Name/label for the gateway to set.
159
*
160
*/
161
+ function setGateway($gateway = NULL) {
162
//set the gateway property
163
+ if(isset($gateway)) {
164
$this->gateway = $gateway;
165
}
166
167
//which one to load?
168
$classname = "PMProGateway"; //default test gateway
169
+ if(!empty($this->gateway) && $this->gateway != "free") {
170
$classname .= "_" . $this->gateway; //adding the gateway suffix
171
+ }
172
173
+ if(class_exists($classname) && !empty($this->gateway)) {
174
$this->Gateway = new $classname($this->gateway);
175
+ } else {
176
+ $this->Gateway = null; //null out any current gateway
177
$error = new WP_Error("PMPro1001", "Could not locate the gateway class file with class name = " . $classname . ".");
178
}
179
180
+ if(!empty($this->Gateway)) {
181
+ return $this->Gateway;
182
+ } else {
183
+ //gateway wasn't setup
184
+ return false;
185
+ }
186
}
187
188
/**
518
$this->gateway_environment = pmpro_getOption("gateway_environment");
519
520
if(empty($this->datetime) && empty($this->timestamp))
521
+ $this->datetime = date_i18n("Y-m-d H:i:s", current_time("timestamp")); //use current time
522
elseif(empty($this->datetime) && !empty($this->timestamp) && is_numeric($this->timestamp))
523
+ $this->datetime = date_i18n("Y-m-d H:i:s", $this->timestamp); //get datetime from timestamp
524
elseif(empty($this->datetime) && !empty($this->timestamp))
525
$this->datetime = $this->timestamp; //must have a datetime in it
526
classes/class.mimetype.php CHANGED
@@ -236,4 +236,4 @@ class pmpro_mimetype {
236
);
237
}
238
}
239
- ?>
236
);
237
}
238
}
239
+ ?>
classes/gateways/class.pmprogateway.php CHANGED
@@ -20,7 +20,7 @@
20
if(!pmpro_isLevelTrial($order->membership_level))
21
{
22
//subscription will start today with a 1 period trial
23
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
24
$order->TrialBillingPeriod = $order->BillingPeriod;
25
$order->TrialBillingFrequency = $order->BillingFrequency;
26
$order->TrialBillingCycles = 1;
@@ -33,7 +33,7 @@
33
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
34
{
35
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
36
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
37
$order->TrialBillingCycles++;
38
39
//add a billing cycle to make up for the trial, if applicable
@@ -43,7 +43,7 @@
43
else
44
{
45
//add a period to the start date to account for the initial payment
46
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
47
}
48
49
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -67,7 +67,7 @@
67
if(!pmpro_isLevelTrial($order->membership_level))
68
{
69
//subscription will start today with a 1 period trial
70
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
71
$order->TrialBillingPeriod = $order->BillingPeriod;
72
$order->TrialBillingFrequency = $order->BillingFrequency;
73
$order->TrialBillingCycles = 1;
@@ -80,7 +80,7 @@
80
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
81
{
82
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
83
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
84
$order->TrialBillingCycles++;
85
86
//add a billing cycle to make up for the trial, if applicable
@@ -90,7 +90,7 @@
90
else
91
{
92
//add a period to the start date to account for the initial payment
93
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
94
}
95
96
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -216,4 +216,4 @@
216
//this looks different for each gateway, but generally an array of some sort
217
return array();
218
}
219
- }
20
if(!pmpro_isLevelTrial($order->membership_level))
21
{
22
//subscription will start today with a 1 period trial
23
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
24
$order->TrialBillingPeriod = $order->BillingPeriod;
25
$order->TrialBillingFrequency = $order->BillingFrequency;
26
$order->TrialBillingCycles = 1;
33
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
34
{
35
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
36
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
37
$order->TrialBillingCycles++;
38
39
//add a billing cycle to make up for the trial, if applicable
43
else
44
{
45
//add a period to the start date to account for the initial payment
46
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
47
}
48
49
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
67
if(!pmpro_isLevelTrial($order->membership_level))
68
{
69
//subscription will start today with a 1 period trial
70
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
71
$order->TrialBillingPeriod = $order->BillingPeriod;
72
$order->TrialBillingFrequency = $order->BillingFrequency;
73
$order->TrialBillingCycles = 1;
80
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
81
{
82
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
83
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
84
$order->TrialBillingCycles++;
85
86
//add a billing cycle to make up for the trial, if applicable
90
else
91
{
92
//add a period to the start date to account for the initial payment
93
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
94
}
95
96
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
216
//this looks different for each gateway, but generally an array of some sort
217
return array();
218
}
219
+ }
classes/gateways/class.pmprogateway_authorizenet.php CHANGED
@@ -136,7 +136,7 @@
136
if(!pmpro_isLevelTrial($order->membership_level))
137
{
138
//subscription will start today with a 1 period trial
139
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
140
$order->TrialBillingPeriod = $order->BillingPeriod;
141
$order->TrialBillingFrequency = $order->BillingFrequency;
142
$order->TrialBillingCycles = 1;
@@ -149,7 +149,7 @@
149
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
150
{
151
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
152
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
153
$order->TrialBillingCycles++;
154
155
//add a billing cycle to make up for the trial, if applicable
@@ -159,7 +159,7 @@
159
else
160
{
161
//add a period to the start date to account for the initial payment
162
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
163
}
164
165
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -183,7 +183,7 @@
183
if(!pmpro_isLevelTrial($order->membership_level))
184
{
185
//subscription will start today with a 1 period trial
186
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
187
$order->TrialBillingPeriod = $order->BillingPeriod;
188
$order->TrialBillingFrequency = $order->BillingFrequency;
189
$order->TrialBillingCycles = 1;
@@ -196,7 +196,7 @@
196
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
197
{
198
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
199
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
200
$order->TrialBillingCycles++;
201
202
//add a billing cycle to make up for the trial, if applicable
@@ -206,7 +206,7 @@
206
else
207
{
208
//add a period to the start date to account for the initial payment
209
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
210
}
211
212
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
136
if(!pmpro_isLevelTrial($order->membership_level))
137
{
138
//subscription will start today with a 1 period trial
139
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
140
$order->TrialBillingPeriod = $order->BillingPeriod;
141
$order->TrialBillingFrequency = $order->BillingFrequency;
142
$order->TrialBillingCycles = 1;
149
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
150
{
151
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
152
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
153
$order->TrialBillingCycles++;
154
155
//add a billing cycle to make up for the trial, if applicable
159
else
160
{
161
//add a period to the start date to account for the initial payment
162
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
163
}
164
165
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
183
if(!pmpro_isLevelTrial($order->membership_level))
184
{
185
//subscription will start today with a 1 period trial
186
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
187
$order->TrialBillingPeriod = $order->BillingPeriod;
188
$order->TrialBillingFrequency = $order->BillingFrequency;
189
$order->TrialBillingCycles = 1;
196
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
197
{
198
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
199
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
200
$order->TrialBillingCycles++;
201
202
//add a billing cycle to make up for the trial, if applicable
206
else
207
{
208
//add a period to the start date to account for the initial payment
209
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
210
}
211
212
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
classes/gateways/class.pmprogateway_braintree.php CHANGED
@@ -340,7 +340,7 @@
340
<option value="12" <?php if($ExpirationMonth == "12") { ?>selected="selected"<?php } ?>>12</option>
341
</select>/<select id="ExpirationYear" name="ExpirationYear" class=" <?php echo pmpro_getClassForField("ExpirationYear");?>">
342
<?php
343
- for($i = date("Y"); $i < date("Y") + 10; $i++)
344
{
345
?>
346
<option value="<?php echo $i?>" <?php if($ExpirationYear == $i) { ?>selected="selected"<?php } ?>><?php echo $i?></option>
@@ -692,13 +692,13 @@
692
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
693
694
//convert to a profile start date
695
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
696
697
//filter the start date
698
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
699
700
//convert back to days
701
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d")) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
702
703
//now add the actual trial set by the site
704
if(!empty($order->TrialBillingCycles))
340
<option value="12" <?php if($ExpirationMonth == "12") { ?>selected="selected"<?php } ?>>12</option>
341
</select>/<select id="ExpirationYear" name="ExpirationYear" class=" <?php echo pmpro_getClassForField("ExpirationYear");?>">
342
<?php
343
+ for($i = date_i18n("Y"); $i < date_i18n("Y") + 10; $i++)
344
{
345
?>
346
<option value="<?php echo $i?>" <?php if($ExpirationYear == $i) { ?>selected="selected"<?php } ?>><?php echo $i?></option>
692
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
693
694
//convert to a profile start date
695
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
696
697
//filter the start date
698
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
699
700
//convert back to days
701
+ $trial_period_days = ceil(abs(strtotime(date_i18n("Y-m-d")) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
702
703
//now add the actual trial set by the site
704
if(!empty($order->TrialBillingCycles))
classes/gateways/class.pmprogateway_check.php CHANGED
@@ -175,7 +175,7 @@
175
if(!pmpro_isLevelTrial($order->membership_level))
176
{
177
//subscription will start today with a 1 period trial
178
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
179
$order->TrialBillingPeriod = $order->BillingPeriod;
180
$order->TrialBillingFrequency = $order->BillingFrequency;
181
$order->TrialBillingCycles = 1;
@@ -188,7 +188,7 @@
188
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
189
{
190
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
191
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
192
$order->TrialBillingCycles++;
193
194
//add a billing cycle to make up for the trial, if applicable
@@ -198,7 +198,7 @@
198
else
199
{
200
//add a period to the start date to account for the initial payment
201
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
202
}
203
204
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -222,7 +222,7 @@
222
if(!pmpro_isLevelTrial($order->membership_level))
223
{
224
//subscription will start today with a 1 period trial
225
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
226
$order->TrialBillingPeriod = $order->BillingPeriod;
227
$order->TrialBillingFrequency = $order->BillingFrequency;
228
$order->TrialBillingCycles = 1;
@@ -235,7 +235,7 @@
235
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
236
{
237
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
238
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
239
$order->TrialBillingCycles++;
240
241
//add a billing cycle to make up for the trial, if applicable
@@ -245,7 +245,7 @@
245
else
246
{
247
//add a period to the start date to account for the initial payment
248
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
249
}
250
251
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -356,4 +356,4 @@
356
$order->updateStatus("cancelled");
357
return true;
358
}
359
- }
175
if(!pmpro_isLevelTrial($order->membership_level))
176
{
177
//subscription will start today with a 1 period trial
178
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
179
$order->TrialBillingPeriod = $order->BillingPeriod;
180
$order->TrialBillingFrequency = $order->BillingFrequency;
181
$order->TrialBillingCycles = 1;
188
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
189
{
190
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
191
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
192
$order->TrialBillingCycles++;
193
194
//add a billing cycle to make up for the trial, if applicable
198
else
199
{
200
//add a period to the start date to account for the initial payment
201
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
202
}
203
204
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
222
if(!pmpro_isLevelTrial($order->membership_level))
223
{
224
//subscription will start today with a 1 period trial
225
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
226
$order->TrialBillingPeriod = $order->BillingPeriod;
227
$order->TrialBillingFrequency = $order->BillingFrequency;
228
$order->TrialBillingCycles = 1;
235
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
236
{
237
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
238
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
239
$order->TrialBillingCycles++;
240
241
//add a billing cycle to make up for the trial, if applicable
245
else
246
{
247
//add a period to the start date to account for the initial payment
248
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
249
}
250
251
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
356
$order->updateStatus("cancelled");
357
return true;
358
}
359
+ }
classes/gateways/class.pmprogateway_cybersource.php CHANGED
@@ -136,7 +136,7 @@
136
if(!pmpro_isLevelTrial($order->membership_level))
137
{
138
//subscription will start today with a 1 period trial
139
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
140
$order->TrialBillingPeriod = $order->BillingPeriod;
141
$order->TrialBillingFrequency = $order->BillingFrequency;
142
$order->TrialBillingCycles = 1;
@@ -149,7 +149,7 @@
149
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
150
{
151
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
152
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
153
$order->TrialBillingCycles++;
154
155
//add a billing cycle to make up for the trial, if applicable
@@ -159,7 +159,7 @@
159
else
160
{
161
//add a period to the start date to account for the initial payment
162
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
163
}
164
165
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -183,7 +183,7 @@
183
if(!pmpro_isLevelTrial($order->membership_level))
184
{
185
//subscription will start today with a 1 period trial
186
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
187
$order->TrialBillingPeriod = $order->BillingPeriod;
188
$order->TrialBillingFrequency = $order->BillingFrequency;
189
$order->TrialBillingCycles = 1;
@@ -196,7 +196,7 @@
196
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
197
{
198
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
199
- $order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
200
$order->TrialBillingCycles++;
201
202
//add a billing cycle to make up for the trial, if applicable
@@ -206,7 +206,7 @@
206
else
207
{
208
//add a period to the start date to account for the initial payment
209
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
210
}
211
212
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -583,13 +583,13 @@
583
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
584
585
//convert to a profile start date
586
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
587
588
//filter the start date
589
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
590
591
//convert back to days
592
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d"), current_time('timestamp')) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
593
594
//now add the actual trial set by the site
595
if(!empty($order->TrialBillingCycles))
@@ -606,7 +606,7 @@
606
}
607
608
//convert back into a date
609
- $profile_start_date = date("Ymd", strtotime("+ " . $trial_period_days . " Days"));
610
611
//figure out the frequency
612
if($order->BillingPeriod == "Year")
136
if(!pmpro_isLevelTrial($order->membership_level))
137
{
138
//subscription will start today with a 1 period trial
139
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
140
$order->TrialBillingPeriod = $order->BillingPeriod;
141
$order->TrialBillingFrequency = $order->BillingFrequency;
142
$order->TrialBillingCycles = 1;
149
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
150
{
151
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
152
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
153
$order->TrialBillingCycles++;
154
155
//add a billing cycle to make up for the trial, if applicable
159
else
160
{
161
//add a period to the start date to account for the initial payment
162
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
163
}
164
165
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
183
if(!pmpro_isLevelTrial($order->membership_level))
184
{
185
//subscription will start today with a 1 period trial
186
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
187
$order->TrialBillingPeriod = $order->BillingPeriod;
188
$order->TrialBillingFrequency = $order->BillingFrequency;
189
$order->TrialBillingCycles = 1;
196
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
197
{
198
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
199
+ $order->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
200
$order->TrialBillingCycles++;
201
202
//add a billing cycle to make up for the trial, if applicable
206
else
207
{
208
//add a period to the start date to account for the initial payment
209
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
210
}
211
212
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
583
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
584
585
//convert to a profile start date
586
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
587
588
//filter the start date
589
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
590
591
//convert back to days
592
+ $trial_period_days = ceil(abs(strtotime(date_i18n("Y-m-d"), current_time('timestamp')) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
593
594
//now add the actual trial set by the site
595
if(!empty($order->TrialBillingCycles))
606
}
607
608
//convert back into a date
609
+ $profile_start_date = date_i18n("Ymd", strtotime("+ " . $trial_period_days . " Days"));
610
611
//figure out the frequency
612
if($order->BillingPeriod == "Year")
classes/gateways/class.pmprogateway_payflowpro.php CHANGED
@@ -154,7 +154,7 @@
154
if($authorization_id)
155
{
156
$this->void($order, $authorization_id);
157
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
158
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
159
return $this->subscribe($order);
160
}
@@ -173,7 +173,7 @@
173
//set up recurring billing
174
if(pmpro_isLevelRecurring($order->membership_level))
175
{
176
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
177
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
178
if($this->subscribe($order))
179
{
@@ -217,7 +217,8 @@
217
$nvpStr = "";
218
219
$nvpStr .="&AMT=1.00";
220
- $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
221
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
222
223
$nvpStr .= "&CUSTIP=" . $_SERVER['REMOTE_ADDR'] . "&INVNUM=" . $order->code;
@@ -311,7 +312,8 @@
311
//paypal profile stuff
312
$nvpStr = "";
313
$nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax . "&CURRENCY=" . $pmpro_currency;
314
- $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
315
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
316
317
$nvpStr .= "&CUSTIP=" . $_SERVER['REMOTE_ADDR'] . "&INVNUM=" . $order->code;
@@ -378,7 +380,8 @@
378
//paypal profile stuff
379
$nvpStr = "&ACTION=A";
380
$nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax . "&CURRENCY=" . $pmpro_currency;
381
- $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
382
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
383
384
$nvpStr .= "&PROFILENAME=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
@@ -412,13 +415,13 @@
412
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
413
414
//convert to a profile start date
415
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
416
417
//filter the start date
418
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
419
420
//convert back to days
421
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d"), current_time('timestamp')) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
422
423
//now add the actual trial set by the site
424
if(!empty($order->TrialBillingCycles))
@@ -435,10 +438,10 @@
435
}
436
437
//convert back into a date
438
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
439
440
//start date
441
- $nvpStr .= "&START=" . date("mdY", strtotime($order->ProfileStartDate));
442
443
if(!empty($order->accountnumber))
444
$nvpStr .= "&ACCT=" . $order->accountnumber . "&EXPDATE=" . $order->expirationmonth . substr($order->expirationyear, 2, 2) . "&CVV2=" . $order->CVV2;
@@ -483,7 +486,8 @@
483
484
//paypal profile stuff
485
$nvpStr = "&ORIGPROFILEID=" . $order->subscription_transaction_id . "&ACTION=M";
486
- $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
487
488
$nvpStr .= "&PROFILENAME=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
489
154
if($authorization_id)
155
{
156
$this->void($order, $authorization_id);
157
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
158
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
159
return $this->subscribe($order);
160
}
173
//set up recurring billing
174
if(pmpro_isLevelRecurring($order->membership_level))
175
{
176
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
177
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
178
if($this->subscribe($order))
179
{
217
$nvpStr = "";
218
219
$nvpStr .="&AMT=1.00";
220
+ /* PayFlow Pro doesn't use IPN so this is a little confusing */
221
+ // $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
222
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
223
224
$nvpStr .= "&CUSTIP=" . $_SERVER['REMOTE_ADDR'] . "&INVNUM=" . $order->code;
312
//paypal profile stuff
313
$nvpStr = "";
314
$nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax . "&CURRENCY=" . $pmpro_currency;
315
+ /* PayFlow Pro doesn't use IPN so this is a little confusing */
316
+ // $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
317
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
318
319
$nvpStr .= "&CUSTIP=" . $_SERVER['REMOTE_ADDR'] . "&INVNUM=" . $order->code;
380
//paypal profile stuff
381
$nvpStr = "&ACTION=A";
382
$nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax . "&CURRENCY=" . $pmpro_currency;
383
+ /* PayFlow Pro doesn't use IPN so this is a little confusing */
384
+ // $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
385
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
386
387
$nvpStr .= "&PROFILENAME=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
415
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
416
417
//convert to a profile start date
418
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
419
420
//filter the start date
421
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
422
423
//convert back to days
424
+ $trial_period_days = ceil(abs(strtotime(date_i18n("Y-m-d"), current_time('timestamp')) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
425
426
//now add the actual trial set by the site
427
if(!empty($order->TrialBillingCycles))
438
}
439
440
//convert back into a date
441
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
442
443
//start date
444
+ $nvpStr .= "&START=" . date_i18n("mdY", strtotime($order->ProfileStartDate));
445
446
if(!empty($order->accountnumber))
447
$nvpStr .= "&ACCT=" . $order->accountnumber . "&EXPDATE=" . $order->expirationmonth . substr($order->expirationyear, 2, 2) . "&CVV2=" . $order->CVV2;
486
487
//paypal profile stuff
488
$nvpStr = "&ORIGPROFILEID=" . $order->subscription_transaction_id . "&ACTION=M";
489
+ /* PayFlow Pro doesn't use IPN so this is a little confusing */
490
+ // $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
491
492
$nvpStr .= "&PROFILENAME=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
493
classes/gateways/class.pmprogateway_paypal.php CHANGED
@@ -52,7 +52,7 @@
52
*
53
* @since 1.8.9.1
54
*/
55
- static function http_api_curl($handle) {
56
if(strpos($url, 'paypal.com') !== false)
57
curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
58
}
@@ -262,7 +262,7 @@
262
if($authorization_id)
263
{
264
$this->void($order, $authorization_id);
265
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
266
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
267
return $this->subscribe($order);
268
}
@@ -281,7 +281,7 @@
281
//set up recurring billing
282
if(pmpro_isLevelRecurring($order->membership_level))
283
{
284
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
285
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
286
if($this->subscribe($order))
287
{
@@ -498,7 +498,7 @@
498
if(!empty($order->Token))
499
$nvpStr .= "&TOKEN=" . $order->Token;
500
$nvpStr .="&AMT=" . $order->PaymentAmount . "&TAXAMT=" . $amount_tax . "&CURRENCYCODE=" . $pmpro_currency . "&PROFILESTARTDATE=" . $order->ProfileStartDate;
501
- $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLAMT=AddToNextBilling";
502
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
503
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
504
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
52
*
53
* @since 1.8.9.1
54
*/
55
+ static function http_api_curl($handle, $r, $url) {
56
if(strpos($url, 'paypal.com') !== false)
57
curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
58
}
262
if($authorization_id)
263
{
264
$this->void($order, $authorization_id);
265
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
266
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
267
return $this->subscribe($order);
268
}
281
//set up recurring billing
282
if(pmpro_isLevelRecurring($order->membership_level))
283
{
284
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
285
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
286
if($this->subscribe($order))
287
{
498
if(!empty($order->Token))
499
$nvpStr .= "&TOKEN=" . $order->Token;
500
$nvpStr .="&AMT=" . $order->PaymentAmount . "&TAXAMT=" . $amount_tax . "&CURRENCYCODE=" . $pmpro_currency . "&PROFILESTARTDATE=" . $order->ProfileStartDate;
501
+ $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLOUTAMT=AddToNextBilling";
502
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
503
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
504
//$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
classes/gateways/class.pmprogateway_paypalexpress.php CHANGED
@@ -319,7 +319,7 @@
319
$morder->discount_code = $discount_code;
320
$morder->InitialPayment = $pmpro_level->initial_payment;
321
$morder->PaymentAmount = $pmpro_level->billing_amount;
322
- $morder->ProfileStartDate = date("Y-m-d") . "T0:0:0";
323
$morder->BillingPeriod = $pmpro_level->cycle_period;
324
$morder->BillingFrequency = $pmpro_level->cycle_number;
325
$morder->Email = $bemail;
@@ -399,7 +399,7 @@
399
{
400
$order->payment_type = "PayPal Express";
401
$order->cardtype = "";
402
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
403
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
404
405
return $this->setExpressCheckout($order);
@@ -414,7 +414,7 @@
414
{
415
if(pmpro_isLevelRecurring($order->membership_level))
416
{
417
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
418
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
419
return $this->subscribe($order);
420
}
@@ -514,7 +514,7 @@
514
if(!empty($order->ProfileStartDate) && strtotime($order->ProfileStartDate, current_time("timestamp")) > 0)
515
$nvpStr .= "&PROFILESTARTDATE=" . $order->ProfileStartDate;
516
if(!empty($order->BillingFrequency))
517
- $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLAMT=AddToNextBilling&L_BILLINGTYPE0=RecurringPayments";
518
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
519
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
520
$nvpStr .= "&NOSHIPPING=1&L_BILLINGAGREEMENTDESCRIPTION0=" . urlencode(substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127)) . "&L_PAYMENTTYPE0=Any";
@@ -649,7 +649,7 @@
649
$nvpStr .= "&TAXAMT=" . $amount_tax;
650
*/
651
if(!empty($order->BillingFrequency))
652
- $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLAMT=AddToNextBilling";
653
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
654
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
655
$nvpStr .= "&NOSHIPPING=1";
@@ -707,7 +707,7 @@
707
$nvpStr .="&INITAMT=" . $initial_payment . "&AMT=" . $amount . "&CURRENCYCODE=" . $pmpro_currency . "&PROFILESTARTDATE=" . $order->ProfileStartDate;
708
if(!empty($amount_tax))
709
$nvpStr .= "&TAXAMT=" . $amount_tax;
710
- $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLAMT=AddToNextBilling";
711
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
712
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
713
319
$morder->discount_code = $discount_code;
320
$morder->InitialPayment = $pmpro_level->initial_payment;
321
$morder->PaymentAmount = $pmpro_level->billing_amount;
322
+ $morder->ProfileStartDate = date_i18n("Y-m-d") . "T0:0:0";
323
$morder->BillingPeriod = $pmpro_level->cycle_period;
324
$morder->BillingFrequency = $pmpro_level->cycle_number;
325
$morder->Email = $bemail;
399
{
400
$order->payment_type = "PayPal Express";
401
$order->cardtype = "";
402
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
403
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
404
405
return $this->setExpressCheckout($order);
414
{
415
if(pmpro_isLevelRecurring($order->membership_level))
416
{
417
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
418
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
419
return $this->subscribe($order);
420
}
514
if(!empty($order->ProfileStartDate) && strtotime($order->ProfileStartDate, current_time("timestamp")) > 0)
515
$nvpStr .= "&PROFILESTARTDATE=" . $order->ProfileStartDate;
516
if(!empty($order->BillingFrequency))
517
+ $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLOUTAMT=AddToNextBilling&L_BILLINGTYPE0=RecurringPayments";
518
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
519
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
520
$nvpStr .= "&NOSHIPPING=1&L_BILLINGAGREEMENTDESCRIPTION0=" . urlencode(substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127)) . "&L_PAYMENTTYPE0=Any";
649
$nvpStr .= "&TAXAMT=" . $amount_tax;
650
*/
651
if(!empty($order->BillingFrequency))
652
+ $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLOUTAMT=AddToNextBilling";
653
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
654
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
655
$nvpStr .= "&NOSHIPPING=1";
707
$nvpStr .="&INITAMT=" . $initial_payment . "&AMT=" . $amount . "&CURRENCYCODE=" . $pmpro_currency . "&PROFILESTARTDATE=" . $order->ProfileStartDate;
708
if(!empty($amount_tax))
709
$nvpStr .= "&TAXAMT=" . $amount_tax;
710
+ $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLOUTAMT=AddToNextBilling";
711
$nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
712
$nvpStr .= "&DESC=" . urlencode( apply_filters( 'pmpro_paypal_level_description', substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), $order->membership_level->name, $order, get_bloginfo("name")) );
713
classes/gateways/class.pmprogateway_paypalstandard.php CHANGED
@@ -346,7 +346,7 @@
346
else
347
{
348
//we can try to work in any change in ProfileStartDate
349
- $psd = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
350
$adjusted_psd = apply_filters("pmpro_profile_start_date", $psd, $order);
351
if($psd != $adjusted_psd)
352
{
346
else
347
{
348
//we can try to work in any change in ProfileStartDate
349
+ $psd = date_i18n("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
350
$adjusted_psd = apply_filters("pmpro_profile_start_date", $psd, $order);
351
if($psd != $adjusted_psd)
352
{
classes/gateways/class.pmprogateway_stripe.php CHANGED
@@ -534,7 +534,7 @@
534
<option value="12" <?php if($ExpirationMonth == "12") { ?>selected="selected"<?php } ?>>12</option>
535
</select>/<select id="ExpirationYear" class=" <?php echo pmpro_getClassForField("ExpirationYear");?>">
536
<?php
537
- for($i = date("Y"); $i < date("Y") + 10; $i++)
538
{
539
?>
540
<option value="<?php echo $i?>" <?php if($ExpirationYear == $i) { ?>selected="selected"<?php } ?>><?php echo $i?></option>
@@ -586,8 +586,8 @@
586
global $wpdb, $current_user, $pmpro_currency_symbol;
587
588
$cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
589
- $current_year = date("Y");
590
- $current_month = date("m");
591
592
//make sure the current user has privileges
593
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
@@ -672,7 +672,7 @@
672
{
673
?>
674
<option value="<?php echo str_pad($i, 2, "0", STR_PAD_LEFT);?>" <?php if(!empty($update['date_month']) && $update['date_month'] == $i) { ?>selected="selected"<?php } ?>>
675
- <?php echo date("M", strtotime($i . "/1/" . $current_year));?>
676
</option>
677
<?php
678
}
@@ -856,7 +856,7 @@
856
$update_order->membership_name = $user_level->name;
857
$update_order->InitialPayment = 0;
858
$update_order->PaymentAmount = $update['billing_amount'];
859
- $update_order->ProfileStartDate = date("Y-m-d", $end_timestamp);
860
$update_order->BillingPeriod = $update['cycle_period'];
861
$update_order->BillingFrequency = $update['cycle_number'];
862
@@ -940,7 +940,7 @@
940
WHERE meta_key = 'pmpro_stripe_next_on_date_update'
941
AND meta_value IS NOT NULL
942
AND meta_value <> ''
943
- AND meta_value < '" . date("Y-m-d", strtotime("+1 day")) . "'";
944
$updates = $wpdb->get_results($sqlQuery);
945
946
if(!empty($updates))
@@ -968,10 +968,10 @@
968
//loop through updates looking for updates happening today or earlier
969
if(!empty($user_updates))
970
{
971
- foreach($user_updates as $key => $update)
972
{
973
- if($update['when'] == 'date' &&
974
- $update['date_year'] . "-" . $update['date_month'] . "-" . $update['date_day'] <= date("Y-m-d")
975
)
976
{
977
//get level for user
@@ -994,7 +994,7 @@
994
}
995
996
//if we didn't get an end date, let's set one one cycle out
997
- $end_timestamp = strtotime("+" . $update['cycle_number'] . " " . $update['cycle_period']);
998
999
//build order object
1000
$update_order = new MemberOrder();
@@ -1003,19 +1003,19 @@
1003
$update_order->membership_id = $user_level->id;
1004
$update_order->membership_name = $user_level->name;
1005
$update_order->InitialPayment = 0;
1006
- $update_order->PaymentAmount = $update['billing_amount'];
1007
- $update_order->ProfileStartDate = date("Y-m-d", $end_timestamp);
1008
- $update_order->BillingPeriod = $update['cycle_period'];
1009
- $update_order->BillingFrequency = $update['cycle_number'];
1010
1011
//update subscription
1012
$update_order->Gateway->subscribe($update_order, false);
1013
1014
//update membership
1015
$sqlQuery = "UPDATE $wpdb->pmpro_memberships_users
1016
- SET billing_amount = '" . esc_sql($update['billing_amount']) . "',
1017
- cycle_number = '" . esc_sql($update['cycle_number']) . "',
1018
- cycle_period = '" . esc_sql($update['cycle_period']) . "'
1019
WHERE user_id = '" . esc_sql($user_id) . "'
1020
AND membership_id = '" . esc_sql($last_order->membership_id) . "'
1021
AND status = 'active'
@@ -1030,13 +1030,13 @@
1030
//remove update from list
1031
unset($user_updates[$key]);
1032
}
1033
- elseif($update['when'] == 'date')
1034
{
1035
//this is an on date update for the future, update the next on date update
1036
if(!empty($next_on_date_update))
1037
- $next_on_date_update = min($next_on_date_update, $update['date_year'] . "-" . $update['date_month'] . "-" . $update['date_day']);
1038
else
1039
- $next_on_date_update = $update['date_year'] . "-" . $update['date_month'] . "-" . $update['date_day'];
1040
}
1041
}
1042
}
@@ -1278,7 +1278,6 @@
1278
$email = $order->Email;
1279
else
1280
$email = "";
1281
- $email = $order->Email;
1282
if(empty($email) && !empty($user->ID) && !empty($user->user_email))
1283
{
1284
$email = $user->user_email;
@@ -1479,13 +1478,13 @@
1479
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
1480
1481
//convert to a profile start date
1482
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
1483
1484
//filter the start date
1485
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
1486
1487
//convert back to days
1488
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d"), current_time("timestamp")) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
1489
1490
//for free trials, just push the start date of the subscription back
1491
if(!empty($order->TrialBillingCycles) && $order->TrialAmount == 0)
534
<option value="12" <?php if($ExpirationMonth == "12") { ?>selected="selected"<?php } ?>>12</option>
535
</select>/<select id="ExpirationYear" class=" <?php echo pmpro_getClassForField("ExpirationYear");?>">
536
<?php
537
+ for($i = date_i18n("Y"); $i < date_i18n("Y") + 10; $i++)
538
{
539
?>
540
<option value="<?php echo $i?>" <?php if($ExpirationYear == $i) { ?>selected="selected"<?php } ?>><?php echo $i?></option>
586
global $wpdb, $current_user, $pmpro_currency_symbol;
587
588
$cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
589
+ $current_year = date_i18n("Y");
590
+ $current_month = date_i18n("m");
591
592
//make sure the current user has privileges
593
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
672
{
673
?>
674
<option value="<?php echo str_pad($i, 2, "0", STR_PAD_LEFT);?>" <?php if(!empty($update['date_month']) && $update['date_month'] == $i) { ?>selected="selected"<?php } ?>>
675
+ <?php echo date_i18n("M", strtotime($i . "/1/" . $current_year));?>
676
</option>
677
<?php
678
}
856
$update_order->membership_name = $user_level->name;
857
$update_order->InitialPayment = 0;
858
$update_order->PaymentAmount = $update['billing_amount'];
859
+ $update_order->ProfileStartDate = date_i18n("Y-m-d", $end_timestamp);
860
$update_order->BillingPeriod = $update['cycle_period'];
861
$update_order->BillingFrequency = $update['cycle_number'];
862
940
WHERE meta_key = 'pmpro_stripe_next_on_date_update'
941
AND meta_value IS NOT NULL
942
AND meta_value <> ''
943
+ AND meta_value < '" . date_i18n("Y-m-d", strtotime("+1 day", current_time('timestamp'))) . "'";
944
$updates = $wpdb->get_results($sqlQuery);
945
946
if(!empty($updates))
968
//loop through updates looking for updates happening today or earlier
969
if(!empty($user_updates))
970
{
971
+ foreach($user_updates as $key => $ud)
972
{
973
+ if($ud['when'] == 'date' &&
974
+ $ud['date_year'] . "-" . $ud['date_month'] . "-" . $ud['date_day'] <= date_i18n("Y-m-d", current_time('timestamp') )
975
)
976
{
977
//get level for user
994
}
995
996
//if we didn't get an end date, let's set one one cycle out
997
+ $end_timestamp = strtotime("+" . $ud['cycle_number'] . " " . $ud['cycle_period'], current_time( 'timestamp' ));
998
999
//build order object
1000
$update_order = new MemberOrder();
1003
$update_order->membership_id = $user_level->id;
1004
$update_order->membership_name = $user_level->name;
1005
$update_order->InitialPayment = 0;
1006
+ $update_order->PaymentAmount = $ud['billing_amount'];
1007
+ $update_order->ProfileStartDate = date_i18n("Y-m-d", $end_timestamp);
1008
+ $update_order->BillingPeriod = $ud['cycle_period'];
1009
+ $update_order->BillingFrequency = $ud['cycle_number'];
1010
1011
//update subscription
1012
$update_order->Gateway->subscribe($update_order, false);
1013
1014
//update membership
1015
$sqlQuery = "UPDATE $wpdb->pmpro_memberships_users
1016
+ SET billing_amount = '" . esc_sql($ud['billing_amount']) . "',
1017
+ cycle_number = '" . esc_sql($ud['cycle_number']) . "',
1018
+ cycle_period = '" . esc_sql($ud['cycle_period']) . "'
1019
WHERE user_id = '" . esc_sql($user_id) . "'
1020
AND membership_id = '" . esc_sql($last_order->membership_id) . "'
1021
AND status = 'active'
1030
//remove update from list
1031
unset($user_updates[$key]);
1032
}
1033
+ elseif($ud['when'] == 'date')
1034
{
1035
//this is an on date update for the future, update the next on date update
1036
if(!empty($next_on_date_update))
1037
+ $next_on_date_update = min($next_on_date_update, $ud['date_year'] . "-" . $ud['date_month'] . "-" . $ud['date_day']);
1038
else
1039
+ $next_on_date_update = $ud['date_year'] . "-" . $ud['date_month'] . "-" . $ud['date_day'];
1040
}
1041
}
1042
}
1278
$email = $order->Email;
1279
else
1280
$email = "";
1281
if(empty($email) && !empty($user->ID) && !empty($user->user_email))
1282
{
1283
$email = $user->user_email;
1478
$trial_period_days = $order->BillingFrequency * 30; //assume monthly
1479
1480
//convert to a profile start date
1481
+ $order->ProfileStartDate = date_i18n("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
1482
1483
//filter the start date
1484
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
1485
1486
//convert back to days
1487
+ $trial_period_days = ceil(abs(strtotime(date_i18n("Y-m-d"), current_time("timestamp")) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
1488
1489
//for free trials, just push the start date of the subscription back
1490
if(!empty($order->TrialBillingCycles) && $order->TrialAmount == 0)
classes/gateways/class.pmprogateway_twocheckout.php CHANGED
@@ -399,4 +399,4 @@
399
400
return $order;
401
}
402
- }
399
400
return $order;
401
}
402
+ }
includes/addons.php CHANGED
@@ -235,4 +235,4 @@ function pmpro_reset_update_plugins_cache($old_value, $value)
235
{
236
delete_option('pmpro_addons_timestamp');
237
delete_site_transient('update_themes');
238
- }
235
{
236
delete_option('pmpro_addons_timestamp');
237
delete_site_transient('update_themes');
238
+ }
includes/cleanup.php CHANGED
@@ -37,4 +37,4 @@ function pmpro_delete_post($post_id = NULL)
37
$sqlQuery = "DELETE FROM $wpdb->pmpro_memberships_pages WHERE page_id = '" . $post_id . "'";
38
$wpdb->query($sqlQuery);
39
}
40
- add_action('delete_post', 'pmpro_delete_post');
37
$sqlQuery = "DELETE FROM $wpdb->pmpro_memberships_pages WHERE page_id = '" . $post_id . "'";
38
$wpdb->query($sqlQuery);
39
}
40
+ add_action('delete_post', 'pmpro_delete_post');
includes/content.php CHANGED
@@ -127,7 +127,7 @@ function pmpro_has_membership_access($post_id = NULL, $user_id = NULL, $return_m
127
//general filter for all posts
128
$hasaccess = apply_filters("pmpro_has_membership_access_filter", $hasaccess, $mypost, $myuser, $post_membership_levels);
129
//filter for this post type
130
- if(has_filter("pmpro_has_membership_access_filter_" . $mypost->post_type))
131
$hasaccess = apply_filters("pmpro_has_membership_access_filter_" . $mypost->post_type, $hasaccess, $mypost, $myuser, $post_membership_levels);
132
133
//return
@@ -151,7 +151,8 @@ function pmpro_search_filter($query)
151
}
152
153
//hide member pages from non-members (make sure they aren't hidden from members)
154
- if(!$query->is_admin &&
155
!$query->is_singular &&
156
empty($query->query['post_parent']) &&
157
(
127
//general filter for all posts
128
$hasaccess = apply_filters("pmpro_has_membership_access_filter", $hasaccess, $mypost, $myuser, $post_membership_levels);
129
//filter for this post type
130
+ if( isset($mypost->post_type) && has_filter("pmpro_has_membership_access_filter_" . $mypost->post_type))
131
$hasaccess = apply_filters("pmpro_has_membership_access_filter_" . $mypost->post_type, $hasaccess, $mypost, $myuser, $post_membership_levels);
132
133
//return
151
}
152
153
//hide member pages from non-members (make sure they aren't hidden from members)
154
+ if(is_user_logged_in() &&
155
+ !$query->is_admin &&
156
!$query->is_singular &&
157
empty($query->query['post_parent']) &&
158
(
includes/countries.php CHANGED
@@ -256,4 +256,4 @@
256
257
asort($pmpro_countries);
258
259
- $pmpro_countries = apply_filters("pmpro_countries", $pmpro_countries);
256
257
asort($pmpro_countries);
258
259
+ $pmpro_countries = apply_filters("pmpro_countries", $pmpro_countries);
includes/email.php CHANGED
@@ -128,4 +128,4 @@ function pmpro_wp_mail_content_type( $content_type ) {
128
}
129
return $content_type;
130
}
131
- add_filter('wp_mail_content_type', 'pmpro_wp_mail_content_type');
128
}
129
return $content_type;
130
}
131
+ add_filter('wp_mail_content_type', 'pmpro_wp_mail_content_type');
includes/filters.php CHANGED
@@ -167,4 +167,4 @@ add_filter('pmpro_confirmation_message', 'pmpro_pmpro_confirmation_message');
167
function pmpro_pmpro_level_description($description) {
168
return apply_filters('the_content', $description);
169
}
170
- add_filter('pmpro_level_description', 'pmpro_pmpro_level_description');
167
function pmpro_pmpro_level_description($description) {
168
return apply_filters('the_content', $description);
169
}
170
+ add_filter('pmpro_level_description', 'pmpro_pmpro_level_description');
includes/functions.php CHANGED
@@ -543,6 +543,7 @@ function pmpro_getLevelExpiration(&$level)
543
$expiration_text = "";
544
545
$expiration_text = apply_filters("pmpro_levels_expiration_text", $expiration_text, $level);
546
return $expiration_text;
547
}
548
@@ -577,6 +578,7 @@ function pmpro_getLevelsExpiration(&$levels)
577
* Filter the levels expiration text. Note the s in levels. Similar to pmpro_levels_expiration_text
578
*/
579
$expiration_text = apply_filters("pmpro_levels_expiration_text", $expiration_text, $levels);
580
return $expiration_text;
581
}
582
@@ -633,7 +635,7 @@ function pmpro_next_payment($user_id = NULL, $order_status = "success", $format
633
if(!empty($order) && !empty($order->id) && !empty($level) && !empty($level->id) && !empty($level->cycle_number))
634
{
635
//last payment date
636
- $lastdate = date("Y-m-d", $order->timestamp);
637
638
//next payment date
639
$nextdate = $wpdb->get_var("SELECT UNIX_TIMESTAMP('" . $lastdate . "' + INTERVAL " . $level->cycle_number . " " . $level->cycle_period . ")");
@@ -664,9 +666,9 @@ function pmpro_next_payment($user_id = NULL, $order_status = "success", $format
664
elseif($format == "timestamp")
665
return $r;
666
elseif($format == "date_format")
667
- return date(get_option('date_format'), $r);
668
else
669
- return date($format, $r); //assume a PHP date format
670
}
671
672
if(!function_exists("last4"))
@@ -981,6 +983,24 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL, $old_level_status
981
//get all active membershipships for this user
982
$old_levels = pmpro_getMembershipLevelsForUser($user_id);
983
984
//deactivate old memberships based on the old_level_status passed in (updates pmpro_memberships_users table)
985
$pmpro_deactivate_old_levels = true;
986
/**
@@ -1021,22 +1041,6 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL, $old_level_status
1021
}
1022
}
1023
1024
- //get level id
1025
- if(is_array($level))
1026
- $level_id = $level['membership_id']; //custom level
1027
- else
1028
- $level_id = $level; //just id
1029
-
1030
- /**
1031
- * Action to run before the membership level changes.
1032
- *
1033
- * @param int $level_id ID of the level changed to.
1034
- * @param int $user_id ID of the user changed.
1035
- * @param array $old_levels array of prior levels the user belonged to.
1036
- * $param int $cancel_level ID of the level being cancelled if specified
1037
- */
1038
- do_action("pmpro_before_change_membership_level", $level_id, $user_id, $old_levels, $cancel_level);
1039
-
1040
//should we cancel their gateway subscriptions?
1041
if(!empty($cancel_level)) {
1042
$pmpro_cancel_previous_subscriptions = true; //don't filter cause we're doing just the one
@@ -1618,22 +1622,22 @@ function pmpro_checkDiscountCode($code, $level_id = NULL, $return_errors = false
1618
if(!$error)
1619
{
1620
//fix the date timestamps
1621
- $dbcode->starts = strtotime(date("m/d/Y", $dbcode->starts));
1622
- $dbcode->expires = strtotime(date("m/d/Y", $dbcode->expires));
1623
1624
//today
1625
- $today = strtotime(date("m/d/Y 00:00:00", current_time("timestamp")));
1626
1627
//has this code started yet?
1628
if(!empty($dbcode->starts) && $dbcode->starts > $today)
1629
- $error = sprintf(__("This discount code goes into effect on %s.", "pmpro"), date(get_option('date_format'), $dbcode->st