Paid Memberships Pro - Version 1.7.15

Version Description

  • SECURITY FIX: The /services/getfile.php script has been disabled by default. You must set the PMPRO_GETFILE_ENABLED constant to true or 1 to allow the script to run. Additionally, the script will strip ../ and /. type strings out of the URI when looking for files to get and will not read any files using the extensions set via the pmpro_getfile_extension_blacklist filter. By default inc, php, php3, php4, php5, phps, and phtml file types are not allowed. (Thanks, Kacper Szurek)
  • BUG: Fixed issue with Stripe integration where existing members checking out for new recurring subscriptions would receive extra charges. Now deleting the old Stripe subscription and any related open invoices and creating a new subscription instead of just updating the old subscription. (Thanks, Antonv and Thomas Sjolshagen)
  • BUG: Fixed issue with Braintree integration where the billing address associated with a credit card was not being updated via the update billing page. (Thanks, Keith Abramo)
  • BUG: Fixed issue where pmpro_next_payment() would return a 0 timestamp instead of false when there is no previous order. (Thanks, Thomas Sjolshagen)
  • ENHANCEMENT: Added pmpro_formatPrice() and pmpro_getCurrencyPosition() functions. Now using them to render prices with formatting. You can use the pmpro_format_price filter or pmpro_currecies filter to adjust the formatting of prices to support currency symbols after the price or to use commas instead of periods for separators.
  • ENAHNCEMENT: Added getSubscriptionStatus() to Authorize.net gateway class. Also fixed up some of the logic around checking the gateway environment.
  • BUG: Now urlencoding the API Username and Password sent through the PayPal APIs in case your values have + or other special characters in them. (Thanks, mrschmiddy)
  • BUG: Now showing cycle number in the Fee column of the members list. E.g. a level that is $10 every 3 months will now show up as $10.00 + $10.00/3 Months.
  • BUG: Fixed bug where user first_name and last_name were being overwritten by PayPal values when using PayPal Standard.
  • ENHANCEMENT: Added PMPRO_CRON_LIMIT constant, which can be used to limit the number of records processed by each scheduled cron job. This can for example, keep your server from going over PHP time limits or email limits. Use define('PMPRO_CRON_LIMIT', 100); to set the limit to 100.
  • BUG: Discount code AJAX calls now going through admin-ajax.php, fixing issues where the Themed Profiles module of Theme My Login would block those calls. (Thanks, Tony)
  • ENHANCEMENT: Removed the "CardType" field at checkout and now using the jquery.creditCardValidator script to determine the card type on form submit.
  • BUG: No longer setting $order->subtotal and invoice total to the billing amount (vs the initial price) for recurring payments with Cybersource, PayPal Standard, PayPal Express or Twocheckout. (Thanks, Joce Nunes)
  • ENHANCEMENT: The search filter will no longer filter out a post that is in a category blocked by one membership level if the user also has access to that content through another category.
  • BUG/ENHANCEMENT: Running email body through wpautop if it doesn't look like HTML.
  • ENHANCEMENT: Added pmpro_getfile_before_error hook in getfile.php.
  • ENHANCEMENT: Added pmpro_ipn_check_receiver_email filter if you want to change how the email is checked in the IPN log.
  • BUG: Fixed bug where reports would show duplicate month labels on the last day of the month.
  • BUG: Fixed some issues with logging in at checkout, especially when using FORCE_SSL_ADMIN. (Thanks, Wimans)
  • ENHANCEMENT: Added "pending" as a default status for orders available on the edit order page in the dashboard.
Download this release

Release Info

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

Code changes from version 1.7.14 to 1.7.15

Files changed (45) hide show
  1. adminpages/discountcodes.php +31 -3
  2. adminpages/functions.php +3 -6
  3. adminpages/membershiplevels.php +33 -6
  4. adminpages/memberslist.php +3 -3
  5. adminpages/orders.php +5 -5
  6. adminpages/paymentsettings.php +2 -0
  7. adminpages/reports/memberships.php +17 -8
  8. adminpages/reports/sales.php +23 -14
  9. classes/class.pmproemail.php +9 -9
  10. classes/gateways/class.pmprogateway_authorizenet.php +84 -7
  11. classes/gateways/class.pmprogateway_braintree.php +63 -19
  12. classes/gateways/class.pmprogateway_cybersource.php +1 -2
  13. classes/gateways/class.pmprogateway_payflowpro.php +1 -1
  14. classes/gateways/class.pmprogateway_paypal.php +1 -1
  15. classes/gateways/class.pmprogateway_paypalexpress.php +6 -8
  16. classes/gateways/class.pmprogateway_paypalstandard.php +2 -3
  17. classes/gateways/class.pmprogateway_stripe.php +43 -22
  18. classes/gateways/class.pmprogateway_twocheckout.php +1 -2
  19. includes/content.php +39 -7
  20. includes/currencies.php +25 -5
  21. includes/email.php +10 -1
  22. includes/functions.php +70 -17
  23. includes/init.php +6 -10
  24. includes/login.php +1 -1
  25. includes/profile.php +3 -3
  26. js/jquery.creditCardValidator.js +181 -0
  27. languages/pmpro-it_IT.mo +0 -0
  28. languages/pmpro-it_IT.po +301 -173
  29. languages/pmpro.mo +0 -0
  30. languages/pmpro.po +324 -291
  31. languages/pmpro.pot +324 -291
  32. pages/account.php +7 -7
  33. pages/billing.php +4 -4
  34. pages/checkout.php +31 -15
  35. pages/confirmation.php +2 -2
  36. pages/invoice.php +8 -8
  37. pages/levels.php +1 -1
  38. paid-memberships-pro.php +2 -2
  39. preheaders/billing.php +10 -6
  40. preheaders/checkout.php +16 -6
  41. readme.txt +34 -1
  42. scheduled/crons.php +19 -7
  43. services/getfile.php +57 -5
  44. services/ipnhandler.php +25 -6
  45. services/stripe-webhook.php +10 -7
adminpages/discountcodes.php CHANGED
@@ -428,7 +428,18 @@
428
<tbody>
429
<tr>
430
<th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
431
- <td><?php echo $pmpro_currency_symbol?><input name="initial_payment[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" /> <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
432
</tr>
433
434
<tr>
@@ -439,7 +450,16 @@
439
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
440
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
441
<td>
442
- <?php echo $pmpro_currency_symbol?><input name="billing_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" /> <small>per</small>
443
<input name="cycle_number[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
444
<select name="cycle_period[]" onchange="updateCyclePeriod();">
445
<?php
@@ -471,7 +491,15 @@
471
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
472
<th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
473
<td>
474
- <?php echo $pmpro_currency_symbol?><input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
475
<small><?php _e('for the first', 'pmpro');?></small>
476
<input name="trial_limit[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
477
<small><?php _e('subscription payments', 'pmpro');?>.</small>
428
<tbody>
429
<tr>
430
<th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
431
+ <td>
432
+ <?php
433
+ if(pmpro_getCurrencyPosition() == "left")
434
+ echo $pmpro_currency_symbol;
435
+ ?>
436
+ <input name="initial_payment[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" />
437
+ <?php
438
+ if(pmpro_getCurrencyPosition() == "right")
439
+ echo $pmpro_currency_symbol;
440
+ ?>
441
+ <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small>
442
+ </td>
443
</tr>
444
445
<tr>
450
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
451
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
452
<td>
453
+ <?php
454
+ if(pmpro_getCurrencyPosition() == "left")
455
+ echo $pmpro_currency_symbol;
456
+ ?>
457
+ <input name="billing_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" />
458
+ <?php
459
+ if(pmpro_getCurrencyPosition() == "right")
460
+ echo $pmpro_currency_symbol;
461
+ ?>
462
+ <small>per</small>
463
<input name="cycle_number[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
464
<select name="cycle_period[]" onchange="updateCyclePeriod();">
465
<?php
491
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
492
<th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
493
<td>
494
+ <?php
495
+ if(pmpro_getCurrencyPosition() == "left")
496
+ echo $pmpro_currency_symbol;
497
+ ?>
498
+ <input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
499
+ <?php
500
+ if(pmpro_getCurrencyPosition() == "right")
501
+ echo $pmpro_currency_symbol;
502
+ ?>
503
<small><?php _e('for the first', 'pmpro');?></small>
504
<input name="trial_limit[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
505
<small><?php _e('subscription payments', 'pmpro');?>.</small>
adminpages/functions.php CHANGED
@@ -39,12 +39,10 @@ function pmpro_checkLevelForStripeCompatibility($level = NULL)
39
{
40
/*
41
Stripe currently does not support:
42
- * Trial Amounts > 0.
43
- * Daily billing periods.
44
* Billing Limits.
45
*/
46
- if($level->trial_amount > 0 ||
47
- ($level->cycle_number > 0 && $level->cycle_period == "Day") ||
48
$level->billing_limit > 0)
49
{
50
return false;
@@ -97,8 +95,7 @@ function pmpro_checkLevelForPayflowCompatibility($level = NULL)
97
*/
98
99
if($level->trial_amount > 0 ||
100
- $level->cycle_number > 1 ||
101
- ($level->cycle_number == 1 && $level->cycle_period == "Day"))
102
{
103
return false;
104
}
39
{
40
/*
41
Stripe currently does not support:
42
+ * Trial Amounts > 0.
43
* Billing Limits.
44
*/
45
+ if($level->trial_amount > 0 ||
46
$level->billing_limit > 0)
47
{
48
return false;
95
*/
96
97
if($level->trial_amount > 0 ||
98
+ $level->cycle_number > 1)
99
{
100
return false;
101
}
adminpages/membershiplevels.php CHANGED
@@ -337,7 +337,17 @@
337
<tbody>
338
<tr>
339
<th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
340
- <td><?php echo $pmpro_currency_symbol?><input name="initial_payment" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" /> <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
341
</tr>
342
343
<tr>
@@ -348,7 +358,16 @@
348
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
349
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
350
<td>
351
- <?php echo $pmpro_currency_symbol?><input name="billing_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" /> <small><?php _e('per', 'pmpro');?></small>
352
<input id="cycle_number" name="cycle_number" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
353
<select id="cycle_period" name="cycle_period">
354
<?php
@@ -405,7 +424,15 @@
405
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
406
<th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
407
<td>
408
- <?php echo $pmpro_currency_symbol?><input name="trial_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
409
<small><?php _e('for the first', 'pmpro');?></small>
410
<input name="trial_limit" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
411
<small><?php _e('subscription payments', 'pmpro');?>.</small>
@@ -541,14 +568,14 @@
541
<?php if(pmpro_isLevelFree($level)) { ?>
542
<?php _e('FREE', 'pmpro');?>
543
<?php } else { ?>
544
- <?php echo $pmpro_currency_symbol?><?php echo $level->initial_payment?>
545
<?php } ?>
546
</td>
547
<td>
548
<?php if(!pmpro_isLevelRecurring($level)) { ?>
549
--
550
<?php } else { ?>
551
- <?php echo $pmpro_currency_symbol?><?php echo $level->billing_amount?> <?php _e('every', 'pmpro');?> <?php echo $level->cycle_number.' '.pmpro_translate_billing_period($level->cycle_period,$level->cycle_number)?>
552
553
<?php if($level->billing_limit) { ?>(<?php _e('for', 'pmpro');?> <?php echo $level->billing_limit?> <?php echo sornot($level->cycle_period,$level->billing_limit)?>)<?php } ?>
554
@@ -558,7 +585,7 @@
558
<?php if(!pmpro_isLevelTrial($level)) { ?>
559
--
560
<?php } else { ?>
561
- <?php echo $pmpro_currency_symbol?><?php echo $level->trial_amount?> <?php _e('for', 'pmpro');?> <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?>
562
<?php } ?>
563
</td>
564
<td>
337
<tbody>
338
<tr>
339
<th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
340
+ <td>
341
+ <?php
342
+ if(pmpro_getCurrencyPosition() == "left")
343
+ echo $pmpro_currency_symbol;
344
+ ?>
345
+ <input name="initial_payment" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" />
346
+ <?php
347
+ if(pmpro_getCurrencyPosition() == "right")
348
+ echo $pmpro_currency_symbol;
349
+ ?>
350
+ <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
351
</tr>
352
353
<tr>
358
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
359
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
360
<td>
361
+ <?php
362
+ if(pmpro_getCurrencyPosition() == "left")
363
+ echo $pmpro_currency_symbol;
364
+ ?>
365
+ <input name="billing_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" />
366
+ <?php
367
+ if(pmpro_getCurrencyPosition() == "right")
368
+ echo $pmpro_currency_symbol;
369
+ ?>
370
+ <small><?php _e('per', 'pmpro');?></small>
371
<input id="cycle_number" name="cycle_number" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
372
<select id="cycle_period" name="cycle_period">
373
<?php
424
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
425
<th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
426
<td>
427
+ <?php
428
+ if(pmpro_getCurrencyPosition() == "left")
429
+ echo $pmpro_currency_symbol;
430
+ ?>
431
+ <input name="trial_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
432
+ <?php
433
+ if(pmpro_getCurrencyPosition() == "right")
434
+ echo $pmpro_currency_symbol;
435
+ ?>
436
<small><?php _e('for the first', 'pmpro');?></small>
437
<input name="trial_limit" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
438
<small><?php _e('subscription payments', 'pmpro');?>.</small>
568
<?php if(pmpro_isLevelFree($level)) { ?>
569
<?php _e('FREE', 'pmpro');?>
570
<?php } else { ?>
571
+ <?php echo pmpro_formatPrice($level->initial_payment);?>
572
<?php } ?>
573
</td>
574
<td>
575
<?php if(!pmpro_isLevelRecurring($level)) { ?>
576
--
577
<?php } else { ?>
578
+ <?php echo pmpro_formatPrice($level->billing_amount);?> <?php _e('every', 'pmpro');?> <?php echo $level->cycle_number.' '.pmpro_translate_billing_period($level->cycle_period,$level->cycle_number)?>
579
580
<?php if($level->billing_limit) { ?>(<?php _e('for', 'pmpro');?> <?php echo $level->billing_limit?> <?php echo sornot($level->cycle_period,$level->billing_limit)?>)<?php } ?>
581
585
<?php if(!pmpro_isLevelTrial($level)) { ?>
586
--
587
<?php } else { ?>
588
+ <?php echo pmpro_formatPrice($level->trial_amount);?> <?php _e('for', 'pmpro');?> <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?>
589
<?php } ?>
590
</td>
591
<td>
adminpages/memberslist.php CHANGED
@@ -6,7 +6,7 @@
6
}
7
8
//vars
9
- global $wpdb, $pmpro_currency_symbol;
10
if(isset($_REQUEST['s']))
11
$s = $_REQUEST['s'];
12
else
@@ -193,11 +193,11 @@
193
<td><?php echo $auser->membership?></td>
194
<td>
195
<?php if((float)$auser->initial_payment > 0) { ?>
196
- <?php echo $pmpro_currency_symbol; ?><?php echo $auser->initial_payment?>
197
<?php } ?>
198
<?php if((float)$auser->initial_payment > 0 && (float)$auser->billing_amount > 0) { ?>+<br /><?php } ?>
199
<?php if((float)$auser->billing_amount > 0) { ?>
200
- <?php echo $pmpro_currency_symbol; ?><?php echo $auser->billing_amount?>/<?php echo $auser->cycle_period?>
201
<?php } ?>
202
<?php if((float)$auser->initial_payment <= 0 && (float)$auser->billing_amount <= 0) { ?>
203
-
6
}
7
8
//vars
9
+ global $wpdb;
10
if(isset($_REQUEST['s']))
11
$s = $_REQUEST['s'];
12
else
193
<td><?php echo $auser->membership?></td>
194
<td>
195
<?php if((float)$auser->initial_payment > 0) { ?>
196
+ <?php echo pmpro_formatPrice($auser->initial_payment);?>
197
<?php } ?>
198
<?php if((float)$auser->initial_payment > 0 && (float)$auser->billing_amount > 0) { ?>+<br /><?php } ?>
199
<?php if((float)$auser->billing_amount > 0) { ?>
200
+ <?php echo pmpro_formatPrice($auser->billing_amount);?>/<?php if($auser->cycle_number > 1) { echo $auser->cycle_number . " " . $auser->cycle_period . "s"; } else { echo $auser->cycle_period; } ?>
201
<?php } ?>
202
<?php if((float)$auser->initial_payment <= 0 && (float)$auser->billing_amount <= 0) { ?>
203
-
adminpages/orders.php CHANGED
@@ -6,7 +6,7 @@
6
}
7
8
//vars
9
- global $wpdb, $pmpro_currency_symbol;
10
if(isset($_REQUEST['s']))
11
$s = $_REQUEST['s'];
12
else
@@ -425,7 +425,7 @@
425
<?php if(in_array("status", $read_only_fields) && $order_id > 0) { echo $order->status; } else { ?>
426
<?php
427
$statuses = array();
428
- $default_statuses = array("", "success", "cancelled", "review", "token", "refunded");
429
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
430
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
431
asort($statuses);
@@ -613,7 +613,7 @@
613
614
<select id="start-month" name="start-month">
615
<?php for($i = 1; $i < 13; $i++) { ?>
616
- <option value="<?php echo $i;?>" <?php selected($start_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
617
<?php } ?>
618
</select>
619
@@ -625,7 +625,7 @@
625
626
<select id="end-month" name="end-month">
627
<?php for($i = 1; $i < 13; $i++) { ?>
628
- <option value="<?php echo $i;?>" <?php selected($end_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
629
<?php } ?>
630
</select>
631
@@ -935,7 +935,7 @@
935
</td>
936
<?php do_action("pmpro_orders_extra_cols_body", $order);?>
937
<td><?php echo $order->membership_id;?></td>
938
- <td><?php echo $pmpro_currency_symbol . $order->total;?></td>
939
<td>
940
<?php if(!empty($order->payment_type)) echo $order->payment_type . "<br />";?>
941
<?php if(!empty($order->accountnumber)) { ?>
6
}
7
8
//vars
9
+ global $wpdb;
10
if(isset($_REQUEST['s']))
11
$s = $_REQUEST['s'];
12
else
425
<?php if(in_array("status", $read_only_fields) && $order_id > 0) { echo $order->status; } else { ?>
426
<?php
427
$statuses = array();
428
+ $default_statuses = array("", "success", "cancelled", "review", "token", "refunded", "pending");
429
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
430
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
431
asort($statuses);
613
614
<select id="start-month" name="start-month">
615
<?php for($i = 1; $i < 13; $i++) { ?>
616
+ <option value="<?php echo $i;?>" <?php selected($start_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
617
<?php } ?>
618
</select>
619
625
626
<select id="end-month" name="end-month">
627
<?php for($i = 1; $i < 13; $i++) { ?>
628
+ <option value="<?php echo $i;?>" <?php selected($end_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i,2));?></option>
629
<?php } ?>
630
</select>
631
935
</td>
936
<?php do_action("pmpro_orders_extra_cols_body", $order);?>
937
<td><?php echo $order->membership_id;?></td>
938
+ <td><?php echo pmpro_formatPrice($order->total);?></td>
939
<td>
940
<?php if(!empty($order->payment_type)) echo $order->payment_type . "<br />";?>
941
<?php if(!empty($order->accountnumber)) { ?>
adminpages/paymentsettings.php CHANGED
@@ -391,6 +391,8 @@
391
global $pmpro_currencies;
392
foreach($pmpro_currencies as $ccode => $cdescription)
393
{
394
?>
395
<option value="<?php echo $ccode?>" <?php if($currency == $ccode) { ?>selected="selected"<?php } ?>><?php echo $cdescription?></option>
396
<?php
391
global $pmpro_currencies;
392
foreach($pmpro_currencies as $ccode => $cdescription)
393
{
394
+ if(is_array($cdescription))
395
+ $cdescription = $cdescription['name'];
396
?>
397
<option value="<?php echo $ccode?>" <?php if($currency == $ccode) { ?>selected="selected"<?php } ?>><?php echo $cdescription?></option>
398
<?php
adminpages/reports/memberships.php CHANGED
@@ -86,7 +86,7 @@ function pmpro_report_memberships_widget() {
86
<label class="section-label"><?php _e('Other Stats', 'pmpro');?>:</label>
87
<div style="width: 33%; float: left;">
88
<label><?php _e('Monthly Recurring Revenue (MRR)', 'pmpro');?></label>
89
- <em><?php echo $pmpro_currency_symbol . $pmpro_mrr = number_format(pmpro_getMRR( 'all time' ), 2); ?></em>
90
</div>
91
<div style="width: 33%; float: left;">
92
<label><?php _e('Cancellation Rate', 'pmpro');?></label>
@@ -94,7 +94,7 @@ function pmpro_report_memberships_widget() {
94
</div>
95
<div style="width: 33%; float: left;">
96
<label><?php _e('Lifetime Value (LTV)', 'pmpro');?></label>
97
- <em><?php echo $pmpro_currency_symbol . number_format(pmpro_getLTV('all time' ), 2); ?></em>
98
</div>
99
<div class="clear"></div>
100
</span>
@@ -189,7 +189,7 @@ function pmpro_report_memberships_page()
189
$cols = array();
190
if($period == "daily")
191
{
192
- $lastday = date("t", $startdate);
193
194
for($i = 1; $i <= $lastday; $i++)
195
{
@@ -304,7 +304,7 @@ function pmpro_report_memberships_page()
304
<span id="for"><?php _ex('for', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?></span>
305
<select id="month" name="month">
306
<?php for($i = 1; $i < 13; $i++) { ?>
307
- <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
308
<?php } ?>
309
</select>
310
<select id="year" name="year">
@@ -376,14 +376,14 @@ function pmpro_report_memberships_page()
376
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
377
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
378
<?php foreach($dates as $key => $value) { ?>
379
- ['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$value->date)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo $value->signups; ?>, <?php echo $value->cancellations; ?>],
380
<?php } ?>
381
<?php endif; ?>
382
383
<?php if ( $type === "mrr_ltv" ) : // Signups vs. cancellations ?>
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)); 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
]);
@@ -397,9 +397,18 @@ function pmpro_report_memberships_page()
397
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
398
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
399
<?php elseif ( $type === "mrr_ltv" ) : // MRR & LTV ?>
400
- var formatter = new google.visualization.NumberFormat({prefix: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
401
formatter.format(data, 2);
402
- var formatter = new google.visualization.NumberFormat({prefix: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
403
formatter.format(data, 1);
404
405
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
86
<label class="section-label"><?php _e('Other Stats', 'pmpro');?>:</label>
87
<div style="width: 33%; float: left;">
88
<label><?php _e('Monthly Recurring Revenue (MRR)', 'pmpro');?></label>
89
+ <em><?php echo pmpro_formatPrice(pmpro_getMRR( 'all time' )); ?></em>
90
</div>
91
<div style="width: 33%; float: left;">
92
<label><?php _e('Cancellation Rate', 'pmpro');?></label>
94
</div>
95
<div style="width: 33%; float: left;">
96
<label><?php _e('Lifetime Value (LTV)', 'pmpro');?></label>
97
+ <em><?php echo pmpro_formatPrice(pmpro_getLTV('all time')); ?></em>
98
</div>
99
<div class="clear"></div>
100
</span>
189
$cols = array();
190
if($period == "daily")
191
{
192
+ $lastday = date("t", strtotime($startdate, current_time("timestamp")));
193
194
for($i = 1; $i <= $lastday; $i++)
195
{
304
<span id="for"><?php _ex('for', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?></span>
305
<select id="month" name="month">
306
<?php for($i = 1; $i < 13; $i++) { ?>
307
+ <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
308
<?php } ?>
309
</select>
310
<select id="year" name="year">
376
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
377
['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
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" ) : // Signups vs. cancellations ?>
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
]);
397
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
398
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
399
<?php elseif ( $type === "mrr_ltv" ) : // MRR & LTV ?>
400
+
401
+ <?php
402
+ //prefix or suffix?
403
+ if(pmpro_getCurrencyPosition() == "right")
404
+ $position = "suffix";
405
+ else
406
+ $position = "prefix";
407
+ ?>
408
+
409
+ var formatter = new google.visualization.NumberFormat({<?php echo $position;?>: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
410
formatter.format(data, 2);
411
+ var formatter = new google.visualization.NumberFormat({<?php echo $position;?>: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
412
formatter.format(data, 1);
413
414
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
adminpages/reports/sales.php CHANGED
@@ -32,7 +32,7 @@ add_action("init", "pmpro_report_sales_init");
32
//widget
33
function pmpro_report_sales_widget()
34
{
35
- global $wpdb, $pmpro_currency_symbol;
36
?>
37
<style>
38
#pmpro_report_sales div {text-align: center;}
@@ -42,22 +42,22 @@ function pmpro_report_sales_widget()
42
<div style="width: 25%; float: left;">
43
<em><?php echo pmpro_getSales("all time");?></em>
44
<label>All Time</label>
45
- <em><?php echo $pmpro_currency_symbol . number_format(pmpro_getRevenue("all time"), 2);?></em>
46
</div>
47
<div style="width: 25%; float: left;">
48
<em><?php echo pmpro_getSales("this year");?></em>
49
<label>This Year</label>
50
- <em><?php echo $pmpro_currency_symbol . number_format(pmpro_getRevenue("this year"), 2);?></em>
51
</div>
52
<div style="width: 25%; float: left;">
53
<em><?php echo pmpro_getSales("this month");?></em>
54
<label>This Month</label>
55
- <em><?php echo $pmpro_currency_symbol . number_format(pmpro_getRevenue("this month"), 2);?></em>
56
</div>
57
<div style="width: 25%; float: left;">
58
<em><?php echo pmpro_getSales("today");?></em>
59
<label>Today</label>
60
- <em><?php echo $pmpro_currency_symbol . number_format(pmpro_getRevenue("today"), 2);?></em>
61
</div>
62
<div class="clear"></div>
63
</span>
@@ -66,7 +66,7 @@ function pmpro_report_sales_widget()
66
67
function pmpro_report_sales_page()
68
{
69
- global $wpdb, $pmpro_currency_symbol;
70
71
//get values from form
72
if(isset($_REQUEST['type']))
@@ -139,7 +139,7 @@ function pmpro_report_sales_page()
139
$cols = array();
140
if($period == "daily")
141
{
142
- $lastday = date("t", $startdate);
143
144
for($i = 1; $i <= $lastday; $i++)
145
{
@@ -203,7 +203,7 @@ function pmpro_report_sales_page()
203
<span id="for"><?php _ex('for', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?></span>
204
<select id="month" name="month">
205
<?php for($i = 1; $i < 13; $i++) { ?>
206
- <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i));?></option>
207
<?php } ?>
208
</select>
209
<select id="year" name="year">
@@ -231,7 +231,7 @@ function pmpro_report_sales_page()
231
</div>
232
233
<div id="chart_div" style="clear: both; width: 100%; height: 500px;"></div>
234
-
235
<script>
236
//update month/year when period dropdown is changed
237
jQuery(document).ready(function() {
@@ -273,7 +273,7 @@ function pmpro_report_sales_page()
273
var data = google.visualization.arrayToDataTable([
274
['<?php echo $date_function;?>', '<?php echo ucwords($type);?>'],
275
<?php foreach($cols as $date => $value) { ?>
276
- ['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$date)); else echo $date;?>', <?php echo $value;?>],
277
<?php } ?>
278
]);
279
@@ -283,10 +283,19 @@ function pmpro_report_sales_page()
283
vAxis: {color: 'green', titleTextStyle: {color: '#51a351'}},
284
};
285
286
- <?php if($type != "sales") { ?>
287
- var formatter = new google.visualization.NumberFormat({prefix: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
288
- formatter.format(data, 1);
289
- <?php } ?>
290
291
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
292
chart.draw(data, options);
32
//widget
33
function pmpro_report_sales_widget()
34
{
35
+ global $wpdb;
36
?>
37
<style>
38
#pmpro_report_sales div {text-align: center;}
42
<div style="width: 25%; float: left;">
43
<em><?php echo pmpro_getSales("all time");?></em>
44
<label>All Time</label>
45
+ <em><?php echo pmpro_formatPrice(pmpro_getRevenue("all time"));?></em>
46
</div>
47
<div style="width: 25%; float: left;">
48
<em><?php echo pmpro_getSales("this year");?></em>
49
<label>This Year</label>
50
+ <em><?php echo pmpro_formatPrice(pmpro_getRevenue("this year"));?></em>
51
</div>
52
<div style="width: 25%; float: left;">
53
<em><?php echo pmpro_getSales("this month");?></em>
54
<label>This Month</label>
55
+ <em><?php echo pmpro_formatPrice(pmpro_getRevenue("this month"));?></em>
56
</div>
57
<div style="width: 25%; float: left;">
58
<em><?php echo pmpro_getSales("today");?></em>
59
<label>Today</label>
60
+ <em><?php echo pmpro_formatPrice(pmpro_getRevenue("today"));?></em>
61
</div>
62
<div class="clear"></div>
63
</span>
66
67
function pmpro_report_sales_page()
68
{
69
+ global $wpdb, $pmpro_currency_symbol, $pmpro_currency, $pmpro_currencies;
70
71
//get values from form
72
if(isset($_REQUEST['type']))
139
$cols = array();
140
if($period == "daily")
141
{
142
+ $lastday = date("t", strtotime($startdate, current_time("timestamp")));
143
144
for($i = 1; $i <= $lastday; $i++)
145
{
203
<span id="for"><?php _ex('for', 'Dropdown label, e.g. Show Daily Revenue for January', 'pmpro')?></span>
204
<select id="month" name="month">
205
<?php for($i = 1; $i < 13; $i++) { ?>
206
+ <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
207
<?php } ?>
208
</select>
209
<select id="year" name="year">
231
</div>
232
233
<div id="chart_div" style="clear: both; width: 100%; height: 500px;"></div>
234
+
235
<script>
236
//update month/year when period dropdown is changed
237
jQuery(document).ready(function() {
273
var data = google.visualization.arrayToDataTable([
274
['<?php echo $date_function;?>', '<?php echo ucwords($type);?>'],
275
<?php foreach($cols as $date => $value) { ?>
276
+ ['<?php if($period == "monthly") echo date("M", mktime(0,0,0,$date,2)); else echo $date;?>', <?php echo $value;?>],
277
<?php } ?>
278
]);
279
283
vAxis: {color: 'green', titleTextStyle: {color: '#51a351'}},
284
};
285
286
+ <?php
287
+ if($type != "sales")
288
+ {
289
+ if(pmpro_getCurrencyPosition() == "right")
290
+ $position = "suffix";
291
+ else
292
+ $position = "prefix";
293
+ ?>
294
+ var formatter = new google.visualization.NumberFormat({<?php echo $position;?>: '<?php echo html_entity_decode($pmpro_currency_symbol);?>'});
295
+ formatter.format(data, 1);
296
+ <?php
297
+ }
298
+ ?>
299
300
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
301
chart.draw(data, options);
classes/class.pmproemail.php CHANGED
@@ -167,7 +167,7 @@
167
168
function sendCheckoutEmail($user = NULL, $invoice = NULL)
169
{
170
- global $wpdb, $current_user, $pmpro_currency_symbol;
171
if(!$user)
172
$user = $current_user;
173
@@ -205,7 +205,7 @@
205
else
206
$this->template = "checkout_paid";
207
$this->data["invoice_id"] = $invoice->code;
208
- $this->data["invoice_total"] = $pmpro_currency_symbol . number_format($invoice->total, 2);
209
$this->data["invoice_date"] = date(get_option('date_format'), $invoice->timestamp);
210
$this->data["billing_name"] = $invoice->billing->name;
211
$this->data["billing_street"] = $invoice->billing->street;
@@ -262,7 +262,7 @@
262
263
function sendCheckoutAdminEmail($user = NULL, $invoice = NULL)
264
{
265
- global $wpdb, $current_user, $pmpro_currency_symbol;
266
if(!$user)
267
$user = $current_user;
268
@@ -302,7 +302,7 @@
302
else
303
$this->template = "checkout_paid_admin";
304
$this->data["invoice_id"] = $invoice->code;
305
- $this->data["invoice_total"] = $pmpro_currency_symbol . number_format($invoice->total, 2);
306
$this->data["invoice_date"] = date(get_option('date_format'), $invoice->timestamp);
307
$this->data["billing_name"] = $invoice->billing->name;
308
$this->data["billing_street"] = $invoice->billing->street;
@@ -597,7 +597,7 @@
597
598
function sendInvoiceEmail($user = NULL, $invoice = NULL)
599
{
600
- global $wpdb, $current_user, $pmpro_currency_symbol;
601
if(!$user)
602
$user = $current_user;
603
@@ -619,7 +619,7 @@
619
"display_name" => $user->display_name,
620
"user_email" => $user->user_email,
621
"invoice_id" => $invoice->code,
622
- "invoice_total" => $pmpro_currency_symbol . number_format($invoice->total, 2),
623
"invoice_date" => date(get_option('date_format'), $invoice->timestamp),
624
"billing_name" => $invoice->billing->name,
625
"billing_street" => $invoice->billing->street,
@@ -660,7 +660,7 @@
660
661
function sendTrialEndingEmail($user = NULL)
662
{
663
- global $current_user, $wpdb, $pmpro_currency_symbol;
664
if(!$user)
665
$user = $current_user;
666
@@ -689,10 +689,10 @@
689
"login_link" => wp_login_url(),
690
"display_name" => $user->display_name,
691
"user_email" => $user->user_email,
692
- "billing_amount" => $pmpro_currency_symbol . $user->membership_level->billing_amount,
693
"cycle_number" => $user->membership_level->cycle_number,
694
"cycle_period" => $user->membership_level->cycle_period,
695
- "trial_amount" => $pmpro_currency_symbol . $user->membership_level->trial_amount,
696
"trial_limit" => $user->membership_level->trial_limit,
697
"trial_end" => date(get_option('date_format'), strtotime(date("m/d/Y", $user->membership_level->startdate) . " + " . $user->membership_level->trial_limit . " " . $user->membership_level->cycle_period), current_time("timestamp"))
698
);
167
168
function sendCheckoutEmail($user = NULL, $invoice = NULL)
169
{
170
+ global $wpdb, $current_user;
171
if(!$user)
172
$user = $current_user;
173
205
else
206
$this->template = "checkout_paid";
207
$this->data["invoice_id"] = $invoice->code;
208
+ $this->data["invoice_total"] = pmpro_formatPrice($invoice->total);
209
$this->data["invoice_date"] = date(get_option('date_format'), $invoice->timestamp);
210
$this->data["billing_name"] = $invoice->billing->name;
211
$this->data["billing_street"] = $invoice->billing->street;
262
263
function sendCheckoutAdminEmail($user = NULL, $invoice = NULL)
264
{
265
+ global $wpdb, $current_user;
266
if(!$user)
267
$user = $current_user;
268
302
else
303
$this->template = "checkout_paid_admin";
304
$this->data["invoice_id"] = $invoice->code;
305
+ $this->data["invoice_total"] = pmpro_formatPrice($invoice->total);
306
$this->data["invoice_date"] = date(get_option('date_format'), $invoice->timestamp);
307
$this->data["billing_name"] = $invoice->billing->name;
308
$this->data["billing_street"] = $invoice->billing->street;
597
598
function sendInvoiceEmail($user = NULL, $invoice = NULL)
599
{
600
+ global $wpdb, $current_user;
601
if(!$user)
602
$user = $current_user;
603
619
"display_name" => $user->display_name,
620
"user_email" => $user->user_email,
621
"invoice_id" => $invoice->code,
622
+ "invoice_total" => pmpro_formatPrice($invoice->total),
623
"invoice_date" => date(get_option('date_format'), $invoice->timestamp),
624
"billing_name" => $invoice->billing->name,
625
"billing_street" => $invoice->billing->street,
660
661
function sendTrialEndingEmail($user = NULL)
662
{
663
+ global $current_user, $wpdb;
664
if(!$user)
665
$user = $current_user;
666
689
"login_link" => wp_login_url(),
690
"display_name" => $user->display_name,
691
"user_email" => $user->user_email,
692
+ "billing_amount" => pmpro_formatPrice($user->membership_level->billing_amount),
693
"cycle_number" => $user->membership_level->cycle_number,
694
"cycle_period" => $user->membership_level->cycle_period,
695
+ "trial_amount" => pmpro_formatPrice($user->membership_level->trial_amount),
696
"trial_limit" => $user->membership_level->trial_limit,
697
"trial_end" => date(get_option('date_format'), strtotime(date("m/d/Y", $user->membership_level->startdate) . " + " . $user->membership_level->trial_limit . " " . $user->membership_level->cycle_period), current_time("timestamp"))
698
);
classes/gateways/class.pmprogateway_authorizenet.php CHANGED
@@ -727,17 +727,22 @@
727
function cancel(&$order)
728
{
729
//define variables to send
730
- $subscriptionId = $order->subscription_transaction_id;
731
$loginname = pmpro_getOption("loginname");
732
$transactionkey = pmpro_getOption("transactionkey");
733
734
- $gateway_environment = $order->gateway_environment;
735
- if(empty($gateway_environment))
736
- $gateway_environment = pmpro_getOption("gateway_environment");
737
if($gateway_environment == "live")
738
- $host = "api.authorize.net";
739
- else
740
- $host = "apitest.authorize.net";
741
742
$path = "/xml/v1/request.api";
743
@@ -790,6 +795,78 @@
790
}
791
}
792
793
//Authorize.net Function
794
//function to send xml request via fsockopen
795
function send_request_via_fsockopen($host,$path,$content)
727
function cancel(&$order)
728
{
729
//define variables to send
730
+ if(!empty($order->subscription_transaction_id))
731
+ $subscriptionId = $order->subscription_transaction_id;
732
+ else
733
+ $subscriptionId = "";
734
$loginname = pmpro_getOption("loginname");
735
$transactionkey = pmpro_getOption("transactionkey");
736
737
+ if(!empty($order->gateway_environment))
738
+ $gateway_environment = $order->gateway_environment;
739
+ else
740
+ $gateway_environment = pmpro_getOption("gateway_environment");
741
+
742
if($gateway_environment == "live")
743
+ $host = "api.authorize.net";
744
+ else
745
+ $host = "apitest.authorize.net";
746
747
$path = "/xml/v1/request.api";
748
795
}
796
}
797
798
+ function getSubscriptionStatus(&$order)
799
+ {
800
+ //define variables to send
801
+ if(!empty($order->subscription_transaction_id))
802
+ $subscriptionId = $order->subscription_transaction_id;
803
+ else
804
+ $subscriptionId = "";
805
+ $loginname = pmpro_getOption("loginname");
806
+ $transactionkey = pmpro_getOption("transactionkey");
807
+
808
+ if(!empty($order->gateway_environment))
809
+ $gateway_environment = $order->gateway_environment;
810
+ else
811
+ $gateway_environment = pmpro_getOption("gateway_environment");
812
+
813
+ if($gateway_environment == "live")
814
+ $host = "api.authorize.net";
815
+ else
816
+ $host = "apitest.authorize.net";
817
+
818
+ $path = "/xml/v1/request.api";
819
+
820
+ if(!$subscriptionId || !$loginname || !$transactionkey)
821
+ return false;
822
+
823
+ //build xml to post
824
+ $content =
825
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>".
826
+ "<ARBGetSubscriptionStatusRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">".
827
+ "<merchantAuthentication>".
828
+ "<name>" . $loginname . "</name>".
829
+ "<transactionKey>" . $transactionkey . "</transactionKey>".
830
+ "</merchantAuthentication>" .
831
+ "<subscriptionId>" . $subscriptionId . "</subscriptionId>".
832
+ "</ARBGetSubscriptionStatusRequest>";
833
+
834
+ //send the xml via curl
835
+ $response = $this->send_request_via_curl($host,$path,$content);
836
+
837
+ //if curl is unavilable you can try using fsockopen
838
+ /*
839
+ $response = send_request_via_fsockopen($host,$path,$content);
840
+ */
841
+
842
+ //if the connection and send worked $response holds the return from Authorize.net
843
+ if($response)
844
+ {
845
+ list ($resultCode, $code, $text, $subscriptionId) = $this->parse_return($response);
846
+
847
+ $status = $this->substring_between($response,'<status>','</status>');
848
+
849
+ if($resultCode == "Ok" || $code == "Ok")
850
+ {
851
+ return $status;
852
+ }
853
+ else
854
+ {
855
+ $order->status = "error";
856
+ $order->errorcode = $resultCode;
857
+ $order->error = $message;
858
+ $order->shorterror = $text;
859
+ }
860
+ }
861
+ else
862
+ {
863
+ $order->status = "error";
864
+ $order->errorcode = $resultCode;
865
+ $order->error = $message;
866
+ $order->shorterror = $text;
867
+ }
868
+ }
869
+
870
//Authorize.net Function
871
//function to send xml request via fsockopen
872
function send_request_via_fsockopen($host,$path,$content)
classes/gateways/class.pmprogateway_braintree.php CHANGED
@@ -162,7 +162,7 @@
162
{
163
$customer_id = get_user_meta($user_id, "pmpro_braintree_customerid", true);
164
}
165
-
166
//check for an existing stripe customer
167
if(!empty($customer_id))
168
{
@@ -170,12 +170,11 @@
170
{
171
$this->customer = Braintree_Customer::find($customer_id);
172
173
- //update the customer description and card
174
if(!empty($order->accountnumber))
175
- {
176
- $response = Braintree_Customer::update(
177
- $customer_id,
178
- array(
179
'firstName' => $order->FirstName,
180
'lastName' => $order->LastName,
181
'creditCard' => array(
@@ -185,13 +184,37 @@
185
'options' => array(
186
'updateExistingToken' => $this->customer->creditCards[0]->token
187
)
188
- )
189
- )
190
);
191
-
192
if($response->success)
193
- {
194
$this->customer = $response->customer;
195
}
196
else
197
{
@@ -200,14 +223,14 @@
200
return false;
201
}
202
}
203
-
204
return $this->customer;
205
}
206
catch (Exception $e)
207
{
208
- //assume no customer found
209
}
210
- }
211
212
//no customer id, create one
213
if(!empty($order->accountnumber))
@@ -236,7 +259,7 @@
236
)
237
)
238
));
239
-
240
if($result->success)
241
{
242
$this->customer = $result->customer;
@@ -254,8 +277,17 @@
254
$order->shorterror = $order->error;
255
return false;
256
}
257
-
258
- update_user_meta($user_id, "pmpro_braintree_customerid", $this->customer->id);
259
return $this->customer;
260
}
261
@@ -365,8 +397,8 @@
365
function update(&$order)
366
{
367
//we just have to run getCustomer which will look for the customer and update it with the new token
368
- $this->getCustomer($order);
369
-
370
if(!empty($this->customer) && empty($order->error))
371
{
372
return true;
@@ -418,5 +450,17 @@
418
$order->shorterror = $order->error;
419
return false; //no customer found
420
}
421
- }
422
}
162
{
163
$customer_id = get_user_meta($user_id, "pmpro_braintree_customerid", true);
164
}
165
+
166
//check for an existing stripe customer
167
if(!empty($customer_id))
168
{
170
{
171
$this->customer = Braintree_Customer::find($customer_id);
172
173
+ //update the customer address, description and card
174
if(!empty($order->accountnumber))
175
+ {
176
+ //put data in array for Braintree API calls
177
+ $update_array = array(
178
'firstName' => $order->FirstName,
179
'lastName' => $order->LastName,
180
'creditCard' => array(
184
'options' => array(
185
'updateExistingToken' => $this->customer->creditCards[0]->token
186
)
187
+ )
188
);
189
+
190
+ //address too?
191
+ if(!empty($order->billing))
192
+ //make sure Address2 is set
193
+ if(!isset($order->Address2))
194
+ $order->Address2 = '';
195
+
196
+ //add billing address to array
197
+ $update_array['creditCard']['billingAddress'] = array(
198
+ 'firstName' => $order->FirstName,
199
+ 'lastName' => $order->LastName,
200
+ 'streetAddress' => $order->Address1,
201
+ 'extendedAddress' => $order->Address2,
202
+ 'locality' => $order->billing->city,
203
+ 'region' => $order->billing->state,
204
+ 'postalCode' => $order->billing->zip,
205
+ 'countryCodeAlpha2' => $order->billing->country,
206
+ 'options' => array(
207
+ 'updateExisting' => true
208
+ )
209
+ );
210
+
211
+ //update
212
+ $response = Braintree_Customer::update($customer_id, $update_array);
213
+
214
if($response->success)
215
+ {
216
$this->customer = $response->customer;
217
+ return $this->customer;
218
}
219
else
220
{
223
return false;
224
}
225
}
226
+
227
return $this->customer;
228
}
229
catch (Exception $e)
230
{
231
+ //assume no customer found
232
}
233
+ }
234
235
//no customer id, create one
236
if(!empty($order->accountnumber))
259
)
260
)
261
));
262
+
263
if($result->success)
264
{
265
$this->customer = $result->customer;
277
$order->shorterror = $order->error;
278
return false;
279
}
280
+
281
+ //if we have no user id, we need to set the customer id after the user is created
282
+ if(empty($user_id))
283
+ {
284
+ global $pmpro_braintree_customerid;
285
+ $pmpro_braintree_customerid = $this->customer->id;
286
+ add_action('user_register', array('PMProGateway_braintree','user_register'));
287
+ }
288
+ else
289
+ update_user_meta($user_id, "pmpro_braintree_customerid", $this->customer->id);
290
+
291
return $this->customer;
292
}
293
397
function update(&$order)
398
{
399
//we just have to run getCustomer which will look for the customer and update it with the new token
400
+ $this->getCustomer($order, true);
401
+
402
if(!empty($this->customer) && empty($order->error))
403
{
404
return true;
450
$order->shorterror = $order->error;
451
return false; //no customer found
452
}
453
+ }
454
+
455
+ /*
456
+ Save Braintree customer id after the user is registered.
457
+ */
458
+ static function user_register($user_id)
459
+ {
460
+ global $pmpro_braintree_customerid;
461
+ if(!empty($pmpro_braintree_customerid))
462
+ {
463
+ update_user_meta($user_id, 'pmpro_braintree_customerid', $pmpro_braintree_customerid);
464
+ }
465
+ }
466
}
classes/gateways/class.pmprogateway_cybersource.php CHANGED
@@ -444,8 +444,7 @@
444
*/
445
//figure out the amounts
446
$amount = $order->PaymentAmount;
447
- $amount_tax = $order->getTaxForPrice($amount);
448
- $order->subtotal = $amount;
449
$amount = round((float)$amount + (float)$amount_tax, 2);
450
451
/*
444
*/
445
//figure out the amounts
446
$amount = $order->PaymentAmount;
447
+ $amount_tax = $order->getTaxForPrice($amount);
448
$amount = round((float)$amount + (float)$amount_tax, 2);
449
450
/*
classes/gateways/class.pmprogateway_payflowpro.php CHANGED
@@ -416,7 +416,7 @@
416
curl_setopt($ch, CURLOPT_POST, 1);
417
418
// NVPRequest for submitting to server
419
- $nvpreq = "TRXTYPE=" . $methodName_ . "&TENDER=C&PARTNER=" . $PARTNER . "&VENDOR=" . $VENDOR . "&USER=" . $USER . "&PWD=" . $PWD . "&VERBOSITY=medium" . $nvpStr_;
420
421
// setting the nvpreq as POST FIELD to curl
422
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
416
curl_setopt($ch, CURLOPT_POST, 1);
417
418
// NVPRequest for submitting to server
419
+ $nvpreq = "TRXTYPE=" . urlencode($methodName_) . "&TENDER=C&PARTNER=" . urlencode($PARTNER) . "&VENDOR=" . urlencode($VENDOR) . "&USER=" . urlencode($USER) . "&PWD=" . urlencode($PWD) . "&VERBOSITY=medium" . $nvpStr_;
420
421
// setting the nvpreq as POST FIELD to curl
422
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
classes/gateways/class.pmprogateway_paypal.php CHANGED
@@ -424,7 +424,7 @@
424
curl_setopt($ch, CURLOPT_POST, 1);
425
426
// NVPRequest for submitting to server
427
- $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
428
429
// setting the nvpreq as POST FIELD to curl
430
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
424
curl_setopt($ch, CURLOPT_POST, 1);
425
426
// NVPRequest for submitting to server
427
+ $nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr_;
428
429
// setting the nvpreq as POST FIELD to curl
430
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
classes/gateways/class.pmprogateway_paypalexpress.php CHANGED
@@ -40,8 +40,7 @@
40
41
//taxes on the amount
42
$amount = $order->PaymentAmount;
43
- $amount_tax = $order->getTaxForPrice($amount);
44
- $order->subtotal = $amount;
45
$amount = round((float)$amount + (float)$amount_tax, 2);
46
47
//paypal profile stuff
@@ -102,9 +101,8 @@
102
103
if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"])) {
104
$order->status = "token";
105
- $order->paypal_token = urldecode($this->httpParsedResponseAr['TOKEN']);
106
- $order->subscription_transaction_id = urldecode($this->httpParsedResponseAr['PROFILEID']);
107
-
108
//update order
109
$order->saveOrder();
110
@@ -197,7 +195,7 @@
197
if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"])) {
198
$order->payment_transaction_id = urldecode($this->httpParsedResponseAr['TRANSACTIONID']);
199
$order->status = "success";
200
-
201
//update order
202
$order->saveOrder();
203
@@ -244,7 +242,7 @@
244
$nvpStr .= "&DESC=" . urlencode(substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127));
245
246
//if billing cycles are defined
247
- if($order->TotalBillingCycles)
248
$nvpStr .= "&TOTALBILLINGCYCLES=" . $order->TotalBillingCycles;
249
250
//if a trial period is defined
@@ -370,7 +368,7 @@
370
curl_setopt($ch, CURLOPT_POST, 1);
371
372
// NVPRequest for submitting to server
373
- $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
374
375
// setting the nvpreq as POST FIELD to curl
376
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
40
41
//taxes on the amount
42
$amount = $order->PaymentAmount;
43
+ $amount_tax = $order->getTaxForPrice($amount);
44
$amount = round((float)$amount + (float)$amount_tax, 2);
45
46
//paypal profile stuff
101
102
if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"])) {
103
$order->status = "token";
104
+ $order->paypal_token = urldecode($this->httpParsedResponseAr['TOKEN']);
105
+
106
//update order
107
$order->saveOrder();
108
195
if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"])) {
196
$order->payment_transaction_id = urldecode($this->httpParsedResponseAr['TRANSACTIONID']);
197
$order->status = "success";
198
+
199
//update order
200
$order->saveOrder();
201
242
$nvpStr .= "&DESC=" . urlencode(substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127));
243
244
//if billing cycles are defined
245
+ if(!empty($order->TotalBillingCycles))
246
$nvpStr .= "&TOTALBILLINGCYCLES=" . $order->TotalBillingCycles;
247
248
//if a trial period is defined
368
curl_setopt($ch, CURLOPT_POST, 1);
369
370
// NVPRequest for submitting to server
371
+ $nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr_;
372
373
// setting the nvpreq as POST FIELD to curl
374
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
classes/gateways/class.pmprogateway_paypalstandard.php CHANGED
@@ -36,8 +36,7 @@
36
37
//taxes on the amount
38
$amount = $order->PaymentAmount;
39
- $amount_tax = $order->getTaxForPrice($amount);
40
- $order->subtotal = $amount;
41
$amount = round((float)$amount + (float)$amount_tax, 2);
42
43
//build PayPal Redirect
@@ -270,7 +269,7 @@
270
curl_setopt($ch, CURLOPT_POST, 1);
271
272
// NVPRequest for submitting to server
273
- $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
274
275
// setting the nvpreq as POST FIELD to curl
276
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
36
37
//taxes on the amount
38
$amount = $order->PaymentAmount;
39
+ $amount_tax = $order->getTaxForPrice($amount);
40
$amount = round((float)$amount + (float)$amount_tax, 2);
41
42
//build PayPal Redirect
269
curl_setopt($ch, CURLOPT_POST, 1);
270
271
// NVPRequest for submitting to server
272
+ $nvpreq = "METHOD=" . urlencode($methodName_) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr_;
273
274
// setting the nvpreq as POST FIELD to curl
275
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
classes/gateways/class.pmprogateway_stripe.php CHANGED
@@ -243,6 +243,9 @@
243
if(empty($this->customer))
244
return false; //error retrieving customer
245
246
//figure out the amounts
247
$amount = $order->PaymentAmount;
248
$amount_tax = $order->getTaxForPrice($amount);
@@ -300,7 +303,7 @@
300
"currency" => strtolower($pmpro_currency),
301
"id" => $order->code
302
);
303
-
304
$plan = Stripe_Plan::create(apply_filters('pmpro_stripe_create_plan_array', $plan));
305
}
306
catch (Exception $e)
@@ -309,11 +312,14 @@
309
$order->shorterror = $order->error;
310
return false;
311
}
312
-
313
//subscribe to the plan
314
try
315
- {
316
- $this->customer->updateSubscription(array("prorate" => false, "plan" => $order->code));
317
}
318
catch (Exception $e)
319
{
@@ -327,12 +333,11 @@
327
}
328
329
//delete the plan
330
- $plan = Stripe_Plan::retrieve($plan['id']);
331
$plan->delete();
332
333
//if we got this far, we're all good
334
- $order->status = "success";
335
- $order->subscription_transaction_id = $this->customer['id']; //transaction id is the customer id, we save it in user meta later too
336
return true;
337
}
338
@@ -351,37 +356,53 @@
351
}
352
}
353
354
- function cancel(&$order)
355
{
356
//no matter what happens below, we're going to cancel the order in our system
357
- $order->updateStatus("cancelled");
358
-
359
//require a subscription id
360
if(empty($order->subscription_transaction_id))
361
return false;
362
363
//find the customer
364
$this->getCustomer($order);
365
-
366
if(!empty($this->customer))
367
{
368
//find subscription with this order code
369
$subscriptions = $this->customer->subscriptions->all();
370
-
371
if(!empty($subscriptions))
372
- {
373
- //in case only one is returned
374
- if(!is_array($subscriptions))
375
- $subscriptions = array($subscriptions);
376
-
377
- foreach($subscriptions as $sub)
378
{
379
- if($sub->data[0]->plan->id == $order->code)
380
{
381
//found it, cancel it
382
try
383
{
384
- $this->customer->subscriptions->retrieve($sub->data[0]->id)->cancel();
385
break;
386
}
387
catch(Exception $e)
@@ -393,7 +414,7 @@
393
}
394
}
395
}
396
- }
397
398
return true;
399
}
@@ -404,4 +425,4 @@
404
return false; //no customer found
405
}
406
}
407
- }
243
if(empty($this->customer))
244
return false; //error retrieving customer
245
246
+ //set subscription id to custom id
247
+ $order->subscription_transaction_id = $this->customer['id']; //transaction id is the customer id, we save it in user meta later too
248
+
249
//figure out the amounts
250
$amount = $order->PaymentAmount;
251
$amount_tax = $order->getTaxForPrice($amount);
303
"currency" => strtolower($pmpro_currency),
304
"id" => $order->code
305
);
306
+
307
$plan = Stripe_Plan::create(apply_filters('pmpro_stripe_create_plan_array', $plan));
308
}
309
catch (Exception $e)
312
$order->shorterror = $order->error;
313
return false;
314
}
315
+
316
+ if(empty($order->subscription_transaction_id) && !empty($this->customer['id']))
317
+ $order->subscription_transaction_id = $this->customer['id'];
318
+
319
//subscribe to the plan
320
try
321
+ {
322
+ $this->customer->subscriptions->create(array("plan" => $order->code));
323
}
324
catch (Exception $e)
325
{
333
}
334
335
//delete the plan
336
+ $plan = Stripe_Plan::retrieve($order->code);
337
$plan->delete();
338
339
//if we got this far, we're all good
340
+ $order->status = "success";
341
return true;
342
}
343
356
}
357
}
358
359
+ function cancel(&$order, $update_status = true)
360
{
361
//no matter what happens below, we're going to cancel the order in our system
362
+ if($update_status)
363
+ $order->updateStatus("cancelled");
364
+
365
//require a subscription id
366
if(empty($order->subscription_transaction_id))
367
return false;
368
369
//find the customer
370
$this->getCustomer($order);
371
+
372
if(!empty($this->customer))
373
{
374
//find subscription with this order code
375
$subscriptions = $this->customer->subscriptions->all();
376
+
377
+ //get open invoices
378
+ $invoices = $this->customer->invoices();
379
+ $invoices = $invoices->all();
380
+
381
if(!empty($subscriptions))
382
+ {
383
+ foreach($subscriptions->data as $sub)
384
{
385
+ if($sub->plan->id == $order->code)
386
{
387
//found it, cancel it
388
try
389
{
390
+ //find any open invoices for this subscription and forgive them
391
+ if(!empty($invoices))
392
+ {
393
+ foreach($invoices->data as $invoice)
394
+ {
395
+ if(!$invoice->closed && $invoice->subscription == $sub->id)
396
+ {
397
+ $invoice->closed = true;
398
+ $invoice->save();
399
+ }
400
+ }
401
+ }
402
+
403
+ //cancel
404
+ $r = $sub->cancel();
405
+
406
break;
407
}
408
catch(Exception $e)
414
}
415
}
416
}
417
+ }
418
419
return true;
420
}
425
return false; //no customer found
426
}
427
}
428
+ }
classes/gateways/class.pmprogateway_twocheckout.php CHANGED
@@ -55,8 +55,7 @@
55
56
//taxes on the amount (NOT CURRENTLY USED)
57
$amount = $order->PaymentAmount;
58
- $amount_tax = $order->getTaxForPrice($amount);
59
- $order->subtotal = $amount;
60
$amount = round((float)$amount + (float)$amount_tax, 2);
61
62
// Recurring membership
55
56
//taxes on the amount (NOT CURRENTLY USED)
57
$amount = $order->PaymentAmount;
58
+ $amount_tax = $order->getTaxForPrice($amount);
59
$amount = round((float)$amount + (float)$amount_tax, 2);
60
61
// Recurring membership
includes/content.php CHANGED
@@ -160,26 +160,32 @@ function pmpro_search_filter($query)
160
$query->set('post__not_in', $hidden_page_ids);
161
162
//get categories that are filtered by level, but not my level
163
- $my_cats = array();
164
165
if($levels) {
166
foreach($levels as $key => $level) {
167
$member_cats = pmpro_getMembershipCategories($level->id);
168
- $my_cats = array_unique(array_merge($my_cats, $member_cats));
169
}
170
}
171
-
172
//get hidden cats
173
- if(!empty($my_cats))
174
- $sql = "SELECT category_id FROM $wpdb->pmpro_memberships_categories WHERE category_id NOT IN(" . implode(',', $my_cats) . ")";
175
else
176
$sql = "SELECT category_id FROM $wpdb->pmpro_memberships_categories";
177
178
$hidden_cat_ids = array_values(array_unique($wpdb->get_col($sql)));
179
-
180
//make this work
181
if($hidden_cat_ids)
182
$query->set('category__not_in', $hidden_cat_ids);
183
}
184
185
return $query;
@@ -187,7 +193,33 @@ function pmpro_search_filter($query)
187
$filterqueries = pmpro_getOption("filterqueries");
188
if(!empty($filterqueries))
189
add_filter( 'pre_get_posts', 'pmpro_search_filter' );
190
-
191
function pmpro_membership_content_filter($content, $skipcheck = false)
192
{
193
global $post, $current_user;
160
$query->set('post__not_in', $hidden_page_ids);
161
162
//get categories that are filtered by level, but not my level
163
+ global $pmpro_my_cats;
164
+ $pmpro_my_cats = array();
165
166
if($levels) {
167
foreach($levels as $key => $level) {
168
$member_cats = pmpro_getMembershipCategories($level->id);
169
+ $pmpro_my_cats = array_unique(array_merge($pmpro_my_cats, $member_cats));
170
}
171
}
172
+
173
//get hidden cats
174
+ if(!empty($pmpro_my_cats))
175
+ $sql = "SELECT category_id FROM $wpdb->pmpro_memberships_categories WHERE category_id NOT IN(" . implode(',', $pmpro_my_cats) . ")";
176
else
177
$sql = "SELECT category_id FROM $wpdb->pmpro_memberships_categories";
178
179
$hidden_cat_ids = array_values(array_unique($wpdb->get_col($sql)));
180
+
181
//make this work
182
if($hidden_cat_ids)
183
+ {
184
$query->set('category__not_in', $hidden_cat_ids);
185
+
186
+ //filter so posts in this member's categories are allowed
187
+ add_action('posts_where', 'pmpro_posts_where_unhide_cats');
188
+ }
189
}
190
191
return $query;
193
$filterqueries = pmpro_getOption("filterqueries");
194
if(!empty($filterqueries))
195
add_filter( 'pre_get_posts', 'pmpro_search_filter' );
196
+
197
+ /*
198
+ * Find taxonomy filters and make sure member categories are not hidden from members.
199
+ * @since 1.7.15
200
+ */
201
+ function pmpro_posts_where_unhide_cats($where)
202
+ {
203
+ global $pmpro_my_cats, $wpdb;
204
+
205
+ //if we have member cats, make sure they are allowed in taxonomy queries
206
+ if(!empty($where) && !empty($pmpro_my_cats))
207
+ {
208
+ $pattern = "/$wpdb->posts.ID NOT IN \(\s*SELECT object_id\s*FROM dev_term_relationships\s*WHERE term_taxonomy_id IN \((.*)\)\s*\)/";
209
+ $replacement = $wpdb->posts . '.ID NOT IN (
210
+ SELECT tr1.object_id
211
+ FROM ' . $wpdb->term_relationships . ' tr1
212
+ LEFT JOIN ' . $wpdb->term_relationships . ' tr2 ON tr1.object_id = tr2.object_id AND tr2.term_taxonomy_id IN(' . implode($pmpro_my_cats) . ')
213
+ WHERE tr1.term_taxonomy_id IN(${1}) AND tr2.term_taxonomy_id IS NULL ) ';
214
+ $where = preg_replace($pattern, $replacement, $where);
215
+ }
216
+
217
+ //remove filter for next query
218
+ remove_action('posts_where', 'pmpro_posts_where_unhide_cats');
219
+
220
+ return $where;
221
+ }
222
+
223
function pmpro_membership_content_filter($content, $skipcheck = false)
224
{
225
global $post, $current_user;
includes/currencies.php CHANGED
@@ -5,10 +5,22 @@
5
6
$pmpro_currencies = array(
7
'USD' => __('US Dollars (&#36;)', 'pmpro'),
8
- 'EUR' => __('Euros (&euro;)', 'pmpro'),
9
- 'GBP' => __('Pounds Sterling (&pound;)', 'pmpro'),
10
'AUD' => __('Australian Dollars (&#36;)', 'pmpro'),
11
- 'BRL' => __('Brazilian Real (&#36;)', 'pmpro'),
12
'CAD' => __('Canadian Dollars (&#36;)', 'pmpro'),
13
'CNY' => __('Chinese Yuan', 'pmpro'),
14
'CZK' => __('Czech Koruna', 'pmpro'),
@@ -18,14 +30,22 @@
18
'INR' => __('Indian Rupee', 'pmpro'),
19
'IDR' => __('Indonesia Rupiah', 'pmpro'),
20
'ILS' => __('Israeli Shekel', 'pmpro'),
21
- 'JPY' => __('Japanese Yen (&yen;)', 'pmpro'),
22
'MYR' => __('Malaysian Ringgits', 'pmpro'),
23
'MXN' => __('Mexican Peso (&#36;)', 'pmpro'),
24
'NZD' => __('New Zealand Dollar (&#36;)', 'pmpro'),
25
'NOK' => __('Norwegian Krone', 'pmpro'),
26
'PHP' => __('Philippine Pesos', 'pmpro'),
27
'PLN' => __('Polish Zloty', 'pmpro'),
28
- 'SGD' => __('Singapore Dollar (&#36;)', 'pmpro'),
29
'ZAR' => __('South African Rand', 'pmpro'),
30
'KRW' => __('South Korean Won', 'pmpro'),
31
'SEK' => __('Swedish Krona', 'pmpro'),
5
6
$pmpro_currencies = array(
7
'USD' => __('US Dollars (&#36;)', 'pmpro'),
8
+ 'EUR' => array(
9
+ 'name' => __('Euros (&euro;)', 'pmpro'),
10
+ 'symbol' => '&euro;',
11
+ 'position' => 'right'
12
+ ),
13
+ 'GBP' => array(
14
+ 'name' => __('Pounds Sterling (&pound;)', 'pmpro'),
15
+ 'symbol' => '&pound;',
16
+ 'position' => 'right'
17
+ ),
18
'AUD' => __('Australian Dollars (&#36;)', 'pmpro'),
19
+ 'BRL' => array(
20
+ 'name' => __('Brazilian Real (R&#36;)', 'pmpro'),
21
+ 'symbol' => 'R&#36;',
22
+ 'position' => 'left'
23
+ ),
24
'CAD' => __('Canadian Dollars (&#36;)', 'pmpro'),
25
'CNY' => __('Chinese Yuan', 'pmpro'),
26
'CZK' => __('Czech Koruna', 'pmpro'),
30
'INR' => __('Indian Rupee', 'pmpro'),
31
'IDR' => __('Indonesia Rupiah', 'pmpro'),
32
'ILS' => __('Israeli Shekel', 'pmpro'),
33
+ 'JPY' => array(
34
+ 'name' => __('Japanese Yen (&yen;)', 'pmpro'),
35
+ 'symbol' => '&yen;',
36
+ 'position' => 'right'
37
+ ),
38
'MYR' => __('Malaysian Ringgits', 'pmpro'),
39
'MXN' => __('Mexican Peso (&#36;)', 'pmpro'),
40
'NZD' => __('New Zealand Dollar (&#36;)', 'pmpro'),
41
'NOK' => __('Norwegian Krone', 'pmpro'),
42
'PHP' => __('Philippine Pesos', 'pmpro'),
43
'PLN' => __('Polish Zloty', 'pmpro'),
44
+ 'SGD' => array(
45
+ 'name' => __('Singapore Dollar (&#36;)', 'pmpro'),
46
+ 'symbol' => '&#36;',
47
+ 'position' => 'right'
48
+ ),
49
'ZAR' => __('South African Rand', 'pmpro'),
50
'KRW' => __('South Korean Won', 'pmpro'),
51
'SEK' => __('Swedish Krona', 'pmpro'),
includes/email.php CHANGED
@@ -59,7 +59,13 @@ if(empty($email_member_notification))
59
Adds template files and changes content type to html if using PHPMailer directly.
60
*/
61
function pmpro_send_html( $phpmailer ) {
62
-
63
// Set the original plain text message
64
$phpmailer->AltBody = wp_specialchars_decode($phpmailer->Body, ENT_QUOTES);
65
// Clean < and > around text links in WP 3.1
@@ -94,6 +100,9 @@ function pmpro_send_html( $phpmailer ) {
94
$phpmailer->Body = str_replace("!!" . $key . "!!", $value, $phpmailer->Body);
95
}
96
97
do_action("pmpro_after_phpmailer_init", $phpmailer);
98
do_action("pmpro_after_pmpmailer_init", $phpmailer); //typo left in for backwards compatibility
99
}
59
Adds template files and changes content type to html if using PHPMailer directly.
60
*/
61
function pmpro_send_html( $phpmailer ) {
62
+
63
+ //check if we should wpautop later
64
+ if($phpmailer->Body == strip_tags($phpmailer->Body))
65
+ $wpautop = true;
66
+ else
67
+ $wpautop = false;
68
+
69
// Set the original plain text message
70
$phpmailer->AltBody = wp_specialchars_decode($phpmailer->Body, ENT_QUOTES);
71
// Clean < and > around text links in WP 3.1
100
$phpmailer->Body = str_replace("!!" . $key . "!!", $value, $phpmailer->Body);
101
}
102
103
+ if($wpautop)
104
+ $phpmailer->Body = wpautop($phpmailer->Body);
105
+
106
do_action("pmpro_after_phpmailer_init", $phpmailer);
107
do_action("pmpro_after_pmpmailer_init", $phpmailer); //typo left in for backwards compatibility
108
}
includes/functions.php CHANGED
@@ -198,12 +198,11 @@ function pmpro_isLevelExpiring(&$level)
198
199
function pmpro_getLevelCost(&$level, $tags = true, $short = false)
200
{
201
- global $pmpro_currency_symbol;
202
//initial payment
203
if(!$short)
204
- $r = sprintf(__('The price for membership is <strong>%s</strong> now', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2));
205
else
206
- $r = sprintf(__('<strong>%s</strong> now', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2));
207
208
//recurring part
209
if($level->billing_amount != '0.00')
@@ -212,36 +211,36 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
212
{
213
if($level->cycle_number == '1')
214
{
215
- $r .= sprintf(__(' and then <strong>%s per %s for %d more %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, pmpro_translate_billing_period($level->cycle_period), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
216
}
217
else
218
{
219
- $r .= sprintf(__(' and then <strong>%s every %d %s for %d more %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
220
}
221
}
222
elseif($level->billing_limit == 1)
223
{
224
- $r .= sprintf(__(' and then <strong>%s after %d %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
225
}
226
else
227
{
228
if( $level->billing_amount === $level->initial_payment ) {
229
if($level->cycle_number == '1')
230
{
231
- $r = sprintf(__('The price for membership is <strong>%s per %s</strong>.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2), pmpro_translate_billing_period($level->cycle_period) );
232
}
233
else
234
{
235
- $r = sprintf(__('The price for membership is <strong>%s every %d %s</strong>.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number) );
236
}
237
} else {
238
if($level->cycle_number == '1')
239
{
240
- $r .= sprintf(__(' and then <strong>%s per %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, pmpro_translate_billing_period($level->cycle_period));
241
}
242
else
243
{
244
- $r .= sprintf(__(' and then <strong>%s every %d %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
245
}
246
}
247
}
@@ -270,11 +269,11 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
270
{
271
if($level->trial_limit == '1')
272
{
273
- $r .= ' ' . sprintf(__('After your initial payment, your first payment will cost %s.', 'pmpro'), $pmpro_currency_symbol . $level->trial_amount);
274
}
275
else
276
{
277
- $r .= ' ' . sprintf(__('After your initial payment, your first %d payments will cost %s.', 'pmpro'), $level->trial_limit, $pmpro_currency_symbol . $level->trial_amount);
278
}
279
}
280
}
@@ -336,7 +335,7 @@ function pmpro_next_payment($user_id = NULL, $order_status = "success")
336
//get current membership level
337
$level = pmpro_getMembershipLevelForUser($user_id);
338
339
- if(!empty($order) && !empty($level) && !empty($level->cycle_number))
340
{
341
//last payment date
342
$lastdate = date("Y-m-d", $order->timestamp);
@@ -1395,7 +1394,7 @@ function pmpro_getCheckoutButton($level_id, $button_text = NULL, $classes = NULL
1395
$button_text = __("Sign Up for !!name!! Now", "pmpro");
1396
1397
if(empty($classes))
1398
- $classes = "btn btn-primary";
1399
1400
if(empty($level_id))
1401
$r = __("Please specify a level id.", "pmpro");
@@ -1555,14 +1554,21 @@ function pmpro_getClassForField($field)
1555
{
1556
global $pmpro_error_fields, $pmpro_required_billing_fields, $pmpro_required_user_fields;
1557
$classes = array();
1558
-
1559
//error on this field?
1560
- if(in_array($field, $pmpro_error_fields))
1561
{
1562
$classes[] = "pmpro_error";
1563
}
1564
1565
- $required_fields = array_merge(array_keys($pmpro_required_billing_fields), array_keys($pmpro_required_user_fields));
1566
1567
//required?
1568
if(in_array($field, $required_fields))
@@ -1740,3 +1746,50 @@ function pmpro_is_ready()
1740
else
1741
return false;
1742
}
198
199
function pmpro_getLevelCost(&$level, $tags = true, $short = false)
200
{
201
//initial payment
202
if(!$short)
203
+ $r = sprintf(__('The price for membership is <strong>%s</strong> now', 'pmpro'), pmpro_formatPrice($level->initial_payment));
204
else
205
+ $r = sprintf(__('<strong>%s</strong> now', 'pmpro'), pmpro_formatPrice($level->initial_payment));
206
207
//recurring part
208
if($level->billing_amount != '0.00')
211
{
212
if($level->cycle_number == '1')
213
{
214
+ $r .= sprintf(__(' and then <strong>%s per %s for %d more %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
215
}
216
else
217
{
218
+ $r .= sprintf(__(' and then <strong>%s every %d %s for %d more %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
219
}
220
}
221
elseif($level->billing_limit == 1)
222
{
223
+ $r .= sprintf(__(' and then <strong>%s after %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
224
}
225
else
226
{
227
if( $level->billing_amount === $level->initial_payment ) {
228
if($level->cycle_number == '1')
229
{
230
+ $r = sprintf(__('The price for membership is <strong>%s per %s</strong>.', 'pmpro'), pmpro_formatPrice($level->initial_payment), pmpro_translate_billing_period($level->cycle_period) );
231
}
232
else
233
{
234
+ $r = sprintf(__('The price for membership is <strong>%s every %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->initial_payment), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number) );
235
}
236
} else {
237
if($level->cycle_number == '1')
238
{
239
+ $r .= sprintf(__(' and then <strong>%s per %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period));
240
}
241
else
242
{
243
+ $r .= sprintf(__(' and then <strong>%s every %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
244
}
245
}
246
}
269
{
270
if($level->trial_limit == '1')
271
{
272
+ $r .= ' ' . sprintf(__('After your initial payment, your first payment will cost %s.', 'pmpro'), pmpro_formatPrice($level->trial_amount));
273
}
274
else
275
{
276
+ $r .= ' ' . sprintf(__('After your initial payment, your first %d payments will cost %s.', 'pmpro'), $level->trial_limit, pmpro_formatPrice($level->trial_amount));
277
}
278
}
279
}
335
//get current membership level
336
$level = pmpro_getMembershipLevelForUser($user_id);
337
338
+ if(!empty($order) && !empty($order->id) && !empty($level) && !empty($level->id) && !empty($level->cycle_number))
339
{
340
//last payment date
341
$lastdate = date("Y-m-d", $order->timestamp);
1394
$button_text = __("Sign Up for !!name!! Now", "pmpro");
1395
1396
if(empty($classes))
1397
+ $classes = "pmpro_btn";
1398
1399
if(empty($level_id))
1400
$r = __("Please specify a level id.", "pmpro");
1554
{
1555
global $pmpro_error_fields, $pmpro_required_billing_fields, $pmpro_required_user_fields;
1556
$classes = array();
1557
+
1558
//error on this field?
1559
+ if(!empty($pmpro_error_fields) && in_array($field, $pmpro_error_fields))
1560
{
1561
$classes[] = "pmpro_error";
1562
}
1563
1564
+ if(is_array($pmpro_required_billing_fields) && is_array($pmpro_required_user_fields))
1565
+ $required_fields = array_merge(array_keys($pmpro_required_billing_fields), array_keys($pmpro_required_user_fields));
1566
+ elseif(is_array($pmpro_required_billing_fields))
1567
+ $required_fields = array_keys($pmpro_required_billing_fields);
1568
+ elseif(is_array($pmpro_required_user_fields))
1569
+ $required_fields = array_keys($pmpro_required_user_fields);
1570
+ else
1571
+ $required_fields = array();
1572
1573
//required?
1574
if(in_array($field, $required_fields))
1746
else
1747
return false;
1748
}
1749
+
1750
+ /**
1751
+ * Format a price per the currency settings.
1752
+ *
1753
+ * @since 1.7.15
1754
+ */
1755
+ function pmpro_formatPrice($price)
1756
+ {
1757
+ global $pmpro_currency, $pmpro_currency_symbol, $pmpro_currencies;
1758
+
1759
+ //start with the price formatted with two decimals
1760
+ $formatted = number_format($price, 2);
1761
+
1762
+ //settings stored in array?
1763
+ if(!empty($pmpro_currencies[$pmpro_currency]) && is_array($pmpro_currencies[$pmpro_currency]))
1764
+ {
1765
+ //which side is the symbol on?
1766
+ if(!empty($pmpro_currencies[$pmpro_currency]['position']) && $pmpro_currencies[$pmpro_currency]['position']== 'left')
1767
+ $formatted = $pmpro_currency_symbol . $formatted;
1768
+ else
1769
+ $formatted = $formatted . $pmpro_currency_symbol;
1770
+
1771
+ //commas or periods?
1772
+ if(!empty($pmpro_currencies[$pmpro_currency]['separator']) && $pmpro_currencies[$pmpro_currency]['separator'])
1773
+ $formatted = str_replace(array(".",","), $pmpro_currencies[$pmpro_currency]['separator'], $formatted);
1774
+ }
1775
+ else
1776
+ $formatted = $pmpro_currency_symbol . $formatted; //default to symbol on the left
1777
+
1778
+ //filter
1779
+ return apply_filters('pmpro_format_price', $formatted, $price, $pmpro_currency, $pmpro_currency_symbol);
1780
+ }
1781
+
1782
+ /**
1783
+ * Which side does the currency symbol go on?
1784
+ *
1785
+ * @since 1.7.15
1786
+ */
1787
+ function pmpro_getCurrencyPosition()
1788
+ {
1789
+ global $pmpro_currency, $pmpro_currencies;
1790
+
1791
+ if(!empty($pmpro_currencies[$pmpro_currency]) && is_array($pmpro_currencies[$pmpro_currency]) && !empty($pmpro_currencies[$pmpro_currency]['position']))
1792
+ return $pmpro_currencies[$pmpro_currency]['position'];
1793
+ else
1794
+ return "left";
1795
+ }
includes/init.php CHANGED
@@ -68,7 +68,7 @@ function pmpro_init()
68
wp_enqueue_style('pmpro_print', $print_css, array(), PMPRO_VERSION, "print");
69
}
70
71
- global $pmpro_pages, $pmpro_ready, $pmpro_currency, $pmpro_currency_symbol;
72
$pmpro_pages = array();
73
$pmpro_pages["account"] = pmpro_getOption("account_page_id");
74
$pmpro_pages["billing"] = pmpro_getOption("billing_page_id");
@@ -89,16 +89,12 @@ function pmpro_init()
89
}
90
91
//figure out what symbol to show for currency
92
- if(in_array($pmpro_currency, array("USD", "AUD", "BRL", "CAD", "HKD", "MXN", "NZD", "SGD")))
93
- $pmpro_currency_symbol = "&#36;";
94
- elseif($pmpro_currency == "EUR")
95
- $pmpro_currency_symbol = "&euro;";
96
- elseif($pmpro_currency == "GBP")
97
- $pmpro_currency_symbol = "&pound;";
98
- elseif($pmpro_currency == "JPY")
99
- $pmpro_currency_symbol = "&yen;";
100
else
101
- $pmpro_currency_symbol = $pmpro_currency . " "; //just use the code
102
}
103
add_action("init", "pmpro_init");
104
68
wp_enqueue_style('pmpro_print', $print_css, array(), PMPRO_VERSION, "print");
69
}
70
71
+ global $pmpro_pages, $pmpro_ready, $pmpro_currencies, $pmpro_currency, $pmpro_currency_symbol;
72
$pmpro_pages = array();
73
$pmpro_pages["account"] = pmpro_getOption("account_page_id");
74
$pmpro_pages["billing"] = pmpro_getOption("billing_page_id");
89
}
90
91
//figure out what symbol to show for currency
92
+ if(!empty($pmpro_currencies[$pmpro_currency]) && is_array($pmpro_currencies[$pmpro_currency]))
93
+ $pmpro_currency_symbol = $pmpro_currencies[$pmpro_currency]['symbol'];
94
+ elseif(!empty($pmpro_currencies[$pmpro_currency]) && strpos($pmpro_currencies[$pmpro_currency], "(") !== false)
95
+ $pmpro_currency_symbol = pmpro_getMatches("/\((.*)\)/", $pmpro_currencies[$pmpro_currency], true);
96
else
97
+ $pmpro_currency_symbol = $pmpro_currency . " "; //just use the code
98
}
99
add_action("init", "pmpro_init");
100
includes/login.php CHANGED
@@ -148,7 +148,7 @@ add_action('login_init', 'pmpro_login_head');
148
*/
149
function pmpro_redirect_to_logged_in()
150
{
151
- if((pmpro_is_login_page() || is_page("login")) && !empty($_REQUEST['redirect_to']) && is_user_logged_in())
152
{
153
wp_redirect($_REQUEST['redirect_to']);
154
exit;
148
*/
149
function pmpro_redirect_to_logged_in()
150
{
151
+ if((pmpro_is_login_page() || is_page("login")) && !empty($_REQUEST['redirect_to']) && is_user_logged_in() && (empty($_REQUEST['action']) || $_REQUEST['action'] == 'login') && empty($_REQUEST['reauth']))
152
{
153
wp_redirect($_REQUEST['redirect_to']);
154
exit;
includes/profile.php CHANGED
@@ -5,7 +5,7 @@
5
//add the fields
6
function pmpro_membership_level_profile_fields($user)
7
{
8
- global $current_user, $pmpro_currency_symbol;
9
10
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
11
if(!current_user_can($membership_level_capability))
@@ -64,7 +64,7 @@ function pmpro_membership_level_profile_fields($user)
64
{
65
?>
66
<?php if($membership_values->billing_amount > 0) { ?>
67
- at <?php echo $pmpro_currency_symbol;?><?php echo $membership_values->billing_amount?>
68
<?php if($membership_values->cycle_number > 1) { ?>
69
per <?php echo $membership_values->cycle_number?> <?php echo sornot($membership_values->cycle_period,$membership_values->cycle_number)?>
70
<?php } elseif($membership_values->cycle_number == 1) { ?>
@@ -75,7 +75,7 @@ function pmpro_membership_level_profile_fields($user)
75
<?php if($membership_values->billing_limit) { ?> for <?php echo $membership_values->billing_limit.' '.sornot($membership_values->cycle_period,$membership_values->billing_limit)?><?php } ?>.
76
77
<?php if($membership_values->trial_limit) { ?>
78
- The first <?php echo $membership_values->trial_limit?> <?php echo sornot("payments",$membership_values->trial_limit)?> will cost <?php echo $pmpro_currency_symbol;?><?php echo $membership_values->trial_amount?>.
79
<?php } ?>
80
<?php
81
}
5
//add the fields
6
function pmpro_membership_level_profile_fields($user)
7
{
8
+ global $current_user;
9
10
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
11
if(!current_user_can($membership_level_capability))
64
{
65
?>
66
<?php if($membership_values->billing_amount > 0) { ?>
67
+ at <?php echo pmpro_formatPrice($membership_values->billing_amount);?>
68
<?php if($membership_values->cycle_number > 1) { ?>
69
per <?php echo $membership_values->cycle_number?> <?php echo sornot($membership_values->cycle_period,$membership_values->cycle_number)?>
70
<?php } elseif($membership_values->cycle_number == 1) { ?>
75
<?php if($membership_values->billing_limit) { ?> for <?php echo $membership_values->billing_limit.' '.sornot($membership_values->cycle_period,$membership_values->billing_limit)?><?php } ?>.
76
77
<?php if($membership_values->trial_limit) { ?>
78
+ The first <?php echo $membership_values->trial_limit?> <?php echo sornot("payments",$membership_values->trial_limit)?> will cost <?php echo pmpro_formatPrice($membership_values->trial_amount);?>.
79
<?php } ?>
80
<?php
81
}
js/jquery.creditCardValidator.js ADDED
@@ -0,0 +1,181 @@
1
+ // Generated by CoffeeScript 1.4.0
2
+
3
+ /*
4
+ jQuery Credit Card Validator
5
+
6
+ Copyright 2012 Pawel Decowski
7
+
8
+ This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
9
+ Unported License. To view a copy of this license, visit:
10
+
11
+ http://creativecommons.org/licenses/by-sa/3.0/
12
+
13
+ or send a letter to:
14
+
15
+ Creative Commons, 444 Castro Street, Suite 900,
16
+ Mountain View, California, 94041, USA.
17
+ */
18
+
19
+
20
+ (function() {
21
+ var $,
22
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
23
+
24
+ $ = jQuery;
25
+
26
+ $.fn.validateCreditCard = function(callback, options) {
27
+ var card, card_type, card_types, get_card_type, is_valid_length, is_valid_luhn, normalize, validate, validate_number, _i, _len, _ref, _ref1;
28
+ card_types = [
29
+ {
30
+ name: 'amex',
31
+ pattern: /^3[47]/,
32
+ valid_length: [15]
33
+ }, {
34
+ name: 'diners_club_carte_blanche',
35
+ pattern: /^30[0-5]/,
36
+ valid_length: [14]
37
+ }, {
38
+ name: 'diners_club_international',
39
+ pattern: /^36/,
40
+ valid_length: [14]
41
+ }, {
42
+ name: 'jcb',
43
+ pattern: /^35(2[89]|[3-8][0-9])/,
44
+ valid_length: [16]
45
+ }, {
46
+ name: 'laser',
47
+ pattern: /^(6304|670[69]|6771)/,
48
+ valid_length: [16, 17, 18, 19]
49
+ }, {
50
+ name: 'visa_electron',
51
+ pattern: /^(4026|417500|4508|4844|491(3|7))/,
52
+ valid_length: [16]
53
+ }, {
54
+ name: 'visa',
55
+ pattern: /^4/,
56
+ valid_length: [16]
57
+ }, {
58
+ name: 'mastercard',
59
+ pattern: /^5[1-5]/,
60
+ valid_length: [16]
61
+ }, {
62
+ name: 'maestro',
63
+ pattern: /^(5018|5020|5038|6304|6759|676[1-3])/,
64
+ valid_length: [12, 13, 14, 15, 16, 17, 18, 19]
65
+ }, {
66
+ name: 'discover',
67
+ pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,
68
+ valid_length: [16]
69
+ }
70
+ ];
71
+ if (options == null) {
72
+ options = {};
73
+ }
74
+ if ((_ref = options.accept) == null) {
75
+ options.accept = (function() {
76
+ var _i, _len, _results;
77
+ _results = [];
78
+ for (_i = 0, _len = card_types.length; _i < _len; _i++) {
79
+ card = card_types[_i];
80
+ _results.push(card.name);
81
+ }
82
+ return _results;
83
+ })();
84
+ }
85
+ _ref1 = options.accept;
86
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
87
+ card_type = _ref1[_i];
88
+ if (__indexOf.call((function() {
89
+ var _j, _len1, _results;
90
+ _results = [];
91
+ for (_j = 0, _len1 = card_types.length; _j < _len1; _j++) {
92
+ card = card_types[_j];
93
+ _results.push(card.name);
94
+ }
95
+ return _results;
96
+ })(), card_type) < 0) {
97
+ throw "Credit card type '" + card_type + "' is not supported";
98
+ }
99
+ }
100
+ get_card_type = function(number) {
101
+ var _j, _len1, _ref2;
102
+ _ref2 = (function() {
103
+ var _k, _len1, _ref2, _results;
104
+ _results = [];
105
+ for (_k = 0, _len1 = card_types.length; _k < _len1; _k++) {
106
+ card = card_types[_k];
107
+ if (_ref2 = card.name, __indexOf.call(options.accept, _ref2) >= 0) {
108
+ _results.push(card);
109
+ }
110
+ }
111
+ return _results;
112
+ })();
113
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
114
+ card_type = _ref2[_j];
115
+ if (number.match(card_type.pattern)) {
116
+ return card_type;
117
+ }
118
+ }
119
+ return null;
120
+ };
121
+ is_valid_luhn = function(number) {
122
+ var digit, n, sum, _j, _len1, _ref2;
123
+ sum = 0;
124
+ _ref2 = number.split('').reverse();
125
+ for (n = _j = 0, _len1 = _ref2.length; _j < _len1; n = ++_j) {
126
+ digit = _ref2[n];
127
+ digit = +digit;
128
+ if (n % 2) {
129
+ digit *= 2;
130
+ if (digit < 10) {
131
+ sum += digit;
132
+ } else {
133
+ sum += digit - 9;
134
+ }
135
+ } else {
136
+ sum += digit;
137
+ }
138
+ }
139
+ return sum % 10 === 0;
140
+ };
141
+ is_valid_length = function(number, card_type) {
142
+ var _ref2;
143
+ return _ref2 = number.length, __indexOf.call(card_type.valid_length, _ref2) >= 0;
144
+ };
145
+ validate_number = function(number) {
146
+ var length_valid, luhn_valid;
147
+ card_type = get_card_type(number);
148
+ luhn_valid = false;
149
+ length_valid = false;
150
+ if (card_type != null) {
151
+ luhn_valid = is_valid_luhn(number);
152
+ length_valid = is_valid_length(number, card_type);
153
+ }
154
+ return callback({
155
+ card_type: card_type,
156
+ luhn_valid: luhn_valid,
157
+ length_valid: length_valid
158
+ });
159
+ };
160
+ validate = function() {
161
+ var number;
162
+ number = normalize($(this).val());
163
+ return validate_number(number);
164
+ };
165
+ normalize = function(number) {
166
+ return number.replace(/[ -]/g, '');
167
+ };
168
+ this.bind('input', function() {
169
+ $(this).unbind('keyup');
170
+ return validate.call(this);
171
+ });
172
+ this.bind('keyup', function() {
173
+ return validate.call(this);
174
+ });
175
+ if (this.length !== 0) {
176
+ validate.call(this);
177
+ }
178
+ return this;
179
+ };
180
+
181
+ }).call(this);
languages/pmpro-it_IT.mo CHANGED
Binary file
languages/pmpro-it_IT.po CHANGED
@@ -1,7 +1,7 @@
1
msgid ""
2
msgstr ""
3
"Project-Id-Version: Paid Memberships Pro\n"
4
- "POT-Creation-Date: 2014-05-05 13:29-0400\n"
5
"PO-Revision-Date: \n"
6
"Last-Translator: Angelo Giammarresi <info@wocmultimedia.com>\n"
7
"Language-Team: Angelo Giammarresi <info@wocmultimedia.com>\n"
@@ -124,7 +124,8 @@ msgid "User Forum"
124
msgstr "Forum Utenti"
125
126
#: adminpages/admin_header.php:149 adminpages/membershiplevels.php:498
127
- #: adminpages/pagesettings.php:69 includes/adminpages.php:107
128
#: adminpages/admin_header.php:128 adminpages/membershiplevels.php:490
129
#: adminpages/membershiplevels.php:496 includes/adminpages.php:44
130
#: includes/adminpages.php:100
@@ -157,11 +158,12 @@ msgstr "Avanzate"
157
msgid "Add Ons"
158
msgstr "Addons"
159
160
- #: adminpages/advancedsettings.php:42 adminpages/advancedsettings.php:35
161
msgid "Your advanced settings have been updated."
162
msgstr "Impostazioni avanzate aggiornate."
163
164
- #: adminpages/advancedsettings.php:66
165
#, php-format
166
msgid ""
167
"This content is for !!levels!! members only. <a href=\"%s\">Register here</"
@@ -170,7 +172,7 @@ msgstr ""
170
"Questo contenuto è riservato ai soli membri di !!levels!! <a href=\"%s"
171
"\">Registrati</a>."
172
173
- #: adminpages/advancedsettings.php:71
174
#, php-format
175
msgid ""
176
"Please <a href=\"%s\">login</a> to view this content. (<a href=\"%s"
@@ -179,148 +181,193 @@ msgstr ""
179
"Per favore <a href=\"%s\">Accedi</a> per vedere questo contenuto. (<a href="
180
"\"%s\">Registrati</a>.)"
181
182
- #: adminpages/advancedsettings.php:76
183
msgid ""
184
"This content is for members only. Visit the site and log in/register to read."
185
msgstr ""
186
"Questo contenuto è riservato ai soli membri. Visita il sito e accedi/"
187
"registrati per continuare la lettura."
188
189
- #: adminpages/advancedsettings.php:86 includes/adminpages.php:51
190
#: includes/adminpages.php:135 adminpages/advancedsettings.php:79
191
- #: includes/adminpages.php:13 includes/adminpages.php:64
192
- #: includes/adminpages.php:128
193
msgid "Advanced Settings"
194
msgstr "Avanzate"
195
196
- #: adminpages/advancedsettings.php:92 adminpages/advancedsettings.php:85
197
msgid "Message for Logged-in Non-members"
198
msgstr "Messaggio per Utenti Autenticati (Login effettuato), NON-membri."
199
200
- #: adminpages/advancedsettings.php:96 adminpages/advancedsettings.php:89
201
msgid ""
202
"This message replaces the post content for non-members. Available variables"
203
msgstr ""
204
"Questo messaggio sostituisce il contenuto del post per i NON-membri. "
205
"Variabili disponibili"
206
207
- #: adminpages/advancedsettings.php:101 adminpages/advancedsettings.php:94
208
msgid "Message for Logged-out Users"
209
msgstr "Messaggio per Visitatori (NON-Autenticati - Login NON effettuato)"
210
211
- #: adminpages/advancedsettings.php:105 adminpages/advancedsettings.php:98
212
msgid "This message replaces the post content for logged-out visitors."
213
msgstr ""
214
"Questo messaggio sostituisce il contenuto del post per i Visitatori (NON-"
215
"Autenticati - Login NON effettuato)"
216
217
- #: adminpages/advancedsettings.php:110 adminpages/advancedsettings.php:103
218
msgid "Message for RSS Feed"
219
msgstr "Messaggio per Feed RSS"
220
221
- #: adminpages/advancedsettings.php:114 adminpages/advancedsettings.php:107
222
msgid "This message replaces the post content in RSS feeds."
223
msgstr "Questo messaggio sostituisce il contenuto del post nei Feed RSS"
224
225
- #: adminpages/advancedsettings.php:120 adminpages/advancedsettings.php:113
226
msgid "Show Excerpts to Non-Members?"
227
msgstr "Mostrare Estratto per i NON-Membri?"
228
229
- #: adminpages/advancedsettings.php:124 adminpages/advancedsettings.php:117
230
msgid "No - Hide excerpts."
231
msgstr "No - Nascondi estratto."
232
233
- #: adminpages/advancedsettings.php:125 adminpages/advancedsettings.php:118
234
msgid "Yes - Show excerpts."
235
msgstr "Si - Mostra estratto."
236
237
- #: adminpages/advancedsettings.php:135 adminpages/advancedsettings.php:194
238
- #: adminpages/advancedsettings.php:206 adminpages/membershiplevels.php:571
239
#: adminpages/paymentsettings.php:434 adminpages/paymentsettings.php:459
240
#: includes/profile.php:123 adminpages/advancedsettings.php:128
241
- #: adminpages/advancedsettings.php:187 adminpages/advancedsettings.php:199
242
- #: adminpages/membershiplevels.php:563 adminpages/membershiplevels.php:569
243
- #: adminpages/paymentsettings.php:414 adminpages/paymentsettings.php:429
244
- #: adminpages/paymentsettings.php:454 includes/profile.php:121
245
msgid "No"
246
msgstr "No"
247
248
- #: adminpages/advancedsettings.php:136 adminpages/advancedsettings.php:129
249
msgid "Hide Ads From All Members"
250
msgstr "Nascondi Annunci da tutti i membri"
251
252
- #: adminpages/advancedsettings.php:137 adminpages/advancedsettings.php:130
253
msgid "Hide Ads From Certain Members"
254
msgstr "Nascondi Annunci da alcuni membri"
255
256
- #: adminpages/advancedsettings.php:144 adminpages/advancedsettings.php:137
257
msgid "Ads from the following plugins will be automatically turned off"
258
msgstr ""
259
"Gli Annunci per i seguenti plugins verranno automaticamente disabilitati"
260
261
- #: adminpages/advancedsettings.php:145 adminpages/advancedsettings.php:138
262
msgid "To hide ads in your template code, use code like the following"
263
msgstr ""
264
"Per nascondere gli Annunci dal codice dei tuoi template, usa il codice come "
265
"segue"
266
267
- #: adminpages/advancedsettings.php:156 adminpages/advancedsettings.php:149
268
msgid "Choose Levels to Hide Ads From"
269
msgstr "Seleziona i livelli da cui nascondere gli Annunci"
270
271
- #: adminpages/advancedsettings.php:190 adminpages/advancedsettings.php:183
272
msgid "Redirect all traffic from registration page to /susbcription/?"
273
msgstr ""
274
"Vuoi reindirizzare tutto il traffico dalla pagina di registrazione alla "
275
"pagina di /sottoscrizione/?"
276
277
- #: adminpages/advancedsettings.php:190 adminpages/advancedsettings.php:183
278
msgid "multisite only"
279
msgstr "solo per multisito"
280
281
- #: adminpages/advancedsettings.php:195 adminpages/membershiplevels.php:571
282
#: adminpages/paymentsettings.php:435 adminpages/paymentsettings.php:460
283
#: includes/profile.php:124 adminpages/advancedsettings.php:188
284
- #: adminpages/membershiplevels.php:563 adminpages/membershiplevels.php:569
285
- #: adminpages/paymentsettings.php:415 adminpages/paymentsettings.php:424
286
- #: adminpages/paymentsettings.php:430 adminpages/paymentsettings.php:455
287
- #: includes/profile.php:122
288
msgid "Yes"
289
msgstr "Si"
290
291
- #: adminpages/advancedsettings.php:202 adminpages/advancedsettings.php:195
292
msgid "Use reCAPTCHA?"
293
msgstr "Abilitare reCAPTCHA?"
294
295
- #: adminpages/advancedsettings.php:207 adminpages/advancedsettings.php:200
296
msgid "Yes - Free memberships only."
297
msgstr "Si - Solo iscrizioni gratuite."
298
299
- #: adminpages/advancedsettings.php:208 adminpages/advancedsettings.php:201
300
msgid "Yes - All memberships."
301
msgstr "Si - Tutte le iscrizioni."
302
303
- #: adminpages/advancedsettings.php:210 adminpages/advancedsettings.php:203
304
msgid "A free reCAPTCHA key is required."
305
msgstr "E' richiesta una chiave reCAPTCHA gratuita."
306
307
- #: adminpages/advancedsettings.php:210 adminpages/advancedsettings.php:203
308
msgid "Click here to signup for reCAPTCHA"
309
msgstr "Clicca qui per l'iscrizione per il reCAPTCHA"
310
311
- #: adminpages/advancedsettings.php:216 adminpages/advancedsettings.php:209
312
msgid "reCAPTCHA Public Key"
313
msgstr "reCAPTCHA Chiave Pubblica"
314
315
- #: adminpages/advancedsettings.php:219 adminpages/advancedsettings.php:212
316
msgid "reCAPTCHA Private Key"
317
msgstr "reCAPTCHA Chiave Privata"
318
319
- #: adminpages/advancedsettings.php:225 adminpages/advancedsettings.php:218
320
msgid "Require Terms of Service on signups?"
321
msgstr "Richiedere Termini di Servizio in fase di registrazione?"
322
323
- #: adminpages/advancedsettings.php:232 adminpages/advancedsettings.php:225
324
msgid ""
325
"If yes, create a WordPress page containing your TOS agreement and assign it "
326
"using the dropdown above."
@@ -328,14 +375,15 @@ msgstr ""
328
"Se si, creata una pagina contenente i Termini di Servizio e selezionala nel "
329
"menù a tendina qui sopra."
330
331
- #: adminpages/advancedsettings.php:272
332
msgid "selected"
333
msgstr "Selezionato"
334
335
- #: adminpages/advancedsettings.php:355 adminpages/pagesettings.php:251
336
#: adminpages/paymentsettings.php:532 adminpages/advancedsettings.php:284
337
- #: adminpages/pagesettings.php:209 adminpages/pagesettings.php:223
338
- #: adminpages/paymentsettings.php:485 adminpages/paymentsettings.php:526
339
msgid "Save Settings"
340
msgstr "Salva Impostazioni"
341
@@ -437,6 +485,10 @@ msgstr "Limite di Utilizzi"
437
msgid "Leave blank for unlimited uses."
438
msgstr "Se lasciato vuoto, utilizzabile illimitatamente"
439
440
#: adminpages/discountcodes.php:430 adminpages/membershiplevels.php:339
441
#: adminpages/membershiplevels.php:515 adminpages/discountcodes.php:427
442
#: adminpages/membershiplevels.php:337 adminpages/membershiplevels.php:507
@@ -1359,11 +1411,11 @@ msgstr "%d ordini trovati."
1359