Version Description
= v140725 =
(Maintenance Release) Upgrade immediately.
Download this release
Release Info
Developer | JasWSInc |
Plugin | s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) |
Version | 140725 |
Comparing to | |
See all releases |
Code changes from version 140614 to 140725
- checksum.txt +1 -1
- images/trans-bg.png +0 -0
- includes/classes/admin-css-js-in.inc.php +109 -109
- includes/classes/admin-css-js.inc.php +51 -59
- includes/classes/admin-lockouts.inc.php +129 -132
- includes/classes/auto-eots.inc.php +35 -35
- includes/classes/check-activation.inc.php +43 -51
- includes/classes/cron-jobs-in.inc.php +65 -67
- includes/classes/cron-jobs.inc.php +54 -57
- includes/classes/css-js-in.inc.php +181 -182
- includes/classes/css-js-themes.inc.php +127 -136
- includes/classes/css-js.inc.php +51 -59
- includes/classes/email-configs.inc.php +75 -75
- includes/classes/installation.inc.php +218 -211
- includes/classes/list-servers.inc.php +487 -445
- includes/classes/login-checks.inc.php +207 -204
- includes/classes/login-customizations.inc.php +214 -216
- includes/classes/login-redirects.inc.php +6 -6
- includes/classes/paypal-notify-in-billing-agreement-signup.inc.php +2 -5
- includes/classes/paypal-notify-in-cart.inc.php +1 -3
- includes/classes/paypal-notify-in-express-checkout.inc.php +2 -5
- includes/classes/paypal-notify-in-merch-pmt.inc.php +2 -5
- includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php +5 -6
- includes/classes/paypal-notify-in-send-money.inc.php +2 -5
- includes/classes/paypal-notify-in-sp-refund-reversal.inc.php +27 -29
- includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +159 -158
- includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +46 -50
- includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +87 -86
- includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php +5 -6
- includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +56 -59
- includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +763 -740
- includes/classes/paypal-notify-in-virtual-terminal.inc.php +2 -5
- includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +183 -179
- includes/classes/paypal-notify-in-web-accept-sp.inc.php +111 -112
- includes/classes/paypal-notify-in.inc.php +202 -208
- includes/classes/paypal-notify.inc.php +38 -43
- includes/classes/paypal-return-in-no-tx-data.inc.php +1 -2
- includes/classes/paypal-return-in-proxy-ty-email.inc.php +1 -2
- includes/classes/paypal-return-in-proxy-x-preview.inc.php +1 -2
- includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +33 -37
- includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +49 -49
- includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php +32 -32
- includes/classes/paypal-return-in-web-accept-sp.inc.php +16 -17
- includes/classes/paypal-return-in.inc.php +4 -6
- includes/classes/paypal-return.inc.php +38 -43
- includes/classes/paypal-utilities.inc.php +2 -2
- includes/classes/profile-mods-4bp-in.inc.php +5 -4
- includes/classes/profile-mods-in.inc.php +4 -3
- includes/classes/registrations.inc.php +56 -43
- includes/classes/return-templates.inc.php +6 -6
- includes/classes/ruris.inc.php +6 -6
- includes/classes/sc-paypal-button-e.inc.php +1 -1
- includes/classes/sc-paypal-button-in.inc.php +88 -88
- includes/classes/tracking-codes.inc.php +203 -230
- includes/classes/tracking-cookies-in.inc.php +89 -95
- includes/classes/tracking-cookies.inc.php +51 -59
- includes/classes/translations.inc.php +151 -157
- includes/classes/user-access.inc.php +4 -4
- includes/classes/user-deletions.inc.php +214 -219
- includes/classes/user-securities.inc.php +133 -127
- includes/classes/users-list-in.inc.php +18 -2
- includes/classes/utils-logs.inc.php +218 -212
- includes/classes/utils-strings.inc.php +2 -2
- includes/classes/utils-users.inc.php +373 -345
- includes/hooks.inc.php +2 -1
- includes/menu-pages/api-ops.inc.php +23 -15
checksum.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
a5a97b396b6173a3fb461b92da759019
|
images/trans-bg.png
ADDED
Binary file
|
includes/classes/admin-css-js-in.inc.php
CHANGED
@@ -1,120 +1,120 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Administrative CSS/JS for menu pages (inner processing routines).
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Admin_CSS_JS
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
|
20 |
if(!class_exists("c_ws_plugin__s2member_admin_css_js_in"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
101 |
-
|
102 |
-
for($n = 0, $labels = ""; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
103 |
-
$labels .= "labels['level".$n."'] = '".((!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"])) ? str_replace('"', "", c_ws_plugin__s2member_utils_strings::esc_js_sq($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"], 3)) : "")."';";
|
104 |
-
unset($n);
|
105 |
-
|
106 |
-
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-min.js";
|
107 |
-
|
108 |
-
echo /* Add a line break before inclusion of this file. */"\n";
|
109 |
-
|
110 |
-
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s-min.js";
|
111 |
-
|
112 |
-
do_action("ws_plugin__s2member_during_menu_pages_js", get_defined_vars());
|
113 |
-
|
114 |
-
exit /* Clean exit. */();
|
115 |
-
}
|
116 |
-
do_action("ws_plugin__s2member_after_menu_pages_js", get_defined_vars());
|
117 |
-
}
|
118 |
}
|
|
|
|
|
119 |
}
|
120 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Administrative CSS/JS for menu pages (inner processing routines).
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Admin_CSS_JS
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
|
20 |
if(!class_exists("c_ws_plugin__s2member_admin_css_js_in"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Administrative CSS/JS for menu pages (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Admin_CSS_JS
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_admin_css_js_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Outputs the CSS for administrative menu pages.
|
32 |
+
*
|
33 |
+
* @package s2Member\Admin_CSS_JS
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*
|
38 |
+
* @return null Or exits script execution after loading CSS.
|
39 |
+
*/
|
40 |
+
public static function menu_pages_css()
|
41 |
+
{
|
42 |
+
do_action("ws_plugin__s2member_before_menu_pages_css", get_defined_vars());
|
43 |
+
|
44 |
+
if(!empty($_GET["ws_plugin__s2member_menu_pages_css"]) && is_user_logged_in() && current_user_can("create_users"))
|
45 |
{
|
46 |
+
status_header(200); // 200 OK status header.
|
47 |
+
|
48 |
+
header("Content-Type: text/css; charset=UTF-8");
|
49 |
+
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT");
|
50 |
+
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
51 |
+
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
52 |
+
header("Pragma: no-cache");
|
53 |
+
|
54 |
+
while(@ob_end_clean()) ; // Clean any existing output buffers.
|
55 |
+
|
56 |
+
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
57 |
+
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
58 |
+
|
59 |
+
ob_start("c_ws_plugin__s2member_utils_css::compress_css");
|
60 |
+
|
61 |
+
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages.css";
|
62 |
+
|
63 |
+
echo "\n"; // Add a line break before inclusion of this file.
|
64 |
+
|
65 |
+
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s.css";
|
66 |
+
|
67 |
+
do_action("ws_plugin__s2member_during_menu_pages_css", get_defined_vars());
|
68 |
+
|
69 |
+
exit(); // Clean exit.
|
70 |
+
}
|
71 |
+
do_action("ws_plugin__s2member_after_menu_pages_css", get_defined_vars());
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Outputs the JS for administrative menu pages.
|
76 |
+
*
|
77 |
+
* @package s2Member\Admin_CSS_JS
|
78 |
+
* @since 3.5
|
79 |
+
*
|
80 |
+
* @attaches-to ``add_action("init");``
|
81 |
+
*
|
82 |
+
* @return null Or exits script execution after loading JS.
|
83 |
+
*/
|
84 |
+
public static function menu_pages_js()
|
85 |
+
{
|
86 |
+
do_action("ws_plugin__s2member_before_menu_pages_js", get_defined_vars());
|
87 |
+
|
88 |
+
if(!empty($_GET["ws_plugin__s2member_menu_pages_js"]) && is_user_logged_in() && current_user_can("create_users"))
|
89 |
+
{
|
90 |
+
status_header(200); // 200 OK status header.
|
91 |
+
|
92 |
+
header("Content-Type: application/x-javascript; charset=UTF-8");
|
93 |
+
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT");
|
94 |
+
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
95 |
+
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
96 |
+
header("Pragma: no-cache");
|
97 |
+
|
98 |
+
while(@ob_end_clean()) ; // Clean any existing output buffers.
|
99 |
+
|
100 |
+
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
101 |
+
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
102 |
+
|
103 |
+
for($n = 0, $labels = ""; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
104 |
+
$labels .= "labels['level".$n."'] = '".((!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"])) ? str_replace('"', "", c_ws_plugin__s2member_utils_strings::esc_js_sq($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"], 3)) : "")."';";
|
105 |
+
unset($n);
|
106 |
+
|
107 |
+
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-min.js";
|
108 |
+
|
109 |
+
echo "\n"; // Add a line break before inclusion of this file.
|
110 |
+
|
111 |
+
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s-min.js";
|
112 |
+
|
113 |
+
do_action("ws_plugin__s2member_during_menu_pages_js", get_defined_vars());
|
114 |
+
|
115 |
+
exit(); // Clean exit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
+
do_action("ws_plugin__s2member_after_menu_pages_js", get_defined_vars());
|
118 |
+
}
|
119 |
}
|
120 |
+
}
|
includes/classes/admin-css-js.inc.php
CHANGED
@@ -1,66 +1,58 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Administrative CSS/JS for menu pages.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Admin_CSS_JS
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
*
|
50 |
-
* @package s2Member\Admin_CSS_JS
|
51 |
-
* @since 3.5
|
52 |
-
*
|
53 |
-
* @attaches-to ``add_action("init");``
|
54 |
-
*
|
55 |
-
* @return null|inner Return-value of inner routine.
|
56 |
-
*/
|
57 |
-
public static function menu_pages_js ()
|
58 |
-
{
|
59 |
-
if (!empty($_GET["ws_plugin__s2member_menu_pages_js"]))
|
60 |
-
{
|
61 |
-
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
}
|
66 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Administrative CSS/JS for menu pages.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Admin_CSS_JS
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_admin_css_js"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Administrative CSS/JS for menu pages.
|
24 |
+
*
|
25 |
+
* @package s2Member\Admin_CSS_JS
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_admin_css_js
|
29 |
{
|
30 |
/**
|
31 |
+
* Outputs the CSS for administrative menu pages.
|
32 |
+
*
|
33 |
+
* @package s2Member\Admin_CSS_JS
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*/
|
38 |
+
public static function menu_pages_css()
|
39 |
+
{
|
40 |
+
if(!empty($_GET["ws_plugin__s2member_menu_pages_css"]))
|
41 |
+
c_ws_plugin__s2member_admin_css_js_in::menu_pages_css();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Outputs the JS for administrative menu pages.
|
46 |
+
*
|
47 |
+
* @package s2Member\Admin_CSS_JS
|
48 |
+
* @since 3.5
|
49 |
+
*
|
50 |
+
* @attaches-to ``add_action("init");``
|
51 |
+
*/
|
52 |
+
public static function menu_pages_js()
|
53 |
+
{
|
54 |
+
if(!empty($_GET["ws_plugin__s2member_menu_pages_js"]))
|
55 |
+
c_ws_plugin__s2member_admin_css_js_in::menu_pages_js();
|
56 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
+
}
|
includes/classes/admin-lockouts.inc.php
CHANGED
@@ -1,139 +1,136 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Locks Users/Members out of admin panels.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Admin_Lockouts
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
do_action("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
|
54 |
-
|
55 |
-
return /* Return for uniformity. */;
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Filters administrative menu bar for Users/Members.
|
59 |
-
*
|
60 |
-
* @package s2Member\Admin_Lockouts
|
61 |
-
* @since 3.5
|
62 |
-
*
|
63 |
-
* @attaches-to ``add_action("admin_bar_menu");``
|
64 |
-
*
|
65 |
-
* @param object $wp_admin_bar Expects the ``$wp_admin_bar``, by reference; passed in by the Action Hook.
|
66 |
-
* @return null After modifying ``$wp_admin_var``.
|
67 |
-
*/
|
68 |
-
public static function filter_admin_menu_bar (&$wp_admin_bar = FALSE)
|
69 |
-
{
|
70 |
-
do_action("ws_plugin__s2member_before_filter_admin_menu_bar", get_defined_vars ());
|
71 |
-
|
72 |
-
$uses_nodes = (version_compare (get_bloginfo ("version"), "3.3-RC1", ">=")) ? true : false;
|
73 |
-
|
74 |
-
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* Always for Users/Members. */)
|
75 |
-
{
|
76 |
-
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("site-name"))
|
77 |
-
{
|
78 |
-
$id = /* Give this a special/unique ID. */ "s2-site-name";
|
79 |
-
$title = wp_html_excerpt /* A brief excerpt. */ (get_bloginfo ("name"), 42);
|
80 |
-
$title = ($title !== get_bloginfo ("name")) ? trim ($title) . "…" : $title;
|
81 |
-
$href = /* Change to front page. */ site_url ("/");
|
82 |
-
|
83 |
-
$wp_admin_bar->add_node (array("id" => $id, "title" => $title, "href" => $href));
|
84 |
-
$wp_admin_bar->remove_node /* Ditch now, replacing this. */ ("site-name");
|
85 |
-
|
86 |
-
unset /* A little housekeeping. */ ($id, $title, $href);
|
87 |
-
}
|
88 |
-
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("wp-logo"))
|
89 |
-
$wp_admin_bar->remove_node /* Ditch this node. */ ("wp-logo");
|
90 |
-
// -------
|
91 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"dashboard"}))
|
92 |
-
unset /* Ditch this item. */ ($wp_admin_bar->menu->{"dashboard"});
|
93 |
-
|
94 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-blogs"}))
|
95 |
-
unset /* Ditch this item. */ ($wp_admin_bar->menu->{"my-blogs"});
|
96 |
-
// -------
|
97 |
-
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-sites"))
|
98 |
-
$wp_admin_bar->remove_node /* Ditch this node. */ ("my-sites");
|
99 |
-
}
|
100 |
-
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* If locking Users/Members out of `/wp-admin/` areas. */)
|
101 |
-
if (apply_filters("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
|
102 |
-
{
|
103 |
-
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ();
|
104 |
-
$lwp = (!$lwp) ? get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) : $lwp;
|
105 |
-
|
106 |
-
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-account"))
|
107 |
-
$wp_admin_bar->add_node /* Update this node. */ (array("id" => "my-account", "href" => $lwp));
|
108 |
-
|
109 |
-
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("user-info"))
|
110 |
-
$wp_admin_bar->add_node /* Update this node. */ (array("id" => "user-info", "href" => $lwp));
|
111 |
-
|
112 |
-
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("edit-profile"))
|
113 |
-
$wp_admin_bar->add_node /* Update this node. */ (array("id" => "edit-profile", "href" => $lwp));
|
114 |
-
// -------
|
115 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["href"]))
|
116 |
-
$wp_admin_bar->menu->{"my-account"}["href"] = /* Update this item. */ $lwp;
|
117 |
-
|
118 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["children"]->{"edit-profile"}["href"]))
|
119 |
-
$wp_admin_bar->menu->{"my-account"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
|
120 |
-
|
121 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["children"]->{"user-info"}["href"]))
|
122 |
-
$wp_admin_bar->menu->{"my-account"}["children"]->{"user-info"}["href"] = /* Update this item. */ $lwp;
|
123 |
-
// -------
|
124 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["href"]))
|
125 |
-
$wp_admin_bar->menu->{"my-account-with-avatar"}["href"] = /* Update this item. */ $lwp;
|
126 |
-
|
127 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"user-info"}["href"]))
|
128 |
-
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"user-info"}["href"] = /* Update this item. */ $lwp;
|
129 |
-
|
130 |
-
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"]))
|
131 |
-
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
|
132 |
-
}
|
133 |
-
do_action("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
|
134 |
-
|
135 |
-
return /* Return for uniformity. */;
|
136 |
-
}
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Locks Users/Members out of admin panels.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Admin_Lockouts
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_admin_lockouts'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Locks Users/Members out of admin panels.
|
24 |
+
*
|
25 |
+
* @package s2Member\Admin_Lockouts
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_admin_lockouts
|
29 |
{
|
30 |
/**
|
31 |
+
* Locks Users/Members out of admin panels.
|
32 |
+
*
|
33 |
+
* @package s2Member\Admin_Lockouts
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('admin_init');``
|
37 |
+
*
|
38 |
+
* @return null Or exits script execution after redirection.
|
39 |
+
*/
|
40 |
+
public static function admin_lockout()
|
41 |
+
{
|
42 |
+
do_action('ws_plugin__s2member_before_admin_lockouts', get_defined_vars());
|
43 |
+
|
44 |
+
if(is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX) && !current_user_can('edit_posts') /* Give Filters a chance here too. */)
|
45 |
+
if(apply_filters('ws_plugin__s2member_admin_lockout', $GLOBALS['WS_PLUGIN__']['s2member']['o']['force_admin_lockouts'], get_defined_vars()))
|
46 |
+
{
|
47 |
+
if($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url())
|
48 |
+
wp_redirect($redirection_url).exit ( /* Special Redirection. */);
|
49 |
+
|
50 |
+
else // Else we use the Login Welcome Page configured for s2Member.
|
51 |
+
wp_redirect(get_page_link($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'])).exit ();
|
52 |
+
}
|
53 |
+
do_action('ws_plugin__s2member_after_admin_lockouts', get_defined_vars());
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Filters administrative menu bar for Users/Members.
|
58 |
+
*
|
59 |
+
* @package s2Member\Admin_Lockouts
|
60 |
+
* @since 3.5
|
61 |
+
*
|
62 |
+
* @attaches-to ``add_action('admin_bar_menu');``
|
63 |
+
*
|
64 |
+
* @param WP_Admin_Bar $wp_admin_bar Expects the ``$wp_admin_bar``, by reference; passed in by the Action Hook.
|
65 |
+
*
|
66 |
+
* @return null After modifying ``$wp_admin_var``.
|
67 |
+
*/
|
68 |
+
public static function filter_admin_menu_bar(&$wp_admin_bar)
|
69 |
+
{
|
70 |
+
do_action('ws_plugin__s2member_before_filter_admin_menu_bar', get_defined_vars());
|
71 |
+
|
72 |
+
$uses_nodes = (version_compare(get_bloginfo('version'), '3.3-RC1', '>=')) ? TRUE : FALSE;
|
73 |
+
|
74 |
+
if(is_object($wp_admin_bar) && !current_user_can('edit_posts') /* Always for Users/Members. */)
|
75 |
{
|
76 |
+
if($uses_nodes && $wp_admin_bar->get_node('site-name'))
|
77 |
+
{
|
78 |
+
$id = 's2-site-name'; // Give this a special/unique ID.
|
79 |
+
$title = wp_html_excerpt(get_bloginfo('name'), 42); // A brief excerpt.
|
80 |
+
$title = ($title !== get_bloginfo('name')) ? trim($title).'…' : $title;
|
81 |
+
$href = site_url('/'); // Change to front page.
|
82 |
+
|
83 |
+
$wp_admin_bar->add_node(array('id' => $id, 'title' => $title, 'href' => $href));
|
84 |
+
$wp_admin_bar->remove_node('site-name');
|
85 |
+
|
86 |
+
unset($id, $title, $href); // Housekeeping.
|
87 |
+
}
|
88 |
+
if($uses_nodes && $wp_admin_bar->get_node('wp-logo'))
|
89 |
+
$wp_admin_bar->remove_node('wp-logo');
|
90 |
+
// -------
|
91 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'dashboard'}))
|
92 |
+
unset ($wp_admin_bar->menu->{'dashboard'});
|
93 |
+
|
94 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-blogs'}))
|
95 |
+
unset ($wp_admin_bar->menu->{'my-blogs'});
|
96 |
+
// -------
|
97 |
+
if($uses_nodes && $wp_admin_bar->get_node('my-sites'))
|
98 |
+
$wp_admin_bar->remove_node('my-sites');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
+
if(is_object($wp_admin_bar) && !current_user_can('edit_posts') /* If locking Users/Members out of `/wp-admin/` areas. */)
|
101 |
+
if(apply_filters('ws_plugin__s2member_admin_lockout', $GLOBALS['WS_PLUGIN__']['s2member']['o']['force_admin_lockouts'], get_defined_vars()))
|
102 |
+
{
|
103 |
+
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url();
|
104 |
+
$lwp = (!$lwp) ? get_page_link($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']) : $lwp;
|
105 |
+
|
106 |
+
if($uses_nodes && $wp_admin_bar->get_node('my-account'))
|
107 |
+
$wp_admin_bar->add_node(array('id' => 'my-account', 'href' => $lwp));
|
108 |
+
|
109 |
+
if($uses_nodes && $wp_admin_bar->get_node('user-info'))
|
110 |
+
$wp_admin_bar->add_node(array('id' => 'user-info', 'href' => $lwp));
|
111 |
+
|
112 |
+
if($uses_nodes && $wp_admin_bar->get_node('edit-profile'))
|
113 |
+
$wp_admin_bar->add_node(array('id' => 'edit-profile', 'href' => $lwp));
|
114 |
+
// -------
|
115 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-account'}['href']))
|
116 |
+
$wp_admin_bar->menu->{'my-account'}['href'] = $lwp;
|
117 |
+
|
118 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-account'}['children']->{'edit-profile'}['href']))
|
119 |
+
$wp_admin_bar->menu->{'my-account'}['children']->{'edit-profile'}['href'] = $lwp;
|
120 |
+
|
121 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-account'}['children']->{'user-info'}['href']))
|
122 |
+
$wp_admin_bar->menu->{'my-account'}['children']->{'user-info'}['href'] = $lwp;
|
123 |
+
// -------
|
124 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-account-with-avatar'}['href']))
|
125 |
+
$wp_admin_bar->menu->{'my-account-with-avatar'}['href'] = $lwp;
|
126 |
+
|
127 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-account-with-avatar'}['children']->{'user-info'}['href']))
|
128 |
+
$wp_admin_bar->menu->{'my-account-with-avatar'}['children']->{'user-info'}['href'] = $lwp;
|
129 |
+
|
130 |
+
if(!$uses_nodes && isset ($wp_admin_bar->menu->{'my-account-with-avatar'}['children']->{'edit-profile'}['href']))
|
131 |
+
$wp_admin_bar->menu->{'my-account-with-avatar'}['children']->{'edit-profile'}['href'] = $lwp;
|
132 |
+
}
|
133 |
+
do_action('ws_plugin__s2member_after_filter_admin_menu_bar', get_defined_vars());
|
134 |
+
}
|
135 |
}
|
136 |
+
}
|
includes/classes/auto-eots.inc.php
CHANGED
@@ -131,6 +131,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
131 |
$subscr_gateway = get_user_option ("s2member_subscr_gateway", $user_id);
|
132 |
$subscr_id = get_user_option ("s2member_subscr_id", $user_id);
|
133 |
$subscr_baid = get_user_option ("s2member_subscr_baid", $user_id);
|
|
|
134 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
135 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id);
|
136 |
|
@@ -153,9 +154,10 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
153 |
$user->remove_cap ($ccap = $cap);
|
154 |
|
155 |
delete_user_option ($user_id, "s2member_custom");
|
|
|
156 |
delete_user_option ($user_id, "s2member_subscr_id");
|
157 |
delete_user_option ($user_id, "s2member_subscr_baid");
|
158 |
-
delete_user_option ($user_id, "
|
159 |
|
160 |
delete_user_option ($user_id, "s2member_ipn_signup_vars");
|
161 |
if (!apply_filters("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
|
@@ -177,17 +179,17 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
177 |
{
|
178 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
|
179 |
|
180 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::
|
181 |
-
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
182 |
-
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
183 |
-
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
184 |
-
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
185 |
-
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
186 |
-
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
187 |
{
|
188 |
if (is_array($fields) && !empty($fields))
|
189 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
190 |
-
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
191 |
break;
|
192 |
|
193 |
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
@@ -204,6 +206,8 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
204 |
|
205 |
$msg .= "eot_del_type: %%eot_del_type%%\n";
|
206 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
|
|
|
|
207 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
208 |
$msg .= "user_last_name: %%user_last_name%%\n";
|
209 |
$msg .= "user_full_name: %%user_full_name%%\n";
|
@@ -227,26 +231,26 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
227 |
$msg .= "cv8: %%cv8%%\n";
|
228 |
$msg .= "cv9: %%cv9%%";
|
229 |
|
230 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
231 |
-
if (($msg = preg_replace ("/%%
|
232 |
-
if (($msg = preg_replace ("/%%
|
233 |
-
if (($msg = preg_replace ("/%%
|
234 |
-
if (($msg = preg_replace ("/%%
|
235 |
-
if (($msg = preg_replace ("/%%
|
236 |
-
if (($msg = preg_replace ("/%%
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
}
|
251 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
252 |
do_action("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
|
@@ -283,15 +287,11 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
283 |
}
|
284 |
}
|
285 |
}
|
286 |
-
|
287 |
-
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients /* Cleanup. */ ();
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
|
291 |
unset($__refs, $__v);
|
292 |
-
|
293 |
-
return /* Return for uniformity. */;
|
294 |
}
|
295 |
}
|
296 |
-
}
|
297 |
-
?>
|
131 |
$subscr_gateway = get_user_option ("s2member_subscr_gateway", $user_id);
|
132 |
$subscr_id = get_user_option ("s2member_subscr_id", $user_id);
|
133 |
$subscr_baid = get_user_option ("s2member_subscr_baid", $user_id);
|
134 |
+
$subscr_cid = get_user_option ("s2member_subscr_cid", $user_id);
|
135 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
136 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id);
|
137 |
|
154 |
$user->remove_cap ($ccap = $cap);
|
155 |
|
156 |
delete_user_option ($user_id, "s2member_custom");
|
157 |
+
delete_user_option ($user_id, "s2member_subscr_gateway");
|
158 |
delete_user_option ($user_id, "s2member_subscr_id");
|
159 |
delete_user_option ($user_id, "s2member_subscr_baid");
|
160 |
+
delete_user_option ($user_id, "s2member_subscr_cid");
|
161 |
|
162 |
delete_user_option ($user_id, "s2member_ipn_signup_vars");
|
163 |
if (!apply_filters("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
|
179 |
{
|
180 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
|
181 |
|
182 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ("auto-eot-cancellation-expiration-demotion")), $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($subscr_id)), $url)))
|
183 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->last_name)), $url)))
|
184 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
185 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_email)), $url)))
|
186 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_login)), $url)))
|
187 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_reg_ip)), $url)))
|
188 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
189 |
{
|
190 |
if (is_array($fields) && !empty($fields))
|
191 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
192 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
193 |
break;
|
194 |
|
195 |
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
206 |
|
207 |
$msg .= "eot_del_type: %%eot_del_type%%\n";
|
208 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
209 |
+
$msg .= "subscr_baid: %%subscr_baid%%\n";
|
210 |
+
$msg .= "subscr_cid: %%subscr_cid%%\n";
|
211 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
212 |
$msg .= "user_last_name: %%user_last_name%%\n";
|
213 |
$msg .= "user_full_name: %%user_full_name%%\n";
|
231 |
$msg .= "cv8: %%cv8%%\n";
|
232 |
$msg .= "cv9: %%cv9%%";
|
233 |
|
234 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ("auto-eot-cancellation-expiration-demotion"), $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($subscr_id), $msg)))
|
235 |
+
if (($msg = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($subscr_baid), $msg)) && ($msg = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($subscr_cid), $msg)))
|
236 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
237 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
238 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
239 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
240 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
241 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
242 |
+
{
|
243 |
+
if (is_array($fields) && !empty($fields))
|
244 |
+
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
245 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
246 |
+
break;
|
247 |
+
|
248 |
+
if /* Still have a ``$sbj`` and a ``$msg``? */ ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
249 |
+
|
250 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
251 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
252 |
+
}
|
253 |
+
if($email_configs_were_on) c_ws_plugin__s2member_email_configs::email_config ();
|
254 |
}
|
255 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
256 |
do_action("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
|
287 |
}
|
288 |
}
|
289 |
}
|
290 |
+
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients();
|
|
|
291 |
|
292 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
293 |
do_action("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
|
294 |
unset($__refs, $__v);
|
|
|
|
|
295 |
}
|
296 |
}
|
297 |
+
}
|
|
includes/classes/check-activation.inc.php
CHANGED
@@ -1,58 +1,50 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's self re-activation routines.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Installation
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
{
|
42 |
-
if (!($v = get_option ("ws_plugin__s2member_activated_version")) || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
|
43 |
-
{
|
44 |
-
c_ws_plugin__s2member_installation::activate ("version");
|
45 |
-
}
|
46 |
-
else if (is_multisite () && is_main_site () && (!($mms_v = get_option ("ws_plugin__s2member_activated_mms_version")) || !version_compare ($mms_v, WS_PLUGIN__S2MEMBER_VERSION, ">=")))
|
47 |
-
{
|
48 |
-
c_ws_plugin__s2member_installation::activate ("mms_version");
|
49 |
-
}
|
50 |
-
else if (!($l = (int)get_option ("ws_plugin__s2member_activated_levels")) || $l !== $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"])
|
51 |
-
{
|
52 |
-
c_ws_plugin__s2member_installation::activate ("levels");
|
53 |
-
}
|
54 |
-
return /* Return for uniformity. */;
|
55 |
-
}
|
56 |
-
}
|
57 |
}
|
58 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's self re-activation routines.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Installation
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_check_activation"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member's self re-activation routines.
|
24 |
+
*
|
25 |
+
* @package s2Member\Installation
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_check_activation
|
29 |
{
|
30 |
/**
|
31 |
+
* Checks for existing installs that are NOT yet re-activated.
|
32 |
+
*
|
33 |
+
* @package s2Member\Installation
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("admin_init");``
|
37 |
+
*/
|
38 |
+
public static function check()
|
39 |
+
{
|
40 |
+
if(!($v = get_option("ws_plugin__s2member_activated_version")) || !version_compare($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
|
41 |
+
c_ws_plugin__s2member_installation::activate("version");
|
42 |
+
|
43 |
+
else if(is_multisite() && is_main_site() && (!($mms_v = get_option("ws_plugin__s2member_activated_mms_version")) || !version_compare($mms_v, WS_PLUGIN__S2MEMBER_VERSION, ">=")))
|
44 |
+
c_ws_plugin__s2member_installation::activate("mms_version");
|
45 |
+
|
46 |
+
else if(!($l = (int)get_option("ws_plugin__s2member_activated_levels")) || $l !== $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"])
|
47 |
+
c_ws_plugin__s2member_installation::activate("levels");
|
48 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
+
}
|
includes/classes/cron-jobs-in.inc.php
CHANGED
@@ -1,79 +1,77 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Cron routines handled by s2Member (inner processing routines).
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Cron_Jobs
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
* @return array Array of WP_Cron schedules after having added a 10 minute cycle.
|
40 |
-
*/
|
41 |
-
public static function extend_cron_schedules ($schedules = array())
|
42 |
-
{
|
43 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
-
do_action("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
|
45 |
-
unset($__refs, $__v);
|
46 |
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
|
53 |
-
*
|
54 |
-
* @package s2Member\Cron_Jobs
|
55 |
-
* @since 3.5
|
56 |
-
*
|
57 |
-
* @attaches-to ``add_action("init");``
|
58 |
-
*
|
59 |
-
* @return null Or exits script execution after task completed.
|
60 |
-
*/
|
61 |
-
public static function auto_eot_system_via_cron ()
|
62 |
-
{
|
63 |
-
do_action("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
77 |
}
|
|
|
|
|
78 |
}
|
79 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Cron routines handled by s2Member (inner processing routines).
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Cron_Jobs
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_cron_jobs_in"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Cron routines handled by s2Member (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Cron_Jobs
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_cron_jobs_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Extends WP-Cron schedules to support 10 minute intervals.
|
32 |
+
*
|
33 |
+
* @package s2Member\Cron_Jobs
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_filter("cron_schedules");``
|
37 |
+
*
|
38 |
+
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter.
|
39 |
+
*
|
40 |
+
* @return array Array of WP_Cron schedules after having added a 10 minute cycle.
|
41 |
+
*/
|
42 |
+
public static function extend_cron_schedules($schedules = array())
|
43 |
+
{
|
44 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
45 |
+
do_action("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars());
|
46 |
+
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
$array = array("every10m" => array("interval" => 600, "display" => "Every 10 Minutes"));
|
49 |
|
50 |
+
return apply_filters("ws_plugin__s2member_extend_cron_schedules", array_merge($array, $schedules), get_defined_vars());
|
51 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
/**
|
54 |
+
* Allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
|
55 |
+
*
|
56 |
+
* @package s2Member\Cron_Jobs
|
57 |
+
* @since 3.5
|
58 |
+
*
|
59 |
+
* @attaches-to ``add_action("init");``
|
60 |
+
*/
|
61 |
+
public static function auto_eot_system_via_cron()
|
62 |
+
{
|
63 |
+
do_action("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars());
|
64 |
|
65 |
+
if(!empty($_GET["s2member_auto_eot_system_via_cron"]))
|
66 |
+
{
|
67 |
+
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
|
68 |
+
{
|
69 |
+
c_ws_plugin__s2member_auto_eots::auto_eot_system(); // Process.
|
70 |
+
do_action("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars());
|
71 |
+
}
|
72 |
+
exit(); // Clean exit.
|
73 |
}
|
74 |
+
do_action("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars());
|
75 |
+
}
|
76 |
}
|
77 |
+
}
|
includes/classes/cron-jobs.inc.php
CHANGED
@@ -1,64 +1,61 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Cron routines handled by s2Member.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Cron_Jobs
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
*
|
53 |
-
* @return null|inner Return-value of inner routine.
|
54 |
-
*/
|
55 |
-
public static function auto_eot_system_via_cron ()
|
56 |
-
{
|
57 |
-
if (!empty($_GET["s2member_auto_eot_system_via_cron"]))
|
58 |
-
{
|
59 |
-
return c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron ();
|
60 |
-
}
|
61 |
-
}
|
62 |
-
}
|
63 |
}
|
64 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Cron routines handled by s2Member.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Cron_Jobs
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_cron_jobs"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Cron routines handled by s2Member.
|
24 |
+
*
|
25 |
+
* @package s2Member\Cron_Jobs
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_cron_jobs
|
29 |
{
|
30 |
/**
|
31 |
+
* Extends WP-Cron schedules to support 10 minute intervals.
|
32 |
+
*
|
33 |
+
* @package s2Member\Cron_Jobs
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_filter("cron_schedules");``
|
37 |
+
*
|
38 |
+
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter.
|
39 |
+
*
|
40 |
+
* @return array Return-value of inner routine.
|
41 |
+
*/
|
42 |
+
public static function extend_cron_schedules($schedules = array())
|
43 |
+
{
|
44 |
+
return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules($schedules);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
|
49 |
+
*
|
50 |
+
* @package s2Member\Cron_Jobs
|
51 |
+
* @since 3.5
|
52 |
+
*
|
53 |
+
* @attaches-to ``add_action("init");``
|
54 |
+
*/
|
55 |
+
public static function auto_eot_system_via_cron()
|
56 |
+
{
|
57 |
+
if(!empty($_GET["s2member_auto_eot_system_via_cron"]))
|
58 |
+
c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron();
|
59 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
+
}
|
includes/classes/css-js-in.inc.php
CHANGED
@@ -1,201 +1,200 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* CSS/JS loading handlers for s2Member (inner processing routines).
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\CSS_JS
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
|
20 |
if(!class_exists("c_ws_plugin__s2member_css_js_in"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
* Outputs CSS for theme integration.
|
32 |
-
*
|
33 |
-
* @package s2Member\CSS_JS
|
34 |
-
* @since 3.5
|
35 |
-
*
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null Or exits script execution after loading CSS.
|
39 |
-
*/
|
40 |
-
public static function css()
|
41 |
-
{
|
42 |
-
do_action("ws_plugin__s2member_before_css", get_defined_vars());
|
43 |
-
|
44 |
-
if(!empty($_GET["ws_plugin__s2member_css"]))
|
45 |
-
{
|
46 |
-
status_header /* 200 OK status. */(200);
|
47 |
-
|
48 |
-
header("Content-Type: text/css; charset=UTF-8");
|
49 |
-
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("+1 week"))." GMT");
|
50 |
-
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
51 |
-
header("Cache-Control: max-age=604800");
|
52 |
-
header("Pragma: public");
|
53 |
-
|
54 |
-
while (@ob_end_clean ()); // Clean any existing output buffers.
|
55 |
-
|
56 |
-
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
57 |
-
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
58 |
-
|
59 |
-
ob_start("c_ws_plugin__s2member_utils_css::compress_css");
|
60 |
-
|
61 |
-
include_once dirname(dirname(__FILE__))."/s2member.css";
|
62 |
-
|
63 |
-
do_action("ws_plugin__s2member_during_css", get_defined_vars());
|
64 |
-
|
65 |
-
exit /* Clean exit. */();
|
66 |
-
}
|
67 |
-
do_action("ws_plugin__s2member_after_css", get_defined_vars());
|
68 |
-
}
|
69 |
-
/**
|
70 |
-
* Outputs JS for theme integration.
|
71 |
-
*
|
72 |
-
* Be sure s2Member's API Constants are already defined before firing this.
|
73 |
-
*
|
74 |
-
* @package s2Member\CSS_JS
|
75 |
-
* @since 3.5
|
76 |
-
*
|
77 |
-
* @attaches-to ``add_action("init");``
|
78 |
-
*
|
79 |
-
* @return null Or exits script execution after loading JS w/Globals.
|
80 |
-
*/
|
81 |
-
public static function js_w_globals()
|
82 |
-
{
|
83 |
-
do_action("ws_plugin__s2member_before_js_w_globals", get_defined_vars());
|
84 |
-
|
85 |
-
if(!empty($_GET["ws_plugin__s2member_js_w_globals"]))
|
86 |
-
{
|
87 |
-
status_header /* 200 OK status header. */(200);
|
88 |
-
|
89 |
-
header("Content-Type: application/x-javascript; charset=UTF-8");
|
90 |
-
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("+1 week"))." GMT");
|
91 |
-
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
92 |
-
header("Cache-Control: max-age=604800");
|
93 |
-
header("Pragma: public");
|
94 |
-
|
95 |
-
while (@ob_end_clean ()); // Clean any existing output buffers.
|
96 |
-
|
97 |
-
include_once dirname(dirname(__FILE__))."/jquery/jquery.sprintf/jquery.sprintf-min.js";
|
98 |
-
|
99 |
-
echo /* Add a line break before writing JavaScript Globals to file. */ "\n";
|
100 |
-
|
101 |
-
echo "var S2MEMBER_VERSION = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_VERSION)."',";
|
102 |
-
|
103 |
-
echo "S2MEMBER_CURRENT_USER_LOGIN_COUNTER = ".S2MEMBER_CURRENT_USER_LOGIN_COUNTER.",";
|
104 |
-
|
105 |
-
echo "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = ".((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false").",";
|
106 |
-
echo "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = ".((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false").",";
|
107 |
-
|
108 |
-
echo "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = ".S2MEMBER_CURRENT_USER_ACCESS_LEVEL.",";
|
109 |
-
echo "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_ACCESS_LABEL)."',";
|
110 |
-
|
111 |
-
echo "S2MEMBER_CURRENT_USER_SUBSCR_ID = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_SUBSCR_ID)."',";
|
112 |
-
echo "S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID)."',";
|
113 |
-
echo "S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY)."',";
|
114 |
-
echo "S2MEMBER_CURRENT_USER_CUSTOM = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_CUSTOM)."',";
|
115 |
-
|
116 |
-
echo "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = ".S2MEMBER_CURRENT_USER_REGISTRATION_TIME.",";
|
117 |
-
echo "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME = ".S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME.",";
|
118 |
-
|
119 |
-
echo "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = ".S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS.",";
|
120 |
-
echo "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = ".S2MEMBER_CURRENT_USER_REGISTRATION_DAYS.",";
|
121 |
-
|
122 |
-
echo "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_DISPLAY_NAME)."',";
|
123 |
-
echo "S2MEMBER_CURRENT_USER_FIRST_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_FIRST_NAME)."',";
|
124 |
-
echo "S2MEMBER_CURRENT_USER_LAST_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_LAST_NAME)."',";
|
125 |
-
|
126 |
-
echo "S2MEMBER_CURRENT_USER_LOGIN = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_LOGIN)."',";
|
127 |
-
echo "S2MEMBER_CURRENT_USER_EMAIL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_EMAIL)."',";
|
128 |
-
echo "S2MEMBER_CURRENT_USER_IP = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_IP)."',";
|
129 |
-
echo "S2MEMBER_CURRENT_USER_REGISTRATION_IP = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_REGISTRATION_IP)."',";
|
130 |
-
|
131 |
-
echo "S2MEMBER_CURRENT_USER_ID = ".S2MEMBER_CURRENT_USER_ID.",";
|
132 |
-
echo "S2MEMBER_CURRENT_USER_FIELDS = ".S2MEMBER_CURRENT_USER_FIELDS.",";
|
133 |
-
|
134 |
-
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = ".S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED.",";
|
135 |
-
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = ".((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false").",";
|
136 |
-
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = ".S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY.",";
|
137 |
-
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = ".S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS.",";
|
138 |
-
|
139 |
-
echo "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = ".S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID.",";
|
140 |
-
echo "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = ".S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID.",";
|
141 |
-
echo "S2MEMBER_LOGIN_WELCOME_PAGE_ID = ".S2MEMBER_LOGIN_WELCOME_PAGE_ID.",";
|
142 |
-
|
143 |
-
echo "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL)."',";
|
144 |
-
echo "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL)."',";
|
145 |
-
echo "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL)."',";
|
146 |
-
echo "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_LOGIN_WELCOME_PAGE_URL)."',";
|
147 |
-
echo "S2MEMBER_LOGOUT_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_LOGOUT_PAGE_URL)."',";
|
148 |
-
echo "S2MEMBER_LOGIN_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_LOGIN_PAGE_URL)."',";
|
149 |
-
|
150 |
-
for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
151 |
-
{
|
152 |
-
if(defined(($S2MEMBER_LEVELn_LABEL = "S2MEMBER_LEVEL".$n."_LABEL")))
|
153 |
-
echo $S2MEMBER_LEVELn_LABEL." = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(constant($S2MEMBER_LEVELn_LABEL))."',";
|
154 |
-
}
|
155 |
-
for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
156 |
-
{
|
157 |
-
if(defined(($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED = "S2MEMBER_LEVEL".$n."_FILE_DOWNLOADS_ALLOWED")))
|
158 |
-
echo $S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED." = ".constant($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED).",";
|
159 |
-
}
|
160 |
-
for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
161 |
-
{
|
162 |
-
if(defined(($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS = "S2MEMBER_LEVEL".$n."_FILE_DOWNLOADS_ALLOWED_DAYS")))
|
163 |
-
echo $S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS." = ".constant($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS).",";
|
164 |
-
}
|
165 |
-
echo "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS)."',";
|
166 |
-
|
167 |
-
echo "S2MEMBER_REG_EMAIL_FROM_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_REG_EMAIL_FROM_NAME)."',";
|
168 |
-
echo "S2MEMBER_REG_EMAIL_FROM_EMAIL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_REG_EMAIL_FROM_EMAIL)."',";
|
169 |
-
|
170 |
-
echo "S2MEMBER_PAYPAL_NOTIFY_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_NOTIFY_URL)."',";
|
171 |
-
echo "S2MEMBER_PAYPAL_RETURN_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_RETURN_URL)."',";
|
172 |
-
|
173 |
-
echo "S2MEMBER_PAYPAL_BUSINESS = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_BUSINESS)."',";
|
174 |
-
echo "S2MEMBER_PAYPAL_ENDPOINT = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_ENDPOINT)."',";
|
175 |
-
echo "S2MEMBER_PAYPAL_API_ENDPOINT = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_API_ENDPOINT)."',";
|
176 |
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
179 |
|
180 |
-
|
181 |
-
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0)."',";
|
182 |
|
183 |
-
|
184 |
-
|
185 |
|
186 |
-
|
187 |
-
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
-
|
196 |
-
}
|
197 |
-
do_action("ws_plugin__s2member_after_js_w_globals", get_defined_vars());
|
198 |
-
}
|
199 |
}
|
|
|
|
|
200 |
}
|
201 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* CSS/JS loading handlers for s2Member (inner processing routines).
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\CSS_JS
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
|
20 |
if(!class_exists("c_ws_plugin__s2member_css_js_in"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* CSS/JS loading handlers for s2Member (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\CSS_JS
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_css_js_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Outputs CSS for theme integration.
|
32 |
+
*
|
33 |
+
* @package s2Member\CSS_JS
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*
|
38 |
+
* @return null Or exits script execution after loading CSS.
|
39 |
+
*/
|
40 |
+
public static function css()
|
41 |
+
{
|
42 |
+
do_action("ws_plugin__s2member_before_css", get_defined_vars());
|
43 |
+
|
44 |
+
if(!empty($_GET["ws_plugin__s2member_css"]))
|
45 |
{
|
46 |
+
status_header(200); // 200 OK status header.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
header("Content-Type: text/css; charset=UTF-8");
|
49 |
+
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("+1 week"))." GMT");
|
50 |
+
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
51 |
+
header("Cache-Control: max-age=604800");
|
52 |
+
header("Pragma: public");
|
53 |
|
54 |
+
while(@ob_end_clean()) ; // Clean output buffers.
|
|
|
55 |
|
56 |
+
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
57 |
+
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
58 |
|
59 |
+
ob_start("c_ws_plugin__s2member_utils_css::compress_css");
|
|
|
60 |
|
61 |
+
include_once dirname(dirname(__FILE__))."/s2member.css";
|
62 |
|
63 |
+
do_action("ws_plugin__s2member_during_css", get_defined_vars());
|
64 |
|
65 |
+
exit(); // Clean exit.
|
66 |
+
}
|
67 |
+
do_action("ws_plugin__s2member_after_css", get_defined_vars());
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Outputs JS for theme integration.
|
72 |
+
*
|
73 |
+
* Be sure s2Member's API Constants are already defined before firing this.
|
74 |
+
*
|
75 |
+
* @package s2Member\CSS_JS
|
76 |
+
* @since 3.5
|
77 |
+
*
|
78 |
+
* @attaches-to ``add_action("init");``
|
79 |
+
*
|
80 |
+
* @return null Or exits script execution after loading JS w/Globals.
|
81 |
+
*/
|
82 |
+
public static function js_w_globals()
|
83 |
+
{
|
84 |
+
do_action("ws_plugin__s2member_before_js_w_globals", get_defined_vars());
|
85 |
+
|
86 |
+
if(!empty($_GET["ws_plugin__s2member_js_w_globals"]))
|
87 |
+
{
|
88 |
+
status_header(200); // 200 OK status header.
|
89 |
+
|
90 |
+
header("Content-Type: application/x-javascript; charset=UTF-8");
|
91 |
+
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("+1 week"))." GMT");
|
92 |
+
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
93 |
+
header("Cache-Control: max-age=604800");
|
94 |
+
header("Pragma: public");
|
95 |
+
|
96 |
+
while(@ob_end_clean()) ; // Clean output buffers.
|
97 |
+
|
98 |
+
include_once dirname(dirname(__FILE__))."/jquery/jquery.sprintf/jquery.sprintf-min.js";
|
99 |
+
|
100 |
+
echo "\n"; // Add a line break before writing JavaScript Globals to file.
|
101 |
+
|
102 |
+
echo "var S2MEMBER_VERSION = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_VERSION)."',";
|
103 |
+
|
104 |
+
echo "S2MEMBER_CURRENT_USER_LOGIN_COUNTER = ".S2MEMBER_CURRENT_USER_LOGIN_COUNTER.",";
|
105 |
+
|
106 |
+
echo "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = ".((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false").",";
|
107 |
+
echo "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = ".((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false").",";
|
108 |
+
|
109 |
+
echo "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = ".S2MEMBER_CURRENT_USER_ACCESS_LEVEL.",";
|
110 |
+
echo "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_ACCESS_LABEL)."',";
|
111 |
+
|
112 |
+
echo "S2MEMBER_CURRENT_USER_SUBSCR_ID = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_SUBSCR_ID)."',";
|
113 |
+
echo "S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID)."',";
|
114 |
+
echo "S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY)."',";
|
115 |
+
echo "S2MEMBER_CURRENT_USER_CUSTOM = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_CUSTOM)."',";
|
116 |
+
|
117 |
+
echo "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = ".S2MEMBER_CURRENT_USER_REGISTRATION_TIME.",";
|
118 |
+
echo "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME = ".S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME.",";
|
119 |
+
|
120 |
+
echo "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = ".S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS.",";
|
121 |
+
echo "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = ".S2MEMBER_CURRENT_USER_REGISTRATION_DAYS.",";
|
122 |
+
|
123 |
+
echo "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_DISPLAY_NAME)."',";
|
124 |
+
echo "S2MEMBER_CURRENT_USER_FIRST_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_FIRST_NAME)."',";
|
125 |
+
echo "S2MEMBER_CURRENT_USER_LAST_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_LAST_NAME)."',";
|
126 |
+
|
127 |
+
echo "S2MEMBER_CURRENT_USER_LOGIN = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_LOGIN)."',";
|
128 |
+
echo "S2MEMBER_CURRENT_USER_EMAIL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_EMAIL)."',";
|
129 |
+
echo "S2MEMBER_CURRENT_USER_IP = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_IP)."',";
|
130 |
+
echo "S2MEMBER_CURRENT_USER_REGISTRATION_IP = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_REGISTRATION_IP)."',";
|
131 |
+
|
132 |
+
echo "S2MEMBER_CURRENT_USER_ID = ".S2MEMBER_CURRENT_USER_ID.",";
|
133 |
+
echo "S2MEMBER_CURRENT_USER_FIELDS = ".S2MEMBER_CURRENT_USER_FIELDS.",";
|
134 |
+
|
135 |
+
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = ".S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED.",";
|
136 |
+
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = ".((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false").",";
|
137 |
+
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = ".S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY.",";
|
138 |
+
echo "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = ".S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS.",";
|
139 |
+
|
140 |
+
echo "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = ".S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID.",";
|
141 |
+
echo "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = ".S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID.",";
|
142 |
+
echo "S2MEMBER_LOGIN_WELCOME_PAGE_ID = ".S2MEMBER_LOGIN_WELCOME_PAGE_ID.",";
|
143 |
+
|
144 |
+
echo "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL)."',";
|
145 |
+
echo "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL)."',";
|
146 |
+
echo "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL)."',";
|
147 |
+
echo "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_LOGIN_WELCOME_PAGE_URL)."',";
|
148 |
+
echo "S2MEMBER_LOGOUT_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_LOGOUT_PAGE_URL)."',";
|
149 |
+
echo "S2MEMBER_LOGIN_PAGE_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_LOGIN_PAGE_URL)."',";
|
150 |
+
|
151 |
+
for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
152 |
+
{
|
153 |
+
if(defined(($S2MEMBER_LEVELn_LABEL = "S2MEMBER_LEVEL".$n."_LABEL")))
|
154 |
+
echo $S2MEMBER_LEVELn_LABEL." = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(constant($S2MEMBER_LEVELn_LABEL))."',";
|
155 |
+
}
|
156 |
+
for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
157 |
+
{
|
158 |
+
if(defined(($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED = "S2MEMBER_LEVEL".$n."_FILE_DOWNLOADS_ALLOWED")))
|
159 |
+
echo $S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED." = ".constant($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED).",";
|
160 |
+
}
|
161 |
+
for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
162 |
+
{
|
163 |
+
if(defined(($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS = "S2MEMBER_LEVEL".$n."_FILE_DOWNLOADS_ALLOWED_DAYS")))
|
164 |
+
echo $S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS." = ".constant($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS).",";
|
165 |
+
}
|
166 |
+
echo "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS)."',";
|
167 |
+
|
168 |
+
echo "S2MEMBER_REG_EMAIL_FROM_NAME = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_REG_EMAIL_FROM_NAME)."',";
|
169 |
+
echo "S2MEMBER_REG_EMAIL_FROM_EMAIL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_REG_EMAIL_FROM_EMAIL)."',";
|
170 |
+
|
171 |
+
echo "S2MEMBER_PAYPAL_NOTIFY_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_NOTIFY_URL)."',";
|
172 |
+
echo "S2MEMBER_PAYPAL_RETURN_URL = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_RETURN_URL)."',";
|
173 |
+
|
174 |
+
echo "S2MEMBER_PAYPAL_BUSINESS = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_BUSINESS)."',";
|
175 |
+
echo "S2MEMBER_PAYPAL_ENDPOINT = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_ENDPOINT)."',";
|
176 |
+
echo "S2MEMBER_PAYPAL_API_ENDPOINT = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_PAYPAL_API_ENDPOINT)."',";
|
177 |
+
|
178 |
+
echo "S2MEMBER_VALUE_FOR_PP_INV = Math.round (new Date ().getTime ()) + '~".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_IP)."',";
|
179 |
+
echo "S2MEMBER_VALUE_FOR_PP_INV_GEN = s2member_value_for_pp_inv_gen = function(){ var invoice = '', formatSeed = function(seed, reqWidth) { seed = parseInt(seed, 10).toString (16); if (reqWidth < seed.length) return seed.slice (seed.length - reqWidth); else if (reqWidth > seed.length) return Array(1 + (reqWidth - seed.length)).join ('0') + seed; return seed; }; if (typeof S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED === 'undefined') S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED = Math.floor (Math.random () * 0x75bcd15); S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED++; invoice = formatSeed(parseInt(new Date ().getTime () / 1000, 10), 8); invoice += formatSeed(S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED, 5); invoice += '~' + S2MEMBER_CURRENT_USER_IP; return invoice; },";
|
180 |
+
|
181 |
+
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0)."',";
|
182 |
+
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0)."',";
|
183 |
+
|
184 |
+
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1 = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1)."',";
|
185 |
+
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1 = '".c_ws_plugin__s2member_utils_strings::esc_js_sq(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1)."';";
|
186 |
+
|
187 |
+
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
188 |
+
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
189 |
+
|
190 |
+
echo "\n"; // Add a line break before inclusion.
|
191 |
+
include_once dirname(dirname(__FILE__))."/s2member-min.js";
|
192 |
+
|
193 |
+
do_action("ws_plugin__s2member_during_js_w_globals", get_defined_vars());
|
194 |
|
195 |
+
exit(); // Clean exit.
|
|
|
|
|
|
|
196 |
}
|
197 |
+
do_action("ws_plugin__s2member_after_js_w_globals", get_defined_vars());
|
198 |
+
}
|
199 |
}
|
200 |
+
}
|
includes/classes/css-js-themes.inc.php
CHANGED
@@ -1,143 +1,134 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* CSS/JS integrations with theme.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\CSS_JS
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$null = NULL; // Needed below in earlier versions of WP.
|
45 |
-
|
46 |
-
if(!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["lazy_load_css_js"])
|
47 |
-
$load = TRUE;
|
48 |
-
|
49 |
-
else if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())
|
50 |
-
$load = TRUE;
|
51 |
-
|
52 |
-
else if(!empty($_GET[apply_filters("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", array())]))
|
53 |
-
$load = TRUE;
|
54 |
-
|
55 |
-
else if(c_ws_plugin__s2member_utils_conds::bp_is_installed()
|
56 |
-
&& (bp_is_register_page() || bp_is_activation_page() || bp_is_user_profile()))
|
57 |
-
$load = TRUE;
|
58 |
-
|
59 |
-
else if(is_singular() && ($post = get_post($null))
|
60 |
-
&& (stripos($post->post_content, "s2member") !== FALSE
|
61 |
-
|| stripos($post->post_content, "[s2") !== FALSE))
|
62 |
-
$load = TRUE;
|
63 |
-
|
64 |
-
else if(preg_match("/\/wp\-signup\.php".
|
65 |
-
"|\/wp\-login\.php".
|
66 |
-
"|\/wp\-admin\/(?:user\/)?profile\.php".
|
67 |
-
"|[?&]s2member/", $_SERVER["REQUEST_URI"]))
|
68 |
-
$load = TRUE;
|
69 |
-
|
70 |
-
if(!isset($load)) $load = FALSE; // Make sure it's set; always.
|
71 |
-
|
72 |
-
return ($load = apply_filters("ws_plugin__s2member_lazy_load_css_js", $load));
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Enqueues CSS file for theme integration.
|
77 |
-
*
|
78 |
-
* @package s2Member\CSS_JS
|
79 |
-
* @since 3.5
|
80 |
-
*
|
81 |
-
* @attaches-to ``add_action("wp_print_styles");``
|
82 |
-
*
|
83 |
-
* @return null After enqueuing CSS for theme integration.
|
84 |
-
*/
|
85 |
-
public static function add_css ()
|
86 |
-
{
|
87 |
-
do_action("ws_plugin__s2member_before_add_css", get_defined_vars ());
|
88 |
-
|
89 |
-
if(!is_admin () && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
|
90 |
-
{
|
91 |
-
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
|
92 |
-
|
93 |
-
wp_enqueue_style ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_css=1&qcABC=1", array(), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
|
94 |
-
|
95 |
-
do_action("ws_plugin__s2member_during_add_css", get_defined_vars ());
|
96 |
-
}
|
97 |
-
do_action("ws_plugin__s2member_after_add_css", get_defined_vars ());
|
98 |
-
|
99 |
-
return /* Return for uniformity. */;
|
100 |
-
}
|
101 |
-
/**
|
102 |
-
* Enqueues JS file for theme integration.
|
103 |
-
*
|
104 |
-
* Be sure s2Member's API Constants are already defined before firing this.
|
105 |
-
*
|
106 |
-
* @package s2Member\CSS_JS
|
107 |
-
* @since 3.5
|
108 |
-
*
|
109 |
-
* @attaches-to ``add_action("wp_print_scripts");``
|
110 |
-
*
|
111 |
-
* @return null After enqueuing JS for theme integration.
|
112 |
-
*/
|
113 |
-
public static function add_js_w_globals ()
|
114 |
-
{
|
115 |
-
global /* Need this for comparisons. */ $pagenow;
|
116 |
-
|
117 |
-
do_action("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
|
118 |
-
|
119 |
-
if ((!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
|
120 |
-
|| (is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
|
121 |
-
{
|
122 |
-
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
|
123 |
-
|
124 |
-
if /* Separate version for logged-in Users/Members. */ (is_user_logged_in ())
|
125 |
-
{
|
126 |
-
$md5 = /* An MD5 hash based on global key => values. */ WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
|
127 |
-
// The MD5 hash allows the script to be cached in the browser until the globals happen to change.
|
128 |
-
// For instance, the global variables may change when a User who is logged-in changes their Profile.
|
129 |
-
wp_enqueue_script ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode ($md5) . "&qcABC=1", array("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
|
130 |
-
}
|
131 |
-
else // Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5.
|
132 |
-
{ // This essentially creates 2 versions of the script. One while logged in & another when not.
|
133 |
-
wp_enqueue_script ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
|
134 |
-
}
|
135 |
-
do_action("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
|
136 |
-
}
|
137 |
-
do_action("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
|
138 |
-
|
139 |
-
return /* Return for uniformity. */;
|
140 |
-
}
|
141 |
}
|
|
|
|
|
142 |
}
|
143 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* CSS/JS integrations with theme.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\CSS_JS
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_css_js_themes'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* CSS/JS integrations with theme.
|
24 |
+
*
|
25 |
+
* @package s2Member\CSS_JS
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_css_js_themes
|
29 |
{
|
30 |
/**
|
31 |
+
* Lazy load CSS/JS files?
|
32 |
+
*
|
33 |
+
* @package s2Member\CSS_JS
|
34 |
+
* @since 131028
|
35 |
+
*
|
36 |
+
* @return boolean TRUE if we should load; else FALSE.
|
37 |
+
*/
|
38 |
+
public static function lazy_load_css_js()
|
39 |
+
{
|
40 |
+
static $load; // Static cache var.
|
41 |
+
|
42 |
+
if(isset($load)) return $load;
|
43 |
+
|
44 |
+
$null = NULL; // Needed below in earlier versions of WP.
|
45 |
+
|
46 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['lazy_load_css_js'])
|
47 |
+
$load = TRUE;
|
48 |
+
|
49 |
+
else if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())
|
50 |
+
$load = TRUE;
|
51 |
+
|
52 |
+
else if(!empty($_GET[apply_filters('ws_plugin__s2member_check_force_ssl_get_var_name', 's2-ssl', array())]))
|
53 |
+
$load = TRUE;
|
54 |
+
|
55 |
+
else if(c_ws_plugin__s2member_utils_conds::bp_is_installed()
|
56 |
+
&& (bp_is_register_page() || bp_is_activation_page() || bp_is_user_profile())
|
57 |
+
) $load = TRUE;
|
58 |
+
|
59 |
+
else if(is_singular() && ($post = get_post($null))
|
60 |
+
&& (stripos($post->post_content, 's2member') !== FALSE || stripos($post->post_content, '[s2') !== FALSE)
|
61 |
+
) $load = TRUE;
|
62 |
+
|
63 |
+
else if(preg_match('/\/wp\-signup\.php|\/wp\-login\.php|\/wp\-admin\/(?:user\/)?profile\.php|[?&]s2member/', $_SERVER['REQUEST_URI']))
|
64 |
+
$load = TRUE;
|
65 |
+
|
66 |
+
if(!isset($load)) $load = FALSE; // Make sure it's set; always.
|
67 |
+
|
68 |
+
return ($load = apply_filters('ws_plugin__s2member_lazy_load_css_js', $load));
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Enqueues CSS file for theme integration.
|
73 |
+
*
|
74 |
+
* @package s2Member\CSS_JS
|
75 |
+
* @since 3.5
|
76 |
+
*
|
77 |
+
* @attaches-to ``add_action('wp_print_styles');``
|
78 |
+
*
|
79 |
+
* @return null After enqueuing CSS for theme integration.
|
80 |
+
*/
|
81 |
+
public static function add_css()
|
82 |
+
{
|
83 |
+
do_action('ws_plugin__s2member_before_add_css', get_defined_vars());
|
84 |
+
|
85 |
+
if(!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
|
86 |
+
{
|
87 |
+
$s2o = $GLOBALS['WS_PLUGIN__']['s2member']['c']['s2o_url'];
|
88 |
+
|
89 |
+
wp_enqueue_style('ws-plugin--s2member', $s2o.'?ws_plugin__s2member_css=1&qcABC=1', array(), c_ws_plugin__s2member_utilities::ver_checksum(), 'all');
|
90 |
+
|
91 |
+
do_action('ws_plugin__s2member_during_add_css', get_defined_vars());
|
92 |
+
}
|
93 |
+
do_action('ws_plugin__s2member_after_add_css', get_defined_vars());
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Enqueues JS file for theme integration.
|
98 |
+
*
|
99 |
+
* Be sure s2Member's API Constants are already defined before firing this.
|
100 |
+
*
|
101 |
+
* @package s2Member\CSS_JS
|
102 |
+
* @since 3.5
|
103 |
+
*
|
104 |
+
* @attaches-to ``add_action('wp_print_scripts');``
|
105 |
+
*
|
106 |
+
* @return null After enqueuing JS for theme integration.
|
107 |
+
*/
|
108 |
+
public static function add_js_w_globals()
|
109 |
+
{
|
110 |
+
global $pagenow; // Need this for comparisons.
|
111 |
+
|
112 |
+
do_action('ws_plugin__s2member_before_add_js_w_globals', get_defined_vars());
|
113 |
+
|
114 |
+
if((!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js()) || (is_user_admin() && $pagenow === 'profile.php' && !current_user_can('edit_users')))
|
115 |
{
|
116 |
+
$s2o = $GLOBALS['WS_PLUGIN__']['s2member']['c']['s2o_url'];
|
117 |
+
|
118 |
+
if(is_user_logged_in()) // Separate version for logged-in Users/Members.
|
119 |
+
{
|
120 |
+
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; // An MD5 hash based on global key => values.
|
121 |
+
// The MD5 hash allows the script to be cached in the browser until the globals happen to change.
|
122 |
+
// For instance, the global variables may change when a User who is logged-in changes their Profile.
|
123 |
+
wp_enqueue_script('ws-plugin--s2member', $s2o.'?ws_plugin__s2member_js_w_globals='.urlencode($md5).'&qcABC=1', array('jquery'), c_ws_plugin__s2member_utilities::ver_checksum(), TRUE);
|
124 |
+
}
|
125 |
+
else // Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5.
|
126 |
+
{ // This essentially creates 2 versions of the script. One while logged in & another when not.
|
127 |
+
wp_enqueue_script('ws-plugin--s2member', $s2o.'?ws_plugin__s2member_js_w_globals=1&qcABC=1', array('jquery'), c_ws_plugin__s2member_utilities::ver_checksum(), TRUE);
|
128 |
+
}
|
129 |
+
do_action('ws_plugin__s2member_during_add_js_w_globals', get_defined_vars());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
+
do_action('ws_plugin__s2member_after_add_js_w_globals', get_defined_vars());
|
132 |
+
}
|
133 |
}
|
134 |
+
}
|
includes/classes/css-js.inc.php
CHANGED
@@ -1,66 +1,58 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* CSS/JS loading handlers for s2Member.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\CSS_JS
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
*
|
50 |
-
* @package s2Member\CSS_JS
|
51 |
-
* @since 3.5
|
52 |
-
*
|
53 |
-
* @attaches-to ``add_action("init");``
|
54 |
-
*
|
55 |
-
* @return null|inner Return-value of inner routine.
|
56 |
-
*/
|
57 |
-
public static function js_w_globals ()
|
58 |
-
{
|
59 |
-
if (!empty($_GET["ws_plugin__s2member_js_w_globals"]))
|
60 |
-
{
|
61 |
-
return c_ws_plugin__s2member_css_js_in::js_w_globals ();
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
}
|
66 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* CSS/JS loading handlers for s2Member.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\CSS_JS
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_css_js"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* CSS/JS loading handlers for s2Member.
|
24 |
+
*
|
25 |
+
* @package s2Member\CSS_JS
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_css_js
|
29 |
{
|
30 |
/**
|
31 |
+
* Outputs CSS for theme integration.
|
32 |
+
*
|
33 |
+
* @package s2Member\CSS_JS
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*/
|
38 |
+
public static function css()
|
39 |
+
{
|
40 |
+
if(!empty($_GET["ws_plugin__s2member_css"]))
|
41 |
+
c_ws_plugin__s2member_css_js_in::css();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Outputs JS for theme integration.
|
46 |
+
*
|
47 |
+
* @package s2Member\CSS_JS
|
48 |
+
* @since 3.5
|
49 |
+
*
|
50 |
+
* @attaches-to ``add_action("init");``
|
51 |
+
*/
|
52 |
+
public static function js_w_globals()
|
53 |
+
{
|
54 |
+
if(!empty($_GET["ws_plugin__s2member_js_w_globals"]))
|
55 |
+
c_ws_plugin__s2member_css_js_in::js_w_globals();
|
56 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
+
}
|
includes/classes/email-configs.inc.php
CHANGED
@@ -242,45 +242,45 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
242 |
$user_ip = $_SERVER["REMOTE_ADDR"];
|
243 |
|
244 |
if (($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_subject"]))
|
245 |
-
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
246 |
-
if (($sbj = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::
|
247 |
-
if (($sbj = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
248 |
-
if (($sbj = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::
|
249 |
-
if (($sbj = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
250 |
-
if (($sbj = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
251 |
-
if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
252 |
-
if (($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
253 |
-
if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
254 |
-
if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
255 |
-
if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
256 |
-
if (($sbj = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
257 |
-
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
258 |
-
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
259 |
{
|
260 |
if (is_array($fields) && !empty($fields))
|
261 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
262 |
-
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
263 |
break;
|
264 |
|
265 |
if (($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_message"]))
|
266 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
267 |
-
if (($msg = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::
|
268 |
-
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
269 |
-
if (($msg = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::
|
270 |
-
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
271 |
-
if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
272 |
-
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
273 |
-
if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
274 |
-
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
275 |
-
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
276 |
-
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
277 |
-
if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
278 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
279 |
-
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
280 |
{
|
281 |
if (is_array($fields) && !empty($fields))
|
282 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
283 |
-
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
284 |
break;
|
285 |
|
286 |
if (($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
@@ -312,66 +312,66 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
312 |
$user_ip = $_SERVER["REMOTE_ADDR"];
|
313 |
|
314 |
if (($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]))
|
315 |
-
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
316 |
-
if (($rec = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::
|
317 |
-
if (($rec = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
318 |
-
if (($rec = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::
|
319 |
-
if (($rec = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
320 |
-
if (($rec = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
321 |
-
if (($rec = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::
|
322 |
-
if (($rec = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::
|
323 |
-
if (($rec = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::
|
324 |
-
if (($rec = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
325 |
-
if (($rec = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
326 |
-
if (($rec = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
327 |
-
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
328 |
-
if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
329 |
{
|
330 |
if (is_array($fields) && !empty($fields))
|
331 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
332 |
-
if (!($rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
333 |
break;
|
334 |
|
335 |
if (($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]))
|
336 |
-
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
337 |
-
if (($sbj = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::
|
338 |
-
if (($sbj = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
339 |
-
if (($sbj = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::
|
340 |
-
if (($sbj = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
341 |
-
if (($sbj = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
342 |
-
if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
343 |
-
if (($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
344 |
-
if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
345 |
-
if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
346 |
-
if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
347 |
-
if (($sbj = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
348 |
-
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
349 |
-
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
350 |
{
|
351 |
if (is_array($fields) && !empty($fields))
|
352 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
353 |
-
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
354 |
break;
|
355 |
|
356 |
if (($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_message"]))
|
357 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
358 |
-
if (($msg = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::
|
359 |
-
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
360 |
-
if (($msg = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::
|
361 |
-
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
362 |
-
if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
363 |
-
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
364 |
-
if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
365 |
-
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
366 |
-
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
367 |
-
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
368 |
-
if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
369 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
370 |
-
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
371 |
{
|
372 |
if (is_array($fields) && !empty($fields))
|
373 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
374 |
-
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
375 |
break;
|
376 |
|
377 |
if (($rec = trim (preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
242 |
$user_ip = $_SERVER["REMOTE_ADDR"];
|
243 |
|
244 |
if (($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_subject"]))
|
245 |
+
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)))
|
246 |
+
if (($sbj = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (wp_login_url ()), $sbj)))
|
247 |
+
if (($sbj = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($role), $sbj)))
|
248 |
+
if (($sbj = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($label), $sbj)))
|
249 |
+
if (($sbj = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($level), $sbj)))
|
250 |
+
if (($sbj = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ccaps), $sbj)))
|
251 |
+
if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $sbj)))
|
252 |
+
if (($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $sbj)))
|
253 |
+
if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_full_name), $sbj)))
|
254 |
+
if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $sbj)))
|
255 |
+
if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $sbj)))
|
256 |
+
if (($sbj = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_pass), $sbj)))
|
257 |
+
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ip), $sbj)))
|
258 |
+
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $sbj)))
|
259 |
{
|
260 |
if (is_array($fields) && !empty($fields))
|
261 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
262 |
+
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $sbj)))
|
263 |
break;
|
264 |
|
265 |
if (($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_message"]))
|
266 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)))
|
267 |
+
if (($msg = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (wp_login_url ()), $msg)))
|
268 |
+
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($role), $msg)))
|
269 |
+
if (($msg = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($label), $msg)))
|
270 |
+
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($level), $msg)))
|
271 |
+
if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ccaps), $msg)))
|
272 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)))
|
273 |
+
if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
274 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_full_name), $msg)))
|
275 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
276 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
277 |
+
if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_pass), $msg)))
|
278 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ip), $msg)))
|
279 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
280 |
{
|
281 |
if (is_array($fields) && !empty($fields))
|
282 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
283 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
284 |
break;
|
285 |
|
286 |
if (($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
312 |
$user_ip = $_SERVER["REMOTE_ADDR"];
|
313 |
|
314 |
if (($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]))
|
315 |
+
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $rec)))
|
316 |
+
if (($rec = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (wp_login_url ()), $rec)))
|
317 |
+
if (($rec = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($role), $rec)))
|
318 |
+
if (($rec = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($label), $rec)))
|
319 |
+
if (($rec = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($level), $rec)))
|
320 |
+
if (($rec = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ccaps), $rec)))
|
321 |
+
if (($rec = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name)), $rec)))
|
322 |
+
if (($rec = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name)), $rec)))
|
323 |
+
if (($rec = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($user_full_name)), $rec)))
|
324 |
+
if (($rec = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $rec)))
|
325 |
+
if (($rec = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $rec)))
|
326 |
+
if (($rec = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_pass), $rec)))
|
327 |
+
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ip), $rec)))
|
328 |
+
if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $rec)))
|
329 |
{
|
330 |
if (is_array($fields) && !empty($fields))
|
331 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
332 |
+
if (!($rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $rec)))
|
333 |
break;
|
334 |
|
335 |
if (($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]))
|
336 |
+
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)))
|
337 |
+
if (($sbj = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (wp_login_url ()), $sbj)))
|
338 |
+
if (($sbj = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($role), $sbj)))
|
339 |
+
if (($sbj = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($label), $sbj)))
|
340 |
+
if (($sbj = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($level), $sbj)))
|
341 |
+
if (($sbj = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ccaps), $sbj)))
|
342 |
+
if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $sbj)))
|
343 |
+
if (($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $sbj)))
|
344 |
+
if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_full_name), $sbj)))
|
345 |
+
if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $sbj)))
|
346 |
+
if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $sbj)))
|
347 |
+
if (($sbj = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_pass), $sbj)))
|
348 |
+
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ip), $sbj)))
|
349 |
+
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $sbj)))
|
350 |
{
|
351 |
if (is_array($fields) && !empty($fields))
|
352 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
353 |
+
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $sbj)))
|
354 |
break;
|
355 |
|
356 |
if (($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_message"]))
|
357 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)))
|
358 |
+
if (($msg = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (wp_login_url ()), $msg)))
|
359 |
+
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($role), $msg)))
|
360 |
+
if (($msg = preg_replace ("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($label), $msg)))
|
361 |
+
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($level), $msg)))
|
362 |
+
if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ccaps), $msg)))
|
363 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)))
|
364 |
+
if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
365 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_full_name), $msg)))
|
366 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
367 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
368 |
+
if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_pass), $msg)))
|
369 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ip), $msg)))
|
370 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
371 |
{
|
372 |
if (is_array($fields) && !empty($fields))
|
373 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
374 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
375 |
break;
|
376 |
|
377 |
if (($rec = trim (preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
includes/classes/installation.inc.php
CHANGED
@@ -1,220 +1,227 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Installation routines for s2Member.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Installation
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if(realpath(__FILE__) === realpath($_SERVER[
|
18 |
-
exit(
|
19 |
-
|
20 |
-
if(!class_exists(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
(
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
}
|
97 |
-
if($v && version_compare($v, "130316", "<=")) // This version disables logging by default.
|
98 |
-
{
|
99 |
-
c_ws_plugin__s2member_menu_pages::update_all_options(array("ws_plugin__s2member_gateway_debug_logs" => "0", "ws_plugin__s2member_gateway_debug_logs_extensive" => "0"), true, false, false, false, false);
|
100 |
-
|
101 |
-
$notice = '<strong>IMPORTANT:</strong> This version of s2Member disables s2Member\'s debug logging by default (for added security). Please see: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
|
102 |
-
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
|
103 |
-
|
104 |
-
$notice = '<strong>IMPORTANT / Regarding s2Member Security Badges:</strong> If debug logging is enabled, your site will no longer qualify for an s2Member Security Badge until you disable logging (and you MUST also download, and then delete any existing log files from the past). Please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member Security Badges</a> for further details. If you have existing s2Member log files, you will need to delete those files from the server before your s2Member Security Badge can be re-enabled. s2Member stores log files here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])).'</code>. See also: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
|
105 |
-
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
|
106 |
-
}
|
107 |
-
if($v && version_compare($v, "140128", "<=")) // This version introduces support for partial refunds.
|
108 |
-
{
|
109 |
-
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds,reversals") // `refunds,reversals` => `refunds,partial_refunds,reversals`
|
110 |
-
c_ws_plugin__s2member_menu_pages::update_all_options(array("ws_plugin__s2member_triggers_immediate_eot" => "refunds,partial_refunds,reversals"), true, false, false, false, false);
|
111 |
-
}
|
112 |
-
$notice = '<strong>s2Member</strong> has been <strong>reactivated</strong>, with '.(($reactivation_reason === "levels") ? '<code>'.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]).'</code> Membership Levels' : 'the latest version').'.<br />';
|
113 |
-
$notice .= 'You now have version '.esc_html(WS_PLUGIN__S2MEMBER_VERSION).'. Your existing configuration remains.';
|
114 |
-
|
115 |
-
if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) // No Changelog on a Multisite Blog Farm.
|
116 |
-
$notice .= '<br />Have fun, <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-info#rm-changelog")).'">read the Changelog</a>, and make some money! :-)';
|
117 |
-
|
118 |
-
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
|
119 |
-
}
|
120 |
-
else // Otherwise (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide.
|
121 |
-
{
|
122 |
-
$notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>(upper right-hand corner)</em>. With WordPress Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
|
123 |
-
|
124 |
-
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, "blog:users.php", false, false, true);
|
125 |
-
|
126 |
-
$notice = '<strong>s2Member</strong> v'.esc_html(WS_PLUGIN__S2MEMBER_VERSION).' has been <strong>activated</strong>. Nice work!<br />';
|
127 |
-
$notice .= 'Have fun, <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-start")).'">read the Quick Start Guide</a>, and make some money! :-)';
|
128 |
-
|
129 |
-
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
|
130 |
-
}
|
131 |
-
|
132 |
-
if(is_multisite() && is_main_site()) // Network activation routines.
|
133 |
-
{
|
134 |
-
$wpdb->query("INSERT INTO `".$wpdb->usermeta."` (`user_id`, `meta_key`, `meta_value`) SELECT `ID`, 's2member_originating_blog', '".esc_sql($current_site->blog_id)."' FROM `".$wpdb->users."` WHERE `ID` NOT IN (SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE `meta_key` = 's2member_originating_blog')");
|
135 |
-
|
136 |
-
$notice = '<strong>Multisite Network</strong> updated automatically by <strong>s2Member</strong> v'.esc_html(WS_PLUGIN__S2MEMBER_VERSION).'.<br />';
|
137 |
-
$notice .= 'You\'ll want to configure s2Member\'s Multisite options now.<br />';
|
138 |
-
$notice .= 'In the Dashboard for your Main Site, see:<br />';
|
139 |
-
$notice .= '<code>s2Member -› Multisite (Config)</code>.';
|
140 |
-
|
141 |
-
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
|
142 |
-
|
143 |
-
update_site_option("ws_plugin__s2member_options", (array)get_option("ws_plugin__s2member_options"));
|
144 |
-
|
145 |
-
update_option("ws_plugin__s2member_activated_mms_version", WS_PLUGIN__S2MEMBER_VERSION);
|
146 |
-
}
|
147 |
-
|
148 |
-
update_option("ws_plugin__s2member_activated_version", WS_PLUGIN__S2MEMBER_VERSION);
|
149 |
-
|
150 |
-
do_action("ws_plugin__s2member_after_activation", get_defined_vars());
|
151 |
-
|
152 |
-
return /* Return for uniformity. */;
|
153 |
-
}
|
154 |
-
/**
|
155 |
-
* Deactivation routines for s2Member.
|
156 |
-
*
|
157 |
-
* @package s2Member\Installation
|
158 |
-
* @since 3.5
|
159 |
-
*
|
160 |
-
* @return null
|
161 |
-
*/
|
162 |
-
public static function deactivate()
|
163 |
-
{
|
164 |
-
global /* Global database object reference. */ $wpdb;
|
165 |
-
global /* Multisite. */ $current_site, $current_blog;
|
166 |
-
|
167 |
-
do_action("ws_plugin__s2member_before_deactivation", get_defined_vars());
|
168 |
-
|
169 |
-
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
|
170 |
-
{
|
171 |
-
c_ws_plugin__s2member_roles_caps::unlink_roles /* Unlink Roles/Caps. */();
|
172 |
-
|
173 |
-
c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess /* Remove GZIP exclusions. */();
|
174 |
-
|
175 |
-
if(is_dir($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
|
176 |
-
{
|
177 |
-
if(file_exists($htaccess = $files_dir."/.htaccess"))
|
178 |
-
if(is_writable($htaccess))
|
179 |
-
unlink($htaccess);
|
180 |
-
|
181 |
-
@rmdir($files_dir).@rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir));
|
182 |
-
}
|
183 |
-
|
184 |
-
if(is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
185 |
-
{
|
186 |
-
foreach(scandir($logs_dir) as $log_file)
|
187 |
-
if(is_file($log_file = $logs_dir."/".$log_file))
|
188 |
-
if(is_writable($log_file))
|
189 |
-
unlink($log_file);
|
190 |
-
|
191 |
-
@rmdir($logs_dir).@rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir));
|
192 |
-
}
|
193 |
-
|
194 |
-
delete_option("ws_plugin__s2member_cache");
|
195 |
-
delete_option("ws_plugin__s2member_notices");
|
196 |
-
delete_option("ws_plugin__s2member_options");
|
197 |
-
delete_option("ws_plugin__s2member_configured");
|
198 |
-
delete_option("ws_plugin__s2member_activated_levels");
|
199 |
-
delete_option("ws_plugin__s2member_activated_version");
|
200 |
-
delete_option("ws_plugin__s2member_activated_mms_version");
|
201 |
-
|
202 |
-
if(is_multisite() && is_main_site() /* Site options? */)
|
203 |
-
delete_site_option("ws_plugin__s2member_options");
|
204 |
-
|
205 |
-
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '%".esc_sql(like_escape("s2member_"))."%'");
|
206 |
-
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '".esc_sql(like_escape("_transient_s2m_"))."%'");
|
207 |
-
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '".esc_sql(like_escape("_transient_timeout_s2m_"))."%'");
|
208 |
-
$wpdb->query("DELETE FROM `".$wpdb->postmeta."` WHERE `meta_key` LIKE '%".esc_sql(like_escape("s2member_"))."%'");
|
209 |
-
$wpdb->query("DELETE FROM `".$wpdb->usermeta."` WHERE `meta_key` LIKE '%".esc_sql(like_escape("s2member_"))."%'");
|
210 |
-
|
211 |
-
do_action("ws_plugin__s2member_during_deactivation", get_defined_vars());
|
212 |
-
}
|
213 |
|
214 |
-
|
215 |
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
|
|
|
|
219 |
}
|
220 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Installation routines for s2Member.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Installation
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_installation'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Installation routines for s2Member.
|
24 |
+
*
|
25 |
+
* @package s2Member\Installation
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_installation
|
29 |
{
|
30 |
/**
|
31 |
+
* Activation routines for s2Member.
|
32 |
+
*
|
33 |
+
* @package s2Member\Installation
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @param string $reactivation_reason Optional.
|
37 |
+
*/
|
38 |
+
public static function activate($reactivation_reason = '')
|
39 |
+
{
|
40 |
+
global $wpdb;
|
41 |
+
/** @var $wpdb wpdb */
|
42 |
+
global $current_site, $current_blog; // Multisite.
|
43 |
+
|
44 |
+
do_action('ws_plugin__s2member_before_activation', get_defined_vars());
|
45 |
+
|
46 |
+
c_ws_plugin__s2member_roles_caps::config_roles(); // Config Roles/Caps.
|
47 |
+
update_option('ws_plugin__s2member_activated_levels', $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']);
|
48 |
+
|
49 |
+
if(!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir']))
|
50 |
+
if(is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir))))
|
51 |
+
mkdir($files_dir, 0777, TRUE);
|
52 |
+
|
53 |
+
if(is_dir($files_dir) && is_writable($files_dir))
|
54 |
+
if(!file_exists($htaccess = $files_dir.'/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_files_dir_htaccess', FALSE, get_defined_vars()))
|
55 |
+
file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir_htaccess']))));
|
56 |
+
|
57 |
+
c_ws_plugin__s2member_files::write_no_gzip_into_root_htaccess(); // Handle the root `.htaccess` file as well now, for GZIP exclusions.
|
58 |
+
|
59 |
+
if(!is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
60 |
+
if(is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir))))
|
61 |
+
mkdir($logs_dir, 0777, TRUE);
|
62 |
+
|
63 |
+
if(is_dir($logs_dir) && is_writable($logs_dir))
|
64 |
+
if(!file_exists($htaccess = $logs_dir.'/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_logs_dir_htaccess', FALSE, get_defined_vars()))
|
65 |
+
file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir_htaccess']))));
|
66 |
+
|
67 |
+
(!is_array(get_option('ws_plugin__s2member_cache'))) ? update_option('ws_plugin__s2member_cache', array()) : NULL;
|
68 |
+
(!is_array(get_option('ws_plugin__s2member_notices'))) ? update_option('ws_plugin__s2member_notices', array()) : NULL;
|
69 |
+
(!is_array(get_option('ws_plugin__s2member_options'))) ? update_option('ws_plugin__s2member_options', array()) : NULL;
|
70 |
+
(!is_numeric(get_option('ws_plugin__s2member_configured'))) ? update_option('ws_plugin__s2member_configured', '0') : NULL;
|
71 |
+
|
72 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['c']['configured']) // If we are re-activating.
|
73 |
{
|
74 |
+
$v = get_option('ws_plugin__s2member_activated_version'); // Currently.
|
75 |
+
|
76 |
+
if(!$v || !version_compare($v, '3.2', '>=')) // Needs to be upgraded?
|
77 |
+
// Version 3.2 is where `meta_key` names were changed. They're prefixed now.
|
78 |
+
{
|
79 |
+
$like = "`meta_key` LIKE 's2member\\_%' AND `meta_key` NOT LIKE '%s2member\\_originating\\_blog%'";
|
80 |
+
$wpdb->query("UPDATE `".$wpdb->usermeta."` SET `meta_key` = CONCAT('".$wpdb->prefix."', `meta_key`) WHERE ".$like);
|
81 |
+
}
|
82 |
+
if(!$v || !version_compare($v, '3.2.5', '>=')) // Needs to be upgraded?
|
83 |
+
// Version 3.2.5 is where transient names were changed. They're prefixed now.
|
84 |
+
{
|
85 |
+
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '\\_transient\\_%'");
|
86 |
+
}
|
87 |
+
if(!$v || !version_compare($v, '3.2.6', '>=')) // Needs to be upgraded?
|
88 |
+
// Version 3.2.6 fixed `s2member_ccaps_req` being stored empty and/or w/ one empty element in the array.
|
89 |
+
{
|
90 |
+
$wpdb->query("DELETE FROM `".$wpdb->postmeta."` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` IN('','a:0:{}','a:1:{i:0;s:0:\"\";}')");
|
91 |
+
}
|
92 |
+
if(!$v || !version_compare($v, '110912', '>=') && $GLOBALS['WS_PLUGIN__']['s2member']['o']['filter_wp_query'] === array('all'))
|
93 |
+
// s2Member v110912 changed the way the 'all' option for Alternative Views was handled.
|
94 |
+
{
|
95 |
+
$notice = '<strong>IMPORTANT:</strong> This version of s2Member changes the way your <code>Alternative View Protections</code> work. Please review your options under: <code>s2Member -› Restriction Options -› Alternative View Protections</code>.';
|
96 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
|
97 |
+
}
|
98 |
+
if($v && version_compare($v, '130316', '<=')) // This version disables logging by default.
|
99 |
+
{
|
100 |
+
c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_gateway_debug_logs' => '0', 'ws_plugin__s2member_gateway_debug_logs_extensive' => '0'), TRUE, FALSE, FALSE, FALSE, FALSE);
|
101 |
+
|
102 |
+
$notice = '<strong>IMPORTANT:</strong> This version of s2Member disables s2Member\'s debug logging by default (for added security). Please see: <a href="'.esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-logs')).'">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
|
103 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
|
104 |
+
|
105 |
+
$notice = '<strong>IMPORTANT / Regarding s2Member Security Badges:</strong> If debug logging is enabled, your site will no longer qualify for an s2Member Security Badge until you disable logging (and you MUST also download, and then delete any existing log files from the past). Please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member Security Badges</a> for further details. If you have existing s2Member log files, you will need to delete those files from the server before your s2Member Security Badge can be re-enabled. s2Member stores log files here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'])).'</code>. See also: <a href="'.esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-logs')).'">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
|
106 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
|
107 |
+
}
|
108 |
+
if($v && version_compare($v, '140128', '<=')) // This version introduces support for partial refunds.
|
109 |
+
{
|
110 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,reversals') // `refunds,reversals` => `refunds,partial_refunds,reversals`
|
111 |
+
c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_triggers_immediate_eot' => 'refunds,partial_refunds,reversals'), TRUE, FALSE, FALSE, FALSE, FALSE);
|
112 |
+
}
|
113 |
+
$notice = '<strong>s2Member</strong> has been <strong>reactivated</strong>, with '.(($reactivation_reason === 'levels') ? '<code>'.esc_html($GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']).'</code> Membership Levels' : 'the latest version').'.<br />';
|
114 |
+
$notice .= 'You now have version '.esc_html(WS_PLUGIN__S2MEMBER_VERSION).'. Your existing configuration remains.';
|
115 |
+
|
116 |
+
if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) // No Changelog on a Multisite Blog Farm.
|
117 |
+
$notice .= '<br />Have fun, <a href="'.esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-info#rm-changelog')).'">read the Changelog</a>, and make some money! :-)';
|
118 |
+
|
119 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
|
120 |
+
}
|
121 |
+
else // Otherwise (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide.
|
122 |
+
{
|
123 |
+
$notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>(upper right-hand corner)</em>. With WordPress Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
|
124 |
+
|
125 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, 'blog:users.php', FALSE, FALSE, TRUE);
|
126 |
+
|
127 |
+
$notice = '<strong>s2Member</strong> v'.esc_html(WS_PLUGIN__S2MEMBER_VERSION).' has been <strong>activated</strong>. Nice work!<br />';
|
128 |
+
$notice .= 'Have fun, <a href="'.esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-start')).'">read the Quick Start Guide</a>, and make some money! :-)';
|
129 |
+
|
130 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
|
131 |
+
}
|
132 |
+
if(is_multisite() && is_main_site()) // Network activation routines.
|
133 |
+
{
|
134 |
+
$wpdb->query("INSERT INTO `".$wpdb->usermeta."` (`user_id`, `meta_key`, `meta_value`) SELECT `ID`, 's2member_originating_blog', '".esc_sql($current_site->blog_id)."' FROM `".$wpdb->users."` WHERE `ID` NOT IN (SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE `meta_key` = 's2member_originating_blog')");
|
135 |
+
|
136 |
+
$notice = '<strong>Multisite Network</strong> updated automatically by <strong>s2Member</strong> v'.esc_html(WS_PLUGIN__S2MEMBER_VERSION).'.<br />';
|
137 |
+
$notice .= 'You\'ll want to configure s2Member\'s Multisite options now.<br />';
|
138 |
+
$notice .= 'In the Dashboard for your Main Site, see:<br />';
|
139 |
+
$notice .= '<code>s2Member -› Multisite (Config)</code>.';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
+
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
|
142 |
|
143 |
+
update_site_option('ws_plugin__s2member_options', (array)get_option('ws_plugin__s2member_options'));
|
144 |
+
|
145 |
+
update_option('ws_plugin__s2member_activated_mms_version', WS_PLUGIN__S2MEMBER_VERSION);
|
146 |
+
}
|
147 |
+
update_option('ws_plugin__s2member_activated_version', WS_PLUGIN__S2MEMBER_VERSION);
|
148 |
+
|
149 |
+
do_action('ws_plugin__s2member_after_activation', get_defined_vars());
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Deactivation routines for s2Member.
|
154 |
+
*
|
155 |
+
* @package s2Member\Installation
|
156 |
+
* @since 3.5
|
157 |
+
*/
|
158 |
+
public static function deactivate()
|
159 |
+
{
|
160 |
+
global $wpdb;
|
161 |
+
/** @var $wpdb wpdb */
|
162 |
+
global $current_site, $current_blog; // Multisite.
|
163 |
+
|
164 |
+
do_action('ws_plugin__s2member_before_deactivation', get_defined_vars());
|
165 |
+
do_action('ws_plugin__s2member_after_deactivation', get_defined_vars());
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Uninstall routines for s2Member.
|
170 |
+
*
|
171 |
+
* @package s2Member\Installation
|
172 |
+
* @since 3.5
|
173 |
+
*/
|
174 |
+
public static function uninstall()
|
175 |
+
{
|
176 |
+
global $wpdb;
|
177 |
+
/** @var $wpdb wpdb */
|
178 |
+
global $current_site, $current_blog; // Multisite.
|
179 |
+
|
180 |
+
do_action('ws_plugin__s2member_before_uninstall', get_defined_vars());
|
181 |
+
|
182 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['run_uninstall_routines'])
|
183 |
+
{
|
184 |
+
c_ws_plugin__s2member_roles_caps::unlink_roles();
|
185 |
+
|
186 |
+
c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess();
|
187 |
+
|
188 |
+
if(is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir']))
|
189 |
+
{
|
190 |
+
if(file_exists($htaccess = $files_dir.'/.htaccess'))
|
191 |
+
if(is_writable($htaccess))
|
192 |
+
unlink($htaccess);
|
193 |
+
|
194 |
+
@rmdir($files_dir).@rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir));
|
195 |
+
}
|
196 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
197 |
+
{
|
198 |
+
foreach(scandir($logs_dir) as $log_file)
|
199 |
+
if(is_file($log_file = $logs_dir.'/'.$log_file))
|
200 |
+
if(is_writable($log_file))
|
201 |
+
unlink($log_file);
|
202 |
+
|
203 |
+
@rmdir($logs_dir).@rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir));
|
204 |
+
}
|
205 |
+
delete_option('ws_plugin__s2member_cache');
|
206 |
+
delete_option('ws_plugin__s2member_notices');
|
207 |
+
delete_option('ws_plugin__s2member_options');
|
208 |
+
delete_option('ws_plugin__s2member_configured');
|
209 |
+
delete_option('ws_plugin__s2member_activated_levels');
|
210 |
+
delete_option('ws_plugin__s2member_activated_version');
|
211 |
+
delete_option('ws_plugin__s2member_activated_mms_version');
|
212 |
+
|
213 |
+
if(is_multisite() && is_main_site() /* Site options? */)
|
214 |
+
delete_site_option('ws_plugin__s2member_options');
|
215 |
+
|
216 |
+
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '%".esc_sql(like_escape('s2member_'))."%'");
|
217 |
+
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '".esc_sql(like_escape('_transient_s2m_'))."%'");
|
218 |
+
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE `option_name` LIKE '".esc_sql(like_escape('_transient_timeout_s2m_'))."%'");
|
219 |
+
$wpdb->query("DELETE FROM `".$wpdb->postmeta."` WHERE `meta_key` LIKE '%".esc_sql(like_escape('s2member_'))."%'");
|
220 |
+
$wpdb->query("DELETE FROM `".$wpdb->usermeta."` WHERE `meta_key` LIKE '%".esc_sql(like_escape('s2member_'))."%'");
|
221 |
+
|
222 |
+
do_action('ws_plugin__s2member_during_uninstall', get_defined_vars());
|
223 |
}
|
224 |
+
do_action('ws_plugin__s2member_after_uninstall', get_defined_vars());
|
225 |
+
}
|
226 |
}
|
227 |
+
}
|
includes/classes/list-servers.inc.php
CHANGED
@@ -1,481 +1,523 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* List Server integrations.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\List_Servers
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit(
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
{
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
* @since 3.5
|
53 |
-
*
|
54 |
-
* @param string $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`.
|
55 |
-
* @param int|string $level A numeric s2Member Access Level number.
|
56 |
-
* @param string $login Username for the User.
|
57 |
-
* @param string $pass Plain Text Password for the User.
|
58 |
-
* @param string $email Email Address for the User.
|
59 |
-
* @param string $fname First Name for the User.
|
60 |
-
* @param string $lname Last Name for the User.
|
61 |
-
* @param string $ip IP Address for the User.
|
62 |
-
* @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in.
|
63 |
-
* @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk.
|
64 |
-
* @param int|string $user_id A WordPress User ID, numeric string or integer.
|
65 |
-
* @return bool True if at least one List Server is processed successfully, else false.
|
66 |
-
*
|
67 |
-
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
68 |
-
* @todo Add a separate option for mail debugging; or consolidate?
|
69 |
-
* @todo Integrate AWeber API (much like the MailChimp API).
|
70 |
-
*/
|
71 |
-
public static function process_list_servers ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE, $double_opt_in = TRUE, $user_id = FALSE)
|
72 |
{
|
73 |
-
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
{
|
81 |
-
$
|
82 |
-
|
83 |
-
$
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
{
|
95 |
-
$mailchimp = array("function" => __FUNCTION__, "func_get_args" => $args, "api_method" => "listSubscribe");
|
96 |
-
|
97 |
-
if (($mailchimp["list"] = trim ($mailchimp_list)))
|
98 |
-
{
|
99 |
-
if (strpos ($mailchimp["list"], "::") !== false) // Also contains Interest Groups?
|
100 |
-
{
|
101 |
-
list ($mailchimp["list_id"], $mailchimp["interest_groups_title"], $mailchimp["interest_groups"]) = preg_split ("/\:\:/", $mailchimp["list"], 3);
|
102 |
-
|
103 |
-
if /* This is a title configured by the list master. */ (($mailchimp["interest_groups_title"] = trim ($mailchimp["interest_groups_title"])))
|
104 |
-
if (($mailchimp["interest_groups"] = (trim ($mailchimp["interest_groups"])) ? preg_split ("/\|/", trim ($mailchimp["interest_groups"])) : false))
|
105 |
-
$mailchimp["interest_groups"] = array("GROUPINGS" => array(array("name" => $mailchimp["interest_groups_title"], "groups" => implode (",", $mailchimp["interest_groups"]))));
|
106 |
-
|
107 |
-
if /* Need to double-check this. If empty, skip over this entry. */ (empty($mailchimp["list_id"]))
|
108 |
-
continue /* Continue to next List, if there is one. */;
|
109 |
-
}
|
110 |
-
else // Else, it's just a List ID.
|
111 |
-
$mailchimp["list_id"] = $mailchimp["list"];
|
112 |
-
|
113 |
-
$fname = (!$fname) ? ucwords (strstr($email, '@', TRUE)) : $fname; $lname = (!$lname) ? '-' : $lname;
|
114 |
-
$name = ($fname || $lname) ? trim ($fname . " " . $lname) : ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
115 |
-
$mailchimp["merge_array"] = array("MERGE1" => $fname, "MERGE2" => $lname, "OPTIN_IP" => $ip, "OPTIN_TIME" => date ("Y-m-d H:i:s"));
|
116 |
-
$mailchimp["merge_array"] = (!empty($mailchimp["interest_groups"])) ? array_merge ($mailchimp["merge_array"], $mailchimp["interest_groups"]) : $mailchimp["merge_array"];
|
117 |
-
$mailchimp["merge_array"] = apply_filters( /* Deprecated. */"ws_plugin__s2member_mailchimp_array", $mailchimp["merge_array"], get_defined_vars ());
|
118 |
-
// Filter: `ws_plugin__s2member_mailchimp_array` deprecated in v110523. Please use Filter: `ws_plugin__s2member_mailchimp_merge_array`.
|
119 |
-
|
120 |
-
if ($mailchimp["api_response"] = $mcapi->{$mailchimp["api_method"]}($mailchimp["list_id"], $email, // See: `http://apidocs.mailchimp.com/` for full details.
|
121 |
-
($mailchimp["api_merge_array"] = apply_filters("ws_plugin__s2member_mailchimp_merge_array", $mailchimp["merge_array"], get_defined_vars ())), // Configured merge array above.
|
122 |
-
($mailchimp["api_email_type"] = apply_filters("ws_plugin__s2member_mailchimp_email_type", "html", get_defined_vars ())), // Type of email to receive (i.e. html,text,mobile).
|
123 |
-
($mailchimp["api_double_optin"] = apply_filters("ws_plugin__s2member_mailchimp_double_optin", $double_opt_in, get_defined_vars ())), // Abuse of this may cause account suspension.
|
124 |
-
($mailchimp["api_update_existing"] = apply_filters("ws_plugin__s2member_mailchimp_update_existing", true, get_defined_vars ())), // Existing subscribers should be updated with this?
|
125 |
-
($mailchimp["api_replace_interests"] = apply_filters("ws_plugin__s2member_mailchimp_replace_interests", true, get_defined_vars ())), // Replace interest groups? (only if provided).
|
126 |
-
($mailchimp["api_send_welcome"] = apply_filters("ws_plugin__s2member_mailchimp_send_welcome", false, get_defined_vars ())))) // See documentation. This is a weird option.
|
127 |
-
$mailchimp["api_success"] = $success = true; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
128 |
-
$mailchimp["api_properties"] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
129 |
-
|
130 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
131 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
132 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
133 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
134 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
135 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "mailchimp-api-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "mailchimp-api.log";
|
136 |
-
|
137 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
138 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
139 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
140 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
141 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
142 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($mailchimp, true)) . "\n\n",
|
143 |
-
FILE_APPEND);
|
144 |
-
}
|
145 |
-
}
|
146 |
-
}
|
147 |
-
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]))
|
148 |
-
{
|
149 |
-
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list)
|
150 |
-
{
|
151 |
-
$getresponse = array("function" => __FUNCTION__, "func_get_args" => $args, "api_method" => "add_contact");
|
152 |
-
|
153 |
-
if (($getresponse["list_id"] = $getresponse["list"] = trim ($getresponse_list)))
|
154 |
-
{
|
155 |
-
$getresponse["api_method"] = "add_contact";
|
156 |
-
$getresponse["api_headers"] = array("Content-Type" => "application/json");
|
157 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("campaigns" => array($getresponse["list_id"]), "email" => array("EQUALS" => $email)));
|
158 |
-
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
159 |
-
$name = ($fname || $lname) ? trim ($fname . " " . $lname) : ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
160 |
-
|
161 |
-
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && ($getresponse["api_response_contact_ids"] = array_keys((array)$getresponse["api_response"]->result)) && ($getresponse["api_response_contact_id"] = $getresponse["api_response_contact_ids"][0]))
|
162 |
-
{
|
163 |
-
$getresponse["api_method"] = "set_contact_name";
|
164 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"], "name" => $name));
|
165 |
-
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
166 |
-
|
167 |
-
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error))
|
168 |
-
{
|
169 |
-
$getresponse["api_method"] = "set_contact_customs";
|
170 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"], "customs" => apply_filters("ws_plugin__s2member_getresponse_customs_array", array(), get_defined_vars ())));
|
171 |
-
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
172 |
-
|
173 |
-
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error))
|
174 |
-
$getresponse["api_success"] = $success = true;
|
175 |
-
}
|
176 |
-
}
|
177 |
-
else // Create a new contact; i.e. they do not exist on this list yet.
|
178 |
-
{
|
179 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"],
|
180 |
-
array("name" => $name, "email" => $email, "ip" => $ip,
|
181 |
-
"campaign" => $getresponse["list_id"], "action" => "standard", "cycle_day" => 0,
|
182 |
-
"customs" => apply_filters("ws_plugin__s2member_getresponse_customs_array", array(), get_defined_vars ())));
|
183 |
-
if(!$getresponse["api_params"][1]["ip"] || $getresponse["api_params"][1]["ip"] === "unknown") unset($getresponse["api_params"][1]["ip"]);
|
184 |
-
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
185 |
-
|
186 |
-
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && $getresponse["api_response"]->result->queued)
|
187 |
-
$getresponse["api_success"] = $success = true;
|
188 |
-
}
|
189 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
190 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
191 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
192 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
193 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
194 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "getresponse-api-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "getresponse-api.log";
|
195 |
-
|
196 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
197 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
198 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
199 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
200 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
201 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($getresponse, true)) . "\n\n",
|
202 |
-
FILE_APPEND);
|
203 |
-
}
|
204 |
-
}
|
205 |
-
}
|
206 |
-
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
|
207 |
-
{
|
208 |
-
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]) as $aweber_list)
|
209 |
-
{
|
210 |
-
$aweber = array("function" => __FUNCTION__, "func_get_args" => $args, "wp_mail_method" => "listSubscribe");
|
211 |
-
|
212 |
-
if /* Trim this up. NO trailing white space. */ (($aweber["list_id"] = trim ($aweber_list)))
|
213 |
-
{
|
214 |
-
$aweber["bcc"] = apply_filters("ws_plugin__s2member_aweber_bcc", false, get_defined_vars ());
|
215 |
-
$aweber["pass_inclusion"] = (apply_filters("ws_plugin__s2member_aweber_pass_inclusion", false, get_defined_vars ()) && $pass) ? "\nPass: " . $pass : false;
|
216 |
-
$name = $buyer = ($fname || $lname) ? trim ($fname . " " . $lname) : /* Must have. AWeber's PayPal Email Parser chokes on an empty value. */ ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
217 |
-
|
218 |
-
if ($aweber["wp_mail_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
|
219 |
-
($aweber["wp_mail_sbj"] = apply_filters("ws_plugin__s2member_aweber_sbj", "s2Member Subscription Request", get_defined_vars ())), // These Filters make it possible to customize these emails.
|
220 |
-
($aweber["wp_mail_msg"] = apply_filters("ws_plugin__s2member_aweber_msg", "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nAd Tracking: s2Member-" . ((is_multisite () && !is_main_site ()) ? $current_blog->domain . $current_blog->path : $_SERVER["HTTP_HOST"]) . "\nEMail Address: " . $email . "\nBuyer: " . $buyer . "\nFull Name: " . trim ($fname . " " . $lname) . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber["pass_inclusion"] . "\nRole: " . $role . "\nLevel: " . $level . "\nCCaps: " . $ccaps . "\n - end.", get_defined_vars ())),
|
221 |
-
($aweber["wp_mail_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["bcc"]) ? "\r\nBcc: " . $aweber["bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
|
222 |
-
$aweber["wp_mail_success"] = $success = true; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
223 |
-
|
224 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
225 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
226 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
227 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
228 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
229 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "aweber-api-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "aweber-api.log";
|
230 |
-
|
231 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
232 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
233 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
234 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
235 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
236 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($aweber, true)) . "\n\n",
|
237 |
-
FILE_APPEND);
|
238 |
-
}
|
239 |
-
}
|
240 |
-
}
|
241 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
242 |
-
do_action("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
|
243 |
-
unset($__refs, $__v);
|
244 |
-
|
245 |
-
if /* Back on? */ ($email_configs_were_on)
|
246 |
-
c_ws_plugin__s2member_email_configs::email_config ();
|
247 |
}
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
}
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
* @since 3.5
|
259 |
-
*
|
260 |
-
* @param string $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`.
|
261 |
-
* @param int|string $level A numeric s2Member Access Level number.
|
262 |
-
* @param string $login Username for the User.
|
263 |
-
* @param string $pass Plain Text Password for the User.
|
264 |
-
* @param string $email Email address for the User.
|
265 |
-
* @param string $fname First Name for the User.
|
266 |
-
* @param string $lname Last Name for the User.
|
267 |
-
* @param string $ip IP Address for the User.
|
268 |
-
* @param bool $opt_out Defaults to false; must be set to true. Indicates the User IS opting out.
|
269 |
-
* @param int|string $user_id A WordPress User ID, numeric string or integer.
|
270 |
-
* @return bool True if at least one List Server is processed successfully, else false.
|
271 |
-
*
|
272 |
-
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
273 |
-
* @todo Add a separate option for mail debugging; or consolidate?
|
274 |
-
* @todo Integrate AWeber API (much like the MailChimp API).
|
275 |
-
*/
|
276 |
-
public static function process_list_server_removals ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_out = FALSE, $user_id = FALSE)
|
277 |
{
|
278 |
-
|
279 |
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
|
|
|
|
283 |
|
284 |
-
|
285 |
{
|
286 |
-
$
|
287 |
-
|
288 |
-
$
|
289 |
-
c_ws_plugin__s2member_email_configs::email_config_release /* Release s2Member Filters before we begin this routine. */ ();
|
290 |
-
|
291 |
-
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
|
292 |
-
{
|
293 |
-
if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
|
294 |
-
include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
|
295 |
-
|
296 |
-
$mcapi = /* MailChimp API (no-conflict). */ new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true);
|
297 |
-
|
298 |
-
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
|
299 |
-
{
|
300 |
-
$mailchimp = array("function" => __FUNCTION__, "func_get_args" => $args, "api_removal_method" => "listUnsubscribe");
|
301 |
-
|
302 |
-
if /* Trim & strip groups. */ (($mailchimp["list_id"] = trim (preg_replace ("/\:\:.*$/", "", $mailchimp_list))))
|
303 |
-
{
|
304 |
-
if ($mailchimp["api_removal_response"] = $mcapi->{$mailchimp["api_removal_method"]}($mailchimp["list_id"], $email, // See: `http://apidocs.mailchimp.com/`.
|
305 |
-
($mailchimp["api_removal_delete_member"] = apply_filters("ws_plugin__s2member_mailchimp_removal_delete_member", false, get_defined_vars ())), // Completely delete?
|
306 |
-
($mailchimp["api_removal_send_goodbye"] = apply_filters("ws_plugin__s2member_mailchimp_removal_send_goodbye", false, get_defined_vars ())), // Send goodbye letter?
|
307 |
-
($mailchimp["api_removal_send_notify"] = apply_filters("ws_plugin__s2member_mailchimp_removal_send_notify", false, get_defined_vars ())))) // Send notification?
|
308 |
-
$mailchimp["api_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
309 |
-
$mailchimp["api_removal_properties"] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
310 |
-
|
311 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
312 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
313 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
314 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
315 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
316 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "mailchimp-api-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "mailchimp-api.log";
|
317 |
-
|
318 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
319 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
320 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
321 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
322 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
323 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($mailchimp, true)) . "\n\n",
|
324 |
-
FILE_APPEND);
|
325 |
-
}
|
326 |
-
}
|
327 |
-
}
|
328 |
-
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]))
|
329 |
-
{
|
330 |
-
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list)
|
331 |
-
{
|
332 |
-
$getresponse = array("function" => __FUNCTION__, "func_get_args" => $args, "api_removal_method" => "delete_contact");
|
333 |
-
|
334 |
-
if (($getresponse["list_id"] = $getresponse["list"] = trim ($getresponse_list)))
|
335 |
-
{
|
336 |
-
$getresponse["api_method"] = "get_contacts";
|
337 |
-
$getresponse["api_headers"] = array("Content-Type" => "application/json");
|
338 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("campaigns" => array($getresponse["list_id"]), "email" => array("EQUALS" => $email)));
|
339 |
-
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
340 |
-
|
341 |
-
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && ($getresponse["api_response_contact_ids"] = array_keys((array)$getresponse["api_response"]->result)) && ($getresponse["api_response_contact_id"] = $getresponse["api_response_contact_ids"][0]))
|
342 |
-
{
|
343 |
-
$getresponse["api_method"] = "delete_contact"; // Update method now.
|
344 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"]));
|
345 |
-
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
346 |
-
|
347 |
-
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && $getresponse["api_response"]->result->deleted)
|
348 |
-
$getresponse["api_success"] = $success = true;
|
349 |
-
}
|
350 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
351 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
352 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
353 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
354 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
355 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "getresponse-api-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "getresponse-api.log";
|
356 |
-
|
357 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
358 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
359 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
360 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
361 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
362 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($getresponse, true)) . "\n\n",
|
363 |
-
FILE_APPEND);
|
364 |
-
}
|
365 |
-
}
|
366 |
-
}
|
367 |
-
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
|
368 |
-
{
|
369 |
-
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]) as $aweber_list)
|
370 |
-
{
|
371 |
-
$aweber = array("function" => __FUNCTION__, "func_get_args" => $args, "wp_mail_removal_method" => "listUnsubscribe");
|
372 |
-
|
373 |
-
if /* Trim this up. NO trailing white space. */ (($aweber["list_id"] = trim ($aweber_list)))
|
374 |
-
{
|
375 |
-
$aweber["removal_bcc"] = apply_filters("ws_plugin__s2member_aweber_removal_bcc", false, get_defined_vars ());
|
376 |
-
|
377 |
-
c_ws_plugin__s2member_email_configs::email_config (); // Email configs MUST be ON for removal requests.
|
378 |
-
// The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
|
379 |
-
|
380 |
-
if ($aweber["wp_mail_removal_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
|
381 |
-
($aweber["wp_mail_removal_sbj"] = apply_filters("ws_plugin__s2member_aweber_removal_sbj", "REMOVE#" . $email . "#s2Member#" . $aweber["list_id"], get_defined_vars ())), // Bug fix. AWeber does not like dots (possibly other chars) in the Ad Tracking field. Now using just: `s2Member`.
|
382 |
-
($aweber["wp_mail_removal_msg"] = "REMOVE"), ($aweber["wp_mail_removal_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["removal_bcc"]) ? "\r\nBcc: " . $aweber["removal_bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
|
383 |
-
$aweber["wp_mail_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
384 |
-
|
385 |
-
c_ws_plugin__s2member_email_configs::email_config_release /* Release. */ ();
|
386 |
-
|
387 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
388 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
389 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
390 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
391 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
392 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "aweber-api-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "aweber-api.log";
|
393 |
-
|
394 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
395 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
396 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
397 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
398 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
399 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($aweber, true)) . "\n\n",
|
400 |
-
FILE_APPEND);
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}
|
404 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
405 |
-
do_action("ws_plugin__s2member_during_process_list_server_removals", get_defined_vars ());
|
406 |
-
unset($__refs, $__v);
|
407 |
-
|
408 |
-
if /* Back on? */ ($email_configs_were_on)
|
409 |
-
c_ws_plugin__s2member_email_configs::email_config ();
|
410 |
-
}
|
411 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
412 |
-
do_action("ws_plugin__s2member_after_process_list_server_removals", get_defined_vars ());
|
413 |
-
unset($__refs, $__v);
|
414 |
|
415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
}
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
*
|
422 |
-
* @package s2Member\List_Servers
|
423 |
-
* @since 3.5
|
424 |
-
*
|
425 |
-
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
|
426 |
-
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
|
427 |
-
*
|
428 |
-
* @param int|string $user_id Required. A WordPress User ID, numeric string or integer.
|
429 |
-
* @param array $vars Required. An array of defined variables passed by the calling Hook.
|
430 |
-
* @param string $event Required. A specific event that triggered this call from the Action Hook.
|
431 |
-
* @param string $event_spec Required. A specific event specification *(a broader classification)*.
|
432 |
-
* @param string $mod_new_role Required if ``$event_spec === "modification"`` (but can be empty). Role the User is being modified to.
|
433 |
-
* @param string $mod_new_user Optional. If ``$event_spec === "modification"``, the new User object with current details.
|
434 |
-
* @param string $mod_old_user Optional. If ``$event_spec === "modification"``, the old/previous User obj with old details.
|
435 |
-
*/
|
436 |
-
public static function auto_process_list_server_removals ($user_id = FALSE, $vars = FALSE, $event = FALSE, $event_spec = FALSE, $mod_new_role = FALSE, $mod_new_user = FALSE, $mod_old_user = FALSE)
|
437 |
{
|
438 |
-
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
-
|
442 |
-
|
443 |
-
unset($__refs, $__v);
|
444 |
|
445 |
-
|
|
|
|
|
|
|
|
|
446 |
|
447 |
-
|
448 |
-
|
449 |
-
$mod_new_role = ($event_spec === "modification" && $mod_new_role && is_string ($mod_new_role)) ? $mod_new_role : /* Might be empty(i.e. they now have NO Role). */ false;
|
450 |
-
$mod_new_user = ($event_spec === "modification" && $mod_new_user && is_object ($mod_new_user) && !empty($mod_new_user->ID) && $mod_new_user->ID === $_user->ID) ? $mod_new_user : false;
|
451 |
-
$mod_old_user = ($event_spec === "modification" && $mod_old_user && is_object ($mod_old_user) && !empty($mod_old_user->ID) && $mod_old_user->ID === $_user->ID) ? $mod_old_user : false;
|
452 |
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
-
|
456 |
-
{
|
457 |
-
$removed = c_ws_plugin__s2member_list_servers::process_list_server_removals (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user->ID);
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
|
463 |
-
|
|
|
|
|
464 |
|
465 |
-
|
466 |
-
do_action("ws_plugin__s2member_during_auto_process_list_server_removal_transitions", get_defined_vars ());
|
467 |
-
unset($__refs, $__v);
|
468 |
-
}
|
469 |
|
470 |
-
|
471 |
-
|
472 |
-
unset($__refs, $__v);
|
473 |
-
}
|
474 |
-
}
|
475 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
476 |
-
do_action("ws_plugin__s2member_after_auto_process_list_server_removals", get_defined_vars ());
|
477 |
unset($__refs, $__v);
|
478 |
}
|
|
|
|
|
|
|
|
|
|
|
479 |
}
|
|
|
|
|
|
|
|
|
480 |
}
|
481 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* List Server integrations.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\List_Servers
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_list_servers'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* List Server integrations.
|
24 |
+
*
|
25 |
+
* @package s2Member\List_Servers
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_list_servers
|
29 |
{
|
30 |
/**
|
31 |
+
* Determines whether or not any List Servers have been integrated.
|
32 |
+
*
|
33 |
+
* @package s2Member\List_Servers
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @return bool True if List Servers have been integrated, else false.
|
37 |
+
*/
|
38 |
+
public static function list_servers_integrated()
|
39 |
+
{
|
40 |
+
do_action('ws_plugin__s2member_before_list_servers_integrated', get_defined_vars());
|
41 |
+
|
42 |
+
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++ /* Go through each Level; looking for a configured list. */)
|
43 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_mailchimp_list_ids']) || !empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_getresponse_list_ids']) || !empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_aweber_list_ids']))
|
44 |
+
return apply_filters('ws_plugin__s2member_list_servers_integrated', TRUE, get_defined_vars());
|
45 |
+
|
46 |
+
return apply_filters('ws_plugin__s2member_list_servers_integrated', FALSE, get_defined_vars());
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Processes List Server integrations for s2Member.
|
51 |
+
*
|
52 |
+
* @package s2Member\List_Servers
|
53 |
+
* @since 3.5
|
54 |
+
*
|
55 |
+
* @param string $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`.
|
56 |
+
* @param int|string $level A numeric s2Member Access Level number.
|
57 |
+
* @param string $login Username for the User.
|
58 |
+
* @param string $pass Plain Text Password for the User.
|
59 |
+
* @param string $email Email Address for the User.
|
60 |
+
* @param string $fname First Name for the User.
|
61 |
+
* @param string $lname Last Name for the User.
|
62 |
+
* @param string $ip IP Address for the User.
|
63 |
+
* @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in.
|
64 |
+
* @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk.
|
65 |
+
* @param int|string $user_id A WordPress User ID, numeric string or integer.
|
66 |
+
*
|
67 |
+
* @return bool True if at least one List Server is processed successfully, else false.
|
68 |
+
*
|
69 |
+
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
70 |
+
* @todo Add a separate option for mail debugging; or consolidate?
|
71 |
+
* @todo Integrate AWeber API (much like the MailChimp API).
|
72 |
+
*/
|
73 |
+
public static function process_list_servers($role = '', $level = '', $login = '', $pass = '', $email = '', $fname = '', $lname = '', $ip = '', $opt_in = FALSE, $double_opt_in = TRUE, $user_id = 0)
|
74 |
+
{
|
75 |
+
global $current_site, $current_blog; // For Multisite support.
|
76 |
+
|
77 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
78 |
+
do_action('ws_plugin__s2member_before_process_list_servers', get_defined_vars());
|
79 |
+
unset($__refs, $__v);
|
80 |
+
|
81 |
+
if(c_ws_plugin__s2member_list_servers::list_servers_integrated() && ($args = func_get_args()) && $role && is_string($role) && is_numeric($level) && $login && is_string($login) && is_string($pass = (string)$pass) && $email && is_string($email) && is_email($email) && is_string($fname = (string)$fname) && is_string($lname = (string)$lname) && is_string($ip = (string)$ip) && is_bool($opt_in = (bool)$opt_in) && $opt_in && is_bool($double_opt_in = (bool)$double_opt_in) && $user_id && is_numeric($user_id) && is_object($user = new WP_User ($user_id)) && !empty($user->ID))
|
82 |
{
|
83 |
+
$ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
|
84 |
+
|
85 |
+
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
|
86 |
+
c_ws_plugin__s2member_email_configs::email_config_release( /* Release s2Member Filters before we begin this routine. */);
|
87 |
+
|
88 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['mailchimp_api_key']) && !empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_mailchimp_list_ids']))
|
89 |
+
{
|
90 |
+
if(!class_exists('NC_MCAPI')) // Include the MailChimp API Class here.
|
91 |
+
include_once dirname(dirname(__FILE__)).'/externals/mailchimp/nc-mcapi.inc.php';
|
92 |
+
|
93 |
+
$mcapi = new NC_MCAPI ($GLOBALS['WS_PLUGIN__']['s2member']['o']['mailchimp_api_key'], TRUE);
|
94 |
+
|
95 |
+
foreach(preg_split('/['."\r\n\t".';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_mailchimp_list_ids']) as $mailchimp_list)
|
96 |
{
|
97 |
+
$mailchimp = array('function' => __FUNCTION__, 'func_get_args' => $args, 'api_method' => 'listSubscribe');
|
98 |
|
99 |
+
if(($mailchimp['list'] = trim($mailchimp_list)))
|
100 |
+
{
|
101 |
+
if(strpos($mailchimp['list'], '::') !== FALSE) // Also contains Interest Groups?
|
102 |
+
{
|
103 |
+
list ($mailchimp['list_id'], $mailchimp['interest_groups_title'], $mailchimp['interest_groups']) = preg_split('/\:\:/', $mailchimp['list'], 3);
|
104 |
+
|
105 |
+
if(($mailchimp['interest_groups_title'] = trim($mailchimp['interest_groups_title'])) /* This is a title configured by the list master. */)
|
106 |
+
if(($mailchimp['interest_groups'] = (trim($mailchimp['interest_groups'])) ? preg_split('/\|/', trim($mailchimp['interest_groups'])) : FALSE))
|
107 |
+
$mailchimp['interest_groups'] = array('GROUPINGS' => array(array('name' => $mailchimp['interest_groups_title'], 'groups' => implode(',', $mailchimp['interest_groups']))));
|
108 |
|
109 |
+
if(empty($mailchimp['list_id']) /* Need to double-check this. If empty, skip over this entry. */)
|
110 |
+
continue; // Continue to next List, if there is one.
|
111 |
+
}
|
112 |
+
else $mailchimp['list_id'] = $mailchimp['list']; // Else, it's just a List ID.
|
113 |
+
|
114 |
+
$fname = (!$fname) ? ucwords(strstr($email, '@', TRUE)) : $fname;
|
115 |
+
$lname = (!$lname) ? '-' : $lname;
|
116 |
+
$name = ($fname || $lname) ? trim($fname.' '.$lname) : ucwords(preg_replace('/^(.+?)@.+/', '$1', $email));
|
117 |
+
$mailchimp['merge_array'] = array('MERGE1' => $fname, 'MERGE2' => $lname, 'OPTIN_IP' => $ip, 'OPTIN_TIME' => date('Y-m-d H:i:s'));
|
118 |
+
$mailchimp['merge_array'] = (!empty($mailchimp['interest_groups'])) ? array_merge($mailchimp['merge_array'], $mailchimp['interest_groups']) : $mailchimp['merge_array'];
|
119 |
+
$mailchimp['merge_array'] = apply_filters('ws_plugin__s2member_mailchimp_array', $mailchimp['merge_array'], get_defined_vars()); // Deprecated.
|
120 |
+
// Filter: `ws_plugin__s2member_mailchimp_array` deprecated in v110523. Please use Filter: `ws_plugin__s2member_mailchimp_merge_array`.
|
121 |
+
|
122 |
+
if($mailchimp['api_response'] = $mcapi->{$mailchimp['api_method']}($mailchimp['list_id'], $email, // See: `http://apidocs.mailchimp.com/` for full details.
|
123 |
+
($mailchimp['api_merge_array'] = apply_filters('ws_plugin__s2member_mailchimp_merge_array', $mailchimp['merge_array'], get_defined_vars())), // Configured merge array above.
|
124 |
+
($mailchimp['api_email_type'] = apply_filters('ws_plugin__s2member_mailchimp_email_type', 'html', get_defined_vars())), // Type of email to receive (i.e. html,text,mobile).
|
125 |
+
($mailchimp['api_double_optin'] = apply_filters('ws_plugin__s2member_mailchimp_double_optin', $double_opt_in, get_defined_vars())), // Abuse of this may cause account suspension.
|
126 |
+
($mailchimp['api_update_existing'] = apply_filters('ws_plugin__s2member_mailchimp_update_existing', TRUE, get_defined_vars())), // Existing subscribers should be updated with this?
|
127 |
+
($mailchimp['api_replace_interests'] = apply_filters('ws_plugin__s2member_mailchimp_replace_interests', TRUE, get_defined_vars())), // Replace interest groups? (only if provided).
|
128 |
+
($mailchimp['api_send_welcome'] = apply_filters('ws_plugin__s2member_mailchimp_send_welcome', FALSE, get_defined_vars())))
|
129 |
+
) $mailchimp['api_success'] = $success = TRUE; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
130 |
+
|
131 |
+
$mailchimp['api_properties'] = $mcapi; // Include API instance too; as it contains some additional information for logs.
|
132 |
+
|
133 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
134 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
135 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
136 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
137 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
138 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'mailchimp-api-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'mailchimp-api.log';
|
139 |
+
|
140 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
141 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
142 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
143 |
+
file_put_contents($logs_dir.'/'.$log2,
|
144 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
145 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($mailchimp, TRUE))."\n\n",
|
146 |
+
FILE_APPEND);
|
147 |
+
}
|
148 |
}
|
149 |
+
}
|
150 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key']) && !empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_getresponse_list_ids']))
|
151 |
+
{
|
152 |
+
foreach(preg_split('/['."\r\n\t".';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_getresponse_list_ids']) as $getresponse_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
{
|
154 |
+
$getresponse = array('function' => __FUNCTION__, 'func_get_args' => $args, 'api_method' => 'add_contact');
|
155 |
|
156 |
+
if(($getresponse['list_id'] = $getresponse['list'] = trim($getresponse_list)))
|
157 |
+
{
|
158 |
+
$getresponse['api_method'] = 'add_contact';
|
159 |
+
$getresponse['api_headers'] = array('Content-Type' => 'application/json');
|
160 |
+
$getresponse['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('campaigns' => array($getresponse['list_id']), 'email' => array('EQUALS' => $email)));
|
161 |
+
$getresponse['api_request'] = json_encode(array('method' => $getresponse['api_method'], 'params' => $getresponse['api_params'], 'id' => uniqid('', TRUE)));
|
162 |
+
$name = ($fname || $lname) ? trim($fname.' '.$lname) : ucwords(preg_replace('/^(.+?)@.+/', '$1', $email));
|
163 |
|
164 |
+
if(is_object($getresponse['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $getresponse['api_request'], array('headers' => $getresponse['api_headers'])))) && empty($getresponse['api_response']->error) && ($getresponse['api_response_contact_ids'] = array_keys((array)$getresponse['api_response']->result)) && ($getresponse['api_response_contact_id'] = $getresponse['api_response_contact_ids'][0]))
|
165 |
{
|
166 |
+
$getresponse['api_method'] = 'set_contact_name';
|
167 |
+
$getresponse['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('contact' => $getresponse['api_response_contact_id'], 'name' => $name));
|
168 |
+
$getresponse['api_request'] = json_encode(array('method' => $getresponse['api_method'], 'params' => $getresponse['api_params'], 'id' => uniqid('', TRUE)));
|
169 |
+
|
170 |
+
if(is_object($getresponse['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $getresponse['api_request'], array('headers' => $getresponse['api_headers'])))) && empty($getresponse['api_response']->error))
|
171 |
+
{
|
172 |
+
$getresponse['api_method'] = 'set_contact_customs';
|
173 |
+
$getresponse['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('contact' => $getresponse['api_response_contact_id'], 'customs' => apply_filters('ws_plugin__s2member_getresponse_customs_array', array(), get_defined_vars())));
|
174 |
+
$getresponse['api_request'] = json_encode(array('method' => $getresponse['api_method'], 'params' => $getresponse['api_params'], 'id' => uniqid('', TRUE)));
|
175 |
+
|
176 |
+
if(is_object($getresponse['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $getresponse['api_request'], array('headers' => $getresponse['api_headers'])))) && empty($getresponse['api_response']->error))
|
177 |
+
$getresponse['api_success'] = $success = TRUE;
|
178 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
+
else // Create a new contact; i.e. they do not exist on this list yet.
|
181 |
+
{
|
182 |
+
$getresponse['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'],
|
183 |
+
array('name' => $name, 'email' => $email, 'ip' => $ip,
|
184 |
+
'campaign' => $getresponse['list_id'], 'action' => 'standard', 'cycle_day' => 0,
|
185 |
+
'customs' => apply_filters('ws_plugin__s2member_getresponse_customs_array', array(), get_defined_vars())));
|
186 |
+
if(!$getresponse['api_params'][1]['ip'] || $getresponse['api_params'][1]['ip'] === 'unknown') unset($getresponse['api_params'][1]['ip']);
|
187 |
+
$getresponse['api_request'] = json_encode(array('method' => $getresponse['api_method'], 'params' => $getresponse['api_params'], 'id' => uniqid('', TRUE)));
|
188 |
+
|
189 |
+
if(is_object($getresponse['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $getresponse['api_request'], array('headers' => $getresponse['api_headers'])))) && empty($getresponse['api_response']->error) && $getresponse['api_response']->result->queued)
|
190 |
+
$getresponse['api_success'] = $success = TRUE;
|
191 |
+
}
|
192 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
193 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
194 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
195 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
196 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
197 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'getresponse-api-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'getresponse-api.log';
|
198 |
+
|
199 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
200 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
201 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
202 |
+
file_put_contents($logs_dir.'/'.$log2,
|
203 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
204 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($getresponse, TRUE))."\n\n",
|
205 |
+
FILE_APPEND);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_aweber_list_ids']))
|
210 |
+
{
|
211 |
+
foreach(preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_aweber_list_ids']) as $aweber_list)
|
212 |
+
{
|
213 |
+
$aweber = array('function' => __FUNCTION__, 'func_get_args' => $args, 'wp_mail_method' => 'listSubscribe');
|
214 |
+
|
215 |
+
if(($aweber['list_id'] = trim($aweber_list)))
|
216 |
+
{
|
217 |
+
$aweber['bcc'] = apply_filters('ws_plugin__s2member_aweber_bcc', FALSE, get_defined_vars());
|
218 |
+
$aweber['pass_inclusion'] = (apply_filters('ws_plugin__s2member_aweber_pass_inclusion', FALSE, get_defined_vars()) && $pass) ? '\nPass: '.$pass : FALSE;
|
219 |
+
$name = $buyer = ($fname || $lname) ? trim($fname.' '.$lname) : ucwords(preg_replace('/^(.+?)@.+/', '$1', $email)); // Must have. AWeber's PayPal Email Parser chokes on an empty value.
|
220 |
+
|
221 |
+
if($aweber['wp_mail_response'] = wp_mail($aweber['list_id'].'@aweber.com', // AWeber List ID converts to email address @aweber.com.
|
222 |
+
($aweber['wp_mail_sbj'] = apply_filters('ws_plugin__s2member_aweber_sbj', 's2Member Subscription Request', get_defined_vars())), // These Filters make it possible to customize these emails.
|
223 |
+
($aweber['wp_mail_msg'] = apply_filters('ws_plugin__s2member_aweber_msg', 's2Member Subscription Request'."\n".'s2Member w/ PayPal Email ID'."\n".'Ad Tracking: s2Member-'.((is_multisite() && !is_main_site()) ? $current_blog->domain.$current_blog->path : $_SERVER['HTTP_HOST'])."\n".'EMail Address: '.$email."\n".'Buyer: '.$buyer."\n".'Full Name: '.trim($fname.' '.$lname)."\n".'First Name: '.$fname."\n".'Last Name: '.$lname."\n".'IP Address: '.$ip."\n".'User ID: '.$user_id."\n".'Login: '.$login.$aweber['pass_inclusion']."\n".'Role: '.$role."\n".'Level: '.$level."\n".'CCaps: '.$ccaps."\n".' - end.', get_defined_vars())),
|
224 |
+
($aweber['wp_mail_headers'] = 'From: "'.preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']).'" <'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'].'>'.(($aweber['bcc']) ? "\r\n".'Bcc: '.$aweber['bcc'] : '')."\r\n".'Content-Type: text/plain; charset=UTF-8'))
|
225 |
+
) $aweber['wp_mail_success'] = $success = TRUE; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
226 |
+
|
227 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
228 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
229 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
230 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
231 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
232 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'aweber-api-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'aweber-api.log';
|
233 |
+
|
234 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
235 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
236 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
237 |
+
file_put_contents($logs_dir.'/'.$log2,
|
238 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
239 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($aweber, TRUE))."\n\n",
|
240 |
+
FILE_APPEND);
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
245 |
+
do_action('ws_plugin__s2member_during_process_list_servers', get_defined_vars());
|
246 |
+
unset($__refs, $__v);
|
247 |
+
|
248 |
+
if($email_configs_were_on)
|
249 |
+
c_ws_plugin__s2member_email_configs::email_config();
|
250 |
+
|
251 |
+
if($user_id) update_user_option($user_id, 's2member_opt_in', '1');
|
252 |
+
}
|
253 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
254 |
+
do_action('ws_plugin__s2member_after_process_list_servers', get_defined_vars());
|
255 |
+
unset($__refs, $__v);
|
256 |
+
|
257 |
+
return apply_filters('ws_plugin__s2member_process_list_servers', (isset ($success) && $success), get_defined_vars());
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* See {@link process_list_servers()} for further details about this wrapper.
|
262 |
+
*
|
263 |
+
* @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in.
|
264 |
+
* @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk.
|
265 |
+
* @param bool $clean_user_cache Defaults to true; i.e. we start from a fresh copy of the current user.
|
266 |
+
*
|
267 |
+
* @return bool True if at least one List Server is processed successfully, else false.
|
268 |
+
*/
|
269 |
+
public static function process_list_servers_against_current_user($opt_in = TRUE, $double_opt_in = TRUE, $clean_user_cache = TRUE)
|
270 |
+
{
|
271 |
+
if($clean_user_cache) // Start from a fresh user object here?
|
272 |
+
{
|
273 |
+
clean_user_cache(get_current_user_id());
|
274 |
+
wp_cache_delete(get_current_user_id(), 'user_meta');
|
275 |
+
$user = new WP_User(get_current_user_id());
|
276 |
+
}
|
277 |
+
else $user = wp_get_current_user();
|
278 |
+
|
279 |
+
return self::process_list_servers(
|
280 |
+
($role = c_ws_plugin__s2member_user_access::user_access_role($user)),
|
281 |
+
($level = c_ws_plugin__s2member_user_access::user_access_level($user)),
|
282 |
+
($login = $user->user_login),
|
283 |
+
($pass = $user->user_pass),
|
284 |
+
($email = $user->user_email),
|
285 |
+
($fname = $user->first_name),
|
286 |
+
($lname = $user->last_name),
|
287 |
+
($ip = $_SERVER['REMOTE_ADDR']),
|
288 |
+
($opt_in = $opt_in), ($double_opt_in = $double_opt_in),
|
289 |
+
($user_id = $user->ID)
|
290 |
+
);
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Processes List Server removals for s2Member.
|
295 |
+
*
|
296 |
+
* @package s2Member\List_Servers
|
297 |
+
* @since 3.5
|
298 |
+
*
|
299 |
+
* @param string $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`.
|
300 |
+
* @param int|string $level A numeric s2Member Access Level number.
|
301 |
+
* @param string $login Username for the User.
|
302 |
+
* @param string $pass Plain Text Password for the User.
|
303 |
+
* @param string $email Email address for the User.
|
304 |
+
* @param string $fname First Name for the User.
|
305 |
+
* @param string $lname Last Name for the User.
|
306 |
+
* @param string $ip IP Address for the User.
|
307 |
+
* @param bool $opt_out Defaults to false; must be set to true. Indicates the User IS opting out.
|
308 |
+
* @param int|string $user_id A WordPress User ID, numeric string or integer.
|
309 |
+
*
|
310 |
+
* @return bool True if at least one List Server is processed successfully, else false.
|
311 |
+
*
|
312 |
+
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
313 |
+
* @todo Add a separate option for mail debugging; or consolidate?
|
314 |
+
* @todo Integrate AWeber API (much like the MailChimp API).
|
315 |
+
*/
|
316 |
+
public static function process_list_server_removals($role = '', $level = '', $login = '', $pass = '', $email = '', $fname = '', $lname = '', $ip = '', $opt_out = FALSE, $user_id = 0)
|
317 |
+
{
|
318 |
+
global $current_site, $current_blog; // For Multisite support.
|
319 |
+
|
320 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
321 |
+
do_action('ws_plugin__s2member_before_process_list_server_removals', get_defined_vars());
|
322 |
+
unset($__refs, $__v);
|
323 |
+
|
324 |
+
if(c_ws_plugin__s2member_list_servers::list_servers_integrated() && ($args = func_get_args()) && $role && is_string($role) && is_numeric($level) && $login && is_string($login) && is_string($pass = (string)$pass) && $email && is_string($email) && is_email($email) && is_string($fname = (string)$fname) && is_string($lname = (string)$lname) && is_string($ip = (string)$ip) && is_bool($opt_out = (bool)$opt_out) && $opt_out && $user_id && is_numeric($user_id) && is_object($user = new WP_User ($user_id)) && !empty($user->ID))
|
325 |
+
{
|
326 |
+
$ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
|
327 |
+
|
328 |
+
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
|
329 |
+
c_ws_plugin__s2member_email_configs::email_config_release( /* Release s2Member Filters before we begin this routine. */);
|
330 |
|
331 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['mailchimp_api_key']) && !empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_mailchimp_list_ids']))
|
332 |
+
{
|
333 |
+
if(!class_exists('NC_MCAPI')) // Include the MailChimp API Class here.
|
334 |
+
include_once dirname(dirname(__FILE__)).'/externals/mailchimp/nc-mcapi.inc.php';
|
335 |
+
|
336 |
+
$mcapi = new NC_MCAPI ($GLOBALS['WS_PLUGIN__']['s2member']['o']['mailchimp_api_key'], TRUE);
|
337 |
+
|
338 |
+
foreach(preg_split('/['."\r\n\t".';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_mailchimp_list_ids']) as $mailchimp_list)
|
339 |
+
{
|
340 |
+
$mailchimp = array('function' => __FUNCTION__, 'func_get_args' => $args, 'api_removal_method' => 'listUnsubscribe');
|
341 |
+
|
342 |
+
if(($mailchimp['list_id'] = trim(preg_replace('/\:\:.*$/', '', $mailchimp_list))))
|
343 |
+
{
|
344 |
+
if($mailchimp['api_removal_response'] = $mcapi->{$mailchimp['api_removal_method']}($mailchimp['list_id'], $email, // See: `http://apidocs.mailchimp.com/`.
|
345 |
+
($mailchimp['api_removal_delete_member'] = apply_filters('ws_plugin__s2member_mailchimp_removal_delete_member', FALSE, get_defined_vars())), // Completely delete?
|
346 |
+
($mailchimp['api_removal_send_goodbye'] = apply_filters('ws_plugin__s2member_mailchimp_removal_send_goodbye', FALSE, get_defined_vars())), // Send goodbye letter?
|
347 |
+
($mailchimp['api_removal_send_notify'] = apply_filters('ws_plugin__s2member_mailchimp_removal_send_notify', FALSE, get_defined_vars())))
|
348 |
+
) $mailchimp['api_removal_success'] = $removal_success = TRUE; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
349 |
+
$mailchimp['api_removal_properties'] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
350 |
+
|
351 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
352 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
353 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
354 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
355 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
356 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'mailchimp-api-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'mailchimp-api.log';
|
357 |
+
|
358 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
359 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
360 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
361 |
+
file_put_contents($logs_dir.'/'.$log2,
|
362 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
363 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($mailchimp, TRUE))."\n\n",
|
364 |
+
FILE_APPEND);
|
365 |
+
}
|
366 |
}
|
367 |
+
}
|
368 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key']) && !empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_getresponse_list_ids']))
|
369 |
+
{
|
370 |
+
foreach(preg_split('/['."\r\n\t".';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_getresponse_list_ids']) as $getresponse_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
{
|
372 |
+
$getresponse = array('function' => __FUNCTION__, 'func_get_args' => $args, 'api_removal_method' => 'delete_contact');
|
373 |
|
374 |
+
if(($getresponse['list_id'] = $getresponse['list'] = trim($getresponse_list)))
|
375 |
+
{
|
376 |
+
$getresponse['api_method'] = 'get_contacts';
|
377 |
+
$getresponse['api_headers'] = array('Content-Type' => 'application/json');
|
378 |
+
$getresponse['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('campaigns' => array($getresponse['list_id']), 'email' => array('EQUALS' => $email)));
|
379 |
+
$getresponse['api_request'] = json_encode(array('method' => $getresponse['api_method'], 'params' => $getresponse['api_params'], 'id' => uniqid('', TRUE)));
|
380 |
|
381 |
+
if(is_object($getresponse['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $getresponse['api_request'], array('headers' => $getresponse['api_headers'])))) && empty($getresponse['api_response']->error) && ($getresponse['api_response_contact_ids'] = array_keys((array)$getresponse['api_response']->result)) && ($getresponse['api_response_contact_id'] = $getresponse['api_response_contact_ids'][0]))
|
382 |
{
|
383 |
+
$getresponse['api_method'] = 'delete_contact'; // Update method now.
|
384 |
+
$getresponse['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('contact' => $getresponse['api_response_contact_id']));
|
385 |
+
$getresponse['api_request'] = json_encode(array('method' => $getresponse['api_method'], 'params' => $getresponse['api_params'], 'id' => uniqid('', TRUE)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
|
387 |
+
if(is_object($getresponse['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $getresponse['api_request'], array('headers' => $getresponse['api_headers'])))) && empty($getresponse['api_response']->error) && $getresponse['api_response']->result->deleted)
|
388 |
+
$getresponse['api_success'] = $success = TRUE;
|
389 |
+
}
|
390 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
391 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
392 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
393 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
394 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
395 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'getresponse-api-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'getresponse-api.log';
|
396 |
+
|
397 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
398 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
399 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
400 |
+
file_put_contents($logs_dir.'/'.$log2,
|
401 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
402 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($getresponse, TRUE))."\n\n",
|
403 |
+
FILE_APPEND);
|
404 |
+
}
|
405 |
}
|
406 |
+
}
|
407 |
+
if(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_aweber_list_ids']))
|
408 |
+
{
|
409 |
+
foreach(preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_aweber_list_ids']) as $aweber_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
{
|
411 |
+
$aweber = array('function' => __FUNCTION__, 'func_get_args' => $args, 'wp_mail_removal_method' => 'listUnsubscribe');
|
412 |
+
|
413 |
+
if(($aweber['list_id'] = trim($aweber_list)))
|
414 |
+
{
|
415 |
+
$aweber['removal_bcc'] = apply_filters('ws_plugin__s2member_aweber_removal_bcc', FALSE, get_defined_vars());
|
416 |
+
|
417 |
+
c_ws_plugin__s2member_email_configs::email_config(); // Email configs MUST be ON for removal requests.
|
418 |
+
// The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
|
419 |
+
|
420 |
+
if($aweber['wp_mail_removal_response'] = wp_mail($aweber['list_id'].'@aweber.com', // AWeber List ID converts to email address @aweber.com.
|
421 |
+
($aweber['wp_mail_removal_sbj'] = apply_filters('ws_plugin__s2member_aweber_removal_sbj', 'REMOVE#'.$email.'#s2Member#'.$aweber['list_id'], get_defined_vars())), // Bug fix. AWeber does not like dots (possibly other chars) in the Ad Tracking field. Now using just: `s2Member`.
|
422 |
+
($aweber['wp_mail_removal_msg'] = 'REMOVE'), ($aweber['wp_mail_removal_headers'] = 'From: "'.preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']).'" <'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'].'>'.(($aweber['removal_bcc']) ? "\r\n".'Bcc: '.$aweber['removal_bcc'] : '')."\r\n".'Content-Type: text/plain; charset=UTF-8'))
|
423 |
+
) $aweber['wp_mail_removal_success'] = $removal_success = TRUE; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
424 |
+
|
425 |
+
c_ws_plugin__s2member_email_configs::email_config_release( /* Release. */);
|
426 |
+
|
427 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
428 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
429 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
430 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
431 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
432 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'aweber-api-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'aweber-api.log';
|
433 |
+
|
434 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
435 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
436 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
437 |
+
file_put_contents($logs_dir.'/'.$log2,
|
438 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
439 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($aweber, TRUE))."\n\n",
|
440 |
+
FILE_APPEND);
|
441 |
+
}
|
442 |
+
}
|
443 |
+
}
|
444 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
445 |
+
do_action('ws_plugin__s2member_during_process_list_server_removals', get_defined_vars());
|
446 |
+
unset($__refs, $__v);
|
447 |
|
448 |
+
if($email_configs_were_on)
|
449 |
+
c_ws_plugin__s2member_email_configs::email_config();
|
|
|
450 |
|
451 |
+
if($user_id) update_user_option($user_id, 's2member_opt_in', '0');
|
452 |
+
}
|
453 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
454 |
+
do_action('ws_plugin__s2member_after_process_list_server_removals', get_defined_vars());
|
455 |
+
unset($__refs, $__v);
|
456 |
|
457 |
+
return apply_filters('ws_plugin__s2member_process_list_server_removals', (isset ($removal_success) && $removal_success), get_defined_vars());
|
458 |
+
}
|
|
|
|
|
|
|
459 |
|
460 |
+
/**
|
461 |
+
* Listens to Collective EOT/MOD Events processed internally by s2Member.
|
462 |
+
*
|
463 |
+
* This is only applicable when ``['custom_reg_auto_opt_outs']`` contains related Event(s).
|
464 |
+
*
|
465 |
+
* @package s2Member\List_Servers
|
466 |
+
* @since 3.5
|
467 |
+
*
|
468 |
+
* @attaches-to ``add_action('ws_plugin__s2member_during_collective_mods');``
|
469 |
+
* @attaches-to ``add_action('ws_plugin__s2member_during_collective_eots');``
|
470 |
+
*
|
471 |
+
* @param int|string $user_id Required. A WordPress User ID, numeric string or integer.
|
472 |
+
* @param array $vars Required. An array of defined variables passed by the calling Hook.
|
473 |
+
* @param string $event Required. A specific event that triggered this call from the Action Hook.
|
474 |
+
* @param string $event_spec Required. A specific event specification *(a broader classification)*.
|
475 |
+
* @param string $mod_new_role Required if ``$event_spec === 'modification'`` (but can be empty). Role the User is being modified to.
|
476 |
+
* @param string $mod_new_user Optional. If ``$event_spec === 'modification'``, the new User object with current details.
|
477 |
+
* @param string $mod_old_user Optional. If ``$event_spec === 'modification'``, the old/previous User obj with old details.
|
478 |
+
*/
|
479 |
+
public static function auto_process_list_server_removals($user_id, $vars, $event, $event_spec, $mod_new_role = NULL, $mod_new_user = NULL, $mod_old_user = NULL)
|
480 |
+
{
|
481 |
+
global $current_site, $current_blog; // For Multisite support.
|
482 |
+
static $auto_processed = array( /* Process ONE time for each User. */);
|
483 |
+
|
484 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
485 |
+
do_action('ws_plugin__s2member_before_auto_process_list_server_removals', get_defined_vars());
|
486 |
+
unset($__refs, $__v);
|
487 |
+
|
488 |
+
$custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_outs'], '/^', '$/i');
|
489 |
+
|
490 |
+
if(c_ws_plugin__s2member_list_servers::list_servers_integrated() && $user_id && is_numeric($user_id) && !in_array($user_id, $auto_processed) && is_array($vars) && is_string($event = (string)$event) && is_string($event_spec = (string)$event_spec) && (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) && is_object($user = $_user = new WP_User ($user_id)) && !empty($user->ID))
|
491 |
+
{
|
492 |
+
$mod_new_role = ($event_spec === 'modification' && $mod_new_role && is_string($mod_new_role)) ? $mod_new_role : FALSE; // Might be empty(i.e. they now have NO Role).
|
493 |
+
$mod_new_user = ($event_spec === 'modification' && $mod_new_user && is_object($mod_new_user) && !empty($mod_new_user->ID) && $mod_new_user->ID === $_user->ID) ? $mod_new_user : FALSE;
|
494 |
+
$mod_old_user = ($event_spec === 'modification' && $mod_old_user && is_object($mod_old_user) && !empty($mod_old_user->ID) && $mod_old_user->ID === $_user->ID) ? $mod_old_user : FALSE;
|
495 |
|
496 |
+
$user = ($event_spec === 'modification' && $mod_old_user) ? $mod_old_user : $_user; // Now, should we switch over to the old/previous User object ``$mod_old_user`` here? Or, should we use the one pulled by this routine with the User's ID?
|
|
|
|
|
497 |
|
498 |
+
if(($event_spec !== 'modification' || ($event_spec === 'modification' && (string)$mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role($user) && strtotime($user->user_registered) < strtotime('-10 seconds') && ($event !== 'user-role-change' || ($event === 'user-role-change' && !empty($vars['_p']['ws_plugin__s2member_custom_reg_auto_opt_out_transitions']))))) && ($auto_processed[$user->ID] = TRUE))
|
499 |
+
{
|
500 |
+
$removed = c_ws_plugin__s2member_list_servers::process_list_server_removals(c_ws_plugin__s2member_user_access::user_access_role($user), c_ws_plugin__s2member_user_access::user_access_level($user), $user->user_login, FALSE, $user->user_email, $user->first_name, $user->last_name, FALSE, TRUE, $user->ID);
|
501 |
|
502 |
+
if($event_spec === 'modification' && $mod_new_role && ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '2' || ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '1' && $removed)))
|
503 |
+
{
|
504 |
+
$user = ($event_spec === 'modification' && $mod_new_user) ? $mod_new_user : $_user; // Now, should we switch over to a new/current User object ``$mod_new_user`` here? (which may contain newly updated details). Or, should we simply use the User object pulled by this routine with the User's ID?
|
505 |
|
506 |
+
$transitioned = c_ws_plugin__s2member_list_servers::process_list_servers($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level($mod_new_role), $user->user_login, FALSE, $user->user_email, $user->first_name, $user->last_name, FALSE, TRUE, (($removed) ? FALSE : TRUE), $user->ID);
|
|
|
|
|
|
|
507 |
|
508 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
509 |
+
do_action('ws_plugin__s2member_during_auto_process_list_server_removal_transitions', get_defined_vars());
|
|
|
|
|
|
|
|
|
|
|
510 |
unset($__refs, $__v);
|
511 |
}
|
512 |
+
|
513 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
514 |
+
do_action('ws_plugin__s2member_during_auto_process_list_server_removals', get_defined_vars());
|
515 |
+
unset($__refs, $__v);
|
516 |
+
}
|
517 |
}
|
518 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
519 |
+
do_action('ws_plugin__s2member_after_auto_process_list_server_removals', get_defined_vars());
|
520 |
+
unset($__refs, $__v);
|
521 |
+
}
|
522 |
}
|
523 |
+
}
|
includes/classes/login-checks.inc.php
CHANGED
@@ -1,209 +1,212 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Login checks.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Login_Checks
|
15 |
-
* @since 131025
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
204 |
-
do_action("ws_plugin__s2member_after_update_simultaneous_logins", get_defined_vars ());
|
205 |
-
unset($__refs, $__v);
|
206 |
-
}
|
207 |
-
}
|
208 |
}
|
209 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Login checks.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Login_Checks
|
15 |
+
* @since 131025
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_login_checks'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Login checks.
|
24 |
+
*
|
25 |
+
* @package s2Member\Login_Checks
|
26 |
+
* @since 131025
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_login_checks
|
29 |
{
|
30 |
/**
|
31 |
+
* Assists in multisite User authentication.
|
32 |
+
*
|
33 |
+
* @package s2Member\Login_Checks
|
34 |
+
* @since 131025
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_filter('wp_authenticate_user');``
|
37 |
+
*
|
38 |
+
* @param WP_User|WP_Error Expects either a WP_User or WP_Error object passed in by the Filter.
|
39 |
+
*
|
40 |
+
* @return WP_User|WP_Error WP_User or WP_Error object (if there was a problem).
|
41 |
+
*/
|
42 |
+
public static function ms_wp_authenticate_user($user_or_wp_error)
|
43 |
+
{
|
44 |
+
if(!is_multisite()) return $user_or_wp_error;
|
45 |
+
|
46 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
47 |
+
do_action('ws_plugin__s2member_before_ms_wp_authenticate_user', get_defined_vars());
|
48 |
+
unset($__refs, $__v);
|
49 |
+
|
50 |
+
if(is_a($user_or_wp_error, 'WP_User') && ($user = $user_or_wp_error) && $user->ID && !is_super_admin($user->ID) && !in_array(get_current_blog_id(), array_keys(get_blogs_of_user($user->ID)), TRUE))
|
51 |
+
$user_or_wp_error = new WP_Error('invalid_username', _x('<strong>ERROR</strong>: Invalid username for this site.', 's2member-front', 's2member'));
|
52 |
+
|
53 |
+
return apply_filters('ws_plugin__s2member_ms_wp_authenticate_user', $user_or_wp_error, get_defined_vars());
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Assists in User authentication (stops max simultaneous logins).
|
58 |
+
*
|
59 |
+
* @package s2Member\Login_Checks
|
60 |
+
* @since 131025
|
61 |
+
*
|
62 |
+
* @attaches-to ``add_filter('wp_authenticate_user');``
|
63 |
+
*
|
64 |
+
* @param WP_User|WP_Error Expects either a WP_User or WP_Error object passed in by the Filter.
|
65 |
+
*
|
66 |
+
* @return WP_User|WP_Error WP_User or WP_Error object (if there was a problem).
|
67 |
+
*/
|
68 |
+
public static function stop_simultaneous_logins($user_or_wp_error)
|
69 |
+
{
|
70 |
+
if(!($max = $GLOBALS['WS_PLUGIN__']['s2member']['o']['max_simultaneous_logins']))
|
71 |
+
return $user_or_wp_error; // Simultaneous login monitoring not enabled here.
|
72 |
+
|
73 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
74 |
+
do_action('ws_plugin__s2member_before_stop_simultaneous_logins', get_defined_vars());
|
75 |
+
unset($__refs, $__v);
|
76 |
+
|
77 |
+
if(is_a($user_or_wp_error, 'WP_User') && ($user = $user_or_wp_error) && $user->ID && !is_super_admin($user->ID) && c_ws_plugin__s2member_login_checks::get_simultaneous_logins($user->user_login) + 1 > $max)
|
78 |
+
$user_or_wp_error = new WP_Error('max_simultaneous_logins', sprintf(_x('<strong>ERROR</strong>: Max simultaneous logins for username: %1$s. Please wait %2$s and try again.', 's2member-front', 's2member'), $user->user_login, $GLOBALS['WS_PLUGIN__']['s2member']['o']['max_simultaneous_logins_timeout']));
|
79 |
+
|
80 |
+
return apply_filters('ws_plugin__s2member_stop_simultaneous_logins', $user_or_wp_error, get_defined_vars());
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Monitors simultaneous logins (updates timer on each page view).
|
85 |
+
*
|
86 |
+
* @package s2Member\Login_Checks
|
87 |
+
* @since 131025
|
88 |
+
*
|
89 |
+
* @attaches-to ``add_action('init');``
|
90 |
+
*
|
91 |
+
* @param WP_User|WP_Error Expects either a WP_User or WP_Error object passed in by the Filter.
|
92 |
+
*
|
93 |
+
* @return WP_User|WP_Error WP_User or WP_Error object (if there was a problem).
|
94 |
+
*/
|
95 |
+
public static function monitor_simultaneous_logins()
|
96 |
+
{
|
97 |
+
if(!is_user_logged_in() || is_super_admin())
|
98 |
+
return; // Nothing to do here.
|
99 |
+
|
100 |
+
if(!($max = $GLOBALS['WS_PLUGIN__']['s2member']['o']['max_simultaneous_logins']))
|
101 |
+
return; // Simultaneous login monitoring not enabled here.
|
102 |
+
|
103 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
104 |
+
do_action('ws_plugin__s2member_before_monitor_simultaneous_logins', get_defined_vars());
|
105 |
+
unset($__refs, $__v);
|
106 |
+
|
107 |
+
$user = wp_get_current_user();
|
108 |
+
$username = $user->user_login; // The username.
|
109 |
+
c_ws_plugin__s2member_login_checks::update_simultaneous_logins($username, $user, 'timer');
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Handles simultaneous logouts.
|
114 |
+
*
|
115 |
+
* @package s2Member\Login_Checks
|
116 |
+
* @since 131025
|
117 |
+
*
|
118 |
+
* @attaches-to ``add_action('clear_auth_cookie');``
|
119 |
+
*/
|
120 |
+
public static function simultaneous_logout()
|
121 |
+
{
|
122 |
+
if(!is_user_logged_in() || is_super_admin())
|
123 |
+
return; // Nothing to do here.
|
124 |
+
|
125 |
+
if(!($max = $GLOBALS['WS_PLUGIN__']['s2member']['o']['max_simultaneous_logins']))
|
126 |
+
return; // Simultaneous login monitoring not enabled here.
|
127 |
+
|
128 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
129 |
+
do_action('ws_plugin__s2member_before_simultaneous_logout', get_defined_vars());
|
130 |
+
unset($__refs, $__v);
|
131 |
+
|
132 |
+
$user = wp_get_current_user();
|
133 |
+
$username = $user->user_login; // The username.
|
134 |
+
c_ws_plugin__s2member_login_checks::update_simultaneous_logins($username, $user, 'decrement');
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Get simultaneous logins for a particular username.
|
139 |
+
*
|
140 |
+
* @package s2Member\Login_Checks
|
141 |
+
* @since 131025
|
142 |
+
*
|
143 |
+
* @param string $username Expects a username (e.g. a `user_login` value).
|
144 |
+
*
|
145 |
+
* @return integer Current number of simultaneous logins.
|
146 |
+
*/
|
147 |
+
public static function get_simultaneous_logins($username)
|
148 |
+
{
|
149 |
+
if(!$username) return 0; // Nothing to get.
|
150 |
+
|
151 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
152 |
+
do_action('ws_plugin__s2member_before_get_simultaneous_logins', get_defined_vars());
|
153 |
+
unset($__refs, $__v);
|
154 |
+
|
155 |
+
$prefix = 's2m_slm_'; // s2Member Transient prefix for all simultaneous login monitoring.
|
156 |
+
$transient_entries = $prefix.md5('s2member_simultaneous_login_entries_for_'.strtolower((string)$username));
|
157 |
+
|
158 |
+
$timeout = $GLOBALS['WS_PLUGIN__']['s2member']['o']['max_simultaneous_logins_timeout'];
|
159 |
+
$timeout_ago = strtotime('-'.$timeout); // e.g. 30 minutes ago.
|
160 |
+
|
161 |
+
$entries = (is_array($entries = get_transient($transient_entries))) ? $entries : array();
|
162 |
+
foreach($entries as $_entry => $_time /* Auto-expire entries, based on time. */)
|
163 |
+
if($_time < $timeout_ago) unset($entries[$_entry]);
|
164 |
+
|
165 |
+
return apply_filters('ws_plugin__s2member_get_simultaneous_logins', count($entries), get_defined_vars());
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Update simultaneous logins for a particular username.
|
170 |
+
*
|
171 |
+
* @package s2Member\Login_Checks
|
172 |
+
* @since 131025
|
173 |
+
*
|
174 |
+
* @attaches-to ``add_action('wp_login');``
|
175 |
+
*
|
176 |
+
* @param string $username Expects a username (e.g. a `user_login` value).
|
177 |
+
* @param WP_User|null $user When fired against `wp_login` this receives a WP_User object also.
|
178 |
+
* @param string $action Default action is to increment the counter. This can be set to `decrement` or NULL to do nothing.
|
179 |
+
*/
|
180 |
+
public static function update_simultaneous_logins($username, $user = NULL, $action = 'increment')
|
181 |
+
{
|
182 |
+
if(!$username) return; // Nothing to do.
|
183 |
+
|
184 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
185 |
+
do_action('ws_plugin__s2member_before_update_simultaneous_logins', get_defined_vars());
|
186 |
+
unset($__refs, $__v);
|
187 |
+
|
188 |
+
$prefix = 's2m_slm_'; // s2Member Transient prefix for all simultaneous login monitoring.
|
189 |
+
$transient_entries = $prefix.md5('s2member_simultaneous_login_entries_for_'.strtolower((string)$username));
|
190 |
+
|
191 |
+
$timeout = $GLOBALS['WS_PLUGIN__']['s2member']['o']['max_simultaneous_logins_timeout'];
|
192 |
+
$timeout_ago = strtotime('-'.$timeout); // e.g. 30 minutes ago.
|
193 |
+
|
194 |
+
$entries = (is_array($entries = get_transient($transient_entries))) ? $entries : array();
|
195 |
+
foreach($entries as $_entry => $_time /* Auto-expire entries, based on time. */)
|
196 |
+
if($_time < $timeout_ago) unset($entries[$_entry]);
|
197 |
+
|
198 |
+
$total_entries = count($entries); // May need this below.
|
199 |
+
|
200 |
+
if($action === 'increment') $entries[] = time(); // New entry.
|
201 |
+
else if($action === 'decrement') array_pop($entries); // Remove last entry.
|
202 |
+
else if($action === 'timer') // Update time on last entry; or add a new entry.
|
203 |
+
$entries[(($total_entries) ? $total_entries - 1 : 0)] = time();
|
204 |
+
|
205 |
+
set_transient($transient_entries, $entries, strtotime('+'.$timeout) - time());
|
206 |
+
|
207 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
208 |
+
do_action('ws_plugin__s2member_after_update_simultaneous_logins', get_defined_vars());
|
209 |
+
unset($__refs, $__v);
|
210 |
+
}
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
+
}
|
includes/classes/login-customizations.inc.php
CHANGED
@@ -1,224 +1,222 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Login customizations.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Login_Customizations
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if(realpath(__FILE__) === realpath($_SERVER[
|
18 |
-
exit(
|
19 |
-
|
20 |
-
if(!class_exists(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
if(!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_design_enabled"])
|
170 |
-
return; // Login/Registration Design disabled in this case.
|
171 |
-
|
172 |
-
do_action("ws_plugin__s2member_before_login_footer_design", get_defined_vars());
|
173 |
-
|
174 |
-
if(($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_footer_design"]))
|
175 |
-
|
176 |
-
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site())
|
177 |
-
{
|
178 |
-
echo /* No PHP here. */ $code."\n";
|
179 |
-
}
|
180 |
-
else // Otherwise, safe to allow PHP code.
|
181 |
-
{
|
182 |
-
eval("?>".$code);
|
183 |
-
}
|
184 |
-
|
185 |
-
do_action("ws_plugin__s2member_after_login_footer_design", get_defined_vars());
|
186 |
-
|
187 |
-
return /* Return for uniformity. */;
|
188 |
-
}
|
189 |
-
/**
|
190 |
-
* Filters the Lost Password URL when the call is made from the /wp-login.php system
|
191 |
-
* and changes the default behavior of wp_lostpassword_url() so that it uses site_url()
|
192 |
-
* instead of network_site_url(), but only if the current $_SERVER['REQUEST_URI'] differs
|
193 |
-
* from the Parent Site URL, as returned by network_site_url(). In a non-multisite
|
194 |
-
* environment, the default WordPress behavior (as of v3.9.1) is used.
|
195 |
-
*
|
196 |
-
* @package s2Member\Login_Customizations
|
197 |
-
* @since 140603
|
198 |
-
*
|
199 |
-
* @attaches-to ``add_filter("lostpassword_url");``
|
200 |
-
*
|
201 |
-
* @param string $lostpassword_url The lost password page URL.
|
202 |
-
* @param string $redirect The path to redirect to on login.
|
203 |
-
*
|
204 |
-
* @return string Lost password URL.
|
205 |
-
*/
|
206 |
-
public static function lost_password_url($lostpassword_url, $redirect)
|
207 |
{
|
208 |
-
$
|
209 |
-
$url = $scheme.'://'.$_SERVER["HTTP_HOST"].strtok($_SERVER["REQUEST_URI"], '?'); // Request URL minus query vars
|
210 |
-
|
211 |
-
if(basename(strtok($_SERVER['REQUEST_URI'], '?')) === 'wp-login.php'
|
212 |
-
&& strpos($url, (string)network_site_url('wp-login.php')) === FALSE
|
213 |
-
&& apply_filters("ws_plugin__s2member_tweak_lost_password_url", TRUE, get_defined_vars()))
|
214 |
-
{
|
215 |
-
$args = array('action' => 'lostpassword');
|
216 |
-
if(!empty($redirect)) $args['redirect_to'] = $redirect;
|
217 |
-
|
218 |
-
$lostpassword_url = add_query_arg(urlencode_deep($args), site_url('wp-login.php', 'login'));
|
219 |
-
}
|
220 |
-
return apply_filters("ws_plugin__s2member_lost_password_url", $lostpassword_url, $redirect, get_defined_vars());
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
}
|
224 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Login customizations.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Login_Customizations
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_login_customizations'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Login customizations.
|
24 |
+
*
|
25 |
+
* @package s2Member\Login_Customizations
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_login_customizations
|
29 |
{
|
30 |
/**
|
31 |
+
* Filters the login/registration logo URL.
|
32 |
+
*
|
33 |
+
* @package s2Member\Login_Customizations
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_filter('login_headerurl');``
|
37 |
+
*
|
38 |
+
* @param string $url Expects a login header URL passed in by the Filter.
|
39 |
+
*
|
40 |
+
* @return string A URL based on s2Member's UI configuration.
|
41 |
+
*/
|
42 |
+
public static function login_header_url($url = '')
|
43 |
+
{
|
44 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_design_enabled'])
|
45 |
+
return $url; // Login/registration design disabled in this case.
|
46 |
+
|
47 |
+
do_action('ws_plugin__s2member_before_login_header_url', get_defined_vars());
|
48 |
+
|
49 |
+
$url = $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_logo_url'];
|
50 |
+
|
51 |
+
return apply_filters('ws_plugin__s2member_login_header_url', $url, get_defined_vars());
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Filters the login/registration logo title.
|
56 |
+
*
|
57 |
+
* @package s2Member\Login_Customizations
|
58 |
+
* @since 3.5
|
59 |
+
*
|
60 |
+
* @attaches-to ``add_filter('login_headertitle');``
|
61 |
+
*
|
62 |
+
* @param string $title Expects a title passed in by the Filter.
|
63 |
+
*
|
64 |
+
* @return string A title based on s2Member's UI configuration.
|
65 |
+
*/
|
66 |
+
public static function login_header_title($title = '')
|
67 |
+
{
|
68 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_design_enabled'])
|
69 |
+
return $title; // Login/registration design disabled in this case.
|
70 |
+
|
71 |
+
do_action('ws_plugin__s2member_before_login_header_title', get_defined_vars());
|
72 |
+
|
73 |
+
$title = $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_logo_title'];
|
74 |
+
|
75 |
+
return apply_filters('ws_plugin__s2member_login_header_title', $title, get_defined_vars());
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Styles login/registration *( i.e. `/wp-login.php` )*.
|
80 |
+
*
|
81 |
+
* @package s2Member\Login_Customizations
|
82 |
+
* @since 3.5
|
83 |
+
*
|
84 |
+
* @attaches-to ``add_action('login_head');``
|
85 |
+
*/
|
86 |
+
public static function login_header_styles()
|
87 |
+
{
|
88 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_design_enabled'])
|
89 |
+
return; // Login/registration design disabled in this case.
|
90 |
+
|
91 |
+
$s = ''; // Initialize styles string here to give hooks a chance.
|
92 |
+
$a = array(); // Initialize here to give filters a chance.
|
93 |
+
|
94 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
95 |
+
do_action('ws_plugin__s2member_before_login_header_styles', get_defined_vars());
|
96 |
+
unset($__refs, $__v);
|
97 |
+
|
98 |
+
$a[] = '<style type="text/css">'; // Open style tag, then give filters a chance below.
|
99 |
+
$i = apply_filters('ws_plugin__s2member_login_header_styles_important', ' !important', get_defined_vars());
|
100 |
+
$a = apply_filters('ws_plugin__s2member_login_header_styles_array_after_open', $a, get_defined_vars());
|
101 |
+
|
102 |
+
$a[] = 'html, body { border:0'.$i.'; background:none'.$i.'; }';
|
103 |
+
$a[] = 'html { background-color:#'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_color'].$i.'; }';
|
104 |
+
$a[] = 'html { background-image:url('.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_image'].')'.$i.'; }';
|
105 |
+
$a[] = 'html { background-repeat:'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_image_repeat'].$i.'; }';
|
106 |
+
|
107 |
+
$a[] = 'body, body * { font-size:'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_font_size'].$i.'; }';
|
108 |
+
$a[] = 'body, body * { font-family:'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_font_family'].$i.'; }';
|
109 |
+
|
110 |
+
$a[] = 'div#login { width:'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_logo_src_width'].'px'.$i.'; }';
|
111 |
+
$a[] = 'div#login h1 a { background:url('.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_logo_src'].') no-repeat top center'.$i.'; background-size:auto'.$i.'; }';
|
112 |
+
$a[] = 'div#login h1 a { display:block'.$i.'; width:100%'.$i.'; height:'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_logo_src_height'].'px'.$i.'; }';
|
113 |
+
|
114 |
+
$a[] = 'div#login form { box-shadow:1px 1px 2px #'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_box_shadow_color'].', -1px -1px 2px #'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_box_shadow_color'].$i.'; border-radius:5px'.$i.'; padding-bottom:16px'.$i.'; }';
|
115 |
+
|
116 |
+
$a[] = 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color:#'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_text_color'].$i.'; text-shadow:1px 1px 3px #'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_text_shadow_color'].$i.'; }';
|
117 |
+
$a[] = 'div#login p#backtoblog, div#login p#backtoblog a, div#login p#backtoblog a:hover, div#login p#backtoblog a:active, div#login p#backtoblog a:focus { color:#'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_text_color'].$i.'; text-shadow:1px 1px 3px #'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_background_text_shadow_color'].$i.'; }';
|
118 |
+
|
119 |
+
$a[] = 'div#login form p { margin:2px 0 16px 0'.$i.'; }'; // Handles paragraph margins inside the form.
|
120 |
+
$a[] = 'div#login form input[type="text"], div#login form input[type="email"], div#login form input[type="password"], div#login form textarea, div#login form select { margin:0'.$i.'; padding:3px'.$i.'; border-radius:3px'.$i.'; box-sizing:border-box'.$i.'; width:100%'.$i.'; background:#FBFBFB repeat scroll 0 0'.$i.'; border:1px solid #E5E5E5'.$i.'; font-size:'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_font_field_size'].$i.'; font-weight:normal'.$i.'; color:#333333'.$i.'; }';
|
121 |
+
$a[] = 'div#login form label { cursor:pointer'.$i.'; } div#login form label.ws-plugin--s2member-custom-reg-field-op-l { opacity:0.7'.$i.'; font-size:90%'.$i.'; vertical-align:middle'.$i.'; }';
|
122 |
+
$a[] = 'div#login form input[type="checkbox"], div#login form input[type="radio"] { margin:0 3px 0 0'.$i.'; vertical-align:middle'.$i.'; }';
|
123 |
+
$a[] = 'div#login form input#ws-plugin--s2member-custom-reg-field-user-pass2[type="password"] { margin-top:5px'.$i.'; }';
|
124 |
+
|
125 |
+
$a[] = 'div#login form div.ws-plugin--s2member-custom-reg-field-divider-section { margin:2px 0 16px 0'.$i.'; border:0'.$i.'; height:1px'.$i.'; line-height:1px'.$i.'; background:#CCCCCC'.$i.'; }';
|
126 |
+
$a[] = 'div#login form div.ws-plugin--s2member-custom-reg-field-divider-section-title { margin:2px 0 16px 0'.$i.'; border:0 solid #CCCCCC'.$i.'; border-width:0 0 1px 0'.$i.'; padding:0 0 10px 0'.$i.'; font-size:110%'.$i.'; }';
|
127 |
+
|
128 |
+
$a[] = 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color:#666666'.$i.'; text-shadow:2px 2px 5px #EEEEEE'.$i.'; border:1px solid #999999'.$i.'; border-radius:3px'.$i.'; background:#FBFBFB'.$i.'; box-shadow:0 -1px 2px 0 rgba(0,0,0,0.2) inset'.$i.'; }';
|
129 |
+
$a[] = 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color:#000000'.$i.'; text-shadow:2px 2px 5px #CCCCCC'.$i.'; border-color:#000000'.$i.'; }';
|
130 |
+
$a[] = 'div#login form#registerform p.submit { float:none'.$i.'; margin-top:-10px'.$i.'; } div#login form#registerform input[type="submit"] { float:none'.$i.'; width:100%'.$i.'; box-sizing:border-box'.$i.'; }';
|
131 |
+
$a[] = 'div#login form#lostpasswordform p.submit { float:none'.$i.'; } div#login form#lostpasswordform input[type="submit"] { float:none'.$i.'; width:100%'.$i.'; box-sizing:border-box'.$i.'; }';
|
132 |
+
|
133 |
+
$a[] = 'div.ws-plugin--s2member-password-strength { margin-top:3px'.$i.'; font-color:#000000'.$i.'; background-color:#EEEEEE'.$i.'; padding:3px'.$i.'; border-radius:3px'.$i.'; } div.ws-plugin--s2member-password-strength-short { background-color:#FFA0A0'.$i.'; } div.ws-plugin--s2member-password-strength-bad { background-color:#FFB78C'.$i.'; } div.ws-plugin--s2member-password-strength-good { background-color:#FFEC8B'.$i.'; } div.ws-plugin--s2member-password-strength-strong { background-color:#C3FF88'.$i.'; } div.ws-plugin--s2member-password-strength-mismatch { background-color:#D6C1AB'.$i.'; }';
|
134 |
+
|
135 |
+
$a[] = 'div#login form#registerform p#reg_passmail { font-style:italic'.$i.'; }';
|
136 |
+
|
137 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password'])
|
138 |
+
$a[] = 'div#login form#registerform p#reg_passmail { display:none'.$i.'; }';
|
139 |
+
|
140 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_footer_backtoblog'])
|
141 |
+
$a[] = 'div#login p#backtoblog { display:none'.$i.'; }';
|
142 |
+
|
143 |
+
$a = apply_filters('ws_plugin__s2member_login_header_styles_array_before_close', $a, get_defined_vars());
|
144 |
+
$a[] = '</style>'; // Now close style tag. There are other filters below.
|
145 |
+
|
146 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
147 |
+
do_action('ws_plugin__s2member_during_login_header_styles', get_defined_vars());
|
148 |
+
unset($__refs, $__v);
|
149 |
+
|
150 |
+
$a = apply_filters('ws_plugin__s2member_login_header_styles_array', $a, get_defined_vars());
|
151 |
+
$s .= "\n".implode("\n", $a)."\n\n"; // Now put all array elements together.
|
152 |
+
|
153 |
+
echo apply_filters('ws_plugin__s2member_login_header_styles', $s, get_defined_vars());
|
154 |
+
|
155 |
+
do_action('ws_plugin__s2member_after_login_header_styles', get_defined_vars());
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Displays login footer design.
|
160 |
+
*
|
161 |
+
* @package s2Member\Login_Customizations
|
162 |
+
* @since 3.5
|
163 |
+
*
|
164 |
+
* @attaches-to ``add_action('login_footer');``
|
165 |
+
*
|
166 |
+
* @return void
|
167 |
+
*/
|
168 |
+
public static function login_footer_design()
|
169 |
+
{
|
170 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_design_enabled'])
|
171 |
+
return; // Login/registration design disabled in this case.
|
172 |
+
|
173 |
+
do_action('ws_plugin__s2member_before_login_footer_design', get_defined_vars());
|
174 |
+
|
175 |
+
if(($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_reg_footer_design']))
|
176 |
+
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
{
|
178 |
+
echo $code."\n"; // No PHP here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
+
else // Otherwise, safe to allow PHP code.
|
181 |
+
{
|
182 |
+
eval('?>'.$code);
|
183 |
+
}
|
184 |
+
do_action('ws_plugin__s2member_after_login_footer_design', get_defined_vars());
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Filters the Lost Password URL when the call is made from the /wp-login.php system
|
189 |
+
* and changes the default behavior of wp_lostpassword_url() so that it uses site_url()
|
190 |
+
* instead of network_site_url(), but only if the current $_SERVER['REQUEST_URI'] differs
|
191 |
+
* from the Parent Site URL, as returned by network_site_url(). In a non-multisite
|
192 |
+
* environment, the default WordPress behavior (as of v3.9.1) is used.
|
193 |
+
*
|
194 |
+
* @package s2Member\Login_Customizations
|
195 |
+
* @since 140603
|
196 |
+
*
|
197 |
+
* @attaches-to ``add_filter('lostpassword_url');``
|
198 |
+
*
|
199 |
+
* @param string $lostpassword_url The lost password page URL.
|
200 |
+
* @param string $redirect The path to redirect to on login.
|
201 |
+
*
|
202 |
+
* @return string Lost password URL.
|
203 |
+
*/
|
204 |
+
public static function lost_password_url($lostpassword_url, $redirect)
|
205 |
+
{
|
206 |
+
$scheme = (is_ssl()) ? 'https' : 'http';
|
207 |
+
$url = $scheme.'://'.$_SERVER['HTTP_HOST'].strtok($_SERVER['REQUEST_URI'], '?');
|
208 |
+
|
209 |
+
if(basename(strtok($_SERVER['REQUEST_URI'], '?')) === 'wp-login.php'
|
210 |
+
&& strpos($url, (string)network_site_url('wp-login.php')) === FALSE
|
211 |
+
&& apply_filters('ws_plugin__s2member_tweak_lost_password_url', TRUE, get_defined_vars())
|
212 |
+
)
|
213 |
+
{
|
214 |
+
$args = array('action' => 'lostpassword');
|
215 |
+
if(!empty($redirect)) $args['redirect_to'] = $redirect;
|
216 |
+
|
217 |
+
$lostpassword_url = add_query_arg(urlencode_deep($args), site_url('wp-login.php', 'login'));
|
218 |
+
}
|
219 |
+
return apply_filters('ws_plugin__s2member_lost_password_url', $lostpassword_url, $redirect, get_defined_vars());
|
220 |
}
|
221 |
}
|
222 |
+
}
|
includes/classes/login-redirects.inc.php
CHANGED
@@ -186,12 +186,12 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
186 |
$user_ccaps = (string)implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
187 |
$user_logins = ($user) ? (string)(int)get_user_option ("s2member_login_counter", $user_id) : "-1";
|
188 |
|
189 |
-
$url = preg_replace ("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
190 |
-
$url = preg_replace ("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
191 |
-
$url = preg_replace ("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::
|
192 |
-
$url = preg_replace ("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::
|
193 |
-
$url = preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
194 |
-
$url = preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::
|
195 |
|
196 |
if ( /* Only if s2Member's fault » */$url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url ($url, -1, false)) || (!empty($parse["path"]) && strpos ($parse["path"], "//") !== false)))
|
197 |
$url = /* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */ site_url ("/");
|
186 |
$user_ccaps = (string)implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
187 |
$user_logins = ($user) ? (string)(int)get_user_option ("s2member_login_counter", $user_id) : "-1";
|
188 |
|
189 |
+
$url = preg_replace ("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_login), $url);
|
190 |
+
$url = preg_replace ("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $url);
|
191 |
+
$url = preg_replace ("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_level), $url);
|
192 |
+
$url = preg_replace ("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_role), $url);
|
193 |
+
$url = preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ccaps), $url);
|
194 |
+
$url = preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_logins), $url);
|
195 |
|
196 |
if ( /* Only if s2Member's fault » */$url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url ($url, -1, false)) || (!empty($parse["path"]) && strpos ($parse["path"], "//") !== false)))
|
197 |
$url = /* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */ site_url ("/");
|
includes/classes/paypal-notify-in-billing-agreement-signup.inc.php
CHANGED
@@ -65,16 +65,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_sig
|
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `mp_signup` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
68 |
-
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
do_action("ws_plugin__s2member_during_paypal_notify_after_billing_agreement_signup", get_defined_vars ());
|
71 |
unset($__refs, $__v);
|
72 |
|
73 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
-
else
|
76 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup", false, get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
-
}
|
80 |
-
?>
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `mp_signup` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
|
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
do_action("ws_plugin__s2member_during_paypal_notify_after_billing_agreement_signup", get_defined_vars ());
|
70 |
unset($__refs, $__v);
|
71 |
|
72 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup", false, get_defined_vars ());
|
|
|
75 |
}
|
76 |
}
|
77 |
+
}
|
|
includes/classes/paypal-notify-in-cart.inc.php
CHANGED
@@ -65,7 +65,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_cart"))
|
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `cart` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
68 |
-
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
do_action("ws_plugin__s2member_during_paypal_notify_after_cart", get_defined_vars ());
|
71 |
unset($__refs, $__v);
|
@@ -75,5 +74,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_cart"))
|
|
75 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_cart", false, get_defined_vars ());
|
76 |
}
|
77 |
}
|
78 |
-
}
|
79 |
-
?>
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `cart` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
|
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
do_action("ws_plugin__s2member_during_paypal_notify_after_cart", get_defined_vars ());
|
70 |
unset($__refs, $__v);
|
74 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_cart", false, get_defined_vars ());
|
75 |
}
|
76 |
}
|
77 |
+
}
|
|
includes/classes/paypal-notify-in-express-checkout.inc.php
CHANGED
@@ -65,16 +65,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_express_checkout"))
|
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `express_checkout` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
68 |
-
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
do_action("ws_plugin__s2member_during_paypal_notify_after_express_checkout", get_defined_vars ());
|
71 |
unset($__refs, $__v);
|
72 |
|
73 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_express_checkout", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
-
else
|
76 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_express_checkout", false, get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
-
}
|
80 |
-
?>
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `express_checkout` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
|
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
do_action("ws_plugin__s2member_during_paypal_notify_after_express_checkout", get_defined_vars ());
|
70 |
unset($__refs, $__v);
|
71 |
|
72 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_express_checkout", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_express_checkout", false, get_defined_vars ());
|
|
|
75 |
}
|
76 |
}
|
77 |
+
}
|
|
includes/classes/paypal-notify-in-merch-pmt.inc.php
CHANGED
@@ -65,16 +65,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_merch_pmt"))
|
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `merch_pmt` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
68 |
-
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
do_action("ws_plugin__s2member_during_paypal_notify_after_merch_pmt", get_defined_vars ());
|
71 |
unset($__refs, $__v);
|
72 |
|
73 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_merch_pmt", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
-
else
|
76 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_merch_pmt", false, get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
-
}
|
80 |
-
?>
|
65 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `merch_pmt` ).";
|
66 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
67 |
}
|
|
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
do_action("ws_plugin__s2member_during_paypal_notify_after_merch_pmt", get_defined_vars ());
|
70 |
unset($__refs, $__v);
|
71 |
|
72 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_merch_pmt", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_merch_pmt", false, get_defined_vars ());
|
|
|
75 |
}
|
76 |
}
|
77 |
+
}
|
|
includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php
CHANGED
@@ -44,7 +44,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_
|
|
44 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
46 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
47 |
-
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
|
|
|
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_notify_before_recurring_payment_profile_created", get_defined_vars ());
|
@@ -69,16 +71,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_
|
|
69 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `recurring_payment_profile_created` ).";
|
70 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
71 |
}
|
72 |
-
|
73 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
74 |
do_action("ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created", get_defined_vars ());
|
75 |
unset($__refs, $__v);
|
76 |
|
77 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", $paypal, get_defined_vars ());
|
78 |
}
|
79 |
-
else
|
80 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", false, get_defined_vars ());
|
81 |
}
|
82 |
}
|
83 |
-
}
|
84 |
-
?>
|
44 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
46 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
47 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
48 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
49 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"])))
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
do_action("ws_plugin__s2member_during_paypal_notify_before_recurring_payment_profile_created", get_defined_vars ());
|
71 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `recurring_payment_profile_created` ).";
|
72 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
73 |
}
|
|
|
74 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
75 |
do_action("ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created", get_defined_vars ());
|
76 |
unset($__refs, $__v);
|
77 |
|
78 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", $paypal, get_defined_vars ());
|
79 |
}
|
80 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", false, get_defined_vars ());
|
|
|
81 |
}
|
82 |
}
|
83 |
+
}
|
|
includes/classes/paypal-notify-in-send-money.inc.php
CHANGED
@@ -64,16 +64,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_send_money"))
|
|
64 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `send_money` ).";
|
65 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
66 |
}
|
67 |
-
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
do_action("ws_plugin__s2member_during_paypal_notify_after_send_money", get_defined_vars ());
|
70 |
unset($__refs, $__v);
|
71 |
|
72 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_send_money", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
-
else
|
75 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_send_money", false, get_defined_vars ());
|
76 |
}
|
77 |
}
|
78 |
-
}
|
79 |
-
?>
|
64 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `send_money` ).";
|
65 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
66 |
}
|
|
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
do_action("ws_plugin__s2member_during_paypal_notify_after_send_money", get_defined_vars ());
|
69 |
unset($__refs, $__v);
|
70 |
|
71 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_send_money", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_send_money", false, get_defined_vars ());
|
|
|
74 |
}
|
75 |
}
|
76 |
+
}
|
|
includes/classes/paypal-notify-in-sp-refund-reversal.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -46,7 +44,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
46 |
|| (!empty($paypal["payment_status"]) && preg_match ("/^(refunded|reversed|reversal)$/i", $paypal["payment_status"])) /* The "txn_type" is irrelevant in these special situations. */)
|
47 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
48 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))
|
49 |
-
&& (!empty($paypal["payer_email"])) && (!empty($paypal["parent_txn_id"])))
|
|
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_refund_reversal", get_defined_vars ());
|
@@ -70,26 +69,28 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
70 |
{
|
71 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"]) as $url)
|
72 |
|
73 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::
|
74 |
-
if (($url = preg_replace ("/%%
|
75 |
-
if (($url = preg_replace ("
|
76 |
-
if (($url = preg_replace ("
|
77 |
-
if (($url = preg_replace ("/%%
|
78 |
-
if (($url = preg_replace ("/%%
|
79 |
-
if (($url = preg_replace ("/%%
|
|
|
80 |
|
81 |
-
|
82 |
-
|
83 |
|
84 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.";
|
85 |
}
|
86 |
-
|
87 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
88 |
{
|
89 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Refund/Reversal";
|
90 |
$msg .= "\n\n"; // Spacing in the message body.
|
91 |
|
92 |
$msg .= "parent_txn_id: %%parent_txn_id%%\n";
|
|
|
|
|
93 |
$msg .= "item_number: %%item_number%%\n";
|
94 |
$msg .= "item_name: %%item_name%%\n";
|
95 |
$msg .= "-amount: %%-amount%%\n";
|
@@ -111,22 +112,22 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
111 |
$msg .= "cv8: %%cv8%%\n";
|
112 |
$msg .= "cv9: %%cv9%%";
|
113 |
|
114 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
115 |
-
if (($msg = preg_replace ("/%%
|
116 |
-
if (($msg = preg_replace ("
|
117 |
-
if (($msg = preg_replace ("
|
118 |
-
if (($msg = preg_replace ("/%%
|
119 |
-
if (($msg = preg_replace ("/%%
|
120 |
-
if (($msg = preg_replace ("/%%
|
|
|
121 |
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
|
126 |
|
127 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification Emails have been processed.";
|
128 |
}
|
129 |
-
|
130 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
131 |
do_action("ws_plugin__s2member_during_paypal_notify_during_sp_refund_reversal", get_defined_vars ());
|
132 |
unset($__refs, $__v);
|
@@ -137,16 +138,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
137 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` ).";
|
138 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
139 |
}
|
140 |
-
|
141 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
142 |
do_action("ws_plugin__s2member_during_paypal_notify_after_sp_refund_reversal", get_defined_vars ());
|
143 |
unset($__refs, $__v);
|
144 |
|
145 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal", $paypal, get_defined_vars ());
|
146 |
}
|
147 |
-
else
|
148 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal", false, get_defined_vars ());
|
149 |
}
|
150 |
}
|
151 |
-
}
|
152 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
44 |
|| (!empty($paypal["payment_status"]) && preg_match ("/^(refunded|reversed|reversal)$/i", $paypal["payment_status"])) /* The "txn_type" is irrelevant in these special situations. */)
|
45 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
46 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))
|
47 |
+
&& (!empty($paypal["payer_email"])) && (!empty($paypal["parent_txn_id"])) && (!empty($paypal["parent_txn_baid"]) || ($paypal["parent_txn_baid"] = $paypal["parent_txn_id"]))
|
48 |
+
&& (!empty($paypal["parent_txn_cid"]) || ($paypal["parent_txn_cid"] = $paypal["parent_txn_id"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_refund_reversal", get_defined_vars ());
|
69 |
{
|
70 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"]) as $url)
|
71 |
|
72 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["parent_txn_id"])), $url)))
|
73 |
+
if (($url = preg_replace ("/%%parent_txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["parent_txn_baid"])), $url)) && ($url = preg_replace ("/%%parent_txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["parent_txn_cid"])), $url)))
|
74 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
75 |
+
if (($url = preg_replace ("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_fee"])), $url)))
|
76 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
77 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
78 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
79 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["ip"])), $url)))
|
80 |
|
81 |
+
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
82 |
+
c_ws_plugin__s2member_utils_urls::remote ($url);
|
83 |
|
84 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.";
|
85 |
}
|
|
|
86 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
87 |
{
|
88 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Refund/Reversal";
|
89 |
$msg .= "\n\n"; // Spacing in the message body.
|
90 |
|
91 |
$msg .= "parent_txn_id: %%parent_txn_id%%\n";
|
92 |
+
$msg .= "parent_txn_baid: %%parent_txn_baid%%\n";
|
93 |
+
$msg .= "parent_txn_cid: %%parent_txn_cid%%\n";
|
94 |
$msg .= "item_number: %%item_number%%\n";
|
95 |
$msg .= "item_name: %%item_name%%\n";
|
96 |
$msg .= "-amount: %%-amount%%\n";
|
112 |
$msg .= "cv8: %%cv8%%\n";
|
113 |
$msg .= "cv9: %%cv9%%";
|
114 |
|
115 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["parent_txn_id"]), $msg)))
|
116 |
+
if (($msg = preg_replace ("/%%parent_txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["parent_txn_baid"]), $msg)) && ($msg = preg_replace ("/%%parent_txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["parent_txn_cid"]), $msg)))
|
117 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
118 |
+
if (($msg = preg_replace ("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_fee"]), $msg)))
|
119 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
120 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
121 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
122 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $msg)))
|
123 |
|
124 |
+
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
125 |
|
126 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"]) as $recipient)
|
127 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_sp_ref_rev_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_sp_ref_rev_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
128 |
|
129 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification Emails have been processed.";
|
130 |
}
|
|
|
131 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
132 |
do_action("ws_plugin__s2member_during_paypal_notify_during_sp_refund_reversal", get_defined_vars ());
|
133 |
unset($__refs, $__v);
|
138 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` ).";
|
139 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
140 |
}
|
|
|
141 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
142 |
do_action("ws_plugin__s2member_during_paypal_notify_after_sp_refund_reversal", get_defined_vars ());
|
143 |
unset($__refs, $__v);
|
144 |
|
145 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal", $paypal, get_defined_vars ());
|
146 |
}
|
147 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal", false, get_defined_vars ());
|
|
|
148 |
}
|
149 |
}
|
150 |
+
}
|
|
includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -44,7 +42,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
44 |
|
45 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^subscr_modify$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
47 |
-
&& (!empty($paypal["subscr_id"])) && (!empty($paypal["payer_email"]))
|
|
|
|
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
|
@@ -107,10 +107,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
107 |
|
108 |
update_user_option ($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
|
109 |
update_user_option ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
|
110 |
-
|
111 |
-
|
112 |
-
update_user_option ($user_id, "s2member_subscr_baid", $paypal["subscr_baid"]);
|
113 |
-
else delete_user_option ($user_id, "s2member_subscr_baid");
|
114 |
|
115 |
update_user_option ($user_id, "s2member_custom", $paypal["custom"]);
|
116 |
|
@@ -137,103 +135,107 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
137 |
$msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_message"]; // The same for standard and w/ Pro Forms.
|
138 |
$rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_recipients"]; // The same for standard and w/ Pro Forms.
|
139 |
|
140 |
-
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
141 |
-
if (($rec = preg_replace ("/%%
|
142 |
-
if (($rec = preg_replace ("/%%
|
143 |
-
if (($rec = preg_replace ("/%%
|
144 |
-
if (($rec = preg_replace ("/%%
|
145 |
-
if (($rec = preg_replace ("/%%
|
146 |
-
if (($rec = preg_replace ("/%%
|
147 |
-
if (($rec = preg_replace ("/%%
|
148 |
-
if (($rec = preg_replace ("/%%
|
149 |
-
|
150 |
-
|
151 |
-
if (($rec = preg_replace ("/%%
|
152 |
-
if (($rec = preg_replace ("/%%
|
153 |
-
if (($rec = preg_replace ("/%%
|
154 |
-
if (($rec = preg_replace ("/%%
|
155 |
-
if (($rec = preg_replace ("/%%
|
156 |
-
|
157 |
-
|
158 |
-
if (($sbj = preg_replace ("/%%
|
159 |
-
if (($sbj = preg_replace ("/%%
|
160 |
-
if (($sbj = preg_replace ("/%%
|
161 |
-
if (($sbj = preg_replace ("/%%
|
162 |
-
if (($sbj = preg_replace ("/%%
|
163 |
-
if (($sbj = preg_replace ("/%%
|
164 |
-
if (($sbj = preg_replace ("/%%
|
165 |
-
if (($sbj = preg_replace ("/%%
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
if (($sbj = preg_replace ("/%%
|
170 |
-
if (($sbj = preg_replace ("/%%
|
171 |
-
if (($sbj = preg_replace ("/%%
|
172 |
-
if (($sbj = preg_replace ("/%%
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
if (($msg = preg_replace ("/%%
|
177 |
-
if (($msg = preg_replace ("/%%
|
178 |
-
if (($msg = preg_replace ("/%%
|
179 |
-
if (($msg = preg_replace ("/%%
|
180 |
-
if (($msg = preg_replace ("/%%
|
181 |
-
if (($msg = preg_replace ("/%%
|
182 |
-
if (($msg = preg_replace ("/%%
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
if (($msg = preg_replace ("/%%
|
188 |
-
if (($msg = preg_replace ("/%%
|
189 |
-
if (($msg = preg_replace ("/%%
|
190 |
-
|
191 |
-
if (
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
-
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
205 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
206 |
-
|
207 |
-
$paypal["s2member_log"][] = "Modification Confirmation Email sent to: " . $rec . ".";
|
208 |
-
}
|
209 |
-
}
|
210 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
211 |
{
|
212 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) as $url)
|
213 |
|
214 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::
|
215 |
-
if (($url = preg_replace ("/%%
|
216 |
-
if (($url = preg_replace ("/%%
|
217 |
-
if (($url = preg_replace ("/%%
|
218 |
-
if (($url = preg_replace ("/%%
|
219 |
-
if (($url = preg_replace ("/%%
|
220 |
-
if (($url = preg_replace ("/%%
|
221 |
-
|
222 |
-
|
223 |
-
if (($url = preg_replace ("/%%
|
224 |
-
if (($url = preg_replace ("/%%
|
225 |
-
if (($url = preg_replace ("/%%
|
226 |
-
if (($url = preg_replace ("/%%
|
227 |
-
if (($url = preg_replace ("/%%
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
237 |
$paypal["s2member_log"][] = "Modification Notification URLs have been processed.";
|
238 |
}
|
239 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
@@ -242,6 +244,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
242 |
$msg .= "\n\n"; // Spacing in the message body.
|
243 |
|
244 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
|
|
|
|
245 |
$msg .= "initial: %%initial%%\n";
|
246 |
$msg .= "regular: %%regular%%\n";
|
247 |
$msg .= "recurring: %%recurring%%\n";
|
@@ -277,73 +281,72 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
277 |
$msg .= "cv8: %%cv8%%\n";
|
278 |
$msg .= "cv9: %%cv9%%";
|
279 |
|
280 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
281 |
-
if (($msg = preg_replace ("/%%
|
282 |
-
if (($msg = preg_replace ("/%%
|
283 |
-
if (($msg = preg_replace ("/%%
|
284 |
-
if (($msg = preg_replace ("/%%
|
285 |
-
if (($msg = preg_replace ("/%%
|
286 |
-
if (($msg = preg_replace ("/%%
|
287 |
-
|
288 |
-
|
289 |
-
if (($msg = preg_replace ("/%%
|
290 |
-
if (($msg = preg_replace ("/%%
|
291 |
-
if (($msg = preg_replace ("/%%
|
292 |
-
if (($msg = preg_replace ("/%%
|
293 |
-
if (($msg = preg_replace ("/%%
|
294 |
-
|
295 |
-
if (is_array($fields) && !empty($fields))
|
296 |
-
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
297 |
-
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
298 |
-
break;
|
299 |
-
|
300 |
-
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
301 |
-
|
302 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
303 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
304 |
-
}
|
305 |
-
|
306 |
-
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
307 |
-
}
|
308 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
309 |
-
{
|
310 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
311 |
-
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
312 |
-
if (($code = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $code)) && ($code = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $code)))
|
313 |
-
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
314 |
-
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $code)))
|
315 |
-
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
316 |
-
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $code)))
|
317 |
-
{
|
318 |
-
if (($code = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $code)) && ($code = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $code)))
|
319 |
-
if (($code = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $code)))
|
320 |
-
if (($code = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $code)))
|
321 |
-
if (($code = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $code)))
|
322 |
-
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
323 |
-
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
324 |
{
|
325 |
if (is_array($fields) && !empty($fields))
|
326 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
327 |
-
if (!($
|
328 |
break;
|
329 |
|
330 |
-
if (($
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
}
|
335 |
}
|
336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
}
|
338 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
339 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
|
340 |
unset($__refs, $__v);
|
341 |
}
|
342 |
-
else
|
343 |
-
$paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
344 |
}
|
345 |
-
else
|
346 |
-
$paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
|
347 |
}
|
348 |
else // Else, this is a duplicate IPN. Must stop here.
|
349 |
{
|
@@ -357,9 +360,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
357 |
|
358 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level", $paypal, get_defined_vars ());
|
359 |
}
|
360 |
-
else
|
361 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level", false, get_defined_vars ());
|
362 |
}
|
363 |
}
|
364 |
-
}
|
365 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
42 |
|
43 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^subscr_modify$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
+
&& (!empty($paypal["subscr_id"])) && (!empty($paypal["payer_email"]))
|
46 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
47 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"])))
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
|
107 |
|
108 |
update_user_option ($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
|
109 |
update_user_option ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
|
110 |
+
update_user_option ($user_id, "s2member_subscr_baid", $paypal["subscr_baid"]);
|
111 |
+
update_user_option ($user_id, "s2member_subscr_cid", $paypal["subscr_cid"]);
|
|
|
|
|
112 |
|
113 |
update_user_option ($user_id, "s2member_custom", $paypal["custom"]);
|
114 |
|
135 |
$msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_message"]; // The same for standard and w/ Pro Forms.
|
136 |
$rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_recipients"]; // The same for standard and w/ Pro Forms.
|
137 |
|
138 |
+
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $rec)) && ($rec = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $rec)))
|
139 |
+
if (($rec = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $rec)) && ($rec = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $rec)))
|
140 |
+
if (($rec = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial"]), $rec)) && ($rec = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular"]), $rec)))
|
141 |
+
if (($rec = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial_term"]), $rec)) && ($rec = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular_term"]), $rec)))
|
142 |
+
if (($rec = preg_replace ("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::period_term ($paypal["initial_term"])), $rec)) && ($rec = preg_replace ("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], $paypal["recurring"])), $rec)))
|
143 |
+
if (($rec = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["recurring"]), $rec)) && ($rec = preg_replace ("/%%recurring\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], true) : "0 / non-recurring")), $rec)))
|
144 |
+
if (($rec = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $rec)) && ($rec = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $rec)))
|
145 |
+
if (($rec = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"])), $rec)) && ($rec = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"])), $rec)))
|
146 |
+
if (($rec = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $rec))) // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
|
147 |
+
if (($rec = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $rec)))
|
148 |
+
|
149 |
+
if (($rec = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $rec)) && ($rec = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $rec)))
|
150 |
+
if (($rec = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $rec)))
|
151 |
+
if (($rec = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $rec)))
|
152 |
+
if (($rec = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $rec)))
|
153 |
+
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $rec)))
|
154 |
+
if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $rec)))
|
155 |
+
|
156 |
+
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $sbj)))
|
157 |
+
if (($sbj = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $sbj)) && ($sbj = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $sbj)))
|
158 |
+
if (($sbj = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial"]), $sbj)) && ($sbj = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular"]), $sbj)))
|
159 |
+
if (($sbj = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial_term"]), $sbj)) && ($sbj = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular_term"]), $sbj)))
|
160 |
+
if (($sbj = preg_replace ("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::period_term ($paypal["initial_term"])), $sbj)) && ($sbj = preg_replace ("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], $paypal["recurring"])), $sbj)))
|
161 |
+
if (($sbj = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["recurring"]), $sbj)) && ($sbj = preg_replace ("/%%recurring\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], true) : "0 / non-recurring")), $sbj)))
|
162 |
+
if (($sbj = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $sbj)))
|
163 |
+
if (($sbj = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $sbj)))
|
164 |
+
if (($sbj = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)))
|
165 |
+
if (($sbj = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $sbj)))
|
166 |
+
|
167 |
+
if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $sbj)) && ($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $sbj)))
|
168 |
+
if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $sbj)))
|
169 |
+
if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $sbj)))
|
170 |
+
if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $sbj)))
|
171 |
+
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $sbj)))
|
172 |
+
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $sbj)))
|
173 |
+
|
174 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $msg)))
|
175 |
+
if (($msg = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $msg)) && ($msg = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $msg)))
|
176 |
+
if (($msg = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial"]), $msg)) && ($msg = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular"]), $msg)))
|
177 |
+
if (($msg = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial_term"]), $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular_term"]), $msg)))
|
178 |
+
if (($msg = preg_replace ("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::period_term ($paypal["initial_term"])), $msg)) && ($msg = preg_replace ("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], $paypal["recurring"])), $msg)))
|
179 |
+
if (($msg = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["recurring"]), $msg)) && ($msg = preg_replace ("/%%recurring\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], true) : "0 / non-recurring")), $msg)))
|
180 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
181 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
182 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
183 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
184 |
+
|
185 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
186 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
187 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
188 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
189 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
190 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
191 |
+
{
|
192 |
+
if (is_array($fields) && !empty($fields)) foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
193 |
+
{
|
194 |
+
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $rec);
|
195 |
+
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $sbj);
|
196 |
+
$msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg);
|
197 |
+
}
|
198 |
+
if (($rec = trim (preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
199 |
+
{
|
200 |
+
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
|
201 |
+
{
|
202 |
+
$sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
|
203 |
+
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
204 |
+
}
|
205 |
+
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
206 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
207 |
+
|
208 |
+
$paypal["s2member_log"][] = "Modification Confirmation Email sent to: " . $rec . ".";
|
209 |
+
}
|
210 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
212 |
{
|
213 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) as $url)
|
214 |
|
215 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_id"])), $url)))
|
216 |
+
if (($url = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_baid"])), $url)) && ($url = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_cid"])), $url)))
|
217 |
+
if (($url = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["initial"])), $url)) && ($url = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["regular"])), $url)) && ($url = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["recurring"])), $url)))
|
218 |
+
if (($url = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["initial_term"])), $url)) && ($url = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["regular_term"])), $url)))
|
219 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
220 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
221 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
222 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
223 |
+
|
224 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->last_name)), $url)))
|
225 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
226 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_email)), $url)))
|
227 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_login)), $url)))
|
228 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_reg_ip)), $url)))
|
229 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
230 |
+
{
|
231 |
+
if (is_array($fields) && !empty($fields))
|
232 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
233 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
234 |
+
break;
|
235 |
+
|
236 |
+
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
237 |
+
c_ws_plugin__s2member_utils_urls::remote ($url);
|
238 |
+
}
|
239 |
$paypal["s2member_log"][] = "Modification Notification URLs have been processed.";
|
240 |
}
|
241 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
244 |
$msg .= "\n\n"; // Spacing in the message body.
|
245 |
|
246 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
247 |
+
$msg .= "subscr_baid: %%subscr_baid%%\n";
|
248 |
+
$msg .= "subscr_cid: %%subscr_cid%%\n";
|
249 |
$msg .= "initial: %%initial%%\n";
|
250 |
$msg .= "regular: %%regular%%\n";
|
251 |
$msg .= "recurring: %%recurring%%\n";
|
281 |
$msg .= "cv8: %%cv8%%\n";
|
282 |
$msg .= "cv9: %%cv9%%";
|
283 |
|
284 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $msg)))
|
285 |
+
if (($msg = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $msg)) && ($msg = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $msg)))
|
286 |
+
if (($msg = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial"]), $msg)) && ($msg = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular"]), $msg)) && ($msg = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["recurring"]), $msg)))
|
287 |
+
if (($msg = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial_term"]), $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular_term"]), $msg)))
|
288 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
289 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
290 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
291 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
292 |
+
|
293 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
294 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
295 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
296 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
297 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
298 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
{
|
300 |
if (is_array($fields) && !empty($fields))
|
301 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
302 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
303 |
break;
|
304 |
|
305 |
+
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
306 |
+
|
307 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
308 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
|
|
309 |
}
|
310 |
+
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
311 |
+
}
|
312 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
313 |
+
{
|
314 |
+
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $code)))
|
315 |
+
if (($code = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $code)) && ($code = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $code)))
|
316 |
+
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["recurring"]), $code)))
|
317 |
+
if (($code = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["initial_term"]), $code)) && ($code = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["regular_term"]), $code)))
|
318 |
+
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $code)))
|
319 |
+
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $code)))
|
320 |
+
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
321 |
+
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $code)))
|
322 |
+
{
|
323 |
+
if (($code = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $code)) && ($code = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $code)))
|
324 |
+
if (($code = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $code)))
|
325 |
+
if (($code = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $code)))
|
326 |
+
if (($code = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $code)))
|
327 |
+
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $code)))
|
328 |
+
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $code)))
|
329 |
+
{
|
330 |
+
if (is_array($fields) && !empty($fields))
|
331 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
332 |
+
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $code)))
|
333 |
+
break;
|
334 |
+
|
335 |
+
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code)))) // This gets stored into a Transient Queue.
|
336 |
+
{
|
337 |
+
$paypal["s2member_log"][] = "Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.";
|
338 |
+
set_transient ("s2m_" . md5 ("s2member_transient_modification_tracking_codes_" . $paypal["subscr_id"]), $code, 43200);
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
342 |
}
|
343 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
344 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
|
345 |
unset($__refs, $__v);
|
346 |
}
|
347 |
+
else $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
|
|
348 |
}
|
349 |
+
else $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
|
|
|
350 |
}
|
351 |
else // Else, this is a duplicate IPN. Must stop here.
|
352 |
{
|
360 |
|
361 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level", $paypal, get_defined_vars ());
|
362 |
}
|
363 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level", false, get_defined_vars ());
|
|
|
364 |
}
|
365 |
}
|
366 |
+
}
|
|
includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -49,7 +47,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
49 |
&& (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal)))
|
50 |
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
51 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
52 |
-
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
|
|
|
|
53 |
{
|
54 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
55 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
|
@@ -86,40 +86,40 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
86 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
|
87 |
unset($__refs, $__v);
|
88 |
}
|
89 |
-
else
|
90 |
-
$paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member. An s2Member API Notification will still be processed however.";
|
91 |
|
92 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) // Handle Cancellation Notifications.
|
95 |
|
96 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::
|
97 |
-
if (($url = preg_replace ("/%%
|
98 |
-
if (($url = preg_replace ("/%%
|
99 |
-
if (($url = preg_replace ("/%%
|
100 |
-
if (($url = preg_replace ("/%%
|
101 |
-
if (($url = preg_replace ("/%%
|
102 |
-
if (($url = preg_replace ("/%%
|
103 |
-
if (($url = preg_replace ("/%%
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
$paypal["s2member_log"][] = "Cancellation Notification URLs have been processed.";
|
115 |
}
|
116 |
-
|
117 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
118 |
{
|
119 |
$msg = $sbj = "(s2Member / API Notification Email) - Cancellation";
|
120 |
$msg .= "\n\n"; // Spacing in the message body.
|
121 |
|
122 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
|
|
|
|
123 |
$msg .= "item_number: %%item_number%%\n";
|
124 |
$msg .= "item_name: %%item_name%%\n";
|
125 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
@@ -145,34 +145,32 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
145 |
$msg .= "cv8: %%cv8%%\n";
|
146 |
$msg .= "cv9: %%cv9%%";
|
147 |
|
148 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
149 |
-
if (($msg = preg_replace ("/%%
|
150 |
-
if (($msg = preg_replace ("/%%
|
151 |
-
if (($msg = preg_replace ("/%%
|
152 |
-
if (($msg = preg_replace ("/%%
|
153 |
-
if (($msg = preg_replace ("/%%
|
154 |
-
if (($msg = preg_replace ("/%%
|
155 |
-
if (($msg = preg_replace ("/%%
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"]) as $recipient)
|
165 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_cancellation_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_cancellation_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
166 |
-
}
|
167 |
|
|
|
|
|
|
|
168 |
$paypal["s2member_log"][] = "Cancellation Notification Emails have been processed.";
|
169 |
}
|
170 |
}
|
171 |
-
else
|
172 |
-
$paypal["s2member_log"][] = "Ignoring Cancellation. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
173 |
}
|
174 |
-
else
|
175 |
-
$paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
|
176 |
}
|
177 |
else // Else, this is a duplicate IPN. Must stop here.
|
178 |
{
|
@@ -180,7 +178,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
180 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_cancel|recurring_payment_profile_cancel` ).";
|
181 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
182 |
}
|
183 |
-
|
184 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
185 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
|
186 |
unset($__refs, $__v);
|
@@ -190,5 +187,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
190 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancellation_w_level", false, get_defined_vars ());
|
191 |
}
|
192 |
}
|
193 |
-
}
|
194 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
47 |
&& (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal)))
|
48 |
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
49 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
50 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
51 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
52 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"])))
|
53 |
{
|
54 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
55 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
|
86 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
|
87 |
unset($__refs, $__v);
|
88 |
}
|
89 |
+
else $paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member. An s2Member API Notification will still be processed however.";
|
|
|
90 |
|
91 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
92 |
{
|
93 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) // Handle Cancellation Notifications.
|
94 |
|
95 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_id"])), $url)))
|
96 |
+
if (($url = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_baid"])), $url)) && ($url = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_cid"])), $url)))
|
97 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
98 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->last_name)), $url)))
|
99 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
100 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_email)), $url)))
|
101 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_login)), $url)))
|
102 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_reg_ip)), $url)))
|
103 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
104 |
+
{
|
105 |
+
if (is_array($fields) && !empty($fields))
|
106 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
107 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
108 |
+
break;
|
109 |
+
|
110 |
+
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
111 |
+
c_ws_plugin__s2member_utils_urls::remote ($url);
|
112 |
+
}
|
113 |
$paypal["s2member_log"][] = "Cancellation Notification URLs have been processed.";
|
114 |
}
|
|
|
115 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
116 |
{
|
117 |
$msg = $sbj = "(s2Member / API Notification Email) - Cancellation";
|
118 |
$msg .= "\n\n"; // Spacing in the message body.
|
119 |
|
120 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
121 |
+
$msg .= "subscr_baid: %%subscr_baid%%\n";
|
122 |
+
$msg .= "subscr_cid: %%subscr_cid%%\n";
|
123 |
$msg .= "item_number: %%item_number%%\n";
|
124 |
$msg .= "item_name: %%item_name%%\n";
|
125 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
145 |
$msg .= "cv8: %%cv8%%\n";
|
146 |
$msg .= "cv9: %%cv9%%";
|
147 |
|
148 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $msg)))
|
149 |
+
if (($msg = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $msg)) && ($msg = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $msg)))
|
150 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
151 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
152 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
153 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
154 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
155 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
156 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
157 |
+
{
|
158 |
+
if (is_array($fields) && !empty($fields))
|
159 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
160 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
161 |
+
break;
|
162 |
+
|
163 |
+
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
|
|
|
|
|
|
164 |
|
165 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"]) as $recipient)
|
166 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_cancellation_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_cancellation_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
167 |
+
}
|
168 |
$paypal["s2member_log"][] = "Cancellation Notification Emails have been processed.";
|
169 |
}
|
170 |
}
|
171 |
+
else $paypal["s2member_log"][] = "Ignoring Cancellation. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
|
|
172 |
}
|
173 |
+
else $paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
|
|
|
174 |
}
|
175 |
else // Else, this is a duplicate IPN. Must stop here.
|
176 |
{
|
178 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_cancel|recurring_payment_profile_cancel` ).";
|
179 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
180 |
}
|
|
|
181 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
182 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
|
183 |
unset($__refs, $__v);
|
187 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancellation_w_level", false, get_defined_vars ());
|
188 |
}
|
189 |
}
|
190 |
+
}
|
|
includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -51,7 +49,9 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
51 |
&& (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal, false)) || empty($recurring) || ($paypal["period3"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("period3", false, $paypal["subscr_id"])) || ($paypal["period3"] = "1 D"))
|
52 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal)) || ($paypal["item_number"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("item_number", false, $paypal["subscr_id"])) || ($paypal["item_number"] = "1")) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
53 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal)) || ($paypal["item_name"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("item_name", false, $paypal["subscr_id"])) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))
|
54 |
-
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("payer_email", false, $paypal["subscr_id"])) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal["subscr_id"])))
|
|
|
|
|
55 |
{
|
56 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
57 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars());
|
@@ -59,8 +59,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
59 |
|
60 |
if(!get_transient($transient_ipn = "s2m_ipn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10))
|
61 |
{
|
62 |
-
$is_refund = (preg_match("/^refunded$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
|
63 |
-
$is_reversal = (preg_match("/^(reversed|reversal)$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
|
64 |
$is_reversal = (!$is_reversal) ? (preg_match("/^new_case$/i", $paypal["txn_type"]) && preg_match("/^chargeback$/i", $paypal["case_type"])) : $is_reversal;
|
65 |
$is_refund_or_reversal = ($is_refund || $is_reversal); // If either of the previous tests above evaluated to true; then it's obviously a Refund and/or a Reversal.
|
66 |
$is_partial_refund = // Partial refund detection. All refunds processed against Subscriptions are considered partials. Full refunds occur only against Buy Now transactions.
|
@@ -125,6 +125,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
125 |
delete_user_option($user_id, "s2member_custom");
|
126 |
delete_user_option($user_id, "s2member_subscr_id");
|
127 |
delete_user_option($user_id, "s2member_subscr_baid");
|
|
|
128 |
delete_user_option($user_id, "s2member_subscr_gateway");
|
129 |
|
130 |
delete_user_option($user_id, "s2member_ipn_signup_vars");
|
@@ -147,23 +148,23 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
147 |
{
|
148 |
foreach(preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
|
149 |
|
150 |
-
if(($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::
|
151 |
-
if(($url = preg_replace("/%%
|
152 |
-
if(($url = preg_replace("/%%
|
153 |
-
if(($url = preg_replace("/%%
|
154 |
-
if(($url = preg_replace("/%%
|
155 |
-
if(($url = preg_replace("/%%
|
156 |
-
if(($url = preg_replace("/%%
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
168 |
}
|
169 |
if($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
@@ -173,6 +174,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
173 |
|
174 |
$msg .= "eot_del_type: %%eot_del_type%%\n";
|
175 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
|
|
|
|
176 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
177 |
$msg .= "user_last_name: %%user_last_name%%\n";
|
178 |
$msg .= "user_full_name: %%user_full_name%%\n";
|
@@ -196,25 +199,25 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
196 |
$msg .= "cv8: %%cv8%%\n";
|
197 |
$msg .= "cv9: %%cv9%%";
|
198 |
|
199 |
-
if(($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(
|
200 |
-
if(($msg = preg_replace("/%%
|
201 |
-
if(($msg = preg_replace("/%%
|
202 |
-
if(($msg = preg_replace("/%%
|
203 |
-
if(($msg = preg_replace("/%%
|
204 |
-
if(($msg = preg_replace("/%%
|
205 |
-
if(($msg = preg_replace("/%%
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
215 |
-
wp_mail($recipient, apply_filters("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
|
216 |
-
}
|
217 |
|
|
|
|
|
|
|
218 |
$paypal["s2member_log"][] = "EOT/Deletion Notification Emails have been processed.";
|
219 |
}
|
220 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
@@ -239,7 +242,6 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
239 |
// This will automatically trigger `eot_del_notification_urls` as well.
|
240 |
c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions($user_id, $current_blog->blog_id, "s2says");
|
241 |
}
|
242 |
-
|
243 |
else // Otherwise, we can actually delete them.
|
244 |
// This will automatically trigger `eot_del_notification_urls` as well.
|
245 |
wp_delete_user($user_id); // `c_ws_plugin__s2member_user_deletions::handle_user_deletions()`
|
@@ -270,8 +272,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
270 |
unset($__refs, $__v);
|
271 |
}
|
272 |
}
|
273 |
-
else
|
274 |
-
$paypal["s2member_log"][] = "Unable to (demote|delete) Member. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
275 |
}
|
276 |
else if($is_delayed_eot && !get_user_option("s2member_auto_eot_time", $user_id))
|
277 |
{
|
@@ -290,8 +291,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
290 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delayed", get_defined_vars());
|
291 |
unset($__refs, $__v);
|
292 |
}
|
293 |
-
else
|
294 |
-
$paypal["s2member_log"][] = "Ignoring Delayed EOT. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
295 |
}
|
296 |
else if(!$is_refund_or_reversal || $is_delayed_eot)
|
297 |
$paypal["s2member_log"][] = "Skipping (demote|delete) Member, for now. An Auto-EOT Time is already set for this account. When an Auto-EOT Time has been recorded, s2Member will handle EOT (demote|delete) events using it's own Auto-EOT System - internally.";
|
@@ -312,7 +312,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
312 |
$ipn = array("txn_type" => "subscr_eot"); // Create a simulated IPN response for txn_type=subscr_eot.
|
313 |
|
314 |
foreach($paypal as $var => $val)
|
315 |
-
if(in_array($var, array("subscr_gateway", "subscr_id", "custom", "invoice", "payer_email", "first_name", "last_name", "item_name", "item_number", /* Exclude; might be defaults. "period1", "period3", */ "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
316 |
$ipn[$var] = $val;
|
317 |
|
318 |
$paypal["s2member_log"][] = "Re-generating. This IPN will go into a Transient Queue; and be re-processed during registration.";
|
@@ -326,7 +326,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
326 |
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
|
327 |
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
|
328 |
*/
|
329 |
-
if($is_refund_or_reversal) //
|
330 |
{
|
331 |
$fields = ($user_id) ? get_user_option("s2member_custom_fields", $user_id) : array(); // These will be needed below.
|
332 |
$user_reg_ip = ($user_id) ? get_user_option("s2member_registration_ip", $user_id) : ""; // Needed below.
|
@@ -336,24 +336,24 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
336 |
{
|
337 |
foreach(preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) as $url)
|
338 |
|
339 |
-
if(($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::
|
340 |
-
if(($url = preg_replace("/%%
|
341 |
-
if(($url = preg_replace("
|
342 |
-
if(($url = preg_replace("
|
343 |
-
if(($url = preg_replace("/%%
|
344 |
-
if(($url = preg_replace("/%%
|
345 |
-
if(($url = preg_replace("/%%
|
346 |
-
if(($url = preg_replace("/%%
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
$paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
|
358 |
}
|
359 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_recipients"] && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
@@ -362,6 +362,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
362 |
$msg .= "\n\n"; // Spacing in the message body.
|
363 |
|
364 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
|
|
|
|
365 |
$msg .= "parent_txn_id: %%parent_txn_id%%\n";
|
366 |
$msg .= "item_number: %%item_number%%\n";
|
367 |
$msg .= "item_name: %%item_name%%\n";
|
@@ -389,26 +391,26 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
389 |
$msg .= "cv8: %%cv8%%\n";
|
390 |
$msg .= "cv9: %%cv9%%";
|
391 |
|
392 |
-
if(($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(
|
393 |
-
if(($msg = preg_replace("/%%
|
394 |
-
if(($msg = preg_replace("
|
395 |
-
if(($msg = preg_replace("
|
396 |
-
if(($msg = preg_replace("/%%
|
397 |
-
if(($msg = preg_replace("/%%
|
398 |
-
if(($msg = preg_replace("/%%
|
399 |
-
if(($msg = preg_replace("/%%
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_recipients"]) as $recipient)
|
409 |
-
wp_mail($recipient, apply_filters("ws_plugin__s2member_ref_rev_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_ref_rev_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
|
410 |
-
}
|
411 |
|
|
|
|
|
|
|
412 |
$paypal["s2member_log"][] = "Refund/Reversal Notification Emails have been processed.";
|
413 |
}
|
414 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
@@ -431,5 +433,4 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
431 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_level", false, get_defined_vars());
|
432 |
}
|
433 |
}
|
434 |
-
}
|
435 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
49 |
&& (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal, false)) || empty($recurring) || ($paypal["period3"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("period3", false, $paypal["subscr_id"])) || ($paypal["period3"] = "1 D"))
|
50 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal)) || ($paypal["item_number"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("item_number", false, $paypal["subscr_id"])) || ($paypal["item_number"] = "1")) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
51 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal)) || ($paypal["item_name"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("item_name", false, $paypal["subscr_id"])) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))
|
52 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("payer_email", false, $paypal["subscr_id"])) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal["subscr_id"])))
|
53 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
54 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"])))
|
55 |
{
|
56 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
57 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars());
|
59 |
|
60 |
if(!get_transient($transient_ipn = "s2m_ipn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10))
|
61 |
{
|
62 |
+
$is_refund = (preg_match("/^refunded$/i", $paypal["payment_status"]) && !empty($paypal["parent_txn_id"]));
|
63 |
+
$is_reversal = (preg_match("/^(reversed|reversal)$/i", $paypal["payment_status"]) && !empty($paypal["parent_txn_id"]));
|
64 |
$is_reversal = (!$is_reversal) ? (preg_match("/^new_case$/i", $paypal["txn_type"]) && preg_match("/^chargeback$/i", $paypal["case_type"])) : $is_reversal;
|
65 |
$is_refund_or_reversal = ($is_refund || $is_reversal); // If either of the previous tests above evaluated to true; then it's obviously a Refund and/or a Reversal.
|
66 |
$is_partial_refund = // Partial refund detection. All refunds processed against Subscriptions are considered partials. Full refunds occur only against Buy Now transactions.
|
125 |
delete_user_option($user_id, "s2member_custom");
|
126 |
delete_user_option($user_id, "s2member_subscr_id");
|
127 |
delete_user_option($user_id, "s2member_subscr_baid");
|
128 |
+
delete_user_option($user_id, "s2member_subscr_cid");
|
129 |
delete_user_option($user_id, "s2member_subscr_gateway");
|
130 |
|
131 |
delete_user_option($user_id, "s2member_ipn_signup_vars");
|
148 |
{
|
149 |
foreach(preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
|
150 |
|
151 |
+
if(($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($eot_del_type)), $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_id"])), $url)))
|
152 |
+
if(($url = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_baid"])), $url)) && ($url = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_cid"])), $url)))
|
153 |
+
if(($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url)))
|
154 |
+
if(($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name." ".$user->last_name))), $url)))
|
155 |
+
if(($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)))
|
156 |
+
if(($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)))
|
157 |
+
if(($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)))
|
158 |
+
if(($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)))
|
159 |
+
{
|
160 |
+
if(is_array($fields) && !empty($fields))
|
161 |
+
foreach($fields as $var => $val) // Custom Registration/Profile Fields.
|
162 |
+
if(!($url = preg_replace("/%%".preg_quote($var, "/")."%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url)))
|
163 |
+
break;
|
164 |
+
|
165 |
+
if(($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))))
|
166 |
+
c_ws_plugin__s2member_utils_urls::remote($url);
|
167 |
+
}
|
168 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
169 |
}
|
170 |
if($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
174 |
|
175 |
$msg .= "eot_del_type: %%eot_del_type%%\n";
|
176 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
177 |
+
$msg .= "subscr_baid: %%subscr_baid%%\n";
|
178 |
+
$msg .= "subscr_cid: %%subscr_cid%%\n";
|
179 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
180 |
$msg .= "user_last_name: %%user_last_name%%\n";
|
181 |
$msg .= "user_full_name: %%user_full_name%%\n";
|
199 |
$msg .= "cv8: %%cv8%%\n";
|
200 |
$msg .= "cv9: %%cv9%%";
|
201 |
|
202 |
+
if(($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($eot_del_type), $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_id"]), $msg)))
|
203 |
+
if(($msg = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_baid"]), $msg)) && ($msg = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_cid"]), $msg)))
|
204 |
+
if(($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)))
|
205 |
+
if(($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name." ".$user->last_name)), $msg)))
|
206 |
+
if(($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)))
|
207 |
+
if(($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)))
|
208 |
+
if(($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)))
|
209 |
+
if(($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)))
|
210 |
+
{
|
211 |
+
if(is_array($fields) && !empty($fields))
|
212 |
+
foreach($fields as $var => $val) // Custom Registration/Profile Fields.
|
213 |
+
if(!($msg = preg_replace("/%%".preg_quote($var, "/")."%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg)))
|
214 |
+
break;
|
215 |
+
|
216 |
+
if($sbj && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
|
|
|
|
|
|
217 |
|
218 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
219 |
+
wp_mail($recipient, apply_filters("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
|
220 |
+
}
|
221 |
$paypal["s2member_log"][] = "EOT/Deletion Notification Emails have been processed.";
|
222 |
}
|
223 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
242 |
// This will automatically trigger `eot_del_notification_urls` as well.
|
243 |
c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions($user_id, $current_blog->blog_id, "s2says");
|
244 |
}
|
|
|
245 |
else // Otherwise, we can actually delete them.
|
246 |
// This will automatically trigger `eot_del_notification_urls` as well.
|
247 |
wp_delete_user($user_id); // `c_ws_plugin__s2member_user_deletions::handle_user_deletions()`
|
272 |
unset($__refs, $__v);
|
273 |
}
|
274 |
}
|
275 |
+
else $paypal["s2member_log"][] = "Unable to (demote|delete) Member. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
|
|
276 |
}
|
277 |
else if($is_delayed_eot && !get_user_option("s2member_auto_eot_time", $user_id))
|
278 |
{
|
291 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delayed", get_defined_vars());
|
292 |
unset($__refs, $__v);
|
293 |
}
|
294 |
+
else $paypal["s2member_log"][] = "Ignoring Delayed EOT. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
|
|
295 |
}
|
296 |
else if(!$is_refund_or_reversal || $is_delayed_eot)
|
297 |
$paypal["s2member_log"][] = "Skipping (demote|delete) Member, for now. An Auto-EOT Time is already set for this account. When an Auto-EOT Time has been recorded, s2Member will handle EOT (demote|delete) events using it's own Auto-EOT System - internally.";
|
312 |
$ipn = array("txn_type" => "subscr_eot"); // Create a simulated IPN response for txn_type=subscr_eot.
|
313 |
|
314 |
foreach($paypal as $var => $val)
|
315 |
+
if(in_array($var, array("subscr_gateway", "subscr_id", "subscr_baid", "subscr_cid", "custom", "invoice", "payer_email", "first_name", "last_name", "item_name", "item_number", /* Exclude; might be defaults. "period1", "period3", */ "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
316 |
$ipn[$var] = $val;
|
317 |
|
318 |
$paypal["s2member_log"][] = "Re-generating. This IPN will go into a Transient Queue; and be re-processed during registration.";
|
326 |
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
|
327 |
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
|
328 |
*/
|
329 |
+
if($is_refund_or_reversal) // Previously assigned as a quick method of Refund/Reversal detection.
|
330 |
{
|
331 |
$fields = ($user_id) ? get_user_option("s2member_custom_fields", $user_id) : array(); // These will be needed below.
|
332 |
$user_reg_ip = ($user_id) ? get_user_option("s2member_registration_ip", $user_id) : ""; // Needed below.
|
336 |
{
|
337 |
foreach(preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) as $url)
|
338 |
|
339 |
+
if(($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_id"])), $url)) && ($url = preg_replace("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["parent_txn_id"])), $url)))
|
340 |
+
if(($url = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_baid"])), $url)) && ($url = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_cid"])), $url)))
|
341 |
+
if(($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["item_name"])), $url)))
|
342 |
+
if(($url = preg_replace("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["mc_fee"])), $url)))
|
343 |
+
if(($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["last_name"])), $url)))
|
344 |
+
if(($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal["first_name"]." ".$paypal["last_name"]))), $url)))
|
345 |
+
if(($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["payer_email"])), $url)))
|
346 |
+
if(($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)))
|
347 |
+
if(($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)))
|
348 |
+
{
|
349 |
+
if(is_array($fields) && !empty($fields))
|
350 |
+
foreach($fields as $var => $val) // Custom Registration/Profile Fields.
|
351 |
+
if(!($url = preg_replace("/%%".preg_quote($var, "/")."%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url)))
|
352 |
+
break;
|
353 |
+
|
354 |
+
if(($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))))
|
355 |
+
c_ws_plugin__s2member_utils_urls::remote($url);
|
356 |
+
}
|
357 |
$paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
|
358 |
}
|
359 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_recipients"] && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
362 |
$msg .= "\n\n"; // Spacing in the message body.
|
363 |
|
364 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
365 |
+
$msg .= "subscr_baid: %%subscr_baid%%\n";
|
366 |
+
$msg .= "subscr_cid: %%subscr_cid%%\n";
|
367 |
$msg .= "parent_txn_id: %%parent_txn_id%%\n";
|
368 |
$msg .= "item_number: %%item_number%%\n";
|
369 |
$msg .= "item_name: %%item_name%%\n";
|
391 |
$msg .= "cv8: %%cv8%%\n";
|
392 |
$msg .= "cv9: %%cv9%%";
|
393 |
|
394 |
+
if(($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_id"]), $msg)) && ($msg = preg_replace("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["parent_txn_id"]), $msg)))
|
395 |
+
if(($msg = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_baid"]), $msg)) && ($msg = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_cid"]), $msg)))
|
396 |
+
if(($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_name"]), $msg)))
|
397 |
+
if(($msg = preg_replace("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["mc_gross"]), $msg)) && ($msg = preg_replace("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["mc_fee"]), $msg)))
|
398 |
+
if(($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["last_name"]), $msg)))
|
399 |
+
if(($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal["first_name"]." ".$paypal["last_name"])), $msg)))
|
400 |
+
if(($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["payer_email"]), $msg)))
|
401 |
+
if(($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)))
|
402 |
+
if(($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)))
|
403 |
+
{
|
404 |
+
if(is_array($fields) && !empty($fields))
|
405 |
+
foreach($fields as $var => $val) // Custom Registration/Profile Fields.
|
406 |
+
if(!($msg = preg_replace("/%%".preg_quote($var, "/")."%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg)))
|
407 |
+
break;
|
408 |
+
|
409 |
+
if($sbj && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
|
|
|
|
|
|
410 |
|
411 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_recipients"]) as $recipient)
|
412 |
+
wp_mail($recipient, apply_filters("ws_plugin__s2member_ref_rev_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_ref_rev_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
|
413 |
+
}
|
414 |
$paypal["s2member_log"][] = "Refund/Reversal Notification Emails have been processed.";
|
415 |
}
|
416 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
433 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_level", false, get_defined_vars());
|
434 |
}
|
435 |
}
|
436 |
+
}
|
|
includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php
CHANGED
@@ -44,7 +44,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
44 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
46 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
47 |
-
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
|
|
|
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_failed", get_defined_vars ());
|
@@ -70,16 +72,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
70 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_failed|recurring_payment_failed|recurring_payment_skipped` ).";
|
71 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
72 |
}
|
73 |
-
|
74 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
75 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_failed", get_defined_vars ());
|
76 |
unset($__refs, $__v);
|
77 |
|
78 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", $paypal, get_defined_vars ());
|
79 |
}
|
80 |
-
else
|
81 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", false, get_defined_vars ());
|
82 |
}
|
83 |
}
|
84 |
-
}
|
85 |
-
?>
|
44 |
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
46 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
47 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
48 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
49 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"])))
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_failed", get_defined_vars ());
|
72 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_failed|recurring_payment_failed|recurring_payment_skipped` ).";
|
73 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
74 |
}
|
|
|
75 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
76 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_failed", get_defined_vars ());
|
77 |
unset($__refs, $__v);
|
78 |
|
79 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", $paypal, get_defined_vars ());
|
80 |
}
|
81 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", false, get_defined_vars ());
|
|
|
82 |
}
|
83 |
}
|
84 |
+
}
|
|
includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -48,6 +46,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
48 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
49 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
50 |
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
|
|
|
|
51 |
&& (!empty($paypal["txn_id"])) && (!empty($paypal["mc_gross"])))
|
52 |
{
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
@@ -93,39 +93,40 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
95 |
|
96 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::
|
97 |
-
if (($url = preg_replace ("/%%
|
98 |
-
if (($url = preg_replace ("/%%
|
99 |
-
if (($url = preg_replace ("/%%
|
100 |
-
if (($url = preg_replace ("/%%
|
101 |
-
if (($url = preg_replace ("/%%
|
102 |
-
|
103 |
-
|
104 |
-
if (($url = preg_replace ("/%%
|
105 |
-
if (($url = preg_replace ("/%%
|
106 |
-
if (($url = preg_replace ("/%%
|
107 |
-
if (($url = preg_replace ("/%%
|
108 |
-
if (($url = preg_replace ("/%%
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
121 |
}
|
122 |
-
|
123 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
124 |
{
|
125 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
126 |
$msg .= "\n\n"; // Spacing in the message body.
|
127 |
|
128 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
|
|
|
|
129 |
$msg .= "amount: %%amount%%\n";
|
130 |
$msg .= "txn_id: %%txn_id%%\n";
|
131 |
$msg .= "item_number: %%item_number%%\n";
|
@@ -158,35 +159,34 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
158 |
$msg .= "cv8: %%cv8%%\n";
|
159 |
$msg .= "cv9: %%cv9%%";
|
160 |
|
161 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
162 |
-
if (($msg = preg_replace ("/%%
|
163 |
-
if (($msg = preg_replace ("/%%
|
164 |
-
if (($msg = preg_replace ("/%%
|
165 |
-
if (($msg = preg_replace ("/%%
|
166 |
-
if (($msg = preg_replace ("/%%
|
167 |
-
|
168 |
-
|
169 |
-
if (($msg = preg_replace ("/%%
|
170 |
-
if (($msg = preg_replace ("/%%
|
171 |
-
if (($msg = preg_replace ("/%%
|
172 |
-
if (($msg = preg_replace ("/%%
|
173 |
-
if (($msg = preg_replace ("/%%
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
181 |
-
|
182 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
183 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
184 |
-
}
|
185 |
-
}
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
188 |
}
|
189 |
-
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
|
192 |
unset($__refs, $__v);
|
@@ -198,7 +198,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
198 |
$ipn = array("txn_type" => "subscr_payment"); // Create a simulated IPN response for txn_type=subscr_payment.
|
199 |
|
200 |
foreach ($paypal as $var => $val)
|
201 |
-
if (in_array($var, array("subscr_gateway", "subscr_id", "txn_id", "custom", "invoice", "mc_gross", "mc_currency", "tax", "payer_email", "first_name", "last_name", "item_name", "item_number", "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
202 |
$ipn[$var] = $val;
|
203 |
|
204 |
$paypal["s2member_log"][] = "Re-generating. This IPN will go into a Transient Queue; and be re-processed during registration.";
|
@@ -212,16 +212,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
212 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_payment|recurring_payment` ).";
|
213 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
214 |
}
|
215 |
-
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
|
218 |
unset($__refs, $__v);
|
219 |
|
220 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level", $paypal, get_defined_vars ());
|
221 |
}
|
222 |
-
else
|
223 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level", false, get_defined_vars ());
|
224 |
}
|
225 |
}
|
226 |
-
}
|
227 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
46 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
47 |
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
48 |
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
49 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
50 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"]))
|
51 |
&& (!empty($paypal["txn_id"])) && (!empty($paypal["mc_gross"])))
|
52 |
{
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
95 |
|
96 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_id"])), $url)))
|
97 |
+
if (($url = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_baid"])), $url)) && ($url = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["subscr_cid"])), $url)))
|
98 |
+
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
99 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
100 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
101 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
102 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
103 |
+
{
|
104 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->last_name)), $url)))
|
105 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
106 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_email)), $url)))
|
107 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_login)), $url)))
|
108 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_reg_ip)), $url)))
|
109 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
110 |
+
{
|
111 |
+
if (is_array($fields) && !empty($fields))
|
112 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
113 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
114 |
+
break;
|
115 |
+
|
116 |
+
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
117 |
+
c_ws_plugin__s2member_utils_urls::remote ($url);
|
118 |
+
}
|
119 |
+
}
|
120 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
121 |
}
|
|
|
122 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
123 |
{
|
124 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
125 |
$msg .= "\n\n"; // Spacing in the message body.
|
126 |
|
127 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
128 |
+
$msg .= "subscr_baid: %%subscr_baid%%\n";
|
129 |
+
$msg .= "subscr_cid: %%subscr_cid%%\n";
|
130 |
$msg .= "amount: %%amount%%\n";
|
131 |
$msg .= "txn_id: %%txn_id%%\n";
|
132 |
$msg .= "item_number: %%item_number%%\n";
|
159 |
$msg .= "cv8: %%cv8%%\n";
|
160 |
$msg .= "cv9: %%cv9%%";
|
161 |
|
162 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_id"]), $msg)))
|
163 |
+
if (($msg = preg_replace ("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_baid"]), $msg)) && ($msg = preg_replace ("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["subscr_cid"]), $msg)))
|
164 |
+
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
165 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
166 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
167 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
168 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
169 |
+
{
|
170 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
171 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
172 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
173 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
174 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
175 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
176 |
+
{
|
177 |
+
if (is_array($fields) && !empty($fields))
|
178 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
179 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
180 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
183 |
+
|
184 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
185 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
186 |
+
}
|
187 |
+
}
|
188 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
189 |
}
|
|
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
|
192 |
unset($__refs, $__v);
|
198 |
$ipn = array("txn_type" => "subscr_payment"); // Create a simulated IPN response for txn_type=subscr_payment.
|
199 |
|
200 |
foreach ($paypal as $var => $val)
|
201 |
+
if (in_array($var, array("subscr_gateway", "subscr_id", "subscr_baid", "subscr_cid", "txn_id", "custom", "invoice", "mc_gross", "mc_currency", "tax", "payer_email", "first_name", "last_name", "item_name", "item_number", "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
202 |
$ipn[$var] = $val;
|
203 |
|
204 |
$paypal["s2member_log"][] = "Re-generating. This IPN will go into a Transient Queue; and be re-processed during registration.";
|
212 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_payment|recurring_payment` ).";
|
213 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
214 |
}
|
|
|
215 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
216 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
|
217 |
unset($__refs, $__v);
|
218 |
|
219 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level", $paypal, get_defined_vars ());
|
220 |
}
|
221 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level", false, get_defined_vars ());
|
|
|
222 |
}
|
223 |
}
|
224 |
+
}
|
|
includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php
CHANGED
@@ -1,756 +1,779 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's PayPal IPN handler (inner processing routine).
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\PayPal
|
15 |
-
* @since 110720
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
*
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
{
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
if
|
46 |
-
|
47 |
-
|
48 |
-
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
49 |
-
&& (!empty($paypal["payer_email"])))
|
50 |
{
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
53 |
unset($__refs, $__v);
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
$
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
$msg
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
if
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
break;
|
338 |
-
|
339 |
-
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
340 |
-
|
341 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
342 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
343 |
-
}
|
344 |
-
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
345 |
-
}
|
346 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
347 |
-
{
|
348 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
349 |
-
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
350 |
-
if (($code = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $code)) && ($code = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $code)))
|
351 |
-
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
352 |
-
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $code)))
|
353 |
-
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
354 |
-
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $code)))
|
355 |
-
|
356 |
-
if (($code = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $code)))
|
357 |
-
|
358 |
-
if (($code = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $code)) && ($code = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $code)))
|
359 |
-
if (($code = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $code)))
|
360 |
-
if (($code = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $code)))
|
361 |
-
if (($code = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $code)))
|
362 |
-
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
363 |
-
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
364 |
-
{
|
365 |
-
if (is_array($fields) && !empty($fields))
|
366 |
-
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
367 |
-
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
368 |
-
break;
|
369 |
-
|
370 |
-
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code))) /* This gets stored into a Transient Queue. */)
|
371 |
-
{
|
372 |
-
$paypal["s2member_log"][] = "Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.";
|
373 |
-
set_transient ("s2m_" . md5 ("s2member_transient_modification_tracking_codes_" . $paypal["subscr_id"]), $code, 43200);
|
374 |
-
}
|
375 |
-
}
|
376 |
-
}
|
377 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
378 |
-
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", get_defined_vars ());
|
379 |
-
unset($__refs, $__v);
|
380 |
-
}
|
381 |
-
else $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
382 |
-
}
|
383 |
-
else $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
|
384 |
-
|
385 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
386 |
-
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars ());
|
387 |
-
unset($__refs, $__v);
|
388 |
-
}
|
389 |
-
/*
|
390 |
-
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
391 |
-
*/
|
392 |
-
else // Else this is a normal Subscription signup, we are not updating anything.
|
393 |
-
{
|
394 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
395 |
-
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars ());
|
396 |
-
unset($__refs, $__v);
|
397 |
-
|
398 |
-
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/o update vars.";
|
399 |
-
|
400 |
-
if (($registration_url = c_ws_plugin__s2member_register_access::register_link_gen ($paypal["subscr_gateway"], $paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
401 |
-
{
|
402 |
-
$processing = $during = /* Yes, we ARE processing this. */true;
|
403 |
-
|
404 |
-
$sbj = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_REQUEST["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_subject"]);
|
405 |
-
$msg = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_REQUEST["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_message"]);
|
406 |
-
$rec = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_REQUEST["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_recipients"]);
|
407 |
-
|
408 |
-
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $rec)))
|
409 |
-
if (($rec = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $rec)) && ($rec = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $rec)))
|
410 |
-
if (($rec = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $rec)) && ($rec = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $rec)))
|
411 |
-
if (($rec = preg_replace ("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::period_term ($paypal["initial_term"])), $rec)) && ($rec = preg_replace ("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], $paypal["recurring"])), $rec)))
|
412 |
-
if (($rec = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $rec)) && ($rec = preg_replace ("/%%recurring\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], true) : "0 / non-recurring")), $rec)))
|
413 |
-
if (($rec = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $rec)) && ($rec = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $rec)))
|
414 |
-
if (($rec = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"])), $rec)) && ($rec = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"])), $rec)))
|
415 |
-
if (($rec = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $rec))) // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
|
416 |
-
if (($rec = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $rec)))
|
417 |
-
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["ip"]), $rec)))
|
418 |
-
if (($rec = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $rec)) && ($rec = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $rec)) && ($rec = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $rec)))
|
419 |
-
|
420 |
-
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $sbj)))
|
421 |
-
if (($sbj = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $sbj)) && ($sbj = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $sbj)))
|
422 |
-
if (($sbj = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $sbj)) && ($sbj = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $sbj)))
|
423 |
-
if (($sbj = preg_replace ("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::period_term ($paypal["initial_term"])), $sbj)) && ($sbj = preg_replace ("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], $paypal["recurring"])), $sbj)))
|
424 |
-
if (($sbj = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $sbj)) && ($sbj = preg_replace ("/%%recurring\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], true) : "0 / non-recurring")), $sbj)))
|
425 |
-
if (($sbj = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $sbj)))
|
426 |
-
if (($sbj = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $sbj)))
|
427 |
-
if (($sbj = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)))
|
428 |
-
if (($sbj = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $sbj)))
|
429 |
-
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["ip"]), $sbj)))
|
430 |
-
if (($sbj = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $sbj)) && ($sbj = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $sbj)) && ($sbj = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $sbj)))
|
431 |
-
|
432 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $msg)))
|
433 |
-
if (($msg = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $msg)) && ($msg = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $msg)))
|
434 |
-
if (($msg = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $msg)))
|
435 |
-
if (($msg = preg_replace ("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::period_term ($paypal["initial_term"])), $msg)) && ($msg = preg_replace ("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], $paypal["recurring"])), $msg)))
|
436 |
-
if (($msg = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $msg)) && ($msg = preg_replace ("/%%recurring\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term ($paypal["regular_term"], true) : "0 / non-recurring")), $msg)))
|
437 |
-
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $msg)))
|
438 |
-
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $msg)))
|
439 |
-
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
440 |
-
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $msg)))
|
441 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["ip"]), $msg)))
|
442 |
-
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $msg)))
|
443 |
-
|
444 |
-
if (($rec = trim (preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
445 |
-
{
|
446 |
-
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
|
447 |
-
{
|
448 |
-
$sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
|
449 |
-
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
450 |
-
}
|
451 |
-
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
452 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_signup_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_signup_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
453 |
-
|
454 |
-
$paypal["s2member_log"][] = "Signup Confirmation Email sent to: " . $rec . ".";
|
455 |
-
}
|
456 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
457 |
-
{
|
458 |
-
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) as $url)
|
459 |
-
|
460 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
|
461 |
-
if (($url = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["initial"])), $url)) && ($url = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["regular"])), $url)) && ($url = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["recurring"])), $url)))
|
462 |
-
if (($url = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["initial_term"])), $url)) && ($url = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["regular_term"])), $url)))
|
463 |
-
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_name"])), $url)))
|
464 |
-
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["last_name"])), $url)))
|
465 |
-
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
466 |
-
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["payer_email"])), $url)))
|
467 |
-
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["ip"])), $url)))
|
468 |
-
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["affiliate_id"])), $url)))
|
469 |
-
|
470 |
-
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
471 |
-
c_ws_plugin__s2member_utils_urls::remote ($url);
|
472 |
-
|
473 |
-
$paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
|
474 |
-
}
|
475 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
476 |
-
{
|
477 |
-
$msg = $sbj = "(s2Member / API Notification Email) - Signup";
|
478 |
-
$msg .= /* Spacing in the message body. */ "\n\n";
|
479 |
-
|
480 |
-
$msg .= "subscr_id: %%subscr_id%%\n";
|
481 |
-
$msg .= "initial: %%initial%%\n";
|
482 |
-
$msg .= "regular: %%regular%%\n";
|
483 |
-
$msg .= "recurring: %%recurring%%\n";
|
484 |
-
$msg .= "initial_term: %%initial_term%%\n";
|
485 |
-
$msg .= "regular_term: %%regular_term%%\n";
|
486 |
-
$msg .= "item_number: %%item_number%%\n";
|
487 |
-
$msg .= "item_name: %%item_name%%\n";
|
488 |
-
$msg .= "first_name: %%first_name%%\n";
|
489 |
-
$msg .= "last_name: %%last_name%%\n";
|
490 |
-
$msg .= "full_name: %%full_name%%\n";
|
491 |
-
$msg .= "payer_email: %%payer_email%%\n";
|
492 |
-
$msg .= "user_ip: %%user_ip%%\n";
|
493 |
-
|
494 |
-
$msg .= "full_coupon_code: %%full_coupon_code%%\n";
|
495 |
-
$msg .= "coupon_code: %%coupon_code%%\n";
|
496 |
-
$msg .= "coupon_affiliate_id: %%coupon_affiliate_id%%\n";
|
497 |
-
|
498 |
-
$msg .= "cv0: %%cv0%%\n";
|
499 |
-
$msg .= "cv1: %%cv1%%\n";
|
500 |
-
$msg .= "cv2: %%cv2%%\n";
|
501 |
-
$msg .= "cv3: %%cv3%%\n";
|
502 |
-
$msg .= "cv4: %%cv4%%\n";
|
503 |
-
$msg .= "cv5: %%cv5%%\n";
|
504 |
-
$msg .= "cv6: %%cv6%%\n";
|
505 |
-
$msg .= "cv7: %%cv7%%\n";
|
506 |
-
$msg .= "cv8: %%cv8%%\n";
|
507 |
-
$msg .= "cv9: %%cv9%%";
|
508 |
-
|
509 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $msg)))
|
510 |
-
if (($msg = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $msg)) && ($msg = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $msg)) && ($msg = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $msg)))
|
511 |
-
if (($msg = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $msg)))
|
512 |
-
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $msg)))
|
513 |
-
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $msg)))
|
514 |
-
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
515 |
-
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $msg)))
|
516 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["ip"]), $msg)))
|
517 |
-
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $msg)))
|
518 |
-
|
519 |
-
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
520 |
-
|
521 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"]) as $recipient)
|
522 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_signup_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_signup_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
523 |
-
|
524 |
-
$paypal["s2member_log"][] = "Signup Notification Emails have been processed.";
|
525 |
-
}
|
526 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
527 |
-
{
|
528 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
529 |
-
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
530 |
-
if (($code = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial_term"]), $code)) && ($code = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular_term"]), $code)))
|
531 |
-
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
532 |
-
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $code)))
|
533 |
-
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
534 |
-
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $code)))
|
535 |
-
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["ip"]), $code)))
|
536 |
-
if (($code = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $code)))
|
537 |
-
|
538 |
-
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code))) /* This gets stored into a Transient Queue. */)
|
539 |
-
{
|
540 |
-
$paypal["s2member_log"][] = "Storing Signup Tracking Codes into a Transient Queue. These will be processed on-site.";
|
541 |
-
set_transient ("s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $paypal["subscr_id"]), $code, 43200);
|
542 |
-
}
|
543 |
-
}
|
544 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
545 |
-
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_wo_update_vars", get_defined_vars ());
|
546 |
-
unset($__refs, $__v);
|
547 |
-
}
|
548 |
-
else $paypal["s2member_log"][] = "Unable to generate Registration URL for Membership Access. Possible data corruption within the IPN response.";
|
549 |
-
|
550 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
551 |
-
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_wo_update_vars", get_defined_vars ());
|
552 |
-
unset($__refs, $__v);
|
553 |
-
}
|
554 |
-
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
555 |
-
{
|
556 |
-
if (($user_id && is_object ($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID))
|
557 |
-
{
|
558 |
-
$fields = /* These will be needed in the routines below. */get_user_option ("s2member_custom_fields", $user_id);
|
559 |
-
$user_reg_ip = /* Original IP during Registration. */get_user_option ("s2member_registration_ip", $user_id);
|
560 |
-
|
561 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
|
562 |
-
if (($url = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["initial"])), $url)) && ($url = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["regular"])), $url)) && ($url = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["recurring"])), $url)))
|
563 |
-
if (($url = preg_replace ("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["initial_term"])), $url)) && ($url = preg_replace ("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["regular_term"])), $url)))
|
564 |
-
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_name"])), $url)))
|
565 |
-
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["last_name"])), $url)))
|
566 |
-
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
567 |
-
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["payer_email"])), $url)))
|
568 |
-
if (($url = preg_replace ("/%%modification%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ((int)$modifying)), $url)))
|
569 |
-
|
570 |
-
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["affiliate_id"])), $url)))
|
571 |
-
|
572 |
-
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
|
573 |
-
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
574 |
-
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
|
575 |
-
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_login)), $url)))
|
576 |
-
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
577 |
-
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
578 |
-
{
|
579 |
-
if (is_array($fields) && !empty($fields))
|
580 |
-
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
581 |
-
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
582 |
-
break;
|
583 |
-
|
584 |
-
if /* Preserve remaining replacements. */(($url = trim ($url)))
|
585 |
-
// Because the parent routine may perform replacements too.
|
586 |
-
$paypal["s2member_paypal_proxy_return_url"] = $url;
|
587 |
-
}
|
588 |
-
}
|
589 |
-
$paypal["s2member_log"][] = "Subscr. Return ( `modification=" . (int)$modifying . "` ), a Proxy Return URL is ready.";
|
590 |
-
}
|
591 |
-
if ($processing // Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`.
|
592 |
-
&& (preg_match ("/^web_accept$/i", $paypal["txn_type"]) || ($_REQUEST["s2member_paypal_proxy"] && preg_match ("/subscr-signup-as-subscr-payment/", $_REQUEST["s2member_paypal_proxy_use"]) && $paypal["txn_id"] && $paypal["mc_gross"] > 0))
|
593 |
-
&& (($user_id && is_object ($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)))
|
594 |
-
{
|
595 |
-
$paypal["s2member_log"][] = "User exists. Handling `payment` for Subscription via ( `" . ((preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . "` ).";
|
596 |
-
|
597 |
-
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
598 |
-
$pr_times["level"] = /* Preserve existing. */ (!$pr_times["level"]) ? time () : $pr_times["level"];
|
599 |
-
$pr_times["level" . $paypal["level"]] = (!$pr_times["level" . $paypal["level"]]) ? time () : $pr_times["level" . $paypal["level"]];
|
600 |
-
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times);
|
601 |
-
|
602 |
-
if /* 1st payment? */(!get_user_option ("s2member_first_payment_txn_id", $user_id))
|
603 |
-
update_user_option ($user_id, "s2member_first_payment_txn_id", $paypal["txn_id"]);
|
604 |
-
|
605 |
-
update_user_option /* Update the last payment time. */ ($user_id, "s2member_last_payment_time", time ());
|
606 |
-
|
607 |
-
$fields = /* These will be needed in the routines below. */ get_user_option ("s2member_custom_fields", $user_id);
|
608 |
-
$user_reg_ip = /* Original IP during Registration. */get_user_option ("s2member_registration_ip", $user_id);
|
609 |
-
|
610 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
611 |
-
{
|
612 |
-
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
613 |
-
|
614 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
|
615 |
-
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["txn_id"])), $url)))
|
616 |
-
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_name"])), $url)))
|
617 |
-
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["last_name"])), $url)))
|
618 |
-
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
619 |
-
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["payer_email"])), $url)))
|
620 |
-
|
621 |
-
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode($coupon["affiliate_id"])), $url)))
|
622 |
-
|
623 |
-
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
|
624 |
-
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
625 |
-
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
|
626 |
-
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_login)), $url)))
|
627 |
-
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
628 |
-
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
629 |
-
{
|
630 |
-
if (is_array($fields) && !empty($fields))
|
631 |
-
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
632 |
-
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
633 |
-
break;
|
634 |
-
|
635 |
-
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
636 |
-
c_ws_plugin__s2member_utils_urls::remote ($url);
|
637 |
-
}
|
638 |
-
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
639 |
-
}
|
640 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
641 |
-
{
|
642 |
-
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
643 |
-
$msg .= /* Spacing in the message body. */"\n\n";
|
644 |
-
|
645 |
-
$msg .= "subscr_id: %%subscr_id%%\n";
|
646 |
-
$msg .= "amount: %%amount%%\n";
|
647 |
-
$msg .= "txn_id: %%txn_id%%\n";
|
648 |
-
$msg .= "item_number: %%item_number%%\n";
|
649 |
-
$msg .= "item_name: %%item_name%%\n";
|
650 |
-
$msg .= "first_name: %%first_name%%\n";
|
651 |
-
$msg .= "last_name: %%last_name%%\n";
|
652 |
-
$msg .= "full_name: %%full_name%%\n";
|
653 |
-
$msg .= "payer_email: %%payer_email%%\n";
|
654 |
-
|
655 |
-
$msg .= "full_coupon_code: %%full_coupon_code%%\n";
|
656 |
-
$msg .= "coupon_code: %%coupon_code%%\n";
|
657 |
-
$msg .= "coupon_affiliate_id: %%coupon_affiliate_id%%\n";
|
658 |
-
|
659 |
-
$msg .= "user_first_name: %%user_first_name%%\n";
|
660 |
-
$msg .= "user_last_name: %%user_last_name%%\n";
|
661 |
-
$msg .= "user_full_name: %%user_full_name%%\n";
|
662 |
-
$msg .= "user_email: %%user_email%%\n";
|
663 |
-
$msg .= "user_login: %%user_login%%\n";
|
664 |
-
$msg .= "user_ip: %%user_ip%%\n";
|
665 |
-
$msg .= "user_id: %%user_id%%\n";
|
666 |
-
|
667 |
-
if (is_array($fields) && !empty($fields))
|
668 |
-
foreach ($fields as $var => $val)
|
669 |
-
$msg .= $var . ": %%" . $var . "%%\n";
|
670 |
-
|
671 |
-
$msg .= "cv0: %%cv0%%\n";
|
672 |
-
$msg .= "cv1: %%cv1%%\n";
|
673 |
-
$msg .= "cv2: %%cv2%%\n";
|
674 |
-
$msg .= "cv3: %%cv3%%\n";
|
675 |
-
$msg .= "cv4: %%cv4%%\n";
|
676 |
-
$msg .= "cv5: %%cv5%%\n";
|
677 |
-
$msg .= "cv6: %%cv6%%\n";
|
678 |
-
$msg .= "cv7: %%cv7%%\n";
|
679 |
-
$msg .= "cv8: %%cv8%%\n";
|
680 |
-
$msg .= "cv9: %%cv9%%";
|
681 |
-
|
682 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $msg)))
|
683 |
-
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $msg)))
|
684 |
-
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $msg)))
|
685 |
-
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $msg)))
|
686 |
-
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
687 |
-
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["payer_email"]), $msg)))
|
688 |
-
|
689 |
-
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($coupon["affiliate_id"]), $msg)))
|
690 |
-
|
691 |
-
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
|
692 |
-
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
693 |
-
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
|
694 |
-
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $msg)))
|
695 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
696 |
-
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
697 |
-
{
|
698 |
-
if (is_array($fields) && !empty($fields))
|
699 |
-
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
700 |
-
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
701 |
-
break;
|
702 |
-
|
703 |
-
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
704 |
-
|
705 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
706 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
707 |
-
}
|
708 |
-
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
709 |
-
}
|
710 |
-
}
|
711 |
-
else if ($processing // Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`.
|
712 |
-
&& (preg_match ("/^web_accept$/i", $paypal["txn_type"]) || ($_REQUEST["s2member_paypal_proxy"] && preg_match ("/subscr-signup-as-subscr-payment/", $_REQUEST["s2member_paypal_proxy_use"]) && $paypal["txn_id"] && $paypal["mc_gross"] > 0)))
|
713 |
-
{
|
714 |
-
$paypal["s2member_log"][] = "Storing `payment` for Subscription via ( `" . ((preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . "` ).";
|
715 |
-
|
716 |
-
$ipn = /* Create a simulated IPN response for txn_type=subscr_payment. */array("txn_type" => "subscr_payment");
|
717 |
-
|
718 |
-
foreach ($paypal as $var => $val)
|
719 |
-
if (in_array($var, array("subscr_gateway", "subscr_id", "txn_id", "custom", "invoice", "mc_gross", "mc_currency", "tax", "payer_email", "first_name", "last_name", "item_name", "item_number", "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
720 |
-
$ipn[$var] = $val;
|
721 |
-
|
722 |
-
$paypal["s2member_log"][] = "Creating an IPN response for `subscr_payment`. This will go into a Transient Queue; and be processed during registration.";
|
723 |
-
|
724 |
-
set_transient ("s2m_" . md5 ("s2member_transient_ipn_subscr_payment_" . $paypal["subscr_id"]), $ipn, 43200);
|
725 |
-
}
|
726 |
-
if ($processing // Store signup vars now? If the User already exists in the database, we can go ahead and store these right now.
|
727 |
-
&& (($user_id && is_object ($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)))
|
728 |
-
{
|
729 |
-
$paypal["s2member_log"][] = "Storing IPN signup vars now. These are associated with a User's account record; for future reference.";
|
730 |
-
|
731 |
-
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
|
732 |
-
}
|
733 |
-
else if /* Otherwise, we can store these into a Transient Queue for registration processing. */ ($processing)
|
734 |
-
{
|
735 |
-
$paypal["s2member_log"][] = "Storing IPN signup vars into a Transient Queue. These will be processed on registration.";
|
736 |
-
|
737 |
-
set_transient ("s2m_" . md5 ("s2member_transient_ipn_signup_vars_" . $paypal["subscr_id"]), $ipn_signup_vars, 43200);
|
738 |
-
}
|
739 |
-
}
|
740 |
-
else // Else, this is a duplicate IPN. Must stop here.
|
741 |
-
{
|
742 |
-
$paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
|
743 |
-
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ).";
|
744 |
-
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
745 |
-
}
|
746 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
747 |
-
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
|
748 |
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
749 |
|
750 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
}
|
752 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
753 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
754 |
}
|
|
|
|
|
755 |
}
|
756 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's PayPal IPN handler (inner processing routine).
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\PayPal
|
15 |
+
* @since 110720
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member's PayPal IPN handler (inner processing routine).
|
24 |
+
*
|
25 |
+
* @package s2Member\PayPal
|
26 |
+
* @since 110720
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level
|
29 |
{
|
30 |
/**
|
31 |
+
* s2Member's PayPal IPN handler (inner processing routine).
|
32 |
+
*
|
33 |
+
* @package s2Member\PayPal
|
34 |
+
* @since 110720
|
35 |
+
*
|
36 |
+
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
+
*
|
38 |
+
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
39 |
+
*/
|
40 |
+
public static function cp($vars = array() /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */)
|
41 |
+
{
|
42 |
+
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
43 |
+
|
44 |
+
if((!empty($paypal['txn_type']) && preg_match('/^(web_accept|subscr_signup)$/i', $paypal['txn_type']))
|
45 |
+
&& (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_regex'], $paypal['item_number']))
|
46 |
+
&& (!empty($paypal['subscr_id']) || (!empty($paypal['txn_id']) && ($paypal['subscr_id'] = $paypal['txn_id'])))
|
47 |
+
&& (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status']))
|
48 |
+
&& (!empty($paypal['subscr_baid']) || ($paypal['subscr_baid'] = $paypal['subscr_id']))
|
49 |
+
&& (!empty($paypal['subscr_cid']) || ($paypal['subscr_cid'] = $paypal['subscr_id']))
|
50 |
+
&& (!empty($paypal['payer_email']))
|
51 |
+
)
|
52 |
{
|
53 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
54 |
+
do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_signup', get_defined_vars());
|
55 |
+
unset($__refs, $__v);
|
56 |
+
|
57 |
+
if(!get_transient($transient_ipn = 's2m_ipn_'.md5('s2member_transient_'.$_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10))
|
58 |
+
{
|
59 |
+
$processing = $modifying = $during = FALSE; // Initialize these flags.
|
60 |
+
|
61 |
+
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ).';
|
62 |
+
|
63 |
+
@list ($paypal['level'], $paypal['ccaps'], $paypal['eotper']) = preg_split('/\:/', $paypal['item_number'], 3);
|
64 |
+
|
65 |
+
$paypal['ip'] = (preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2']) ? $paypal['option_selection2'] : '';
|
66 |
+
$paypal['ip'] = (!$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\.]+$/i', $paypal['invoice'])) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
|
67 |
+
|
68 |
+
$paypal['period1'] = (isset($paypal['period1']) && preg_match('/^[1-9]/', $paypal['period1'])) ? $paypal['period1'] : '0 D';
|
69 |
+
$paypal['mc_amount1'] = (isset($paypal['mc_amount1']) && $paypal['mc_amount1'] > 0) ? $paypal['mc_amount1'] : '0.00';
|
70 |
+
|
71 |
+
if(preg_match('/^web_accept$/i', $paypal['txn_type']) /* Conversions for lifetime & fixed-term sales. */)
|
72 |
+
{
|
73 |
+
$paypal['period3'] = ($paypal['eotper']) ? $paypal['eotper'] : '1 L'; // 1 lifetime.
|
74 |
+
$paypal['mc_amount3'] = $paypal['mc_gross']; // The 'Buy Now' amount is the full gross.
|
75 |
+
}
|
76 |
+
$paypal['initial_term'] = (preg_match('/^[1-9]/', $paypal['period1'])) ? $paypal['period1'] : '0 D';
|
77 |
+
$paypal['initial'] = isset($paypal['mc_amount1'][0]) && preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['mc_amount1'] : $paypal['mc_amount3'];
|
78 |
+
$paypal['regular'] = $paypal['mc_amount3']; // This is the regular payment amount that is charged to the customer. always required by PayPal.
|
79 |
+
$paypal['regular_term'] = $paypal['period3']; // This is just set to keep a standard; this way both initial_term & regular_term are available.
|
80 |
+
$paypal['recurring'] = !empty($paypal['recurring']) ? $paypal['mc_amount3'] : '0'; // If non-recurring, this should be zero, otherwise regular.
|
81 |
+
|
82 |
+
$ipn_signup_vars = $paypal; // Create array of IPN signup vars w/o s2member_log.
|
83 |
+
unset($ipn_signup_vars['s2member_log']);
|
84 |
+
/*
|
85 |
+
New Subscription with advanced update vars (option_name1, option_selection1)? These variables are used in Subscr. Modifications.
|
86 |
+
*/
|
87 |
+
if(preg_match('/(referenc|associat|updat|upgrad)/i', $paypal['option_name1']) && $paypal['option_selection1'])
|
88 |
{
|
89 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
90 |
+
do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars', get_defined_vars());
|
91 |
+
unset($__refs, $__v);
|
92 |
+
|
93 |
+
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/ update vars.';
|
94 |
|
95 |
+
if(($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User ($user_id)) && $user->ID)
|
96 |
+
{
|
97 |
+
if(!$user->has_cap('administrator')) // Do NOT process this routine on Administrators.
|
|
|
|
|
98 |
{
|
99 |
+
$processing = $modifying = $during = TRUE; // Yes, we ARE processing this.
|
100 |
+
|
101 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
102 |
+
do_action('ws_plugin__s2member_during_paypal_notify_during_before_subscr_signup_w_update_vars', get_defined_vars());
|
103 |
+
do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), 'ipn-upgrade-downgrade', 'modification', 's2member_level'.$paypal['level']);
|
104 |
unset($__refs, $__v);
|
105 |
|
106 |
+
$fields = get_user_option('s2member_custom_fields', $user_id);
|
107 |
+
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
|
108 |
+
$user_reg_ip = $paypal['ip'] = ($user_reg_ip) ? $user_reg_ip : $paypal['ip'];
|
109 |
+
|
110 |
+
if(is_multisite() && !is_user_member_of_blog($user_id))
|
111 |
+
{
|
112 |
+
add_existing_user_to_blog(array('user_id' => $user_id, 'role' => 's2member_level'.$paypal['level']));
|
113 |
+
$user = new WP_User ($user_id);
|
114 |
+
}
|
115 |
+
$current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
116 |
+
|
117 |
+
if($current_role !== 's2member_level'.$paypal['level'])
|
118 |
+
$user->set_role('s2member_level'.$paypal['level']);
|
119 |
+
|
120 |
+
if($paypal['ccaps'] && preg_match('/^-all/', str_replace('+', '', $paypal['ccaps'])))
|
121 |
+
foreach($user->allcaps as $cap => $cap_enabled)
|
122 |
+
if(preg_match('/^access_s2member_ccap_/', $cap))
|
123 |
+
$user->remove_cap($ccap = $cap);
|
124 |
+
|
125 |
+
if($paypal['ccaps'] && preg_replace('/^-all['."\r\n\t".'\s;,]*/', '', str_replace('+', '', $paypal['ccaps'])))
|
126 |
+
foreach(preg_split('/['."\r\n\t".'\s;,]+/', preg_replace('/^-all['."\r\n\t".'\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) as $ccap)
|
127 |
+
if(strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap)))))
|
128 |
+
$user->add_cap('access_s2member_ccap_'.$ccap);
|
129 |
+
|
130 |
+
update_user_option($user_id, 's2member_subscr_gateway', $paypal['subscr_gateway']);
|
131 |
+
update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
|
132 |
+
update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
|
133 |
+
update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
|
134 |
+
|
135 |
+
update_user_option($user_id, 's2member_custom', $paypal['custom']);
|
136 |
+
|
137 |
+
if(!get_user_option('s2member_registration_ip', $user_id))
|
138 |
+
update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
|
139 |
+
|
140 |
+
update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
|
141 |
+
|
142 |
+
delete_user_option($user_id, 's2member_file_download_access_log');
|
143 |
+
|
144 |
+
if((preg_match('/^web_accept$/i', $paypal['txn_type']) || ($paypal['initial'] <= 0 && $paypal['regular'] <= 0)) && $paypal['eotper'])
|
145 |
+
{
|
146 |
+
update_user_option($user_id, 's2member_auto_eot_time', // Set exclusively by the IPN handler; to avoid duplicate extensions.
|
147 |
+
($eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time('', '', '', $paypal['eotper'], '', get_user_option('s2member_auto_eot_time', $user_id))));
|
148 |
+
$paypal['s2member_log'][] = 'Automatic EOT (End Of Term) Time set to: '.date('D M j, Y g:i:s a T', $eot_time).'.';
|
149 |
+
}
|
150 |
+
else delete_user_option($user_id, 's2member_auto_eot_time');
|
151 |
+
|
152 |
+
$pr_times = get_user_option('s2member_paid_registration_times', $user_id);
|
153 |
+
$pr_times['level'] = (!$pr_times['level']) ? time() : $pr_times['level']; // Preserve existing.
|
154 |
+
$pr_times['level'.$paypal['level']] = (!$pr_times['level'.$paypal['level']]) ? time() : $pr_times['level'.$paypal['level']];
|
155 |
+
update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
|
156 |
+
|
157 |
+
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Demoted by s2Member\:/');
|
158 |
+
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Paid Subscr\. ID @ time of demotion\:/');
|
159 |
+
|
160 |
+
$paypal['s2member_log'][] = 's2Member Level/Capabilities updated w/ advanced update routines.';
|
161 |
+
|
162 |
+
$sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_subject']; // The same for standard and w/ Pro Forms.
|
163 |
+
$msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_message']; // The same for standard and w/ Pro Forms.
|
164 |
+
$rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_recipients']; // The same for standard and w/ Pro Forms.
|
165 |
+
|
166 |
+
if(($rec = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $rec)) && ($rec = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $rec)))
|
167 |
+
if(($rec = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $rec)) && ($rec = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $rec)))
|
168 |
+
if(($rec = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $rec)) && ($rec = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $rec)))
|
169 |
+
if(($rec = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $rec)) && ($rec = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $rec)))
|
170 |
+
if(($rec = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $rec)) && ($rec = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $rec)))
|
171 |
+
if(($rec = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $rec)) && ($rec = preg_replace('/%%recurring\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs((($paypal['recurring']) ? $paypal['recurring'].' / '.c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring')), $rec)))
|
172 |
+
if(($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec)))
|
173 |
+
if(($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec)))
|
174 |
+
if(($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name']))), $rec))) // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. 'N\'ame' <email>).
|
175 |
+
if(($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)))
|
176 |
+
|
177 |
+
if(($rec = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $rec)))
|
178 |
+
|
179 |
+
if(($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $rec)) && ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $rec)))
|
180 |
+
if(($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $rec)))
|
181 |
+
if(($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)))
|
182 |
+
if(($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)))
|
183 |
+
if(($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $rec)))
|
184 |
+
if(($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)))
|
185 |
+
|
186 |
+
if(($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) && ($sbj = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $sbj)))
|
187 |
+
if(($sbj = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $sbj)) && ($sbj = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $sbj)))
|
188 |
+
if(($sbj = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $sbj)) && ($sbj = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $sbj)))
|
189 |
+
if(($sbj = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $sbj)) && ($sbj = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $sbj)))
|
190 |
+
if(($sbj = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $sbj)) && ($sbj = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $sbj)))
|
191 |
+
if(($sbj = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $sbj)) && ($sbj = preg_replace('/%%recurring\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs((($paypal['recurring']) ? $paypal['recurring'].' / '.c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring')), $sbj)))
|
192 |
+
if(($sbj = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $sbj)) && ($sbj = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $sbj)))
|
193 |
+
if(($sbj = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $sbj)) && ($sbj = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $sbj)))
|
194 |
+
if(($sbj = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $sbj)))
|
195 |
+
if(($sbj = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $sbj)))
|
196 |
+
|
197 |
+
if(($sbj = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $sbj)))
|
198 |
+
|
199 |
+
if(($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) && ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)))
|
200 |
+
if(($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $sbj)))
|
201 |
+
if(($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)))
|
202 |
+
if(($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)))
|
203 |
+
if(($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $sbj)))
|
204 |
+
if(($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)))
|
205 |
+
|
206 |
+
if(($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg)))
|
207 |
+
if(($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg)))
|
208 |
+
if(($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg)))
|
209 |
+
if(($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg)))
|
210 |
+
if(($msg = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $msg)) && ($msg = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $msg)))
|
211 |
+
if(($msg = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $msg)) && ($msg = preg_replace('/%%recurring\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs((($paypal['recurring']) ? $paypal['recurring'].' / '.c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring')), $msg)))
|
212 |
+
if(($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg)))
|
213 |
+
if(($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg)))
|
214 |
+
if(($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $msg)))
|
215 |
+
if(($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)))
|
216 |
+
|
217 |
+
if(($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg)))
|
218 |
+
|
219 |
+
if(($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)))
|
220 |
+
if(($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $msg)))
|
221 |
+
if(($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)))
|
222 |
+
if(($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)))
|
223 |
+
if(($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)))
|
224 |
+
if(($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)))
|
225 |
+
{
|
226 |
+
if(is_array($fields) && !empty($fields)) foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
227 |
+
{
|
228 |
+
$rec = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $rec);
|
229 |
+
$sbj = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj);
|
230 |
+
$msg = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg);
|
231 |
+
}
|
232 |
+
if(($rec = trim(preg_replace('/%%(.+?)%%/i', '', $rec))) && ($sbj = trim(preg_replace('/%%(.+?)%%/i', '', $sbj))) && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg))))
|
233 |
+
{
|
234 |
+
if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())
|
235 |
+
{
|
236 |
+
$sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
|
237 |
+
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
238 |
+
}
|
239 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient /* Go through a possible list of recipients. */)
|
240 |
+
c_ws_plugin__s2member_email_configs::email_config().wp_mail($recipient, apply_filters('ws_plugin__s2member_modification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_modification_email_msg', $msg, get_defined_vars()), 'From: "'.preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']).'" <'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'].'>'."\r\n".'Content-Type: text/plain; charset=UTF-8').c_ws_plugin__s2member_email_configs::email_config_release();
|
241 |
+
|
242 |
+
$paypal['s2member_log'][] = 'Modification Confirmation Email sent to: '.$rec.'.';
|
243 |
+
}
|
244 |
+
}
|
245 |
+
if($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_urls'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
246 |
+
{
|
247 |
+
foreach(preg_split('/['."\r\n\t".']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_urls']) as $url)
|
248 |
+
|
249 |
+
if(($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url)))
|
250 |
+
if(($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url)))
|
251 |
+
if(($url = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial'])), $url)) && ($url = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular'])), $url)) && ($url = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['recurring'])), $url)))
|
252 |
+
if(($url = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial_term'])), $url)) && ($url = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular_term'])), $url)))
|
253 |
+
if(($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url)))
|
254 |
+
if(($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url)))
|
255 |
+
if(($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'].' '.$paypal['last_name']))), $url)))
|
256 |
+
if(($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)))
|
257 |
+
|
258 |
+
if(($url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['full_coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['affiliate_id'])), $url)))
|
259 |
+
|
260 |
+
if(($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url)))
|
261 |
+
if(($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name.' '.$user->last_name))), $url)))
|
262 |
+
if(($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)))
|
263 |
+
if(($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)))
|
264 |
+
if(($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)))
|
265 |
+
if(($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)))
|
266 |
+
{
|
267 |
+
if(is_array($fields) && !empty($fields))
|
268 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
269 |
+
if(!($url = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url)))
|
270 |
+
break;
|
271 |
+
|
272 |
+
if(($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))))
|
273 |
+
c_ws_plugin__s2member_utils_urls::remote($url);
|
274 |
+
}
|
275 |
+
$paypal['s2member_log'][] = 'Modification Notification URLs have been processed.';
|
276 |
+
}
|
277 |
+
if($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_recipients'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
278 |
+
{
|
279 |
+
$msg = $sbj = '(s2Member / API Notification Email) - Modification';
|
280 |
+
$msg .= "\n\n"; // Spacing in the message body.
|
281 |
+
|
282 |
+
$msg .= 'subscr_id: %%subscr_id%%'."\n";
|
283 |
+
$msg .= 'subscr_baid: %%subscr_baid%%'."\n";
|
284 |
+
$msg .= 'subscr_cid: %%subscr_cid%%'."\n";
|
285 |
+
$msg .= 'initial: %%initial%%'."\n";
|
286 |
+
$msg .= 'regular: %%regular%%'."\n";
|
287 |
+
$msg .= 'recurring: %%recurring%%'."\n";
|
288 |
+
$msg .= 'initial_term: %%initial_term%%'."\n";
|
289 |
+
$msg .= 'regular_term: %%regular_term%%'."\n";
|
290 |
+
$msg .= 'item_number: %%item_number%%'."\n";
|
291 |
+
$msg .= 'item_name: %%item_name%%'."\n";
|
292 |
+
$msg .= 'first_name: %%first_name%%'."\n";
|
293 |
+
$msg .= 'last_name: %%last_name%%'."\n";
|
294 |
+
$msg .= 'full_name: %%full_name%%'."\n";
|
295 |
+
$msg .= 'payer_email: %%payer_email%%'."\n";
|
296 |
+
|
297 |
+
$msg .= 'full_coupon_code: %%full_coupon_code%%'."\n";
|
298 |
+
$msg .= 'coupon_code: %%coupon_code%%'."\n";
|
299 |
+
$msg .= 'coupon_affiliate_id: %%coupon_affiliate_id%%'."\n";
|
300 |
+
|
301 |
+
$msg .= 'user_first_name: %%user_first_name%%'."\n";
|
302 |
+
$msg .= 'user_last_name: %%user_last_name%%'."\n";
|
303 |
+
$msg .= 'user_full_name: %%user_full_name%%'."\n";
|
304 |
+
$msg .= 'user_email: %%user_email%%'."\n";
|
305 |
+
$msg .= 'user_login: %%user_login%%'."\n";
|
306 |
+
$msg .= 'user_ip: %%user_ip%%'."\n";
|
307 |
+
$msg .= 'user_id: %%user_id%%'."\n";
|
308 |
+
|
309 |
+
if(is_array($fields) && !empty($fields))
|
310 |
+
foreach($fields as $var => $val)
|
311 |
+
$msg .= $var.': %%'.$var.'%%'."\n";
|
312 |
+
|
313 |
+
$msg .= 'cv0: %%cv0%%'."\n";
|
314 |
+
$msg .= 'cv1: %%cv1%%'."\n";
|
315 |
+
$msg .= 'cv2: %%cv2%%'."\n";
|
316 |
+
$msg .= 'cv3: %%cv3%%'."\n";
|
317 |
+
$msg .= 'cv4: %%cv4%%'."\n";
|
318 |
+
$msg .= 'cv5: %%cv5%%'."\n";
|
319 |
+
$msg .= 'cv6: %%cv6%%'."\n";
|
320 |
+
$msg .= 'cv7: %%cv7%%'."\n";
|
321 |
+
$msg .= 'cv8: %%cv8%%'."\n";
|
322 |
+
$msg .= 'cv9: %%cv9%%';
|
323 |
+
|
324 |
+
if(($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg)))
|
325 |
+
if(($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg)))
|
326 |
+
if(($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg)) && ($msg = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $msg)))
|
327 |
+
if(($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg)))
|
328 |
+
if(($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg)))
|
329 |
+
if(($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg)))
|
330 |
+
if(($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $msg)))
|
331 |
+
if(($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)))
|
332 |
+
|
333 |
+
if(($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg)))
|
334 |
+
|
335 |
+
if(($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)))
|
336 |
+
if(($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $msg)))
|
337 |
+
if(($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)))
|
338 |
+
if(($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)))
|
339 |
+
if(($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)))
|
340 |
+
if(($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)))
|
341 |
+
{
|
342 |
+
if(is_array($fields) && !empty($fields))
|
343 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
344 |
+
if(!($msg = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg)))
|
345 |
+
break;
|
346 |
+
|
347 |
+
if($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
348 |
+
|
349 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_recipients']) as $recipient)
|
350 |
+
wp_mail($recipient, apply_filters('ws_plugin__s2member_modification_notification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_modification_notification_email_msg', $msg, get_defined_vars()), 'Content-Type: text/plain; charset=UTF-8');
|
351 |
+
}
|
352 |
+
$paypal['s2member_log'][] = 'Modification Notification Emails have been processed.';
|
353 |
+
}
|
354 |
+
if($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_tracking_codes']) && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
355 |
+
{
|
356 |
+
if(($code = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $code)) && ($code = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $code)))
|
357 |
+
if(($code = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $code)) && ($code = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $code)))
|
358 |
+
if(($code = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $code)) && ($code = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $code)) && ($code = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $code)))
|
359 |
+
if(($code = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $code)) && ($code = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $code)))
|
360 |
+
if(($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code)))
|
361 |
+
if(($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code)))
|
362 |
+
if(($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $code)))
|
363 |
+
if(($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)))
|
364 |
+
|
365 |
+
if(($code = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $code)) && ($code = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $code)) && ($code = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $code)))
|
366 |
+
|
367 |
+
if(($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code)))
|
368 |
+
if(($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $code)))
|
369 |
+
if(($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)))
|
370 |
+
if(($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)))
|
371 |
+
if(($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)))
|
372 |
+
if(($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)))
|
373 |
+
{
|
374 |
+
if(is_array($fields) && !empty($fields))
|
375 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
376 |
+
if(!($code = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code)))
|
377 |
+
break;
|
378 |
+
|
379 |
+
if(($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) /* This gets stored into a transient queue. */)
|
380 |
+
{
|
381 |
+
$paypal['s2member_log'][] = 'Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.';
|
382 |
+
set_transient('s2m_'.md5('s2member_transient_modification_tracking_codes_'.$paypal['subscr_id']), $code, 43200);
|
383 |
+
}
|
384 |
+
}
|
385 |
+
}
|
386 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
387 |
+
do_action('ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars', get_defined_vars());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
unset($__refs, $__v);
|
389 |
+
}
|
390 |
+
else $paypal['s2member_log'][] = 'Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.';
|
391 |
+
}
|
392 |
+
else $paypal['s2member_log'][] = 'Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.';
|
393 |
|
394 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
395 |
+
do_action('ws_plugin__s2member_during_paypal_notify_after_subscr_signup_w_update_vars', get_defined_vars());
|
396 |
+
unset($__refs, $__v);
|
397 |
+
}
|
398 |
+
/*
|
399 |
+
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
400 |
+
*/
|
401 |
+
else // Else this is a normal Subscription signup, we are not updating anything.
|
402 |
+
{
|
403 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
404 |
+
do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_signup_wo_update_vars', get_defined_vars());
|
405 |
+
unset($__refs, $__v);
|
406 |
+
|
407 |
+
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/o update vars.';
|
408 |
+
|
409 |
+
if(($registration_url = c_ws_plugin__s2member_register_access::register_link_gen($paypal['subscr_gateway'], $paypal['subscr_id'], $paypal['custom'], $paypal['item_number'])) && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
410 |
+
{
|
411 |
+
$processing = $during = TRUE; // Yes, we ARE processing this.
|
412 |
+
|
413 |
+
$sbj = preg_replace('/%%registration_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($registration_url), $GLOBALS['WS_PLUGIN__']['s2member']['o'][(($_REQUEST['s2member_paypal_proxy'] && preg_match('/pro-emails/', $_REQUEST['s2member_paypal_proxy_use'])) ? 'pro_' : '').'signup_email_subject']);
|
414 |
+
$msg = preg_replace('/%%registration_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($registration_url), $GLOBALS['WS_PLUGIN__']['s2member']['o'][(($_REQUEST['s2member_paypal_proxy'] && preg_match('/pro-emails/', $_REQUEST['s2member_paypal_proxy_use'])) ? 'pro_' : '').'signup_email_message']);
|
415 |
+
$rec = preg_replace('/%%registration_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($registration_url), $GLOBALS['WS_PLUGIN__']['s2member']['o'][(($_REQUEST['s2member_paypal_proxy'] && preg_match('/pro-emails/', $_REQUEST['s2member_paypal_proxy_use'])) ? 'pro_' : '').'signup_email_recipients']);
|
416 |
+
|
417 |
+
if(($rec = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $rec)) && ($rec = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $rec)))
|
418 |
+
if(($rec = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $rec)) && ($rec = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $rec)))
|
419 |
+
if(($rec = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $rec)) && ($rec = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $rec)))
|
420 |
+
if(($rec = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $rec)) && ($rec = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $rec)))
|
421 |
+
if(($rec = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $rec)) && ($rec = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $rec)))
|
422 |
+
if(($rec = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $rec)) && ($rec = preg_replace('/%%recurring\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs((($paypal['recurring']) ? $paypal['recurring'].' / '.c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring')), $rec)))
|
423 |
+
if(($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec)))
|
424 |
+
if(($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec)))
|
425 |
+
if(($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name']))), $rec))) // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
|
426 |
+
if(($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)))
|
427 |
+
if(($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $rec)))
|
428 |
+
if(($rec = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $rec)))
|
429 |
+
|
430 |
+
if(($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) && ($sbj = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $sbj)))
|
431 |
+
if(($sbj = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $sbj)) && ($sbj = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $sbj)))
|
432 |
+
if(($sbj = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $sbj)) && ($sbj = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $sbj)))
|
433 |
+
if(($sbj = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $sbj)) && ($sbj = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $sbj)))
|
434 |
+
if(($sbj = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $sbj)) && ($sbj = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $sbj)))
|
435 |
+
if(($sbj = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $sbj)) && ($sbj = preg_replace('/%%recurring\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs((($paypal['recurring']) ? $paypal['recurring'].' / '.c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring')), $sbj)))
|
436 |
+
if(($sbj = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $sbj)) && ($sbj = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $sbj)))
|
437 |
+
if(($sbj = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $sbj)) && ($sbj = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $sbj)))
|
438 |
+
if(($sbj = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $sbj)))
|
439 |
+
if(($sbj = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $sbj)))
|
440 |
+
if(($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $sbj)))
|
441 |
+
if(($sbj = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $sbj)))
|
442 |
+
|
443 |
+
if(($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg)))
|
444 |
+
if(($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg)))
|
445 |
+
if(($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg)))
|
446 |
+
if(($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg)))
|
447 |
+
if(($msg = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $msg)) && ($msg = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $msg)))
|
448 |
+
if(($msg = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $msg)) && ($msg = preg_replace('/%%recurring\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs((($paypal['recurring']) ? $paypal['recurring'].' / '.c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring')), $msg)))
|
449 |
+
if(($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg)))
|
450 |
+
if(($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg)))
|
451 |
+
if(($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $msg)))
|
452 |
+
if(($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)))
|
453 |
+
if(($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $msg)))
|
454 |
+
if(($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg)))
|
455 |
+
|
456 |
+
if(($rec = trim(preg_replace('/%%(.+?)%%/i', '', $rec))) && ($sbj = trim(preg_replace('/%%(.+?)%%/i', '', $sbj))) && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg))))
|
457 |
+
{
|
458 |
+
if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())
|
459 |
+
{
|
460 |
+
$sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
|
461 |
+
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
462 |
+
}
|
463 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) // Go through a possible list of recipients.
|
464 |
+
c_ws_plugin__s2member_email_configs::email_config().wp_mail($recipient, apply_filters('ws_plugin__s2member_signup_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_signup_email_msg', $msg, get_defined_vars()), 'From: "'.preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']).'" <'.$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'].'>'."\r\n".'Content-Type: text/plain; charset=UTF-8').c_ws_plugin__s2member_email_configs::email_config_release();
|
465 |
+
|
466 |
+
$paypal['s2member_log'][] = 'Signup Confirmation Email sent to: '.$rec.'.';
|
467 |
+
}
|
468 |
+
if($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['signup_notification_urls'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
469 |
+
{
|
470 |
+
foreach(preg_split('/['."\r\n\t".']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['signup_notification_urls']) as $url)
|
471 |
+
|
472 |
+
if(($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url)))
|
473 |
+
if(($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url)))
|
474 |
+
if(($url = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial'])), $url)) && ($url = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular'])), $url)) && ($url = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['recurring'])), $url)))
|
475 |
+
if(($url = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial_term'])), $url)) && ($url = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular_term'])), $url)))
|
476 |
+
if(($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url)))
|
477 |
+
if(($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url)))
|
478 |
+
if(($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'].' '.$paypal['last_name']))), $url)))
|
479 |
+
if(($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)))
|
480 |
+
if(($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['ip'])), $url)))
|
481 |
+
if(($url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['full_coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['affiliate_id'])), $url)))
|
482 |
+
|
483 |
+
if(($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))))
|
484 |
+
c_ws_plugin__s2member_utils_urls::remote($url);
|
485 |
+
|
486 |
+
$paypal['s2member_log'][] = 'Signup Notification URLs have been processed.';
|
487 |
+
}
|
488 |
+
if($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['signup_notification_recipients'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
489 |
+
{
|
490 |
+
$msg = $sbj = '(s2Member / API Notification Email) - Signup';
|
491 |
+
$msg .= "\n\n"; // Spacing in the message body.
|
492 |
+
|
493 |
+
$msg .= 'subscr_id: %%subscr_id%%'."\n";
|
494 |
+
$msg .= 'subscr_baid: %%subscr_baid%%'."\n";
|
495 |
+
$msg .= 'subscr_cid: %%subscr_cid%%'."\n";
|
496 |
+
$msg .= 'initial: %%initial%%'."\n";
|
497 |
+
$msg .= 'regular: %%regular%%'."\n";
|
498 |
+
$msg .= 'recurring: %%recurring%%'."\n";
|
499 |
+
$msg .= 'initial_term: %%initial_term%%'."\n";
|
500 |
+
$msg .= 'regular_term: %%regular_term%%'."\n";
|
501 |
+
$msg .= 'item_number: %%item_number%%'."\n";
|
502 |
+
$msg .= 'item_name: %%item_name%%'."\n";
|
503 |
+
$msg .= 'first_name: %%first_name%%'."\n";
|
504 |
+
$msg .= 'last_name: %%last_name%%'."\n";
|
505 |
+
$msg .= 'full_name: %%full_name%%'."\n";
|
506 |
+
$msg .= 'payer_email: %%payer_email%%'."\n";
|
507 |
+
$msg .= 'user_ip: %%user_ip%%'."\n";
|
508 |
+
|
509 |
+
$msg .= 'full_coupon_code: %%full_coupon_code%%'."\n";
|
510 |
+
$msg .= 'coupon_code: %%coupon_code%%'."\n";
|
511 |
+
$msg .= 'coupon_affiliate_id: %%coupon_affiliate_id%%'."\n";
|
512 |
+
|
513 |
+
$msg .= 'cv0: %%cv0%%'."\n";
|
514 |
+
$msg .= 'cv1: %%cv1%%'."\n";
|
515 |
+
$msg .= 'cv2: %%cv2%%'."\n";
|
516 |
+
$msg .= 'cv3: %%cv3%%'."\n";
|
517 |
+
$msg .= 'cv4: %%cv4%%'."\n";
|
518 |
+
$msg .= 'cv5: %%cv5%%'."\n";
|
519 |
+
$msg .= 'cv6: %%cv6%%'."\n";
|
520 |
+
$msg .= 'cv7: %%cv7%%'."\n";
|
521 |
+
$msg .= 'cv8: %%cv8%%'."\n";
|
522 |
+
$msg .= 'cv9: %%cv9%%';
|
523 |
+
|
524 |
+
if(($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg)))
|
525 |
+
if(($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg)))
|
526 |
+
if(($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg)) && ($msg = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $msg)))
|
527 |
+
if(($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg)))
|
528 |
+
if(($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg)))
|
529 |
+
if(($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg)))
|
530 |
+
if(($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $msg)))
|
531 |
+
if(($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)))
|
532 |
+
if(($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $msg)))
|
533 |
+
if(($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg)))
|
534 |
+
|
535 |
+
if($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
536 |
+
|
537 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS['WS_PLUGIN__']['s2member']['o']['signup_notification_recipients']) as $recipient)
|
538 |
+
wp_mail($recipient, apply_filters('ws_plugin__s2member_signup_notification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_signup_notification_email_msg', $msg, get_defined_vars()), 'Content-Type: text/plain; charset=UTF-8');
|
539 |
+
|
540 |
+
$paypal['s2member_log'][] = 'Signup Notification Emails have been processed.';
|
541 |
+
}
|
542 |
+
if($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['signup_tracking_codes']) && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
543 |
+
{
|
544 |
+
if(($code = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $code)) && ($code = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $code)))
|
545 |
+
if(($code = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $code)) && ($code = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $code)))
|
546 |
+
if(($code = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $code)) && ($code = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $code)) && ($code = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $code)))
|
547 |
+
if(($code = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $code)) && ($code = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $code)))
|
548 |
+
if(($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code)))
|
549 |
+
if(($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code)))
|
550 |
+
if(($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $code)))
|
551 |
+
if(($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)))
|
552 |
+
if(($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $code)))
|
553 |
+
if(($code = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $code)) && ($code = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $code)) && ($code = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $code)))
|
554 |
+
|
555 |
+
if(($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) /* This gets stored into a Transient Queue. */)
|
556 |
+
{
|
557 |
+
$paypal['s2member_log'][] = 'Storing Signup Tracking Codes into a Transient Queue. These will be processed on-site.';
|
558 |
+
set_transient('s2m_'.md5('s2member_transient_signup_tracking_codes_'.$paypal['subscr_id']), $code, 43200);
|
559 |
+
}
|
560 |
}
|
561 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
562 |
+
do_action('ws_plugin__s2member_during_paypal_notify_during_subscr_signup_wo_update_vars', get_defined_vars());
|
563 |
+
unset($__refs, $__v);
|
564 |
+
}
|
565 |
+
else $paypal['s2member_log'][] = 'Unable to generate Registration URL for Membership Access. Possible data corruption within the IPN response.';
|
566 |
+
|
567 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
568 |
+
do_action('ws_plugin__s2member_during_paypal_notify_after_subscr_signup_wo_update_vars', get_defined_vars());
|
569 |
+
unset($__refs, $__v);
|
570 |
+
}
|
571 |
+
if($processing && $_REQUEST['s2member_paypal_proxy'] && ($url = $_REQUEST['s2member_paypal_proxy_return_url']) && is_array($cv = preg_split('/\|/', $paypal['custom']))) // A Proxy is requesting a Return URL?
|
572 |
+
{
|
573 |
+
if((!empty($user_id) && !empty($user) && is_object($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User ($user_id)) && $user->ID))
|
574 |
+
{
|
575 |
+
$fields = get_user_option('s2member_custom_fields', $user_id); // These will be needed in the routines below.
|
576 |
+
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id); // Original IP during Registration.
|
577 |
+
|
578 |
+
if(($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url)))
|
579 |
+
if(($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url)))
|
580 |
+
if(($url = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial'])), $url)) && ($url = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular'])), $url)) && ($url = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['recurring'])), $url)))
|
581 |
+
if(($url = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial_term'])), $url)) && ($url = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular_term'])), $url)))
|
582 |
+
if(($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url)))
|
583 |
+
if(($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url)))
|
584 |
+
if(($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'].' '.$paypal['last_name']))), $url)))
|
585 |
+
if(($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)))
|
586 |
+
if(($url = preg_replace('/%%modification%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode((int)$modifying)), $url)))
|
587 |
+
|
588 |
+
if(($url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['full_coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['affiliate_id'])), $url)))
|
589 |
+
|
590 |
+
if(($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url)))
|
591 |
+
if(($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name.' '.$user->last_name))), $url)))
|
592 |
+
if(($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)))
|
593 |
+
if(($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)))
|
594 |
+
if(($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)))
|
595 |
+
if(($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)))
|
596 |
+
{
|
597 |
+
if(is_array($fields) && !empty($fields))
|
598 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
599 |
+
if(!($url = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url)))
|
600 |
+
break;
|
601 |
+
|
602 |
+
if(($url = trim($url))) // Preserve remaining replacements; parent routine may perform replacements too.
|
603 |
+
$paypal['s2member_paypal_proxy_return_url'] = $url;
|
604 |
+
}
|
605 |
+
}
|
606 |
+
$paypal['s2member_log'][] = 'Subscr. Return ( `modification='.(int)$modifying.'` ), a Proxy Return URL is ready.';
|
607 |
+
}
|
608 |
+
if($processing // Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`.
|
609 |
+
&& (preg_match('/^web_accept$/i', $paypal['txn_type']) || ($_REQUEST['s2member_paypal_proxy'] && preg_match('/subscr-signup-as-subscr-payment/', $_REQUEST['s2member_paypal_proxy_use']) && $paypal['txn_id'] && $paypal['mc_gross'] > 0))
|
610 |
+
&& ((!empty($user_id) && !empty($user) && is_object($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User ($user_id)) && $user->ID))
|
611 |
+
)
|
612 |
+
{
|
613 |
+
$paypal['s2member_log'][] = 'User exists. Handling `payment` for Subscription via ( `'.((preg_match('/^web_accept$/i', $paypal['txn_type'])) ? 'web_accept' : 'subscr-signup-as-subscr-payment').'` ).';
|
614 |
+
|
615 |
+
$pr_times = get_user_option('s2member_paid_registration_times', $user_id);
|
616 |
+
$pr_times['level'] = (!$pr_times['level']) ? time() : $pr_times['level']; // Preserve existing.
|
617 |
+
$pr_times['level'.$paypal['level']] = (!$pr_times['level'.$paypal['level']]) ? time() : $pr_times['level'.$paypal['level']];
|
618 |
+
update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
|
619 |
+
|
620 |
+
if(!get_user_option('s2member_first_payment_txn_id', $user_id) /* 1st payment? */)
|
621 |
+
update_user_option($user_id, 's2member_first_payment_txn_id', $paypal['txn_id']);
|
622 |
+
|
623 |
+
update_user_option($user_id, 's2member_last_payment_time', time()); // Update the last payment time.
|
624 |
+
|
625 |
+
$fields = get_user_option('s2member_custom_fields', $user_id); // These will be needed in the routines below.
|
626 |
+
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id); // Original IP during Registration.
|
627 |
+
|
628 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
629 |
+
{
|
630 |
+
foreach(preg_split('/['."\r\n\t".']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls']) as $url)
|
631 |
+
|
632 |
+
if(($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url)))
|
633 |
+
if(($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url)))
|
634 |
+
if(($url = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['mc_gross'])), $url)) && ($url = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_id'])), $url)))
|
635 |
+
if(($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url)))
|
636 |
+
if(($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url)))
|
637 |
+
if(($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'].' '.$paypal['last_name']))), $url)))
|
638 |
+
if(($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)))
|
639 |
+
|
640 |
+
if(($url = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['full_coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['coupon_code'])), $url)) && ($url = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($coupon['affiliate_id'])), $url)))
|
641 |
+
|
642 |
+
if(($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url)))
|
643 |
+
if(($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name.' '.$user->last_name))), $url)))
|
644 |
+
if(($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)))
|
645 |
+
if(($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)))
|
646 |
+
if(($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)))
|
647 |
+
if(($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)))
|
648 |
+
{
|
649 |
+
if(is_array($fields) && !empty($fields))
|
650 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
651 |
+
if(!($url = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url)))
|
652 |
+
break;
|
653 |
+
|
654 |
+
if(($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))))
|
655 |
+
c_ws_plugin__s2member_utils_urls::remote($url);
|
656 |
+
}
|
657 |
+
$paypal['s2member_log'][] = 'Payment Notification URLs have been processed.';
|
658 |
+
}
|
659 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_recipients'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
|
660 |
+
{
|
661 |
+
$msg = $sbj = '(s2Member / API Notification Email) - Payment';
|
662 |
+
$msg .= "\n\n"; // Spacing in the message body.
|
663 |
+
|
664 |
+
$msg .= 'subscr_id: %%subscr_id%%'."\n";
|
665 |
+
$msg .= 'subscr_baid: %%subscr_baid%%'."\n";
|
666 |
+
$msg .= 'subscr_cid: %%subscr_cid%%'."\n";
|
667 |
+
$msg .= 'amount: %%amount%%'."\n";
|
668 |
+
$msg .= 'txn_id: %%txn_id%%'."\n";
|
669 |
+
$msg .= 'item_number: %%item_number%%'."\n";
|
670 |
+
$msg .= 'item_name: %%item_name%%'."\n";
|
671 |
+
$msg .= 'first_name: %%first_name%%'."\n";
|
672 |
+
$msg .= 'last_name: %%last_name%%'."\n";
|
673 |
+
$msg .= 'full_name: %%full_name%%'."\n";
|
674 |
+
$msg .= 'payer_email: %%payer_email%%'."\n";
|
675 |
+
|
676 |
+
$msg .= 'full_coupon_code: %%full_coupon_code%%'."\n";
|
677 |
+
$msg .= 'coupon_code: %%coupon_code%%'."\n";
|
678 |
+
$msg .= 'coupon_affiliate_id: %%coupon_affiliate_id%%'."\n";
|
679 |
+
|
680 |
+
$msg .= 'user_first_name: %%user_first_name%%'."\n";
|
681 |
+
$msg .= 'user_last_name: %%user_last_name%%'."\n";
|
682 |
+
$msg .= 'user_full_name: %%user_full_name%%'."\n";
|
683 |
+
$msg .= 'user_email: %%user_email%%'."\n";
|
684 |
+
$msg .= 'user_login: %%user_login%%'."\n";
|
685 |
+
$msg .= 'user_ip: %%user_ip%%'."\n";
|
686 |
+
$msg .= 'user_id: %%user_id%%'."\n";
|
687 |
+
|
688 |
+
if(is_array($fields) && !empty($fields))
|
689 |
+
foreach($fields as $var => $val)
|
690 |
+
$msg .= $var.': %%'.$var.'%%'."\n";
|
691 |
+
|
692 |
+
$msg .= 'cv0: %%cv0%%'."\n";
|
693 |
+
$msg .= 'cv1: %%cv1%%'."\n";
|
694 |
+
$msg .= 'cv2: %%cv2%%'."\n";
|
695 |
+
$msg .= 'cv3: %%cv3%%'."\n";
|
696 |
+
$msg .= 'cv4: %%cv4%%'."\n";
|
697 |
+
$msg .= 'cv5: %%cv5%%'."\n";
|
698 |
+
$msg .= 'cv6: %%cv6%%'."\n";
|
699 |
+
$msg .= 'cv7: %%cv7%%'."\n";
|
700 |
+
$msg .= 'cv8: %%cv8%%'."\n";
|
701 |
+
$msg .= 'cv9: %%cv9%%';
|
702 |
+
|
703 |
+
if(($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg)))
|
704 |
+
if(($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg)))
|
705 |
+
if(($msg = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $msg)) && ($msg = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $msg)))
|
706 |
+
if(($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $msg)))
|
707 |
+
if(($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg)))
|
708 |
+
if(($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'].' '.$paypal['last_name'])), $msg)))
|
709 |
+
if(($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)))
|
710 |
+
|
711 |
+
if(($msg = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $msg)) && ($msg = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $msg)))
|
712 |
+
|
713 |
+
if(($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)))
|
714 |
+
if(($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $msg)))
|
715 |
+
if(($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)))
|
716 |
+
if(($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)))
|
717 |
+
if(($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)))
|
718 |
+
if(($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)))
|
719 |
+
{
|
720 |
+
if(is_array($fields) && !empty($fields))
|
721 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
722 |
+
if(!($msg = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg)))
|
723 |
+
break;
|
724 |
+
|
725 |
+
if($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
726 |
+
|
727 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_recipients']) as $recipient)
|
728 |
+
wp_mail($recipient, apply_filters('ws_plugin__s2member_payment_notification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_payment_notification_email_msg', $msg, get_defined_vars()), 'Content-Type: text/plain; charset=UTF-8');
|
729 |
+
}
|
730 |
+
$paypal['s2member_log'][] = 'Payment Notification Emails have been processed.';
|
731 |
+
}
|
732 |
+
}
|
733 |
+
else if($processing // Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`.
|
734 |
+
&& (preg_match('/^web_accept$/i', $paypal['txn_type']) || ($_REQUEST['s2member_paypal_proxy'] && preg_match('/subscr-signup-as-subscr-payment/', $_REQUEST['s2member_paypal_proxy_use']) && $paypal['txn_id'] && $paypal['mc_gross'] > 0))
|
735 |
+
)
|
736 |
+
{
|
737 |
+
$paypal['s2member_log'][] = 'Storing `payment` for Subscription via ( `'.((preg_match('/^web_accept$/i', $paypal['txn_type'])) ? 'web_accept' : 'subscr-signup-as-subscr-payment').'` ).';
|
738 |
+
|
739 |
+
$ipn = array('txn_type' => 'subscr_payment'); // Create a simulated IPN response for txn_type=subscr_payment.
|
740 |
+
|
741 |
+
foreach($paypal as $var => $val)
|
742 |
+
if(in_array($var, array('subscr_gateway', 'subscr_id', 'subscr_baid', 'subscr_cid', 'txn_id', 'custom', 'invoice', 'mc_gross', 'mc_currency', 'tax', 'payer_email', 'first_name', 'last_name', 'item_name', 'item_number', 'option_name1', 'option_selection1', 'option_name2', 'option_selection2')))
|
743 |
+
$ipn[$var] = $val;
|
744 |
+
|
745 |
+
$paypal['s2member_log'][] = 'Creating an IPN response for `subscr_payment`. This will go into a Transient Queue; and be processed during registration.';
|
746 |
+
|
747 |
+
set_transient('s2m_'.md5('s2member_transient_ipn_subscr_payment_'.$paypal['subscr_id']), $ipn, 43200);
|
748 |
+
}
|
749 |
+
if($processing // Store signup vars now? If the User already exists in the database, we can go ahead and store these right now.
|
750 |
+
&& ((!empty($user_id) && !empty($user) && is_object($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User ($user_id)) && $user->ID))
|
751 |
+
)
|
752 |
+
{
|
753 |
+
$paypal['s2member_log'][] = 'Storing IPN signup vars now. These are associated with a User\'s account record; for future reference.';
|
754 |
+
|
755 |
+
update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
|
756 |
+
}
|
757 |
+
else if($processing) // Otherwise, we can store these into a Transient Queue for registration processing.
|
758 |
+
{
|
759 |
+
$paypal['s2member_log'][] = 'Storing IPN signup vars into a Transient Queue. These will be processed on registration.';
|
760 |
+
|
761 |
+
set_transient('s2m_'.md5('s2member_transient_ipn_signup_vars_'.$paypal['subscr_id']), $ipn_signup_vars, 43200);
|
762 |
}
|
763 |
+
}
|
764 |
+
else // Else, this is a duplicate IPN. Must stop here.
|
765 |
+
{
|
766 |
+
$paypal['s2member_log'][] = 'Not processing. Duplicate IPN.';
|
767 |
+
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ).';
|
768 |
+
$paypal['s2member_log'][] = 'Duplicate IPN. Already processed. This IPN will be ignored.';
|
769 |
+
}
|
770 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
771 |
+
do_action('ws_plugin__s2member_during_paypal_notify_after_subscr_signup', get_defined_vars());
|
772 |
+
unset($__refs, $__v);
|
773 |
+
|
774 |
+
return apply_filters('c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level', $paypal, get_defined_vars());
|
775 |
}
|
776 |
+
return apply_filters('c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level', FALSE, get_defined_vars());
|
777 |
+
}
|
778 |
}
|
779 |
+
}
|
includes/classes/paypal-notify-in-virtual-terminal.inc.php
CHANGED
@@ -64,16 +64,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal"))
|
|
64 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `virtual_terminal` ).";
|
65 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
66 |
}
|
67 |
-
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
do_action("ws_plugin__s2member_during_paypal_notify_after_virtual_terminal", get_defined_vars ());
|
70 |
unset($__refs, $__v);
|
71 |
|
72 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
-
else
|
75 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal", false, get_defined_vars ());
|
76 |
}
|
77 |
}
|
78 |
-
}
|
79 |
-
?>
|
64 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `virtual_terminal` ).";
|
65 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
66 |
}
|
|
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
do_action("ws_plugin__s2member_during_paypal_notify_after_virtual_terminal", get_defined_vars ());
|
69 |
unset($__refs, $__v);
|
70 |
|
71 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal", false, get_defined_vars ());
|
|
|
74 |
}
|
75 |
}
|
76 |
+
}
|
|
includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -45,7 +43,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
45 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))
|
47 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
-
&& (!empty($paypal["txn_id"])
|
|
|
|
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars ());
|
@@ -100,130 +100,135 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
100 |
$msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_message"]; // The same for standard and w/ Pro Forms.
|
101 |
$rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_recipients"]; // The same for standard and w/ Pro Forms.
|
102 |
|
103 |
-
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
104 |
-
if (($rec = preg_replace ("/%%
|
105 |
-
if (($rec = preg_replace ("/%%
|
106 |
-
if (($rec = preg_replace ("/%%
|
107 |
-
if (($rec = preg_replace ("/%%
|
108 |
-
if (($rec = preg_replace ("/%%
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
if (($rec = preg_replace ("/%%
|
114 |
-
if (($rec = preg_replace ("/%%
|
115 |
-
if (($rec = preg_replace ("/%%
|
116 |
-
if (($rec = preg_replace ("/%%
|
117 |
-
if (($rec = preg_replace ("/%%
|
118 |
-
|
119 |
-
|
120 |
-
if (($sbj = preg_replace ("/%%
|
121 |
-
if (($sbj = preg_replace ("/%%
|
122 |
-
if (($sbj = preg_replace ("/%%
|
123 |
-
if (($sbj = preg_replace ("/%%
|
124 |
-
if (($sbj = preg_replace ("/%%
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
if (($sbj = preg_replace ("/%%
|
131 |
-
if (($sbj = preg_replace ("/%%
|
132 |
-
if (($sbj = preg_replace ("/%%
|
133 |
-
if (($sbj = preg_replace ("/%%
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
if (($msg = preg_replace ("/%%
|
138 |
-
if (($msg = preg_replace ("/%%
|
139 |
-
if (($msg = preg_replace ("/%%
|
140 |
-
if (($msg = preg_replace ("/%%
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
if (($msg = preg_replace ("/%%
|
148 |
-
if (($msg = preg_replace ("/%%
|
149 |
-
if (($msg = preg_replace ("/%%
|
150 |
-
|
151 |
-
if (
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
164 |
-
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
165 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_capabilities_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_capabilities_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
166 |
-
|
167 |
-
$paypal["s2member_log"][] = "Capability Confirmation Email sent to: " . $rec . ".";
|
168 |
-
}
|
169 |
-
}
|
170 |
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
171 |
{
|
172 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%
|
173 |
-
if (($url = preg_replace ("/%%
|
174 |
-
if (($url = preg_replace ("/%%
|
175 |
-
if (($url = preg_replace ("/%%
|
176 |
-
if (($url = preg_replace ("/%%
|
177 |
-
if (($url = preg_replace ("/%%
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
if (($url = preg_replace ("/%%
|
183 |
-
if (($url = preg_replace ("/%%
|
184 |
-
if (($url = preg_replace ("/%%
|
185 |
-
if (($url = preg_replace ("/%%
|
186 |
-
if (($url = preg_replace ("/%%
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
197 |
$paypal["s2member_log"][] = "Capability Return, a Proxy Return URL is ready.";
|
198 |
}
|
199 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
200 |
{
|
201 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
202 |
|
203 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%
|
204 |
-
if (($url = preg_replace ("/%%
|
205 |
-
if (($url = preg_replace ("/%%
|
206 |
-
if (($url = preg_replace ("/%%
|
207 |
-
if (($url = preg_replace ("/%%
|
208 |
-
if (($url = preg_replace ("/%%
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
if (($url = preg_replace ("/%%
|
214 |
-
if (($url = preg_replace ("/%%
|
215 |
-
if (($url = preg_replace ("/%%
|
216 |
-
if (($url = preg_replace ("/%%
|
217 |
-
if (($url = preg_replace ("/%%
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
228 |
}
|
229 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
@@ -231,9 +236,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
231 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
232 |
$msg .= "\n\n"; // Spacing in the message body.
|
233 |
|
234 |
-
$msg .= "subscr_id: %%subscr_id%%\n";
|
235 |
$msg .= "amount: %%amount%%\n";
|
236 |
$msg .= "txn_id: %%txn_id%%\n";
|
|
|
|
|
237 |
$msg .= "item_number: %%item_number%%\n";
|
238 |
$msg .= "item_name: %%item_name%%\n";
|
239 |
$msg .= "first_name: %%first_name%%\n";
|
@@ -268,76 +274,75 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
268 |
$msg .= "cv8: %%cv8%%\n";
|
269 |
$msg .= "cv9: %%cv9%%";
|
270 |
|
271 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
272 |
-
if (($msg = preg_replace ("/%%
|
273 |
-
if (($msg = preg_replace ("/%%
|
274 |
-
if (($msg = preg_replace ("/%%
|
275 |
-
if (($msg = preg_replace ("/%%
|
276 |
-
if (($msg = preg_replace ("/%%
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
if (($msg = preg_replace ("/%%
|
282 |
-
if (($msg = preg_replace ("/%%
|
283 |
-
if (($msg = preg_replace ("/%%
|
284 |
-
if (($msg = preg_replace ("/%%
|
285 |
-
if (($msg = preg_replace ("/%%
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
|
|
297 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
298 |
}
|
299 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
300 |
{
|
301 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
302 |
-
if (($code = preg_replace ("/%%
|
303 |
-
if (($code = preg_replace ("/%%
|
304 |
-
if (($code = preg_replace ("/%%
|
305 |
-
if (($code = preg_replace ("/%%
|
306 |
-
if (($code = preg_replace ("/%%
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
if (($code = preg_replace ("/%%
|
312 |
-
if (($code = preg_replace ("/%%
|
313 |
-
if (($code = preg_replace ("/%%
|
314 |
-
if (($code = preg_replace ("/%%
|
315 |
-
if (($code = preg_replace ("/%%
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
|
|
328 |
}
|
329 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
330 |
do_action("ws_plugin__s2member_during_paypal_notify_during_new_ccaps", get_defined_vars ());
|
331 |
unset($__refs, $__v);
|
332 |
}
|
333 |
-
else
|
334 |
-
$paypal["s2member_log"][] = "Unable to add new Capabilities. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
335 |
}
|
336 |
-
else
|
337 |
-
$paypal["s2member_log"][] = "Unable to add new Capabilities. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
|
338 |
}
|
339 |
-
else
|
340 |
-
$paypal["s2member_log"][] = "Unable to add new Capabilities. Missing User/Member details. Please check the `on0` and `os0` variables in your Button Code.";
|
341 |
}
|
342 |
else // Else, this is a duplicate IPN. Must stop here.
|
343 |
{
|
@@ -354,5 +359,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
354 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level", false, get_defined_vars ());
|
355 |
}
|
356 |
}
|
357 |
-
}
|
358 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
43 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))
|
45 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
46 |
+
&& (!empty($paypal["txn_id"])) && (!empty($paypal["payer_email"]))
|
47 |
+
&& (!empty($paypal["txn_baid"]) || ($paypal["txn_baid"] = $paypal["txn_id"]))
|
48 |
+
&& (!empty($paypal["txn_cid"]) || ($paypal["txn_cid"] = $paypal["txn_id"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars ());
|
100 |
$msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_message"]; // The same for standard and w/ Pro Forms.
|
101 |
$rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_recipients"]; // The same for standard and w/ Pro Forms.
|
102 |
|
103 |
+
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $rec)) && ($rec = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $rec)))
|
104 |
+
if (($rec = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $rec)) && ($rec = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $rec)))
|
105 |
+
if (($rec = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $rec)) && ($rec = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $rec)))
|
106 |
+
if (($rec = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $rec)) && ($rec = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $rec)))
|
107 |
+
if (($rec = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"])), $rec)) && ($rec = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"])), $rec)))
|
108 |
+
if (($rec = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $rec))) // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
|
109 |
+
if (($rec = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $rec)))
|
110 |
+
|
111 |
+
if (($rec = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $rec)) && ($rec = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $rec)) && ($rec = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $rec)))
|
112 |
+
|
113 |
+
if (($rec = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $rec)) && ($rec = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $rec)))
|
114 |
+
if (($rec = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $rec)))
|
115 |
+
if (($rec = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $rec)))
|
116 |
+
if (($rec = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $rec)))
|
117 |
+
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $rec)))
|
118 |
+
if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $rec)))
|
119 |
+
|
120 |
+
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $sbj)))
|
121 |
+
if (($sbj = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $sbj)) && ($sbj = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $sbj)))
|
122 |
+
if (($sbj = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $sbj)))
|
123 |
+
if (($sbj = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $sbj)))
|
124 |
+
if (($sbj = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $sbj)))
|
125 |
+
if (($sbj = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)))
|
126 |
+
if (($sbj = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $sbj)))
|
127 |
+
|
128 |
+
if (($sbj = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $sbj)) && ($sbj = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $sbj)) && ($sbj = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $sbj)))
|
129 |
+
|
130 |
+
if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $sbj)) && ($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $sbj)))
|
131 |
+
if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $sbj)))
|
132 |
+
if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $sbj)))
|
133 |
+
if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $sbj)))
|
134 |
+
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $sbj)))
|
135 |
+
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $sbj)))
|
136 |
+
|
137 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
138 |
+
if (($msg = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $msg)) && ($msg = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $msg)))
|
139 |
+
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
140 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
141 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
142 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
143 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
144 |
+
|
145 |
+
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $msg)))
|
146 |
+
|
147 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
148 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
149 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
150 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
151 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
152 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
153 |
+
{
|
154 |
+
if (is_array($fields) && !empty($fields)) foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
155 |
+
{
|
156 |
+
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $rec);
|
157 |
+
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $sbj);
|
158 |
+
$msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg);
|
159 |
+
}
|
160 |
+
if (($rec = trim (preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
161 |
+
{
|
162 |
+
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
|
163 |
+
{
|
164 |
+
$sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
|
165 |
+
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
166 |
+
}
|
167 |
+
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
168 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_capabilities_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_capabilities_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
169 |
+
|
170 |
+
$paypal["s2member_log"][] = "Capability Confirmation Email sent to: " . $rec . ".";
|
171 |
+
}
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
174 |
{
|
175 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
176 |
+
if (($url = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_baid"])), $url)) && ($url = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_cid"])), $url)))
|
177 |
+
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
178 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
179 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
180 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
181 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
182 |
+
|
183 |
+
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["affiliate_id"])), $url)))
|
184 |
+
|
185 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->last_name)), $url)))
|
186 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
187 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_email)), $url)))
|
188 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_login)), $url)))
|
189 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_reg_ip)), $url)))
|
190 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
191 |
+
{
|
192 |
+
if (is_array($fields) && !empty($fields))
|
193 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
194 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
195 |
+
break;
|
196 |
+
|
197 |
+
if (($url = trim ($url))) // Preserve remaining replacements.
|
198 |
+
// Because the parent routine may perform replacements too.
|
199 |
+
$paypal["s2member_paypal_proxy_return_url"] = $url;
|
200 |
+
}
|
201 |
$paypal["s2member_log"][] = "Capability Return, a Proxy Return URL is ready.";
|
202 |
}
|
203 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
204 |
{
|
205 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
206 |
|
207 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
208 |
+
if (($url = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_baid"])), $url)) && ($url = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_cid"])), $url)))
|
209 |
+
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
210 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
211 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
212 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
213 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
214 |
+
|
215 |
+
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["affiliate_id"])), $url)))
|
216 |
+
|
217 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->last_name)), $url)))
|
218 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
219 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_email)), $url)))
|
220 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user->user_login)), $url)))
|
221 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_reg_ip)), $url)))
|
222 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
223 |
+
{
|
224 |
+
if (is_array($fields) && !empty($fields))
|
225 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
226 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
227 |
+
break;
|
228 |
|
229 |
+
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
230 |
+
c_ws_plugin__s2member_utils_urls::remote ($url);
|
231 |
+
}
|
232 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
233 |
}
|
234 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
236 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
237 |
$msg .= "\n\n"; // Spacing in the message body.
|
238 |
|
|
|
239 |
$msg .= "amount: %%amount%%\n";
|
240 |
$msg .= "txn_id: %%txn_id%%\n";
|
241 |
+
$msg .= "txn_baid: %%txn_baid%%\n";
|
242 |
+
$msg .= "txn_cid: %%txn_cid%%\n";
|
243 |
$msg .= "item_number: %%item_number%%\n";
|
244 |
$msg .= "item_name: %%item_name%%\n";
|
245 |
$msg .= "first_name: %%first_name%%\n";
|
274 |
$msg .= "cv8: %%cv8%%\n";
|
275 |
$msg .= "cv9: %%cv9%%";
|
276 |
|
277 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
278 |
+
if (($msg = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $msg)) && ($msg = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $msg)))
|
279 |
+
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
280 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
281 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
282 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
283 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
284 |
+
|
285 |
+
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $msg)))
|
286 |
+
|
287 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $msg)))
|
288 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
289 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $msg)))
|
290 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $msg)))
|
291 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $msg)))
|
292 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
293 |
+
{
|
294 |
+
if (is_array($fields) && !empty($fields))
|
295 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
296 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
297 |
+
break;
|
298 |
+
|
299 |
+
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
300 |
+
|
301 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
302 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
303 |
+
}
|
304 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
305 |
}
|
306 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
307 |
{
|
308 |
+
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $code)))
|
309 |
+
if (($code = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $code)) && ($code = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $code)))
|
310 |
+
if (($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $code)))
|
311 |
+
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $code)))
|
312 |
+
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $code)))
|
313 |
+
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
314 |
+
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $code)))
|
315 |
+
|
316 |
+
if (($code = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $code)))
|
317 |
+
|
318 |
+
if (($code = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $code)) && ($code = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $code)))
|
319 |
+
if (($code = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $code)))
|
320 |
+
if (($code = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $code)))
|
321 |
+
if (($code = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $code)))
|
322 |
+
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $code)))
|
323 |
+
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $code)))
|
324 |
+
{
|
325 |
+
if (is_array($fields) && !empty($fields))
|
326 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
327 |
+
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $code)))
|
328 |
+
break;
|
329 |
+
|
330 |
+
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code)))) // This gets stored into a Transient Queue.
|
331 |
+
{
|
332 |
+
$paypal["s2member_log"][] = "Storing Payment Tracking Codes into a Transient Queue. These will be processed on-site.";
|
333 |
+
set_transient ("s2m_" . md5 ("s2member_transient_ccap_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
|
334 |
+
}
|
335 |
+
}
|
336 |
}
|
337 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
338 |
do_action("ws_plugin__s2member_during_paypal_notify_during_new_ccaps", get_defined_vars ());
|
339 |
unset($__refs, $__v);
|
340 |
}
|
341 |
+
else $paypal["s2member_log"][] = "Unable to add new Capabilities. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
|
|
342 |
}
|
343 |
+
else $paypal["s2member_log"][] = "Unable to add new Capabilities. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
|
|
|
344 |
}
|
345 |
+
else $paypal["s2member_log"][] = "Unable to add new Capabilities. Missing User/Member details. Please check the `on0` and `os0` variables in your Button Code.";
|
|
|
346 |
}
|
347 |
else // Else, this is a duplicate IPN. Must stop here.
|
348 |
{
|
359 |
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level", false, get_defined_vars ());
|
360 |
}
|
361 |
}
|
362 |
+
}
|
|
includes/classes/paypal-notify-in-web-accept-sp.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
@@ -45,7 +43,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
45 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
47 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
-
&& (!empty($paypal["payer_email"])) && (!empty($paypal["txn_id"])))
|
|
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
|
@@ -74,76 +73,77 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
74 |
|
75 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale associated with User ID: " . $user_id . ".";
|
76 |
}
|
77 |
-
|
78 |
-
$sbj = preg_replace ("/%%
|
79 |
-
|
80 |
-
|
81 |
-
$msg = preg_replace ("/%%
|
82 |
-
|
83 |
-
|
84 |
-
$rec = preg_replace ("/%%
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
127 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
128 |
{
|
129 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"]) as $url)
|
130 |
|
131 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::
|
132 |
-
if (($url = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::
|
133 |
-
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::
|
134 |
-
if (($url = preg_replace ("/%%
|
135 |
-
if (($url = preg_replace ("/%%
|
136 |
-
if (($url = preg_replace ("/%%
|
137 |
-
if (($url = preg_replace ("/%%
|
138 |
-
if (($url = preg_replace ("/%%
|
139 |
-
if (($url = preg_replace ("/%%
|
|
|
140 |
|
141 |
-
|
142 |
-
|
143 |
|
144 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification URLs have been processed.";
|
145 |
}
|
146 |
-
|
147 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
148 |
{
|
149 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Sale";
|
@@ -154,6 +154,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
154 |
|
155 |
$msg .= "amount: %%amount%%\n";
|
156 |
$msg .= "txn_id: %%txn_id%%\n";
|
|
|
|
|
157 |
$msg .= "item_number: %%item_number%%\n";
|
158 |
$msg .= "item_name: %%item_name%%\n";
|
159 |
$msg .= "first_name: %%first_name%%\n";
|
@@ -177,65 +179,65 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
177 |
$msg .= "cv8: %%cv8%%\n";
|
178 |
$msg .= "cv9: %%cv9%%";
|
179 |
|
180 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
181 |
-
if (($msg = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::
|
182 |
-
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::
|
183 |
-
if (($msg = preg_replace ("/%%
|
184 |
-
if (($msg = preg_replace ("/%%
|
185 |
-
if (($msg = preg_replace ("/%%
|
186 |
-
if (($msg = preg_replace ("/%%
|
187 |
-
if (($msg = preg_replace ("/%%
|
188 |
-
if (($msg = preg_replace ("/%%
|
|
|
189 |
|
190 |
-
|
191 |
|
192 |
-
|
193 |
-
|
194 |
|
195 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification Emails have been processed.";
|
196 |
}
|
197 |
-
|
198 |
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
199 |
{
|
200 |
-
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::
|
201 |
-
if (($url = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::
|
202 |
-
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::
|
203 |
-
if (($url = preg_replace ("/%%
|
204 |
-
if (($url = preg_replace ("/%%
|
205 |
-
if (($url = preg_replace ("/%%
|
206 |
-
if (($url = preg_replace ("/%%
|
207 |
-
if (($url = preg_replace ("/%%
|
208 |
-
if (($url = preg_replace ("/%%
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
213 |
|
214 |
$paypal["s2member_log"][] = "Specific Post/Page Return, a Proxy Return URL is ready.";
|
215 |
}
|
216 |
-
|
217 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
218 |
{
|
219 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
220 |
-
if (($code = preg_replace ("/%%
|
221 |
-
if (($code = preg_replace ("/%%
|
222 |
-
if (($code = preg_replace ("/%%
|
223 |
-
if (($code = preg_replace ("/%%
|
224 |
-
if (($code = preg_replace ("/%%
|
225 |
-
if (($code = preg_replace ("/%%
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
232 |
}
|
233 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
234 |
do_action("ws_plugin__s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
|
235 |
unset($__refs, $__v);
|
236 |
}
|
237 |
-
else
|
238 |
-
$paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
|
239 |
}
|
240 |
else // Else, this is a duplicate IPN. Must stop here.
|
241 |
{
|
@@ -243,16 +245,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
243 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.";
|
244 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
245 |
}
|
246 |
-
|
247 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
248 |
do_action("ws_plugin__s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
|
249 |
unset($__refs, $__v);
|
250 |
|
251 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", $paypal, get_defined_vars ());
|
252 |
}
|
253 |
-
else
|
254 |
-
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", false, get_defined_vars ());
|
255 |
}
|
256 |
}
|
257 |
-
}
|
258 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
43 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
45 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
46 |
+
&& (!empty($paypal["payer_email"])) && (!empty($paypal["txn_id"])) && (!empty($paypal["txn_baid"]) || ($paypal["txn_baid"] = $paypal["txn_id"]))
|
47 |
+
&& (!empty($paypal["txn_cid"]) || ($paypal["txn_cid"] = $paypal["txn_id"])))
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
|
73 |
|
74 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale associated with User ID: " . $user_id . ".";
|
75 |
}
|
76 |
+
$sbj = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_REQUEST["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_subject"]);
|
77 |
+
$sbj = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $sbj);
|
78 |
+
|
79 |
+
$msg = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_REQUEST["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_message"]);
|
80 |
+
$msg = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $msg);
|
81 |
+
|
82 |
+
$rec = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_REQUEST["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_REQUEST["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_recipients"]);
|
83 |
+
$rec = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $rec);
|
84 |
+
|
85 |
+
if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $rec)) && ($rec = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $rec)))
|
86 |
+
if (($rec = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $rec))) // Full amount of the payment, before fee is subtracted.
|
87 |
+
if (($rec = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $rec)) && ($rec = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $rec)))
|
88 |
+
if (($rec = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $rec)) && ($rec = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $rec)))
|
89 |
+
if (($rec = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"])), $rec)) && ($rec = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"])), $rec)))
|
90 |
+
if (($rec = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $rec))) // **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
|
91 |
+
if (($rec = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $rec)))
|
92 |
+
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $rec)))
|
93 |
+
if (($rec = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $rec)) && ($rec = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $rec)) && ($rec = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $rec)))
|
94 |
+
|
95 |
+
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $sbj)))
|
96 |
+
if (($sbj = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $sbj))) // Full amount of the payment, before fee is subtracted.
|
97 |
+
if (($sbj = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $sbj)) && ($sbj = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $sbj)))
|
98 |
+
if (($sbj = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $sbj)))
|
99 |
+
if (($sbj = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $sbj)))
|
100 |
+
if (($sbj = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)))
|
101 |
+
if (($sbj = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $sbj)))
|
102 |
+
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $sbj)))
|
103 |
+
if (($sbj = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $sbj)) && ($sbj = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $sbj)) && ($sbj = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $sbj)))
|
104 |
+
|
105 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
106 |
+
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $msg))) // Full amount of the payment, before fee is subtracted.
|
107 |
+
if (($msg = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $msg)) && ($msg = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $msg)))
|
108 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
109 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
110 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
111 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
112 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $msg)))
|
113 |
+
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $msg)))
|
114 |
+
|
115 |
+
if (($rec = trim (preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
116 |
+
{
|
117 |
+
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
|
118 |
+
{
|
119 |
+
$sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
|
120 |
+
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
121 |
+
}
|
122 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient) // Go through a possible list of recipients.
|
123 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_sp_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_sp_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
124 |
+
|
125 |
+
$paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to: " . $rec . ".";
|
126 |
+
}
|
127 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
128 |
{
|
129 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"]) as $url)
|
130 |
|
131 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (rawurlencode ($sp_access_url)), $url)))
|
132 |
+
if (($url = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")))), $url)))
|
133 |
+
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
134 |
+
if (($url = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_baid"])), $url)) && ($url = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_cid"])), $url)))
|
135 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
136 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
137 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
138 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
139 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["ip"])), $url)))
|
140 |
+
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["affiliate_id"])), $url)))
|
141 |
|
142 |
+
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
143 |
+
c_ws_plugin__s2member_utils_urls::remote ($url);
|
144 |
|
145 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification URLs have been processed.";
|
146 |
}
|
|
|
147 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
148 |
{
|
149 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Sale";
|
154 |
|
155 |
$msg .= "amount: %%amount%%\n";
|
156 |
$msg .= "txn_id: %%txn_id%%\n";
|
157 |
+
$msg .= "txn_baid: %%txn_baid%%\n";
|
158 |
+
$msg .= "txn_cid: %%txn_cid%%\n";
|
159 |
$msg .= "item_number: %%item_number%%\n";
|
160 |
$msg .= "item_name: %%item_name%%\n";
|
161 |
$msg .= "first_name: %%first_name%%\n";
|
179 |
$msg .= "cv8: %%cv8%%\n";
|
180 |
$msg .= "cv9: %%cv9%%";
|
181 |
|
182 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($sp_access_url), $msg)))
|
183 |
+
if (($msg = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $msg)))
|
184 |
+
if (($msg = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $msg)))
|
185 |
+
if (($msg = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $msg)) && ($msg = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $msg)))
|
186 |
+
if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $msg)))
|
187 |
+
if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $msg)))
|
188 |
+
if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
|
189 |
+
if (($msg = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $msg)))
|
190 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $msg)))
|
191 |
+
if (($msg = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $msg)) && ($msg = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $msg)))
|
192 |
|
193 |
+
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
194 |
|
195 |
+
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"]) as $recipient)
|
196 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_sp_sale_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_sp_sale_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
197 |
|
198 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification Emails have been processed.";
|
199 |
}
|
|
|
200 |
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
201 |
{
|
202 |
+
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (rawurlencode ($sp_access_url)), $url)))
|
203 |
+
if (($url = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")))), $url)))
|
204 |
+
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_id"])), $url)))
|
205 |
+
if (($url = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_baid"])), $url)) && ($url = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["txn_cid"])), $url)))
|
206 |
+
if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["item_name"])), $url)))
|
207 |
+
if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["last_name"])), $url)))
|
208 |
+
if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
|
209 |
+
if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["payer_email"])), $url)))
|
210 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($paypal["ip"])), $url)))
|
211 |
+
if (($url = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode($coupon["affiliate_id"])), $url)))
|
212 |
+
|
213 |
+
if (($url = trim ($url))) // Preserve Remaining replacements.
|
214 |
+
// Because the parent routine may perform replacements too.
|
215 |
+
$paypal["s2member_paypal_proxy_return_url"] = $url;
|
216 |
|
217 |
$paypal["s2member_log"][] = "Specific Post/Page Return, a Proxy Return URL is ready.";
|
218 |
}
|
|
|
219 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
220 |
{
|
221 |
+
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $code)))
|
222 |
+
if (($code = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $code)) && ($code = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $code)))
|
223 |
+
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $code)))
|
224 |
+
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $code)))
|
225 |
+
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
226 |
+
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $code)))
|
227 |
+
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $code)))
|
228 |
+
if (($code = preg_replace ("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["full_coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["coupon_code"]), $code)) && ($code = preg_replace ("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($coupon["affiliate_id"]), $code)))
|
229 |
+
|
230 |
+
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code)))) // This gets stored into a Transient Queue.
|
231 |
+
{
|
232 |
+
$paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue. These will be processed on-site.";
|
233 |
+
set_transient ("s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
|
234 |
+
}
|
235 |
}
|
236 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
237 |
do_action("ws_plugin__s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
|
238 |
unset($__refs, $__v);
|
239 |
}
|
240 |
+
else $paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
|
|
|
241 |
}
|
242 |
else // Else, this is a duplicate IPN. Must stop here.
|
243 |
{
|
245 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.";
|
246 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
247 |
}
|
|
|
248 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
249 |
do_action("ws_plugin__s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
|
250 |
unset($__refs, $__v);
|
251 |
|
252 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", $paypal, get_defined_vars ());
|
253 |
}
|
254 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", false, get_defined_vars ());
|
|
|
255 |
}
|
256 |
}
|
257 |
+
}
|
|
includes/classes/paypal-notify-in.inc.php
CHANGED
@@ -1,230 +1,224 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's PayPal IPN handler (inner processing routines).
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\PayPal
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
{
|
52 |
-
|
53 |
|
54 |
-
|
|
|
|
|
|
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
@ignore_user_abort (true); // Important. Continue processing even if/when the connection is broken by the sending party.
|
59 |
|
60 |
-
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
${esc_html(trim(stripslashes($_REQUEST["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
$paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
|
72 |
-
$paypal["s2member_log"][] = "s2Member POST vars verified " . ((!empty($paypal["proxy_verified"])) ? "with a Proxy Key" : "through a POST back to PayPal.");
|
73 |
|
74 |
-
|
|
|
75 |
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
sleep(5); // Wait for Pro Form procesing to complete.
|
84 |
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level::cp (get_defined_vars ())))
|
116 |
-
$paypal = $_paypal_cp;
|
117 |
-
|
118 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level::cp (get_defined_vars ())))
|
119 |
-
$paypal = $_paypal_cp;
|
120 |
-
|
121 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level::cp (get_defined_vars ())))
|
122 |
-
$paypal = $_paypal_cp;
|
123 |
-
|
124 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level::cp (get_defined_vars ())))
|
125 |
-
$paypal = $_paypal_cp;
|
126 |
-
|
127 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level::cp (get_defined_vars ())))
|
128 |
-
$paypal = $_paypal_cp;
|
129 |
-
|
130 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level::cp (get_defined_vars ())))
|
131 |
-
$paypal = $_paypal_cp;
|
132 |
-
|
133 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancellation_w_level::cp (get_defined_vars ())))
|
134 |
-
$paypal = $_paypal_cp;
|
135 |
-
|
136 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_level::cp (get_defined_vars ())))
|
137 |
-
$paypal = $_paypal_cp;
|
138 |
-
|
139 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal::cp (get_defined_vars ())))
|
140 |
-
$paypal = $_paypal_cp;
|
141 |
-
|
142 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup::cp (get_defined_vars ())))
|
143 |
-
$paypal = $_paypal_cp;
|
144 |
-
|
145 |
-
else if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_merch_pmt::cp (get_defined_vars ())))
|
146 |
-
$paypal = $_paypal_cp;
|
147 |
-
|
148 |
-
else // Ignoring this IPN request. The txn_type/status does NOT require any action.
|
149 |
-
$paypal["s2member_log"][] = "Ignoring this IPN request. The `txn_type/status` does NOT require any action on the part of s2Member.";
|
150 |
-
}
|
151 |
-
else // Else a custom conditional has been applied by Filters.
|
152 |
-
unset($__refs, $__v);
|
153 |
-
}
|
154 |
-
|
155 |
-
else if (!empty($paypal["txn_type"]) && preg_match("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]))
|
156 |
-
{
|
157 |
-
$paypal["s2member_log"][] = "Transaction type ( `recurring_payment_profile_cancel` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
|
158 |
-
$paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
|
159 |
-
}
|
160 |
-
|
161 |
-
else if (!empty($paypal["txn_type"]) && preg_match("/^recurring_/i", $paypal["txn_type"])) // Otherwise, is this a ^recurring_ txn_type?
|
162 |
-
$paypal["s2member_log"][] = "Transaction type ( `^recurring_?` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
|
163 |
-
|
164 |
-
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
165 |
-
$paypal["s2member_log"][] = "Unable to verify `\$_SERVER[\"HTTP_HOST\"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.";
|
166 |
-
}
|
167 |
-
else // Extensive log reporting here. This is an area where many site owners find trouble. Depending on server configuration; remote HTTPS connections may fail.
|
168 |
-
{
|
169 |
-
$paypal["s2member_log"][] = "Unable to verify \$_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.";
|
170 |
-
$paypal["s2member_log"][] = "Please see this KB article: `http://www.s2member.com/kb/server-scanner/`. We suggest that you run the s2Member Server Scanner.";
|
171 |
-
$paypal["s2member_log"][] = var_export ($_REQUEST, true); // Recording _POST + _GET vars for analysis and debugging.
|
172 |
-
}
|
173 |
-
if ($email_configs_were_on) // Back on?
|
174 |
-
c_ws_plugin__s2member_email_configs::email_config ();
|
175 |
-
/*
|
176 |
-
Add IPN proxy (when available) to the ``$paypal`` array.
|
177 |
-
*/
|
178 |
-
if (!empty($_REQUEST["s2member_paypal_proxy"]))
|
179 |
-
$paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy"])));
|
180 |
-
/*
|
181 |
-
Add IPN proxy use vars (when available) to the ``$paypal`` array.
|
182 |
-
*/
|
183 |
-
if (!empty($_REQUEST["s2member_paypal_proxy_use"]))
|
184 |
-
$paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy_use"])));
|
185 |
-
/*
|
186 |
-
Add IPN proxy coupon vars (when available) to the ``$paypal`` array.
|
187 |
-
*/
|
188 |
-
if (!empty($_REQUEST["s2member_paypal_proxy_coupon"]))
|
189 |
-
$paypal["s2member_paypal_proxy_coupon"] = stripslashes_deep((array)$_REQUEST["s2member_paypal_proxy_coupon"]);
|
190 |
-
/*
|
191 |
-
Also add IPN proxy self-verification (when available) to the ``$paypal`` array.
|
192 |
-
*/
|
193 |
-
if (!empty($_REQUEST["s2member_paypal_proxy_verification"]))
|
194 |
-
$paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy_verification"])));
|
195 |
-
/*
|
196 |
-
If debugging/logging is enabled; we need to append ``$paypal`` to the log file.
|
197 |
-
Logging now supports Multisite Networking as well.
|
198 |
-
*/
|
199 |
-
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
200 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
201 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
202 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
203 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
204 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "gateway-core-ipn-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "gateway-core-ipn.log";
|
205 |
-
|
206 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
207 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
208 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
209 |
-
file_put_contents ($logs_dir . "/" . $log2,
|
210 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
211 |
-
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($paypal, true)) . "\n\n",
|
212 |
-
FILE_APPEND);
|
213 |
-
|
214 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
215 |
-
do_action("ws_plugin__s2member_during_paypal_notify", get_defined_vars ());
|
216 |
-
unset($__refs, $__v);
|
217 |
-
|
218 |
-
status_header (200); // Send a 200 OK status header.
|
219 |
-
header ("Content-Type: text/plain; charset=UTF-8"); // Content-Type text/plain with UTF-8.
|
220 |
-
while (@ob_end_clean ()); // Clean any existing output buffers.
|
221 |
-
|
222 |
-
exit (((!empty($paypal["s2member_paypal_proxy_return_url"])) ? $paypal["s2member_paypal_proxy_return_url"] : ""));
|
223 |
-
}
|
224 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
-
do_action("ws_plugin__s2member_after_paypal_notify", get_defined_vars ());
|
226 |
-
unset($__refs, $__v);
|
227 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's PayPal IPN handler (inner processing routines).
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\PayPal
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_paypal_notify_in'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member's PayPal IPN handler (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\PayPal
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_paypal_notify_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles PayPal IPN processing.
|
32 |
+
*
|
33 |
+
* These same routines also handle s2Member Pro/PayPal Pro operations;
|
34 |
+
* giving you the ability *(as needed)* to Hook into these routines using
|
35 |
+
* WordPress Hooks/Filters; as seen in the source code below.
|
36 |
+
*
|
37 |
+
* Please do NOT modify the source code directly.
|
38 |
+
* Instead, use WordPress Hooks/Filters.
|
39 |
+
*
|
40 |
+
* For example, if you'd like to add your own custom conditionals, use:
|
41 |
+
* ``add_filter ('ws_plugin__s2member_during_paypal_notify_conditionals', 'your_function');``
|
42 |
+
*
|
43 |
+
* @package s2Member\PayPal
|
44 |
+
* @since 3.5
|
45 |
+
*
|
46 |
+
* @attaches-to ``add_action('init');``
|
47 |
+
*/
|
48 |
+
public static function paypal_notify()
|
49 |
+
{
|
50 |
+
global $current_site, $current_blog;
|
51 |
+
|
52 |
+
do_action('ws_plugin__s2member_before_paypal_notify', get_defined_vars());
|
53 |
+
|
54 |
+
if(!empty($_GET['s2member_paypal_notify']) && ($GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_business'] || !empty($_REQUEST['s2member_paypal_proxy'])))
|
55 |
{
|
56 |
+
@ignore_user_abort(TRUE); // Important. Continue processing even if/when the connection is broken by the sending party.
|
57 |
+
|
58 |
+
include_once ABSPATH.'wp-admin/includes/admin.php'; // Get administrative functions. Needed for `wp_delete_user()`.
|
59 |
+
|
60 |
+
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status(); // Filters on?
|
61 |
+
c_ws_plugin__s2member_email_configs::email_config_release(); // Release s2Member Filters.
|
62 |
+
|
63 |
+
$paypal = array(); // Initialize PayPal array; we also reference this with a variable for a possible proxy handler.
|
64 |
+
if(!empty($_REQUEST['s2member_paypal_proxy']) && in_array($_REQUEST['s2member_paypal_proxy'], array('alipay', 'stripe', 'authnet', 'clickbank', 'ccbill', 'google'), TRUE))
|
65 |
+
${esc_html(trim(stripslashes($_REQUEST['s2member_paypal_proxy'])))} = & $paypal; // Internal alias by reference.
|
66 |
+
|
67 |
+
if(is_array($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars()) && ($_paypal = $paypal) && ($_paypal_s = serialize($_paypal)))
|
68 |
+
{
|
69 |
+
$paypal['s2member_log'][] = 'IPN received on: '.date('D M j, Y g:i:s a T');
|
70 |
+
$paypal['s2member_log'][] = 's2Member POST vars verified '.((!empty($paypal['proxy_verified'])) ? 'with a Proxy Key' : 'through a POST back to PayPal.');
|
71 |
+
|
72 |
+
$payment_status_issues = '/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i';
|
73 |
+
|
74 |
+
$paypal['subscr_gateway'] = (!empty($_REQUEST['s2member_paypal_proxy'])) ? esc_html(trim(stripslashes($_REQUEST['s2member_paypal_proxy']))) : 'paypal';
|
75 |
+
|
76 |
+
$coupon = (!empty($_REQUEST['s2member_paypal_proxy_coupon']) && is_array($_REQUEST['s2member_paypal_proxy_coupon'])) ? stripslashes_deep($_REQUEST['s2member_paypal_proxy_coupon']) : array();
|
77 |
+
$coupon = (isset($coupon['full_coupon_code'], $coupon['coupon_code'], $coupon['affiliate_id']) && is_string($coupon['full_coupon_code']) && is_string($coupon['coupon_code']) && is_string($coupon['affiliate_id'])) ? $coupon : array('full_coupon_code' => '', 'coupon_code' => '', 'affiliate_id' => '');
|
78 |
+
|
79 |
+
if(!empty($paypal['txn_type']) && $paypal['txn_type'] === 'merch_pmt')
|
80 |
+
// This is mostly irrelevant, but it helps to keep the logs cleaner.
|
81 |
+
sleep(5); // Wait for Pro Form procesing to complete.
|
82 |
+
|
83 |
+
if(empty($paypal['custom']) && !empty($paypal['recurring_payment_id'])) // Recurring Profile ID.
|
84 |
+
$paypal['custom'] = c_ws_plugin__s2member_utils_users::get_user_custom_with($paypal['recurring_payment_id']);
|
85 |
+
|
86 |
+
else if(empty($paypal['custom']) && !empty($paypal['mp_id'])) // Billing Agreement ID.
|
87 |
+
$paypal['custom'] = c_ws_plugin__s2member_utils_users::get_user_custom_with($paypal['mp_id']);
|
88 |
+
|
89 |
+
if(!empty($paypal['custom']) && preg_match('/^'.preg_quote(preg_replace('/\:([0-9]+)$/', '', $_SERVER['HTTP_HOST']), '/').'/i', $paypal['custom']))
|
90 |
{
|
91 |
+
$paypal['s2member_log'][] = 's2Member originating domain (`$_SERVER["HTTP_HOST"]`) validated.';
|
92 |
|
93 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
94 |
+
if(!apply_filters('ws_plugin__s2member_during_paypal_notify_conditionals', FALSE, get_defined_vars()))
|
95 |
+
{
|
96 |
+
unset($__refs, $__v); // From the filter above.
|
97 |
|
98 |
+
if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_virtual_terminal::cp(get_defined_vars())))
|
99 |
+
$paypal = $_paypal_cp;
|
|
|
100 |
|
101 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_express_checkout::cp(get_defined_vars())))
|
102 |
+
$paypal = $_paypal_cp;
|
103 |
|
104 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_cart::cp(get_defined_vars())))
|
105 |
+
$paypal = $_paypal_cp;
|
106 |
|
107 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_send_money::cp(get_defined_vars())))
|
108 |
+
$paypal = $_paypal_cp;
|
|
|
109 |
|
110 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_web_accept_sp::cp(get_defined_vars())))
|
111 |
+
$paypal = $_paypal_cp;
|
|
|
|
|
112 |
|
113 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level::cp(get_defined_vars())))
|
114 |
+
$paypal = $_paypal_cp;
|
115 |
|
116 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level::cp(get_defined_vars())))
|
117 |
+
$paypal = $_paypal_cp;
|
118 |
|
119 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level::cp(get_defined_vars())))
|
120 |
+
$paypal = $_paypal_cp;
|
121 |
|
122 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level::cp(get_defined_vars())))
|
123 |
+
$paypal = $_paypal_cp;
|
|
|
124 |
|
125 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level::cp(get_defined_vars())))
|
126 |
+
$paypal = $_paypal_cp;
|
127 |
|
128 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level::cp(get_defined_vars())))
|
129 |
+
$paypal = $_paypal_cp;
|
130 |
|
131 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancellation_w_level::cp(get_defined_vars())))
|
132 |
+
$paypal = $_paypal_cp;
|
133 |
+
|
134 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_level::cp(get_defined_vars())))
|
135 |
+
$paypal = $_paypal_cp;
|
136 |
+
|
137 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal::cp(get_defined_vars())))
|
138 |
+
$paypal = $_paypal_cp;
|
139 |
+
|
140 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup::cp(get_defined_vars())))
|
141 |
+
$paypal = $_paypal_cp;
|
142 |
+
|
143 |
+
else if(($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_merch_pmt::cp(get_defined_vars())))
|
144 |
+
$paypal = $_paypal_cp;
|
145 |
+
|
146 |
+
else // Ignoring this IPN request. The txn_type/status does NOT require any action.
|
147 |
+
$paypal['s2member_log'][] = 'Ignoring this IPN request. The `txn_type/status` does NOT require any action on the part of s2Member.';
|
148 |
+
}
|
149 |
+
else unset($__refs, $__v); // Else a custom conditional has been applied by Filters.
|
150 |
+
}
|
151 |
+
else if(!empty($paypal['txn_type']) && preg_match('/^recurring_payment_profile_cancel$/i', $paypal['txn_type']))
|
152 |
+
{
|
153 |
+
$paypal['s2member_log'][] = 'Transaction type (`recurring_payment_profile_cancel`), but there is no match to an existing account; so verification of `$_SERVER["HTTP_HOST"]` was not possible.';
|
154 |
+
$paypal['s2member_log'][] = 'It\'s likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
+
else if(!empty($paypal['txn_type']) && preg_match('/^recurring_/i', $paypal['txn_type'])) // Otherwise, is this a ^recurring_ txn_type?
|
157 |
+
$paypal['s2member_log'][] = 'Transaction type (`^recurring_?`), but there is no match to an existing account; so verification of `$_SERVER["HTTP_HOST"]` was not possible.';
|
158 |
+
|
159 |
+
else // Else, use the default ``$_SERVER['HTTP_HOST']`` error.
|
160 |
+
$paypal['s2member_log'][] = 'Unable to verify `$_SERVER["HTTP_HOST"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.';
|
161 |
+
}
|
162 |
+
else // Extensive log reporting here. This is an area where many site owners find trouble. Depending on server configuration; remote HTTPS connections may fail.
|
163 |
+
{
|
164 |
+
$paypal['s2member_log'][] = 'Unable to verify $_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.';
|
165 |
+
$paypal['s2member_log'][] = 'Please see this KB article: `http://www.s2member.com/kb/server-scanner/`. We suggest that you run the s2Member Server Scanner.';
|
166 |
+
$paypal['s2member_log'][] = var_export($_REQUEST, TRUE); // Recording _POST + _GET vars for analysis and debugging.
|
167 |
+
}
|
168 |
+
if($email_configs_were_on) // Back on?
|
169 |
+
c_ws_plugin__s2member_email_configs::email_config();
|
170 |
+
/*
|
171 |
+
Add IPN proxy (when available) to the ``$paypal`` array.
|
172 |
+
*/
|
173 |
+
if(!empty($_REQUEST['s2member_paypal_proxy']))
|
174 |
+
$paypal['s2member_paypal_proxy'] = esc_html(trim(stripslashes((string)$_REQUEST['s2member_paypal_proxy'])));
|
175 |
+
/*
|
176 |
+
Add IPN proxy use vars (when available) to the ``$paypal`` array.
|
177 |
+
*/
|
178 |
+
if(!empty($_REQUEST['s2member_paypal_proxy_use']))
|
179 |
+
$paypal['s2member_paypal_proxy_use'] = esc_html(trim(stripslashes((string)$_REQUEST['s2member_paypal_proxy_use'])));
|
180 |
+
/*
|
181 |
+
Add IPN proxy coupon vars (when available) to the ``$paypal`` array.
|
182 |
+
*/
|
183 |
+
if(!empty($_REQUEST['s2member_paypal_proxy_coupon']))
|
184 |
+
$paypal['s2member_paypal_proxy_coupon'] = stripslashes_deep((array)$_REQUEST['s2member_paypal_proxy_coupon']);
|
185 |
+
/*
|
186 |
+
Also add IPN proxy self-verification (when available) to the ``$paypal`` array.
|
187 |
+
*/
|
188 |
+
if(!empty($_REQUEST['s2member_paypal_proxy_verification']))
|
189 |
+
$paypal['s2member_paypal_proxy_verification'] = esc_html(trim(stripslashes((string)$_REQUEST['s2member_paypal_proxy_verification'])));
|
190 |
+
/*
|
191 |
+
If debugging/logging is enabled; we need to append ``$paypal`` to the log file.
|
192 |
+
Logging now supports Multisite Networking as well.
|
193 |
+
*/
|
194 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
195 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
196 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
197 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.@$_SERVER['HTTP_USER_AGENT'];
|
198 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
199 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'gateway-core-ipn-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'gateway-core-ipn.log';
|
200 |
+
|
201 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
202 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
203 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
204 |
+
file_put_contents($logs_dir.'/'.$log2,
|
205 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
206 |
+
c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($paypal, TRUE))."\n\n",
|
207 |
+
FILE_APPEND);
|
208 |
+
|
209 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
210 |
+
do_action('ws_plugin__s2member_during_paypal_notify', get_defined_vars());
|
211 |
+
unset($__refs, $__v);
|
212 |
+
|
213 |
+
status_header(200); // Send a 200 OK status header.
|
214 |
+
header('Content-Type: text/plain; charset=UTF-8'); // Content-Type text/plain with UTF-8.
|
215 |
+
while(@ob_end_clean()) ; // Clean any existing output buffers.
|
216 |
+
|
217 |
+
exit (((!empty($paypal['s2member_paypal_proxy_return_url'])) ? $paypal['s2member_paypal_proxy_return_url'] : ''));
|
218 |
}
|
219 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
220 |
+
do_action('ws_plugin__s2member_after_paypal_notify', get_defined_vars());
|
221 |
+
unset($__refs, $__v);
|
222 |
+
}
|
223 |
}
|
224 |
+
}
|
includes/classes/paypal-notify.inc.php
CHANGED
@@ -1,49 +1,44 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's PayPal IPN handler.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\PayPal
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null|inner Return-value of inner routine.
|
39 |
-
*/
|
40 |
-
public static function paypal_notify ()
|
41 |
-
{
|
42 |
-
if (!empty($_GET["s2member_paypal_notify"]))
|
43 |
-
{
|
44 |
-
return c_ws_plugin__s2member_paypal_notify_in::paypal_notify ();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
}
|
49 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's PayPal IPN handler.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\PayPal
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_paypal_notify'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member's PayPal IPN handler.
|
24 |
+
*
|
25 |
+
* @package s2Member\PayPal
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_paypal_notify
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles PayPal IPN processing.
|
32 |
+
*
|
33 |
+
* @package s2Member\PayPal
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('init');``
|
37 |
+
*/
|
38 |
+
public static function paypal_notify()
|
39 |
+
{
|
40 |
+
if(!empty($_GET['s2member_paypal_notify']))
|
41 |
+
c_ws_plugin__s2member_paypal_notify_in::paypal_notify();
|
42 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
+
}
|
includes/classes/paypal-return-in-no-tx-data.inc.php
CHANGED
@@ -73,5 +73,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_no_tx_data"))
|
|
73 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
}
|
76 |
-
}
|
77 |
-
?>
|
73 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
}
|
76 |
+
}
|
|
includes/classes/paypal-return-in-proxy-ty-email.inc.php
CHANGED
@@ -71,5 +71,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_proxy_ty_email"))
|
|
71 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_proxy_ty_email", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
}
|
74 |
-
}
|
75 |
-
?>
|
71 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_proxy_ty_email", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
}
|
74 |
+
}
|
|
includes/classes/paypal-return-in-proxy-x-preview.inc.php
CHANGED
@@ -71,5 +71,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_proxy_x_preview"))
|
|
71 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_proxy_x_preview", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
}
|
74 |
-
}
|
75 |
-
?>
|
71 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_proxy_x_preview", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
}
|
74 |
+
}
|
|
includes/classes/paypal-return-in-subscr-modify-w-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp($vars = array())
|
42 |
{
|
@@ -44,7 +42,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
44 |
|
45 |
if((!empty($paypal["txn_type"]) && preg_match("/^subscr_modify$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
47 |
-
&& (!empty($paypal["subscr_id"])))
|
|
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars());
|
@@ -68,7 +67,6 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
68 |
$paypal["period3"] = ($paypal["eotper"]) ? $paypal["eotper"] : /* 1 Lifetime. */ "1 L";
|
69 |
$paypal["mc_amount3"] = /* The "Buy Now" amount is the full gross. */ $paypal["mc_gross"];
|
70 |
}
|
71 |
-
|
72 |
$paypal["initial_term"] = (preg_match("/^[1-9]/", $paypal["period1"])) ? $paypal["period1"] : /* Defaults to "0 D" (zero days). */ "0 D";
|
73 |
$paypal["initial"] = (strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"])) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
|
74 |
$paypal["regular"] = /* This is the Regular Payment Amount that is charged to the Customer. Always required by PayPal. */ $paypal["mc_amount3"];
|
@@ -114,10 +112,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
114 |
|
115 |
update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
|
116 |
update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
|
117 |
-
|
118 |
-
|
119 |
-
update_user_option ($user_id, "s2member_subscr_baid", $paypal["subscr_baid"]);
|
120 |
-
else delete_user_option ($user_id, "s2member_subscr_baid");
|
121 |
|
122 |
update_user_option($user_id, "s2member_custom", $paypal["custom"]);
|
123 |
|
@@ -146,33 +142,34 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
146 |
|
147 |
if($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
148 |
{
|
149 |
-
if(($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(
|
150 |
-
if(($code = preg_replace("/%%
|
151 |
-
if(($code = preg_replace("/%%
|
152 |
-
if(($code = preg_replace("/%%
|
153 |
-
if(($code = preg_replace("/%%
|
154 |
-
if(($code = preg_replace("/%%
|
155 |
-
if(($code = preg_replace("/%%
|
156 |
-
|
157 |
-
|
158 |
-
if(($code = preg_replace("/%%
|
159 |
-
if(($code = preg_replace("/%%
|
160 |
-
if(($code = preg_replace("/%%
|
161 |
-
if(($code = preg_replace("/%%
|
162 |
-
if(($code = preg_replace("/%%
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
176 |
}
|
177 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
178 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars());
|
@@ -234,5 +231,4 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
234 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level", false, get_defined_vars());
|
235 |
}
|
236 |
}
|
237 |
-
}
|
238 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp($vars = array())
|
40 |
{
|
42 |
|
43 |
if((!empty($paypal["txn_type"]) && preg_match("/^subscr_modify$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
+
&& (!empty($paypal["subscr_id"])) && (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
46 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"])))
|
47 |
{
|
48 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
49 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars());
|
67 |
$paypal["period3"] = ($paypal["eotper"]) ? $paypal["eotper"] : /* 1 Lifetime. */ "1 L";
|
68 |
$paypal["mc_amount3"] = /* The "Buy Now" amount is the full gross. */ $paypal["mc_gross"];
|
69 |
}
|
|
|
70 |
$paypal["initial_term"] = (preg_match("/^[1-9]/", $paypal["period1"])) ? $paypal["period1"] : /* Defaults to "0 D" (zero days). */ "0 D";
|
71 |
$paypal["initial"] = (strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"])) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
|
72 |
$paypal["regular"] = /* This is the Regular Payment Amount that is charged to the Customer. Always required by PayPal. */ $paypal["mc_amount3"];
|
112 |
|
113 |
update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
|
114 |
update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
|
115 |
+
update_user_option($user_id, "s2member_subscr_baid", $paypal["subscr_baid"]);
|
116 |
+
update_user_option($user_id, "s2member_subscr_cid", $paypal["subscr_cid"]);
|
|
|
|
|
117 |
|
118 |
update_user_option($user_id, "s2member_custom", $paypal["custom"]);
|
119 |
|
142 |
|
143 |
if($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
144 |
{
|
145 |
+
if(($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_id"]), $code)))
|
146 |
+
if(($code = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_baid"]), $code)) && ($code = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_cid"]), $code)))
|
147 |
+
if(($code = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["initial"]), $code)) && ($code = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["regular"]), $code)) && ($code = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["recurring"]), $code)))
|
148 |
+
if(($code = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["initial_term"]), $code)) && ($code = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["regular_term"]), $code)))
|
149 |
+
if(($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_name"]), $code)))
|
150 |
+
if(($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["last_name"]), $code)))
|
151 |
+
if(($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal["first_name"]." ".$paypal["last_name"])), $code)))
|
152 |
+
if(($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["payer_email"]), $code)))
|
153 |
+
{
|
154 |
+
if(($code = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code)))
|
155 |
+
if(($code = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name." ".$user->last_name)), $code)))
|
156 |
+
if(($code = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)))
|
157 |
+
if(($code = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)))
|
158 |
+
if(($code = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)))
|
159 |
+
if(($code = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)))
|
160 |
+
{
|
161 |
+
if(is_array($fields) && !empty($fields))
|
162 |
+
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
163 |
+
if(!($code = preg_replace("/%%".preg_quote($var, "/")."%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code)))
|
164 |
+
break;
|
165 |
+
|
166 |
+
if(($code = trim(preg_replace("/%%(.+?)%%/i", "", $code))) /* This gets stored into a Transient Queue. */)
|
167 |
+
{
|
168 |
+
$paypal["s2member_log"][] = "Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.";
|
169 |
+
set_transient("s2m_".md5("s2member_transient_modification_tracking_codes_".$paypal["subscr_id"]), $code, 43200);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
}
|
174 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
175 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars());
|
231 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level", false, get_defined_vars());
|
232 |
}
|
233 |
}
|
234 |
+
}
|
|
includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp($vars = array())
|
42 |
{
|
@@ -45,6 +43,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
45 |
if((!empty($paypal["txn_type"]) && preg_match("/^(web_accept|subscr_signup|subscr_payment)$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
47 |
&& (!empty($paypal["subscr_id"]) || (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])))
|
|
|
|
|
48 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal["payment_status"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
@@ -104,6 +104,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
104 |
|
105 |
$ipn_signup_vars = $paypal; /* Create array of wouldbe IPN signup vars w/o s2member_log. */ unset($ipn_signup_vars["s2member_log"]);
|
106 |
}
|
|
|
107 |
/*
|
108 |
New Subscription with advanced update vars (option_name1, option_selection1)? Used in Subscr. Modifications.
|
109 |
*/
|
@@ -152,10 +153,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
152 |
|
153 |
update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
|
154 |
update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
|
155 |
-
|
156 |
-
|
157 |
-
update_user_option ($user_id, "s2member_subscr_baid", $paypal["subscr_baid"]);
|
158 |
-
else delete_user_option ($user_id, "s2member_subscr_baid");
|
159 |
|
160 |
update_user_option($user_id, "s2member_custom", $paypal["custom"]);
|
161 |
|
@@ -193,33 +192,34 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
193 |
|
194 |
if($processing && $tracking_properties && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
195 |
{
|
196 |
-
if(($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(
|
197 |
-
if(($code = preg_replace("/%%
|
198 |
-
if(($code = preg_replace("/%%
|
199 |
-
if(($code = preg_replace("/%%
|
200 |
-
if(($code = preg_replace("/%%
|
201 |
-
if(($code = preg_replace("/%%
|
202 |
-
if(($code = preg_replace("/%%
|
203 |
-
|
204 |
-
|
205 |
-
if(($code = preg_replace("/%%
|
206 |
-
if(($code = preg_replace("/%%
|
207 |
-
if(($code = preg_replace("/%%
|
208 |
-
if(($code = preg_replace("/%%
|
209 |
-
if(($code = preg_replace("/%%
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
223 |
}
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars());
|
@@ -291,20 +291,21 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
291 |
|
292 |
if($processing && $tracking_properties && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
293 |
{
|
294 |
-
if(($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(
|
295 |
-
if(($code = preg_replace("/%%
|
296 |
-
if(($code = preg_replace("/%%
|
297 |
-
if(($code = preg_replace("/%%
|
298 |
-
if(($code = preg_replace("/%%
|
299 |
-
if(($code = preg_replace("/%%
|
300 |
-
if(($code = preg_replace("/%%
|
301 |
-
if(($code = preg_replace("/%%
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
308 |
}
|
309 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
310 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars());
|
@@ -380,5 +381,4 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
380 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level", false, get_defined_vars());
|
381 |
}
|
382 |
}
|
383 |
-
}
|
384 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp($vars = array())
|
40 |
{
|
43 |
if((!empty($paypal["txn_type"]) && preg_match("/^(web_accept|subscr_signup|subscr_payment)$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
&& (!empty($paypal["subscr_id"]) || (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])))
|
46 |
+
&& (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"]))
|
47 |
+
&& (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"]))
|
48 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal["payment_status"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
104 |
|
105 |
$ipn_signup_vars = $paypal; /* Create array of wouldbe IPN signup vars w/o s2member_log. */ unset($ipn_signup_vars["s2member_log"]);
|
106 |
}
|
107 |
+
else $tracking_properties = false; // Not possible.
|
108 |
/*
|
109 |
New Subscription with advanced update vars (option_name1, option_selection1)? Used in Subscr. Modifications.
|
110 |
*/
|
153 |
|
154 |
update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
|
155 |
update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
|
156 |
+
update_user_option($user_id, "s2member_subscr_baid", $paypal["subscr_baid"]);
|
157 |
+
update_user_option($user_id, "s2member_subscr_cid", $paypal["subscr_cid"]);
|
|
|
|
|
158 |
|
159 |
update_user_option($user_id, "s2member_custom", $paypal["custom"]);
|
160 |
|
192 |
|
193 |
if($processing && $tracking_properties && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
194 |
{
|
195 |
+
if(($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_id"]), $code)))
|
196 |
+
if(($code = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_baid"]), $code)) && ($code = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_cid"]), $code)))
|
197 |
+
if(($code = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["initial"]), $code)) && ($code = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["regular"]), $code)) && ($code = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["recurring"]), $code)))
|
198 |
+
if(($code = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["initial_term"]), $code)) && ($code = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["regular_term"]), $code)))
|
199 |
+
if(($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_name"]), $code)))
|
200 |
+
if(($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["last_name"]), $code)))
|
201 |
+
if(($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal["first_name"]." ".$paypal["last_name"])), $code)))
|
202 |
+
if(($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["payer_email"]), $code)))
|
203 |
+
{
|
204 |
+
if(($code = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code)))
|
205 |
+
if(($code = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name." ".$user->last_name)), $code)))
|
206 |
+
if(($code = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)))
|
207 |
+
if(($code = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)))
|
208 |
+
if(($code = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)))
|
209 |
+
if(($code = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)))
|
210 |
+
{
|
211 |
+
if(is_array($fields) && !empty($fields))
|
212 |
+
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
213 |
+
if(!($code = preg_replace("/%%".preg_quote($var, "/")."%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code)))
|
214 |
+
break;
|
215 |
+
|
216 |
+
if(($code = trim(preg_replace("/%%(.+?)%%/i", "", $code))) /* This gets stored into a Transient Queue. */)
|
217 |
+
{
|
218 |
+
$paypal["s2member_log"][] = "Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.";
|
219 |
+
set_transient("s2m_".md5("s2member_transient_modification_tracking_codes_".$paypal["subscr_id"]), $code, 43200);
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
}
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars());
|
291 |
|
292 |
if($processing && $tracking_properties && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array($cv = preg_split("/\|/", $paypal["custom"])))
|
293 |
{
|
294 |
+
if(($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_id"]), $code)))
|
295 |
+
if(($code = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_baid"]), $code)) && ($code = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["subscr_cid"]), $code)))
|
296 |
+
if(($code = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["initial"]), $code)) && ($code = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["regular"]), $code)) && ($code = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["recurring"]), $code)))
|
297 |
+
if(($code = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["initial_term"]), $code)) && ($code = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["regular_term"]), $code)))
|
298 |
+
if(($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["item_name"]), $code)))
|
299 |
+
if(($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["last_name"]), $code)))
|
300 |
+
if(($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal["first_name"]." ".$paypal["last_name"])), $code)))
|
301 |
+
if(($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["payer_email"]), $code)))
|
302 |
+
if(($code = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($paypal["ip"]), $code)))
|
303 |
+
|
304 |
+
if(($code = trim(preg_replace("/%%(.+?)%%/i", "", $code))) /* This gets stored into a Transient Queue. */)
|
305 |
+
{
|
306 |
+
$paypal["s2member_log"][] = "Storing Signup Tracking Codes into a Transient Queue. These will be processed on-site.";
|
307 |
+
set_transient("s2m_".md5("s2member_transient_signup_tracking_codes_".$paypal["subscr_id"]), $code, 43200);
|
308 |
+
}
|
309 |
}
|
310 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
311 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars());
|
381 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level", false, get_defined_vars());
|
382 |
}
|
383 |
}
|
384 |
+
}
|
|
includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
42 |
{
|
@@ -45,7 +43,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
45 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))
|
47 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
-
&& (!empty($paypal["txn_id"])
|
|
|
|
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_return_before_new_ccaps", get_defined_vars ());
|
@@ -93,38 +93,39 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
93 |
|
94 |
$paypal["s2member_log"][] = "s2Member Custom Capabilities updated w/ advanced update routines.";
|
95 |
|
96 |
-
setcookie ("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt ($paypal["
|
97 |
|
98 |
$paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
|
99 |
|
100 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
101 |
{
|
102 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
103 |
-
if (($code = preg_replace ("/%%
|
104 |
-
if (($code = preg_replace ("/%%
|
105 |
-
if (($code = preg_replace ("/%%
|
106 |
-
if (($code = preg_replace ("/%%
|
107 |
-
if (($code = preg_replace ("/%%
|
108 |
-
|
109 |
-
|
110 |
-
if (($code = preg_replace ("/%%
|
111 |
-
if (($code = preg_replace ("/%%
|
112 |
-
if (($code = preg_replace ("/%%
|
113 |
-
if (($code = preg_replace ("/%%
|
114 |
-
if (($code = preg_replace ("/%%
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
128 |
}
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
do_action("ws_plugin__s2member_during_paypal_return_during_new_ccaps", get_defined_vars ());
|
@@ -197,5 +198,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
197 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level", false, get_defined_vars ());
|
198 |
}
|
199 |
}
|
200 |
-
}
|
201 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
40 |
{
|
43 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))
|
45 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
46 |
+
&& (!empty($paypal["txn_id"])) && (!empty($paypal["payer_email"]))
|
47 |
+
&& (!empty($paypal["txn_baid"]) || ($paypal["txn_baid"] = $paypal["txn_id"]))
|
48 |
+
&& (!empty($paypal["txn_cid"]) || ($paypal["txn_cid"] = $paypal["txn_id"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_return_before_new_ccaps", get_defined_vars ());
|
93 |
|
94 |
$paypal["s2member_log"][] = "s2Member Custom Capabilities updated w/ advanced update routines.";
|
95 |
|
96 |
+
setcookie ("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt ($paypal["txn_id"])), time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_tracking", $s2member_tracking, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
|
97 |
|
98 |
$paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
|
99 |
|
100 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
101 |
{
|
102 |
+
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace ("/%%(?:subscr|txn)_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $code)))
|
103 |
+
if (($code = preg_replace ("/%%(?:subscr|txn)_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $code)) && ($code = preg_replace ("/%%(?:subscr|txn)_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $code)))
|
104 |
+
if (($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $code)))
|
105 |
+
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $code)))
|
106 |
+
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $code)))
|
107 |
+
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
108 |
+
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $code)))
|
109 |
+
{
|
110 |
+
if (($code = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->first_name), $code)) && ($code = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->last_name), $code)))
|
111 |
+
if (($code = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($user->first_name . " " . $user->last_name)), $code)))
|
112 |
+
if (($code = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_email), $code)))
|
113 |
+
if (($code = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user->user_login), $code)))
|
114 |
+
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_reg_ip), $code)))
|
115 |
+
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $code)))
|
116 |
+
{
|
117 |
+
if (is_array($fields) && !empty($fields))
|
118 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
119 |
+
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $code)))
|
120 |
+
break;
|
121 |
+
|
122 |
+
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code))) /* This gets stored into a Transient Queue. */)
|
123 |
+
{
|
124 |
+
$paypal["s2member_log"][] = "Storing Payment Tracking Codes into a Transient Queue. These will be processed on-site.";
|
125 |
+
set_transient ("s2m_" . md5 ("s2member_transient_ccap_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
}
|
130 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
131 |
do_action("ws_plugin__s2member_during_paypal_return_during_new_ccaps", get_defined_vars ());
|
198 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level", false, get_defined_vars ());
|
199 |
}
|
200 |
}
|
201 |
+
}
|
|
includes/classes/paypal-return-in-web-accept-sp.inc.php
CHANGED
@@ -35,8 +35,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
-
*
|
39 |
-
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
42 |
{
|
@@ -45,7 +43,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
45 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
47 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
-
&& (!empty($paypal["txn_id"])))
|
|
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_return_before_sp_access", get_defined_vars ());
|
@@ -71,18 +70,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
71 |
|
72 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
73 |
{
|
74 |
-
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
75 |
-
if (($code = preg_replace ("/%%
|
76 |
-
if (($code = preg_replace ("/%%
|
77 |
-
if (($code = preg_replace ("/%%
|
78 |
-
if (($code = preg_replace ("/%%
|
79 |
-
if (($code = preg_replace ("/%%
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
86 |
}
|
87 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
88 |
do_action("ws_plugin__s2member_during_paypal_return_during_sp_access", get_defined_vars ());
|
@@ -139,5 +139,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
139 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_web_accept_sp", false, get_defined_vars ());
|
140 |
}
|
141 |
}
|
142 |
-
}
|
143 |
-
?>
|
35 |
*
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
|
|
|
|
38 |
*/
|
39 |
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
40 |
{
|
43 |
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
44 |
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
45 |
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
46 |
+
&& (!empty($paypal["txn_id"])) && (!empty($paypal["txn_baid"]) || ($paypal["txn_baid"] = $paypal["txn_id"]))
|
47 |
+
&& (!empty($paypal["txn_cid"]) || ($paypal["txn_cid"] = $paypal["txn_id"])))
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_return_before_sp_access", get_defined_vars ());
|
70 |
|
71 |
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
72 |
{
|
73 |
+
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_id"]), $code)))
|
74 |
+
if (($code = preg_replace ("/%%txn_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_baid"]), $code)) && ($code = preg_replace ("/%%txn_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["txn_cid"]), $code)))
|
75 |
+
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["item_name"]), $code)))
|
76 |
+
if (($code = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["last_name"]), $code)))
|
77 |
+
if (($code = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
|
78 |
+
if (($code = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["payer_email"]), $code)))
|
79 |
+
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($paypal["ip"]), $code)))
|
80 |
+
|
81 |
+
if (($code = trim (preg_replace ("/%%(.+?)%%/i", "", $code)))) // This gets stored into a Transient Queue.
|
82 |
+
{
|
83 |
+
$paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue. These will be processed on-site.";
|
84 |
+
set_transient ("s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
|
85 |
+
}
|
86 |
}
|
87 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
88 |
do_action("ws_plugin__s2member_during_paypal_return_during_sp_access", get_defined_vars ());
|
139 |
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_web_accept_sp", false, get_defined_vars ());
|
140 |
}
|
141 |
}
|
142 |
+
}
|
|
includes/classes/paypal-return-in.inc.php
CHANGED
@@ -46,7 +46,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
46 |
if (!empty($_GET["s2member_paypal_return"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !empty($_GET["s2member_paypal_proxy"])))
|
47 |
{
|
48 |
$paypal = array(); // Initialize PayPal array; we also reference this with a variable for a possible proxy handler.
|
49 |
-
if(!empty($_GET["s2member_paypal_proxy"]) && in_array($_GET["s2member_paypal_proxy"], array("alipay", "authnet", "clickbank", "ccbill", "google"), TRUE))
|
50 |
${esc_html(trim(stripslashes($_GET["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
51 |
|
52 |
$custom_success_redirection = (!empty($_GET["s2member_paypal_return_success"])) ? esc_html (trim (stripslashes ($_GET["s2member_paypal_return_success"]))) : false;
|
@@ -95,8 +95,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
95 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
96 |
}
|
97 |
}
|
98 |
-
else // Else a custom conditional has been applied by filters.
|
99 |
-
unset($__refs, $__v);
|
100 |
}
|
101 |
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
102 |
{
|
@@ -169,7 +168,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
169 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
170 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
171 |
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
172 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " .
|
173 |
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
174 |
$log2 = (is_multisite () && !is_main_site ()) ? "gateway-core-rtn-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "gateway-core-rtn.log";
|
175 |
|
@@ -192,5 +191,4 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
192 |
unset($__refs, $__v);
|
193 |
}
|
194 |
}
|
195 |
-
}
|
196 |
-
?>
|
46 |
if (!empty($_GET["s2member_paypal_return"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !empty($_GET["s2member_paypal_proxy"])))
|
47 |
{
|
48 |
$paypal = array(); // Initialize PayPal array; we also reference this with a variable for a possible proxy handler.
|
49 |
+
if(!empty($_GET["s2member_paypal_proxy"]) && in_array($_GET["s2member_paypal_proxy"], array("alipay", "stripe", "authnet", "clickbank", "ccbill", "google"), TRUE))
|
50 |
${esc_html(trim(stripslashes($_GET["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
51 |
|
52 |
$custom_success_redirection = (!empty($_GET["s2member_paypal_return_success"])) ? esc_html (trim (stripslashes ($_GET["s2member_paypal_return_success"]))) : false;
|
95 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
96 |
}
|
97 |
}
|
98 |
+
else unset($__refs, $__v); // Else a custom conditional has been applied by filters.
|
|
|
99 |
}
|
100 |
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
101 |
{
|
168 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
169 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
170 |
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
171 |
+
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . @$_SERVER["HTTP_USER_AGENT"];
|
172 |
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
173 |
$log2 = (is_multisite () && !is_main_site ()) ? "gateway-core-rtn-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "gateway-core-rtn.log";
|
174 |
|
191 |
unset($__refs, $__v);
|
192 |
}
|
193 |
}
|
194 |
+
}
|
|
includes/classes/paypal-return.inc.php
CHANGED
@@ -1,49 +1,44 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's PayPal Auto-Return/PDT handler.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\PayPal
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null|inner Return-value of inner routine.
|
39 |
-
*/
|
40 |
-
public static function paypal_return ()
|
41 |
-
{
|
42 |
-
if (!empty($_GET["s2member_paypal_return"]))
|
43 |
-
{
|
44 |
-
return c_ws_plugin__s2member_paypal_return_in::paypal_return ();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
}
|
49 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's PayPal Auto-Return/PDT handler.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\PayPal
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_paypal_return'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member's PayPal Auto-Return/PDT handler.
|
24 |
+
*
|
25 |
+
* @package s2Member\PayPal
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_paypal_return
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles PayPal Return URLs.
|
32 |
+
*
|
33 |
+
* @package s2Member\PayPal
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('init');``
|
37 |
+
*/
|
38 |
+
public static function paypal_return()
|
39 |
+
{
|
40 |
+
if(!empty($_GET['s2member_paypal_return']))
|
41 |
+
c_ws_plugin__s2member_paypal_return_in::paypal_return();
|
42 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
+
}
|
includes/classes/paypal-utilities.inc.php
CHANGED
@@ -190,7 +190,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
190 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
191 |
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
192 |
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
193 |
-
$log4 = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\nUser-Agent: "
|
194 |
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
195 |
$log2 = (is_multisite() && !is_main_site()) ? "paypal-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "paypal-api.log";
|
196 |
|
@@ -327,7 +327,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
327 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
328 |
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
329 |
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
330 |
-
$log4 = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\nUser-Agent: "
|
331 |
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
332 |
$log2 = (is_multisite() && !is_main_site()) ? "paypal-payflow-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "paypal-payflow-api.log";
|
333 |
|
190 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
191 |
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
192 |
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
193 |
+
$log4 = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\nUser-Agent: ".@$_SERVER["HTTP_USER_AGENT"];
|
194 |
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
195 |
$log2 = (is_multisite() && !is_main_site()) ? "paypal-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "paypal-api.log";
|
196 |
|
327 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
328 |
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
329 |
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
330 |
+
$log4 = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\nUser-Agent: ".@$_SERVER["HTTP_USER_AGENT"];
|
331 |
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
332 |
$log2 = (is_multisite() && !is_main_site()) ? "paypal-payflow-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "paypal-payflow-api.log";
|
333 |
|
includes/classes/profile-mods-4bp-in.inc.php
CHANGED
@@ -100,19 +100,20 @@ if(!class_exists('c_ws_plugin__s2member_profile_mods_4bp_in'))
|
|
100 |
do_action('ws_plugin__s2member_during_handle_profile_modifications_4bp', get_defined_vars());
|
101 |
unset($__refs, $__v);
|
102 |
|
103 |
-
|
104 |
-
(
|
|
|
|
|
|
|
105 |
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
106 |
$level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
|
107 |
|
108 |
if(!empty($_p['ws_plugin__s2member_profile_4bp_opt_in']) && $role && $level >= 0)
|
109 |
{
|
110 |
-
update_user_option($user_id, 's2member_opt_in', '1');
|
111 |
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
|
112 |
}
|
113 |
else if($role && $level >= 0)
|
114 |
{
|
115 |
-
update_user_option($user_id, 's2member_opt_in', '0');
|
116 |
c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
|
117 |
}
|
118 |
}
|
100 |
do_action('ws_plugin__s2member_during_handle_profile_modifications_4bp', get_defined_vars());
|
101 |
unset($__refs, $__v);
|
102 |
|
103 |
+
clean_user_cache($user_id);
|
104 |
+
wp_cache_delete($user_id, 'user_meta');
|
105 |
+
$user = new WP_User($user_id); // Fresh object.
|
106 |
+
if(function_exists('setup_userdata')) setup_userdata();
|
107 |
+
|
108 |
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
109 |
$level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
|
110 |
|
111 |
if(!empty($_p['ws_plugin__s2member_profile_4bp_opt_in']) && $role && $level >= 0)
|
112 |
{
|
|
|
113 |
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
|
114 |
}
|
115 |
else if($role && $level >= 0)
|
116 |
{
|
|
|
117 |
c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
|
118 |
}
|
119 |
}
|
includes/classes/profile-mods-in.inc.php
CHANGED
@@ -124,19 +124,20 @@ if(!class_exists('c_ws_plugin__s2member_profile_mods_in'))
|
|
124 |
do_action('ws_plugin__s2member_during_handle_profile_modifications', get_defined_vars());
|
125 |
unset($__refs, $__v);
|
126 |
|
127 |
-
|
|
|
|
|
128 |
if(function_exists('setup_userdata')) setup_userdata();
|
|
|
129 |
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
130 |
$level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
|
131 |
|
132 |
if(!empty($_p['ws_plugin__s2member_profile_opt_in']) && $role && $level >= 0)
|
133 |
{
|
134 |
-
update_user_option($user_id, 's2member_opt_in', '1');
|
135 |
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, ((!empty($userdata['user_pass'])) ? $userdata['user_pass'] : ''), $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
|
136 |
}
|
137 |
else if($role && $level >= 0)
|
138 |
{
|
139 |
-
update_user_option($user_id, 's2member_opt_in', '0');
|
140 |
c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, ((!empty($userdata['user_pass'])) ? $userdata['user_pass'] : ''), $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
|
141 |
}
|
142 |
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
|
124 |
do_action('ws_plugin__s2member_during_handle_profile_modifications', get_defined_vars());
|
125 |
unset($__refs, $__v);
|
126 |
|
127 |
+
clean_user_cache($user_id);
|
128 |
+
wp_cache_delete($user_id, 'user_meta');
|
129 |
+
$user = new WP_User ($user_id); // Fresh object.
|
130 |
if(function_exists('setup_userdata')) setup_userdata();
|
131 |
+
|
132 |
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
133 |
$level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
|
134 |
|
135 |
if(!empty($_p['ws_plugin__s2member_profile_opt_in']) && $role && $level >= 0)
|
136 |
{
|
|
|
137 |
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, ((!empty($userdata['user_pass'])) ? $userdata['user_pass'] : ''), $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
|
138 |
}
|
139 |
else if($role && $level >= 0)
|
140 |
{
|
|
|
141 |
c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, ((!empty($userdata['user_pass'])) ? $userdata['user_pass'] : ''), $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
|
142 |
}
|
143 |
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
|
includes/classes/registrations.inc.php
CHANGED
@@ -54,6 +54,11 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
54 |
if (($custom = trim (stripslashes ((string)$_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))))
|
55 |
$password = $custom; // Yes, use s2Member custom Password supplied by User.
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
57 |
else if (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !empty($GLOBALS["ws_plugin__s2member_generate_password_return"]))
|
58 |
{
|
59 |
if (($custom = trim (stripslashes ((string)$GLOBALS["ws_plugin__s2member_generate_password_return"]))))
|
@@ -537,7 +542,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
537 |
$_p[$_key] = $_value; // Add each of these key conversions.
|
538 |
unset /* Just a little housekeeping here. */ ($_key, $_value);
|
539 |
|
540 |
-
if (!is_admin () && (isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_custom"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_ccaps"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_notes"])))
|
541 |
exit (_x ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
|
542 |
|
543 |
$_pmr = array_merge ($_p, $meta, $rvs); // Merge all of these arrays together now, in this specific order.
|
@@ -561,6 +566,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
561 |
$ip = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
|
562 |
$ip = (!$ip) ? $_SERVER["REMOTE_ADDR"] : $ip; // Else use environment variable.
|
563 |
$subscr_baid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"];
|
|
|
564 |
$cv = preg_split ("/\|/", $custom);
|
565 |
|
566 |
if (!($auto_eot_time = "") && $eotper) // If a specific EOT Period is included.
|
@@ -610,6 +616,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
610 |
update_user_option ($user_id, "s2member_subscr_gateway", $subscr_gateway);
|
611 |
update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
|
612 |
update_user_option ($user_id, "s2member_subscr_baid", $subscr_baid);
|
|
|
613 |
update_user_option ($user_id, "s2member_custom", $custom);
|
614 |
update_user_option ($user_id, "s2member_notes", $notes);
|
615 |
|
@@ -695,7 +702,9 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
695 |
delete_transient ($transient); // This can be deleted now.
|
696 |
}
|
697 |
if (!headers_sent ()) // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
|
698 |
-
@setcookie
|
|
|
|
|
699 |
|
700 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
701 |
do_action("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars ());
|
@@ -731,6 +740,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
731 |
$custom = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
|
732 |
$subscr_id = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
|
733 |
$subscr_baid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"];
|
|
|
734 |
$subscr_gateway = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
|
735 |
$cv = preg_split ("/\|/", (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
|
736 |
|
@@ -779,6 +789,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
779 |
update_user_option ($user_id, "s2member_subscr_gateway", $subscr_gateway);
|
780 |
update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
|
781 |
update_user_option ($user_id, "s2member_subscr_baid", $subscr_baid);
|
|
|
782 |
update_user_option ($user_id, "s2member_custom", $custom);
|
783 |
update_user_option ($user_id, "s2member_notes", $notes);
|
784 |
|
@@ -877,6 +888,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
877 |
$custom = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
|
878 |
$subscr_id = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
|
879 |
$subscr_baid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"];
|
|
|
880 |
$subscr_gateway = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
|
881 |
$cv = preg_split ("/\|/", (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
|
882 |
|
@@ -916,6 +928,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
916 |
update_user_option ($user_id, "s2member_subscr_gateway", $subscr_gateway);
|
917 |
update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
|
918 |
update_user_option ($user_id, "s2member_subscr_baid", $subscr_baid);
|
|
|
919 |
update_user_option ($user_id, "s2member_custom", $custom);
|
920 |
update_user_option ($user_id, "s2member_notes", $notes);
|
921 |
|
@@ -989,21 +1002,21 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
989 |
foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) // Notify each of the URLs.
|
990 |
|
991 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)))
|
992 |
-
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
993 |
-
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
994 |
-
if (($url = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
995 |
-
if (($url = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::
|
996 |
-
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
997 |
-
if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
998 |
-
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
999 |
-
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
1000 |
-
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
1001 |
-
if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
1002 |
-
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
1003 |
-
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
1004 |
{
|
1005 |
foreach ($fields as $var => $val) // Custom Fields.
|
1006 |
-
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
1007 |
break;
|
1008 |
|
1009 |
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
@@ -1046,22 +1059,22 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
1046 |
$msg .= "cv8: %%cv8%%\n";
|
1047 |
$msg .= "cv9: %%cv9%%";
|
1048 |
|
1049 |
-
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(
|
1050 |
-
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
1051 |
-
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
1052 |
-
if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
1053 |
-
if (($msg = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::
|
1054 |
-
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
1055 |
-
if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
1056 |
-
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
1057 |
-
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
1058 |
-
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
1059 |
-
if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
1060 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
1061 |
-
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
1062 |
{
|
1063 |
foreach ($fields as $var => $val) // Custom Fields.
|
1064 |
-
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
1065 |
break;
|
1066 |
|
1067 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
@@ -1078,21 +1091,21 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
1078 |
if (!empty($GLOBALS["ws_plugin__s2member_registration_return_url"]) && ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"]))
|
1079 |
|
1080 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)))
|
1081 |
-
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::
|
1082 |
-
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::
|
1083 |
-
if (($url = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
1084 |
-
if (($url = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::
|
1085 |
-
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::
|
1086 |
-
if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::
|
1087 |
-
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::
|
1088 |
-
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::
|
1089 |
-
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
1090 |
-
if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::
|
1091 |
-
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::
|
1092 |
-
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
1093 |
{
|
1094 |
foreach ($fields as $var => $val) // Custom Fields.
|
1095 |
-
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::
|
1096 |
break;
|
1097 |
|
1098 |
if (($url = trim ($url))) // Preserve remaining Replacements; because the parent routine may perform replacements too.
|
@@ -1122,7 +1135,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
1122 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
1123 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
1124 |
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
1125 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " .
|
1126 |
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
1127 |
$log2 = (is_multisite () && !is_main_site ()) ? "reg-handler-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "reg-handler.log";
|
1128 |
|
54 |
if (($custom = trim (stripslashes ((string)$_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))))
|
55 |
$password = $custom; // Yes, use s2Member custom Password supplied by User.
|
56 |
}
|
57 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && !empty($GLOBALS['ws_plugin__s2member_registration_vars']) && !empty($GLOBALS['ws_plugin__s2member_registration_vars']['ws_plugin__s2member_custom_reg_field_user_pass1']))
|
58 |
+
{
|
59 |
+
if (($custom = trim ((string)$GLOBALS['ws_plugin__s2member_registration_vars']['ws_plugin__s2member_custom_reg_field_user_pass1'])))
|
60 |
+
$password = $custom; // Yes, use s2Member custom Password supplied by User.
|
61 |
+
}
|
62 |
else if (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !empty($GLOBALS["ws_plugin__s2member_generate_password_return"]))
|
63 |
{
|
64 |
if (($custom = trim (stripslashes ((string)$GLOBALS["ws_plugin__s2member_generate_password_return"]))))
|
542 |
$_p[$_key] = $_value; // Add each of these key conversions.
|
543 |
unset /* Just a little housekeeping here. */ ($_key, $_value);
|
544 |
|
545 |
+
if (!is_admin () && (isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_cid"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_custom"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_ccaps"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_notes"])))
|
546 |
exit (_x ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
|
547 |
|
548 |
$_pmr = array_merge ($_p, $meta, $rvs); // Merge all of these arrays together now, in this specific order.
|
566 |
$ip = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
|
567 |
$ip = (!$ip) ? $_SERVER["REMOTE_ADDR"] : $ip; // Else use environment variable.
|
568 |
$subscr_baid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"];
|
569 |
+
$subscr_cid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_cid"];
|
570 |
$cv = preg_split ("/\|/", $custom);
|
571 |
|
572 |
if (!($auto_eot_time = "") && $eotper) // If a specific EOT Period is included.
|
616 |
update_user_option ($user_id, "s2member_subscr_gateway", $subscr_gateway);
|
617 |
update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
|
618 |
update_user_option ($user_id, "s2member_subscr_baid", $subscr_baid);
|
619 |
+
update_user_option ($user_id, "s2member_subscr_cid", $subscr_cid);
|
620 |
update_user_option ($user_id, "s2member_custom", $custom);
|
621 |
update_user_option ($user_id, "s2member_notes", $notes);
|
622 |
|
702 |
delete_transient ($transient); // This can be deleted now.
|
703 |
}
|
704 |
if (!headers_sent ()) // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
|
705 |
+
@setcookie("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($subscr_id)), time () + 31556926, COOKIEPATH, COOKIE_DOMAIN).
|
706 |
+
@setcookie("s2member_tracking", $s2member_tracking, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN).
|
707 |
+
($_COOKIE["s2member_tracking"] = $s2member_tracking);
|
708 |
|
709 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
710 |
do_action("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars ());
|
740 |
$custom = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
|
741 |
$subscr_id = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
|
742 |
$subscr_baid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"];
|
743 |
+
$subscr_cid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_cid"];
|
744 |
$subscr_gateway = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
|
745 |
$cv = preg_split ("/\|/", (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
|
746 |
|
789 |
update_user_option ($user_id, "s2member_subscr_gateway", $subscr_gateway);
|
790 |
update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
|
791 |
update_user_option ($user_id, "s2member_subscr_baid", $subscr_baid);
|
792 |
+
update_user_option ($user_id, "s2member_subscr_cid", $subscr_cid);
|
793 |
update_user_option ($user_id, "s2member_custom", $custom);
|
794 |
update_user_option ($user_id, "s2member_notes", $notes);
|
795 |
|
888 |
$custom = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
|
889 |
$subscr_id = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
|
890 |
$subscr_baid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_baid"];
|
891 |
+
$subscr_cid = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_cid"];
|
892 |
$subscr_gateway = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
|
893 |
$cv = preg_split ("/\|/", (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
|
894 |
|
928 |
update_user_option ($user_id, "s2member_subscr_gateway", $subscr_gateway);
|
929 |
update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
|
930 |
update_user_option ($user_id, "s2member_subscr_baid", $subscr_baid);
|
931 |
+
update_user_option ($user_id, "s2member_subscr_cid", $subscr_cid);
|
932 |
update_user_option ($user_id, "s2member_custom", $custom);
|
933 |
update_user_option ($user_id, "s2member_notes", $notes);
|
934 |
|
1002 |
foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) // Notify each of the URLs.
|
1003 |
|
1004 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)))
|
1005 |
+
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($role)), $url)))
|
1006 |
+
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($level)), $url)))
|
1007 |
+
if (($url = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($ccaps)), $url)))
|
1008 |
+
if (($url = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($auto_eot_time)), $url)))
|
1009 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($fname)), $url)))
|
1010 |
+
if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($lname)), $url)))
|
1011 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($name)), $url)))
|
1012 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($email)), $url)))
|
1013 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($login)), $url)))
|
1014 |
+
if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($pass)), $url)))
|
1015 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($ip)), $url)))
|
1016 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
1017 |
{
|
1018 |
foreach ($fields as $var => $val) // Custom Fields.
|
1019 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
1020 |
break;
|
1021 |
|
1022 |
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
1059 |
$msg .= "cv8: %%cv8%%\n";
|
1060 |
$msg .= "cv9: %%cv9%%";
|
1061 |
|
1062 |
+
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)))
|
1063 |
+
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($role), $msg)))
|
1064 |
+
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($level), $msg)))
|
1065 |
+
if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ccaps), $msg)))
|
1066 |
+
if (($msg = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($auto_eot_time), $msg)))
|
1067 |
+
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($fname), $msg)))
|
1068 |
+
if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($lname), $msg)))
|
1069 |
+
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($name), $msg)))
|
1070 |
+
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($email), $msg)))
|
1071 |
+
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($login), $msg)))
|
1072 |
+
if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($pass), $msg)))
|
1073 |
+
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($ip), $msg)))
|
1074 |
+
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $msg)))
|
1075 |
{
|
1076 |
foreach ($fields as $var => $val) // Custom Fields.
|
1077 |
+
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (maybe_serialize ($val)), $msg)))
|
1078 |
break;
|
1079 |
|
1080 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
1091 |
if (!empty($GLOBALS["ws_plugin__s2member_registration_return_url"]) && ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"]))
|
1092 |
|
1093 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $url)))
|
1094 |
+
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($role)), $url)))
|
1095 |
+
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($level)), $url)))
|
1096 |
+
if (($url = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($ccaps)), $url)))
|
1097 |
+
if (($url = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($auto_eot_time)), $url)))
|
1098 |
+
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($fname)), $url)))
|
1099 |
+
if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($lname)), $url)))
|
1100 |
+
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($name)), $url)))
|
1101 |
+
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($email)), $url)))
|
1102 |
+
if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($login)), $url)))
|
1103 |
+
if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($pass)), $url)))
|
1104 |
+
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($ip)), $url)))
|
1105 |
+
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode ($user_id)), $url)))
|
1106 |
{
|
1107 |
foreach ($fields as $var => $val) // Custom Fields.
|
1108 |
+
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (urlencode (maybe_serialize ($val))), $url)))
|
1109 |
break;
|
1110 |
|
1111 |
if (($url = trim ($url))) // Preserve remaining Replacements; because the parent routine may perform replacements too.
|
1135 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
1136 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
1137 |
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
1138 |
+
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . @$_SERVER["HTTP_USER_AGENT"];
|
1139 |
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
1140 |
$log2 = (is_multisite () && !is_main_site ()) ? "reg-handler-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "reg-handler.log";
|
1141 |
|
includes/classes/return-templates.inc.php
CHANGED
@@ -68,14 +68,14 @@ if (!class_exists ("c_ws_plugin__s2member_return_templates"))
|
|
68 |
$code = trim (((!$custom_template || !is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? c_ws_plugin__s2member_utilities::evl ($code) : $code));
|
69 |
|
70 |
$doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head (get_bloginfo ("name"), "ws_plugin__s2member_during_return_template_head_" . (($specific_template) ? basename ($specific_template) : "default-return.php"));
|
71 |
-
$code = preg_replace ("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::
|
72 |
|
73 |
-
$code = preg_replace ("/%%header%%/i", c_ws_plugin__s2member_utils_strings::
|
74 |
|
75 |
-
$code = preg_replace ("/%%response%%/i", c_ws_plugin__s2member_utils_strings::
|
76 |
-
$code = preg_replace ("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::
|
77 |
-
$code = preg_replace ("/%%support%%/i", c_ws_plugin__s2member_utils_strings::
|
78 |
-
$code = preg_replace ("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::
|
79 |
|
80 |
return apply_filters("ws_plugin__s2member_return_template", $code, get_defined_vars ());
|
81 |
}
|
68 |
$code = trim (((!$custom_template || !is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? c_ws_plugin__s2member_utilities::evl ($code) : $code));
|
69 |
|
70 |
$doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head (get_bloginfo ("name"), "ws_plugin__s2member_during_return_template_head_" . (($specific_template) ? basename ($specific_template) : "default-return.php"));
|
71 |
+
$code = preg_replace ("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (apply_filters("ws_plugin__s2member_return_template_doctype_html_head", $doctype_html_head, get_defined_vars ())), $code);
|
72 |
|
73 |
+
$code = preg_replace ("/%%header%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (apply_filters("ws_plugin__s2member_return_template_header", sprintf (_x ('[ %s ] <strong><em>says…</em></strong>', "s2member-front", "s2member"), esc_html ($_SERVER["HTTP_HOST"])), get_defined_vars ())), $code);
|
74 |
|
75 |
+
$code = preg_replace ("/%%response%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (apply_filters("ws_plugin__s2member_return_template_response", $response, get_defined_vars ())), $code);
|
76 |
+
$code = preg_replace ("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (apply_filters("ws_plugin__s2member_return_template_continue", '<a href="' . esc_attr ($continue_link) . '">' . $continue_html . '</a>', get_defined_vars ())), $code);
|
77 |
+
$code = preg_replace ("/%%support%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (apply_filters("ws_plugin__s2member_return_template_support", sprintf (_x ('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', "s2member-front", "s2member"), esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_support_link"])), get_defined_vars ())), $code);
|
78 |
+
$code = preg_replace ("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::esc_refs (apply_filters("ws_plugin__s2member_return_template_tracking", c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes (), get_defined_vars ())), $code);
|
79 |
|
80 |
return apply_filters("ws_plugin__s2member_return_template", $code, get_defined_vars ());
|
81 |
}
|
includes/classes/ruris.inc.php
CHANGED
@@ -99,12 +99,12 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
|
|
99 |
$user_ccaps = (string)implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
100 |
$user_logins = ($user) ? (string)(int)get_user_option ("s2member_login_counter", $user_id) : "-1";
|
101 |
|
102 |
-
$uris = (strlen ($user_login)) ? preg_replace ("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::
|
103 |
-
$uris = (strlen ($user_id)) ? preg_replace ("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::
|
104 |
-
$uris = (strlen ($user_level)) ? preg_replace ("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::
|
105 |
-
$uris = (strlen ($user_role)) ? preg_replace ("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::
|
106 |
-
$uris = (strlen ($user_ccaps)) ? preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::
|
107 |
-
$uris = (strlen ($user_logins)) ? preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::
|
108 |
|
109 |
return apply_filters("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
|
110 |
}
|
99 |
$user_ccaps = (string)implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
100 |
$user_logins = ($user) ? (string)(int)get_user_option ("s2member_login_counter", $user_id) : "-1";
|
101 |
|
102 |
+
$uris = (strlen ($user_login)) ? preg_replace ("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_login), $uris) : $uris;
|
103 |
+
$uris = (strlen ($user_id)) ? preg_replace ("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_id), $uris) : $uris;
|
104 |
+
$uris = (strlen ($user_level)) ? preg_replace ("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_level), $uris) : $uris;
|
105 |
+
$uris = (strlen ($user_role)) ? preg_replace ("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_role), $uris) : $uris;
|
106 |
+
$uris = (strlen ($user_ccaps)) ? preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_ccaps), $uris) : $uris;
|
107 |
+
$uris = (strlen ($user_logins)) ? preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_refs ($user_logins), $uris) : $uris;
|
108 |
|
109 |
return apply_filters("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
|
110 |
}
|
includes/classes/sc-paypal-button-e.inc.php
CHANGED
@@ -79,7 +79,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
|
|
79 |
$code = preg_replace ("/\<img[^\>]+\>/i", "", $code); // Remove 1x1 pixel tracking image that PayPal sticks in there.
|
80 |
$code = preg_replace ("/(\<input)([^\>]+)(\>)/ie", "'\\1'.rtrim(stripslashes('\\2'),'/').' /\\3'", $code); // Use XHTML!
|
81 |
|
82 |
-
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::
|
83 |
|
84 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
85 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
79 |
$code = preg_replace ("/\<img[^\>]+\>/i", "", $code); // Remove 1x1 pixel tracking image that PayPal sticks in there.
|
80 |
$code = preg_replace ("/(\<input)([^\>]+)(\>)/ie", "'\\1'.rtrim(stripslashes('\\2'),'/').' /\\3'", $code); // Use XHTML!
|
81 |
|
82 |
+
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["image"])) . '"', $code) : preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($default_image)) . '"', $code);
|
83 |
|
84 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
85 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
includes/classes/sc-paypal-button-in.inc.php
CHANGED
@@ -73,14 +73,14 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
73 |
$default_image = "https://www.paypal.com/" . (($attr["lang"]) ? $attr["lang"] : _x ("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_unsubscribe_LG.gif";
|
74 |
|
75 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.php")));
|
76 |
-
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::
|
77 |
-
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::
|
78 |
|
79 |
-
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::
|
80 |
-
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::
|
81 |
-
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::
|
82 |
|
83 |
-
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::
|
84 |
|
85 |
$code = ($attr["output"] === "anchor") ? /* Already in anchor format; `button` format is not used in Cancellations. */ $code : $code;
|
86 |
if ($attr["output"] === "url" && preg_match ('/ href\="(.*?)"/', $code, $m) && ($href = $m[1]))
|
@@ -110,35 +110,35 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
110 |
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
111 |
|
112 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.php")));
|
113 |
-
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::
|
114 |
-
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::
|
115 |
|
116 |
-
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::
|
117 |
-
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::
|
118 |
-
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::
|
119 |
-
$code = preg_replace ("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::
|
120 |
-
$code = preg_replace ("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::
|
121 |
-
$code = preg_replace ("/%%return%%/", c_ws_plugin__s2member_utils_strings::
|
122 |
-
$code = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::
|
123 |
|
124 |
-
$code = preg_replace ('/ name\="lc" value\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::
|
125 |
-
$code = preg_replace ('/ name\="no_shipping" value\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::
|
126 |
-
$code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::
|
127 |
-
$code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::
|
128 |
-
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::
|
129 |
-
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::
|
130 |
-
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::
|
131 |
|
132 |
-
$code = preg_replace ('/ name\="invoice" value\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::
|
133 |
|
134 |
-
$code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::
|
135 |
-
$code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::
|
136 |
-
$code = preg_replace ('/ name\="on1" value\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::
|
137 |
-
$code = preg_replace ('/ name\="os1" value\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::
|
138 |
|
139 |
-
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::
|
140 |
|
141 |
-
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::
|
142 |
|
143 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
144 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
@@ -166,35 +166,35 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
166 |
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
167 |
|
168 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-ccaps-checkout-button.php")));
|
169 |
-
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::
|
170 |
-
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::
|
171 |
|
172 |
-
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::
|
173 |
-
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::
|
174 |
-
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::
|
175 |
-
$code = preg_replace ("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::
|
176 |
-
$code = preg_replace ("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::
|
177 |
-
$code = preg_replace ("/%%return%%/", c_ws_plugin__s2member_utils_strings::
|
178 |
-
$code = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::
|
179 |
|
180 |
-
$code = preg_replace ('/ name\="lc" value\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::
|
181 |
-
$code = preg_replace ('/ name\="no_shipping" value\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::
|
182 |
-
$code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::
|
183 |
-
$code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::
|
184 |
-
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::
|
185 |
-
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::
|
186 |
-
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::
|
187 |
|
188 |
-
$code = preg_replace ('/ name\="invoice" value\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::
|
189 |
|
190 |
-
$code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::
|
191 |
-
$code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::
|
192 |
-
$code = preg_replace ('/ name\="on1" value\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::
|
193 |
-
$code = preg_replace ('/ name\="os1" value\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::
|
194 |
|
195 |
-
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::
|
196 |
|
197 |
-
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::
|
198 |
|
199 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
200 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
@@ -227,18 +227,18 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
227 |
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
228 |
|
229 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
|
230 |
-
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::
|
231 |
-
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::
|
232 |
-
|
233 |
-
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::
|
234 |
-
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::
|
235 |
-
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::
|
236 |
-
$code = preg_replace ("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::
|
237 |
-
$code = preg_replace ("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::
|
238 |
-
$code = preg_replace ("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::
|
239 |
-
$code = preg_replace ("/%%return%%/", c_ws_plugin__s2member_utils_strings::
|
240 |
-
$code = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::
|
241 |
-
$code = preg_replace ("/%%level%%/", c_ws_plugin__s2member_utils_strings::
|
242 |
|
243 |
$code = preg_replace ('/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/', " $1", $code);
|
244 |
$code = ($attr["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick$3", $code) : $code;
|
@@ -247,37 +247,37 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
247 |
$code = ($attr["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick-subscriptions$3", $code) : $code;
|
248 |
$code = ($attr["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
|
249 |
|
250 |
-
$code = preg_replace ('/ name\="lc" value\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::
|
251 |
-
$code = preg_replace ('/ name\="no_shipping" value\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::
|
252 |
-
$code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::
|
253 |
-
$code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::
|
254 |
-
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::
|
255 |
-
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::
|
256 |
-
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::
|
257 |
|
258 |
-
$code = preg_replace ('/ name\="invoice" value\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::
|
259 |
|
260 |
-
$code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::
|
261 |
-
$code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::
|
262 |
-
$code = preg_replace ('/ name\="on1" value\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::
|
263 |
-
$code = preg_replace ('/ name\="os1" value\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::
|
264 |
|
265 |
-
$code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::
|
266 |
|
267 |
-
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::
|
268 |
|
269 |
-
$code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::
|
270 |
-
$code = preg_replace ('/ name\="srt" value\="(.*?)"/', ' name="srt" value="' . c_ws_plugin__s2member_utils_strings::
|
271 |
-
$code = preg_replace ('/ name\="sra" value\="(.*?)"/', ' name="sra" value="' . c_ws_plugin__s2member_utils_strings::
|
272 |
|
273 |
-
$code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::
|
274 |
-
$code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . c_ws_plugin__s2member_utils_strings::
|
275 |
-
$code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . c_ws_plugin__s2member_utils_strings::
|
276 |
-
$code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . c_ws_plugin__s2member_utils_strings::
|
277 |
-
$code = preg_replace ('/ name\="p3" value\="(.*?)"/', ' name="p3" value="' . c_ws_plugin__s2member_utils_strings::
|
278 |
-
$code = preg_replace ('/ name\="t3" value\="(.*?)"/', ' name="t3" value="' . c_ws_plugin__s2member_utils_strings::
|
279 |
|
280 |
-
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::
|
281 |
|
282 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
283 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
73 |
$default_image = "https://www.paypal.com/" . (($attr["lang"]) ? $attr["lang"] : _x ("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_unsubscribe_LG.gif";
|
74 |
|
75 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.php")));
|
76 |
+
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
77 |
+
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ())), $code);
|
78 |
|
79 |
+
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
|
80 |
+
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
|
81 |
+
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $code);
|
82 |
|
83 |
+
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["image"])) . '"', $code) : preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($default_image)) . '"', $code);
|
84 |
|
85 |
$code = ($attr["output"] === "anchor") ? /* Already in anchor format; `button` format is not used in Cancellations. */ $code : $code;
|
86 |
if ($attr["output"] === "url" && preg_match ('/ href\="(.*?)"/', $code, $m) && ($href = $m[1]))
|
110 |
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
111 |
|
112 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.php")));
|
113 |
+
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
114 |
+
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ())), $code);
|
115 |
|
116 |
+
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
|
117 |
+
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
|
118 |
+
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $code);
|
119 |
+
$code = preg_replace ("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (home_url ("/"))), $code);
|
120 |
+
$code = preg_replace ("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ("/?s2member_paypal_notify=1"))), $code);
|
121 |
+
$code = preg_replace ("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($success_return_url)), $code);
|
122 |
+
$code = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["custom"])), $code);
|
123 |
|
124 |
+
$code = preg_replace ('/ name\="lc" value\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["lc"])) . '"', $code);
|
125 |
+
$code = preg_replace ('/ name\="no_shipping" value\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ns"])) . '"', $code);
|
126 |
+
$code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["desc"])) . '"', $code);
|
127 |
+
$code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["sp_ids_exp"])) . '"', $code);
|
128 |
+
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ps"])) . '"', $code);
|
129 |
+
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["cc"])) . '"', $code);
|
130 |
+
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["custom"])) . '"', $code);
|
131 |
|
132 |
+
$code = preg_replace ('/ name\="invoice" value\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_invoice_input_value)) . '"', $code);
|
133 |
|
134 |
+
$code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_on0_input_value)) . '"', $code);
|
135 |
+
$code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_os0_input_value)) . '"', $code);
|
136 |
+
$code = preg_replace ('/ name\="on1" value\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_on1_input_value)) . '"', $code);
|
137 |
+
$code = preg_replace ('/ name\="os1" value\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_os1_input_value)) . '"', $code);
|
138 |
|
139 |
+
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ra"])) . '"', $code);
|
140 |
|
141 |
+
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["image"])) . '"', $code) : preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($default_image)) . '"', $code);
|
142 |
|
143 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
144 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
166 |
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
167 |
|
168 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-ccaps-checkout-button.php")));
|
169 |
+
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
170 |
+
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ())), $code);
|
171 |
|
172 |
+
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
|
173 |
+
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
|
174 |
+
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $code);
|
175 |
+
$code = preg_replace ("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (home_url ("/"))), $code);
|
176 |
+
$code = preg_replace ("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ("/?s2member_paypal_notify=1"))), $code);
|
177 |
+
$code = preg_replace ("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($success_return_url)), $code);
|
178 |
+
$code = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["custom"])), $code);
|
179 |
|
180 |
+
$code = preg_replace ('/ name\="lc" value\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["lc"])) . '"', $code);
|
181 |
+
$code = preg_replace ('/ name\="no_shipping" value\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ns"])) . '"', $code);
|
182 |
+
$code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["desc"])) . '"', $code);
|
183 |
+
$code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["level_ccaps_eotper"])) . '"', $code);
|
184 |
+
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ps"])) . '"', $code);
|
185 |
+
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["cc"])) . '"', $code);
|
186 |
+
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["custom"])) . '"', $code);
|
187 |
|
188 |
+
$code = preg_replace ('/ name\="invoice" value\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_invoice_input_value)) . '"', $code);
|
189 |
|
190 |
+
$code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_on0_input_value)) . '"', $code);
|
191 |
+
$code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_os0_input_value)) . '"', $code);
|
192 |
+
$code = preg_replace ('/ name\="on1" value\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_on1_input_value)) . '"', $code);
|
193 |
+
$code = preg_replace ('/ name\="os1" value\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_os1_input_value)) . '"', $code);
|
194 |
|
195 |
+
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ra"])) . '"', $code);
|
196 |
|
197 |
+
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["image"])) . '"', $code) : preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($default_image)) . '"', $code);
|
198 |
|
199 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
200 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
227 |
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
228 |
|
229 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
|
230 |
+
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
231 |
+
$code = preg_replace ("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ())), $code);
|
232 |
+
|
233 |
+
$code = preg_replace ("/%%endpoint%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
|
234 |
+
$code = preg_replace ("/%%paypal_business%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
|
235 |
+
$code = preg_replace ("/%%paypal_merchant_id%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"])), $code);
|
236 |
+
$code = preg_replace ("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"])), $code);
|
237 |
+
$code = preg_replace ("/%%cancel_return%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (home_url ("/"))), $code); // This brings them back to Front Page.
|
238 |
+
$code = preg_replace ("/%%notify_url%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr (site_url ("/?s2member_paypal_notify=1"))), $code);
|
239 |
+
$code = preg_replace ("/%%return%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($success_return_url)), $code);
|
240 |
+
$code = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["custom"])), $code);
|
241 |
+
$code = preg_replace ("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["level"])), $code);
|
242 |
|
243 |
$code = preg_replace ('/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/', " $1", $code);
|
244 |
$code = ($attr["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick$3", $code) : $code;
|
247 |
$code = ($attr["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick-subscriptions$3", $code) : $code;
|
248 |
$code = ($attr["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
|
249 |
|
250 |
+
$code = preg_replace ('/ name\="lc" value\="(.*?)"/', ' name="lc" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["lc"])) . '"', $code);
|
251 |
+
$code = preg_replace ('/ name\="no_shipping" value\="(.*?)"/', ' name="no_shipping" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ns"])) . '"', $code);
|
252 |
+
$code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["desc"])) . '"', $code);
|
253 |
+
$code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["level_ccaps_eotper"])) . '"', $code);
|
254 |
+
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ps"])) . '"', $code);
|
255 |
+
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["cc"])) . '"', $code);
|
256 |
+
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["custom"])) . '"', $code);
|
257 |
|
258 |
+
$code = preg_replace ('/ name\="invoice" value\="(.*?)"/', ' name="invoice" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_invoice_input_value)) . '"', $code);
|
259 |
|
260 |
+
$code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_on0_input_value)) . '"', $code);
|
261 |
+
$code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_os0_input_value)) . '"', $code);
|
262 |
+
$code = preg_replace ('/ name\="on1" value\="(.*?)"/', ' name="on1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_on1_input_value)) . '"', $code);
|
263 |
+
$code = preg_replace ('/ name\="os1" value\="(.*?)"/', ' name="os1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($paypal_os1_input_value)) . '"', $code);
|
264 |
|
265 |
+
$code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["modify"])) . '"', $code);
|
266 |
|
267 |
+
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ra"])) . '"', $code);
|
268 |
|
269 |
+
$code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["rr"])) . '"', $code);
|
270 |
+
$code = preg_replace ('/ name\="srt" value\="(.*?)"/', ' name="srt" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["rrt"])) . '"', $code);
|
271 |
+
$code = preg_replace ('/ name\="sra" value\="(.*?)"/', ' name="sra" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["rra"])) . '"', $code);
|
272 |
|
273 |
+
$code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ta"])) . '"', $code);
|
274 |
+
$code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["tp"])) . '"', $code);
|
275 |
+
$code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["tt"])) . '"', $code);
|
276 |
+
$code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["ra"])) . '"', $code);
|
277 |
+
$code = preg_replace ('/ name\="p3" value\="(.*?)"/', ' name="p3" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["rp"])) . '"', $code);
|
278 |
+
$code = preg_replace ('/ name\="t3" value\="(.*?)"/', ' name="t3" value="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["rt"])) . '"', $code);
|
279 |
|
280 |
+
$code = $_code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($attr["image"])) . '"', $code) : preg_replace ('/ src\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs (esc_attr ($default_image)) . '"', $code);
|
281 |
|
282 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
283 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
includes/classes/tracking-codes.inc.php
CHANGED
@@ -1,258 +1,231 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Tracking Codes.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Tracking
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
* These are stored inside s2Member's Transient Queue by the IPN processor.
|
34 |
-
*
|
35 |
-
* Tracking Codes are only displayed/processed one time.
|
36 |
-
* s2Member will display Tracking Codes in (1) of these 4 locations:
|
37 |
-
*
|
38 |
-
* o On the Return URL / Thank-You Page, after returning from your Payment Gateway.
|
39 |
-
* o Otherwise, on the Registration Form, after returning from your Payment Gateway.
|
40 |
-
* o Otherwise, if possible, on the Login Form *(in the footer)* after Registration is completed.
|
41 |
-
* o Otherwise, in the footer of your WordPress theme, as soon as possible; or after the Customer's very first login.
|
42 |
-
*
|
43 |
-
* @package s2Member\Tracking
|
44 |
-
* @since 3.5
|
45 |
-
*
|
46 |
-
* @attaches-to ``add_action("login_footer");``
|
47 |
-
* @attaches-to ``add_action("wp_footer");``
|
48 |
-
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
49 |
-
*
|
50 |
-
* @return null After displaying possible Tracking Code(s).
|
51 |
-
*/
|
52 |
-
public static function display_signup_tracking_codes ()
|
53 |
-
{
|
54 |
-
do_action("ws_plugin__s2member_before_display_signup_tracking_codes", get_defined_vars ());
|
55 |
|
56 |
-
|
57 |
-
{
|
58 |
-
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $subscr_or_txn_id))))
|
59 |
-
{
|
60 |
-
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
61 |
|
62 |
-
|
|
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
unset($__refs, $__v);
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
echo do_shortcode (c_ws_plugin__s2member_utilities::evl ($code));
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
do_action("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars ());
|
80 |
-
|
81 |
-
return /* Return for uniformity. */;
|
82 |
-
}
|
83 |
-
/**
|
84 |
-
* Displays Modification Tracking Codes.
|
85 |
-
*
|
86 |
-
* These are stored inside s2Member's Transient Queue by the IPN processor.
|
87 |
-
*
|
88 |
-
* Tracking Codes are only displayed/processed one time.
|
89 |
-
* s2Member will display Tracking Codes in (1) of these 3 locations:
|
90 |
-
*
|
91 |
-
* o On the Return URL / Thank-You Page, after returning from your Payment Gateway.
|
92 |
-
* o Otherwise, if possible, on the Login Form *(in the footer)* after returning from your Payment Gateway.
|
93 |
-
* o Otherwise, in the footer of your WordPress theme, as soon as possible; or after the Customer's next login.
|
94 |
-
*
|
95 |
-
* @package s2Member\Tracking
|
96 |
-
* @since 110815
|
97 |
-
*
|
98 |
-
* @attaches-to ``add_action("login_footer");``
|
99 |
-
* @attaches-to ``add_action("wp_footer");``
|
100 |
-
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
101 |
-
*
|
102 |
-
* @return null After displaying possible Tracking Code(s).
|
103 |
-
*/
|
104 |
-
public static function display_modification_tracking_codes ()
|
105 |
-
{
|
106 |
-
do_action("ws_plugin__s2member_before_display_modification_tracking_codes", get_defined_vars ());
|
107 |
-
|
108 |
-
if ((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
109 |
-
{
|
110 |
-
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_modification_tracking_codes_" . $subscr_or_txn_id))))
|
111 |
-
{
|
112 |
-
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
113 |
-
|
114 |
-
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
115 |
-
|
116 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
117 |
-
do_action("ws_plugin__s2member_during_display_modification_tracking_codes", get_defined_vars ());
|
118 |
-
unset($__refs, $__v);
|
119 |
-
|
120 |
-
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
121 |
-
{
|
122 |
-
echo do_shortcode ($code) . "\n"; // No PHP here.
|
123 |
-
}
|
124 |
-
else // Otherwise, safe to allow PHP code.
|
125 |
-
{
|
126 |
-
echo do_shortcode (c_ws_plugin__s2member_utilities::evl ($code));
|
127 |
-
}
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
do_action("ws_plugin__s2member_after_display_modification_tracking_codes", get_defined_vars ());
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
{
|
162 |
-
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_ccap_tracking_codes_" . $subscr_or_txn_id))))
|
163 |
-
{
|
164 |
-
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
165 |
|
166 |
-
|
|
|
|
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
unset($__refs, $__v);
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
echo do_shortcode (c_ws_plugin__s2member_utilities::evl ($code));
|
179 |
-
}
|
180 |
-
}
|
181 |
-
}
|
182 |
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
-
|
186 |
-
}
|
187 |
-
/**
|
188 |
-
* Displays Specific Post/Page Tracking Codes.
|
189 |
-
*
|
190 |
-
* These are stored inside s2Member's Transient Queue, by BOTH the IPN & Return-Data processors.
|
191 |
-
*
|
192 |
-
* Specific Post/Page Tracking Codes are only displayed/processed one time.
|
193 |
-
* s2Member will display Tracking Codes in the footer of your theme.
|
194 |
-
*
|
195 |
-
* @package s2Member\Tracking
|
196 |
-
* @since 3.5
|
197 |
-
*
|
198 |
-
* @attaches-to ``add_action("login_footer");``
|
199 |
-
* @attaches-to ``add_action("wp_footer");``
|
200 |
-
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
201 |
-
*
|
202 |
-
* @return null After displaying possible Tracking Code(s).
|
203 |
-
*/
|
204 |
-
public static function display_sp_tracking_codes ()
|
205 |
-
{
|
206 |
-
do_action("ws_plugin__s2member_before_display_sp_tracking_codes", get_defined_vars ());
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
{
|
212 |
-
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
213 |
|
214 |
-
|
|
|
215 |
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
-
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
* Generates/returns all Tracking Codes integrated with s2Member.
|
237 |
-
*
|
238 |
-
* This method may be used in areas where s2Member needs to build tracking codes in a more dynamic way.
|
239 |
-
*
|
240 |
-
* @package s2Member\Tracking
|
241 |
-
* @since 110720
|
242 |
-
*
|
243 |
-
* @return string HTML output for all Tracking Codes integrated with s2Member.
|
244 |
-
*/
|
245 |
-
public static function generate_all_tracking_codes ()
|
246 |
-
{
|
247 |
-
ob_start /* Begin output buffering so we can "return". */ ();
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
c_ws_plugin__s2member_tracking_codes::display_ccap_tracking_codes ();
|
252 |
-
c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes ();
|
253 |
|
254 |
-
|
255 |
-
|
|
|
256 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Tracking Codes.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Tracking
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_tracking_codes"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Tracking Codes.
|
24 |
+
*
|
25 |
+
* @package s2Member\Tracking
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_tracking_codes
|
29 |
{
|
30 |
/**
|
31 |
+
* Displays Signup Tracking Codes.
|
32 |
+
*
|
33 |
+
* These are stored inside s2Member's Transient Queue by the IPN processor.
|
34 |
+
*
|
35 |
+
* Tracking Codes are only displayed/processed one time.
|
36 |
+
* s2Member will display Tracking Codes in (1) of these 4 locations:
|
37 |
+
*
|
38 |
+
* o On the Return URL / Thank-You Page, after returning from your Payment Gateway.
|
39 |
+
* o Otherwise, on the Registration Form, after returning from your Payment Gateway.
|
40 |
+
* o Otherwise, if possible, on the Login Form *(in the footer)* after Registration is completed.
|
41 |
+
* o Otherwise, in the footer of your WordPress theme, as soon as possible; or after the Customer's very first login.
|
42 |
+
*
|
43 |
+
* @package s2Member\Tracking
|
44 |
+
* @since 3.5
|
45 |
+
*
|
46 |
+
* @attaches-to ``add_action("login_footer");``
|
47 |
+
* @attaches-to ``add_action("wp_footer");``
|
48 |
+
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
49 |
+
*/
|
50 |
+
public static function display_signup_tracking_codes()
|
51 |
+
{
|
52 |
+
do_action("ws_plugin__s2member_before_display_signup_tracking_codes", get_defined_vars());
|
53 |
+
|
54 |
+
if((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
55 |
{
|
56 |
+
if(($code = get_transient($transient = "s2m_".md5("s2member_transient_signup_tracking_codes_".$subscr_or_txn_id))))
|
57 |
+
{
|
58 |
+
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
echo '<img src="'.esc_attr(site_url("/?s2member_delete_tracking_cookie=1")).'" alt="." style="width:1px; height:1px; border:0;" />'."\n";
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
63 |
+
do_action("ws_plugin__s2member_during_display_signup_tracking_codes", get_defined_vars());
|
64 |
+
unset($__refs, $__v);
|
65 |
|
66 |
+
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site())
|
67 |
+
echo do_shortcode($code)."\n"; // No PHP here.
|
|
|
68 |
|
69 |
+
else // Otherwise, safe to allow PHP code.
|
70 |
+
echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
|
71 |
+
}
|
72 |
+
}
|
73 |
+
do_action("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars());
|
74 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
/**
|
77 |
+
* Displays Modification Tracking Codes.
|
78 |
+
*
|
79 |
+
* These are stored inside s2Member's Transient Queue by the IPN processor.
|
80 |
+
*
|
81 |
+
* Tracking Codes are only displayed/processed one time.
|
82 |
+
* s2Member will display Tracking Codes in (1) of these 3 locations:
|
83 |
+
*
|
84 |
+
* o On the Return URL / Thank-You Page, after returning from your Payment Gateway.
|
85 |
+
* o Otherwise, if possible, on the Login Form *(in the footer)* after returning from your Payment Gateway.
|
86 |
+
* o Otherwise, in the footer of your WordPress theme, as soon as possible; or after the Customer's next login.
|
87 |
+
*
|
88 |
+
* @package s2Member\Tracking
|
89 |
+
* @since 110815
|
90 |
+
*
|
91 |
+
* @attaches-to ``add_action("login_footer");``
|
92 |
+
* @attaches-to ``add_action("wp_footer");``
|
93 |
+
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
94 |
+
*/
|
95 |
+
public static function display_modification_tracking_codes()
|
96 |
+
{
|
97 |
+
do_action("ws_plugin__s2member_before_display_modification_tracking_codes", get_defined_vars());
|
98 |
+
|
99 |
+
if((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
100 |
+
{
|
101 |
+
if(($code = get_transient($transient = "s2m_".md5("s2member_transient_modification_tracking_codes_".$subscr_or_txn_id))))
|
102 |
+
{
|
103 |
+
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
104 |
|
105 |
+
echo '<img src="'.esc_attr(site_url("/?s2member_delete_tracking_cookie=1")).'" alt="." style="width:1px; height:1px; border:0;" />'."\n";
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
108 |
+
do_action("ws_plugin__s2member_during_display_modification_tracking_codes", get_defined_vars());
|
109 |
+
unset($__refs, $__v);
|
110 |
|
111 |
+
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site())
|
112 |
+
echo do_shortcode($code)."\n"; // No PHP here.
|
|
|
113 |
|
114 |
+
else // Otherwise, safe to allow PHP code.
|
115 |
+
echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
|
116 |
+
}
|
117 |
+
}
|
118 |
+
do_action("ws_plugin__s2member_after_display_modification_tracking_codes", get_defined_vars());
|
119 |
+
}
|
|
|
|
|
|
|
|
|
120 |
|
121 |
+
/**
|
122 |
+
* Displays Capability Tracking Codes.
|
123 |
+
*
|
124 |
+
* These are stored inside s2Member's Transient Queue by the IPN processor.
|
125 |
+
*
|
126 |
+
* Tracking Codes are only displayed/processed one time.
|
127 |
+
* s2Member will display Tracking Codes in (1) of these 3 locations:
|
128 |
+
*
|
129 |
+
* o On the Return URL / Thank-You Page, after returning from your Payment Gateway.
|
130 |
+
* o Otherwise, if possible, on the Login Form *(in the footer)* after returning from your Payment Gateway.
|
131 |
+
* o Otherwise, in the footer of your WordPress theme, as soon as possible; or after the Customer's next login.
|
132 |
+
*
|
133 |
+
* @package s2Member\Tracking
|
134 |
+
* @since 110815
|
135 |
+
*
|
136 |
+
* @attaches-to ``add_action("login_footer");``
|
137 |
+
* @attaches-to ``add_action("wp_footer");``
|
138 |
+
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
139 |
+
*/
|
140 |
+
public static function display_ccap_tracking_codes()
|
141 |
+
{
|
142 |
+
do_action("ws_plugin__s2member_before_display_ccap_tracking_codes", get_defined_vars());
|
143 |
+
|
144 |
+
if((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
145 |
+
{
|
146 |
+
if(($code = get_transient($transient = "s2m_".md5("s2member_transient_ccap_tracking_codes_".$subscr_or_txn_id))))
|
147 |
+
{
|
148 |
+
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
149 |
|
150 |
+
echo '<img src="'.esc_attr(site_url("/?s2member_delete_tracking_cookie=1")).'" alt="." style="width:1px; height:1px; border:0;" />'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
153 |
+
do_action("ws_plugin__s2member_during_display_ccap_tracking_codes", get_defined_vars());
|
154 |
+
unset($__refs, $__v);
|
|
|
|
|
155 |
|
156 |
+
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site())
|
157 |
+
echo do_shortcode($code)."\n"; // No PHP here.
|
158 |
|
159 |
+
else // Otherwise, safe to allow PHP code.
|
160 |
+
echo do_shortcode(c_ws_plugin__s2member_utilities::evl($code));
|
161 |
+
}
|
162 |
+
}
|
163 |
+
do_action("ws_plugin__s2member_after_display_ccap_tracking_codes", get_defined_vars());
|
164 |
+
}
|
165 |
|
166 |
+
/**
|
167 |
+
* Displays Specific Post/Page Tracking Codes.
|
168 |
+
*
|
169 |
+
* These are stored inside s2Member's Transient Queue, by BOTH the IPN & Return-Data processors.
|
170 |
+
*
|
171 |
+
* Specific Post/Page Tracking Codes are only displayed/processed one time.
|
172 |
+
* s2Member will display Tracking Codes in the footer of your theme.
|
173 |
+
*
|
174 |
+
* @package s2Member\Tracking
|
175 |
+
* @since 3.5
|
176 |
+
*
|
177 |
+
* @attaches-to ``add_action("login_footer");``
|
178 |
+
* @attaches-to ``add_action("wp_footer");``
|
179 |
+
* @also-called-by {@link s2Member\Tracking\c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes()}
|
180 |
+
*
|
181 |
+
* @return null After displaying possible Tracking Code(s).
|
182 |
+
*/
|
183 |
+
public static function display_sp_tracking_codes()
|
184 |
+
{
|
185 |
+
do_action("ws_plugin__s2member_before_display_sp_tracking_codes", get_defined_vars());
|
186 |
+
|
187 |
+
if(!empty($_COOKIE["s2member_sp_tracking"]) && ($txn_id = c_ws_plugin__s2member_utils_encryption::decrypt($_COOKIE["s2member_sp_tracking"])))
|
188 |
+
{
|
189 |
+
if(($code = get_transient($transient = "s2m_".md5("s2member_transient_sp_tracking_codes_".$txn_id))))
|
190 |
+
{
|
191 |
+
delete_transient($transient); // Only display this ONE time. Delete transient immediately.
|
192 |
|
193 |
+
echo '<img src="'.esc_attr(site_url("/?s2member_delete_sp_tracking_cookie=1")).'" alt="." style="width:1px; height:1px; border:0;" />'."\n";
|
194 |
|
195 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
196 |
+
do_action("ws_plugin__s2member_during_display_sp_tracking_codes", get_defined_vars());
|
197 |
+
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
+
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site())
|
200 |
+
echo $code."\n"; // No PHP here.
|
|
|
|
|
201 |
|
202 |
+
else // Otherwise, it's safe to allow PHP code.
|
203 |
+
eval("?>".$code);
|
204 |
+
}
|
205 |
}
|
206 |
+
do_action("ws_plugin__s2member_after_display_sp_tracking_codes", get_defined_vars());
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Generates/returns all Tracking Codes integrated with s2Member.
|
211 |
+
*
|
212 |
+
* This method may be used in areas where s2Member needs to build tracking codes in a more dynamic way.
|
213 |
+
*
|
214 |
+
* @package s2Member\Tracking
|
215 |
+
* @since 110720
|
216 |
+
*
|
217 |
+
* @return string HTML output for all Tracking Codes integrated with s2Member.
|
218 |
+
*/
|
219 |
+
public static function generate_all_tracking_codes()
|
220 |
+
{
|
221 |
+
ob_start(); // Begin output buffering so we can "return".
|
222 |
+
|
223 |
+
c_ws_plugin__s2member_tracking_codes::display_signup_tracking_codes();
|
224 |
+
c_ws_plugin__s2member_tracking_codes::display_modification_tracking_codes();
|
225 |
+
c_ws_plugin__s2member_tracking_codes::display_ccap_tracking_codes();
|
226 |
+
c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes();
|
227 |
+
|
228 |
+
return apply_filters("ws_plugin__s2member_generate_all_tracking_codes", ob_get_clean(), get_defined_vars());
|
229 |
+
}
|
230 |
}
|
231 |
+
}
|
includes/classes/tracking-cookies-in.inc.php
CHANGED
@@ -1,104 +1,98 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Tracking Cookies (inner processing routines).
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Tracking
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
if (!empty($_GET["s2member_delete_sp_tracking_cookie"])) // Deletes cookie.
|
81 |
-
{
|
82 |
-
setcookie ("s2member_sp_tracking", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
83 |
-
setcookie ("s2member_sp_tracking", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
84 |
-
|
85 |
-
do_action("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
|
86 |
-
|
87 |
-
@ini_set ("zlib.output_compression", 0);
|
88 |
-
if(function_exists("apache_setenv"))
|
89 |
-
@apache_setenv("no-gzip", "1");
|
90 |
-
|
91 |
-
status_header (200); // Send a 200 OK status header.
|
92 |
-
|
93 |
-
header ("Content-Type: image/png"); // Content-Type image/png for 1px transparency.
|
94 |
-
|
95 |
-
while (@ob_end_clean ()); // Clean any existing output buffers.
|
96 |
-
|
97 |
-
exit (file_get_contents (dirname (dirname (dirname (__FILE__))) . "/images/trans-1px.png"));
|
98 |
-
}
|
99 |
-
|
100 |
-
do_action("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
|
101 |
-
}
|
102 |
}
|
|
|
|
|
103 |
}
|
104 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Tracking Cookies (inner processing routines).
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Tracking
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_tracking_cookies_in"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Tracking Cookies (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Tracking
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_tracking_cookies_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Deletes s2Member's temporary tracking cookie.
|
32 |
+
*
|
33 |
+
* @package s2Member\Tracking
|
34 |
+
* @since 110815
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*/
|
38 |
+
public static function delete_tracking_cookie()
|
39 |
+
{
|
40 |
+
do_action("ws_plugin__s2member_before_delete_tracking_cookie", get_defined_vars());
|
41 |
+
|
42 |
+
if(!empty($_GET["s2member_delete_tracking_cookie"])) // Deletes cookie.
|
43 |
{
|
44 |
+
setcookie("s2member_tracking", "", time() + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
45 |
+
setcookie("s2member_tracking", "", time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
46 |
+
|
47 |
+
do_action("ws_plugin__s2member_during_delete_tracking_cookie", get_defined_vars());
|
48 |
+
|
49 |
+
@ini_set("zlib.output_compression", 0);
|
50 |
+
if(function_exists("apache_setenv"))
|
51 |
+
@apache_setenv("no-gzip", "1");
|
52 |
+
|
53 |
+
status_header(200); // Send a 200 OK status header.
|
54 |
+
|
55 |
+
header("Content-Type: image/png"); // Content-Type image/png for 1px transparency.
|
56 |
+
|
57 |
+
while(@ob_end_clean()) ; // Clean any existing output buffers.
|
58 |
+
|
59 |
+
exit (file_get_contents(dirname(dirname(dirname(__FILE__)))."/images/trans-1px.png"));
|
60 |
+
}
|
61 |
+
do_action("ws_plugin__s2member_after_delete_tracking_cookie", get_defined_vars());
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Deletes s2Member's temporary tracking cookie.
|
66 |
+
*
|
67 |
+
* @package s2Member\Tracking
|
68 |
+
* @since 3.5
|
69 |
+
*
|
70 |
+
* @attaches-to ``add_action("init");``
|
71 |
+
*/
|
72 |
+
public static function delete_sp_tracking_cookie()
|
73 |
+
{
|
74 |
+
do_action("ws_plugin__s2member_before_delete_sp_tracking_cookie", get_defined_vars());
|
75 |
+
|
76 |
+
if(!empty($_GET["s2member_delete_sp_tracking_cookie"])) // Deletes cookie.
|
77 |
+
{
|
78 |
+
setcookie("s2member_sp_tracking", "", time() + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
79 |
+
setcookie("s2member_sp_tracking", "", time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
80 |
+
|
81 |
+
do_action("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars());
|
82 |
+
|
83 |
+
@ini_set("zlib.output_compression", 0);
|
84 |
+
if(function_exists("apache_setenv"))
|
85 |
+
@apache_setenv("no-gzip", "1");
|
86 |
+
|
87 |
+
status_header(200); // Send a 200 OK status header.
|
88 |
+
|
89 |
+
header("Content-Type: image/png"); // Content-Type image/png for 1px transparency.
|
90 |
+
|
91 |
+
while(@ob_end_clean()) ; // Clean any existing output buffers.
|
92 |
+
|
93 |
+
exit (file_get_contents(dirname(dirname(dirname(__FILE__)))."/images/trans-1px.png"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
+
do_action("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars());
|
96 |
+
}
|
97 |
}
|
98 |
+
}
|
includes/classes/tracking-cookies.inc.php
CHANGED
@@ -1,66 +1,58 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Tracking Cookies.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Tracking
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
*
|
50 |
-
* @package s2Member\Tracking
|
51 |
-
* @since 3.5
|
52 |
-
*
|
53 |
-
* @attaches-to ``add_action("init");``
|
54 |
-
*
|
55 |
-
* @return null|inner Return-value of inner routine.
|
56 |
-
*/
|
57 |
-
public static function delete_sp_tracking_cookie ()
|
58 |
-
{
|
59 |
-
if (!empty($_GET["s2member_delete_sp_tracking_cookie"]))
|
60 |
-
{
|
61 |
-
return c_ws_plugin__s2member_tracking_cookies_in::delete_sp_tracking_cookie ();
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
}
|
66 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Tracking Cookies.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Tracking
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_tracking_cookies"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Tracking Cookies.
|
24 |
+
*
|
25 |
+
* @package s2Member\Tracking
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_tracking_cookies
|
29 |
{
|
30 |
/**
|
31 |
+
* Deletes s2Member's temporary tracking cookie.
|
32 |
+
*
|
33 |
+
* @package s2Member\Tracking
|
34 |
+
* @since 110815
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*/
|
38 |
+
public static function delete_tracking_cookie()
|
39 |
+
{
|
40 |
+
if(!empty($_GET["s2member_delete_tracking_cookie"]))
|
41 |
+
c_ws_plugin__s2member_tracking_cookies_in::delete_tracking_cookie();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Deletes s2Member's temporary tracking cookie.
|
46 |
+
*
|
47 |
+
* @package s2Member\Tracking
|
48 |
+
* @since 3.5
|
49 |
+
*
|
50 |
+
* @attaches-to ``add_action("init");``
|
51 |
+
*/
|
52 |
+
public static function delete_sp_tracking_cookie()
|
53 |
+
{
|
54 |
+
if(!empty($_GET["s2member_delete_sp_tracking_cookie"]))
|
55 |
+
c_ws_plugin__s2member_tracking_cookies_in::delete_sp_tracking_cookie();
|
56 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
+
}
|
includes/classes/translations.inc.php
CHANGED
@@ -1,174 +1,168 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member translations.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Translations
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null
|
39 |
-
*/
|
40 |
-
public static function load ()
|
41 |
-
{
|
42 |
-
load_plugin_textdomain ("s2member", false, c_ws_plugin__s2member_utils_dirs::rel_path (WP_PLUGIN_DIR, dirname (dirname (__FILE__)) . "/translations"));
|
43 |
-
load_plugin_textdomain ("s2member"); // Allows `.mo` file to be loaded from the `/wp-content/plugins/s2member-[locale].mo`.
|
44 |
-
|
45 |
-
do_action("ws_plugin__s2member_during_translations_load", get_defined_vars ());
|
46 |
-
|
47 |
-
add_filter ("gettext", "c_ws_plugin__s2member_translations::translation_mangler", 10, 3);
|
48 |
-
|
49 |
-
}
|
50 |
-
/**
|
51 |
-
* Handles internal translations via `gettext` Filter.
|
52 |
-
*
|
53 |
-
* Important note. Because this routine also uses translation functionality by WordPress,
|
54 |
-
* anything translated by this routine MUST be different, otherwise it will result in a recursive loop,
|
55 |
-
* because the ``__()`` family of functions would be called upon recursively by this routine.
|
56 |
-
*
|
57 |
-
* If you're translating s2Member into a different language, your MO file for s2Member will automagically deal with
|
58 |
-
* everything you see below. No worries. Just build your translation file for s2Member, and you're all set.
|
59 |
-
*
|
60 |
-
* @package s2Member\Translations
|
61 |
-
* @since 3.5
|
62 |
-
*
|
63 |
-
* @attaches-to ``add_filter("gettext");``
|
64 |
-
*
|
65 |
-
* @param string $translated Expects already-translated string passed in by Filter.
|
66 |
-
* @param string $original Expects original text string passed in by Filter.
|
67 |
-
* @param string $domain Expects translation domain passed in by Filter.
|
68 |
-
* @return string Translated string, possibly modified by this routine.
|
69 |
-
*/
|
70 |
-
public static function translation_mangler ($translated = FALSE, $original = FALSE, $domain = FALSE)
|
71 |
-
{
|
72 |
-
global $current_site, $current_blog; // In support of Multisite Networking.
|
73 |
-
static $s = array(); // This static array optimizes all of these routines.
|
74 |
|
75 |
-
|
76 |
-
{
|
77 |
-
if ($original === "Username") // Give Filters a chance here.
|
78 |
-
{
|
79 |
-
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Username:", "s2member-front", "s2member"), get_defined_vars ());
|
80 |
-
}
|
81 |
-
else if ($original === "Password") // Give Filters a chance here.
|
82 |
-
{
|
83 |
-
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("My Password:", "s2member-front", "s2member"), get_defined_vars ());
|
84 |
-
}
|
85 |
-
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
if ($original === "Username") // Give Filters a chance here.
|
90 |
-
{
|
91 |
-
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Username *", "s2member-front", "s2member"), get_defined_vars ());
|
92 |
-
}
|
93 |
-
else if ($original === "Password") // Give Filters a chance here.
|
94 |
-
{
|
95 |
-
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Password *", "s2member-front", "s2member"), get_defined_vars ());
|
96 |
-
}
|
97 |
-
else if ($original === "E-mail") // Give Filters a chance here.
|
98 |
-
{
|
99 |
-
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Email Address *", "s2member-front", "s2member"), get_defined_vars ());
|
100 |
-
}
|
101 |
-
}
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
{
|
129 |
-
if ($original === "If you’re not going to use a great site domain, leave it for a new user. Now have at it!")
|
130 |
-
{
|
131 |
-
$translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars ());
|
132 |
-
}
|
133 |
-
else if ($original === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!")
|
134 |
-
{
|
135 |
-
if (is_user_logged_in () && !(is_main_site () && current_user_can ("create_users")) && !is_super_admin () && is_object ($user = wp_get_current_user ()) && $user->ID && is_object ($user = new WP_User ($user->ID, $current_site->blog_id)) && $user->ID)
|
136 |
-
{
|
137 |
-
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
138 |
-
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
139 |
-
$user_blogs = (is_array($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
|
140 |
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
}
|
147 |
-
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
|
164 |
-
|
165 |
|
166 |
-
|
167 |
-
}
|
168 |
-
}
|
169 |
-
}
|
170 |
-
return $translated; // No Filters.
|
171 |
}
|
|
|
172 |
}
|
|
|
|
|
173 |
}
|
174 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member translations.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Translations
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_translations"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member translations.
|
24 |
+
*
|
25 |
+
* @package s2Member\Translations
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_translations
|
29 |
{
|
30 |
/**
|
31 |
+
* Loads s2Member's text domain for translations.
|
32 |
+
*
|
33 |
+
* @package s2Member\Translations
|
34 |
+
* @since 110815
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*
|
38 |
+
* @return null
|
39 |
+
*/
|
40 |
+
public static function load()
|
41 |
+
{
|
42 |
+
load_plugin_textdomain("s2member", FALSE, c_ws_plugin__s2member_utils_dirs::rel_path(WP_PLUGIN_DIR, dirname(dirname(__FILE__))."/translations"));
|
43 |
+
load_plugin_textdomain("s2member"); // Allows `.mo` file to be loaded from the `/wp-content/plugins/s2member-[locale].mo`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
do_action("ws_plugin__s2member_during_translations_load", get_defined_vars());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
+
add_filter("gettext", "c_ws_plugin__s2member_translations::translation_mangler", 10, 3);
|
48 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
/**
|
51 |
+
* Handles internal translations via `gettext` Filter.
|
52 |
+
*
|
53 |
+
* Important note. Because this routine also uses translation functionality by WordPress,
|
54 |
+
* anything translated by this routine MUST be different, otherwise it will result in a recursive loop,
|
55 |
+
* because the ``__()`` family of functions would be called upon recursively by this routine.
|
56 |
+
*
|
57 |
+
* If you're translating s2Member into a different language, your MO file for s2Member will automagically deal with
|
58 |
+
* everything you see below. No worries. Just build your translation file for s2Member, and you're all set.
|
59 |
+
*
|
60 |
+
* @package s2Member\Translations
|
61 |
+
* @since 3.5
|
62 |
+
*
|
63 |
+
* @attaches-to ``add_filter("gettext");``
|
64 |
+
*
|
65 |
+
* @param string $translated Expects already-translated string passed in by Filter.
|
66 |
+
* @param string $original Expects original text string passed in by Filter.
|
67 |
+
* @param string $domain Expects translation domain passed in by Filter.
|
68 |
+
*
|
69 |
+
* @return string Translated string, possibly modified by this routine.
|
70 |
+
*/
|
71 |
+
public static function translation_mangler($translated = '', $original = '', $domain = '')
|
72 |
+
{
|
73 |
+
global $current_site, $current_blog; // In support of Multisite Networking.
|
74 |
+
static $s = array(); // This static array optimizes all of these routines.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
if((isset ($s["is_wp_login"]) && $s["is_wp_login"]) || (!isset ($s["is_wp_login"]) && ($s["is_wp_login"] = (strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== FALSE && empty($_REQUEST["action"]) && empty($_REQUEST["checkemail"])) ? TRUE : FALSE)))
|
77 |
+
{
|
78 |
+
if($original === "Username") // Give Filters a chance here.
|
79 |
+
{
|
80 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Username:", "s2member-front", "s2member"), get_defined_vars());
|
81 |
+
}
|
82 |
+
else if($original === "Password") // Give Filters a chance here.
|
83 |
+
{
|
84 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("My Password:", "s2member-front", "s2member"), get_defined_vars());
|
85 |
+
}
|
86 |
+
}
|
87 |
+
else if((isset ($s["is_wp_login_register"]) && $s["is_wp_login_register"]) || (!isset ($s["is_wp_login_register"]) && ($s["is_wp_login_register"] = (strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== FALSE && !empty($_REQUEST["action"]) && $_REQUEST["action"] === "register") ? TRUE : FALSE)))
|
88 |
+
{
|
89 |
+
if($original === "Username") // Give Filters a chance here.
|
90 |
+
{
|
91 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Username *", "s2member-front", "s2member"), get_defined_vars());
|
92 |
+
}
|
93 |
+
else if($original === "Password") // Give Filters a chance here.
|
94 |
+
{
|
95 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Password *", "s2member-front", "s2member"), get_defined_vars());
|
96 |
+
}
|
97 |
+
else if($original === "E-mail") // Give Filters a chance here.
|
98 |
+
{
|
99 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Email Address *", "s2member-front", "s2member"), get_defined_vars());
|
100 |
+
}
|
101 |
+
}
|
102 |
+
else if((isset ($s["is_wp_login_checkemail"]) && $s["is_wp_login_checkemail"]) || (!isset ($s["is_wp_login_checkemail"]) && ($s["is_wp_login_checkemail"] = (strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== FALSE && empty($_REQUEST["action"]) && !empty($_REQUEST["checkemail"]) && $_REQUEST["checkemail"] === "registered") ? TRUE : FALSE)))
|
103 |
+
{
|
104 |
+
if($original === "Registration complete. Please check your e-mail." && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
|
105 |
+
{
|
106 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Registration complete. Please log in.", "s2member-front", "s2member"), get_defined_vars());
|
107 |
+
}
|
108 |
+
}
|
109 |
+
else if((isset ($s["is_user_new"]) && $s["is_user_new"]) || (!isset ($s["is_user_new"]) && ($s["is_user_new"] = (strpos($_SERVER["REQUEST_URI"], "/wp-admin/user-new.php") !== FALSE) ? TRUE : FALSE)))
|
110 |
+
{
|
111 |
+
if($original === "Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n" && !empty($_REQUEST["role"]) && preg_match("/^(subscriber|s2member_level[0-9]+)$/", $_REQUEST["role"]))
|
112 |
+
{
|
113 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("You have been invited to join `%1\$s` at\n%2\$s as a Member.\nPlease click the following link to confirm the invite:\n%4\$s\n", "s2member-front", "s2member"), get_defined_vars());
|
114 |
+
}
|
115 |
+
}
|
116 |
+
else if((isset ($s["is_wp_activate"]) && $s["is_wp_activate"]) || (!isset ($s["is_wp_activate"]) && ($s["is_wp_activate"] = (strpos($_SERVER["REQUEST_URI"], "/wp-activate.php") !== FALSE) ? TRUE : FALSE)))
|
117 |
+
{
|
118 |
+
if($original === 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>')
|
119 |
+
{
|
120 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x('Your account is now active. <a href="%1$s">Visit site</a> or <a href="%2$s">Log in</a>.', "s2member-front", "s2member"), get_defined_vars());
|
121 |
+
}
|
122 |
+
}
|
123 |
+
else if((isset ($s["is_wp_signup"]) && $s["is_wp_signup"]) || (!isset ($s["is_wp_signup"]) && ($s["is_wp_signup"] = (strpos($_SERVER["REQUEST_URI"], "/wp-signup.php") !== FALSE) ? TRUE : FALSE)))
|
124 |
+
{
|
125 |
+
if($original === "If you’re not going to use a great site domain, leave it for a new user. Now have at it!")
|
126 |
+
{
|
127 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars());
|
128 |
+
}
|
129 |
+
else if($original === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!")
|
130 |
+
{
|
131 |
+
if(is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User ($user->ID, $current_site->blog_id)) && $user->ID)
|
132 |
+
{
|
133 |
+
$mms_options = c_ws_plugin__s2member_utilities::mms_options();
|
134 |
+
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level".c_ws_plugin__s2member_user_access::user_access_level($user)];
|
135 |
+
$user_blogs = (is_array($blogs = get_blogs_of_user($user->ID))) ? count($blogs) - 1 : 0;
|
136 |
|
137 |
+
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
138 |
+
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
|
|
|
|
139 |
|
140 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member").(($blogs_allowed > 1) ? '<br />'.sprintf(_nx('You may create <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars());
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
else if((isset ($s["is_bp_blog_creation"]) && $s["is_bp_blog_creation"]) || (!isset ($s["is_bp_blog_creation"]) && ($s["is_bp_blog_creation"] = (c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_create_blog()) ? TRUE : FALSE)))
|
145 |
+
{
|
146 |
+
if($original === "If you’re not going to use a great domain, leave it for a new user. Now have at it!")
|
147 |
+
{
|
148 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars());
|
149 |
+
}
|
150 |
+
else if($original === "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!")
|
151 |
+
{
|
152 |
+
if(is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User ($user->ID, $current_site->blog_id)) && $user->ID)
|
153 |
+
{
|
154 |
+
$mms_options = c_ws_plugin__s2member_utilities::mms_options();
|
155 |
+
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level".c_ws_plugin__s2member_user_access::user_access_level($user)];
|
156 |
+
$user_blogs = (is_array($blogs = get_blogs_of_user($user->ID))) ? count($blogs) - 1 : 0;
|
157 |
|
158 |
+
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
159 |
+
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
160 |
|
161 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member").(($blogs_allowed > 1) ? '<br />'.sprintf(_nx('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars());
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
+
}
|
164 |
}
|
165 |
+
return $translated; // No Filters.
|
166 |
+
}
|
167 |
}
|
168 |
+
}
|
includes/classes/user-access.inc.php
CHANGED
@@ -37,11 +37,11 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
37 |
* @package s2Member\User_Access
|
38 |
* @since 3.5
|
39 |
*
|
40 |
-
* @param
|
41 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
42 |
* @return string Role ID/Name, or an empty string if they have no Role, or if ``$user`` does not exist, or if no User is currently logged-in.
|
43 |
*/
|
44 |
-
public static function user_access_role ($user =
|
45 |
{
|
46 |
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
47 |
{
|
@@ -60,11 +60,11 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
60 |
* @package s2Member\User_Access
|
61 |
* @since 3.5
|
62 |
*
|
63 |
-
* @param
|
64 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
65 |
* @return array Array of Custom Capabilities, or an empty array if they have no Custom Capabilities, or if ``$user`` does not exist, or if no User is currently logged-in.
|
66 |
*/
|
67 |
-
public static function user_access_ccaps ($user =
|
68 |
{
|
69 |
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
70 |
{
|
37 |
* @package s2Member\User_Access
|
38 |
* @since 3.5
|
39 |
*
|
40 |
+
* @param \WP_User $user Optional. A `WP_User` object. Defaults to the current User.
|
41 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
42 |
* @return string Role ID/Name, or an empty string if they have no Role, or if ``$user`` does not exist, or if no User is currently logged-in.
|
43 |
*/
|
44 |
+
public static function user_access_role ($user = NULL)
|
45 |
{
|
46 |
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
47 |
{
|
60 |
* @package s2Member\User_Access
|
61 |
* @since 3.5
|
62 |
*
|
63 |
+
* @param \WP_User $user Optional. A `WP_User` object. Defaults to the current User.
|
64 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
65 |
* @return array Array of Custom Capabilities, or an empty array if they have no Custom Capabilities, or if ``$user`` does not exist, or if no User is currently logged-in.
|
66 |
*/
|
67 |
+
public static function user_access_ccaps ($user = NULL)
|
68 |
{
|
69 |
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
70 |
{
|
includes/classes/user-deletions.inc.php
CHANGED
@@ -1,226 +1,221 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* User deletion routines.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\User_Deletions
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
$msg
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
|
192 |
-
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
193 |
-
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
|
194 |
-
if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $msg)))
|
195 |
-
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
196 |
-
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
197 |
-
{
|
198 |
-
if (is_array($fields) && !empty($fields))
|
199 |
-
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
200 |
-
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
201 |
-
break;
|
202 |
-
|
203 |
-
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
204 |
-
|
205 |
-
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
206 |
-
wp_mail ($recipient, apply_filters("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
207 |
-
}
|
208 |
-
|
209 |
-
if ($email_configs_were_on) // Back on?
|
210 |
-
c_ws_plugin__s2member_email_configs::email_config ();
|
211 |
-
}
|
212 |
-
|
213 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
214 |
-
do_action("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
|
215 |
-
unset($__refs, $__v);
|
216 |
-
}
|
217 |
-
|
218 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
219 |
-
do_action("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
|
220 |
-
unset($__refs, $__v);
|
221 |
-
|
222 |
-
return /* Return for uniformity. */;
|
223 |
-
}
|
224 |
}
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* User deletion routines.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\User_Deletions
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_user_deletions'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* User deletion routines.
|
24 |
+
*
|
25 |
+
* @package s2Member\User_Deletions
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_user_deletions
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Multisite User removal deletions.
|
32 |
+
*
|
33 |
+
* @package s2Member\User_Deletions
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('remove_user_from_blog');``
|
37 |
+
*
|
38 |
+
* @param int|string $user_id Numeric WordPress User ID.
|
39 |
+
* @param int|string $blog_id Numeric WordPress Blog ID.
|
40 |
+
* @param bool $s2says Optional. Defaults to false. If true, it's definitely OK to process this deletion?
|
41 |
+
* The ``$s2says`` flag can be used when/if the routine is called directly for whatever reason.
|
42 |
+
*/
|
43 |
+
public static function handle_ms_user_deletions($user_id = 0, $blog_id = 0, $s2says = FALSE)
|
44 |
+
{
|
45 |
+
static $processed = array(); // No duplicate processing.
|
46 |
+
global $pagenow; // Need this to detect the current admin page.
|
47 |
+
|
48 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
49 |
+
do_action('ws_plugin__s2member_before_handle_ms_user_deletions', get_defined_vars());
|
50 |
+
unset($__refs, $__v);
|
51 |
+
|
52 |
+
if($user_id && is_multisite() && empty($processed[$user_id]) && ($s2says || (is_blog_admin() && $pagenow === 'users.php')))
|
53 |
{
|
54 |
+
$processed[$user_id] = TRUE;
|
55 |
+
|
56 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
57 |
+
do_action('ws_plugin__s2member_during_handle_ms_user_deletions_before', get_defined_vars());
|
58 |
+
unset($__refs, $__v);
|
59 |
+
|
60 |
+
c_ws_plugin__s2member_user_deletions::handle_user_deletions($user_id);
|
61 |
+
|
62 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
63 |
+
do_action('ws_plugin__s2member_during_handle_ms_user_deletions_after', get_defined_vars());
|
64 |
+
unset($__refs, $__v);
|
65 |
+
}
|
66 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
67 |
+
do_action('ws_plugin__s2member_after_handle_ms_user_deletions', get_defined_vars());
|
68 |
+
unset($__refs, $__v);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Handles User removals/deletions.
|
73 |
+
*
|
74 |
+
* @package s2Member\User_Deletions
|
75 |
+
* @since 3.5
|
76 |
+
*
|
77 |
+
* @attaches-to ``add_action('delete_user');``
|
78 |
+
* @attaches-to ``add_action('wpmu_delete_user');``
|
79 |
+
*
|
80 |
+
* @param int|string $user_id Numeric WordPress User ID.
|
81 |
+
*/
|
82 |
+
public static function handle_user_deletions($user_id = 0)
|
83 |
+
{
|
84 |
+
static $processed = array(); // No duplicate processing.
|
85 |
+
|
86 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
87 |
+
do_action('ws_plugin__s2member_before_handle_user_deletions', get_defined_vars());
|
88 |
+
unset($__refs, $__v);
|
89 |
+
|
90 |
+
if($user_id && empty($processed[$user_id]) && ($processed[$user_id] = TRUE))
|
91 |
+
{
|
92 |
+
$eot_del_type = // Configure EOT/DEL type (possibly through this global variable).
|
93 |
+
(!empty($GLOBALS['ws_plugin__s2member_eot_del_type'])) ? // Is the global available for use?
|
94 |
+
$GLOBALS['ws_plugin__s2member_eot_del_type'] : 'user-removal-deletion'; // Else use default.
|
95 |
+
|
96 |
+
$custom = get_user_option('s2member_custom', $user_id);
|
97 |
+
$subscr_id = get_user_option('s2member_subscr_id', $user_id);
|
98 |
+
$subscr_baid = get_user_option('s2member_subscr_baid', $user_id);
|
99 |
+
$subscr_cid = get_user_option('s2member_subscr_cid', $user_id);
|
100 |
+
$fields = get_user_option('s2member_custom_fields', $user_id);
|
101 |
+
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
|
102 |
+
|
103 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
104 |
+
do_action('ws_plugin__s2member_during_handle_user_before_deletions', get_defined_vars());
|
105 |
+
do_action('ws_plugin__s2member_during_collective_eots', $user_id, get_defined_vars(), $eot_del_type, 'removal-deletion');
|
106 |
+
unset($__refs, $__v);
|
107 |
+
|
108 |
+
delete_user_option($user_id, 's2member_custom');
|
109 |
+
delete_user_option($user_id, 's2member_subscr_id');
|
110 |
+
delete_user_option($user_id, 's2member_subscr_baid');
|
111 |
+
delete_user_option($user_id, 's2member_subscr_cid');
|
112 |
+
delete_user_option($user_id, 's2member_subscr_gateway');
|
113 |
+
|
114 |
+
delete_user_option($user_id, 's2member_custom_fields');
|
115 |
+
delete_user_option($user_id, 's2member_registration_ip');
|
116 |
+
|
117 |
+
delete_user_option($user_id, 's2member_ipn_signup_vars');
|
118 |
+
delete_user_option($user_id, 's2member_paid_registration_times');
|
119 |
+
delete_user_option($user_id, 's2member_access_cap_times');
|
120 |
+
delete_user_option($user_id, 's2member_sp_references');
|
121 |
+
|
122 |
+
delete_user_option($user_id, 's2member_last_status_scan');
|
123 |
+
delete_user_option($user_id, 's2member_first_payment_txn_id');
|
124 |
+
delete_user_option($user_id, 's2member_last_payment_time');
|
125 |
+
delete_user_option($user_id, 's2member_auto_eot_time');
|
126 |
+
|
127 |
+
delete_user_option($user_id, 's2member_file_download_access_arc');
|
128 |
+
delete_user_option($user_id, 's2member_file_download_access_log');
|
129 |
+
|
130 |
+
delete_user_option($user_id, 's2member_login_counter');
|
131 |
+
delete_user_option($user_id, 's2member_notes');
|
132 |
+
|
133 |
+
if(is_object($user = new WP_User ($user_id)) && $user->ID && $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls'] && is_array($cv = preg_split('/\|/', $custom)))
|
134 |
+
{
|
135 |
+
foreach(preg_split("/[\r\n\t]+/", $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) as $url) // Handle EOT Notifications on user deletion.
|
136 |
+
|
137 |
+
if(($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%eot_del_type%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($eot_del_type)), $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($subscr_id)), $url)))
|
138 |
+
if(($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($subscr_baid)), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($subscr_cid)), $url)))
|
139 |
+
if(($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url)))
|
140 |
+
if(($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name.' '.$user->last_name))), $url)))
|
141 |
+
if(($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)))
|
142 |
+
if(($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)))
|
143 |
+
if(($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)))
|
144 |
+
if(($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)))
|
145 |
+
{
|
146 |
+
if(is_array($fields) && !empty($fields))
|
147 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
148 |
+
if(!($url = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url)))
|
149 |
+
break;
|
150 |
+
|
151 |
+
if(($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))))
|
152 |
+
c_ws_plugin__s2member_utils_urls::remote($url);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
if(is_object($user = new WP_User ($user_id)) && $user->ID && $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_recipients'] && is_array($cv = preg_split('/\|/', $custom)))
|
156 |
+
{
|
157 |
+
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
|
158 |
+
c_ws_plugin__s2member_email_configs::email_config_release();
|
159 |
+
|
160 |
+
$msg = $sbj = '(s2Member / API Notification Email) - EOT/Deletion';
|
161 |
+
$msg .= "\n\n"; // Spacing in the message body.
|
162 |
+
|
163 |
+
$msg .= 'eot_del_type: %%eot_del_type%%'."\n";
|
164 |
+
$msg .= 'subscr_id: %%subscr_id%%'."\n";
|
165 |
+
$msg .= 'subscr_baid: %%subscr_baid%%'."\n";
|
166 |
+
$msg .= 'subscr_cid: %%subscr_cid%%'."\n";
|
167 |
+
$msg .= 'user_first_name: %%user_first_name%%'."\n";
|
168 |
+
$msg .= 'user_last_name: %%user_last_name%%'."\n";
|
169 |
+
$msg .= 'user_full_name: %%user_full_name%%'."\n";
|
170 |
+
$msg .= 'user_email: %%user_email%%'."\n";
|
171 |
+
$msg .= 'user_login: %%user_login%%'."\n";
|
172 |
+
$msg .= 'user_ip: %%user_ip%%'."\n";
|
173 |
+
$msg .= 'user_id: %%user_id%%'."\n";
|
174 |
+
|
175 |
+
if(is_array($fields) && !empty($fields))
|
176 |
+
foreach($fields as $var => $val)
|
177 |
+
$msg .= $var.': %%'.$var.'%%'."\n";
|
178 |
+
|
179 |
+
$msg .= 'cv0: %%cv0%%'."\n";
|
180 |
+
$msg .= 'cv1: %%cv1%%'."\n";
|
181 |
+
$msg .= 'cv2: %%cv2%%'."\n";
|
182 |
+
$msg .= 'cv3: %%cv3%%'."\n";
|
183 |
+
$msg .= 'cv4: %%cv4%%'."\n";
|
184 |
+
$msg .= 'cv5: %%cv5%%'."\n";
|
185 |
+
$msg .= 'cv6: %%cv6%%'."\n";
|
186 |
+
$msg .= 'cv7: %%cv7%%'."\n";
|
187 |
+
$msg .= 'cv8: %%cv8%%'."\n";
|
188 |
+
$msg .= 'cv9: %%cv9%%';
|
189 |
+
|
190 |
+
if(($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) && ($msg = preg_replace('/%%eot_del_type%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($eot_del_type), $msg)) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($subscr_id), $msg)))
|
191 |
+
if(($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($subscr_baid), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($subscr_cid), $msg)))
|
192 |
+
if(($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) && ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)))
|
193 |
+
if(($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name.' '.$user->last_name)), $msg)))
|
194 |
+
if(($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)))
|
195 |
+
if(($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)))
|
196 |
+
if(($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $msg)))
|
197 |
+
if(($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)))
|
198 |
+
{
|
199 |
+
if(is_array($fields) && !empty($fields))
|
200 |
+
foreach($fields as $var => $val /* Custom Registration/Profile Fields. */)
|
201 |
+
if(!($msg = preg_replace('/%%'.preg_quote($var, '/').'%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg)))
|
202 |
+
break;
|
203 |
+
|
204 |
+
if($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
205 |
+
|
206 |
+
foreach(c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_recipients']) as $recipient)
|
207 |
+
wp_mail($recipient, apply_filters('ws_plugin__s2member_eot_del_notification_email_sbj', $sbj, get_defined_vars()), apply_filters('ws_plugin__s2member_eot_del_notification_email_msg', $msg, get_defined_vars()), 'Content-Type: text/plain; charset=UTF-8');
|
208 |
+
}
|
209 |
+
if($email_configs_were_on) // Back on?
|
210 |
+
c_ws_plugin__s2member_email_configs::email_config();
|
211 |
+
}
|
212 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
213 |
+
do_action('ws_plugin__s2member_during_handle_user_deletions', get_defined_vars());
|
214 |
+
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
217 |
+
do_action('ws_plugin__s2member_after_handle_user_deletions', get_defined_vars());
|
218 |
+
unset($__refs, $__v);
|
219 |
+
}
|
220 |
}
|
221 |
+
}
|
includes/classes/user-securities.inc.php
CHANGED
@@ -1,143 +1,149 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* User securities.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\User_Securities
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
* @attaches-to ``add_action("init");``
|
41 |
-
*
|
42 |
-
* @return null
|
43 |
-
*/
|
44 |
-
public static function initialize () // Initializes the Filter for `user_has_cap`.
|
45 |
-
{
|
46 |
-
add_filter ("user_has_cap", "c_ws_plugin__s2member_user_securities::user_capabilities", 10, 3);
|
47 |
-
}
|
48 |
-
/**
|
49 |
-
* Alters `WP_User->has_cap()` in special cases for Administrators.
|
50 |
-
*
|
51 |
-
* @package s2Member\User_Securities
|
52 |
-
* @since 110815
|
53 |
-
*
|
54 |
-
* @attaches-to ``add_filter("user_has_cap");``
|
55 |
-
*
|
56 |
-
* @param array $capabilities Expects an array of Capabilities passed in by the Filter.
|
57 |
-
* This array contains all of the Capabilities that the User has *( i.e. ``$user->allcaps`` )*.
|
58 |
-
* @param array $caps_map An array of Capabilities mapped out by the ``map_meta_cap`` function.
|
59 |
-
* @param array $args Array of arguments originally passed through the ``has_cap()`` function.
|
60 |
-
* However, WordPress modifies this array of arguments in the following way.
|
61 |
-
* Argument `[0]` is the Capability test string itself *(this is normal)*.
|
62 |
-
* Argument `[1]` is added by WordPress; it's the ID of the User.
|
63 |
-
* Other arguments starting from array index `[2]` are normal.
|
64 |
-
* @return array An array of Capabilities.
|
65 |
-
*/
|
66 |
-
public static function user_capabilities ($capabilities = FALSE, $caps_map = FALSE, $args = FALSE)
|
67 |
-
{
|
68 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
-
do_action("ws_plugin__s2member_before_user_capabilities", get_defined_vars ());
|
70 |
-
unset($__refs, $__v);
|
71 |
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
-
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
$capabilities = array_merge ((array)$capabilities, array("edit_users" => 1));
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
$allow = true; // Yes, allow Administrators to edit User Profiles.
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
136 |
-
|
137 |
-
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
}
|
142 |
}
|
143 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* User securities.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\User_Securities
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_user_securities'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* User securities.
|
24 |
+
*
|
25 |
+
* @package s2Member\User_Securities
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_user_securities
|
29 |
{
|
30 |
/**
|
31 |
+
* Initializes Filter for `user_has_cap`.
|
32 |
+
*
|
33 |
+
* It's very important that this is NOT attached before WordPress creates `$current_user` via `$wp->init()`.
|
34 |
+
* This prevents crashes when other plugins attempt to call upon `current_user_can()` before WordPress is initialized.
|
35 |
+
* For instance, some plugins attempt to use `current_user_can()` on the `plugins_loaded` Hook, which they should not do.
|
36 |
+
*
|
37 |
+
* @package s2Member\User_Securities
|
38 |
+
* @since 3.5
|
39 |
+
*
|
40 |
+
* @attaches-to ``add_action('init');``
|
41 |
+
*
|
42 |
+
* @return null
|
43 |
+
*/
|
44 |
+
public static function initialize() // Initializes the Filter for `user_has_cap`.
|
45 |
+
{
|
46 |
+
add_filter('user_has_cap', 'c_ws_plugin__s2member_user_securities::user_capabilities', 10, 3);
|
47 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
/**
|
50 |
+
* Alters `WP_User->has_cap()` in special cases for Administrators.
|
51 |
+
*
|
52 |
+
* @package s2Member\User_Securities
|
53 |
+
* @since 110815
|
54 |
+
*
|
55 |
+
* @attaches-to ``add_filter('user_has_cap');``
|
56 |
+
*
|
57 |
+
* @param array $capabilities Expects an array of Capabilities passed in by the Filter.
|
58 |
+
* This array contains all of the Capabilities that the User has *( i.e. ``$user->allcaps`` )*.
|
59 |
+
* @param array $caps_map An array of Capabilities mapped out by the ``map_meta_cap`` function.
|
60 |
+
* @param array $args Array of arguments originally passed through the ``has_cap()`` function.
|
61 |
+
* However, WordPress modifies this array of arguments in the following way.
|
62 |
+
* Argument `[0]` is the Capability test string itself *(this is normal)*.
|
63 |
+
* Argument `[1]` is added by WordPress; it's the ID of the User.
|
64 |
+
* Other arguments starting from array index `[2]` are normal.
|
65 |
+
*
|
66 |
+
* @return array An array of Capabilities.
|
67 |
+
*/
|
68 |
+
public static function user_capabilities($capabilities, $caps_map, $args)
|
69 |
+
{
|
70 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
71 |
+
do_action('ws_plugin__s2member_before_user_capabilities', get_defined_vars());
|
72 |
+
unset($__refs, $__v);
|
73 |
+
|
74 |
+
if(!empty($capabilities['access_s2member_ccap_all_ccaps']) && !empty($args[0]) && preg_match('/^access_s2member_ccap_/i', $args[0]) && apply_filters('ws_plugin__s2member_all_ccaps_enable', TRUE, get_defined_vars()))
|
75 |
+
$capabilities = array_merge((array)$capabilities, array($args[0] => 1));
|
76 |
+
|
77 |
+
else if(!is_multisite() && !empty($capabilities['administrator']) && !empty($args[0]) && preg_match('/^access_s2member_ccap_/i', $args[0]) && apply_filters('ws_plugin__s2member_admins_have_all_ccaps', TRUE, get_defined_vars()))
|
78 |
+
$capabilities = array_merge((array)$capabilities, array($args[0] => 1));
|
79 |
|
80 |
+
else if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && (is_super_admin() || !empty($capabilities['administrator'])) && !empty($args[0]) && ($args[0] === 'edit_user' || $args[0] === 'edit_users'))
|
81 |
+
if($args[0] === 'edit_users' || ($args[0] === 'edit_user' && !empty($args[2]) && ((!empty($args[1]) && (int)$args[1] === (int)$args[2]) || is_user_member_of_blog($args[2]))))
|
82 |
+
$capabilities = array_merge((array)$capabilities, array('edit_users' => 1));
|
83 |
|
84 |
+
return apply_filters('ws_plugin__s2member_user_capabilities', $capabilities, get_defined_vars());
|
85 |
+
}
|
|
|
86 |
|
87 |
+
/**
|
88 |
+
* Alters this Filter inside `/wp-admin/user-edit.php`.
|
89 |
+
*
|
90 |
+
* @package s2Member\User_Securities
|
91 |
+
* @since 3.5
|
92 |
+
*
|
93 |
+
* @attaches-to ``add_filter('enable_edit_any_user_configuration');``
|
94 |
+
*
|
95 |
+
* @param bool $allow Expects boolean value passed through by the Filter.
|
96 |
+
*
|
97 |
+
* @return bool True if the current User is allowed to edit any User, else existing value.
|
98 |
+
*/
|
99 |
+
public static function ms_allow_edits($allow = FALSE)
|
100 |
+
{
|
101 |
+
global $user_id; // Available inside `/wp-admin/user-edit.php`.
|
102 |
+
|
103 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
104 |
+
do_action('ws_plugin__s2member_before_ms_allow_edits', get_defined_vars());
|
105 |
+
unset($__refs, $__v);
|
106 |
|
107 |
+
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm())
|
108 |
+
if(is_super_admin() || (current_user_can('administrator') && $user_id && is_user_member_of_blog($user_id)))
|
109 |
+
$allow = TRUE; // Yes, allow Administrators to edit User Profiles.
|
110 |
|
111 |
+
return apply_filters('ws_plugin__s2member_ms_allow_edits', $allow, get_defined_vars());
|
112 |
+
}
|
|
|
113 |
|
114 |
+
/**
|
115 |
+
* Hides Password fields for Demo Users; and deals with Password fields on Multisite Blog Farms.
|
116 |
+
*
|
117 |
+
* Demo accounts *( where the Username MUST be 'demo' )*, will NOT be allowed to change their Password.
|
118 |
+
* Any other restrictions you need to impose must be done through custom programming, using s2Member's Conditionals.
|
119 |
+
* See `s2Member -› API Scripting`.
|
120 |
+
*
|
121 |
+
* @package s2Member\User_Securities
|
122 |
+
* @since 3.5
|
123 |
+
*
|
124 |
+
* @attaches-to ``add_filter('show_password_fields');``
|
125 |
+
*
|
126 |
+
* @param bool $show Expects boolean value passed through by the Filter.
|
127 |
+
* @param WP_User $user Expects a `WP_User` object passed through by the Filter.
|
128 |
+
* If this is NOT passed (it isn't always), then we assume the current user.
|
129 |
+
*
|
130 |
+
* @return bool False if the Password is locked for this User, else existing value.
|
131 |
+
*/
|
132 |
+
public static function hide_password_fields($show, $user = NULL)
|
133 |
+
{
|
134 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
135 |
+
do_action('ws_plugin__s2member_before_hide_password_fields', get_defined_vars());
|
136 |
+
unset($__refs, $__v);
|
137 |
|
138 |
+
if($show && is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm())
|
139 |
+
if(!is_super_admin() && is_object($user) && !empty($user->ID) && is_object($current_user = wp_get_current_user()) && !empty($current_user->ID))
|
140 |
+
if($user->ID !== $current_user->ID)
|
141 |
+
$show = FALSE;
|
142 |
|
143 |
+
if($show && is_object($user) && !empty($user->ID) && $user->user_login === 'demo')
|
144 |
+
$show = FALSE; // Lock Password on Demos.
|
145 |
|
146 |
+
return apply_filters('ws_plugin__s2member_hide_password_fields', $show, get_defined_vars());
|
147 |
+
}
|
|
|
148 |
}
|
149 |
+
}
|
includes/classes/users-list-in.inc.php
CHANGED
@@ -88,7 +88,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
88 |
unset($__refs, $__v);
|
89 |
|
90 |
echo '<tr>'."\n";
|
91 |
-
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway
|
92 |
echo '<td><select name="ws_plugin__s2member_profile_s2member_subscr_gateway" id="ws-plugin--s2member-profile-s2member-subscr-gateway" style="width:25em;"><option value=""></option>'."\n";
|
93 |
foreach(apply_filters("ws_plugin__s2member_profile_s2member_subscr_gateways", array("paypal" => "PayPal (code: paypal)"), get_defined_vars()) as $gateway => $gateway_name)
|
94 |
echo '<option value="'.esc_attr($gateway).'"'.(($gateway === get_user_option("s2member_subscr_gateway", $user_id)) ? ' selected="selected"' : '').'>'.esc_html($gateway_name).'</option>'."\n";
|
@@ -105,7 +105,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
105 |
unset($__refs, $__v);
|
106 |
|
107 |
echo '<tr>'."\n";
|
108 |
-
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as
|
109 |
echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_subscr_id" id="ws-plugin--s2member-profile-s2member-subscr-id" value="'.format_to_edit(get_user_option("s2member_subscr_id", $user_id)).'" class="regular-text" /></td>'."\n";
|
110 |
echo '</tr>'."\n";
|
111 |
|
@@ -113,6 +113,22 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
113 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars());
|
114 |
unset($__refs, $__v);
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
117 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars());
|
118 |
unset($__refs, $__v);
|
88 |
unset($__refs, $__v);
|
89 |
|
90 |
echo '<tr>'."\n";
|
91 |
+
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway Code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.\\n\\nThis will be filled automatically by s2Member. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID can be a PayPal Standard Subscription ID, or a PayPal Pro Recurring Profile ID, or a PayPal Transaction ID; depending on the type of sale. Your PayPal account will supply this information.\\n\\nIf you are using Stripe, please use the customer\\\'s Subscription ID (if applicable); else a Charge ID or an Invoice ID.\\n\\nIf you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID.\\n\\nThe general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
92 |
echo '<td><select name="ws_plugin__s2member_profile_s2member_subscr_gateway" id="ws-plugin--s2member-profile-s2member-subscr-gateway" style="width:25em;"><option value=""></option>'."\n";
|
93 |
foreach(apply_filters("ws_plugin__s2member_profile_s2member_subscr_gateways", array("paypal" => "PayPal (code: paypal)"), get_defined_vars()) as $gateway => $gateway_name)
|
94 |
echo '<option value="'.esc_attr($gateway).'"'.(($gateway === get_user_option("s2member_subscr_gateway", $user_id)) ? ' selected="selected"' : '').'>'.esc_html($gateway_name).'</option>'."\n";
|
105 |
unset($__refs, $__v);
|
106 |
|
107 |
echo '<tr>'."\n";
|
108 |
+
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.\\n\\nThis will be filled automatically by s2Member. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID can be a PayPal Standard Subscription ID, or a PayPal Pro Recurring Profile ID, or a PayPal Transaction ID; depending on the type of sale. Your PayPal account will supply this information.\\n\\nIf you are using Stripe, please use the customer\\\'s Subscription ID (if applicable); else a Charge ID or an Invoice ID.\\n\\nIf you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID.\\n\\nThe general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
109 |
echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_subscr_id" id="ws-plugin--s2member-profile-s2member-subscr-id" value="'.format_to_edit(get_user_option("s2member_subscr_id", $user_id)).'" class="regular-text" /></td>'."\n";
|
110 |
echo '</tr>'."\n";
|
111 |
|
113 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars());
|
114 |
unset($__refs, $__v);
|
115 |
|
116 |
+
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
117 |
+
if(in_array('stripe', $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_gateways_enabled']))
|
118 |
+
{
|
119 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
120 |
+
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_cid", get_defined_vars());
|
121 |
+
unset($__refs, $__v);
|
122 |
+
|
123 |
+
echo '<tr>'."\n";
|
124 |
+
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-cid">Paid Subscr. CID:</label> <a href="#" onclick="alert(\'A Paid Subscription CID; i.e. a Customer\\\'s ID. Applicable only with Stripe integration. s2Member fills this in automatically. This is the Customer\\\'s ID in Stripe, which remains constant throughout any & all future payments. Each Stripe Customer has this Customer ID; and also a Subscription and/or Transaction ID.\\n\\nIn all other cases, the Paid Subscr. CID is simply set to the Paid Subscr. ID value; i.e. it is a duplicate of Paid Subscr. ID when running anything other than Stripe.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID/CID manually.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
125 |
+
echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_subscr_cid" id="ws-plugin--s2member-profile-s2member-subscr-cid" value="'.format_to_edit(get_user_option("s2member_subscr_cid", $user_id)).'" class="regular-text" /></td>'."\n";
|
126 |
+
echo '</tr>'."\n";
|
127 |
+
|
128 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
129 |
+
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_cid", get_defined_vars());
|
130 |
+
unset($__refs, $__v);
|
131 |
+
}
|
132 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
133 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars());
|
134 |
unset($__refs, $__v);
|
includes/classes/utils-logs.inc.php
CHANGED
@@ -1,223 +1,229 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Log utilities.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Utilities
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
'/reg-handler/' => array('short' => 'User registrations processed by s2Member.', 'long' => 'This log file records all User/Member registrations processed by s2Member (either directly or indirectly). This includes both free and paid registrations. It also logs registrations that occur as a result of new Users/Members being created from the Dashboard by a site owner. It also includes registrations that occur through the s2Member Pro Remote Operations API.'),
|
67 |
-
|
68 |
-
'/s2-http-api-debug/' => array('short' => 'All outgoing HTTP connections related to s2Member.', 'long' => 'This log file records all outgoing WP_Http connections that are specifically related to s2Member. This log file can be extremely helpful. It includes technical details about remote HTTP connections that are not available in other log files.'),
|
69 |
-
'/wp-http-api-debug/' => array('short' => 'All outgoing WordPress HTTP connections.', 'long' => 'This log file records all outgoing HTTP connections processed by the WP_Http class. This includes everything processed by WordPress; even things unrelated to s2Member. This log file can be extremely helpful. It includes technical details about remote HTTP connections that are not available in other log files.'),
|
70 |
-
);
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Logs HTTP communication (if enabled).
|
74 |
-
*
|
75 |
-
* @package s2Member\Utilities
|
76 |
-
* @since 120212
|
77 |
-
*
|
78 |
-
* @return null Nothing.
|
79 |
-
*/
|
80 |
-
public static function http_api_debug ($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
|
81 |
-
{
|
82 |
-
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
83 |
-
return; // Logging is NOT enabled in this case.
|
84 |
-
|
85 |
-
$is_s2member = (!empty($args["s2member"]) || strpos($url, "s2member") !== false) ? true : false;
|
86 |
-
|
87 |
-
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"] && !$is_s2member)
|
88 |
-
return; // Extensive logging is NOT enabled in this case.
|
89 |
-
|
90 |
-
global /* For Multisite support. */ $current_site, $current_blog;
|
91 |
-
|
92 |
-
$http_api_debug = array(
|
93 |
-
"state" => $state,
|
94 |
-
"transport_class" => $class,
|
95 |
-
"args" => $args,
|
96 |
-
"url" => $url,
|
97 |
-
"response" => $response
|
98 |
-
);
|
99 |
-
|
100 |
-
$logt = c_ws_plugin__s2member_utilities::time_details();
|
101 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
102 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
103 |
-
|
104 |
-
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
|
105 |
-
$log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
|
106 |
-
$log2 = (is_multisite () && !is_main_site ()) ? "http-api-debug-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "http-api-debug.log";
|
107 |
-
|
108 |
-
$http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export ($http_api_debug, true));
|
109 |
-
|
110 |
-
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
111 |
-
if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
|
112 |
-
{
|
113 |
-
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"])
|
114 |
-
file_put_contents ($logs_dir . "/wp-" . $log2,
|
115 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
116 |
-
$http_api_debug_conceal_private_info . "\n\n",
|
117 |
-
FILE_APPEND);
|
118 |
-
|
119 |
-
if($is_s2member) // Log s2Member HTTP connections separately.
|
120 |
-
file_put_contents ($logs_dir . "/s2-" . $log2,
|
121 |
-
"LOG ENTRY: ".$logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" .
|
122 |
-
$http_api_debug_conceal_private_info . "\n\n",
|
123 |
-
FILE_APPEND);
|
124 |
-
}
|
125 |
-
}
|
126 |
-
/**
|
127 |
-
* Archives logs to prevent HUGE files from building up over time.
|
128 |
-
*
|
129 |
-
* This routine is staggered to conserve resources.
|
130 |
-
* This is called by all logging routines for s2Member.
|
131 |
-
*
|
132 |
-
* @package s2Member\Utilities
|
133 |
-
* @since 3.5
|
134 |
-
*
|
135 |
-
* @param bool $stagger Optional. Defaults to true. If false, the routine will run, regardless.
|
136 |
-
* @return bool Always returns true.
|
137 |
-
*/
|
138 |
-
public static function archive_oversize_log_files ($stagger = TRUE)
|
139 |
-
{
|
140 |
-
if (!$stagger || is_float ($stagger = time () / 2)) // Stagger this routine?
|
141 |
-
{
|
142 |
-
if (is_dir ($dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]) && is_writable ($dir))
|
143 |
-
{
|
144 |
-
$max = apply_filters("ws_plugin__s2member_oversize_log_file_bytes", 2097152, get_defined_vars ());
|
145 |
-
|
146 |
-
$log_files = scandir ($dir); shuffle($log_files); $counter = 1;
|
147 |
-
|
148 |
-
foreach ($log_files as $file) // Go through each log file. Up to 25 files at a time.
|
149 |
-
{
|
150 |
-
if (preg_match ("/\.log$/i", $file) && !preg_match ("/-ARCHIVED-/i", $file) && is_file ($dir_file = $dir . "/" . $file))
|
151 |
-
{
|
152 |
-
if (filesize ($dir_file) > $max && is_writable ($dir_file)) // The file must be writable.
|
153 |
-
if ($log = preg_replace ("/\.log$/i", "", $dir_file)) // Strip .log before renaming.
|
154 |
-
rename ($dir_file, $log . "-ARCHIVED-" . date ("m-d-Y") . "-" . time () . ".log");
|
155 |
-
}
|
156 |
-
|
157 |
-
if (($counter = $counter + 1) > 25) // Up to 25 files at a time.
|
158 |
-
break; // Stop for now.
|
159 |
-
}
|
160 |
-
}
|
161 |
-
}
|
162 |
-
return true;
|
163 |
-
}
|
164 |
-
/**
|
165 |
-
* Removes expired Transients inserted into the database by s2Member.
|
166 |
-
*
|
167 |
-
* This routine is staggered to conserve resources.
|
168 |
-
* Only 5 Transients are deleted each time.
|
169 |
-
*
|
170 |
-
* This is called by s2Member's Auto-EOT System, every 10 minutes.
|
171 |
-
*
|
172 |
-
* @package s2Member\Utilities
|
173 |
-
* @since 3.5
|
174 |
-
*
|
175 |
-
* @param bool $stagger Optional. Defaults to true. If false, the routine will run, regardless.
|
176 |
-
* @return bool Always returns true.
|
177 |
-
*/
|
178 |
-
public static function cleanup_expired_s2m_transients ($stagger = TRUE)
|
179 |
-
{
|
180 |
-
global $wpdb; // Will need this for database cleaning.
|
181 |
-
|
182 |
-
if (!$stagger || is_float ($stagger = time () / 2)) // Stagger this routine?
|
183 |
-
{
|
184 |
-
if (is_array($expired_s2m_transients = $wpdb->get_results ("SELECT * FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_timeout_s2m_")) . "%' AND `option_value` < '" . esc_sql (time ()) . "' LIMIT 5")) && !empty($expired_s2m_transients))
|
185 |
-
{
|
186 |
-
foreach ($expired_s2m_transients as $expired_s2m_transient) // Delete the _timeout, and also the Transient entry name itself.
|
187 |
-
if (($id = $expired_s2m_transient->option_id) && ($name = preg_replace ("/_transient_timeout_/i", "_transient_", $expired_s2m_transient->option_name, 1)))
|
188 |
-
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_id` = '" . esc_sql ($id) . "' OR `option_name` = '" . esc_sql ($name) . "'");
|
189 |
-
}
|
190 |
-
}
|
191 |
-
return true;
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Attempts to conceal private details in log entries.
|
196 |
-
*
|
197 |
-
* @package s2Member\Utilities
|
198 |
-
* @since 130315
|
199 |
-
*
|
200 |
-
* @param string $log_entry The log entry we need to conceal private details in.
|
201 |
-
* @return string Filtered string with some data X'd out :-)
|
202 |
-
*/
|
203 |
-
public static function conceal_private_info($log_entry)
|
204 |
-
{
|
205 |
-
$log_entry = preg_replace('/\b([3456][0-9]{10,11})([0-9]{4})\b/', 'xxxxxxxxxxxx'.'$2', (string)$log_entry);
|
206 |
-
|
207 |
-
$log_entry = preg_replace('/(\'.*pass_?(?:word)?(?:[0-9]+)?\'\s*\=\>\s*\')([^\']+)(\')/', '$1'.'xxxxxxxx/pass'.'$3', $log_entry);
|
208 |
-
$log_entry = preg_replace('/([&?][^&]*pass_?(?:word)?(?:[0-9]+)?\=)([^&]+)/', '$1'.'xxxxxxxx/pass', $log_entry);
|
209 |
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
-
|
217 |
-
|
|
|
218 |
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Log utilities.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Utilities
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
18 |
+
exit ('Do not access this file directly.');
|
19 |
+
|
20 |
+
if(!class_exists('c_ws_plugin__s2member_utils_logs'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Log utilities.
|
24 |
+
*
|
25 |
+
* @package s2Member\Utilities
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_utils_logs
|
29 |
{
|
30 |
/**
|
31 |
+
* Array of log file descriptions.
|
32 |
+
*
|
33 |
+
* @package s2Member\Utilities
|
34 |
+
* @since 120214
|
35 |
+
*
|
36 |
+
* @var array Array of log file descriptions.
|
37 |
+
*/
|
38 |
+
public static $log_file_descriptions = array
|
39 |
+
( // Array keys are regex patterns matching their associated log file names.
|
40 |
+
'/paypal\-api/' => array('short' => 'PayPal API communication.', 'long' => 'This log file records all communication between s2Member and PayPal APIs. Such as PayPal Button Encryption and PayPal Pro API calls that process transactions. See also: gateway-core-ipn.log (s2Member\'s core processor).'),
|
41 |
+
'/paypal\-payflow\-api/' => array('short' => 'PayPal (PayFlow Edition) API communication.', 'long' => 'This log file records all communication between s2Member and the PayPal (PayFlow Edition) APIs. Only applicable if you operate a PayPal Payments Pro (PayFlow Edition) account. See also: gateway-core-ipn.log (s2Member\'s core processor).'),
|
42 |
+
'/gateway\-core\-ipn/' => array('short' => 'Core PayPal IPN and post-processing handler.', 'long' => 'This log file records all communication between s2Member and the PayPal IPN service. Also logs all post-processing routines from other Payment Gateway integrations, where s2Member translates its communication with other Payment Gateways into a format it\'s core PayPal processing routines can understand. All transactions pass through s2Member\'s core PayPal processor and they will be logged in this file. Including transactions processed via s2Member Pro Forms; for all Payment Gateway integrations.'),
|
43 |
+
'/gateway\-core\-rtn/' => array('short' => 'Core PayPal PDT/Auto-Return communication.', 'long' => 'This log file records all communication between s2Member and the PayPal PDT Auto-Return system (i.e. routines that help s2Member process Thank-You pages). Also logs all Auto-Return routines from other Payment Gateway integrations (those implemented via Payment Buttons), where s2Member translates its communication with other Payment Gateways into a format it\'s core PayPal processing routines can understand. Not used in s2Member Pro Form integrations however.'),
|
44 |
+
|
45 |
+
'/stripe\-api/' => array('short' => 'Stripe API communication.', 'long' => 'This log file records all communication between s2Member and Stripe APIs.'),
|
46 |
+
'/stripe\-ipn/' => array('short' => 'Stripe Webhook/IPN communication.', 'long' => 'This log file records the Webhook/IPN data that Stripe sends to s2Member.'),
|
47 |
+
|
48 |
+
'/authnet\-api/' => array('short' => 'Authorize.Net API communication.', 'long' => 'This log file records all communication between s2Member and Authorize.Net APIs (for both AIM and ARB integrations).'),
|
49 |
+
'/authnet\-arb/' => array('short' => 'Authorize.Net ARB Subscription status checks.', 'long' => 'This log file records s2Member\'s Authorize.Net ARB Subscription status checks. s2Member polls the ARB service periodically to check the status of existing Members (e.g. to see if billing is still active or not).'),
|
50 |
+
'/authnet\-ipn/' => array('short' => 'Authorize.Net Silent Post/IPN communication.', 'long' => 'This log file records the Silent Post/IPN data Authorize.Net sends to s2Member with details regarding new transactions.'),
|
51 |
+
|
52 |
+
'/alipay\-ipn/' => array('short' => 'AliPay IPN communication.', 'long' => 'This log file records the IPN data AliPay sends to s2Member with details regarding new transactions. See also: gateway-core-ipn.log (s2Member\'s core processor).'),
|
53 |
+
'/alipay\-rtn/' => array('short' => 'AliPay Auto-Return communication.', 'long' => 'This log file records the Auto-Return data AliPay sends to s2Member with details regarding new transactions (i.e. logs routines that help s2Member process Thank-You pages). See also: gateway-core-rtn.log (s2Member\'s core processor).'),
|
54 |
+
|
55 |
+
'/clickbank\-ipn/' => array('short' => 'ClickBank IPN communication.', 'long' => 'This log file records the IPN data ClickBank sends to s2Member with details regarding new transactions, cancellations, expirations, etc. See also: gateway-core-ipn.log (s2Member\'s core processor).'),
|
56 |
+
'/clickbank\-rtn/' => array('short' => 'ClickBank Auto-Return communication.', 'long' => 'This log file records the Auto-Return data ClickBank sends to s2Member with details regarding new transactions (i.e. logs routines that help s2Member process Thank-You pages). See also: gateway-core-rtn.log (s2Member\'s core processor).'),
|
57 |
+
|
58 |
+
'/google\-rtn/' => array('short' => 'Google Auto-Return communication.', 'long' => 'This log file records the Auto-Return data Google sends to s2Member with details regarding new transactions (i.e. logs routines that help s2Member process Thank-You pages). See also: gateway-core-rtn.log (s2Member\'s core processor). NOTE (regarding Google Wallet)... this particular log file is currently implemented for a possible future use ONLY. At this time there is no need for an Auto-Return handler with Google Wallet, because Google Wallet return handling is done via email-only at this time.'),
|
59 |
+
'/google\-ipn/' => array('short' => 'Google Postback/IPN communication.', 'long' => 'This log file records the Postback/IPN data Google sends to s2Member with details regarding new transactions, cancellations, expirations, etc. See also: gateway-core-ipn.log (s2Member\'s core processor).'),
|
60 |
+
|
61 |
+
'/ccbill\-ipn/' => array('short' => 'ccBill Bg Post/IPN communication.', 'long' => 'This log file records the Bg Post/IPN data ccBill sends to s2Member with details regarding new transactions. See also: gateway-core-ipn.log (s2Member\'s core processor).'),
|
62 |
+
'/ccbill\-rtn/' => array('short' => 'ccBill Auto-Return communication.', 'long' => 'This log file records the Auto-Return data ccBill sends to s2Member with details regarding new transactions (i.e. logs routines that help s2Member process Thank-You pages). See also: gateway-core-rtn.log (s2Member\'s core processor).'),
|
63 |
+
'/ccbill\-dl\-ipn/' => array('short' => 'ccBill Datalink Subscription status checks.', 'long' => 'This log file records s2Member\'s ccBill Datalink Subscription status checks that may result in actions taken by s2Member. s2Member polls the ccBill Datalink service periodically to check the status of existing Members (e.g. to see if billing is still active or not).'),
|
64 |
+
'/ccbill\-dl/' => array('short' => 'ccBill Datalink collections.', 'long' => 'This log file records s2Member\'s ccBill Datalink connections. s2Member polls the ccBill Datalink service periodically to obtain information about existing Users/Members.'),
|
65 |
+
|
66 |
+
'/mailchimp\-api/' => array('short' => 'MailChimp API communication.', 'long' => 'This log file records all of s2Member\'s communication with MailChimp APIs.'),
|
67 |
+
'/aweber\-api/' => array('short' => 'AWeber API communication.', 'long' => 'This log file records all of s2Member\'s communication with AWeber APIs.'),
|
68 |
+
|
69 |
+
'/reg\-handler/' => array('short' => 'User registrations processed by s2Member.', 'long' => 'This log file records all User/Member registrations processed by s2Member (either directly or indirectly). This includes both free and paid registrations. It also logs registrations that occur as a result of new Users/Members being created from the Dashboard by a site owner. It also includes registrations that occur through the s2Member Pro Remote Operations API.'),
|
70 |
+
|
71 |
+
'/s2\-http\-api\-debug/' => array('short' => 'All outgoing HTTP connections related to s2Member.', 'long' => 'This log file records all outgoing WP_Http connections that are specifically related to s2Member. This log file can be extremely helpful. It includes technical details about remote HTTP connections that are not available in other log files.'),
|
72 |
+
'/wp\-http\-api\-debug/' => array('short' => 'All outgoing WordPress HTTP connections.', 'long' => 'This log file records all outgoing HTTP connections processed by the WP_Http class. This includes everything processed by WordPress; even things unrelated to s2Member. This log file can be extremely helpful. It includes technical details about remote HTTP connections that are not available in other log files.'),
|
73 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
/**
|
76 |
+
* Logs HTTP communication (if enabled).
|
77 |
+
*
|
78 |
+
* @package s2Member\Utilities
|
79 |
+
* @since 120212
|
80 |
+
*/
|
81 |
+
public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
|
82 |
+
{
|
83 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs'])
|
84 |
+
return; // Logging is NOT enabled in this case.
|
85 |
+
|
86 |
+
$is_s2member = (!empty($args['s2member']) || strpos($url, 's2member') !== FALSE) ? TRUE : FALSE;
|
87 |
+
|
88 |
+
if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs_extensive'] && !$is_s2member)
|
89 |
+
return; // Extensive logging is NOT enabled in this case.
|
90 |
+
|
91 |
+
global $current_site, $current_blog; // For Multisite support.
|
92 |
+
|
93 |
+
$http_api_debug = array(
|
94 |
+
'state' => $state,
|
95 |
+
'transport_class' => $class,
|
96 |
+
'args' => $args,
|
97 |
+
'url' => $url,
|
98 |
+
'response' => $response
|
99 |
+
);
|
100 |
+
$logt = c_ws_plugin__s2member_utilities::time_details();
|
101 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
102 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
103 |
+
|
104 |
+
$log4 = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".'User-Agent: '.$_SERVER['HTTP_USER_AGENT'];
|
105 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
106 |
+
$log2 = (is_multisite() && !is_main_site()) ? 'http-api-debug-4-'.trim(preg_replace('/[^a-z0-9]/i', '-', (!empty($_log4) ? $_log4 : '')), '-').'.log' : 'http-api-debug.log';
|
107 |
+
|
108 |
+
$http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($http_api_debug, TRUE));
|
109 |
+
|
110 |
+
if(is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']))
|
111 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
112 |
+
{
|
113 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs_extensive'])
|
114 |
+
file_put_contents($logs_dir.'/wp-'.$log2,
|
115 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
116 |
+
$http_api_debug_conceal_private_info."\n\n",
|
117 |
+
FILE_APPEND);
|
118 |
+
|
119 |
+
if($is_s2member) // Log s2Member HTTP connections separately.
|
120 |
+
file_put_contents($logs_dir.'/s2-'.$log2,
|
121 |
+
'LOG ENTRY: '.$logt."\n".$logv."\n".$logm."\n".$log4."\n".
|
122 |
+
$http_api_debug_conceal_private_info."\n\n",
|
123 |
+
FILE_APPEND);
|
124 |
+
}
|
125 |
+
}
|
126 |
|
127 |
+
/**
|
128 |
+
* Archives logs to prevent HUGE files from building up over time.
|
129 |
+
*
|
130 |
+
* This routine is staggered to conserve resources.
|
131 |
+
* This is called by all logging routines for s2Member.
|
132 |
+
*
|
133 |
+
* @package s2Member\Utilities
|
134 |
+
* @since 3.5
|
135 |
+
*
|
136 |
+
* @param bool $stagger Optional. Defaults to true. If false, the routine will run, regardless.
|
137 |
+
*
|
138 |
+
* @return bool Always returns true.
|
139 |
+
*/
|
140 |
+
public static function archive_oversize_log_files($stagger = TRUE)
|
141 |
+
{
|
142 |
+
if(!$stagger || is_float($stagger = time() / 2)) // Stagger this routine?
|
143 |
+
{
|
144 |
+
if(is_dir($dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']) && is_writable($dir))
|
145 |
+
{
|
146 |
+
$max = apply_filters('ws_plugin__s2member_oversize_log_file_bytes', 2097152, get_defined_vars());
|
147 |
|
148 |
+
$log_files = scandir($dir);
|
149 |
+
shuffle($log_files);
|
150 |
+
$counter = 1;
|
151 |
|
152 |
+
foreach($log_files as $file) // Go through each log file. Up to 25 files at a time.
|
153 |
+
{
|
154 |
+
if(preg_match('/\.log$/i', $file) && !preg_match('/\-ARCHIVED\-/i', $file) && is_file($dir_file = $dir.'/'.$file))
|
155 |
+
{
|
156 |
+
if(filesize($dir_file) > $max && is_writable($dir_file)) // The file must be writable.
|
157 |
+
if($log = preg_replace('/\.log$/i', '', $dir_file)) // Strip .log before renaming.
|
158 |
+
rename($dir_file, $log.'-ARCHIVED-'.date('m-d-Y').'-'.time().'.log');
|
159 |
+
}
|
160 |
+
if(($counter = $counter + 1) > 25) // Up to 25 files at a time.
|
161 |
+
break; // Stop for now.
|
162 |
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return TRUE;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Removes expired Transients inserted into the database by s2Member.
|
170 |
+
*
|
171 |
+
* This routine is staggered to conserve resources.
|
172 |
+
* Only 5 Transients are deleted each time.
|
173 |
+
*
|
174 |
+
* This is called by s2Member's Auto-EOT System, every 10 minutes.
|
175 |
+
*
|
176 |
+
* @package s2Member\Utilities
|
177 |
+
* @since 3.5
|
178 |
+
*
|
179 |
+
* @param bool $stagger Optional. Defaults to true. If false, the routine will run, regardless.
|
180 |
+
*
|
181 |
+
* @return bool Always returns true.
|
182 |
+
*/
|
183 |
+
public static function cleanup_expired_s2m_transients($stagger = TRUE)
|
184 |
+
{
|
185 |
+
global $wpdb;
|
186 |
+
/** @var wpdb $wpdb */
|
187 |
+
|
188 |
+
if(!$stagger || is_float($stagger = time() / 2)) // Stagger this routine?
|
189 |
+
{
|
190 |
+
if(is_array($expired_s2m_transients = $wpdb->get_results("SELECT * FROM `".$wpdb->options."` WHERE `option_name` LIKE '".esc_sql(like_escape('_transient_timeout_s2m_'))."%' AND `option_value` < '".esc_sql(time())."' LIMIT 5")) && !empty($expired_s2m_transients))
|
191 |
+
{
|
192 |
+
foreach($expired_s2m_transients as $expired_s2m_transient) // Delete the _timeout, and also the transient entry name itself.
|
193 |
+
if(($id = $expired_s2m_transient->option_id) && ($name = preg_replace('/_transient_timeout_/i', '_transient_', $expired_s2m_transient->option_name, 1)))
|
194 |
+
$wpdb->query("DELETE FROM `".$wpdb->options."` WHERE (`option_id` = '".esc_sql($id)."' OR `option_name` = '".esc_sql($name)."')");
|
195 |
+
}
|
196 |
}
|
197 |
+
return TRUE;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Attempts to conceal private details in log entries.
|
202 |
+
*
|
203 |
+
* @package s2Member\Utilities
|
204 |
+
* @since 130315
|
205 |
+
*
|
206 |
+
* @param string $log_entry The log entry we need to conceal private details in.
|
207 |
+
*
|
208 |
+
* @return string Filtered string with some data X'd out :-)
|
209 |
+
*/
|
210 |
+
public static function conceal_private_info($log_entry)
|
211 |
+
{
|
212 |
+
$log_entry = preg_replace('/\b([3456][0-9]{10,11})([0-9]{4})\b/', 'xxxxxxxxxxxx'.'$2', (string)$log_entry);
|
213 |
+
|
214 |
+
$log_entry = preg_replace('/(\'.*pass_?(?:word)?(?:[0-9]+)?\'\s*\=\>\s*\')([^\']+)(\')/', '$1'.'xxxxxxxx/pass'.'$3', $log_entry);
|
215 |
+
$log_entry = preg_replace('/([&?][^&]*pass_?(?:word)?(?:[0-9]+)?\=)([^&]+)/', '$1'.'xxxxxxxx/pass', $log_entry);
|
216 |
+
|
217 |
+
$log_entry = preg_replace('/(\'api_?(?:key|secret)\'\s*\=\>\s*\')([^\']+)(\')/', '$1'.'xxxxxxxx/api/key/sec'.'$3', $log_entry);
|
218 |
+
$log_entry = preg_replace('/([&?][^&]api_?(?:key|secret)\=)([^&]+)/', '$1'.'xxxxxxxx/api/key/sec', $log_entry);
|
219 |
+
|
220 |
+
$log_entry = preg_replace('/(\'(?:PWD|SIGNATURE)\'\s*\=\>\s*\')([^\']+)(\')/', '$1'.'xxxxxxxx/PWD/SIG'.'$3', $log_entry);
|
221 |
+
$log_entry = preg_replace('/([&?][^&](?:PWD|SIGNATURE)\=)([^&]+)/', '$1'.'xxxxxxxx/PWD/SIG', $log_entry);
|
222 |
+
|
223 |
+
$log_entry = preg_replace('/(\'(?:x_login|x_tran_key)\'\s*\=\>\s*\')([^\']+)(\')/', '$1'.'xxxxxxxx/key/tran'.'$3', $log_entry);
|
224 |
+
$log_entry = preg_replace('/([&?][^&](?:x_login|x_tran_key)\=)([^&]+)/', '$1'.'xxxxxxxx/key/tran', $log_entry);
|
225 |
+
|
226 |
+
return $log_entry;
|
227 |
+
}
|
228 |
}
|
229 |
+
}
|
includes/classes/utils-strings.inc.php
CHANGED
@@ -142,7 +142,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
142 |
* @param string $string Input string.
|
143 |
* @return string Output string, after characters NOT on a standard U.S. keyboard have been stripped.
|
144 |
*/
|
145 |
-
public static function strip_2_kb_chars($string =
|
146 |
{
|
147 |
return preg_replace("/[^0-9A-Z\r\n\t\s`\=\[\]\\\;',\.\/~\!@#\$%\^&\*\(\)_\+\|\}\{\:\"\?\>\<\-]/i", "", remove_accents((string)$string));
|
148 |
}
|
@@ -262,7 +262,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
262 |
*/
|
263 |
public static function trim_html($string = FALSE)
|
264 |
{
|
265 |
-
$whitespace = '
|
266 |
return preg_replace('/^(?:'.$whitespace.')+|(?:'.$whitespace.')+$/', '', (string)$string);
|
267 |
}
|
268 |
/**
|
142 |
* @param string $string Input string.
|
143 |
* @return string Output string, after characters NOT on a standard U.S. keyboard have been stripped.
|
144 |
*/
|
145 |
+
public static function strip_2_kb_chars($string = '')
|
146 |
{
|
147 |
return preg_replace("/[^0-9A-Z\r\n\t\s`\=\[\]\\\;',\.\/~\!@#\$%\^&\*\(\)_\+\|\}\{\:\"\?\>\<\-]/i", "", remove_accents((string)$string));
|
148 |
}
|
262 |
*/
|
263 |
public static function trim_html($string = FALSE)
|
264 |
{
|
265 |
+
$whitespace = ' |\<br\>|\<br\s*\/\>|\<p\>(?: )*\<\/p\>';
|
266 |
return preg_replace('/^(?:'.$whitespace.')+|(?:'.$whitespace.')+$/', '', (string)$string);
|
267 |
}
|
268 |
/**
|
includes/classes/utils-users.inc.php
CHANGED
@@ -1,354 +1,382 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* User utilities.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2011
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (coded in the USA)
|
8 |
-
*
|
9 |
-
* Released under the terms of the GNU General Public License.
|
10 |
-
* You should have received a copy of the GNU General Public License,
|
11 |
-
* along with this software. In the main directory, see: /licensing/
|
12 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
-
*
|
14 |
-
* @package s2Member\Utilities
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
*
|
201 |
-
* @package s2Member\Utilities
|
202 |
-
* @since 3.5
|
203 |
-
*
|
204 |
-
* @param object $user Optional. A `WP_User` object.
|
205 |
-
* In order to check the current User, you must call this function with no arguments/parameters.
|
206 |
-
* @return int|str|bool If possible, the User's Paid Subscr. ID, else their WordPress User ID, else false.
|
207 |
-
*/
|
208 |
-
public static function get_user_subscr_or_wp_id ($user = FALSE)
|
209 |
-
{
|
210 |
-
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
211 |
-
{
|
212 |
-
return /* The ``$user`` was passed in but is NOT an object; or nobody is logged in. */ false;
|
213 |
-
}
|
214 |
-
else // Else return Paid Subscr. ID (if available), otherwise return their WP database User ID.
|
215 |
-
return ($subscr_id = get_user_option ("s2member_subscr_id", $user->ID)) ? $subscr_id : $user->ID;
|
216 |
-
}
|
217 |
-
/**
|
218 |
-
* Determines whether or not a Username/Email is already in the database.
|
219 |
-
*
|
220 |
-
* Returns the WordPress User ID if they exist.
|
221 |
-
*
|
222 |
-
* @package s2Member\Utilities
|
223 |
-
* @since 3.5
|
224 |
-
*
|
225 |
-
* @param string $user_login A User's Username.
|
226 |
-
* @param string $user_email A User's Email Address.
|
227 |
-
* @return int|bool If exists, a WordPress User ID, else false.
|
228 |
-
*/
|
229 |
-
public static function user_login_email_exists ($user_login = FALSE, $user_email = FALSE)
|
230 |
-
{
|
231 |
-
global $wpdb; /** @var $wpdb \wpdb */
|
232 |
-
|
233 |
-
if /* Only if we have both of these. */ ($user_login && $user_email)
|
234 |
-
if (($user_id = $wpdb->get_var ("SELECT `ID` FROM `" . $wpdb->users . "` WHERE `user_login` LIKE '" . esc_sql (like_escape ($user_login)) . "' AND `user_email` LIKE '" . esc_sql (like_escape ($user_email)) . "' LIMIT 1")))
|
235 |
-
return /* Return the associated WordPress ID. */$user_id;
|
236 |
-
|
237 |
-
return /* Else return false. */false;
|
238 |
-
}
|
239 |
-
/**
|
240 |
-
* Determines whether or not a Username/Email is already in the database for this Blog.
|
241 |
-
*
|
242 |
-
* Returns the WordPress User ID if they exist.
|
243 |
-
*
|
244 |
-
* @package s2Member\Utilities
|
245 |
-
* @since 3.5
|
246 |
-
*
|
247 |
-
* @param string $user_login A User's Username.
|
248 |
-
* @param string $user_email A User's Email Address.
|
249 |
-
* @param int|string $blog_id A numeric WordPress Blog ID.
|
250 |
-
* @return int|bool If exists *(but not on Blog)*, a WordPress User ID, else false.
|
251 |
-
*/
|
252 |
-
public static function ms_user_login_email_exists_but_not_on_blog ($user_login = FALSE, $user_email = FALSE, $blog_id = FALSE)
|
253 |
-
{
|
254 |
-
if /* Only if we have both of these. */ ($user_login && $user_email)
|
255 |
-
if (is_multisite () && ($user_id = c_ws_plugin__s2member_utils_users::user_login_email_exists ($user_login, $user_email)) && !is_user_member_of_blog ($user_id, $blog_id))
|
256 |
-
return $user_id;
|
257 |
-
|
258 |
-
return /* Else return false. */ false;
|
259 |
-
}
|
260 |
-
/**
|
261 |
-
* Determines whether or not a Username/Email is already in the database for this Blog.
|
262 |
-
*
|
263 |
-
* This is an alias for: `c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog()`.
|
264 |
-
*
|
265 |
-
* Returns the WordPress User ID if they exist.
|
266 |
-
*
|
267 |
-
* @package s2Member\Utilities
|
268 |
-
* @since 3.5
|
269 |
-
*
|
270 |
-
* @param string $user_login A User's Username.
|
271 |
-
* @param string $user_email A User's Email Address.
|
272 |
-
* @param int|string $blog_id A numeric WordPress Blog ID.
|
273 |
-
* @return int|bool If exists *(but not on Blog)*, a WordPress User ID, else false.
|
274 |
-
*/
|
275 |
-
public static function ms_user_login_email_can_join_blog ($user_login = FALSE, $user_email = FALSE, $blog_id = FALSE)
|
276 |
-
{
|
277 |
-
return c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email, $blog_id);
|
278 |
-
}
|
279 |
-
/**
|
280 |
-
* Retrieves a field value. Also supports Custom Fields.
|
281 |
-
*
|
282 |
-
* @package s2Member\Utilities
|
283 |
-
* @since 3.5
|
284 |
-
*
|
285 |
-
* @param string $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
|
286 |
-
* Or, this could be set to any property that exists on the WP_User object for a particular User;
|
287 |
-
* ( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
|
288 |
-
* `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
|
289 |
-
* `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
|
290 |
-
* `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
|
291 |
-
* `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
|
292 |
-
* `s2member_access_ccaps`, etc, etc. ).
|
293 |
-
* @param int|string $user_id Optional. Defaults to the current User's ID.
|
294 |
-
* @return mixed The value of the requested field, or false if the field does not exist.
|
295 |
-
*/
|
296 |
-
public static function get_user_field ($field_id = FALSE, $user_id = FALSE) // Very powerful function here.
|
297 |
-
{
|
298 |
-
global $wpdb; /** @var $wpdb \wpdb */
|
299 |
-
|
300 |
-
$current_user = /* Current User's object (used when/if `$user_id` is empty). */ wp_get_current_user ();
|
301 |
-
|
302 |
-
if (is_object ($user = ($user_id) ? new WP_User ($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID))
|
303 |
-
{
|
304 |
-
if /* Immediate User object property? (most likely) */(isset ($user->$field_id))
|
305 |
-
return $user->$field_id;
|
306 |
-
|
307 |
-
else if /* Also try the data object property. */ (isset ($user->data->$field_id))
|
308 |
-
return $user->data->$field_id;
|
309 |
-
|
310 |
-
else if /* Immediate prefixed? */ (isset ($user->{$wpdb->prefix . $field_id}))
|
311 |
-
return $user->{$wpdb->prefix . $field_id};
|
312 |
-
|
313 |
-
else if /* Data prefixed? */ (isset ($user->data->{$wpdb->prefix . $field_id}))
|
314 |
-
return $user->data->{$wpdb->prefix . $field_id};
|
315 |
-
|
316 |
-
else if /* First/last full name? */ (strcasecmp ($field_id, "full_name") === 0)
|
317 |
-
return trim ($user->first_name . " " . $user->last_name);
|
318 |
-
|
319 |
-
else if /* Email address? */ (preg_match ("/^(email|user_email)$/i", $field_id))
|
320 |
-
return $user->user_email;
|
321 |
-
|
322 |
-
else if /* Username / login? */ (preg_match ("/^(login|user_login)$/i", $field_id))
|
323 |
-
return $user->user_login;
|
324 |
-
|
325 |
-
else if /* Role name/ID? */ (strcasecmp ($field_id, "s2member_access_role") === 0)
|
326 |
-
return c_ws_plugin__s2member_user_access::user_access_role ($user);
|
327 |
-
|
328 |
-
else if /* Access Level? */ (strcasecmp ($field_id, "s2member_access_level") === 0)
|
329 |
-
return c_ws_plugin__s2member_user_access::user_access_level ($user);
|
330 |
-
|
331 |
-
else if /* Access Label? */ (strcasecmp ($field_id, "s2member_access_label") === 0)
|
332 |
-
return c_ws_plugin__s2member_user_access::user_access_label ($user);
|
333 |
-
|
334 |
-
else if /* Custom Caps? */ (strcasecmp ($field_id, "s2member_access_ccaps") === 0)
|
335 |
-
return c_ws_plugin__s2member_user_access::user_access_ccaps ($user);
|
336 |
-
|
337 |
-
else if (strcasecmp ($field_id, "ip") === 0 && is_object ($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID))
|
338 |
-
return /* The current User's IP address, right now. */ $_SERVER["REMOTE_ADDR"];
|
339 |
-
|
340 |
-
else if (strcasecmp ($field_id, "s2member_registration_ip") === 0 || strcasecmp ($field_id, "reg_ip") === 0 || strcasecmp ($field_id, "ip") === 0)
|
341 |
-
return get_user_option ("s2member_registration_ip", $user_id);
|
342 |
-
|
343 |
-
else if (strcasecmp ($field_id, "s2member_subscr_or_wp_id") === 0)
|
344 |
-
return ($subscr_id = get_user_option ("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
|
345 |
-
|
346 |
-
else if (is_array($fields = get_user_option ("s2member_custom_fields", $user_id)))
|
347 |
-
if (isset ($fields[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field_id))]))
|
348 |
-
return $fields[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field_id))];
|
349 |
-
}
|
350 |
-
return /* Default, return false. */ false;
|
351 |
-
}
|
352 |
}
|
|
|
|
|
353 |
}
|
354 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* User utilities.
|
4 |
+
*
|
5 |
+
* Copyright: © 2009-2011
|
6 |
+
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
+
*
|
9 |
+
* Released under the terms of the GNU General Public License.
|
10 |
+
* You should have received a copy of the GNU General Public License,
|
11 |
+
* along with this software. In the main directory, see: /licensing/
|
12 |
+
* If not, see: {@link http://www.gnu.org/licenses/}.
|
13 |
+
*
|
14 |
+
* @package s2Member\Utilities
|
15 |
+
* @since 3.5
|
16 |
+
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_utils_users"))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* User utilities.
|
24 |
+
*
|
25 |
+
* @package s2Member\Utilities
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_utils_users
|
29 |
{
|
30 |
/**
|
31 |
+
* Determines the total Users/Members in the database.
|
32 |
+
*
|
33 |
+
* @package s2Member\Utilities
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @return int Number of Users in the database, total.
|
37 |
+
*/
|
38 |
+
public static function users_in_database()
|
39 |
+
{
|
40 |
+
global $wpdb;
|
41 |
+
/** @var wpdb $wpdb */
|
42 |
+
|
43 |
+
$wpdb_handle = $wpdb->dbh;
|
44 |
+
/** @var resource $wpdb_handle */
|
45 |
+
|
46 |
+
$q1 = mysql_query("SELECT SQL_CALC_FOUND_ROWS `".$wpdb->users."`.`ID` FROM `".$wpdb->users."`, `".$wpdb->usermeta."` WHERE `".$wpdb->users."`.`ID` = `".$wpdb->usermeta."`.`user_id` AND `".$wpdb->usermeta."`.`meta_key` = '".esc_sql($wpdb->prefix."capabilities")."' LIMIT 1", $wpdb_handle);
|
47 |
+
$q2 = mysql_query("SELECT FOUND_ROWS()", $wpdb_handle);
|
48 |
+
$users = (int)mysql_result($q2, 0);
|
49 |
+
|
50 |
+
mysql_free_result($q2);
|
51 |
+
mysql_free_result($q1);
|
52 |
+
|
53 |
+
return $users;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Obtains Custom String for an existing Member, referenced by a Subscr. or Transaction ID.
|
58 |
+
*
|
59 |
+
* A second lookup parameter can be provided as well *(optional)*.
|
60 |
+
*
|
61 |
+
* @package s2Member\Utilities
|
62 |
+
* @since 3.5
|
63 |
+
*
|
64 |
+
* @param string $subscr_txn_baid_cid_id Either a Paid Subscr. ID, or a Paid Transaction ID.
|
65 |
+
* @param string $os0 Optional. A second lookup parameter, usually the `os0` value for PayPal integrations.
|
66 |
+
*
|
67 |
+
* @return string|bool The Custom String value on success, else false on failure.
|
68 |
+
*/
|
69 |
+
public static function get_user_custom_with($subscr_txn_baid_cid_id = '', $os0 = '')
|
70 |
+
{
|
71 |
+
global $wpdb;
|
72 |
+
/** @var wpdb $wpdb */
|
73 |
+
|
74 |
+
if($subscr_txn_baid_cid_id && $os0) // This case includes some additional routines that can use the ``$os0`` value.
|
75 |
+
{
|
76 |
+
if(($q = $wpdb->get_row("SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_subscr_id' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_baid' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_cid' OR `meta_key` = '".$wpdb->prefix."s2member_first_payment_txn_id') AND (`meta_value` = '".esc_sql($subscr_txn_baid_cid_id)."' OR `meta_value` = '".esc_sql($os0)."') LIMIT 1"))
|
77 |
+
|| ($q = $wpdb->get_row("SELECT `ID` AS `user_id` FROM `".$wpdb->users."` WHERE `ID` = '".esc_sql($os0)."' LIMIT 1"))
|
78 |
+
) if(($custom = get_user_option("s2member_custom", $q->user_id)))
|
79 |
+
return $custom;
|
80 |
+
}
|
81 |
+
else if($subscr_txn_baid_cid_id) // Otherwise, if all we have is a Subscr./Txn. ID value.
|
82 |
+
{
|
83 |
+
if(($q = $wpdb->get_row("SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_subscr_id' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_baid' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_cid' OR `meta_key` = '".$wpdb->prefix."s2member_first_payment_txn_id') AND `meta_value` = '".esc_sql($subscr_txn_baid_cid_id)."' LIMIT 1")))
|
84 |
+
if(($custom = get_user_option("s2member_custom", $q->user_id)))
|
85 |
+
return $custom;
|
86 |
+
}
|
87 |
+
return FALSE; // Otherwise, return false.
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Obtains the User ID for an existing Member, referenced by a Subscr. or Transaction ID.
|
92 |
+
*
|
93 |
+
* A second lookup parameter can be provided as well *(optional)*.
|
94 |
+
*
|
95 |
+
* @package s2Member\Utilities
|
96 |
+
* @since 3.5
|
97 |
+
*
|
98 |
+
* @param string $subscr_txn_baid_cid_id Either a Paid Subscr. ID, or a Paid Transaction ID.
|
99 |
+
* @param string $os0 Optional. A second lookup parameter, usually the `os0` value for PayPal integrations.
|
100 |
+
*
|
101 |
+
* @return integer|bool A WordPress User ID on success, else false on failure.
|
102 |
+
*/
|
103 |
+
public static function get_user_id_with($subscr_txn_baid_cid_id = '', $os0 = '')
|
104 |
+
{
|
105 |
+
global $wpdb;
|
106 |
+
/** @var wpdb $wpdb */
|
107 |
+
|
108 |
+
if($subscr_txn_baid_cid_id && $os0) // This case includes some additional routines that can use the ``$os0`` value.
|
109 |
+
{
|
110 |
+
if(($q = $wpdb->get_row("SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_subscr_id' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_baid' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_cid' OR `meta_key` = '".$wpdb->prefix."s2member_first_payment_txn_id') AND (`meta_value` = '".esc_sql($subscr_txn_baid_cid_id)."' OR `meta_value` = '".esc_sql($os0)."') LIMIT 1"))
|
111 |
+
|| ($q = $wpdb->get_row("SELECT `ID` AS `user_id` FROM `".$wpdb->users."` WHERE `ID` = '".esc_sql($os0)."' LIMIT 1"))
|
112 |
+
) return $q->user_id;
|
113 |
+
}
|
114 |
+
else if($subscr_txn_baid_cid_id) // Otherwise, if all we have is a Subscr./Txn. ID value.
|
115 |
+
{
|
116 |
+
if(($q = $wpdb->get_row("SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_subscr_id' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_baid' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_cid' OR `meta_key` = '".$wpdb->prefix."s2member_first_payment_txn_id') AND `meta_value` = '".esc_sql($subscr_txn_baid_cid_id)."' LIMIT 1")))
|
117 |
+
return $q->user_id;
|
118 |
+
}
|
119 |
+
return FALSE; // Otherwise, return false.
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Obtains the Email Address for an existing Member, referenced by a Subscr. or Transaction ID.
|
124 |
+
*
|
125 |
+
* A second lookup parameter can be provided as well *(optional)*.
|
126 |
+
*
|
127 |
+
* @package s2Member\Utilities
|
128 |
+
* @since 3.5
|
129 |
+
*
|
130 |
+
* @param string $subscr_txn_baid_cid_id Either a Paid Subscr. ID, or a Paid Transaction ID.
|
131 |
+
* @param string $os0 Optional. A second lookup parameter, usually the `os0` value for PayPal integrations.
|
132 |
+
*
|
133 |
+
* @return int|bool A User's Email Address on success, else false on failure.
|
134 |
+
*/
|
135 |
+
public static function get_user_email_with($subscr_txn_baid_cid_id = '', $os0 = '')
|
136 |
+
{
|
137 |
+
global $wpdb;
|
138 |
+
/** @var wpdb $wpdb */
|
139 |
+
|
140 |
+
if($subscr_txn_baid_cid_id && $os0) // This case includes some additional routines that can use the ``$os0`` value.
|
141 |
+
{
|
142 |
+
if(($q = $wpdb->get_row("SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_subscr_id' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_baid' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_cid' OR `meta_key` = '".$wpdb->prefix."s2member_first_payment_txn_id') AND (`meta_value` = '".esc_sql($subscr_txn_baid_cid_id)."' OR `meta_value` = '".esc_sql($os0)."') LIMIT 1"))
|
143 |
+
|| ($q = $wpdb->get_row("SELECT `ID` AS `user_id` FROM `".$wpdb->users."` WHERE `ID` = '".esc_sql($os0)."' LIMIT 1"))
|
144 |
+
) if(is_object($user = new WP_User ($q->user_id)) && !empty($user->ID) && ($email = $user->user_email))
|
145 |
+
return $email;
|
146 |
+
}
|
147 |
+
else if($subscr_txn_baid_cid_id) // Otherwise, if all we have is a Subscr./Txn. ID value.
|
148 |
+
{
|
149 |
+
if(($q = $wpdb->get_row("SELECT `user_id` FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_subscr_id' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_baid' OR `meta_key` = '".$wpdb->prefix."s2member_subscr_cid' OR `meta_key` = '".$wpdb->prefix."s2member_first_payment_txn_id') AND `meta_value` = '".esc_sql($subscr_txn_baid_cid_id)."' LIMIT 1")))
|
150 |
+
if(is_object($user = new WP_User ($q->user_id)) && !empty($user->ID) && ($email = $user->user_email))
|
151 |
+
return $email;
|
152 |
+
}
|
153 |
+
return FALSE; // Otherwise, return false.
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Retrieves IPN Signup Vars & validates their Subscription ID.
|
158 |
+
*
|
159 |
+
* @package s2Member\Utilities
|
160 |
+
* @since 3.5
|
161 |
+
*
|
162 |
+
* @param integer|string $user_id Optional. A numeric WordPress User ID.
|
163 |
+
*
|
164 |
+
* @param string $subscr_txn_baid_cid_id Optional. Can be used instead of passing in a ``$user_id``.
|
165 |
+
* If ``$subscr_baid_cid_id`` is passed in, it has to match the one found inside the resulting IPN Signup Vars collected by this routine.
|
166 |
+
* If neither of these parameters are passed in, the current User is assumed instead, obtained through ``wp_get_current_user()``.
|
167 |
+
*
|
168 |
+
* @return array|bool A User's IPN Signup Vars on success, else false on failure.
|
169 |
+
*/
|
170 |
+
public static function get_user_ipn_signup_vars($user_id = 0, $subscr_txn_baid_cid_id = '')
|
171 |
+
{
|
172 |
+
if($user_id || ($subscr_txn_baid_cid_id && ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($subscr_txn_baid_cid_id)))
|
173 |
+
|| (!$user_id && !$subscr_txn_baid_cid_id && is_object($user = wp_get_current_user()) && !empty($user->ID) && ($user_id = $user->ID))
|
174 |
+
)
|
175 |
+
{
|
176 |
+
$_subscr_baid = get_user_option("s2member_subscr_baid", $user_id);
|
177 |
+
$_subscr_cid = get_user_option("s2member_subscr_cid", $user_id);
|
178 |
+
$_subscr_id = get_user_option("s2member_subscr_id", $user_id);
|
179 |
+
|
180 |
+
if($_subscr_id && (!$subscr_txn_baid_cid_id || $subscr_txn_baid_cid_id === $_subscr_id || $subscr_txn_baid_cid_id === $_subscr_baid || $subscr_txn_baid_cid_id === $_subscr_cid))
|
181 |
+
if(is_array($ipn_signup_vars = get_user_option("s2member_ipn_signup_vars", $user_id)))
|
182 |
+
if($ipn_signup_vars["subscr_id"] === $_subscr_id)
|
183 |
+
return $ipn_signup_vars;
|
184 |
+
}
|
185 |
+
return FALSE; // Otherwise, return false.
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Retrieves IPN Signup Var & validates their Subscription ID.
|
190 |
+
*
|
191 |
+
* The ``$user_id`` can be passed in directly; or a lookup can be performed with ``$subscr_id``.
|
192 |
+
*
|
193 |
+
* @package s2Member\Utilities
|
194 |
+
* @since 110912
|
195 |
+
*
|
196 |
+
* @param string $var Required. The requested Signup Var.
|
197 |
+
* @param int|string $user_id Optional. A numeric WordPress User ID.
|
198 |
+
* @param string $subscr_txn_baid_cid_id Optional. Can be used instead of passing in a ``$user_id``.
|
199 |
+
* If ``$subscr_id`` is passed in, it has to match the one found inside the resulting IPN Signup Vars collected by this routine.
|
200 |
+
* If neither of these parameters are passed in, the current User is assumed instead, obtained through ``wp_get_current_user()``.
|
201 |
+
*
|
202 |
+
* @return mixed|bool A User's IPN Signup Var on success, else false on failure.
|
203 |
+
*/
|
204 |
+
public static function get_user_ipn_signup_var($var = '', $user_id = 0, $subscr_txn_baid_cid_id = '')
|
205 |
+
{
|
206 |
+
if(!empty($var) && is_array($user_ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars($user_id, $subscr_txn_baid_cid_id)))
|
207 |
{
|
208 |
+
if(isset($user_ipn_signup_vars[$var]))
|
209 |
+
return $user_ipn_signup_vars[$var];
|
210 |
+
}
|
211 |
+
return FALSE; // Otherwise, return false.
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Obtains a User's Paid Subscr. ID *(if available)*; otherwise their WP User ID.
|
216 |
+
*
|
217 |
+
* If ``$user`` IS passed in, this function will return data from a specific ``$user``, or fail if not possible.
|
218 |
+
* If ``$user`` is NOT passed in, check the current User/Member.
|
219 |
+
*
|
220 |
+
* @package s2Member\Utilities
|
221 |
+
* @since 3.5
|
222 |
+
*
|
223 |
+
* @param object $user Optional. A `WP_User` object.
|
224 |
+
* In order to check the current User, you must call this function with no arguments/parameters.
|
225 |
+
*
|
226 |
+
* @return int|string|bool If possible, the User's Paid Subscr. ID, else their WordPress User ID, else false.
|
227 |
+
*/
|
228 |
+
public static function get_user_subscr_or_wp_id($user = NULL)
|
229 |
+
{
|
230 |
+
if((func_num_args() && (!is_object($user) || empty($user->ID)))
|
231 |
+
|| (!func_num_args() && (!is_object($user = (is_user_logged_in()) ? wp_get_current_user() : FALSE) || empty($user->ID)))
|
232 |
+
) return FALSE; // The ``$user`` was passed in but is NOT an object; or nobody is logged in.
|
233 |
+
|
234 |
+
return ($subscr_id = get_user_option("s2member_subscr_id", $user->ID)) ? $subscr_id : $user->ID;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Determines whether or not a Username/Email is already in the database.
|
239 |
+
*
|
240 |
+
* Returns the WordPress User ID if they exist.
|
241 |
+
*
|
242 |
+
* @package s2Member\Utilities
|
243 |
+
* @since 3.5
|
244 |
+
*
|
245 |
+
* @param string $user_login A User's Username.
|
246 |
+
* @param string $user_email A User's Email Address.
|
247 |
+
*
|
248 |
+
* @return int|bool If exists, a WordPress User ID, else false.
|
249 |
+
*/
|
250 |
+
public static function user_login_email_exists($user_login = '', $user_email = '')
|
251 |
+
{
|
252 |
+
global $wpdb;
|
253 |
+
/** @var wpdb $wpdb */
|
254 |
+
|
255 |
+
if($user_login && $user_email) // Only if we have both of these.
|
256 |
+
if(($user_id = $wpdb->get_var("SELECT `ID` FROM `".$wpdb->users."` WHERE `user_login` LIKE '".esc_sql(like_escape($user_login))."' AND `user_email` LIKE '".esc_sql(like_escape($user_email))."' LIMIT 1")))
|
257 |
+
return $user_id; // Return the associated WordPress ID.
|
258 |
+
|
259 |
+
return FALSE; // Otherwise, return false.
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Determines whether or not a Username/Email is already in the database for this Blog.
|
264 |
+
*
|
265 |
+
* Returns the WordPress User ID if they exist.
|
266 |
+
*
|
267 |
+
* @package s2Member\Utilities
|
268 |
+
* @since 3.5
|
269 |
+
*
|
270 |
+
* @param string $user_login A User's Username.
|
271 |
+
* @param string $user_email A User's Email Address.
|
272 |
+
* @param int|string $blog_id A numeric WordPress Blog ID.
|
273 |
+
*
|
274 |
+
* @return int|bool If exists *(but not on Blog)*, a WordPress User ID, else false.
|
275 |
+
*/
|
276 |
+
public static function ms_user_login_email_exists_but_not_on_blog($user_login = '', $user_email = '', $blog_id = 0)
|
277 |
+
{
|
278 |
+
if($user_login && $user_email) // Only if we have both of these.
|
279 |
+
if(is_multisite() && ($user_id = c_ws_plugin__s2member_utils_users::user_login_email_exists($user_login, $user_email)) && !is_user_member_of_blog($user_id, $blog_id))
|
280 |
+
return $user_id;
|
281 |
+
|
282 |
+
return FALSE; // Otherwise, return false.
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Determines whether or not a Username/Email is already in the database for this Blog.
|
287 |
+
*
|
288 |
+
* This is an alias for: `c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog()`.
|
289 |
+
*
|
290 |
+
* Returns the WordPress User ID if they exist.
|
291 |
+
*
|
292 |
+
* @package s2Member\Utilities
|
293 |
+
* @since 3.5
|
294 |
+
*
|
295 |
+
* @param string $user_login A User's Username.
|
296 |
+
* @param string $user_email A User's Email Address.
|
297 |
+
* @param int|string $blog_id A numeric WordPress Blog ID.
|
298 |
+
*
|
299 |
+
* @return int|bool If exists *(but not on Blog)*, a WordPress User ID, else false.
|
300 |
+
*/
|
301 |
+
public static function ms_user_login_email_can_join_blog($user_login = '', $user_email = '', $blog_id = 0)
|
302 |
+
{
|
303 |
+
return c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog($user_login, $user_email, $blog_id);
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Retrieves a field value. Also supports Custom Fields.
|
308 |
+
*
|
309 |
+
* @package s2Member\Utilities
|
310 |
+
* @since 3.5
|
311 |
+
*
|
312 |
+
* @param string $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
|
313 |
+
* Or, this could be set to any property that exists on the WP_User object for a particular User;
|
314 |
+
* ( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
|
315 |
+
* `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
|
316 |
+
* `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
|
317 |
+
* `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
|
318 |
+
* `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
|
319 |
+
* `s2member_access_ccaps`, etc, etc. ).
|
320 |
+
* @param int|string $user_id Optional. Defaults to the current User's ID.
|
321 |
+
*
|
322 |
+
* @return mixed The value of the requested field, or false if the field does not exist.
|
323 |
+
*/
|
324 |
+
public static function get_user_field($field_id = '', $user_id = 0)
|
325 |
+
{
|
326 |
+
global $wpdb;
|
327 |
+
/** @var wpdb $wpdb */
|
328 |
+
|
329 |
+
$current_user = wp_get_current_user(); // Current User's object (used when/if `$user_id` is empty).
|
330 |
+
|
331 |
+
if(is_object($user = ($user_id) ? new WP_User ($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID))
|
332 |
+
{
|
333 |
+
if(isset ($user->$field_id))
|
334 |
+
return $user->$field_id;
|
335 |
+
|
336 |
+
else if(isset ($user->data->$field_id))
|
337 |
+
return $user->data->$field_id;
|
338 |
+
|
339 |
+
else if(isset ($user->{$wpdb->prefix.$field_id}))
|
340 |
+
return $user->{$wpdb->prefix.$field_id};
|
341 |
+
|
342 |
+
else if(isset ($user->data->{$wpdb->prefix.$field_id}))
|
343 |
+
return $user->data->{$wpdb->prefix.$field_id};
|
344 |
+
|
345 |
+
else if(strcasecmp($field_id, "full_name") === 0)
|
346 |
+
return trim($user->first_name." ".$user->last_name);
|
347 |
+
|
348 |
+
else if(preg_match("/^(email|user_email)$/i", $field_id))
|
349 |
+
return $user->user_email;
|
350 |
+
|
351 |
+
else if(preg_match("/^(login|user_login)$/i", $field_id))
|
352 |
+
return $user->user_login;
|
353 |
+
|
354 |
+
else if(strcasecmp($field_id, "s2member_access_role") === 0)
|
355 |
+
return c_ws_plugin__s2member_user_access::user_access_role($user);
|
356 |
+
|
357 |
+
else if(strcasecmp($field_id, "s2member_access_level") === 0)
|
358 |
+
return c_ws_plugin__s2member_user_access::user_access_level($user);
|
359 |
+
|
360 |
+
else if(strcasecmp($field_id, "s2member_access_label") === 0)
|
361 |
+
return c_ws_plugin__s2member_user_access::user_access_label($user);
|
362 |
+
|
363 |
+
else if(strcasecmp($field_id, "s2member_access_ccaps") === 0)
|
364 |
+
return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
|
365 |
+
|
366 |
+
else if(strcasecmp($field_id, "ip") === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID))
|
367 |
+
return $_SERVER["REMOTE_ADDR"];
|
368 |
+
|
369 |
+
else if(strcasecmp($field_id, "s2member_registration_ip") === 0 || strcasecmp($field_id, "reg_ip") === 0 || strcasecmp($field_id, "ip") === 0)
|
370 |
+
return get_user_option("s2member_registration_ip", $user_id);
|
371 |
+
|
372 |
+
else if(strcasecmp($field_id, "s2member_subscr_or_wp_id") === 0)
|
373 |
+
return ($subscr_id = get_user_option("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
|
374 |
+
|
375 |
+
else if(is_array($fields = get_user_option("s2member_custom_fields", $user_id)))
|
376 |
+
if(isset ($fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))]))
|
377 |
+
return $fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
+
return FALSE; // Otherwise, return false.
|
380 |
+
}
|
381 |
}
|
382 |
+
}
|
includes/hooks.inc.php
CHANGED
@@ -200,4 +200,5 @@ add_action('plugins_loaded', 'c_ws_plugin__s2member_mo_page::back_compat_mop_var
|
|
200 |
Register the activation | de-activation routines.
|
201 |
*/
|
202 |
register_activation_hook($GLOBALS['WS_PLUGIN__']['s2member']['c']['plugin_basename'], 'c_ws_plugin__s2member_installation::activate');
|
203 |
-
register_deactivation_hook($GLOBALS['WS_PLUGIN__']['s2member']['c']['plugin_basename'], 'c_ws_plugin__s2member_installation::deactivate');
|
|
200 |
Register the activation | de-activation routines.
|
201 |
*/
|
202 |
register_activation_hook($GLOBALS['WS_PLUGIN__']['s2member']['c']['plugin_basename'], 'c_ws_plugin__s2member_installation::activate');
|
203 |
+
register_deactivation_hook($GLOBALS['WS_PLUGIN__']['s2member']['c']['plugin_basename'], 'c_ws_plugin__s2member_installation::deactivate');
|
204 |
+
register_uninstall_hook($GLOBALS['WS_PLUGIN__']['s2member']['c']['plugin_basename'], 'c_ws_plugin__s2member_installation::uninstall');
|
includes/menu-pages/api-ops.inc.php
CHANGED
@@ -80,8 +80,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
80 |
echo '<textarea name="ws_plugin__s2member_signup_notification_urls" id="ws-plugin--s2member-signup-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) . '</textarea><br />' . "\n";
|
81 |
echo 'Signup Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
82 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
83 |
-
echo '<ul>' . "\n";
|
84 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the purchase. Payment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
|
|
|
|
85 |
echo '<li><code>%%initial%%</code> = The Initial Fee charged during signup. If you offered a 100% Free Trial, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. Even if that amount is 0.\\n\\nIf a Customer signs up, under the terms of a 100% Free Trial Period, this will be 0. So be careful using %%initial%% when you offer a 100% Free Trial Period, because a $0.00 sale amount could cause havoc with affiliate programs.\\n\\nIf you\\\'re offering a 100% Free Trial Period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
|
86 |
echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. If you offer something 100% free, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. If you did NOT offer an Initial Period at a different price, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
|
87 |
echo '<li><code>%%recurring%%</code> = This is the amount that will be charged on a recurring basis, or <code>0</code> if non-recurring. [ <a href="#" onclick="alert(\'If Recurring Payments have not been required, this will be equal to 0. That being said, %%regular%% & %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the Regular Recurring Rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\'); return false;">?</a> ]</li>' . "\n";
|
@@ -99,7 +101,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
99 |
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
100 |
{
|
101 |
echo '<strong>Coupon Replacement Codes (applicable only w/ s2Member Pro Forms):</strong>' . "\n";
|
102 |
-
echo '<ul>' . "\n";
|
103 |
echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code — if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (e.g. the full Coupon Code).</li>' . "\n";
|
104 |
echo '<li><code>%%coupon_code%%</code> = A Coupon Code — if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
|
105 |
echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e. the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
|
@@ -107,7 +109,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
107 |
}
|
108 |
|
109 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
110 |
-
echo '<ul>' . "\n";
|
111 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
112 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
113 |
echo '</ul>' . "\n";
|
@@ -182,7 +184,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
182 |
echo '<textarea name="ws_plugin__s2member_registration_notification_urls" id="ws-plugin--s2member-registration-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"]) . '</textarea><br />' . "\n";
|
183 |
echo 'Registration Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
184 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
185 |
-
echo '<ul>' . "\n";
|
186 |
echo '<li><code>%%role%%</code> = The Role ID <code>(subscriber, s2member_level[0-9]+, administrator, editor, author, contributor)</code>.</li>' . "\n";
|
187 |
echo '<li><code>%%level%%</code> = The Level number <code>(0, 1, 2, 3, 4)</code>. (<em>deprecated, no longer recommended; use <code>%%role%%</code></em>)</li>' . "\n";
|
188 |
echo '<li><code>%%ccaps%%</code> = Custom Capabilities. Ex: <code>music,videos,free_gift</code> (<em>in comma-delimited format</em>).</li>' . "\n";
|
@@ -198,7 +200,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
198 |
echo '</ul>' . "\n";
|
199 |
|
200 |
echo '<strong>Custom Registration/Profile Fields are also supported in this Notification:</strong>' . "\n";
|
201 |
-
echo '<ul>' . "\n";
|
202 |
echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
|
203 |
echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
|
204 |
echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
|
@@ -206,7 +208,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
206 |
echo '</ul>' . "\n";
|
207 |
|
208 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
209 |
-
echo '<ul>' . "\n";
|
210 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
211 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
212 |
echo '</ul>' . "\n";
|
@@ -284,8 +286,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
284 |
echo '<textarea name="ws_plugin__s2member_payment_notification_urls" id="ws-plugin--s2member-payment-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) . '</textarea><br />' . "\n";
|
285 |
echo 'Payment Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
286 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
287 |
-
echo '<ul>' . "\n";
|
288 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'There are some exceptions. If you are selling Lifetime or Fixed-Term (non-recurring) access, and/or Independent Custom Capabilities, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the payment.\\n\\nPayment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), which goes for Independent Custom Capability purchases too; using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
|
|
|
|
289 |
echo '<li><code>%%txn_id%%</code> = The Payment Transaction ID, which is always unique for each payment received.</li>' . "\n";
|
290 |
echo '<li><code>%%amount%%</code> = The Amount of the payment. Most affiliate programs calculate commissions from this.</li>' . "\n";
|
291 |
echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased the Membership Subscription' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? '' : ' or Capabilities.') . '</li>' . "\n";
|
@@ -307,7 +311,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
307 |
{
|
308 |
echo '<strong>Coupon Replacement Codes (applicable only w/ s2Member Pro Forms):</strong><br />' . "\n";
|
309 |
echo '<em>These are ONLY included with payments that occur during checkout. They will NOT be provided with any future recurring payments.</em>'."\n";
|
310 |
-
echo '<ul>' . "\n";
|
311 |
echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code — if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (e.g. the full Coupon Code).</li>' . "\n";
|
312 |
echo '<li><code>%%coupon_code%%</code> = A Coupon Code — if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
|
313 |
echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e. the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
|
@@ -315,7 +319,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
315 |
}
|
316 |
|
317 |
echo '<strong>Custom Registration/Profile Fields are also supported in this Notification:</strong>' . "\n";
|
318 |
-
echo '<ul>' . "\n";
|
319 |
echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
|
320 |
echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
|
321 |
echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
|
@@ -323,7 +327,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
323 |
echo '</ul>' . "\n";
|
324 |
|
325 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
326 |
-
echo '<ul>' . "\n";
|
327 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
328 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
329 |
echo '</ul>' . "\n";
|
@@ -401,8 +405,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
401 |
echo '<textarea name="ws_plugin__s2member_modification_notification_urls" id="ws-plugin--s2member-modification-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) . '</textarea><br />' . "\n";
|
402 |
echo 'Modification Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
403 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
404 |
-
echo '<ul>' . "\n";
|
405 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the purchase. Payment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
|
|
|
|
406 |
echo '<li><code>%%initial%%</code> = The Initial Fee. If you offered a 100% Free Trial, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent when they completed checkout, no matter what. Even if that amount is 0.\\n\\nIf a Customer upgrades/downgrades under the terms of a 100% Free Trial Period, this will be 0. So, please be careful using %%initial%% when you offer a 100% Free Trial Period, because a $0.00 sale amount could cause havoc with affiliate programs.\\n\\nIf you\\\'re offering a 100% Free Trial Period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
|
407 |
echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. If you offer something 100% free, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. If you did NOT offer an Initial Period at a different price, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
|
408 |
echo '<li><code>%%recurring%%</code> = This is the amount that will be charged on a recurring basis, or <code>0</code> if non-recurring. [ <a href="#" onclick="alert(\'If Recurring Payments have not been required, this will be equal to 0. That being said, %%regular%% & %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the Regular Recurring Rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\'); return false;">?</a> ]</li>' . "\n";
|
@@ -426,7 +432,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
426 |
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
427 |
{
|
428 |
echo '<strong>Coupon Replacement Codes (applicable only w/ s2Member Pro Forms):</strong>' . "\n";
|
429 |
-
echo '<ul>' . "\n";
|
430 |
echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code — if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (e.g. the full Coupon Code).</li>' . "\n";
|
431 |
echo '<li><code>%%coupon_code%%</code> = A Coupon Code — if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
|
432 |
echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e. the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
|
@@ -434,7 +440,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
434 |
}
|
435 |
|
436 |
echo '<strong>Custom Registration/Profile Fields are also supported in this Notification:</strong>' . "\n";
|
437 |
-
echo '<ul>' . "\n";
|
438 |
echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
|
439 |
echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
|
440 |
echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
|
@@ -442,7 +448,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
442 |
echo '</ul>' . "\n";
|
443 |
|
444 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
445 |
-
echo '<ul>' . "\n";
|
446 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
447 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
448 |
echo '</ul>' . "\n";
|
@@ -519,8 +525,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_api_ops"))
|
|
519 |
echo '<textarea name="ws_plugin__s2member_cancellation_notification_urls" id="ws-plugin--s2member-cancellation-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) . '</textarea><br />' . "\n";
|
520 |
echo 'Cancellation Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
521 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
522 |
-
echo '<ul>' . "\n";
|
523 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remained constant throughout the lifetime of the Membership. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the original Transaction ID for the purchase. Payment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there was only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
|
|
|
|
524 |
echo '<li><code>%%item_number%%</code> = The Item Number (colon separated <em>level:custom_capabilities:fixed term</em>) that the Subscription was for.</li>' . "\n";
|
525 |
echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item N
|
80 |
echo '<textarea name="ws_plugin__s2member_signup_notification_urls" id="ws-plugin--s2member-signup-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) . '</textarea><br />' . "\n";
|
81 |
echo 'Signup Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
82 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
83 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
84 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the purchase. Payment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
85 |
+
echo '<li><code>%%subscr_baid%%</code> = Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. This is the Subscription\'s Billing Agreement ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. In all other cases, the %%subscr_baid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% in most cases.\'); return false;">?</a> ]</li>' . "\n";
|
86 |
+
echo '<li><code>%%subscr_cid%%</code> = Applicable only with Stripe integration. This is the Customer\'s ID in Stripe, which remains constant throughout any & all future payments. Each Stripe Customer has this Customer ID; and also a Subscription and/or Transaction ID [ <a href="#" onclick="alert(\'Applicable only when you integrate s2Member with Stripe. In all other cases, the %%subscr_cid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% when running anything other than Stripe.\\n\\nEach Stripe Customer has a Customer ID; and also a Subscription and/or Transaction ID. See %%subscr_id%% for further details.\'); return false;">?</a> ]</li>' . "\n";
|
87 |
echo '<li><code>%%initial%%</code> = The Initial Fee charged during signup. If you offered a 100% Free Trial, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. Even if that amount is 0.\\n\\nIf a Customer signs up, under the terms of a 100% Free Trial Period, this will be 0. So be careful using %%initial%% when you offer a 100% Free Trial Period, because a $0.00 sale amount could cause havoc with affiliate programs.\\n\\nIf you\\\'re offering a 100% Free Trial Period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
|
88 |
echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. If you offer something 100% free, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. If you did NOT offer an Initial Period at a different price, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
|
89 |
echo '<li><code>%%recurring%%</code> = This is the amount that will be charged on a recurring basis, or <code>0</code> if non-recurring. [ <a href="#" onclick="alert(\'If Recurring Payments have not been required, this will be equal to 0. That being said, %%regular%% & %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the Regular Recurring Rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\'); return false;">?</a> ]</li>' . "\n";
|
101 |
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
102 |
{
|
103 |
echo '<strong>Coupon Replacement Codes (applicable only w/ s2Member Pro Forms):</strong>' . "\n";
|
104 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
105 |
echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code — if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (e.g. the full Coupon Code).</li>' . "\n";
|
106 |
echo '<li><code>%%coupon_code%%</code> = A Coupon Code — if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
|
107 |
echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e. the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
|
109 |
}
|
110 |
|
111 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
112 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
113 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
114 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
115 |
echo '</ul>' . "\n";
|
184 |
echo '<textarea name="ws_plugin__s2member_registration_notification_urls" id="ws-plugin--s2member-registration-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"]) . '</textarea><br />' . "\n";
|
185 |
echo 'Registration Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
186 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
187 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
188 |
echo '<li><code>%%role%%</code> = The Role ID <code>(subscriber, s2member_level[0-9]+, administrator, editor, author, contributor)</code>.</li>' . "\n";
|
189 |
echo '<li><code>%%level%%</code> = The Level number <code>(0, 1, 2, 3, 4)</code>. (<em>deprecated, no longer recommended; use <code>%%role%%</code></em>)</li>' . "\n";
|
190 |
echo '<li><code>%%ccaps%%</code> = Custom Capabilities. Ex: <code>music,videos,free_gift</code> (<em>in comma-delimited format</em>).</li>' . "\n";
|
200 |
echo '</ul>' . "\n";
|
201 |
|
202 |
echo '<strong>Custom Registration/Profile Fields are also supported in this Notification:</strong>' . "\n";
|
203 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
204 |
echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
|
205 |
echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
|
206 |
echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
|
208 |
echo '</ul>' . "\n";
|
209 |
|
210 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
211 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
212 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
213 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
214 |
echo '</ul>' . "\n";
|
286 |
echo '<textarea name="ws_plugin__s2member_payment_notification_urls" id="ws-plugin--s2member-payment-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) . '</textarea><br />' . "\n";
|
287 |
echo 'Payment Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
288 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
289 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
290 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'There are some exceptions. If you are selling Lifetime or Fixed-Term (non-recurring) access, and/or Independent Custom Capabilities, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the payment.\\n\\nPayment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), which goes for Independent Custom Capability purchases too; using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
291 |
+
echo '<li><code>%%subscr_baid%%</code> = Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. This is the Subscription\'s Billing Agreement ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. In all other cases, the %%subscr_baid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% in most cases.\'); return false;">?</a> ]</li>' . "\n";
|
292 |
+
echo '<li><code>%%subscr_cid%%</code> = Applicable only with Stripe integration. This is the Customer\'s ID in Stripe, which remains constant throughout any & all future payments. Each Stripe Customer has this Customer ID; and also a Subscription and/or Transaction ID [ <a href="#" onclick="alert(\'Applicable only when you integrate s2Member with Stripe. In all other cases, the %%subscr_cid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% when running anything other than Stripe.\\n\\nEach Stripe Customer has a Customer ID; and also a Subscription and/or Transaction ID. See %%subscr_id%% for further details.\'); return false;">?</a> ]</li>' . "\n";
|
293 |
echo '<li><code>%%txn_id%%</code> = The Payment Transaction ID, which is always unique for each payment received.</li>' . "\n";
|
294 |
echo '<li><code>%%amount%%</code> = The Amount of the payment. Most affiliate programs calculate commissions from this.</li>' . "\n";
|
295 |
echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased the Membership Subscription' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? '' : ' or Capabilities.') . '</li>' . "\n";
|
311 |
{
|
312 |
echo '<strong>Coupon Replacement Codes (applicable only w/ s2Member Pro Forms):</strong><br />' . "\n";
|
313 |
echo '<em>These are ONLY included with payments that occur during checkout. They will NOT be provided with any future recurring payments.</em>'."\n";
|
314 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
315 |
echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code — if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (e.g. the full Coupon Code).</li>' . "\n";
|
316 |
echo '<li><code>%%coupon_code%%</code> = A Coupon Code — if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
|
317 |
echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e. the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
|
319 |
}
|
320 |
|
321 |
echo '<strong>Custom Registration/Profile Fields are also supported in this Notification:</strong>' . "\n";
|
322 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
323 |
echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
|
324 |
echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
|
325 |
echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
|
327 |
echo '</ul>' . "\n";
|
328 |
|
329 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
330 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
331 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
332 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
333 |
echo '</ul>' . "\n";
|
405 |
echo '<textarea name="ws_plugin__s2member_modification_notification_urls" id="ws-plugin--s2member-modification-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) . '</textarea><br />' . "\n";
|
406 |
echo 'Modification Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
407 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
408 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
409 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the Transaction ID for the purchase. Payment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
410 |
+
echo '<li><code>%%subscr_baid%%</code> = Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. This is the Subscription\'s Billing Agreement ID, which remains constant throughout any & all future payments. [ <a href="#" onclick="alert(\'Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that require a Billing Agreement. In all other cases, the %%subscr_baid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% in most cases.\'); return false;">?</a> ]</li>' . "\n";
|
411 |
+
echo '<li><code>%%subscr_cid%%</code> = Applicable only with Stripe integration. This is the Customer\'s ID in Stripe, which remains constant throughout any & all future payments. Each Stripe Customer has this Customer ID; and also a Subscription and/or Transaction ID [ <a href="#" onclick="alert(\'Applicable only when you integrate s2Member with Stripe. In all other cases, the %%subscr_cid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% when running anything other than Stripe.\\n\\nEach Stripe Customer has a Customer ID; and also a Subscription and/or Transaction ID. See %%subscr_id%% for further details.\'); return false;">?</a> ]</li>' . "\n";
|
412 |
echo '<li><code>%%initial%%</code> = The Initial Fee. If you offered a 100% Free Trial, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent when they completed checkout, no matter what. Even if that amount is 0.\\n\\nIf a Customer upgrades/downgrades under the terms of a 100% Free Trial Period, this will be 0. So, please be careful using %%initial%% when you offer a 100% Free Trial Period, because a $0.00 sale amount could cause havoc with affiliate programs.\\n\\nIf you\\\'re offering a 100% Free Trial Period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
|
413 |
echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. If you offer something 100% free, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. If you did NOT offer an Initial Period at a different price, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
|
414 |
echo '<li><code>%%recurring%%</code> = This is the amount that will be charged on a recurring basis, or <code>0</code> if non-recurring. [ <a href="#" onclick="alert(\'If Recurring Payments have not been required, this will be equal to 0. That being said, %%regular%% & %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the Regular Recurring Rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\'); return false;">?</a> ]</li>' . "\n";
|
432 |
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
433 |
{
|
434 |
echo '<strong>Coupon Replacement Codes (applicable only w/ s2Member Pro Forms):</strong>' . "\n";
|
435 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
436 |
echo '<li><code>%%full_coupon_code%%</code> = A full Coupon Code — if one is accepted by your configuration of s2Member. This may indicate an Affiliate Coupon Code, which will include your Affiliate Suffix Chars too (e.g. the full Coupon Code).</li>' . "\n";
|
437 |
echo '<li><code>%%coupon_code%%</code> = A Coupon Code — if one is accepted by your configuration of s2Member. This will NOT include any Affiliate Suffix Chars. This indicates the actual Coupon Code accepted by your configuration of s2Member (excluding any Affiliate ID).</li>' . "\n";
|
438 |
echo '<li><code>%%coupon_affiliate_id%%</code> = This is the end of an Affiliate Coupon Code <em>(i.e. the referring affiliate\'s ID)</em>. This is only applicable if an Affiliate Coupon Code is accepted by your configuration of s2Member.</li>' . "\n";
|
440 |
}
|
441 |
|
442 |
echo '<strong>Custom Registration/Profile Fields are also supported in this Notification:</strong>' . "\n";
|
443 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
444 |
echo '<li><code>%%date_of_birth%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>date_of_birth</code>.</li>' . "\n";
|
445 |
echo '<li><code>%%street_address%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>street_address</code>.</li>' . "\n";
|
446 |
echo '<li><code>%%country%%</code> would be valid; if you have a Custom Registration/Profile Field with the ID <code>country</code>.</li>' . "\n";
|
448 |
echo '</ul>' . "\n";
|
449 |
|
450 |
echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
|
451 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
452 |
echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>' . "\n";
|
453 |
echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>' . "\n";
|
454 |
echo '</ul>' . "\n";
|
525 |
echo '<textarea name="ws_plugin__s2member_cancellation_notification_urls" id="ws-plugin--s2member-cancellation-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) . '</textarea><br />' . "\n";
|
526 |
echo 'Cancellation Notifications take place silently behind-the-scene, using an HTTP connection.<br /><br />' . "\n";
|
527 |
echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
|
528 |
+
echo '<ul class="ws-menu-page-li-margins">' . "\n";
|
529 |
echo '<li><code>%%subscr_id%%</code> = The Paid Subscription ID, which remained constant throughout the lifetime of the Membership. [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality; the %%subscr_id%% is actually set to the original Transaction ID for the purchase. Payment Gateways do not provide a specific Subscription ID for Buy Now purchases. Since Lifetime & Fixed-Term Subscriptions are NOT recurring (i.e. there was only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
|
530 |
+
echo '<li><code>%%subscr_baid%%</code> = Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that required a Billing Agreement. This is the Subscription\'s Billing Agreement ID, which remained constant throughout the lifetime of the Membership. [ <a href="#" onclick="alert(\'Applicable only with PayPal Pro (Payflow Edition); and only for Express Checkout transactions that required a Billing Agreement. In all other cases, the %%subscr_baid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% in most cases.\'); return false;">?</a> ]</li>' . "\n";
|
531 |
+
echo '<li><code>%%subscr_cid%%</code> = Applicable only with Stripe integration. This is the Customer\'s ID in Stripe, which remained constant throughout the lifetime of the Membership. Each Stripe Customer has this Customer ID; and also a Subscription and/or Transaction ID [ <a href="#" onclick="alert(\'Applicable only when you integrate s2Member with Stripe. In all other cases, the %%subscr_cid%% is simply set to the %%subscr_id%% value; i.e. it is a duplicate of %%subscr_id%% when running anything other than Stripe.\\n\\nEach Stripe Customer has a Customer ID; and also a Subscription and/or Transaction ID. See %%subscr_id%% for further details.\'); return false;">?</a> ]</li>' . "\n";
|
532 |
echo '<li><code>%%item_number%%</code> = The Item Number (colon separated <em>level:custom_capabilities:fixed term</em>) that the Subscription was for.</li>' . "\n";
|
533 |
echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item N
|