Version Description
- BUG: Fixed conflicts when other plugins with older Recaptcha libraries are also activated. Prefixed our copy of the Recaptcha library and functions with pmpro_ and added code to handle cases where an older version of recaptch is used at checkout.
- BUG: Fixed warnings in pmpro_formatPrice. (Thanks, Andrea Carraro)
Download this release
Release Info
Developer | strangerstudios |
Plugin | Paid Memberships Pro |
Version | 1.8.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.8.2.1 to 1.8.2.2
- includes/functions.php +2 -2
- includes/lib/recaptchalib.php +8 -5
- includes/recaptcha.php +23 -20
- pages/checkout.php +1 -1
- paid-memberships-pro.php +2 -2
- preheaders/checkout.php +23 -4
- readme.txt +5 -1
includes/functions.php
CHANGED
@@ -1832,8 +1832,8 @@ function pmpro_formatPrice($price)
|
|
1832 |
//format number do decimals, with decimal_separator and thousands_separator
|
1833 |
$formatted = number_format($price,
|
1834 |
(isset($pmpro_currencies[$pmpro_currency]['decimals']) ? (int)$pmpro_currencies[$pmpro_currency]['decimals'] : 2),
|
1835 |
-
$pmpro_currencies[$pmpro_currency]['decimal_separator'],
|
1836 |
-
$pmpro_currencies[$pmpro_currency]['thousands_separator']
|
1837 |
);
|
1838 |
|
1839 |
//which side is the symbol on?
|
1832 |
//format number do decimals, with decimal_separator and thousands_separator
|
1833 |
$formatted = number_format($price,
|
1834 |
(isset($pmpro_currencies[$pmpro_currency]['decimals']) ? (int)$pmpro_currencies[$pmpro_currency]['decimals'] : 2),
|
1835 |
+
(isset($pmpro_currencies[$pmpro_currency]['decimal_separator']) ? $pmpro_currencies[$pmpro_currency]['decimal_separator'] : '.'),
|
1836 |
+
(isset($pmpro_currencies[$pmpro_currency]['thousands_separator']) ? $pmpro_currencies[$pmpro_currency]['thousands_separator'] : ',')
|
1837 |
);
|
1838 |
|
1839 |
//which side is the symbol on?
|
includes/lib/recaptchalib.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
|
|
3 |
* This is a PHP library that handles calling reCAPTCHA.
|
4 |
* - Documentation and latest version
|
5 |
* https://developers.google.com/recaptcha/docs/php
|
@@ -33,13 +36,13 @@
|
|
33 |
/**
|
34 |
* A ReCaptchaResponse is returned from checkAnswer().
|
35 |
*/
|
36 |
-
class
|
37 |
{
|
38 |
public $success;
|
39 |
public $errorCodes;
|
40 |
}
|
41 |
|
42 |
-
class
|
43 |
{
|
44 |
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
|
45 |
private static $_siteVerifyUrl =
|
@@ -52,7 +55,7 @@ class ReCaptcha
|
|
52 |
*
|
53 |
* @param string $secret shared secret between site and ReCAPTCHA server.
|
54 |
*/
|
55 |
-
function
|
56 |
{
|
57 |
if ($secret == null || $secret == "") {
|
58 |
die("To use reCAPTCHA you must get an API key from <a href='"
|
@@ -108,7 +111,7 @@ class ReCaptcha
|
|
108 |
{
|
109 |
// Discard empty solution submissions
|
110 |
if ($response == null || strlen($response) == 0) {
|
111 |
-
$recaptchaResponse = new
|
112 |
$recaptchaResponse->success = false;
|
113 |
$recaptchaResponse->errorCodes = 'missing-input';
|
114 |
return $recaptchaResponse;
|
@@ -124,7 +127,7 @@ class ReCaptcha
|
|
124 |
)
|
125 |
);
|
126 |
$answers = json_decode($getResponse, true);
|
127 |
-
$recaptchaResponse = new
|
128 |
|
129 |
if (trim($answers['success']) == true) {
|
130 |
$recaptchaResponse->success = true;
|
1 |
<?php
|
2 |
/**
|
3 |
+
*
|
4 |
+
* Note: The class names have been prefixed with pmpro_ to avoid conflicts with other plugins.
|
5 |
+
*
|
6 |
* This is a PHP library that handles calling reCAPTCHA.
|
7 |
* - Documentation and latest version
|
8 |
* https://developers.google.com/recaptcha/docs/php
|
36 |
/**
|
37 |
* A ReCaptchaResponse is returned from checkAnswer().
|
38 |
*/
|
39 |
+
class pmpro_ReCaptchaResponse
|
40 |
{
|
41 |
public $success;
|
42 |
public $errorCodes;
|
43 |
}
|
44 |
|
45 |
+
class pmpro_ReCaptcha
|
46 |
{
|
47 |
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
|
48 |
private static $_siteVerifyUrl =
|
55 |
*
|
56 |
* @param string $secret shared secret between site and ReCAPTCHA server.
|
57 |
*/
|
58 |
+
function pmpro_ReCaptcha($secret)
|
59 |
{
|
60 |
if ($secret == null || $secret == "") {
|
61 |
die("To use reCAPTCHA you must get an API key from <a href='"
|
111 |
{
|
112 |
// Discard empty solution submissions
|
113 |
if ($response == null || strlen($response) == 0) {
|
114 |
+
$recaptchaResponse = new pmpro_ReCaptchaResponse();
|
115 |
$recaptchaResponse->success = false;
|
116 |
$recaptchaResponse->errorCodes = 'missing-input';
|
117 |
return $recaptchaResponse;
|
127 |
)
|
128 |
);
|
129 |
$answers = json_decode($getResponse, true);
|
130 |
+
$recaptchaResponse = new pmpro_ReCaptchaResponse();
|
131 |
|
132 |
if (trim($answers['success']) == true) {
|
133 |
$recaptchaResponse->success = true;
|
includes/recaptcha.php
CHANGED
@@ -12,32 +12,35 @@ function pmpro_init_recaptcha()
|
|
12 |
{
|
13 |
global $recaptcha_publickey, $recaptcha_privatekey;
|
14 |
|
15 |
-
|
|
|
|
|
16 |
{
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
|
|
20 |
if(!function_exists('recaptcha_get_html'))
|
21 |
{
|
22 |
-
function recaptcha_get_html
|
23 |
{
|
24 |
-
$
|
25 |
-
if(!empty($locale))
|
26 |
-
{
|
27 |
-
$parts = explode("_", $locale);
|
28 |
-
$lang = $parts[0];
|
29 |
-
}
|
30 |
-
else
|
31 |
-
$lang = "en";
|
32 |
-
|
33 |
-
//filter
|
34 |
-
$lang = apply_filters('pmpro_recaptcha_lang', $lang);
|
35 |
-
?>
|
36 |
-
<div class="g-recaptcha" data-sitekey="<?php echo $pubkey;?>"></div>
|
37 |
-
<script type="text/javascript"
|
38 |
-
src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>">
|
39 |
-
</script>
|
40 |
-
<?php
|
41 |
}
|
42 |
}
|
43 |
|
12 |
{
|
13 |
global $recaptcha_publickey, $recaptcha_privatekey;
|
14 |
|
15 |
+
require_once(PMPRO_DIR . "/includes/lib/recaptchalib.php");
|
16 |
+
|
17 |
+
function pmpro_recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
18 |
{
|
19 |
+
$locale = get_locale();
|
20 |
+
if(!empty($locale))
|
21 |
+
{
|
22 |
+
$parts = explode("_", $locale);
|
23 |
+
$lang = $parts[0];
|
24 |
+
}
|
25 |
+
else
|
26 |
+
$lang = "en";
|
27 |
+
|
28 |
+
//filter
|
29 |
+
$lang = apply_filters('pmpro_recaptcha_lang', $lang);
|
30 |
+
?>
|
31 |
+
<div class="g-recaptcha" data-sitekey="<?php echo $pubkey;?>"></div>
|
32 |
+
<script type="text/javascript"
|
33 |
+
src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>">
|
34 |
+
</script>
|
35 |
+
<?php
|
36 |
}
|
37 |
|
38 |
+
//for templates using the old recaptcha_get_html
|
39 |
if(!function_exists('recaptcha_get_html'))
|
40 |
{
|
41 |
+
function recaptcha_get_html($pubkey, $error = null, $use_ssl = false)
|
42 |
{
|
43 |
+
return pmpro_recaptcha_get_html($pubkey, $error, $use_ssl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
46 |
|
pages/checkout.php
CHANGED
@@ -241,7 +241,7 @@
|
|
241 |
global $recaptcha, $recaptcha_publickey;
|
242 |
if($recaptcha == 2 || ($recaptcha == 1 && pmpro_isLevelFree($pmpro_level)))
|
243 |
{
|
244 |
-
echo
|
245 |
}
|
246 |
?>
|
247 |
</div>
|
241 |
global $recaptcha, $recaptcha_publickey;
|
242 |
if($recaptcha == 2 || ($recaptcha == 1 && pmpro_isLevelFree($pmpro_level)))
|
243 |
{
|
244 |
+
echo pmpro_recaptcha_get_html($recaptcha_publickey, NULL, true);
|
245 |
}
|
246 |
?>
|
247 |
</div>
|
paid-memberships-pro.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Paid Memberships Pro
|
4 |
Plugin URI: http://www.paidmembershipspro.com
|
5 |
Description: Plugin to Handle Memberships
|
6 |
-
Version: 1.8.2.
|
7 |
Author: Stranger Studios
|
8 |
Author URI: http://www.strangerstudios.com
|
9 |
*/
|
@@ -13,7 +13,7 @@ Author URI: http://www.strangerstudios.com
|
|
13 |
*/
|
14 |
|
15 |
//version constant
|
16 |
-
define("PMPRO_VERSION", "1.8.2.
|
17 |
|
18 |
//if the session has been started yet, start it (ignore if running from command line)
|
19 |
if(defined('STDIN') )
|
3 |
Plugin Name: Paid Memberships Pro
|
4 |
Plugin URI: http://www.paidmembershipspro.com
|
5 |
Description: Plugin to Handle Memberships
|
6 |
+
Version: 1.8.2.2
|
7 |
Author: Stranger Studios
|
8 |
Author URI: http://www.strangerstudios.com
|
9 |
*/
|
13 |
*/
|
14 |
|
15 |
//version constant
|
16 |
+
define("PMPRO_VERSION", "1.8.2.2");
|
17 |
|
18 |
//if the session has been started yet, start it (ignore if running from command line)
|
19 |
if(defined('STDIN') )
|
preheaders/checkout.php
CHANGED
@@ -390,11 +390,30 @@
|
|
390 |
global $recaptcha;
|
391 |
if (!$skip_account_fields && ($recaptcha == 2 || ($recaptcha == 1 && pmpro_isLevelFree($pmpro_level)))) {
|
392 |
global $recaptcha_privatekey;
|
393 |
-
|
394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
|
396 |
-
if (!$
|
397 |
-
$pmpro_msg = sprintf(__("reCAPTCHA failed. (%s) Please try again.", "pmpro"), $
|
398 |
$pmpro_msgt = "pmpro_error";
|
399 |
} else {
|
400 |
// Your code here to handle a successful verification
|
390 |
global $recaptcha;
|
391 |
if (!$skip_account_fields && ($recaptcha == 2 || ($recaptcha == 1 && pmpro_isLevelFree($pmpro_level)))) {
|
392 |
global $recaptcha_privatekey;
|
393 |
+
|
394 |
+
if(isset($_POST["recaptcha_challenge_field"]))
|
395 |
+
{
|
396 |
+
//using older recaptcha lib
|
397 |
+
$resp = recaptcha_check_answer($recaptcha_privatekey,
|
398 |
+
$_SERVER["REMOTE_ADDR"],
|
399 |
+
$_POST["recaptcha_challenge_field"],
|
400 |
+
$_POST["recaptcha_response_field"]);
|
401 |
+
|
402 |
+
$recaptcha_valid = $resp->is_valid;
|
403 |
+
$recaptcha_errors = $resp->error;
|
404 |
+
}
|
405 |
+
else
|
406 |
+
{
|
407 |
+
//using newer recaptcha lib
|
408 |
+
$reCaptcha = new pmpro_ReCaptcha($recaptcha_privatekey);
|
409 |
+
$resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]);
|
410 |
+
|
411 |
+
$recaptcha_valid = $resp->success;
|
412 |
+
$recaptcha_errors = $resp->errorCodes;
|
413 |
+
}
|
414 |
|
415 |
+
if (!$recaptcha_valid) {
|
416 |
+
$pmpro_msg = sprintf(__("reCAPTCHA failed. (%s) Please try again.", "pmpro"), $recaptcha_errors);
|
417 |
$pmpro_msgt = "pmpro_error";
|
418 |
} else {
|
419 |
// Your code here to handle a successful verification
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: strangerstudios
|
|
3 |
Tags: memberships, membership, authorize.net, ecommerce, paypal, stripe, braintree, restrict access, restrict content, directory site, payflow
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.1.1
|
6 |
-
Stable tag: 1.8.2.
|
7 |
|
8 |
The easiest way to GET PAID with your WordPress site. Flexible content control by Membership Level, Reports, Affiliates and Discounts
|
9 |
|
@@ -102,6 +102,10 @@ Not sure? You can find out by doing a bit a research.
|
|
102 |
4. Offer Membership Discounts with specific price rules (restricted by level, unique pricing for each level, # of uses, expiration date.)
|
103 |
|
104 |
== Changelog ==
|
|
|
|
|
|
|
|
|
105 |
= 1.8.2.1 =
|
106 |
* BUG: Fixed issue where admins would get emails RE membership changes whenever a profile was updated even if the membership wasn't changed. (Thanks, chrisw123)
|
107 |
|
3 |
Tags: memberships, membership, authorize.net, ecommerce, paypal, stripe, braintree, restrict access, restrict content, directory site, payflow
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.1.1
|
6 |
+
Stable tag: 1.8.2.2
|
7 |
|
8 |
The easiest way to GET PAID with your WordPress site. Flexible content control by Membership Level, Reports, Affiliates and Discounts
|
9 |
|
102 |
4. Offer Membership Discounts with specific price rules (restricted by level, unique pricing for each level, # of uses, expiration date.)
|
103 |
|
104 |
== Changelog ==
|
105 |
+
= 1.8.2.2 =
|
106 |
+
* BUG: Fixed conflicts when other plugins with older Recaptcha libraries are also activated. Prefixed our copy of the Recaptcha library and functions with pmpro_ and added code to handle cases where an older version of recaptch is used at checkout.
|
107 |
+
* BUG: Fixed warnings in pmpro_formatPrice. (Thanks, Andrea Carraro)
|
108 |
+
|
109 |
= 1.8.2.1 =
|
110 |
* BUG: Fixed issue where admins would get emails RE membership changes whenever a profile was updated even if the membership wasn't changed. (Thanks, chrisw123)
|
111 |
|