s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) - Version 3.2.2

Version Description

  • Simple Conditionals ( completely re-written ). Simple Conditionals, first introduced in s2Member v3.2.1; have been completely re-written to support a wider range of features. The new Shortcode is s2If. The older Shortcodes have now been deprecated: s2All, s2Any ( do NOT use ). The older Shortcodes will continue to work with backward compatiblity, but they'll be removed in a future release of s2Member. Please update any existing Shortcodes referencing s2All,s2Any ( do NOT use ), by switching them all over to s2If instead. We apologize for the drastic changes to this new feature; but it was a necessary step forward. The initial release of Simple Conditionals was very buggy, and NOT as extensible as the new s2If logic is now. If you've been using Simple Conditionals, you will need to re-review all documentation and code samples. The new s2If Shortcode is fully documented, inside your WordPress Dashboard under: s2Member -> API Scripting -> Simple Conditionals.
  • Starting with s2Member v3.2.3, "Simple Conditionals" are now available to you from within WordPress, using Shortcodes that are fully compatible with both the Visual Editor, and also the HTML Tab in WordPress. We've been through all of the documentation for s2Member, and updated (again) ALL code samples to provide you with Shortcode equivalents. You can learn more about this new feature in your WP Dashboard, under: s2Member -> API Scripting -> Simple Conditionals. Simple Conditionals are a NEW feature, and they'll have no affect on Advanced Conditionals; which have always been available for s2Member.
  • Bug Dodging. A call to get_defined_constants(true) inside css-js-w-globals.inc.php was causing a segfault on some installations of PHP 5.2. Bug reports at PHP.net indicate this is caused by the (true) argument being passed; and under the right conditions ( e.g. with the right combination of PHP extensions installed ) this can result in a segfault. In this release of s2Member ( v3.2.2 ), we've dodged this PHP bug completely, by implementing a different method for tracking the integrity of API Constants, thereby circumventing this odd behavior on some Apache/PHP installations. s2Member no longer makes any calls to the get_defined_constants() function.
  • New Feature. s2Member can now send automatic API Notification Emails, which include a full Transaction Log for each API Notification event. In other words, you can now tell s2Member to send emails to different addresses, for each of s2Member's API Notification events. For further details, see: s2Member -> API Notifications. Look for "Email Transaction Log" under each sub-section. This new feature will make it easier to integrate s2Member with back-office routines, and in particular, easier to integrate with 3rd-party list servers - other than MailChimp/AWeber, which s2Member already supports natively. This new feature also makes it easier to build confidence in s2Member. As a Site Owner, you may configure email notifications for each event, and monitor s2Member's behavior.
  • New API Notification. s2Member can now process separate API Notifications for "Cancellation" events. For further details, see: s2Member -> API Notifications -> Cancellations. Using this feature in conjunction with the new Email Transaction Logs, you can be notified via email; each time a Cancellation occurs.
  • Bug fix. On a Multisite Blog Farm, s2Member was missing an important Hook/Filter ( signup_hidden_fields ) during a registration that included both an account, and also a Blog. This bug has been resolved with s2Member v3.2.2+.
Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 3.2.2
Comparing to
See all releases

Code changes from version 3.2.1 to 3.2.2

Files changed (35) hide show
  1. includes/codes.inc.php +21 -9
  2. includes/functions/auto-eots.inc.php +47 -12
  3. includes/functions/constants.inc.php +71 -68
  4. includes/functions/css-js-w-globals.inc.php +14 -22
  5. includes/functions/paypal-button.inc.php +7 -8
  6. includes/functions/paypal-notify.inc.php +301 -6
  7. includes/functions/register-access.inc.php +73 -2
  8. includes/functions/sc-get-details.inc.php +11 -12
  9. includes/functions/sc-if-conditionals.inc.php +237 -0
  10. includes/functions/{sc-conditionals.inc.php → sc-old-conditionals.inc.php} +11 -6
  11. includes/functions/user-deletions.inc.php +51 -15
  12. includes/functions/utilities.inc.php +16 -0
  13. includes/hooks.inc.php +2 -1
  14. includes/menu-pages/api-ops.inc.php +252 -11
  15. includes/menu-pages/code-samples/current-user-access-level-conditional-upgrades.php +10 -10
  16. includes/menu-pages/code-samples/current-user-access-level.php +12 -12
  17. includes/menu-pages/code-samples/current-user-can-ccaps-1.php +8 -8
  18. includes/menu-pages/code-samples/current-user-can-ccaps-2.php +16 -16
  19. includes/menu-pages/code-samples/current-user-fields.php +6 -6
  20. includes/menu-pages/code-samples/current-user-is-logged-in-as-member.php +2 -2
  21. includes/menu-pages/code-samples/current-user-is-logged-in.php +2 -2
  22. includes/menu-pages/code-samples/sc-current-user-can-full-access.php +4 -4
  23. includes/menu-pages/code-samples/sc-current-user-is-specific-content.php +12 -12
  24. includes/menu-pages/code-samples/sc-is-user-logged-in.php +5 -4
  25. includes/menu-pages/code-samples/sc-s2-conditional-nesting.php +5 -0
  26. includes/menu-pages/code-samples/sc-s2-conditional-supplements-1.php +8 -8
  27. includes/menu-pages/code-samples/sc-s2-conditional-supplements-2.php +14 -14
  28. includes/menu-pages/code-samples/sc-s2-conditional-supplements-3.php +18 -12
  29. includes/menu-pages/mms-options.inc.php +3 -3
  30. includes/menu-pages/options.inc.php +3 -3
  31. includes/menu-pages/scripting.inc.php +89 -81
  32. includes/menu-pages/trk-ops.inc.php +4 -4
  33. includes/syscon.inc.php +20 -23
  34. readme.txt +11 -4
  35. s2member.php +3 -3
includes/codes.inc.php CHANGED
@@ -19,15 +19,27 @@ http://codex.wordpress.org/Shortcode_API
19
  */
20
  add_shortcode ("s2Get", "ws_plugin__s2member_sc_get_details");
21
  /**/
22
- add_shortcode ("s2All", "ws_plugin__s2member_sc_conditionals");
23
- add_shortcode ("_s2All", "ws_plugin__s2member_sc_conditionals");
24
- add_shortcode ("__s2All", "ws_plugin__s2member_sc_conditionals");
25
- add_shortcode ("___s2All", "ws_plugin__s2member_sc_conditionals");
26
- /**/
27
- add_shortcode ("s2Any", "ws_plugin__s2member_sc_conditionals");
28
- add_shortcode ("_s2Any", "ws_plugin__s2member_sc_conditionals");
29
- add_shortcode ("__s2Any", "ws_plugin__s2member_sc_conditionals");
30
- add_shortcode ("___s2Any", "ws_plugin__s2member_sc_conditionals");
31
  /**/
32
  add_shortcode ("s2Member-PayPal-Button", "ws_plugin__s2member_sc_paypal_button");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  ?>
19
  */
20
  add_shortcode ("s2Get", "ws_plugin__s2member_sc_get_details");
21
  /**/
22
+ add_shortcode ("s2If", "ws_plugin__s2member_sc_if_conditionals");
23
+ add_shortcode ("_s2If", "ws_plugin__s2member_sc_if_conditionals");
24
+ add_shortcode ("__s2If", "ws_plugin__s2member_sc_if_conditionals");
25
+ add_shortcode ("___s2If", "ws_plugin__s2member_sc_if_conditionals");
 
 
 
 
 
26
  /**/
27
  add_shortcode ("s2Member-PayPal-Button", "ws_plugin__s2member_sc_paypal_button");
28
+ /*
29
+ ----------------------------------------------------------------------------------------
30
+ The following Shortcodes were deprecated in v3.2.2.
31
+ Going forward, use [s2If] instead ( it's more powerful ).
32
+ @NOTE: These Shortcodes were ONLY available in v3.2.1.
33
+ ~ These WILL all be removed in a future release.
34
+ ----------------------------------------------------------------------------------------
35
+ */
36
+ add_shortcode ("s2All", "ws_plugin__s2member_sc_old_conditionals");
37
+ add_shortcode ("_s2All", "ws_plugin__s2member_sc_old_conditionals");
38
+ add_shortcode ("__s2All", "ws_plugin__s2member_sc_old_conditionals");
39
+ add_shortcode ("___s2All", "ws_plugin__s2member_sc_old_conditionals");
40
+ /**/
41
+ add_shortcode ("s2Any", "ws_plugin__s2member_sc_old_conditionals");
42
+ add_shortcode ("_s2Any", "ws_plugin__s2member_sc_old_conditionals");
43
+ add_shortcode ("__s2Any", "ws_plugin__s2member_sc_old_conditionals");
44
+ add_shortcode ("___s2Any", "ws_plugin__s2member_sc_old_conditionals");
45
  ?>
includes/functions/auto-eots.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit ("Do not access this file directly.");
16
  /*
17
  Function processed by WP-Cron. This handles Auto-EOTs.
18
 
@@ -71,7 +71,7 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
71
  /**/
72
  ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
73
  /**/
74
- if ($subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
75
  {
76
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
77
  /**/
@@ -79,13 +79,48 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
79
  if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
80
  if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
81
  if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
82
- if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  /**/
84
- if (($url = trim ($url))) /* Empty? */
85
- ws_plugin__s2member_remote ($url);
 
86
  }
87
  /**/
88
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
89
  do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
90
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
91
  }
@@ -100,14 +135,14 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
100
  /**/
101
  else /* Otherwise, we can actually delete them. */
102
  /* This will automatically trigger `eot_del_notification_urls` as well. */
103
- wp_delete_user ($user_id); /* `ws_plugin__s2member_handle_user_deletions()` */
104
  /**/
105
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
106
  do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
107
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
108
  }
109
  /**/
110
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
111
  do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
112
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
113
  }
@@ -116,7 +151,7 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
116
  }
117
  }
118
  /**/
119
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
120
  do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
121
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
122
  /**/
@@ -185,8 +220,8 @@ if (!function_exists ("ws_plugin__s2member_delete_auto_eot_system"))
185
  /**/
186
  if (function_exists ("wp_cron"))
187
  {
188
- wp_clear_scheduled_hook ("s2member_auto_eot_system"); /* This is for backward compatibility. */
189
- wp_clear_scheduled_hook ("ws_plugin__s2member_auto_eot_system__schedule"); /* Since v3.0.3. */
190
  /**/
191
  return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
192
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Function processed by WP-Cron. This handles Auto-EOTs.
18
 
71
  /**/
72
  ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
73
  /**/
74
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
75
  {
76
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
77
  /**/
79
  if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
80
  if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
81
  if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
82
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_login)), $url)))
83
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
84
+ /**/
85
+ if (($url = trim ($url))) /* Empty? */
86
+ ws_plugin__s2member_remote($url);
87
+ }
88
+ /**/
89
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
90
+ {
91
+ $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
92
+ $msg .= "\n\n"; /* Spacing in the message body. */
93
+ $msg .= "subscr_id: %%subscr_id%%\n";
94
+ $msg .= "user_first_name: %%user_first_name%%\n";
95
+ $msg .= "user_last_name: %%user_last_name%%\n";
96
+ $msg .= "user_full_name: %%user_full_name%%\n";
97
+ $msg .= "user_email: %%user_email%%\n";
98
+ $msg .= "user_login: %%user_login%%\n";
99
+ $msg .= "user_id: %%user_id%%\n";
100
+ $msg .= "cv0: %%cv0%%\n";
101
+ $msg .= "cv1: %%cv1%%\n";
102
+ $msg .= "cv2: %%cv2%%\n";
103
+ $msg .= "cv3: %%cv3%%\n";
104
+ $msg .= "cv4: %%cv4%%\n";
105
+ $msg .= "cv5: %%cv5%%\n";
106
+ $msg .= "cv6: %%cv6%%\n";
107
+ $msg .= "cv7: %%cv7%%\n";
108
+ $msg .= "cv8: %%cv8%%\n";
109
+ $msg .= "cv9: %%cv9%%";
110
+ /**/
111
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($subscr_id), $msg)))
112
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($user->last_name), $msg)))
113
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
114
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($user->user_email), $msg)))
115
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($user->user_login), $msg)))
116
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
117
  /**/
118
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
119
+ /**/
120
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_eot_del_notification_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") : null;
121
  }
122
  /**/
123
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
124
  do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
125
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
126
  }
135
  /**/
136
  else /* Otherwise, we can actually delete them. */
137
  /* This will automatically trigger `eot_del_notification_urls` as well. */
138
+ wp_delete_user($user_id); /* `ws_plugin__s2member_handle_user_deletions()` */
139
  /**/
140
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
141
  do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
142
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
143
  }
144
  /**/
145
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
146
  do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
147
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
148
  }
151
  }
152
  }
153
  /**/
154
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
155
  do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
156
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
157
  /**/
220
  /**/
221
  if (function_exists ("wp_cron"))
222
  {
223
+ wp_clear_scheduled_hook("s2member_auto_eot_system"); /* This is for backward compatibility. */
224
+ wp_clear_scheduled_hook("ws_plugin__s2member_auto_eot_system__schedule"); /* Since v3.0.3. */
225
  /**/
226
  return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
227
  }
includes/functions/constants.inc.php CHANGED
@@ -40,71 +40,74 @@ if (!function_exists ("ws_plugin__s2member_constants"))
40
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
41
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
42
  /**/
43
- define ("S2MEMBER_VERSION", WS_PLUGIN__S2MEMBER_VERSION); /* Available since 3.0. */
44
- /**/
45
- define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", (($current_user) ? true : false));
46
- define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", (($current_user && $level >= 1) ? true : false));
47
- define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", (int)$level);
48
- define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]);
49
- define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : ""));
50
- define ("S2MEMBER_CURRENT_USER_CUSTOM", (string)$custom);
51
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", (($current_user) ? (int)strtotime ($current_user->user_registered) : 0));
52
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", (($current_user) ? (int)floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0));
53
- define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", (($current_user) ? (string)$current_user->display_name : ""));
54
- define ("S2MEMBER_CURRENT_USER_FIRST_NAME", (($current_user) ? (string)$current_user->first_name : ""));
55
- define ("S2MEMBER_CURRENT_USER_LAST_NAME", (($current_user) ? (string)$current_user->last_name : ""));
56
- define ("S2MEMBER_CURRENT_USER_LOGIN", (($current_user) ? (string)$current_user->user_login : ""));
57
- define ("S2MEMBER_CURRENT_USER_EMAIL", (($current_user) ? (string)$current_user->user_email : ""));
58
- define ("S2MEMBER_CURRENT_USER_IP", (string)$_SERVER["REMOTE_ADDR"]);
59
- define ("S2MEMBER_CURRENT_USER_ID", (($current_user) ? (int)$current_user->ID : 0));
60
- define ("S2MEMBER_CURRENT_USER_FIELDS", (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ())));
61
- /**/
62
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", (int)$file_downloads["allowed"]);
63
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", (($file_downloads["allowed"] >= 999999999) ? true : false));
64
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", (int)$file_downloads["currently"]);
65
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", (int)$file_downloads["allowed_days"]);
66
- /**/
67
- define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]);
68
- define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]);
69
- define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]);
70
- /**/
71
- define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", get_bloginfo ("wpurl") . "/?s2member_profile=1");
72
- define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", (string)$links["file_download_limit_exceeded_page"]);
73
- define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", (string)$links["membership_options_page"]);
74
- define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", (($login_redirection_override) ? (string)$login_redirection_override : (string)$links["login_welcome_page"]));
75
- define ("S2MEMBER_LOGOUT_PAGE_URL", (string)wp_logout_url ());
76
- define ("S2MEMBER_LOGIN_PAGE_URL", (string)wp_login_url ());
77
- /**/
78
- define ("S2MEMBER_LEVEL0_LABEL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]);
79
- define ("S2MEMBER_LEVEL1_LABEL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]);
80
- define ("S2MEMBER_LEVEL2_LABEL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]);
81
- define ("S2MEMBER_LEVEL3_LABEL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]);
82
- define ("S2MEMBER_LEVEL4_LABEL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]);
83
- /**/
84
- define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"]);
85
- define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]);
86
- define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]);
87
- define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]);
88
- define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]);
89
- /**/
90
- define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"]);
91
- define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]);
92
- define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]);
93
- define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]);
94
- define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"]);
95
- /**/
96
- define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]);
97
- /**/
98
- define ("S2MEMBER_REG_EMAIL_FROM_NAME", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]);
99
- define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]);
100
- /**/
101
- define ("S2MEMBER_PAYPAL_NOTIFY_URL", get_bloginfo ("wpurl") . "/?s2member_paypal_notify=1");
102
- define ("S2MEMBER_PAYPAL_RETURN_URL", get_bloginfo ("wpurl") . "/?s2member_paypal_return=1");
103
- define ("S2MEMBER_PAYPAL_ENDPOINT", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"));
104
- define ("S2MEMBER_PAYPAL_BUSINESS", (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]);
105
- /**/
106
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr. ID" : ""));
107
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : ""));
 
 
 
108
  /**/
109
  do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
110
  /**/
@@ -133,7 +136,7 @@ if (!function_exists ("ws_plugin__s2member_constant_links"))
133
  $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
134
  $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
135
  /**/
136
- if ($login_welcome_page && $login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["link"] && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
137
  {
138
  $l["login_welcome_page"] = $login_welcome_page_cache["link"];
139
  }
@@ -146,7 +149,7 @@ if (!function_exists ("ws_plugin__s2member_constant_links"))
146
  $cache_needs_updating = true;
147
  }
148
  /**/
149
- if ($membership_options_page && $membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["link"] && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
150
  {
151
  $l["membership_options_page"] = $membership_options_page_cache["link"];
152
  }
@@ -159,7 +162,7 @@ if (!function_exists ("ws_plugin__s2member_constant_links"))
159
  $cache_needs_updating = true;
160
  }
161
  /**/
162
- if ($file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["link"] && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
163
  {
164
  $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
165
  }
40
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
41
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
42
  /**/
43
+ define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION)); /* Available since 3.0. */
44
+ /**/
45
+ define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($current_user) ? true : false)));
46
+ define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = (($current_user && $level >= 1) ? true : false)));
47
+ define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
48
+ define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
49
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : "")));
50
+ define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (string)$custom));
51
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = (($current_user) ? (int)strtotime ($current_user->user_registered) : 0)));
52
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", ($c[] = (($current_user) ? (int)floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)));
53
+ define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", ($c[] = (($current_user) ? (string)$current_user->display_name : "")));
54
+ define ("S2MEMBER_CURRENT_USER_FIRST_NAME", ($c[] = (($current_user) ? (string)$current_user->first_name : "")));
55
+ define ("S2MEMBER_CURRENT_USER_LAST_NAME", ($c[] = (($current_user) ? (string)$current_user->last_name : "")));
56
+ define ("S2MEMBER_CURRENT_USER_LOGIN", ($c[] = (($current_user) ? (string)$current_user->user_login : "")));
57
+ define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($current_user) ? (string)$current_user->user_email : "")));
58
+ define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
59
+ define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($current_user) ? (int)$current_user->ID : 0)));
60
+ define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
61
+ /**/
62
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
63
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = (($file_downloads["allowed"] >= 999999999) ? true : false)));
64
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", ($c[] = (int)$file_downloads["currently"]));
65
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$file_downloads["allowed_days"]));
66
+ /**/
67
+ define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]));
68
+ define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]));
69
+ define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
70
+ /**/
71
+ define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = get_bloginfo ("wpurl") . "/?s2member_profile=1"));
72
+ define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
73
+ define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"]));
74
+ define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_override) ? (string)$login_redirection_override : (string)$links["login_welcome_page"])));
75
+ define ("S2MEMBER_LOGOUT_PAGE_URL", ($c[] = (string)wp_logout_url ()));
76
+ define ("S2MEMBER_LOGIN_PAGE_URL", ($c[] = (string)wp_login_url ()));
77
+ /**/
78
+ define ("S2MEMBER_LEVEL0_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]));
79
+ define ("S2MEMBER_LEVEL1_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]));
80
+ define ("S2MEMBER_LEVEL2_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]));
81
+ define ("S2MEMBER_LEVEL3_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]));
82
+ define ("S2MEMBER_LEVEL4_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]));
83
+ /**/
84
+ define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"]));
85
+ define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]));
86
+ define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]));
87
+ define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]));
88
+ define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]));
89
+ /**/
90
+ define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"]));
91
+ define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]));
92
+ define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]));
93
+ define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]));
94
+ define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"]));
95
+ /**/
96
+ define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]));
97
+ /**/
98
+ define ("S2MEMBER_REG_EMAIL_FROM_NAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]));
99
+ define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
100
+ /**/
101
+ define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = get_bloginfo ("wpurl") . "/?s2member_paypal_notify=1"));
102
+ define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = get_bloginfo ("wpurl") . "/?s2member_paypal_return=1"));
103
+ define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
104
+ define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
105
+ /**/
106
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr. ID" : "")));
107
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")));
108
+ /**/
109
+ define ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5", md5 (serialize ($c))); /* Used as a Checksum against the state of these Constants. */
110
+ /* ^This particular Constant will NOT be included as part of the official API. It is ONLY used internally by s2Member for optimizations. */
111
  /**/
112
  do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
113
  /**/
136
  $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
137
  $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
138
  /**/
139
+ if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
140
  {
141
  $l["login_welcome_page"] = $login_welcome_page_cache["link"];
142
  }
149
  $cache_needs_updating = true;
150
  }
151
  /**/
152
+ if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
153
  {
154
  $l["membership_options_page"] = $membership_options_page_cache["link"];
155
  }
162
  $cache_needs_updating = true;
163
  }
164
  /**/
165
+ if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
166
  {
167
  $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
168
  }
includes/functions/css-js-w-globals.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
  /*
17
  Function adds styles to the header.
18
  Do NOT enqueue styles in the admin area.
@@ -48,16 +48,16 @@ if (!function_exists ("ws_plugin__s2member_css"))
48
  /**/
49
  if ($_GET["ws_plugin__s2member_css"])
50
  {
51
- header("Content-Type: text/css; charset=utf-8");
52
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
53
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
54
- header("Cache-Control: max-age=604800");
55
- header("Pragma: public");
56
  /**/
57
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
58
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
59
  /**/
60
- ob_start("ws_plugin__s2member_compress_css"); /* Compress. */
61
  /**/
62
  include_once dirname (dirname (__FILE__)) . "/s2member.css";
63
  /**/
@@ -84,16 +84,8 @@ if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
84
  {
85
  if (is_user_logged_in ())
86
  {
87
- $a = get_defined_constants (true);
88
- $c = (array)$a["user"];
89
- unset($a);
90
- /**/
91
- foreach ($c as $k => $v)
92
- if (preg_match ("/^S2MEMBER_/i", $k))
93
- $s2member[$k] = $v;
94
- /**/
95
- $md5 = md5 (serialize ($s2member)); /* This is a hash based on the global key => values. */
96
- /* The md5 hash allows the script to be cached in the browser until the globals happen to change. */
97
  /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
98
  wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("wpurl") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5, array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
99
  }
@@ -122,11 +114,11 @@ if (!function_exists ("ws_plugin__s2member_js_w_globals"))
122
  /**/
123
  if ($_GET["ws_plugin__s2member_js_w_globals"])
124
  {
125
- header("Content-Type: text/javascript; charset=utf-8");
126
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
127
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
128
- header("Cache-Control: max-age=604800");
129
- header("Pragma: public");
130
  /**/
131
  $g = "var S2MEMBER_VERSION = '" . ws_plugin__s2member_esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
132
  /**/
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function adds styles to the header.
18
  Do NOT enqueue styles in the admin area.
48
  /**/
49
  if ($_GET["ws_plugin__s2member_css"])
50
  {
51
+ header ("Content-Type: text/css; charset=utf-8");
52
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
53
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
54
+ header ("Cache-Control: max-age=604800");
55
+ header ("Pragma: public");
56
  /**/
57
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
58
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
59
  /**/
60
+ ob_start ("ws_plugin__s2member_compress_css"); /* Compress. */
61
  /**/
62
  include_once dirname (dirname (__FILE__)) . "/s2member.css";
63
  /**/
84
  {
85
  if (is_user_logged_in ())
86
  {
87
+ $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
88
+ /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
 
 
 
 
 
 
 
 
89
  /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
90
  wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("wpurl") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5, array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
91
  }
114
  /**/
115
  if ($_GET["ws_plugin__s2member_js_w_globals"])
116
  {
117
+ header ("Content-Type: text/javascript; charset=utf-8");
118
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
119
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
120
+ header ("Cache-Control: max-age=604800");
121
+ header ("Pragma: public");
122
  /**/
123
  $g = "var S2MEMBER_VERSION = '" . ws_plugin__s2member_esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
124
  /**/
includes/functions/paypal-button.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
  /*
17
  Function that handles the Shortcode for [s2Member-PayPal-Button /].
18
  Attach to: add_shortcode("s2Member-PayPal-Button");
@@ -29,12 +29,11 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
29
  {
30
  function ws_plugin__s2member_sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
31
  {
32
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
33
  do_action ("ws_plugin__s2member_before_sc_paypal_button", get_defined_vars ());
34
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
35
  /**/
36
- $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
37
- that have been corrupted by a non-default visual editor; ( i.e. CKEditor does this ). */
38
  /**/
39
  $attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
40
  $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
@@ -49,7 +48,7 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
49
  /**/
50
  $attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
51
  /**/
52
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
53
  do_action ("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars ());
54
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
  /**/
@@ -61,7 +60,7 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
61
  /**/
62
  $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
63
  /**/
64
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  do_action ("ws_plugin__s2member_during_sc_paypal_cancellation_button", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  }
@@ -87,7 +86,7 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
87
  /**/
88
  $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
89
  /**/
90
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
91
  do_action ("ws_plugin__s2member_during_sc_paypal_sp_button", get_defined_vars ());
92
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
  }
@@ -133,7 +132,7 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
133
  /**/
134
  $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
135
  /**/
136
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
137
  ($attr["modify"]) ? do_action ("ws_plugin__s2member_during_sc_paypal_modification_button", get_defined_vars ()) : do_action ("ws_plugin__s2member_during_sc_paypal_button", get_defined_vars ());
138
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that handles the Shortcode for [s2Member-PayPal-Button /].
18
  Attach to: add_shortcode("s2Member-PayPal-Button");
29
  {
30
  function ws_plugin__s2member_sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
31
  {
32
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
33
  do_action ("ws_plugin__s2member_before_sc_paypal_button", get_defined_vars ());
34
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
35
  /**/
36
+ $attr = ws_plugin__s2member_trim_quot_deep ((array)$attr); /* Force array, and fix &quot; in attrs. */
 
37
  /**/
38
  $attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
39
  $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
48
  /**/
49
  $attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
50
  /**/
51
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
  do_action ("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars ());
53
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
  /**/
60
  /**/
61
  $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
62
  /**/
63
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
64
  do_action ("ws_plugin__s2member_during_sc_paypal_cancellation_button", get_defined_vars ());
65
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
66
  }
86
  /**/
87
  $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
88
  /**/
89
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
90
  do_action ("ws_plugin__s2member_during_sc_paypal_sp_button", get_defined_vars ());
91
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
  }
132
  /**/
133
  $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
134
  /**/
135
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
136
  ($attr["modify"]) ? do_action ("ws_plugin__s2member_during_sc_paypal_modification_button", get_defined_vars ()) : do_action ("ws_plugin__s2member_during_sc_paypal_button", get_defined_vars ());
137
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
138
  }
includes/functions/paypal-notify.inc.php CHANGED
@@ -227,6 +227,46 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
227
  $paypal["s2member_log"][] = "Specific Post/Page Access Notification URLs have been processed.";
228
  }
229
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  if ($processing && ($url = $paypal["proxy_return_url"])) /* A proxy is requesting a return URL for this transaction? */
231
  {
232
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", ws_plugin__s2member_esc_ds (rawurlencode ($sp_access_url)), $url)))
@@ -445,6 +485,48 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
445
  $paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
446
  }
447
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
449
  {
450
  if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $code)))
@@ -511,6 +593,47 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
511
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
512
  }
513
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
514
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
515
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
516
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -662,6 +785,47 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
662
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
663
  }
664
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
666
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
667
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -751,7 +915,60 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
751
  }
752
  else
753
  {
754
- $paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  }
756
  }
757
  else
@@ -822,20 +1039,57 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
822
  /**/
823
  if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
824
  {
825
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications. */
826
  /**/
827
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
828
  if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
829
  if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
830
  if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
831
- if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
832
- /**/
833
- if (($url = trim ($url))) /* Empty? */
834
- ws_plugin__s2member_remote ($url);
 
835
  /**/
836
  $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
837
  }
838
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
840
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars ());
841
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -931,6 +1185,47 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
931
  $paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
932
  }
933
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
935
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars ());
936
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
227
  $paypal["s2member_log"][] = "Specific Post/Page Access Notification URLs have been processed.";
228
  }
229
  /**/
230
+ if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_recipients"])
231
+ {
232
+ $msg = $sbj = "( s2Member / API Notification Email ) - Specific Post/Page Access";
233
+ $msg .= "\n\n"; /* Spacing in the message body. */
234
+ $msg .= "sp_access_url: %%sp_access_url%%\n";
235
+ $msg .= "sp_access_exp: %%sp_access_exp%%\n";
236
+ $msg .= "amount: %%amount%%\n";
237
+ $msg .= "txn_id: %%txn_id%%\n";
238
+ $msg .= "item_number: %%item_number%%\n";
239
+ $msg .= "item_name: %%item_name%%\n";
240
+ $msg .= "first_name: %%first_name%%\n";
241
+ $msg .= "last_name: %%last_name%%\n";
242
+ $msg .= "full_name: %%full_name%%\n";
243
+ $msg .= "payer_email: %%payer_email%%\n";
244
+ $msg .= "cv0: %%cv0%%\n";
245
+ $msg .= "cv1: %%cv1%%\n";
246
+ $msg .= "cv2: %%cv2%%\n";
247
+ $msg .= "cv3: %%cv3%%\n";
248
+ $msg .= "cv4: %%cv4%%\n";
249
+ $msg .= "cv5: %%cv5%%\n";
250
+ $msg .= "cv6: %%cv6%%\n";
251
+ $msg .= "cv7: %%cv7%%\n";
252
+ $msg .= "cv8: %%cv8%%\n";
253
+ $msg .= "cv9: %%cv9%%";
254
+ /**/
255
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%sp_access_url%%/i", ws_plugin__s2member_esc_ds ($sp_access_url), $msg)))
256
+ if (($msg = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $msg)))
257
+ if (($msg = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $msg)))
258
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
259
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
260
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
261
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
262
+ /**/
263
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_recipients"])) as $recipient)
264
+ /**/
265
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_sp_notification_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") : null;
266
+ /**/
267
+ $paypal["s2member_log"][] = "Specific Post/Page Access Notification Emails have been processed.";
268
+ }
269
+ /**/
270
  if ($processing && ($url = $paypal["proxy_return_url"])) /* A proxy is requesting a return URL for this transaction? */
271
  {
272
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", ws_plugin__s2member_esc_ds (rawurlencode ($sp_access_url)), $url)))
485
  $paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
486
  }
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
+ $msg .= "subscr_id: %%subscr_id%%\n";
493
+ $msg .= "initial: %%initial%%\n";
494
+ $msg .= "regular: %%regular%%\n";
495
+ $msg .= "recurring: %%recurring%%\n";
496
+ $msg .= "initial_term: %%initial_term%%\n";
497
+ $msg .= "regular_term: %%regular_term%%\n";
498
+ $msg .= "item_number: %%item_number%%\n";
499
+ $msg .= "item_name: %%item_name%%\n";
500
+ $msg .= "first_name: %%first_name%%\n";
501
+ $msg .= "last_name: %%last_name%%\n";
502
+ $msg .= "full_name: %%full_name%%\n";
503
+ $msg .= "payer_email: %%payer_email%%\n";
504
+ $msg .= "cv0: %%cv0%%\n";
505
+ $msg .= "cv1: %%cv1%%\n";
506
+ $msg .= "cv2: %%cv2%%\n";
507
+ $msg .= "cv3: %%cv3%%\n";
508
+ $msg .= "cv4: %%cv4%%\n";
509
+ $msg .= "cv5: %%cv5%%\n";
510
+ $msg .= "cv6: %%cv6%%\n";
511
+ $msg .= "cv7: %%cv7%%\n";
512
+ $msg .= "cv8: %%cv8%%\n";
513
+ $msg .= "cv9: %%cv9%%";
514
+ /**/
515
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)))
516
+ if (($msg = preg_replace ("/%%initial%%/i", ws_plugin__s2member_esc_ds ($paypal["initial"]), $msg)) && ($msg = preg_replace ("/%%regular%%/i", ws_plugin__s2member_esc_ds ($paypal["regular"]), $msg)) && ($msg = preg_replace ("/%%recurring%%/i", ws_plugin__s2member_esc_ds ($paypal["recurring"]), $msg)))
517
+ if (($msg = preg_replace ("/%%initial_term%%/i", ws_plugin__s2member_esc_ds ($paypal["initial_term"]), $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", ws_plugin__s2member_esc_ds ($paypal["regular_term"]), $msg)))
518
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
519
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
520
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
521
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
522
+ /**/
523
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"])) as $recipient)
524
+ /**/
525
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_signup_notification_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") : null;
526
+ /**/
527
+ $paypal["s2member_log"][] = "Signup Notification Emails have been processed.";
528
+ }
529
+ /**/
530
  if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
531
  {
532
  if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $code)))
593
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
594
  }
595
  /**/
596
+ if ($processing && preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
597
+ {
598
+ $msg = $sbj = "( s2Member / API Notification Email ) - Payment";
599
+ $msg .= "\n\n"; /* Spacing in the message body. */
600
+ $msg .= "subscr_id: %%subscr_id%%\n";
601
+ $msg .= "subscr_payment: %%subscr_payment%%\n";
602
+ $msg .= "subscr_payment_user_id: %%subscr_payment_user_id%%\n";
603
+ $msg .= "amount: %%amount%%\n";
604
+ $msg .= "txn_id: %%txn_id%%\n";
605
+ $msg .= "item_number: %%item_number%%\n";
606
+ $msg .= "item_name: %%item_name%%\n";
607
+ $msg .= "first_name: %%first_name%%\n";
608
+ $msg .= "last_name: %%last_name%%\n";
609
+ $msg .= "full_name: %%full_name%%\n";
610
+ $msg .= "payer_email: %%payer_email%%\n";
611
+ $msg .= "cv0: %%cv0%%\n";
612
+ $msg .= "cv1: %%cv1%%\n";
613
+ $msg .= "cv2: %%cv2%%\n";
614
+ $msg .= "cv3: %%cv3%%\n";
615
+ $msg .= "cv4: %%cv4%%\n";
616
+ $msg .= "cv5: %%cv5%%\n";
617
+ $msg .= "cv6: %%cv6%%\n";
618
+ $msg .= "cv7: %%cv7%%\n";
619
+ $msg .= "cv8: %%cv8%%\n";
620
+ $msg .= "cv9: %%cv9%%";
621
+ /**/
622
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)))
623
+ if (($msg = preg_replace ("/%%subscr_payment%%/i", ws_plugin__s2member_esc_ds ("0"), $msg)) && ($msg = preg_replace ("/%%subscr_payment_user_id%%/i", ws_plugin__s2member_esc_ds (""), $msg)))
624
+ if (($msg = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $msg)))
625
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
626
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
627
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
628
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
629
+ /**/
630
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"])) as $recipient)
631
+ /**/
632
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_payment_notification_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") : null;
633
+ /**/
634
+ $paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
635
+ }
636
+ /**/
637
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
638
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
639
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
785
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
786
  }
787
  /**/
788
+ if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
789
+ {
790
+ $msg = $sbj = "( s2Member / API Notification Email ) - Payment";
791
+ $msg .= "\n\n"; /* Spacing in the message body. */
792
+ $msg .= "subscr_id: %%subscr_id%%\n";
793
+ $msg .= "subscr_payment: %%subscr_payment%%\n";
794
+ $msg .= "subscr_payment_user_id: %%subscr_payment_user_id%%\n";
795
+ $msg .= "amount: %%amount%%\n";
796
+ $msg .= "txn_id: %%txn_id%%\n";
797
+ $msg .= "item_number: %%item_number%%\n";
798
+ $msg .= "item_name: %%item_name%%\n";
799
+ $msg .= "first_name: %%first_name%%\n";
800
+ $msg .= "last_name: %%last_name%%\n";
801
+ $msg .= "full_name: %%full_name%%\n";
802
+ $msg .= "payer_email: %%payer_email%%\n";
803
+ $msg .= "cv0: %%cv0%%\n";
804
+ $msg .= "cv1: %%cv1%%\n";
805
+ $msg .= "cv2: %%cv2%%\n";
806
+ $msg .= "cv3: %%cv3%%\n";
807
+ $msg .= "cv4: %%cv4%%\n";
808
+ $msg .= "cv5: %%cv5%%\n";
809
+ $msg .= "cv6: %%cv6%%\n";
810
+ $msg .= "cv7: %%cv7%%\n";
811
+ $msg .= "cv8: %%cv8%%\n";
812
+ $msg .= "cv9: %%cv9%%";
813
+ /**/
814
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)))
815
+ if (($msg = preg_replace ("/%%subscr_payment%%/i", ws_plugin__s2member_esc_ds ("1"), $msg)) && ($msg = preg_replace ("/%%subscr_payment_user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
816
+ if (($msg = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $msg)))
817
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
818
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
819
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
820
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
821
+ /**/
822
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"])) as $recipient)
823
+ /**/
824
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_payment_notification_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") : null;
825
+ /**/
826
+ $paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
827
+ }
828
+ /**/
829
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
830
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
831
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
915
  }
916
  else
917
  {
918
+ $paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member. An s2Member API Notification will still be processed however.";
919
+ }
920
+ /**/
921
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
922
+ {
923
+ foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) /* Handle Cancellation Notifications. */
924
+ /**/
925
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
926
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
927
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
928
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
929
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_login)), $url)))
930
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
931
+ /**/
932
+ if (($url = trim ($url))) /* Empty? */
933
+ ws_plugin__s2member_remote ($url);
934
+ /**/
935
+ $paypal["s2member_log"][] = "Cancellation Notification URLs have been processed.";
936
+ }
937
+ /**/
938
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
939
+ {
940
+ $msg = $sbj = "( s2Member / API Notification Email ) - Cancellation";
941
+ $msg .= "\n\n"; /* Spacing in the message body. */
942
+ $msg .= "subscr_id: %%subscr_id%%\n";
943
+ $msg .= "user_first_name: %%user_first_name%%\n";
944
+ $msg .= "user_last_name: %%user_last_name%%\n";
945
+ $msg .= "user_full_name: %%user_full_name%%\n";
946
+ $msg .= "user_email: %%user_email%%\n";
947
+ $msg .= "user_login: %%user_login%%\n";
948
+ $msg .= "user_id: %%user_id%%\n";
949
+ $msg .= "cv0: %%cv0%%\n";
950
+ $msg .= "cv1: %%cv1%%\n";
951
+ $msg .= "cv2: %%cv2%%\n";
952
+ $msg .= "cv3: %%cv3%%\n";
953
+ $msg .= "cv4: %%cv4%%\n";
954
+ $msg .= "cv5: %%cv5%%\n";
955
+ $msg .= "cv6: %%cv6%%\n";
956
+ $msg .= "cv7: %%cv7%%\n";
957
+ $msg .= "cv8: %%cv8%%\n";
958
+ $msg .= "cv9: %%cv9%%";
959
+ /**/
960
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)))
961
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($user->last_name), $msg)))
962
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
963
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($user->user_email), $msg)))
964
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($user->user_login), $msg)))
965
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
966
+ /**/
967
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"])) as $recipient)
968
+ /**/
969
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_cancellation_notification_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") : null;
970
+ /**/
971
+ $paypal["s2member_log"][] = "Cancellation Notification Emails have been processed.";
972
  }
973
  }
974
  else
1039
  /**/
1040
  if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
1041
  {
1042
+ foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
1043
  /**/
1044
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
1045
  if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
1046
  if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
1047
  if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
1048
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_login)), $url)))
1049
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
1050
+ /**/
1051
+ if (($url = trim ($url))) /* Empty? */
1052
+ ws_plugin__s2member_remote ($url);
1053
  /**/
1054
  $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
1055
  }
1056
  /**/
1057
+ if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
1058
+ {
1059
+ $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
1060
+ $msg .= "\n\n"; /* Spacing in the message body. */
1061
+ $msg .= "subscr_id: %%subscr_id%%\n";
1062
+ $msg .= "user_first_name: %%user_first_name%%\n";
1063
+ $msg .= "user_last_name: %%user_last_name%%\n";
1064
+ $msg .= "user_full_name: %%user_full_name%%\n";
1065
+ $msg .= "user_email: %%user_email%%\n";
1066
+ $msg .= "user_login: %%user_login%%\n";
1067
+ $msg .= "user_id: %%user_id%%\n";
1068
+ $msg .= "cv0: %%cv0%%\n";
1069
+ $msg .= "cv1: %%cv1%%\n";
1070
+ $msg .= "cv2: %%cv2%%\n";
1071
+ $msg .= "cv3: %%cv3%%\n";
1072
+ $msg .= "cv4: %%cv4%%\n";
1073
+ $msg .= "cv5: %%cv5%%\n";
1074
+ $msg .= "cv6: %%cv6%%\n";
1075
+ $msg .= "cv7: %%cv7%%\n";
1076
+ $msg .= "cv8: %%cv8%%\n";
1077
+ $msg .= "cv9: %%cv9%%";
1078
+ /**/
1079
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)))
1080
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($user->last_name), $msg)))
1081
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
1082
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($user->user_email), $msg)))
1083
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($user->user_login), $msg)))
1084
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
1085
+ /**/
1086
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
1087
+ /**/
1088
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_eot_del_notification_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") : null;
1089
+ /**/
1090
+ $paypal["s2member_log"][] = "EOT/Deletion Notification Emails have been processed.";
1091
+ }
1092
+ /**/
1093
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1094
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars ());
1095
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1185
  $paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
1186
  }
1187
  /**/
1188
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
1189
+ {
1190
+ $msg = $sbj = "( s2Member / API Notification Email ) - Refund/Reversal";
1191
+ $msg .= "\n\n"; /* Spacing in the message body. */
1192
+ $msg .= "subscr_id: %%subscr_id%%\n";
1193
+ $msg .= "parent_txn_id: %%parent_txn_id%%\n";
1194
+ $msg .= "item_number: %%item_number%%\n";
1195
+ $msg .= "item_name: %%item_name%%\n";
1196
+ $msg .= "-amount: %%-amount%%\n";
1197
+ $msg .= "-fee: %%-fee%%\n";
1198
+ $msg .= "first_name: %%first_name%%\n";
1199
+ $msg .= "last_name: %%last_name%%\n";
1200
+ $msg .= "full_name: %%full_name%%\n";
1201
+ $msg .= "payer_email: %%payer_email%%\n";
1202
+ $msg .= "user_id: %%user_id%%\n";
1203
+ $msg .= "cv0: %%cv0%%\n";
1204
+ $msg .= "cv1: %%cv1%%\n";
1205
+ $msg .= "cv2: %%cv2%%\n";
1206
+ $msg .= "cv3: %%cv3%%\n";
1207
+ $msg .= "cv4: %%cv4%%\n";
1208
+ $msg .= "cv5: %%cv5%%\n";
1209
+ $msg .= "cv6: %%cv6%%\n";
1210
+ $msg .= "cv7: %%cv7%%\n";
1211
+ $msg .= "cv8: %%cv8%%\n";
1212
+ $msg .= "cv9: %%cv9%%";
1213
+ /**/
1214
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)) && ($msg = preg_replace ("/%%parent_txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["parent_txn_id"]), $msg)))
1215
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
1216
+ if (($msg = preg_replace ("/%%-amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%-fee%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_fee"]), $msg)))
1217
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
1218
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
1219
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
1220
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
1221
+ /**/
1222
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_recipients"])) as $recipient)
1223
+ /**/
1224
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_ref_rev_notification_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") : null;
1225
+ /**/
1226
+ $paypal["s2member_log"][] = "Refund/Reversal Notification Emails have been processed.";
1227
+ }
1228
+ /**/
1229
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1230
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars ());
1231
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
includes/functions/register-access.inc.php CHANGED
@@ -815,6 +815,32 @@ if (!function_exists ("ws_plugin__s2member_register"))
815
  }
816
  }
817
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
  Function that adds customs fields to $meta on signup.
819
  Attach to: add_filter("add_signup_meta");
820
 
@@ -831,8 +857,8 @@ if (!function_exists ("ws_plugin__s2member_ms_process_signup_meta"))
831
  do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
832
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
833
  /**/
834
- if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
835
- if ((is_admin () && $pagenow === "user-new.php") || (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && $_POST["stage"] === "validate-user-signup"))
836
  {
837
  ws_plugin__s2member_email_config (); /* Configures From: header that will be used in notifications. */
838
  /**/
@@ -1285,7 +1311,9 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
1285
  ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
1286
  /**/
1287
  if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
 
1288
  foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
 
1289
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
1290
  if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
1291
  if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
@@ -1296,10 +1324,52 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
1296
  if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
1297
  if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
1298
  if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
 
1299
  if (($url = trim ($url))) /* Empty? */
1300
  ws_plugin__s2member_remote ($url);
1301
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1302
  if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
 
1303
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
1304
  if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
1305
  if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
@@ -1310,6 +1380,7 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
1310
  if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
1311
  if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
1312
  if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
 
1313
  if (($url = trim ($url))) /* Empty? ... Otherwise, re-fill. */
1314
  $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
1315
  /**/
815
  }
816
  }
817
  /*
818
+ Function that adds hidden fields to POST vars on signup.
819
+ Attach to: add_filter("signup_hidden_fields");
820
+
821
+ This can ONLY be fired through wp-signup.php on the front-side.
822
+ */
823
+ if (!function_exists ("ws_plugin__s2member_ms_process_signup_hidden_fields"))
824
+ {
825
+ function ws_plugin__s2member_ms_process_signup_hidden_fields ()
826
+ {
827
+ do_action ("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
828
+ /**/
829
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking, on a Blog Farm. */
830
+ if (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && $_POST["stage"] === "validate-user-signup")
831
+ {
832
+ foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
833
+ if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
834
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
835
+ echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr ($value) . '" />' . "\n";
836
+ /**/
837
+ do_action ("ws_plugin__s2member_during_ms_process_signup_hidden_fields", get_defined_vars ());
838
+ }
839
+ /**/
840
+ do_action ("ws_plugin__s2member_after_ms_process_signup_hidden_fields", get_defined_vars ());
841
+ }
842
+ }
843
+ /*
844
  Function that adds customs fields to $meta on signup.
845
  Attach to: add_filter("add_signup_meta");
846
 
857
  do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
858
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
859
  /**/
860
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. Either in the admin, or on a Blog Farm through wp-signup.php. */
861
+ if ((is_admin () && $pagenow === "user-new.php") || (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && preg_match ("/^validate-(user|blog)-signup$/", $_POST["stage"])))
862
  {
863
  ws_plugin__s2member_email_config (); /* Configures From: header that will be used in notifications. */
864
  /**/
1311
  ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
1312
  /**/
1313
  if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
1314
+ /**/
1315
  foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
1316
+ /**/
1317
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
1318
  if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
1319
  if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
1324
  if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
1325
  if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
1326
  if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
1327
+ /**/
1328
  if (($url = trim ($url))) /* Empty? */
1329
  ws_plugin__s2member_remote ($url);
1330
  /**/
1331
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
1332
+ {
1333
+ $msg = $sbj = "( s2Member / API Notification Email ) - Registration";
1334
+ $msg .= "\n\n"; /* Spacing in the message body. */
1335
+ $msg .= "role: %%role%%\n";
1336
+ $msg .= "level: %%level%%\n";
1337
+ $msg .= "user_first_name: %%user_first_name%%\n";
1338
+ $msg .= "user_last_name: %%user_last_name%%\n";
1339
+ $msg .= "user_full_name: %%user_full_name%%\n";
1340
+ $msg .= "user_email: %%user_email%%\n";
1341
+ $msg .= "user_login: %%user_login%%\n";
1342
+ $msg .= "user_pass: %%user_pass%%\n";
1343
+ $msg .= "user_id: %%user_id%%\n";
1344
+ $msg .= "cv0: %%cv0%%\n";
1345
+ $msg .= "cv1: %%cv1%%\n";
1346
+ $msg .= "cv2: %%cv2%%\n";
1347
+ $msg .= "cv3: %%cv3%%\n";
1348
+ $msg .= "cv4: %%cv4%%\n";
1349
+ $msg .= "cv5: %%cv5%%\n";
1350
+ $msg .= "cv6: %%cv6%%\n";
1351
+ $msg .= "cv7: %%cv7%%\n";
1352
+ $msg .= "cv8: %%cv8%%\n";
1353
+ $msg .= "cv9: %%cv9%%";
1354
+ /**/
1355
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
1356
+ if (($msg = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds ($role), $msg)))
1357
+ if (($msg = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds ($level), $msg)))
1358
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($fname), $msg)))
1359
+ if (($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($lname), $msg)))
1360
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds ($name), $msg)))
1361
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($email), $msg)))
1362
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($login), $msg)))
1363
+ if (($msg = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds ($pass), $msg)))
1364
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
1365
+ /**/
1366
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
1367
+ /**/
1368
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_registration_notification_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") : null;
1369
+ }
1370
+ /**/
1371
  if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
1372
+ /**/
1373
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
1374
  if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
1375
  if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
1380
  if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
1381
  if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
1382
  if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
1383
+ /**/
1384
  if (($url = trim ($url))) /* Empty? ... Otherwise, re-fill. */
1385
  $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
1386
  /**/
includes/functions/sc-get-details.inc.php CHANGED
@@ -14,7 +14,7 @@ Direct access denial.
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit("Do not access this file directly.");
16
  /*
17
- Function that handles the Shortcode for [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" user_option="s2member_subscr_id" /].
18
  Attach to: add_shortcode("s2Get");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_sc_get_details"))
@@ -28,10 +28,9 @@ if (!function_exists ("ws_plugin__s2member_sc_get_details"))
28
  do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
29
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
  /**/
31
- $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
32
- that have been corrupted by a non-default visual editor; ( i.e. CKEditor does this ). */
33
  /**/
34
- $attr = shortcode_atts (array ("constant" => "", "custom_field" => "", "user_option" => ""), $attr);
35
  /**/
36
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
37
  do_action ("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars ());
@@ -43,23 +42,23 @@ if (!function_exists ("ws_plugin__s2member_sc_get_details"))
43
  $get = constant ($attr["constant"]);
44
  }
45
  /**/
46
- else if ($attr["custom_field"] && $current_user) /* Pull details out of the DB, matching a Custom Field being requested. */
47
  {
48
- if (preg_match ("/^(first_name|First Name)$/i", $attr["custom_field"]))
49
  $get = $current_user->first_name;
50
  /**/
51
- else if (preg_match ("/^(last_name|Last Name)$/i", $attr["custom_field"]))
52
  $get = $current_user->last_name;
53
  /**/
54
- else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)$/i", $attr["custom_field"]))
55
  $get = $current_user->user_email;
56
  /**/
57
- else if (isset ($current_user->$attr["custom_field"]))
58
- $get = $current_user->$attr["custom_field"];
59
  /**/
60
  else /* Otherwise, we assume it's an actual Custom Field. */
61
  {
62
- $field = trim ($attr["custom_field"], "^* \t\n\r\0\x0B");
63
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
64
  /**/
65
  $fields = get_user_option ("s2member_custom_fields");
@@ -68,7 +67,7 @@ if (!function_exists ("ws_plugin__s2member_sc_get_details"))
68
  }
69
  }
70
  /**/
71
- else if ($attr["user_option"] && $current_user) /* Else pull details from meta table. */
72
  $get = get_user_option ($attr["user_option"]);
73
  /**/
74
  return apply_filters ("ws_plugin__s2member_sc_get_details", $get, get_defined_vars ());
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit("Do not access this file directly.");
16
  /*
17
+ Function that handles the Shortcode for [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /].
18
  Attach to: add_shortcode("s2Get");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_sc_get_details"))
28
  do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
29
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
  /**/
31
+ $attr = ws_plugin__s2member_trim_quot_deep ((array)$attr); /* Force array, and fix &quot; in attrs. */
 
32
  /**/
33
+ $attr = shortcode_atts (array ("constant" => "", "user_field" => "", "user_option" => ""), $attr);
34
  /**/
35
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
36
  do_action ("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars ());
42
  $get = constant ($attr["constant"]);
43
  }
44
  /**/
45
+ else if ($attr["user_field"] && $current_user) /* Pull a particular field. */
46
  {
47
+ if (preg_match ("/^(first_name|First Name)$/i", $attr["user_field"]))
48
  $get = $current_user->first_name;
49
  /**/
50
+ else if (preg_match ("/^(last_name|Last Name)$/i", $attr["user_field"]))
51
  $get = $current_user->last_name;
52
  /**/
53
+ else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)$/i", $attr["user_field"]))
54
  $get = $current_user->user_email;
55
  /**/
56
+ else if (isset ($current_user->$attr["user_field"]))
57
+ $get = $current_user->$attr["user_field"];
58
  /**/
59
  else /* Otherwise, we assume it's an actual Custom Field. */
60
  {
61
+ $field = trim ($attr["user_field"], "^* \t\n\r\0\x0B");
62
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
63
  /**/
64
  $fields = get_user_option ("s2member_custom_fields");
67
  }
68
  }
69
  /**/
70
+ else if ($attr["user_option"] && $current_user) /* Here we pull meta options. */
71
  $get = get_user_option ($attr["user_option"]);
72
  /**/
73
  return apply_filters ("ws_plugin__s2member_sc_get_details", $get, get_defined_vars ());
includes/functions/sc-if-conditionals.inc.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
+ /*
17
+ Function that handles the Shortcode for [s2If ... simple conditionals][/s2If].
18
+ - These Shortcodes are also safe to use on a Multisite Blog Farm.
19
+
20
+ Attach to: add_shortcode("s2If") + _s2If, __s2If, ___s2If for nesting.
21
+
22
+ Is Multisite Networking enabled? Please keep the following in mind.
23
+ * current_user_can(), will ALWAYS return true for a Super Admin!
24
+ ( this can be confusing when testing conditionals )
25
+
26
+ If you're running a Multisite Blog Farm, you can filter this array:
27
+ ws_plugin__s2member_sc_if_conditionals_blog_farm_safe
28
+ $blog_farm_safe
29
+ */
30
+ if (!function_exists ("ws_plugin__s2member_sc_if_conditionals"))
31
+ {
32
+ function ws_plugin__s2member_sc_if_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
33
+ {
34
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
35
+ do_action ("ws_plugin__s2member_before_sc_if_conditionals", get_defined_vars ());
36
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
37
+ /**/
38
+ $attr = ws_plugin__s2member_trim_quot_deep ((array)$attr); /* Force array, and fix &quot; in attrs. */
39
+ /**/
40
+ $blog_farm_safe = apply_filters ("ws_plugin__s2member_sc_if_conditionals_blog_farm_safe", array ("is_user_logged_in", "is_user_not_logged_in", "current_user_is", "current_user_is_not", "current_user_is_for_blog", "current_user_is_not_for_blog", "current_user_can", "current_user_cannot", "current_user_can_for_blog", "current_user_cannot_for_blog", "is_404", "is_home", "is_front_page", "is_singular", "is_single", "is_page", "is_page_template", "is_attachment", "is_feed", "is_archive", "is_search", "is_category", "is_tax", "is_tag", "has_tag", "is_author", "is_date", "is_day", "is_month", "is_time", "is_year", "is_sticky", "is_paged", "is_preview", "in_the_loop", "comments_open", "pings_open", "has_excerpt", "has_post_image"), get_defined_vars ());
41
+ /**/
42
+ foreach ($attr as $attr_key => $attr_value) /* Detects and removes logical attributes. */
43
+ /* It's NOT possible to mix logic. You MUST stick to one type of logic or another. */
44
+ /* If both types of logic are needed, you MUST use two different Shortcodes. */
45
+ if (preg_match ("/^(&&|&amp;&amp;|&#038;&#038;|AND|\|\||OR|[\!\=\<\>]+)$/i", $attr_value))
46
+ { /* Stick with AND/OR. Ampersands are corrupted by the Visual Editor. */
47
+ /**/
48
+ $logicals[] = strtolower ($attr_value); /* Place all logicals into an array here. */
49
+ unset($attr[$attr_key]); /* ^ Detect logic here. We'll use the first key #0. */
50
+ /**/
51
+ if (preg_match ("/^[\!\=\<\>]+$/i", $attr_value)) /* Error on these operators. */
52
+ {
53
+ trigger_error ("s2If, invalid operator [ " . $attr_value . " ]. Simple Conditionals cannot process operators like ( == != <> ). Please use Advanced (PHP) Conditionals instead.", E_USER_ERROR);
54
+ return ""; /* Return now; empty string in this case. */
55
+ }
56
+ }
57
+ /**/
58
+ if (is_array ($logicals) && !empty ($logicals) && count (array_unique ($logicals)) > 1)
59
+ {
60
+ trigger_error ("s2If, AND/OR malformed conditional logic. It's NOT possible to mix logic using AND/OR combinations. You MUST stick to one type of logic or another. If both types of logic are needed, you MUST use two different Shortcode expressions. Or, use Advanced (PHP) Conditionals instead.", E_USER_ERROR);
61
+ return ""; /* Return now; empty string in this case. */
62
+ }
63
+ /**/
64
+ $conditional_logic = (is_array ($logicals) && !empty ($logicals) && preg_match ("/^(\|\||OR)$/i", $logicals[0])) ? "OR" : "AND";
65
+ /**/
66
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
67
+ do_action ("ws_plugin__s2member_before_sc_if_conditionals_after_conditional_logic", get_defined_vars ());
68
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
69
+ /**/
70
+ if ($conditional_logic === "AND") /* This is the AND variation. This routine analyzes conditionals using AND logic ( the default behavior ). */
71
+ {
72
+ foreach ($attr as $attr_value) /* This is the AND variation. This routine analyzes conditionals using AND logic ( the default behavior ). */
73
+ {
74
+ if (preg_match ("/^(\!?)(.+?)(\()(.*?)(\))$/", $attr_value, $m) && ($exclamation = $m[1]) !== "nill" && ($conditional = $m[2]) && ($attr_args = preg_replace ("/[\r\n\t\s ]/", "", $m[4])) !== "nill")
75
+ {
76
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site () || !preg_match ("/[\(\)]/", $attr_args)) /* Disallow functions as arguments on a Multisite Blog Farm. */
77
+ {
78
+ if (is_array ($args = preg_split ("/[;,]+/", $attr_args, 0, PREG_SPLIT_NO_EMPTY))) /* Convert all arguments into an array. And take note; possibly into an empty array. */
79
+ {
80
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site () || in_array (strtolower ($conditional), $blog_farm_safe))
81
+ {
82
+ $test = ($exclamation) ? false : true; /* If !exclamation ( false ) otherwise this defaults to true. */
83
+ /**/
84
+ if (preg_match ("/^\{(.*?)\}$/", $attr_args)) /* Single argument passed as an array. */
85
+ {
86
+ if ($test === true && !call_user_func ($conditional, $args))
87
+ {
88
+ $condition_failed = true;
89
+ break;
90
+ }
91
+ else if ($test === false && call_user_func ($conditional, $args))
92
+ {
93
+ $condition_failed = true;
94
+ break;
95
+ }
96
+ }
97
+ /**/
98
+ else if (empty ($args)) /* No arguments at all. */
99
+ {
100
+ if ($test === true && !call_user_func ($conditional))
101
+ {
102
+ $condition_failed = true;
103
+ break;
104
+ }
105
+ /**/
106
+ else if ($test === false && call_user_func ($conditional))
107
+ {
108
+ $condition_failed = true;
109
+ break;
110
+ }
111
+ }
112
+ /**/
113
+ else if ($test === true && !call_user_func_array ($conditional, $args))
114
+ {
115
+ $condition_failed = true;
116
+ break;
117
+ }
118
+ /**/
119
+ else if ($test === false && call_user_func_array ($conditional, $args))
120
+ {
121
+ $condition_failed = true;
122
+ break;
123
+ }
124
+ }
125
+ else
126
+ {
127
+ trigger_error ("s2If, unsafe conditional function [ " . $attr_value . " ]", E_USER_ERROR);
128
+ return ""; /* Return now; empty string in this case. */
129
+ }
130
+ }
131
+ else
132
+ {
133
+ trigger_error ("s2If, conditional args are NOT an array [ " . $attr_value . " ]", E_USER_ERROR);
134
+ return ""; /* Return now; empty string in this case. */
135
+ }
136
+ }
137
+ else
138
+ {
139
+ trigger_error ("s2If, unsafe conditional args [ " . $attr_value . " ]", E_USER_ERROR);
140
+ return ""; /* Return now; empty string in this case. */
141
+ }
142
+ }
143
+ else
144
+ {
145
+ trigger_error ("s2If, malformed conditional [ " . $attr_value . " ]", E_USER_ERROR);
146
+ return ""; /* Return now; empty string in this case. */
147
+ }
148
+ }
149
+ /* Supports nested Shortcodes. */
150
+ return do_shortcode (apply_filters ("ws_plugin__s2member_sc_if_conditionals", (($condition_failed) ? "" : $content), get_defined_vars ()));
151
+ }
152
+ /**/
153
+ else if ($conditional_logic === "OR") /* This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND logic. */
154
+ {
155
+ foreach ($attr as $attr_value) /* This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND logic. */
156
+ {
157
+ if (preg_match ("/^(\!?)(.+?)(\()(.*?)(\))$/", $attr_value, $m) && ($exclamation = $m[1]) !== "nill" && ($conditional = $m[2]) && ($attr_args = preg_replace ("/[\r\n\t\s ]/", "", $m[4])) !== "nill")
158
+ {
159
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site () || !preg_match ("/[\(\)]/", $attr_args)) /* Disallow functions as arguments on a Multisite Blog Farm. */
160
+ {
161
+ if (is_array ($args = preg_split ("/[;,]+/", $attr_args, 0, PREG_SPLIT_NO_EMPTY))) /* Convert all arguments into an array. And take note; possibly into an empty array. */
162
+ {
163
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site () || in_array (strtolower ($conditional), $blog_farm_safe))
164
+ {
165
+ $test = ($exclamation) ? false : true; /* If !exclamation ( false ) otherwise this defaults to true. */
166
+ /**/
167
+ if (preg_match ("/^\{(.*?)\}$/", $attr_args)) /* Single argument passed as an array. */
168
+ {
169
+ if ($test === true && call_user_func ($conditional, $args))
170
+ {
171
+ $condition_succeeded = true;
172
+ break;
173
+ }
174
+ else if ($test === false && !call_user_func ($conditional, $args))
175
+ {
176
+ $condition_succeeded = true;
177
+ break;
178
+ }
179
+ }
180
+ /**/
181
+ else if (empty ($args)) /* No arguments at all. */
182
+ {
183
+ if ($test === true && call_user_func ($conditional))
184
+ {
185
+ $condition_succeeded = true;
186
+ break;
187
+ }
188
+ /**/
189
+ else if ($test === false && !call_user_func ($conditional))
190
+ {
191
+ $condition_succeeded = true;
192
+ break;
193
+ }
194
+ }
195
+ /**/
196
+ else if ($test === true && call_user_func_array ($conditional, $args))
197
+ {
198
+ $condition_succeeded = true;
199
+ break;
200
+ }
201
+ /**/
202
+ else if ($test === false && !call_user_func_array ($conditional, $args))
203
+ {
204
+ $condition_succeeded = true;
205
+ break;
206
+ }
207
+ }
208
+ else
209
+ {
210
+ trigger_error ("s2If, unsafe conditional function [ " . $attr_value . " ]", E_USER_ERROR);
211
+ return ""; /* Return now; empty string in this case. */
212
+ }
213
+ }
214
+ else
215
+ {
216
+ trigger_error ("s2If, conditional args are NOT an array [ " . $attr_value . " ]", E_USER_ERROR);
217
+ return ""; /* Return now; empty string in this case. */
218
+ }
219
+ }
220
+ else
221
+ {
222
+ trigger_error ("s2If, unsafe conditional args [ " . $attr_value . " ]", E_USER_ERROR);
223
+ return ""; /* Return now; empty string in this case. */
224
+ }
225
+ }
226
+ else
227
+ {
228
+ trigger_error ("s2If, malformed conditional [ " . $attr_value . " ]", E_USER_ERROR);
229
+ return ""; /* Return now; empty string in this case. */
230
+ }
231
+ }
232
+ /* Supports nested Shortcodes. */
233
+ return do_shortcode (apply_filters ("ws_plugin__s2member_sc_if_conditionals", (($condition_succeeded) ? $content : ""), get_defined_vars ()));
234
+ }
235
+ }
236
+ }
237
+ ?>
includes/functions/{sc-conditionals.inc.php → sc-old-conditionals.inc.php} RENAMED
@@ -14,6 +14,11 @@ Direct access denial.
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit("Do not access this file directly.");
16
  /*
 
 
 
 
 
17
  Function that handles the Shortcode for [s2All ... simple conditionals][/s2All].
18
  Function that handles the Shortcode for [s2Any ... simple conditionals][/s2Any].
19
 
@@ -42,12 +47,12 @@ Attach to: add_shortcode("s2Any"), add_shortcode("_s2Any"), add_shortcode("__s2A
42
  [/s2Any]
43
 
44
  */
45
- if (!function_exists ("ws_plugin__s2member_sc_conditionals"))
46
  {
47
- function ws_plugin__s2member_sc_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
48
  {
49
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
- do_action ("ws_plugin__s2member_before_sc_conditionals", get_defined_vars ());
51
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
  /**/
53
  $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
@@ -57,7 +62,7 @@ if (!function_exists ("ws_plugin__s2member_sc_conditionals"))
57
  $attr = shortcode_atts (array ("is_user_logged_in" => "", "is_user_not_logged_in" => "", "current_user_is" => "", "current_user_is_not" => "", "current_user_is_for_blog" => "", "current_user_is_not_for_blog" => "", "current_user_can" => "", "current_user_cannot" => "", "current_user_can_for_blog" => "", "current_user_cannot_for_blog" => "", "is_404" => "", "is_home" => "", "is_front_page" => "", "is_singular" => "", "is_single" => "", "is_page" => "", "is_page_template" => "", "is_attachment" => "", "is_feed" => "", "is_archive" => "", "is_search" => "", "is_category" => "", "is_tax" => "", "is_tag" => "", "has_tag" => "", "is_author" => "", "is_date" => "", "is_day" => "", "is_month" => "", "is_time" => "", "is_year" => "", "is_sticky" => "", "is_paged" => "", "is_preview" => "", "in_the_loop" => "", "comments_open" => "", "pings_open" => "", "has_excerpt" => "", "has_post_image" => ""), $attr);
58
  /**/
59
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
60
- do_action ("ws_plugin__s2member_before_sc_conditionals_after_shortcode_atts", get_defined_vars ());
61
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
62
  /**/
63
  if (preg_match ("/^(_*)s2All$/i", $shortcode)) /* This is the AND variation. This routine analyzes conditionals using AND logic, instead of OR. */
@@ -109,7 +114,7 @@ if (!function_exists ("ws_plugin__s2member_sc_conditionals"))
109
  }
110
  }
111
  /* Supports nested Shortcodes. */
112
- return do_shortcode (apply_filters ("ws_plugin__s2member_sc_conditionals", (($condition_failed) ? "" : $content), get_defined_vars ()));
113
  }
114
  /**/
115
  else if (preg_match ("/^(_*)s2Any$/i", $shortcode)) /* This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND. */
@@ -161,7 +166,7 @@ if (!function_exists ("ws_plugin__s2member_sc_conditionals"))
161
  }
162
  }
163
  /* Supports nested Shortcodes. */
164
- return do_shortcode (apply_filters ("ws_plugin__s2member_sc_conditionals", (($condition_succeeded) ? $content : ""), get_defined_vars ()));
165
  }
166
  }
167
  }
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit("Do not access this file directly.");
16
  /*
17
+ The following Shortcodes were deprecated in v3.2.2.
18
+ Going forward, use [s2If] instead ( it's more powerful ).
19
+ @NOTE: These Shortcodes were ONLY available in v3.2.1.
20
+ ~ These WILL all be removed in the next release.
21
+
22
  Function that handles the Shortcode for [s2All ... simple conditionals][/s2All].
23
  Function that handles the Shortcode for [s2Any ... simple conditionals][/s2Any].
24
 
47
  [/s2Any]
48
 
49
  */
50
+ if (!function_exists ("ws_plugin__s2member_sc_old_conditionals"))
51
  {
52
+ function ws_plugin__s2member_sc_old_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
53
  {
54
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
55
+ do_action ("ws_plugin__s2member_before_sc_old_conditionals", get_defined_vars ());
56
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
  /**/
58
  $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
62
  $attr = shortcode_atts (array ("is_user_logged_in" => "", "is_user_not_logged_in" => "", "current_user_is" => "", "current_user_is_not" => "", "current_user_is_for_blog" => "", "current_user_is_not_for_blog" => "", "current_user_can" => "", "current_user_cannot" => "", "current_user_can_for_blog" => "", "current_user_cannot_for_blog" => "", "is_404" => "", "is_home" => "", "is_front_page" => "", "is_singular" => "", "is_single" => "", "is_page" => "", "is_page_template" => "", "is_attachment" => "", "is_feed" => "", "is_archive" => "", "is_search" => "", "is_category" => "", "is_tax" => "", "is_tag" => "", "has_tag" => "", "is_author" => "", "is_date" => "", "is_day" => "", "is_month" => "", "is_time" => "", "is_year" => "", "is_sticky" => "", "is_paged" => "", "is_preview" => "", "in_the_loop" => "", "comments_open" => "", "pings_open" => "", "has_excerpt" => "", "has_post_image" => ""), $attr);
63
  /**/
64
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
+ do_action ("ws_plugin__s2member_before_sc_old_conditionals_after_shortcode_atts", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  /**/
68
  if (preg_match ("/^(_*)s2All$/i", $shortcode)) /* This is the AND variation. This routine analyzes conditionals using AND logic, instead of OR. */
114
  }
115
  }
116
  /* Supports nested Shortcodes. */
117
+ return do_shortcode (apply_filters ("ws_plugin__s2member_sc_old_conditionals", (($condition_failed) ? "" : $content), get_defined_vars ()));
118
  }
119
  /**/
120
  else if (preg_match ("/^(_*)s2Any$/i", $shortcode)) /* This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND. */
166
  }
167
  }
168
  /* Supports nested Shortcodes. */
169
+ return do_shortcode (apply_filters ("ws_plugin__s2member_sc_old_conditionals", (($condition_succeeded) ? $content : ""), get_defined_vars ()));
170
  }
171
  }
172
  }
includes/functions/user-deletions.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
  /*
17
  Function for handling user deletions.
18
  Attach to: add_action("remove_user_from_blog");
@@ -24,7 +24,7 @@ if (!function_exists ("ws_plugin__s2member_handle_ms_user_deletions"))
24
  static $processed = array (); /* No duplicate processing. */
25
  global $pagenow; /* Need this to detect the current admin page. */
26
  /**/
27
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
28
  do_action ("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars ());
29
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
  /**/
@@ -33,19 +33,19 @@ if (!function_exists ("ws_plugin__s2member_handle_ms_user_deletions"))
33
  if (($s2says || (is_admin () && $pagenow === "users.php")) && ($processed[$user_id] = true)) /* If s2Member says, or on users.php. */
34
  /* We don't react on this event globally, because there are many routines that remove Users from a Blog; w/ harmless reasons. */
35
  {
36
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
37
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars ());
38
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
39
  /**/
40
- ws_plugin__s2member_handle_user_deletions($user_id); /* Now hand this over. */
41
  /**/
42
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
43
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars ());
44
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
45
  }
46
  }
47
  /**/
48
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
49
  do_action ("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars ());
50
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
51
  /**/
@@ -66,7 +66,7 @@ if (!function_exists ("ws_plugin__s2member_handle_user_deletions"))
66
  {
67
  static $processed = array (); /* No duplicate processing. */
68
  /**/
69
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
70
  do_action ("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
71
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
72
  /**/
@@ -87,22 +87,58 @@ if (!function_exists ("ws_plugin__s2member_handle_user_deletions"))
87
  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)))
88
  {
89
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications on user deletion. */
 
90
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($subscr_id)), $url)))
91
  if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
92
  if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
93
  if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
94
- if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
95
- /**/
96
- if (($url = trim ($url))) /* Empty? */
97
- ws_plugin__s2member_remote($url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  /**/
99
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
100
- do_action ("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
101
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
 
 
 
 
 
102
  }
 
 
 
 
103
  }
104
  /**/
105
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
106
  do_action ("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
107
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
108
  /**/
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling user deletions.
18
  Attach to: add_action("remove_user_from_blog");
24
  static $processed = array (); /* No duplicate processing. */
25
  global $pagenow; /* Need this to detect the current admin page. */
26
  /**/
27
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
28
  do_action ("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars ());
29
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
  /**/
33
  if (($s2says || (is_admin () && $pagenow === "users.php")) && ($processed[$user_id] = true)) /* If s2Member says, or on users.php. */
34
  /* We don't react on this event globally, because there are many routines that remove Users from a Blog; w/ harmless reasons. */
35
  {
36
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
37
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars ());
38
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
39
  /**/
40
+ ws_plugin__s2member_handle_user_deletions ($user_id); /* Now hand this over. */
41
  /**/
42
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
43
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars ());
44
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
45
  }
46
  }
47
  /**/
48
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
49
  do_action ("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars ());
50
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
51
  /**/
66
  {
67
  static $processed = array (); /* No duplicate processing. */
68
  /**/
69
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
70
  do_action ("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
71
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
72
  /**/
87
  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)))
88
  {
89
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications on user deletion. */
90
+ /**/
91
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($subscr_id)), $url)))
92
  if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
93
  if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
94
  if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
95
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_login)), $url)))
96
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
97
+ /**/
98
+ if (($url = trim ($url))) /* Empty? */
99
+ ws_plugin__s2member_remote ($url);
100
+ }
101
+ /**/
102
+ 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)))
103
+ {
104
+ $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
105
+ $msg .= "\n\n"; /* Spacing in the message body. */
106
+ $msg .= "subscr_id: %%subscr_id%%\n";
107
+ $msg .= "user_first_name: %%user_first_name%%\n";
108
+ $msg .= "user_last_name: %%user_last_name%%\n";
109
+ $msg .= "user_full_name: %%user_full_name%%\n";
110
+ $msg .= "user_email: %%user_email%%\n";
111
+ $msg .= "user_login: %%user_login%%\n";
112
+ $msg .= "user_id: %%user_id%%\n";
113
+ $msg .= "cv0: %%cv0%%\n";
114
+ $msg .= "cv1: %%cv1%%\n";
115
+ $msg .= "cv2: %%cv2%%\n";
116
+ $msg .= "cv3: %%cv3%%\n";
117
+ $msg .= "cv4: %%cv4%%\n";
118
+ $msg .= "cv5: %%cv5%%\n";
119
+ $msg .= "cv6: %%cv6%%\n";
120
+ $msg .= "cv7: %%cv7%%\n";
121
+ $msg .= "cv8: %%cv8%%\n";
122
+ $msg .= "cv9: %%cv9%%";
123
  /**/
124
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($subscr_id), $msg)))
125
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($user->last_name), $msg)))
126
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
127
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($user->user_email), $msg)))
128
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($user->user_login), $msg)))
129
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
130
+ /**/
131
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
132
+ /**/
133
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_eot_del_notification_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") : null;
134
  }
135
+ /**/
136
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
137
+ do_action ("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
138
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
  }
140
  /**/
141
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
142
  do_action ("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
143
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
144
  /**/
includes/functions/utilities.inc.php CHANGED
@@ -549,4 +549,20 @@ if (!function_exists ("ws_plugin__s2member_compress_css_c3"))
549
  return $m[0];
550
  }
551
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  ?>
549
  return $m[0];
550
  }
551
  }
552
+ /*
553
+ Functions that highlights PHP, and also Shortcodes.
554
+ */
555
+ if (!function_exists ("ws_plugin__s2member_highlight_php"))
556
+ {
557
+ function ws_plugin__s2member_highlight_php ($str = FALSE)
558
+ {
559
+ $str = highlight_string ($str, true); /* Start with PHP syntax highlighting first. */
560
+ /**/
561
+ return preg_replace_callback ("/(\[)(\/?)(_*s2If|s2Get|s2Member-[A-z_0-9\-]+)(.*?)(\])/i", "_ws_plugin__s2member_highlight_php", $str);
562
+ }
563
+ function _ws_plugin__s2member_highlight_php ($m = FALSE)
564
+ {
565
+ return '<span style="color:#164A61;">' . $m[0] . '</span>';
566
+ }
567
+ }
568
  ?>
includes/hooks.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
  /*
17
  Add the plugin actions/filters here.
18
  */
@@ -67,6 +67,7 @@ add_action ("register_form", "ws_plugin__s2member_custom_registration_fields");
67
  add_action ("bp_before_registration_submit_buttons", "ws_plugin__s2member_opt_in_4bp");
68
  /**/
69
  add_filter ("add_signup_meta", "ws_plugin__s2member_ms_process_signup_meta");
 
70
  add_filter ("wpmu_signup_user_notification_email", "ws_plugin__s2member_ms_nice_email_roles", 11);
71
  add_action ("wpmu_activate_user", "ws_plugin__s2member_configure_user_on_ms_user_activation", 10, 3);
72
  add_action ("wpmu_activate_blog", "ws_plugin__s2member_configure_user_on_ms_blog_activation", 10, 5);
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Add the plugin actions/filters here.
18
  */
67
  add_action ("bp_before_registration_submit_buttons", "ws_plugin__s2member_opt_in_4bp");
68
  /**/
69
  add_filter ("add_signup_meta", "ws_plugin__s2member_ms_process_signup_meta");
70
+ add_action ("signup_hidden_fields", "ws_plugin__s2member_ms_process_signup_hidden_fields");
71
  add_filter ("wpmu_signup_user_notification_email", "ws_plugin__s2member_ms_nice_email_roles", 11);
72
  add_action ("wpmu_activate_user", "ws_plugin__s2member_configure_user_on_ms_user_activation", 10, 3);
73
  add_action ("wpmu_activate_blog", "ws_plugin__s2member_configure_user_on_ms_blog_activation", 10, 5);
includes/menu-pages/api-ops.inc.php CHANGED
@@ -42,7 +42,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
42
  /**/
43
  echo '<div class="ws-menu-page-section ws-plugin--s2member-signup-notifications-section">' . "\n";
44
  echo '<h3>Signup Notification URLs ( optional )</h3>' . "\n";
45
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever a new Subscription is created, you\'ll want to read this section. This is marked `Signup`, because the URLs that you list below, will be notified each time a Member signs up. Depending on your fee structure, this may include a first initial payment that establishes their Subscription. This Notification will only be triggered once for each Member. Signup Notifications are sent right after a Member signs up successfully through PayPal®, regardless of whether any money has actually been received. In other words, this Notification is triggered anytime a Member signs up, even if you provided them with a free trial. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Signup Notifications are an added layer of functionality, and they are completely optional.</p>' . "\n";
46
  do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_signup_notifications", get_defined_vars ());
47
  /**/
48
  echo '<table class="form-table">' . "\n";
@@ -75,7 +75,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
75
  echo '<li><code>%%item_number%%</code> = The Item Number ( colon separated <code><em>level:custom_capabilities:fixed term</em></code> ) for the Membership Subscription.</li>' . "\n";
76
  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 Number ).</li>' . "\n";
77
  echo '<li><code>%%initial_term%%</code> = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter. [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
78
- echo '<li><code>%%regular_term%%</code> = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter. [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
79
  echo '</ul>' . "\n";
80
  /**/
81
  if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ())
@@ -95,6 +95,31 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
95
  echo '</tr>' . "\n";
96
  echo '</tbody>' . "\n";
97
  echo '</table>' . "\n";