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

Version Description

Download this release

Release Info

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

Code changes from version 111003 to 111011

Files changed (63) hide show
  1. includes/_xtnls/mailchimp/nc-mcapi.inc.php +4 -6
  2. includes/classes/admin-css-js-in.inc.php +2 -4
  3. includes/classes/auto-eots.inc.php +13 -13
  4. includes/classes/constants.inc.php +9 -9
  5. includes/classes/css-js-in.inc.php +17 -19
  6. includes/classes/custom-reg-fields-4bp.inc.php +23 -24
  7. includes/classes/custom-reg-fields.inc.php +34 -34
  8. includes/classes/email-configs.inc.php +93 -91
  9. includes/classes/files-in.inc.php +50 -50
  10. includes/classes/files.inc.php +46 -45
  11. includes/classes/installation.inc.php +1 -1
  12. includes/classes/ip-restrictions.inc.php +108 -77
  13. includes/classes/list-servers.inc.php +58 -38
  14. includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +11 -11
  15. includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +7 -7
  16. includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +4 -4
  17. includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +8 -8
  18. includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +6 -6
  19. includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +4 -4
  20. includes/classes/paypal-notify-in.inc.php +1 -3
  21. includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +1 -1
  22. includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +17 -17
  23. includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php +8 -8
  24. includes/classes/profile-mods-4bp-in.inc.php +10 -10
  25. includes/classes/profile-mods-in.inc.php +16 -16
  26. includes/classes/register-access.inc.php +21 -17
  27. includes/classes/register-in.inc.php +20 -17
  28. includes/classes/registrations.inc.php +1 -1
  29. includes/classes/roles-caps.inc.php +24 -10
  30. includes/classes/s-badge-status-in.inc.php +7 -3
  31. includes/classes/sc-files-in.inc.php +1 -1
  32. includes/classes/sc-gets-in.inc.php +4 -4
  33. includes/classes/sc-if-conds-in.inc.php +5 -5
  34. includes/classes/sc-keys-in.inc.php +1 -1
  35. includes/classes/sc-paypal-button-in.inc.php +2 -2
  36. includes/classes/sc-profile-in.inc.php +1 -1
  37. includes/classes/sc-s-badge-in.inc.php +5 -4
  38. includes/classes/sp-access.inc.php +41 -37
  39. includes/classes/tracking-cookies-in.inc.php +5 -5
  40. includes/classes/user-access.inc.php +5 -5
  41. includes/classes/user-deletions.inc.php +2 -2
  42. includes/classes/users-list-in.inc.php +79 -76
  43. includes/classes/utilities.inc.php +5 -5
  44. includes/classes/utils-strings.inc.php +42 -8
  45. includes/classes/utils-urls.inc.php +17 -6
  46. includes/classes/utils-users.inc.php +4 -4
  47. includes/functions/api-functions.inc.php +40 -9
  48. includes/hooks.inc.php +1 -1
  49. includes/menu-pages/api-ops.inc.php +31 -31
  50. includes/menu-pages/down-ops.inc.php +4 -3
  51. includes/menu-pages/els-ops.inc.php +12 -9
  52. includes/menu-pages/gen-ops.inc.php +55 -38
  53. includes/menu-pages/integrations.inc.php +3 -2
  54. includes/menu-pages/menu-pages-s-min.js +1 -1
  55. includes/menu-pages/menu-pages-s.js +15 -8
  56. includes/menu-pages/mms-ops.inc.php +12 -9
  57. includes/menu-pages/res-ops.inc.php +10 -9
  58. includes/menu-pages/scripting.inc.php +1 -1
  59. includes/menu-pages/start.inc.php +23 -15
  60. includes/menu-pages/trk-ops.inc.php +10 -10
  61. includes/translations/s2member.pot +175 -182
  62. readme.txt +24 -128
  63. s2member.php +8 -8
includes/_xtnls/mailchimp/nc-mcapi.inc.php CHANGED
@@ -2439,14 +2439,12 @@ class NC_MCAPI {
2439
$this->errorMessage = $response["error"];
2440
$this->errorCode = $response["code"];
2441
return false;
2442
- } else if($error){
2443
- $this->errorMessage = "No error message from API server.";
2444
$this->errorCode = $error;
2445
return false;
2446
- } else if(!is_array($response) || empty($response)){
2447
- $this->errorMessage = "No response from API server.";
2448
- $this->errorCode = "-98";
2449
- return false;
2450
}
2451
2452
return $response;
2439
$this->errorMessage = $response["error"];
2440
$this->errorCode = $response["code"];
2441
return false;
2442
+ } else if($error /* But no error message? */){
2443
+ $this->errorMessage = "No error message.";
2444
$this->errorCode = $error;
2445
return false;
2446
+ } else if(empty($response)){
2447
+ $response = true;
2448
}
2449
2450
return $response;
includes/classes/admin-css-js-in.inc.php CHANGED
@@ -43,9 +43,8 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js_in"))
43
/**/
44
if (!empty ($_GET["ws_plugin__s2member_menu_pages_css"]) && is_user_logged_in () && current_user_can ("create_users"))
45
{
46
- @ini_set ("zlib.output_compression", 0);
47
- /**/
48
status_header (200); /* 200 OK status header. */
49
header ("Content-Type: text/css; charset=utf-8");
50
header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
51
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
@@ -88,9 +87,8 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js_in"))
88
/**/
89
if (!empty ($_GET["ws_plugin__s2member_menu_pages_js"]) && is_user_logged_in () && current_user_can ("create_users"))
90
{
91
- @ini_set ("zlib.output_compression", 0);
92
- /**/
93
status_header (200); /* 200 OK status header. */
94
header ("Content-Type: text/javascript; charset=utf-8");
95
header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
96
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
43
/**/
44
if (!empty ($_GET["ws_plugin__s2member_menu_pages_css"]) && is_user_logged_in () && current_user_can ("create_users"))
45
{
46
status_header (200); /* 200 OK status header. */
47
+ /**/
48
header ("Content-Type: text/css; charset=utf-8");
49
header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
50
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
87
/**/
88
if (!empty ($_GET["ws_plugin__s2member_menu_pages_js"]) && is_user_logged_in () && current_user_can ("create_users"))
89
{
90
status_header (200); /* 200 OK status header. */
91
+ /**/
92
header ("Content-Type: text/javascript; charset=utf-8");
93
header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
94
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
includes/classes/auto-eots.inc.php CHANGED
@@ -15,7 +15,7 @@
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
21
{
@@ -68,7 +68,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
68
/**/
69
if (function_exists ("wp_cron")) /* Is `wp_cron()` even available? */
70
{
71
- wp_clear_scheduled_hook("ws_plugin__s2member_auto_eot_system__schedule"); /* Since v3.0.3. */
72
/**/
73
return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
74
}
@@ -102,10 +102,10 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
102
/**/
103
include_once ABSPATH . "wp-admin/includes/admin.php";
104
/**/
105
- @set_time_limit(0); /* Make time for processing larger userbases. */
106
@ini_set ("memory_limit", "256M"); /* Acquire some additional RAM. */
107
/**/
108
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
109
do_action ("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
110
unset ($__refs, $__v); /* Unset defined __refs, __v. */
111
/**/
@@ -136,7 +136,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
136
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
137
$existing_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
138
/**/
139
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
140
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
141
do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), $eot_del_type, "modification", $demotion_role);
142
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "modification");
@@ -180,7 +180,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
180
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
181
{
182
if (is_array ($fields) && !empty ($fields))
183
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
184
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
185
break;
186
/**/
@@ -231,7 +231,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
231
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
232
{
233
if (is_array ($fields) && !empty ($fields))
234
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
235
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
236
break;
237
/**/
@@ -244,7 +244,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
244
c_ws_plugin__s2member_email_configs::email_config ();
245
}
246
/**/
247
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
248
do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
249
unset ($__refs, $__v); /* Unset defined __refs, __v. */
250
}
@@ -252,7 +252,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
252
{
253
$eot_del_type = $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
254
/**/
255
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
256
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
257
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
258
unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -266,14 +266,14 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
266
/**/
267
else /* Otherwise, we can actually delete them. */
268
/* This will automatically trigger `eot_del_notification_urls` as well. */
269
- wp_delete_user($user_id); /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */
270
/**/
271
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
272
do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
273
unset ($__refs, $__v); /* Unset defined __refs, __v. */
274
}
275
/**/
276
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
277
do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
278
unset ($__refs, $__v); /* Unset defined __refs, __v. */
279
}
@@ -284,7 +284,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
284
/**/
285
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients (); /* Cleanup. */
286
/**/
287
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
288
do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
289
unset ($__refs, $__v); /* Unset defined __refs, __v. */
290
/**/
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
21
{
68
/**/
69
if (function_exists ("wp_cron")) /* Is `wp_cron()` even available? */
70
{
71
+ wp_clear_scheduled_hook ("ws_plugin__s2member_auto_eot_system__schedule"); /* Since v3.0.3. */
72
/**/
73
return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
74
}
102
/**/
103
include_once ABSPATH . "wp-admin/includes/admin.php";
104
/**/
105
+ @set_time_limit (0); /* Make time for processing larger userbases. */
106
@ini_set ("memory_limit", "256M"); /* Acquire some additional RAM. */
107
/**/
108
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
109
do_action ("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
110
unset ($__refs, $__v); /* Unset defined __refs, __v. */
111
/**/
136
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
137
$existing_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
138
/**/
139
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
140
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
141
do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), $eot_del_type, "modification", $demotion_role);
142
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "modification");
180
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
181
{
182
if (is_array ($fields) && !empty ($fields))
183
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
184
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
185
break;
186
/**/
231
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
232
{
233
if (is_array ($fields) && !empty ($fields))
234
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
235
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
236
break;
237
/**/
244
c_ws_plugin__s2member_email_configs::email_config ();
245
}
246
/**/
247
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
248
do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
249
unset ($__refs, $__v); /* Unset defined __refs, __v. */
250
}
252
{
253
$eot_del_type = $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
254
/**/
255
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
256
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
257
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
258
unset ($__refs, $__v); /* Unset defined __refs, __v. */
266
/**/
267
else /* Otherwise, we can actually delete them. */
268
/* This will automatically trigger `eot_del_notification_urls` as well. */
269
+ wp_delete_user ($user_id); /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */
270
/**/
271
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
272
do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
273
unset ($__refs, $__v); /* Unset defined __refs, __v. */
274
}
275
/**/
276
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
277
do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
278
unset ($__refs, $__v); /* Unset defined __refs, __v. */
279
}
284
/**/
285
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients (); /* Cleanup. */
286
/**/
287
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
288
do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
289
unset ($__refs, $__v); /* Unset defined __refs, __v. */
290
/**/
includes/classes/constants.inc.php CHANGED
@@ -965,7 +965,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
965
* o `subscr_or_wp_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}
966
* o `subscr_gateway` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY}
967
* o `custom` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM}
968
- * o and any Custom Registration Fields configured by the site owner.
969
*
970
* This will be an empty JSON-encoded array if NOT logged-in.
971
*
@@ -974,7 +974,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
974
* <!php
975
* $fields = json_decode(S2MEMBER_CURRENT_USER_FIELDS, true);
976
* echo $fields["email"]; # The current User's Email Address.
977
- * echo $fields["my_unique_field_id"]; # A Custom Registration Field configured by the site owner.
978
* !>
979
* ```
980
* ———— Shortcode & JavaScript Equivalents ————
@@ -2056,7 +2056,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2056
* PayPal® value for Payment Buttons with input name: `invoice`.
2057
*
2058
* This can be used to auto-fill the `invoice` value in PayPal® Button Codes, with a unique Code~IP combination.
2059
- * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2060
*
2061
* Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
2062
* It MUST be excluded, because the value of this particular API Constant will change too often *( i.e. it changes, depending on microtime )*.
@@ -2073,7 +2073,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2073
* They are used by the PayPal® Button Generator for s2Member.
2074
*
2075
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2076
- * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2077
*
2078
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2079
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
@@ -2106,7 +2106,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2106
*
2107
* @var str
2108
*
2109
- * @see s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()
2110
*
2111
* @see `Dashboard -> s2Member -> PayPal® Buttons`
2112
*/
@@ -2131,7 +2131,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2131
* They are used by the PayPal® Button Generator for s2Member.
2132
*
2133
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2134
- * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2135
*
2136
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2137
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
@@ -2189,7 +2189,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2189
* They are used by the PayPal® Button Generator for s2Member.
2190
*
2191
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2192
- * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2193
*
2194
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2195
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
@@ -2244,7 +2244,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2244
* They are used by the PayPal® Button Generator for s2Member.
2245
*
2246
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2247
- * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2248
*
2249
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2250
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
@@ -2299,7 +2299,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2299
* They are used by the PayPal® Button Generator for s2Member.
2300
*
2301
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2302
- * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2303
*
2304
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2305
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
965
* o `subscr_or_wp_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}
966
* o `subscr_gateway` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY}
967
* o `custom` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM}
968
+ * o and any Custom Registration/Profile Fields configured by the site owner.
969
*
970
* This will be an empty JSON-encoded array if NOT logged-in.
971
*
974
* <!php
975
* $fields = json_decode(S2MEMBER_CURRENT_USER_FIELDS, true);
976
* echo $fields["email"]; # The current User's Email Address.
977
+ * echo $fields["my_unique_field_id"]; # A Custom Registration/Profile Field configured by the site owner.
978
* !>
979
* ```
980
* ———— Shortcode & JavaScript Equivalents ————
2056
* PayPal® value for Payment Buttons with input name: `invoice`.
2057
*
2058
* This can be used to auto-fill the `invoice` value in PayPal® Button Codes, with a unique Code~IP combination.
2059
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2060
*
2061
* Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
2062
* It MUST be excluded, because the value of this particular API Constant will change too often *( i.e. it changes, depending on microtime )*.
2073
* They are used by the PayPal® Button Generator for s2Member.
2074
*
2075
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2076
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2077
*
2078
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2079
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2106
*
2107
* @var str
2108
*
2109
+ * @see s2Member\API_Functions\s2member_value_for_pp_inv()
2110
*
2111
* @see `Dashboard -> s2Member -> PayPal® Buttons`
2112
*/
2131
* They are used by the PayPal® Button Generator for s2Member.
2132
*
2133
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2134
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2135
*
2136
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2137
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2189
* They are used by the PayPal® Button Generator for s2Member.
2190
*
2191
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2192
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2193
*
2194
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2195
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2244
* They are used by the PayPal® Button Generator for s2Member.
2245
*
2246
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2247
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2248
*
2249
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2250
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2299
* They are used by the PayPal® Button Generator for s2Member.
2300
*
2301
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2302
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2303
*
2304
* The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2305
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
includes/classes/css-js-in.inc.php CHANGED
@@ -15,7 +15,7 @@
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
21
{
@@ -43,21 +43,20 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
43
/**/
44
if (!empty ($_GET["ws_plugin__s2member_css"]))
45
{
46
- @ini_set ("zlib.output_compression", 0);
47
/**/
48
- status_header(200); /* 200 OK status header. */
49
- header("Content-Type: text/css; charset=utf-8");
50
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
51
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
52
- header("Cache-Control: max-age=604800");
53
- header("Pragma: public");
54
/**/
55
- eval('while (@ob_end_clean ());'); /* Clean buffers. */
56
/**/
57
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
58
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
59
/**/
60
- ob_start("c_ws_plugin__s2member_utils_css::compress_css");
61
/**/
62
include_once dirname (dirname (__FILE__)) . "/s2member.css";
63
/**/
@@ -86,16 +85,15 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
86
/**/
87
if (!empty ($_GET["ws_plugin__s2member_js_w_globals"]))
88
{
89
- @ini_set ("zlib.output_compression", 0);
90
/**/
91
- status_header(200); /* 200 OK status header. */
92
- header("Content-Type: text/javascript; charset=utf-8");
93
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
94
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
95
- header("Cache-Control: max-age=604800");
96
- header("Pragma: public");
97
/**/
98
- eval('while (@ob_end_clean ());'); /* Clean buffers. */
99
/**/
100
include_once dirname (dirname (__FILE__)) . "/jquery/jquery.sprintf/jquery.sprintf-min.js";
101
/**/
@@ -181,7 +179,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
181
echo "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
182
/**/
183
echo "S2MEMBER_VALUE_FOR_PP_INV = Math.round (new Date ().getTime ()) + '~" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_CURRENT_USER_IP) . "',";
184
- echo "S2MEMBER_VALUE_FOR_PP_INV_GEN = function(){ var invoice = '', formatSeed = function(seed, reqWidth) { seed = parseInt(seed, 10).toString (16); if (reqWidth < seed.length) return seed.slice (seed.length - reqWidth); else if (reqWidth > seed.length) return Array(1 + (reqWidth - seed.length)).join ('0') + seed; return seed; }; if (typeof S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED === 'undefined') S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED = Math.floor (Math.random () * 0x75bcd15); S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED++; invoice = formatSeed(parseInt(new Date ().getTime () / 1000, 10), 8); invoice += formatSeed(S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED, 5); invoice += '~' + S2MEMBER_CURRENT_USER_IP; return invoice; },";
185
/**/
186
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
187
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
21
{
43
/**/
44
if (!empty ($_GET["ws_plugin__s2member_css"]))
45
{
46
+ status_header (200); /* 200 OK status header. */
47
/**/
48
+ header ("Content-Type: text/css; charset=utf-8");
49
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
50
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
51
+ header ("Cache-Control: max-age=604800");
52
+ header ("Pragma: public");
53
/**/
54
+ eval ('while (@ob_end_clean ());'); /* Clean buffers. */
55
/**/
56
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
57
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
58
/**/
59
+ ob_start ("c_ws_plugin__s2member_utils_css::compress_css");
60
/**/
61
include_once dirname (dirname (__FILE__)) . "/s2member.css";
62
/**/
85
/**/
86
if (!empty ($_GET["ws_plugin__s2member_js_w_globals"]))
87
{
88
+ status_header (200); /* 200 OK status header. */
89
/**/
90
+ header ("Content-Type: text/javascript; charset=utf-8");
91
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
92
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
93
+ header ("Cache-Control: max-age=604800");
94
+ header ("Pragma: public");
95
/**/
96
+ eval ('while (@ob_end_clean ());'); /* Clean buffers. */
97
/**/
98
include_once dirname (dirname (__FILE__)) . "/jquery/jquery.sprintf/jquery.sprintf-min.js";
99
/**/
179
echo "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
180
/**/
181
echo "S2MEMBER_VALUE_FOR_PP_INV = Math.round (new Date ().getTime ()) + '~" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_CURRENT_USER_IP) . "',";
182
+ echo "S2MEMBER_VALUE_FOR_PP_INV_GEN = s2member_value_for_pp_inv_gen = function(){ var invoice = '', formatSeed = function(seed, reqWidth) { seed = parseInt(seed, 10).toString (16); if (reqWidth < seed.length) return seed.slice (seed.length - reqWidth); else if (reqWidth > seed.length) return Array(1 + (reqWidth - seed.length)).join ('0') + seed; return seed; }; if (typeof S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED === 'undefined') S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED = Math.floor (Math.random () * 0x75bcd15); S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED++; invoice = formatSeed(parseInt(new Date ().getTime () / 1000, 10), 8); invoice += formatSeed(S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED, 5); invoice += '~' + S2MEMBER_CURRENT_USER_IP; return invoice; },";
183
/**/
184
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
185
echo "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
includes/classes/custom-reg-fields-4bp.inc.php CHANGED
@@ -1,6 +1,6 @@
1
<?php
2
/**
3
- * Custom Registration Fields for BuddyPress integration.
4
*
5
* Copyright: © 2009-2011
6
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
@@ -15,12 +15,12 @@
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
21
{
22
/**
23
- * Custom Registration Fields for BuddyPress integration.
24
*
25
* @package s2Member\Custom_Reg_Fields
26
* @since 3.5
@@ -52,8 +52,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
52
$_p = (!empty ($_POST)) ? c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) : array ();
53
/**/
54
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
55
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration")/**/
56
- || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ()))
57
if (($close_section_container = true))
58
{
59
echo '<div id="ws-plugin--s2member-custom-reg-fields-4bp-section" class="ws-plugin--s2member-custom-reg-fields-4bp-section register-section">' . "\n";
@@ -61,7 +60,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
61
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
62
}
63
/**/
64
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
65
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before", get_defined_vars ());
66
unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
/**/
@@ -70,7 +69,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
70
{
71
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
72
{
73
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
74
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_custom_fields", get_defined_vars ());
75
unset ($__refs, $__v); /* Unset defined __refs, __v. */
76
/**/
@@ -79,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
79
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
80
$field_id_class = preg_replace ("/_/", "-", $field_var);
81
/**/
82
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
83
if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
84
{
85
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -94,7 +93,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
94
unset ($__refs, $__v); /* Unset defined __refs, __v. */
95
}
96
/**/
97
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
98
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_custom_fields", get_defined_vars ());
99
unset ($__refs, $__v); /* Unset defined __refs, __v. */
100
}
@@ -102,7 +101,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
102
/**/
103
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
104
{
105
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
106
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_opt_in", get_defined_vars ());
107
unset ($__refs, $__v); /* Unset defined __refs, __v. */
108
/**/
@@ -113,15 +112,15 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
113
echo '</label>' . "\n";
114
echo '</div>' . "\n";
115
/**/
116
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
117
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_opt_in", get_defined_vars ());
118
unset ($__refs, $__v); /* Unset defined __refs, __v. */
119
}
120
/**/
121
- if ($close_section_container)
122
- echo '</div></div>' . "\n";
123
/**/
124
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
125
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after", get_defined_vars ());
126
unset ($__refs, $__v); /* Unset defined __refs, __v. */
127
}
@@ -156,7 +155,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
156
{
157
echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
158
/**/
159
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
160
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
161
unset ($__refs, $__v); /* Unset defined __refs, __v. */
162
/**/
@@ -168,7 +167,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
168
/**/
169
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
170
{
171
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
172
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
173
unset ($__refs, $__v); /* Unset defined __refs, __v. */
174
/**/
@@ -177,7 +176,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
177
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
178
$field_id_class = preg_replace ("/_/", "-", $field_var);
179
/**/
180
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
181
if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
182
{
183
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -192,13 +191,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
192
unset ($__refs, $__v); /* Unset defined __refs, __v. */
193
}
194
/**/
195
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
196
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
197
unset ($__refs, $__v); /* Unset defined __refs, __v. */
198
}
199
}
200
/**/
201
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
202
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
203
unset ($__refs, $__v); /* Unset defined __refs, __v. */
204
}
@@ -231,7 +230,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
231
if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
232
if (($processed = true)) /* Mark as having been processed now. */
233
{
234
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
235
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
236
unset ($__refs, $__v); /* Unset defined __refs, __v. */
237
/**/
@@ -243,7 +242,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
243
/**/
244
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
245
{
246
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
247
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
248
unset ($__refs, $__v); /* Unset defined __refs, __v. */
249
/**/
@@ -252,7 +251,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
252
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
253
$field_id_class = preg_replace ("/_/", "-", $field_var);
254
/**/
255
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
256
if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
257
{
258
if (!empty ($field["section"]) && $field["section"] === "yes") /* New section? */
@@ -270,13 +269,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
270
unset ($__refs, $__v); /* Unset defined __refs, __v. */
271
}
272
/**/
273
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
274
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
275
unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
}
277
}
278
/**/
279
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
280
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
281
unset ($__refs, $__v); /* Unset defined __refs, __v. */
282
}
1
<?php
2
/**
3
+ * Custom Registration/Profile Fields for BuddyPress integration.
4
*
5
* Copyright: © 2009-2011
6
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
21
{
22
/**
23
+ * Custom Registration/Profile Fields for BuddyPress integration.
24
*
25
* @package s2Member\Custom_Reg_Fields
26
* @since 3.5
52
$_p = (!empty ($_POST)) ? c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) : array ();
53
/**/
54
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
55
+ if (($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration")) || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ()))
56
if (($close_section_container = true))
57
{
58
echo '<div id="ws-plugin--s2member-custom-reg-fields-4bp-section" class="ws-plugin--s2member-custom-reg-fields-4bp-section register-section">' . "\n";
60
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
61
}
62
/**/
63
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
64
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before", get_defined_vars ());
65
unset ($__refs, $__v); /* Unset defined __refs, __v. */
66
/**/
69
{
70
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
71
{
72
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
73
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_custom_fields", get_defined_vars ());
74
unset ($__refs, $__v); /* Unset defined __refs, __v. */
75
/**/
78
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
79
$field_id_class = preg_replace ("/_/", "-", $field_var);
80
/**/
81
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
82
if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
83
{
84
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
93
unset ($__refs, $__v); /* Unset defined __refs, __v. */
94
}
95
/**/
96
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
97
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_custom_fields", get_defined_vars ());
98
unset ($__refs, $__v); /* Unset defined __refs, __v. */
99
}
101
/**/
102
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
103
{
104
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
105
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_opt_in", get_defined_vars ());
106
unset ($__refs, $__v); /* Unset defined __refs, __v. */
107
/**/
112
echo '</label>' . "\n";
113
echo '</div>' . "\n";
114
/**/
115
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
116
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_opt_in", get_defined_vars ());
117
unset ($__refs, $__v); /* Unset defined __refs, __v. */
118
}
119
/**/
120
+ if (isset ($close_section_container) && $close_section_container)
121
+ echo '</div>' . "\n" . '</div>' . "\n";
122
/**/
123
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
124
do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after", get_defined_vars ());
125
unset ($__refs, $__v); /* Unset defined __refs, __v. */
126
}
155
{
156
echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
157
/**/
158
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
159
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
160
unset ($__refs, $__v); /* Unset defined __refs, __v. */
161
/**/
167
/**/
168
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
169
{
170
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
171
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
172
unset ($__refs, $__v); /* Unset defined __refs, __v. */
173
/**/
176
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
177
$field_id_class = preg_replace ("/_/", "-", $field_var);
178
/**/
179
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
180
if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
181
{
182
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
191
unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
}
193
/**/
194
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
195
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
196
unset ($__refs, $__v); /* Unset defined __refs, __v. */
197
}
198
}
199
/**/
200
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
201
do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
202
unset ($__refs, $__v); /* Unset defined __refs, __v. */
203
}
230
if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
231
if (($processed = true)) /* Mark as having been processed now. */
232
{
233
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
234
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
235
unset ($__refs, $__v); /* Unset defined __refs, __v. */
236
/**/
242
/**/
243
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
244
{
245
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
246
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
247
unset ($__refs, $__v); /* Unset defined __refs, __v. */
248
/**/
251
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
252
$field_id_class = preg_replace ("/_/", "-", $field_var);
253
/**/
254
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
255
if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
256
{
257
if (!empty ($field["section"]) && $field["section"] === "yes") /* New section? */
269
unset ($__refs, $__v); /* Unset defined __refs, __v. */
270
}
271
/**/
272
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
273
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
274
unset ($__refs, $__v); /* Unset defined __refs, __v. */
275
}
276
}
277
/**/
278
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
279
do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
280
unset ($__refs, $__v); /* Unset defined __refs, __v. */
281
}
includes/classes/custom-reg-fields.inc.php CHANGED
@@ -1,6 +1,6 @@
1
<?php
2
/**
3
- * Custom Registration Fields for s2Member.
4
*
5
* Copyright: © 2009-2011
6
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
@@ -15,12 +15,12 @@
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
21
{
22
/**
23
- * Custom Registration Fields for s2Member.
24
*
25
* @package s2Member\Custom_Reg_Fields
26
* @since 3.5
@@ -48,13 +48,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
48
*/
49
public static function custom_field_gen ($_function = FALSE, $_field = FALSE, $_name_prefix = FALSE, $_id_prefix = FALSE, $_classes = FALSE, $_styles = FALSE, $_tabindex = FALSE, $_attrs = FALSE, $_submission = FALSE, $_value = FALSE, $_editable_context = FALSE)
50
{
51
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
52
do_action ("ws_plugin__s2member_before_custom_field_gen", get_defined_vars ());
53
unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
/**/
55
if (!($gen = "") && $_function && is_array ($field = $_field) && !empty ($field["type"]) && !empty ($field["id"]) && $_name_prefix && $_id_prefix)
56
{
57
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
58
do_action ("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars ());
59
unset ($__refs, $__v); /* Unset defined __refs, __v. */
60
/**/
@@ -70,7 +70,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
70
$common .= ((!empty ($field["required"]) && $field["required"] === "yes") ? ' aria-required="true"' : '');
71
$common .= ((strlen ($_tabindex)) ? ' tabindex="' . esc_attr ($_tabindex) . '"' : ''); /* No tabindex if empty. */
72
$common .= ((!empty ($field["expected"])) ? ' data-expected="' . esc_attr ($field["expected"]) . '"' : ''); /* Certain data expected? */
73
- $common .= (($_editable_context === "profile-view" || (!empty ($field["editable"]) && preg_match ("/^no/", $field["editable"]) && $_editable_context === "profile")) ? ' disabled="disabled"' : '');
74
$common .= (($_classes || !empty ($field["classes"])) ? ' class="' . esc_attr (trim ($_classes . ((!empty ($field["classes"])) ? ' ' . $field["classes"] : ''))) . '"' : '');
75
$common .= (($_styles || !empty ($field["styles"])) ? ' style="' . esc_attr (trim ($_styles . ((!empty ($field["styles"])) ? ' ' . $field["styles"] : ''))) . '"' : '');
76
$common .= (($_attrs || !empty ($field["attrs"])) ? ' ' . trim ($_attrs . ((!empty ($field["attrs"])) ? ' ' . $field["attrs"] : '')) : '');
@@ -258,7 +258,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
258
}
259
}
260
/**/
261
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
262
do_action ("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars ());
263
unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
}
@@ -278,7 +278,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
278
*/
279
public static function custom_fields_configured_at_level ($_level = "auto-detection", $_editable_context = FALSE)
280
{
281
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
282
do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
283
unset ($__refs, $__v); /* Unset defined __refs, __v. */
284
/**/
@@ -322,7 +322,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
322
/**/
323
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
324
/**/
325
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
326
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
327
unset ($__refs, $__v); /* Unset defined __refs, __v. */
328
/**/
@@ -330,7 +330,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
330
{
331
echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
332
/**/
333
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
334
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
335
unset ($__refs, $__v); /* Unset defined __refs, __v. */
336
/**/
@@ -338,11 +338,11 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
338
echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . esc_attr ($_p["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
339
echo '<br />' . "\n";
340
/**/
341
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
342
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
343
unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
/**/
345
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
346
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
347
unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
/**/
@@ -350,7 +350,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
350
echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . esc_attr ($_p["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
351
echo '<br />' . "\n";
352
/**/
353
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
354
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
355
unset ($__refs, $__v); /* Unset defined __refs, __v. */
356
}
@@ -359,7 +359,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
359
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
360
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
361
{
362
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
363
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
364
unset ($__refs, $__v); /* Unset defined __refs, __v. */
365
/**/
@@ -368,7 +368,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
368
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
369
$field_id_class = preg_replace ("/_/", "-", $field_var);
370
/**/
371
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
372
if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
373
{
374
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -381,14 +381,14 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
381
unset ($__refs, $__v); /* Unset defined __refs, __v. */
382
}
383
/**/
384
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
385
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
386
unset ($__refs, $__v); /* Unset defined __refs, __v. */
387
}
388
/**/
389
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
390
{
391
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
392
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
393
unset ($__refs, $__v); /* Unset defined __refs, __v. */
394
/**/
@@ -398,17 +398,17 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
398
echo '</label>' . "\n";
399
echo '<br />' . "\n";
400
/**/
401
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
402
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
403
unset ($__refs, $__v); /* Unset defined __refs, __v. */
404
}
405
/**/
406
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
407
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
408
unset ($__refs, $__v); /* Unset defined __refs, __v. */
409
}
410
/**/
411
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
412
do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
413
unset ($__refs, $__v); /* Unset defined __refs, __v. */
414
/**/
@@ -436,13 +436,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
436
/**/
437
$tabindex = 20; /* Incremented tabindex starting with 20. */
438
/**/
439
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
440
do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
441
unset ($__refs, $__v); /* Unset defined __refs, __v. */
442
/**/
443
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
444
{
445
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
446
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
447
unset ($__refs, $__v); /* Unset defined __refs, __v. */
448
/**/
@@ -461,7 +461,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
461
/**/
462
echo '</p>' . "\n";
463
/**/
464
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
465
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
466
unset ($__refs, $__v); /* Unset defined __refs, __v. */
467
}
@@ -470,7 +470,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
470
{
471
echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
472
/**/
473
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
474
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
475
unset ($__refs, $__v); /* Unset defined __refs, __v. */
476
/**/
@@ -481,11 +481,11 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
481
echo '</label>' . "\n";
482
echo '</p>' . "\n";
483
/**/
484
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
485
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
486
unset ($__refs, $__v); /* Unset defined __refs, __v. */
487
/**/
488
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
489
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
490
unset ($__refs, $__v); /* Unset defined __refs, __v. */
491
/**/
@@ -496,7 +496,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
496
echo '</label>' . "\n";
497
echo '</p>' . "\n";
498
/**/
499
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
500
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
501
unset ($__refs, $__v); /* Unset defined __refs, __v. */
502
}
@@ -508,7 +508,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
508
/**/
509
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
510
{
511
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
512
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
513
unset ($__refs, $__v); /* Unset defined __refs, __v. */
514
/**/
@@ -517,7 +517,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
517
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
518
$field_id_class = preg_replace ("/_/", "-", $field_var);
519
/**/
520
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
521
if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
522
{
523
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -532,7 +532,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
532
unset ($__refs, $__v); /* Unset defined __refs, __v. */
533
}
534
/**/
535
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
536
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
537
unset ($__refs, $__v); /* Unset defined __refs, __v. */
538
}
@@ -540,7 +540,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
540
/**/
541
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
542
{
543
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
544
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
545
unset ($__refs, $__v); /* Unset defined __refs, __v. */
546
/**/
@@ -551,16 +551,16 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
551
echo '</label>' . "\n";
552
echo '</p>' . "\n";
553
/**/
554
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
555
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
556
unset ($__refs, $__v); /* Unset defined __refs, __v. */
557
}
558
/**/
559
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
560
do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
561
unset ($__refs, $__v); /* Unset defined __refs, __v. */
562
/**/
563
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
564
do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
565
unset ($__refs, $__v); /* Unset defined __refs, __v. */
566
/**/
1
<?php
2
/**
3
+ * Custom Registration/Profile Fields for s2Member.
4
*
5
* Copyright: © 2009-2011
6
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
21
{
22
/**
23
+ * Custom Registration/Profile Fields for s2Member.
24
*
25
* @package s2Member\Custom_Reg_Fields
26
* @since 3.5
48
*/
49
public static function custom_field_gen ($_function = FALSE, $_field = FALSE, $_name_prefix = FALSE, $_id_prefix = FALSE, $_classes = FALSE, $_styles = FALSE, $_tabindex = FALSE, $_attrs = FALSE, $_submission = FALSE, $_value = FALSE, $_editable_context = FALSE)
50
{
51
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
52
do_action ("ws_plugin__s2member_before_custom_field_gen", get_defined_vars ());
53
unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
/**/
55
if (!($gen = "") && $_function && is_array ($field = $_field) && !empty ($field["type"]) && !empty ($field["id"]) && $_name_prefix && $_id_prefix)
56
{
57
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
58
do_action ("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars ());
59
unset ($__refs, $__v); /* Unset defined __refs, __v. */
60
/**/
70
$common .= ((!empty ($field["required"]) && $field["required"] === "yes") ? ' aria-required="true"' : '');
71
$common .= ((strlen ($_tabindex)) ? ' tabindex="' . esc_attr ($_tabindex) . '"' : ''); /* No tabindex if empty. */
72
$common .= ((!empty ($field["expected"])) ? ' data-expected="' . esc_attr ($field["expected"]) . '"' : ''); /* Certain data expected? */
73
+ $common .= (($_editable_context === "profile-view" || (!empty ($field["editable"]) && strpos ($field["editable"], "no") === 0 && $_editable_context === "profile")) ? ' disabled="disabled"' : '');
74
$common .= (($_classes || !empty ($field["classes"])) ? ' class="' . esc_attr (trim ($_classes . ((!empty ($field["classes"])) ? ' ' . $field["classes"] : ''))) . '"' : '');
75
$common .= (($_styles || !empty ($field["styles"])) ? ' style="' . esc_attr (trim ($_styles . ((!empty ($field["styles"])) ? ' ' . $field["styles"] : ''))) . '"' : '');
76
$common .= (($_attrs || !empty ($field["attrs"])) ? ' ' . trim ($_attrs . ((!empty ($field["attrs"])) ? ' ' . $field["attrs"] : '')) : '');
258
}
259
}
260
/**/
261
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
262
do_action ("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars ());
263
unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
}
278
*/
279
public static function custom_fields_configured_at_level ($_level = "auto-detection", $_editable_context = FALSE)
280
{
281
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
282
do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
283
unset ($__refs, $__v); /* Unset defined __refs, __v. */
284
/**/
322
/**/
323
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
324
/**/
325
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
326
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
327
unset ($__refs, $__v); /* Unset defined __refs, __v. */
328
/**/
330
{
331
echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
332
/**/
333
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
334
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
335
unset ($__refs, $__v); /* Unset defined __refs, __v. */
336
/**/
338
echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . esc_attr ($_p["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
339
echo '<br />' . "\n";
340
/**/
341
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
342
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
343
unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
/**/
345
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
346
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
347
unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
/**/
350
echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . esc_attr ($_p["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
351
echo '<br />' . "\n";
352
/**/
353
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
354
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
355
unset ($__refs, $__v); /* Unset defined __refs, __v. */
356
}
359
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
360
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
361
{
362
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
363
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
364
unset ($__refs, $__v); /* Unset defined __refs, __v. */
365
/**/
368
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
369
$field_id_class = preg_replace ("/_/", "-", $field_var);
370
/**/
371
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
372
if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
373
{
374
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
381
unset ($__refs, $__v); /* Unset defined __refs, __v. */
382
}
383
/**/
384
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
385
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
386
unset ($__refs, $__v); /* Unset defined __refs, __v. */
387
}
388
/**/
389
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
390
{
391
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
392
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
393
unset ($__refs, $__v); /* Unset defined __refs, __v. */
394
/**/
398
echo '</label>' . "\n";
399
echo '<br />' . "\n";
400
/**/
401
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
402
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
403
unset ($__refs, $__v); /* Unset defined __refs, __v. */
404
}
405
/**/
406
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
407
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
408
unset ($__refs, $__v); /* Unset defined __refs, __v. */
409
}
410
/**/
411
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
412
do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
413
unset ($__refs, $__v); /* Unset defined __refs, __v. */
414
/**/
436
/**/
437
$tabindex = 20; /* Incremented tabindex starting with 20. */
438
/**/
439
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
440
do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
441
unset ($__refs, $__v); /* Unset defined __refs, __v. */
442
/**/
443
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
444
{
445
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
446
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
447
unset ($__refs, $__v); /* Unset defined __refs, __v. */
448
/**/
461
/**/
462
echo '</p>' . "\n";
463
/**/
464
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
465
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
466
unset ($__refs, $__v); /* Unset defined __refs, __v. */
467
}
470
{
471
echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
472
/**/
473
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
474
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
475
unset ($__refs, $__v); /* Unset defined __refs, __v. */
476
/**/
481
echo '</label>' . "\n";
482
echo '</p>' . "\n";
483
/**/
484
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
485
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
486
unset ($__refs, $__v); /* Unset defined __refs, __v. */
487
/**/
488
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
489
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
490
unset ($__refs, $__v); /* Unset defined __refs, __v. */
491
/**/
496
echo '</label>' . "\n";
497
echo '</p>' . "\n";
498
/**/
499
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
500
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
501
unset ($__refs, $__v); /* Unset defined __refs, __v. */
502
}
508
/**/
509
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
510
{
511
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
512
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
513
unset ($__refs, $__v); /* Unset defined __refs, __v. */
514
/**/
517
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
518
$field_id_class = preg_replace ("/_/", "-", $field_var);
519
/**/
520
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
521
if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
522
{
523
if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
532
unset ($__refs, $__v); /* Unset defined __refs, __v. */
533
}
534
/**/
535
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
536
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
537
unset ($__refs, $__v); /* Unset defined __refs, __v. */
538
}
540
/**/
541
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
542
{
543
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
544
do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
545
unset ($__refs, $__v); /* Unset defined __refs, __v. */
546
/**/
551
echo '</label>' . "\n";
552
echo '</p>' . "\n";
553
/**/
554
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
555
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
556
unset ($__refs, $__v); /* Unset defined __refs, __v. */
557
}
558
/**/
559
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
560
do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
561
unset ($__refs, $__v); /* Unset defined __refs, __v. */
562
/**/
563
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
564
do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
565
unset ($__refs, $__v); /* Unset defined __refs, __v. */
566
/**/
includes/classes/email-configs.inc.php CHANGED
@@ -28,27 +28,6 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
28
class c_ws_plugin__s2member_email_configs
29
{
30
/**
31
- * Filters email addresses passed to ``wp_mail()``.
32
- *
33
- * @package s2Member\Email_Configs
34
- * @since 3.5
35
- *
36
- * @attaches-to ``add_filter("wp_mail");``
37
- *
38
- * @param array $array Expects an array passed through by the Filter.
39
- * @return array Returns the array passed through by the Filter.
40
- */
41
- public static function email_filter ($array = FALSE)
42
- {
43
- if (!empty ($array["to"]) && is_string ($array["to"]))
44
- $array["to"] = str_replace (array ('\"', '"'), "", $array["to"]);
45
- /**/
46
- if (!empty ($array["to"]) && is_string ($array["to"]) && strpos ($array["to"], ";") !== false)
47
- $array["to"] = c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $array["to"]));
48
- /**/
49
- return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
50
- }
51
- /**
52
* Modifies email From: `"Name" <address>`.
53
*
54
* These Filters are only needed during registration.
@@ -172,7 +151,29 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
172
return apply_filters ("ws_plugin__s2member_ms_nice_email_roles", $message, get_defined_vars ());
173
}
174
/**
175
- * Handles new User notifications.
176
*
177
* @package s2Member\Email_Configs
178
* @since 110707
@@ -214,7 +215,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
214
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
215
{
216
if (is_array ($fields) && !empty ($fields))
217
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
218
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
219
break;
220
/**/
@@ -231,7 +232,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
231
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
232
{
233
if (is_array ($fields) && !empty ($fields))
234
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
235
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
236
break;
237
/**/
@@ -241,73 +242,74 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
241
}
242
}
243
/**/
244
- if (in_array ("admin", $notify) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"])
245
- {
246
- $fields = get_user_option ("s2member_custom_fields", $user_id);
247
- $cv = preg_split ("/\|/", get_user_option ("s2member_custom", $user_id));
248
- $user_full_name = trim ($user->first_name . " " . $user->last_name);
249
- $user_ip = $_SERVER["REMOTE_ADDR"];
250
- /**/
251
- if (($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]))
252
- if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)))
253
- if (($rec = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (wp_login_url ()), $rec)))
254
- if (($rec = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name)), $rec)))
255
- if (($rec = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name)), $rec)))
256
- if (($rec = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($user_full_name)), $rec)))
257
- if (($rec = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $rec)))
258
- if (($rec = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $rec)))
259
- if (($rec = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_pass), $rec)))
260
- if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $rec)))
261
- if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $rec)))
262
- {
263
- if (is_array ($fields) && !empty ($fields))
264
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
265
- if (!($rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec)))
266
- break;
267
- /**/
268
- if (($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]))
269
- if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)))
270
- if (($sbj = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (wp_login_url ()), $sbj)))
271
- if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $sbj)))
272
- if (($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $sbj)))
273
- if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_full_name), $sbj)))
274
- if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $sbj)))
275
- if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $sbj)))
276
- if (($sbj = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_pass), $sbj)))
277
- if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $sbj)))
278
- if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
279
- {
280
- if (is_array ($fields) && !empty ($fields))
281
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
282
- if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
283
- break;
284
- /**/
285
- if (($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_message"]))
286
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
287
- if (($msg = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (wp_login_url ()), $msg)))
288
- if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)))
289
- if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
290
- if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_full_name), $msg)))
291
- if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
292
- if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $msg)))
293
- if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_pass), $msg)))
294
- if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $msg)))
295
- if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
296
- {
297
- if (is_array ($fields) && !empty ($fields))
298
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
299
- if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
300
- break;
301
- /**/
302
- if (($recipients = preg_split ("/;+/", preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
303
- {
304
- foreach (c_ws_plugin__s2member_utils_strings::trim_deep ($recipients) as $recipient)
305
- ($recipient) ? wp_mail ($recipient, $sbj, $msg, "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;
306
- }
307
- }
308
- }
309
- }
310
- }
311
/**/
312
if ($email_configs_were_on) /* Back on? */
313
c_ws_plugin__s2member_email_configs::email_config ();
28
class c_ws_plugin__s2member_email_configs
29
{
30
/**
31
* Modifies email From: `"Name" <address>`.
32
*
33
* These Filters are only needed during registration.
151
return apply_filters ("ws_plugin__s2member_ms_nice_email_roles", $message, get_defined_vars ());
152
}
153
/**
154
+ * Filters email addresses passed to ``wp_mail()``.
155
+ *
156
+ * @package s2Member\Email_Configs
157
+ * @since 3.5
158
+ *
159
+ * @attaches-to ``add_filter("wp_mail");``
160
+ * @uses {@link s2Member\Utilities\c_ws_plugin__s2member_utils_strings::parse_emails()}
161
+ *
162
+ * @param array $array Expects an array passed through by the Filter.
163
+ * @return array Returns the array passed through by the Filter.
164
+ */
165
+ public static function email_filter ($array = FALSE)
166
+ {
167
+ if (isset ($array["to"]) && !empty ($array["to"])) /* Filter list of recipients? */
168
+ /* Reduces `"Name" <email>`, to just an email address *(for best cross-platform compatibility across various MTAs)*. */
169
+ /* Also works around bug in PHP versions prior to fix in 5.2.11. See bug report: <https://bugs.php.net/bug.php?id=28038>. */
170
+ /* Also supplements WordPress®. WordPress® currently does NOT support semicolon `;` delimitation, s2Member does. */
171
+ $array["to"] = implode (",", c_ws_plugin__s2member_utils_strings::parse_emails ($array["to"]));
172
+ /**/
173
+ return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
174
+ }
175
+ /**
176
+ * Handles new User/Member notifications.
177
*
178
* @package s2Member\Email_Configs
179
* @since 110707
215
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
216
{
217
if (is_array ($fields) && !empty ($fields))
218
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
219
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
220
break;
221
/**/
232
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
233
{
234
if (is_array ($fields) && !empty ($fields))
235
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
236
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
237
break;
238
/**/
242
}
243
}
244
/**/
245
+ if (in_array ("admin", $notify)) /* Send Admin(s) a notification? */
246
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"])
247
+ {
248
+ $fields = get_user_option ("s2member_custom_fields", $user_id);
249
+ $cv = preg_split ("/\|/", get_user_option ("s2member_custom", $user_id));
250
+ $user_full_name = trim ($user->first_name . " " . $user->last_name);
251
+ $user_ip = $_SERVER["REMOTE_ADDR"];
252
+ /**/
253
+ if (($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]))
254
+ if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)))
255
+ if (($rec = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (wp_login_url ()), $rec)))
256
+ if (($rec = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name)), $rec)))
257
+ if (($rec = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name)), $rec)))
258
+ if (($rec = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq (c_ws_plugin__s2member_utils_strings::esc_ds ($user_full_name)), $rec)))
259
+ if (($rec = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $rec)))
260
+ if (($rec = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $rec)))
261
+ if (($rec = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_pass), $rec)))
262
+ if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $rec)))
263
+ if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $rec)))
264
+ {
265
+ if (is_array ($fields) && !empty ($fields))
266
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
267
+ if (!($rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec)))
268
+ break;
269
+ /**/
270
+ if (($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]))
271
+ if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)))
272
+ if (($sbj = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (wp_login_url ()), $sbj)))
273
+ if (($sbj = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $sbj)))
274
+ if (($sbj = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $sbj)))
275
+ if (($sbj = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_full_name), $sbj)))
276
+ if (($sbj = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $sbj)))
277
+ if (($sbj = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $sbj)))
278
+ if (($sbj = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_pass), $sbj)))
279
+ if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $sbj)))
280
+ if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
281
+ {
282
+ if (is_array ($fields) && !empty ($fields))
283
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
284
+ if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
285
+ break;
286
+ /**/
287
+ if (($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_message"]))
288
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
289
+ if (($msg = preg_replace ("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (wp_login_url ()), $msg)))
290
+ if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)))
291
+ if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
292
+ if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_full_name), $msg)))
293
+ if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
294
+ if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_login), $msg)))
295
+ if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_pass), $msg)))
296
+ if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $msg)))
297
+ if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
298
+ {
299
+ if (is_array ($fields) && !empty ($fields))
300
+ foreach ($fields as $var => $val) /* Custom Registration/Profile Fields. */
301
+ if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
302
+ break;
303
+ /**/
304
+ if (($recipients = preg_split ("/;+/", preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
305
+ {
306
+ foreach (c_ws_plugin__s2member_utils_strings::trim_deep ($recipients) as $recipient)
307
+ ($recipient) ? wp_mail ($recipient, $sbj, $msg, "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;
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
/**/
314
if ($email_configs_were_on) /* Back on? */
315
c_ws_plugin__s2member_email_configs::email_config ();
includes/classes/files-in.inc.php CHANGED
@@ -73,9 +73,6 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
73
if ($req["file_download"] && is_string ($req["file_download"]) && ($req["file_download"] = trim ($req["file_download"], "/")))
74
if (strpos ($req["file_download"], "..") === false && strpos (basename ($req["file_download"]), ".") !== 0)
75
{
76
- if ($serving) /* We only need this section when/if we're actually serving. */
77
- @set_time_limit(0) . @ini_set ("zlib.output_compression", 0) . eval ('while (@ob_end_clean ());');
78
- /**/
79
$using_amazon_s3_storage = ((!$req["file_storage"] || strcasecmp ((string)$req["file_storage"], "s3") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage ()) ? true : false;
80
$using_amazon_cf_storage = ((!$req["file_storage"] || strcasecmp ((string)$req["file_storage"], "cf") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage ()) ? true : false;
81
$using_amazon_storage = ($using_amazon_s3_storage || $using_amazon_cf_storage) ? true : false; /* Either/or? */
@@ -90,7 +87,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
90
if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
91
{
92
if ($serving) /* We only need this section when/if we're actually serving. */
93
- status_header(404) . exit (_x ("404: Sorry, file not found. Please contact Support for assistance.", "s2member-front", "s2member"));
94
/**/
95
else /* Else return false. */
96
return false;
@@ -99,13 +97,14 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
99
else if ($req["file_download_key"] && is_string ($req["file_download_key"]) && !$valid_file_download_key)
100
{
101
if ($serving) /* We only need this section when/if we're actually serving. */
102
- status_header(503) . exit (_x ("503 ( Invalid Key ): Sorry, your access to this file has expired. Please contact Support for assistance.", "s2member-front", "s2member"));
103
/**/
104
else /* Else return false. */
105
return false;
106
}
107
/**/
108
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] || ($file_downloads_enabled = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
109
{
110
if ($serving) /* We only need remote functionality when/if we're actually serving. */
111
if (!has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization"))
@@ -115,21 +114,20 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
115
if (has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization"))
116
remove_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
117
/**/
118
- if ((isset ($file_downloads_enabled, $min_level_4_downloads) && $file_downloads_enabled === false) || ($file_downloads_enabled = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
119
{
120
if ($serving) /* We only need this section when/if we're actually serving. */
121
- status_header(503) . exit (_x ("503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`.", "s2member-front", "s2member"));
122
/**/
123
else /* Else return false. */
124
return false;
125
}
126
/**/
127
- else if (!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ((is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || empty ($user->ID) || !($user_id = $user->ID))
128
{
129
- if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m))
130
{
131
- $level_req = $m[1]; /* Memebership Level required. */
132
- /**/
133
if ($serving) /* We only need this section when/if we're actually serving. */
134
wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
135
/**/
@@ -137,10 +135,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
137
return false;
138
}
139
/**/
140
- else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $req["file_download"], $m))
141
{
142
- $ccap_req = preg_replace ("/-/", "_", $m[1]); /* Custom Capability required. */
143
- /**/
144
if ($serving) /* We only need this section when/if we're actually serving. */
145
wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
146
/**/
@@ -155,15 +151,6 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
155
return false;
156
}
157
/**/
158
- else if (!is_array ($file_downloads = c_ws_plugin__s2member_files::user_downloads ($user)) || (!$user->has_cap ("administrator") && (!$file_downloads["allowed"] || !$file_downloads["allowed_days"])))
159
- {
160
- if ($serving) /* We only need this section when/if we're actually serving. */
161
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
162
- /**/
163
- else /* Else return false. */
164
- return false;
165
- }
166
- /**/
167
else if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m) && strlen ($level_req = $m[1]) && !$user->has_cap ("access_s2member_level" . $level_req))
168
{
169
if ($serving) /* We only need this section when/if we're actually serving. */
@@ -184,34 +171,37 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
184
/**/
185
else if ($serving || $creating) /* In either case, the following routines apply. */
186
{
187
- $already_downloaded = $streaming_variation_already_downloaded = false;
188
- $previous_file_downloads = 0; /* Here we're going to count how many downloads they have. */
189
- $max_days_logged = c_ws_plugin__s2member_files::max_download_period (); /* Max period/days. */
190
- $file_download_access_log = (array)get_user_option ("s2member_file_download_access_log", $user_id);
191
- $file_download_access_arc = (array)get_user_option ("s2member_file_download_access_arc", $user_id);
192
$streaming_file_extns = c_ws_plugin__s2member_utils_strings::preg_quote_deep ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"], "/");
193
$streaming_variations = /* Only count one streaming media file variation. */ "/\.(" . implode ("|", $streaming_file_extns) . ")#x2F;i";
194
/**/
195
- foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
196
{
197
- if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $max_days_logged . " days"))
198
{
199
- unset($file_download_access_log[$file_download_access_log_entry_key]);
200
- $file_download_access_arc[] = $file_download_access_log_entry;
201
}
202
- else if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . $file_downloads["allowed_days"] . " days"))
203
{
204
- $previous_file_downloads++; /* A previous file that counts. */
205
/**/
206
- if ($file_download_access_log_entry["file"] === $req["file_download"]) /* Already downloaded this file? Or another streaming variation? */
207
- $already_downloaded = true; /* Already downloaded this file? Or another streaming variation? */
208
/**/
209
- else if (preg_replace ($streaming_variations, "", $file_download_access_log_entry["file"]) === preg_replace ($streaming_variations, "", $req["file_download"]))
210
- $already_downloaded = $streaming_variation_already_downloaded = true;
211
}
212
}
213
/**/
214
- if (!$already_downloaded && !$streaming_variation_already_downloaded && !$user->has_cap ("administrator") && $previous_file_downloads >= $file_downloads["allowed"])
215
{
216
if ($serving) /* We only need this section when/if we're actually serving. */
217
wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
@@ -220,13 +210,13 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
220
return false;
221
}
222
/**/
223
- else if (!$already_downloaded && !$streaming_variation_already_downloaded)
224
- $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $req["file_download"]);
225
/**/
226
if ($updating_user_counter) /* By default, we do NOT update the counter when a URL is being created; but this behavior can be modified. */
227
{
228
- update_user_option ($user_id, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_arc));
229
- update_user_option ($user_id, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_log));
230
}
231
}
232
}
@@ -236,7 +226,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
236
if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
237
{
238
if ($serving) /* We only need this section when/if we're actually serving. */
239
- status_header(404) . exit (_x ("404: Sorry, file not found. Please contact Support for assistance.", "s2member-front", "s2member"));
240
/**/
241
else /* Else return false. */
242
return false;
@@ -323,7 +314,9 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
323
/**/
324
else /* Else, ``if ($serving)`` , use local storage option (default). */
325
{
326
- status_header(200);
327
/**/
328
header("Accept-Ranges: none");
329
header("Content-Encoding: none");
@@ -336,6 +329,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
336
/**/
337
header('Content-Disposition: ' . (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"');
338
/**/
339
if ($length && apply_filters ("ws_plugin__s2member_chunk_file_downloads", true, get_defined_vars ()) && is_resource ($resource = fopen ($file, "rb")))
340
{
341
$_chunk_size = apply_filters ("ws_plugin__s2member_chunk_file_downloads_w_chunk_size", 2097152, get_defined_vars ());
@@ -365,7 +360,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
365
}
366
/**/
367
else if ($serving && $req["file_download"]) /* We only need this section when/if we're actually serving. */
368
- status_header(503) . exit (_x ("503: Access denied. Invalid File Download specs.", "s2member-front", "s2member"));
369
/**/
370
else if ($creating) /* We only need this section when/if we're creating a URL. */
371
return false;
@@ -451,9 +447,13 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
451
/**/
452
if (empty ($_SERVER["PHP_AUTH_USER"]) || empty ($_SERVER["PHP_AUTH_PW"]) || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
453
{
454
- header('WWW-Authenticate: Basic realm="' . _x ("Members Only", "s2member-front", "s2member") . '"');
455
- status_header(401); /* Unauthorized status header. */
456
- exit(_x ("Access Denied", "s2member-front", "s2member"));
457
}
458
else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && !empty ($_user->ID))
459
$user = $_user; /* Now assign ``$user``. */
73
if ($req["file_download"] && is_string ($req["file_download"]) && ($req["file_download"] = trim ($req["file_download"], "/")))
74
if (strpos ($req["file_download"], "..") === false && strpos (basename ($req["file_download"]), ".") !== 0)
75
{
76
$using_amazon_s3_storage = ((!$req["file_storage"] || strcasecmp ((string)$req["file_storage"], "s3") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage ()) ? true : false;
77
$using_amazon_cf_storage = ((!$req["file_storage"] || strcasecmp ((string)$req["file_storage"], "cf") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage ()) ? true : false;
78
$using_amazon_storage = ($using_amazon_s3_storage || $using_amazon_cf_storage) ? true : false; /* Either/or? */
87
if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
88
{
89
if ($serving) /* We only need this section when/if we're actually serving. */
90
+ status_header(404) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
91
+ . exit (_x ('<strong>404: Sorry, file not found.</strong> Please contact Support for assistance.', "s2member-front", "s2member"));
92
/**/
93
else /* Else return false. */
94
return false;
97
else if ($req["file_download_key"] && is_string ($req["file_download_key"]) && !$valid_file_download_key)
98
{
99
if ($serving) /* We only need this section when/if we're actually serving. */
100
+ status_header(503) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
101
+ . exit (_x ('<strong>503 ( Invalid Key ):</strong> Sorry, your access to this file has expired. Please contact Support for assistance.', "s2member-front", "s2member"));
102
/**/
103
else /* Else return false. */
104
return false;
105
}
106
/**/
107
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] || ($file_downloads_enabled_by_site_owner = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
108
{
109
if ($serving) /* We only need remote functionality when/if we're actually serving. */
110
if (!has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization"))
114
if (has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization"))
115
remove_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
116
/**/
117
+ if ((isset ($file_downloads_enabled_by_site_owner, $min_level_4_downloads) && $file_downloads_enabled_by_site_owner === false) || ($file_downloads_enabled_by_site_owner = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
118
{
119
if ($serving) /* We only need this section when/if we're actually serving. */
120
+ status_header(503) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
121
+ . exit (_x ('<strong>503: Basic File Downloads are NOT enabled yet.</strong> Please contact Support for assistance. If you are the site owner, please configure: <code>s2Member -> Download Options -> Basic Download Restrictions</code>.', "s2member-front", "s2member"));
122
/**/
123
else /* Else return false. */
124
return false;
125
}
126
/**/
127
+ else if (!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ((is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || empty ($user->ID) || !($user_id = $user->ID) || !is_array ($user_file_downloads = c_ws_plugin__s2member_files::user_downloads ($user)) || (!$user->has_cap ("administrator") && (!$user_file_downloads["allowed"] || !$user_file_downloads["allowed_days"])))
128
{
129
+ if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m) && strlen ($level_req = $m[1]) && (!is_object ($user) || empty ($user->ID) || !$user->has_cap ("access_s2member_level" . $level_req)))
130
{
131
if ($serving) /* We only need this section when/if we're actually serving. */
132
wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
133
/**/
135
return false;
136
}
137
/**/
138
+ else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $req["file_download"], $m) && strlen ($ccap_req = preg_replace ("/-/", "_", $m[1])) && (!is_object ($user) || empty ($user->ID) || !$user->has_cap ("access_s2member_ccap_" . $ccap_req)))
139
{
140
if ($serving) /* We only need this section when/if we're actually serving. */
141
wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
142
/**/
151
return false;
152
}
153
/**/
154
else if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m) && strlen ($level_req = $m[1]) && !$user->has_cap ("access_s2member_level" . $level_req))
155
{
156
if ($serving) /* We only need this section when/if we're actually serving. */
171
/**/
172
else if ($serving || $creating) /* In either case, the following routines apply. */
173
{
174
+ $user_previous_file_downloads = 0; /* Downloads the User has already; in current period/cycle. */
175
+ $user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = false;
176
+ /**/
177
+ $user_file_download_access_log = (array)get_user_option ("s2member_file_download_access_log", $user_id);
178
+ $user_file_download_access_arc = (array)get_user_option ("s2member_file_download_access_arc", $user_id);
179
+ /**/
180
$streaming_file_extns = c_ws_plugin__s2member_utils_strings::preg_quote_deep ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"], "/");
181
$streaming_variations = /* Only count one streaming media file variation. */ "/\.(" . implode ("|", $streaming_file_extns) . ")#x2F;i";
182
/**/
183
+ $max_download_period_days = c_ws_plugin__s2member_files::max_download_period (); /* Max download period; counted in days. */
184
+ /**/
185
+ foreach ($user_file_download_access_log as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry)
186
{
187
+ if (strtotime ($user_file_download_access_log_entry["date"]) < strtotime ("-" . $max_download_period_days . " days"))
188
{
189
+ unset($user_file_download_access_log[$user_file_download_access_log_entry_key]);
190
+ $user_file_download_access_arc[] = $user_file_download_access_log_entry;
191
}
192
+ else if (strtotime ($user_file_download_access_log_entry["date"]) >= strtotime ("-" . $user_file_downloads["allowed_days"] . " days"))
193
{
194
+ $user_previous_file_downloads++; /* A previous file that counts against this User/Member, since it's already in the log. */
195
/**/
196
+ if ($user_file_download_access_log_entry["file"] === $req["file_download"]) /* Already downloaded this file before? */
197
+ $user_already_downloaded_this_file = true; /* Already downloaded this file? If yes, mark this flag as true. */
198
/**/
199
+ else if (preg_replace ($streaming_variations, "", $user_file_download_access_log_entry["file"]) === preg_replace ($streaming_variations, "", $req["file_download"]))
200
+ $user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = true;
201
}
202
}
203
/**/
204
+ if (!$user_already_downloaded_this_file && !$user_already_downloaded_a_streaming_variation_of_this_file && !$user->has_cap ("administrator") && $user_previous_file_downloads >= $user_file_downloads["allowed"])
205
{
206
if ($serving) /* We only need this section when/if we're actually serving. */
207
wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
210
return false;
211
}
212
/**/
213
+ else if (!$user_already_downloaded_this_file && !$user_already_downloaded_a_streaming_variation_of_this_file)
214
+ $user_file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $req["file_download"]);
215
/**/
216
if ($updating_user_counter) /* By default, we do NOT update the counter when a URL is being created; but this behavior can be modified. */
217
{
218
+ update_user_option ($user_id, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($user_file_download_access_arc));
219
+ update_user_option ($user_id, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($user_file_download_access_log));
220
}
221
}
222
}
226
if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
227
{
228
if ($serving) /* We only need this section when/if we're actually serving. */
229
+ status_header(404) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
230
+ . exit (_x ('<strong>404: Sorry, file not found.</strong> Please contact Support for assistance.', "s2member-front", "s2member"));
231
/**/
232
else /* Else return false. */
233
return false;
314
/**/
315
else /* Else, ``if ($serving)`` , use local storage option (default). */
316
{
317
+ @set_time_limit(0) . @ini_set ("zlib.output_compression", 0);
318
+ /**/
319
+ status_header(200); /* 200 OK status header. */
320
/**/
321
header("Accept-Ranges: none");
322
header("Content-Encoding: none");
329
/**/
330
header('Content-Disposition: ' . (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"');
331
/**/
332
+ eval('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist already. */
333
+ /**/
334
if ($length && apply_filters ("ws_plugin__s2member_chunk_file_downloads", true, get_defined_vars ()) && is_resource ($resource = fopen ($file, "rb")))
335
{
336
$_chunk_size = apply_filters ("ws_plugin__s2member_chunk_file_downloads_w_chunk_size", 2097152, get_defined_vars ());
360
}
361
/**/
362
else if ($serving && $req["file_download"]) /* We only need this section when/if we're actually serving. */
363
+ status_header(503) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
364
+ . exit (_x ('<strong>503: Access denied.</strong> Invalid File Download specs.', "s2member-front", "s2member"));
365
/**/
366
else if ($creating) /* We only need this section when/if we're creating a URL. */
367
return false;
447
/**/
448
if (empty ($_SERVER["PHP_AUTH_USER"]) || empty ($_SERVER["PHP_AUTH_PW"]) || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
449
{
450
+ header('WWW-Authenticate: Basic realm="' . c_ws_plugin__s2member_utils_strings::esc_dq (strip_tags (_x ("Members Only", "s2member-front", "s2member"))) . '"');
451
+ /**/
452
+ status_header(401); /* Send an unauthorized 401 status header now. */
453
+ header("Content-Type: text/html; charset=utf-8"); /* Content-Type with UTF-8. */
454
+ eval('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist. */
455
+ /**/
456
+ exit(_x ('<strong>401:</strong> Sorry, access denied.', "s2member-front", "s2member"));
457
}
458
else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && !empty ($_user->ID))
459
$user = $_user; /* Now assign ``$user``. */
includes/classes/files.inc.php CHANGED
@@ -135,7 +135,46 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
135
return apply_filters ("ws_plugin__s2member_min_level_4_downloads", ((is_int ($min)) ? $min : false), get_defined_vars ());
136
}
137
/**
138
- * Determines how many File Downloads are allowed, also provides some extended details.
139
*
140
* @package s2Member\Files
141
* @since 3.5
@@ -151,7 +190,7 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
151
do_action ("ws_plugin__s2member_before_user_downloads", get_defined_vars ());
152
unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
/**/
154
- $allowed = $allowed_days = $currently = 0; /* Initialize all of these to zero. */
155
/**/
156
if ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty ($user->ID) && ($user_id = $user->ID))
157
{
@@ -170,54 +209,16 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
170
}
171
}
172
/**/
173
- $file_download_access_log = (isset ($log)) ? (array)$log : (array)get_user_option ("s2member_file_download_access_log", $user_id);
174
- foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
175
- if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . $allowed_days . " days"))
176
- if ($file_download_access_log_entry["file"] !== $not_counting_this_particular_file)
177
$currently = $currently + 1;
178
}
179
/**/
180
return apply_filters ("ws_plugin__s2member_user_downloads", array ("allowed" => $allowed, "allowed_days" => $allowed_days, "currently" => $currently), get_defined_vars ());
181
}
182
- /**
183
- * Creates a File Download Key.
184
- *
185
- * Builds a hash of: ``date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file``.
186
- *
187
- * @package s2Member\Files
188
- * @since 3.5
189
- *
190
- * @param str $file Location of your protected file, relative to the `/s2member-files/` directory.
191
- * In other words, just the name of the file *(i.e. `file.zip` )*.
192
- * @param str $directive Optional. One of `ip-forever|universal|cache-compatible`.
193
- * `ip-forever` = a Download Key that never expires, tied only to a specific file and IP address.
194
- * `universal` and/or `cache-compatible` = a Download Key which never expires, and is NOT tied to any specific User. Use at your own risk.
195
- * @return str A Download Key. MD5 hash, 32 characters, URL-safe.
196
- */
197
- public static function file_download_key ($file = FALSE, $directive = FALSE)
198
- {
199
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
200
- do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
201
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
- /**/
203
- $file = ($file && is_string ($file) && ($file = trim ($file, "/"))) ? $file : "";
204
- /**/
205
- if ($directive === "ip-forever") /* Allows the current IP forever. */
206
- eval ('$allow_caching = false; $salt = $file . $_SERVER["REMOTE_ADDR"];');
207
- /**/
208
- else if ($directive === "universal" || $directive === "cache-compatible" || $directive)
209
- eval ('$allow_caching = true; $salt = $file;');
210
- /**/
211
- else /* Otherwise, we use the default ``$salt``, which is VERY restrictive; even to a specific browser. */
212
- eval ('$allow_caching = false; $salt = date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file;');
213
- /**/
214
- $key = md5 (c_ws_plugin__s2member_utils_encryption::xencrypt ($salt));
215
- /**/
216
- if ($allow_caching === false) /* Disallow caching? */
217
- c_ws_plugin__s2member_no_cache::no_cache_constants (true); /* No caching. */
218
- /**/
219
- return apply_filters ("ws_plugin__s2member_file_download_key", $key, get_defined_vars ());
220
- }
221
}
222
}
223
?>
135
return apply_filters ("ws_plugin__s2member_min_level_4_downloads", ((is_int ($min)) ? $min : false), get_defined_vars ());
136
}
137
/**
138
+ * Creates a File Download Key.
139
+ *
140
+ * Builds a hash of: ``date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file``.
141
+ *
142
+ * @package s2Member\Files
143
+ * @since 3.5
144
+ *
145
+ * @param str $file Location of your protected file, relative to the `/s2member-files/` directory.
146
+ * In other words, just the name of the file *(i.e. `file.zip` )*.
147
+ * @param str $directive Optional. One of `ip-forever|universal|cache-compatible`.
148
+ * `ip-forever` = a Download Key that never expires, tied only to a specific file and IP address.
149
+ * `universal` and/or `cache-compatible` = a Download Key which never expires, and is NOT tied to any specific User. Use at your own risk.
150
+ * @return str A Download Key. MD5 hash, 32 characters, URL-safe.
151
+ */
152
+ public static function file_download_key ($file = FALSE, $directive = FALSE)
153
+ {
154
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
155
+ do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
156
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
157
+ /**/
158
+ $file = ($file && is_string ($file) && ($file = trim ($file, "/"))) ? $file : "";
159
+ /**/
160
+ if ($directive === "ip-forever") /* Current IP forever. */
161
+ eval ('$allow_caching = false; $salt = $file . $_SERVER["REMOTE_ADDR"];');
162
+ /**/
163
+ else if ($directive === "universal" || $directive === "cache-compatible" || $directive)
164
+ eval ('$allow_caching = true; $salt = $file;');
165
+ /**/
166
+ else /* Otherwise, we use the default ``$salt``, which is VERY restrictive; even to a specific browser. */
167
+ eval ('$allow_caching = false; $salt = date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file;');
168
+ /**/
169
+ $key = md5 (c_ws_plugin__s2member_utils_encryption::xencrypt ($salt));
170
+ /**/
171
+ if ($allow_caching === false) /* Disallow caching? */
172
+ c_ws_plugin__s2member_no_cache::no_cache_constants (true);
173
+ /**/
174
+ return apply_filters ("ws_plugin__s2member_file_download_key", $key, get_defined_vars ());
175
+ }
176
+ /**
177
+ * Download details on a per-User basis.
178
*
179
* @package s2Member\Files
180
* @since 3.5
190
do_action ("ws_plugin__s2member_before_user_downloads", get_defined_vars ());
191
unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
/**/
193
+ $allowed = $allowed_days = $currently = 0; /* Initialize all of these to a default value of zero. */
194
/**/
195
if ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty ($user->ID) && ($user_id = $user->ID))
196
{
209
}
210
}
211
/**/
212
+ $user_file_download_access_log = (isset ($log)) ? (array)$log : (array)get_user_option ("s2member_file_download_access_log", $user_id);
213
+ /**/
214
+ foreach ($user_file_download_access_log as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry)
215
+ if (strtotime ($user_file_download_access_log_entry["date"]) >= strtotime ("-" . $allowed_days . " days"))
216
+ if ($user_file_download_access_log_entry["file"] !== $not_counting_this_particular_file)
217
$currently = $currently + 1;
218
}
219
/**/
220
return apply_filters ("ws_plugin__s2member_user_downloads", array ("allowed" => $allowed, "allowed_days" => $allowed_days, "currently" => $currently), get_defined_vars ());
221
}
222
}
223
}
224
?>
includes/classes/installation.inc.php CHANGED
@@ -106,7 +106,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
106
}
107
else /* Otherwise (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide. */
108
{
109
- $notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
110
/**/
111
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:users.php", false, false, true);
112
/**/
106
}
107
else /* Otherwise (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide. */
108
{
109
+ $notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
110
/**/
111
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:users.php", false, false, true);
112
/**/
includes/classes/ip-restrictions.inc.php CHANGED
@@ -15,7 +15,7 @@
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
21
{
@@ -30,7 +30,7 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
30
/**
31
* Handles IP Restrictions.
32
*
33
- * IP address details are stored in Transient fields.
34
*
35
* @package s2Member\IP_Restrictions
36
* @since 3.5
@@ -41,65 +41,83 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
41
*/
42
public static function ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
43
{
44
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
45
do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
46
unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
/**/
48
- if (!apply_filters ("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars ()))
49
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] && $restriction)
50
- {
51
- $prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. */
52
- $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_entries");
53
- $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
54
- /**/
55
- /* If you add Filters, use a string compatible with PHP's strtotime() function. */
56
- $concurrency = apply_filters ("ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip", "30 days");
57
- /**/
58
- $entries = (is_array ($entries = get_transient ($transient_entries))) ? $entries : array ();
59
- /**/
60
- foreach ($entries as $_entry => $_time) /* Auto-expire entries. */
61
- if ($_time < strtotime ("-" . $concurrency))
62
- unset ($entries[$_entry]);
63
- /**/
64
- $ip = ($ip) ? $ip : "empty"; /* Allow empty IPs. */
65
- $entries[$ip] = strtotime ("now"); /* Log this entry. */
66
- set_transient ($transient_entries, $entries, 2 * (strtotime ("+" . $concurrency) - strtotime ("now")));
67
- /**/
68
- if (get_transient ($transient_security_breach)) /* Has this restriction already been breached? */
69
- {
70
- c_ws_plugin__s2member_no_cache::no_cache_constants (true) . wp_clear_auth_cookie ();
71
- /**/
72
- do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
73
- /**/
74
- status_header (503); /* Sends a status header; temporarily unavailable. */
75
- /**/
76
- echo _x ('<strong>503: Service Temporarily Unavailable</strong><br />Too many IP addresses accessing one secure area<em>!</em><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
77
- /**/
78
- exit (); /* Clean exit. */
79
- }
80
- else if (count ($entries) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
81
- {
82
- c_ws_plugin__s2member_no_cache::no_cache_constants (true) . wp_clear_auth_cookie ();
83
- /**/
84
- set_transient ($transient_security_breach, 1, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
85
- /**/
86
- do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
87
- /**/
88
- status_header (503); /* Sends a status header; temporarily unavailable. */
89
- /**/
90
- echo _x ('<strong>503: Service Temporarily Unavailable</strong><br />Too many IP addresses accessing one secure area<em>!</em><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
91
- /**/
92
- exit (); /* Clean exit. */
93
- }
94
- else /* OK, this looks legitimate. Apply Filters here and return true. */
95
- {
96
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
97
- do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
98
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
99
- /**/
100
- return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
101
- }
102
- }
103
/**/
104
return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
105
}
@@ -117,10 +135,10 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
117
do_action ("ws_plugin__s2member_before_specific_ip_restriction_breached_security", get_defined_vars ());
118
/**/
119
$prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. */
120
- $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
121
- $associated_with_security_breach = (get_transient ($transient_security_breach)) ? true : false;
122
/**/
123
- return apply_filters ("ws_plugin__s2member_before_specific_ip_restriction_breached_security", $associated_with_security_breach, get_defined_vars ());
124
}
125
/**
126
* Resets/deletes specific IP Restrictions.
@@ -129,7 +147,9 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
129
* @since 3.5
130
*
131
* @param str $restriction Unique IP Restriction name/identifier. Such as a Username, or a unique access code.
132
- * @return null
133
*/
134
public static function delete_reset_specific_ip_restrictions ($restriction = FALSE)
135
{
@@ -138,15 +158,15 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
138
do_action ("ws_plugin__s2member_before_delete_reset_specific_ip_restrictions", get_defined_vars ());
139
/**/
140
$prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. */
141
- $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_entries");
142
- $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
143
/**/
144
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ($transient_entries)) . "'");
145
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ($transient_security_breach)) . "'");
146
/**/
147
do_action ("ws_plugin__s2member_after_delete_reset_specific_ip_restrictions", get_defined_vars ());
148
/**/
149
- return; /* Return for uniformity. */
150
}
151
/**
152
* Resets/deletes specific IP Restrictions via AJAX.
@@ -162,19 +182,24 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
162
{
163
do_action ("ws_plugin__s2member_before_delete_reset_specific_ip_restrictions_via_ajax", get_defined_vars ());
164
/**/
165
- if (current_user_can ("create_users")) /* Check priveledges as well. */
166
/**/
167
if (!empty ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax"]))
168
if (($nonce = $_POST["ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax"]))
169
if (wp_verify_nonce ($nonce, "ws-plugin--s2member-delete-reset-specific-ip-restrictions-via-ajax"))
170
/**/
171
if (!empty ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restriction"]))
172
- if (($restriction = trim (stripslashes ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restriction"]))))
173
- /**/
174
- if (c_ws_plugin__s2member_ip_restrictions::delete_reset_specific_ip_restrictions ($restriction) !== "nill")
175
- echo apply_filters ("ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax", 1, get_defined_vars ());
176
/**/
177
- exit (); /* Clean exit. */
178
}
179
/**
180
* Resets/deletes all IP Restrictions.
@@ -182,7 +207,9 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
182
* @package s2Member\IP_Restrictions
183
* @since 3.5
184
*
185
- * @return null
186
*/
187
public static function delete_reset_all_ip_restrictions ()
188
{
@@ -195,7 +222,7 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
195
/**/
196
do_action ("ws_plugin__s2member_after_delete_reset_all_ip_restrictions", get_defined_vars ());
197
/**/
198
- return; /* Return for uniformity. */
199
}
200
/**
201
* Resets/deletes all IP Restrictions via AJAX.
@@ -211,16 +238,20 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
211
{
212
do_action ("ws_plugin__s2member_before_delete_reset_all_ip_restrictions_via_ajax", get_defined_vars ());
213
/**/
214
- if (current_user_can ("create_users")) /* Check priveledges as well. */
215
/**/
216
if (!empty ($_POST["ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax"]))
217
if (($nonce = $_POST["ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax"]))
218
if (wp_verify_nonce ($nonce, "ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax"))
219
/**/
220
- if (c_ws_plugin__s2member_ip_restrictions::delete_reset_all_ip_restrictions () !== "nill")
221
- echo apply_filters ("ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax", 1, get_defined_vars ());
222
/**/
223
- exit (); /* Clean exit. */
224
}
225
}
226
}
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
21
{
30
/**
31
* Handles IP Restrictions.
32
*
33
+ * IP address details are stored as Transients.
34
*
35
* @package s2Member\IP_Restrictions
36
* @since 3.5
41
*/
42
public static function ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
43
{
44
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
45
do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
46
unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
/**/
48
+ if (!apply_filters ("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars ())
49
+ /* Also allow specific exclusions here. */ && !apply_filters ("ws_plugin__s2member_disable_specific_ip_restriction", false, get_defined_vars ())
50
+ /* And enabled by site owner? */ && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] /* And a valid ``$restriction``? */ && $restriction && is_string ($restriction)
51
+ /* Flag indicating that we ARE processing this IP Restriction. Useful in Hooks/Filters. */ && ($processing = true))
52
+ {
53
+ $msg_503 = _x ('<strong>503: Service Temporarily Unavailable</strong><br />Too many IP addresses accessing one secure area<em>!</em><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
54
+ /**/
55
+ $prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. Allows s2Member to find these easily. */
56
+ /**/
57
+ $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_entries");
58
+ $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
59
+ /**/
60
+ /* If you add Filters, use a string compatible with PHP's strtotime() function. */
61
+ $concurrency = apply_filters ("ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip", "30 days");
62
+ /**/
63
+ $entries = (is_array ($entries = get_transient ($transient_entries))) ? $entries : array ();
64
+ /**/
65
+ foreach ($entries as $_entry => $_time) /* Auto-expire entries, based on time. */
66
+ if ($_time < strtotime ("-" . $concurrency)) /* Based on time. */
67
+ unset($entries[$_entry]); /* Unset this entry value. */
68
+ /**/
69
+ $ip = ($ip && is_string ($ip)) ? $ip : "empty"; /* Allow empty IPs. */
70
+ $entries[$ip] = strtotime ("now"); /* Log entry. Add IP with entry time. */
71
+ set_transient ($transient_entries, $entries, 2 * (strtotime ("+" . $concurrency) - strtotime ("now")));
72
+ /**/
73
+ if (get_transient ($transient_security_breach)) /* Already breached security? */
74
+ {
75
+ c_ws_plugin__s2member_no_cache::no_cache_constants (true);
76
+ /**/
77
+ status_header(503); /* Send a 503 error status header; temporarily unavailable. */
78
+ wp_clear_auth_cookie (); /* Clear authorization cookies; we need to log them out now. */
79
+ header("Content-Type: text/html; charset=utf-8"); /* Content-Type text/html with UTF-8. */
80
+ eval('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist. */
81
+ /**/
82
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
83
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
84
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
85
+ /**/
86
+ exit($msg_503); /* Clean exit with 503 error message. */
87
+ }
88
+ /**/
89
+ else if (count ($entries) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
90
+ {
91
+ c_ws_plugin__s2member_no_cache::no_cache_constants (true);
92
+ /**/
93
+ set_transient /* A security breach has just occurred. We need to set this Transient now. */
94
+ ($transient_security_breach, 1, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
95
+ /**/
96
+ status_header(503); /* Send a 503 error status header; temporarily unavailable. */
97
+ wp_clear_auth_cookie (); /* Clear authorization cookies; we need to log them out now. */
98
+ header("Content-Type: text/html; charset=utf-8"); /* Content-Type text/html with UTF-8. */
99
+ eval('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist. */
100
+ /**/
101
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
102
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
103
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
104
+ /**/
105
+ exit($msg_503); /* Clean exit with 503 error message. */
106
+ }
107
+ /**/
108
+ else /* OK, this looks legitimate. Apply Filters here and return true. */
109
+ {
110
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
111
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
112
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
113
+ /**/
114
+ return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
115
+ }
116
+ }
117
+ /**/
118
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
119
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
120
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
121
/**/
122
return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
123
}
135
do_action ("ws_plugin__s2member_before_specific_ip_restriction_breached_security", get_defined_vars ());
136
/**/
137
$prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. */
138
+ $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . (string)$restriction . "_security_breach");
139
+ $breached_security = $associated_with_security_breach = (get_transient ($transient_security_breach)) ? true : false;
140
/**/
141
+ return apply_filters ("ws_plugin__s2member_before_specific_ip_restriction_breached_security", $breached_security, get_defined_vars ());
142
}
143
/**
144
* Resets/deletes specific IP Restrictions.
147
* @since 3.5
148
*
149
* @param str $restriction Unique IP Restriction name/identifier. Such as a Username, or a unique access code.
150
+ * @return bool Always returns a `true` value.
151
+ *
152
+ * @todo Make return value conditional, based on success.
153
*/
154
public static function delete_reset_specific_ip_restrictions ($restriction = FALSE)
155
{
158
do_action ("ws_plugin__s2member_before_delete_reset_specific_ip_restrictions", get_defined_vars ());
159
/**/
160
$prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. */
161
+ $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . (string)$restriction . "_entries");
162
+ $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . (string)$restriction . "_security_breach");
163
/**/
164
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ($transient_entries)) . "'");
165
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ($transient_security_breach)) . "'");
166
/**/
167
do_action ("ws_plugin__s2member_after_delete_reset_specific_ip_restrictions", get_defined_vars ());
168
/**/
169
+ return apply_filters ("ws_plugin__s2member_delete_reset_specific_ip_restrictions", true, get_defined_vars ());
170
}
171
/**
172
* Resets/deletes specific IP Restrictions via AJAX.
182
{
183
do_action ("ws_plugin__s2member_before_delete_reset_specific_ip_restrictions_via_ajax", get_defined_vars ());
184
/**/
185
+ status_header(200); /* Send a 200 OK status header. */
186
+ header("Content-Type: text/plain; charset=utf-8"); /* Content-Type with UTF-8. */
187
+ eval('while (@ob_end_clean ());'); /* End/clean all output buffers that may exist. */
188
+ /**/
189
+ if (current_user_can ("create_users")) /* Check priveledges. Ability to create Users? */
190
/**/
191
if (!empty ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax"]))
192
if (($nonce = $_POST["ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax"]))
193
if (wp_verify_nonce ($nonce, "ws-plugin--s2member-delete-reset-specific-ip-restrictions-via-ajax"))
194
/**/
195
if (!empty ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restriction"]))
196
+ if (is_string /* Must be a string here. */ ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restriction"]))
197
+ if (($restriction = trim (stripslashes ($_POST["ws_plugin__s2member_delete_reset_specific_ip_restriction"]))))
198
+ /**/
199
+ if (c_ws_plugin__s2member_ip_restrictions::delete_reset_specific_ip_restrictions ($restriction))
200
+ $success = true; /* Yes, this IP Restriction was deleted/reset. */
201
/**/
202
+ exit(apply_filters ("ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax", ((isset ($success) && $success) ? "1" : "0"), get_defined_vars ()));
203
}
204
/**
205
* Resets/deletes all IP Restrictions.
207