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

Version Description

Download this release

Release Info

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

Code changes from version 111017 to 111029

Files changed (34) hide show
  1. includes/classes/auto-eots.inc.php +2 -3
  2. includes/classes/constants.inc.php +38 -0
  3. includes/classes/files-in.inc.php +90 -68
  4. includes/classes/files.inc.php +96 -21
  5. includes/classes/login-customizations.inc.php +7 -7
  6. includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +8 -9
  7. includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +4 -5
  8. includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +0 -1
  9. includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +0 -1
  10. includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +0 -1
  11. includes/classes/profile-mods-4bp-in.inc.php +8 -8
  12. includes/classes/profile-mods-in.inc.php +2 -2
  13. includes/classes/querys.inc.php +12 -12
  14. includes/classes/ssl.inc.php +1 -1
  15. includes/classes/systematics-sp.inc.php +11 -11
  16. includes/classes/systematics.inc.php +10 -4
  17. includes/classes/utils-arrays.inc.php +17 -29
  18. includes/classes/utils-gets.inc.php +1 -1
  19. includes/classes/utils-users.inc.php +11 -11
  20. includes/functions/api-functions.inc.php +162 -4
  21. includes/hooks.inc.php +2 -2
  22. includes/menu-pages/menu-pages-min.js +1 -1
  23. includes/menu-pages/menu-pages-s-min.js +1 -1
  24. includes/menu-pages/menu-pages-s.js +4 -14
  25. includes/menu-pages/menu-pages.css +29 -16
  26. includes/menu-pages/menu-pages.js +9 -2
  27. includes/s2member-min.js +1 -1
  28. includes/s2member.css +2 -0
  29. includes/s2member.js +1 -1
  30. includes/syscon.inc.php +4 -4
  31. includes/templates/cfg-files/s2member-files.php +1 -1
  32. includes/translations/s2member.pot +115 -115
  33. readme.txt +25 -11
  34. s2member.php +6 -5
includes/classes/auto-eots.inc.php CHANGED
@@ -102,8 +102,8 @@ 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 ());
@@ -162,7 +162,6 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
162
delete_user_option ($user_id, "s2member_last_payment_time");
163
delete_user_option ($user_id, "s2member_auto_eot_time");
164
/**/
165
- delete_user_option ($user_id, "s2member_file_download_access_arc");
166
delete_user_option ($user_id, "s2member_file_download_access_log");
167
/**/
168
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
102
/**/
103
include_once ABSPATH . "wp-admin/includes/admin.php";
104
/**/
105
+ @set_time_limit (0); /* Make time for processing a larger userbase. */
106
+ @ini_set ("memory_limit", apply_filters ("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
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 ());
162
delete_user_option ($user_id, "s2member_last_payment_time");
163
delete_user_option ($user_id, "s2member_auto_eot_time");
164
/**/
165
delete_user_option ($user_id, "s2member_file_download_access_log");
166
/**/
167
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
includes/classes/constants.inc.php CHANGED
@@ -1035,6 +1035,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1035
*
1036
* @var int
1037
*
1038
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1039
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1040
*
@@ -1085,6 +1089,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1085
*
1086
* @var bool
1087
*
1088
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1089
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1090
*
@@ -1125,6 +1133,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1125
*
1126
* @var int
1127
*
1128
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1129
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1130
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
@@ -1165,6 +1179,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1165
*
1166
* @var int
1167
*
1168
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1169
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1170
*
@@ -1205,6 +1223,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1205
*
1206
* @var int
1207
*
1208
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1209
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1210
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
@@ -1375,6 +1397,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1375
*
1376
* @var str
1377
*
1378
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1379
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1380
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
@@ -1636,6 +1662,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1636
*
1637
* @var int
1638
*
1639
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1640
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1641
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
@@ -1685,6 +1715,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1685
*
1686
* @var int
1687
*
1688
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1689
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1690
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
@@ -1726,6 +1760,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1726
*
1727
* @var str
1728
*
1729
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1730
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1731
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1035
*
1036
* @var int
1037
*
1038
+ * @see s2Member\API_Functions\s2member_user_downloads()
1039
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1040
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1041
+ *
1042
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1043
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1044
*
1089
*
1090
* @var bool
1091
*
1092
+ * @see s2Member\API_Functions\s2member_user_downloads()
1093
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1094
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1095
+ *
1096
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1097
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1098
*
1133
*
1134
* @var int
1135
*
1136
+ * @note This does NOT include File Downloads accessed with an Advanced File Download Key.
1137
+ *
1138
+ * @see s2Member\API_Functions\s2member_user_downloads()
1139
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1140
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1141
+ *
1142
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1143
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1144
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1179
*
1180
* @var int
1181
*
1182
+ * @see s2Member\API_Functions\s2member_user_downloads()
1183
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1184
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1185
+ *
1186
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1187
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1188
*
1223
*
1224
* @var int
1225
*
1226
+ * @see s2Member\API_Functions\s2member_user_downloads()
1227
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1228
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1229
+ *
1230
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1231
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1232
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1397
*
1398
* @var str
1399
*
1400
+ * @see s2Member\API_Functions\s2member_user_downloads()
1401
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1402
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1403
+ *
1404
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1405
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1406
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1662
*
1663
* @var int
1664
*
1665
+ * @see s2Member\API_Functions\s2member_user_downloads()
1666
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1667
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1668
+ *
1669
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1670
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1671
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1715
*
1716
* @var int
1717
*
1718
+ * @see s2Member\API_Functions\s2member_user_downloads()
1719
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1720
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1721
+ *
1722
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1723
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1724
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1760
*
1761
* @var str
1762
*
1763
+ * @see s2Member\API_Functions\s2member_user_downloads()
1764
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1765
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1766
+ *
1767
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1768
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1769
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
includes/classes/files-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_files_in"))
21
{
@@ -43,7 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
43
*/
44
public static function check_file_download_access ($create_file_download_url = FALSE)
45
{
46
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
47
do_action ("ws_plugin__s2member_before_file_download_access", get_defined_vars ());
48
unset ($__refs, $__v); /* Unset defined __refs, __v. */
49
/**/
@@ -87,7 +87,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
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. */
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
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. */
@@ -117,7 +117,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
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. */
@@ -174,32 +174,50 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
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
{
@@ -209,15 +227,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
209
else /* Else return false. */
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
}
223
}
@@ -226,7 +237,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
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. */
@@ -259,14 +270,14 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
259
$mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream";
260
$length = (!$using_amazon_storage && $file) ? filesize ($file) : -1;
261
/**/
262
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
263
do_action ("ws_plugin__s2member_during_file_download_access", get_defined_vars ());
264
unset ($__refs, $__v); /* Unset defined __refs, __v. */
265
/**/
266
if ($using_amazon_s3_storage && ($serving || ($creating && $url_to_storage_source)))
267
{
268
if ($serving) /* We only need this section when/if we're actually serving. */
269
- wp_redirect(c_ws_plugin__s2member_files_in::amazon_s3_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit ();
270
/**/
271
else /* Else return File Download URL. */
272
return apply_filters ("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_s3_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars ());
@@ -275,7 +286,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
275
else if ($using_amazon_cf_storage && ($serving || ($creating && $url_to_storage_source)))
276
{
277
if ($serving) /* We only need this section when/if we're actually serving. */
278
- wp_redirect(c_ws_plugin__s2member_files_in::amazon_cf_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit ();
279
/**/
280
else /* Else return File Download URL. */
281
return apply_filters ("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_cf_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars ());
@@ -319,53 +330,64 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
319
/**/
320
else /* Else, ``if ($serving)`` , use local storage option (default). */
321
{
322
- @set_time_limit(0) . @ini_set ("zlib.output_compression", 0);
323
/**/
324
- status_header(200); /* 200 OK status header. */
325
/**/
326
- header("Accept-Ranges: none");
327
- header("Content-Encoding: none");
328
- header("Content-Type: " . $mimetype);
329
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
330
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
331
- header("Cache-Control: no-cache, must-revalidate, max-age=0");
332
header ("Cache-Control: post-check=0, pre-check=0", false);
333
- header("Pragma: no-cache");
334
/**/
335
- header('Content-Disposition: ' . (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"');
336
/**/
337
- eval('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist already. */
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 ());
342
- $_chunk_w_content_length = (stripos (PHP_OS, "win") === 0 && (!function_exists ("apache_get_version") || apache_get_version () === false)) ? false : true;
343
/**/
344
- /* Windows® IIS doesn't seem to like it when both `Content-Length` and `Transfer-Encoding: chunked` are sent together. */
345
- if (apply_filters ("ws_plugin__s2member_chunk_file_downloads_w_content_length", $_chunk_w_content_length, get_defined_vars ()))
346
- header("Content-Length: " . $length);
347
/**/
348
- header("Transfer-Encoding: chunked"); /* Uses `Transfer-Encoding: chunked` for simulated streaming. */
349
/**/
350
while (!feof ($resource) && ($chunk_size = strlen ($data = fread ($resource, $_chunk_size))))
351
- eval('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
352
/**/
353
- fclose($resource) . exit ("0\r\n\r\n");
354
}
355
else if ($length) /* Else, use: ``file_get_contents()``. */
356
{
357
- header("Content-Length: " . $length) . exit (file_get_contents ($file));
358
}
359
else /* Else, we have an empty file with no length. */
360
{
361
- header("Content-Length: 0") . exit ();
362
}
363
}
364
}
365
}
366
/**/
367
else if ($serving && $req["file_download"]) /* We only need this section when/if we're actually serving. */
368
- status_header(503) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
369
. exit (_x ('<strong>503: Access denied.</strong> Invalid File Download specs.', "s2member-front", "s2member"));
370
/**/
371
else if ($creating) /* We only need this section when/if we're creating a URL. */
@@ -390,7 +412,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
390
*/
391
public static function create_file_download_url ($config = FALSE, $get_streamer_array = FALSE)
392
{
393
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
394
do_action ("ws_plugin__s2member_before_create_file_download_url", get_defined_vars ()); /* Be VERY careful, if you use this Hook. */
395
unset ($__refs, $__v); /* Unset defined __refs, __v. */
396
/**/
@@ -404,7 +426,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
404
/**/
405
if (($_url = c_ws_plugin__s2member_files_in::check_file_download_access (($create_file_download_url = $config))) /* Successfully created a URL to the file? */)
406
{
407
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
408
do_action ("ws_plugin__s2member_during_create_file_download_url", get_defined_vars ()); /* Be VERY careful, if you use this Hook. */
409
unset ($__refs, $__v); /* Unset defined __refs, __v. */
410
/**/
@@ -412,10 +434,10 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
412
$streaming = (isset ($config["file_stream"])) ? filter_var ($config["file_stream"], FILTER_VALIDATE_BOOLEAN) : ((in_array ($extension, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_stream_extensions"]))) ? true : false);
413
$ssl = (isset ($config["file_ssl"])) ? filter_var ($config["file_ssl"], FILTER_VALIDATE_BOOLEAN) : ((is_ssl ()) ? true : false);
414
/**/
415
- if ($get_streamer_array && $streaming && ($cfx = "/cfx/st") && ($cfx_pos = strpos ($_url, $cfx)) !== false && ($streamer = substr ($_url, 0, $cfx_pos + strlen ($cfx))) && ($url = c_ws_plugin__s2member_files_in::check_file_download_access (array_merge ($config, array ("file_stream" => false, "check_user" => false)))))
416
$return = array ("streamer" => $streamer, "file" => preg_replace ("/^" . preg_quote ($streamer, "/") . "\//", "", $_url), "url" => preg_replace ("/^.+?\:/", (($ssl) ? "https:" : "http:"), $url));
417
/**/
418
- else if ($get_streamer_array && $streaming && is_array ($ups = c_ws_plugin__s2member_utils_urls::parse_url ($_url)) && isset ($ups["scheme"], $ups["host"]) && ($streamer = $ups["scheme"] . "://" . $ups["host"] . ((!empty ($ups["port"])) ? ":" . $ups["port"] : "")) && ($url = c_ws_plugin__s2member_files_in::check_file_download_access (array_merge ($config, array ("file_stream" => false, "check_user" => false)))))
419
$return = array ("streamer" => $streamer, "file" => preg_replace ("/^" . preg_quote ($streamer, "/") . "\//", "", $_url), "url" => preg_replace ("/^.+?\:/", (($ssl) ? "https:" : "http:"), $url));
420
/**/
421
else if ($get_streamer_array) /* Else, we MUST return false here, unable to acquire streamer/file. */
@@ -440,7 +462,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
440
*/
441
public static function check_file_remote_authorization ($user = FALSE)
442
{
443
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
444
do_action ("ws_plugin__s2member_before_check_file_remote_authorization", get_defined_vars ());
445
unset ($__refs, $__v); /* Unset defined __refs, __v. */
446
/**/
@@ -452,13 +474,13 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
452
/**/
453
if (empty ($_SERVER["PHP_AUTH_USER"]) || empty ($_SERVER["PHP_AUTH_PW"]) || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
454
{
455
- header('WWW-Authenticate: Basic realm="' . c_ws_plugin__s2member_utils_strings::esc_dq (strip_tags (_x ("Members Only", "s2member-front", "s2member"))) . '"');
456
/**/
457
- status_header(401); /* Send an unauthorized 401 status header now. */
458
- header("Content-Type: text/html; charset=utf-8"); /* Content-Type with UTF-8. */
459
- eval('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist. */
460
/**/
461
- exit(_x ('<strong>401:</strong> Sorry, access denied.', "s2member-front", "s2member"));
462
}
463
else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && !empty ($_user->ID))
464
$user = $_user; /* Now assign ``$user``. */
@@ -480,7 +502,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
480
*/
481
public static function check_file_download_key ($file = FALSE, $key = FALSE)
482
{
483
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
484
do_action ("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars ());
485
unset ($__refs, $__v); /* Unset defined __refs, __v. */
486
/**/
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_files_in"))
21
{
43
*/
44
public static function check_file_download_access ($create_file_download_url = FALSE)
45
{
46
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
47
do_action ("ws_plugin__s2member_before_file_download_access", get_defined_vars ());
48
unset ($__refs, $__v); /* Unset defined __refs, __v. */
49
/**/
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. */
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. */
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. */
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 = (is_array ($user_file_download_access_log = get_user_option ("s2member_file_download_access_log", $user_id))) ? $user_file_download_access_log : array ();
178
+ $user_file_download_access_arc = (is_array ($user_file_download_access_arc = get_user_option ("s2member_file_download_access_arc", $user_id))) ? $user_file_download_access_arc : array ();
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
foreach ($user_file_download_access_log as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry)
184
{
185
+ if ( /* Weed out corrupt/empty log entries. */isset ($user_file_download_access_log_entry["date"], $user_file_download_access_log_entry["file"]))
186
{
187
+ if (strtotime ($user_file_download_access_log_entry["date"]) < strtotime ("-" . $user_file_downloads["allowed_days"] . " days"))
188
+ {
189
+ unset ($user_file_download_access_log[$user_file_download_access_log_entry_key]); /* Remove it from the `log`. */
190
+ $user_file_download_access_arc[] = $user_file_download_access_log_entry; /* Move `log` entry to the `archive` now. */
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++; /* Previous files always count against this User/Member; it's already in the `log`. */
195
+ /**/
196
+ $_user_file_download_access_log_entry = &$user_file_download_access_log[$user_file_download_access_log_entry_key];
197
+ $_user_already_downloaded_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = false;
198
+ /**/
199
+ if ($user_file_download_access_log_entry["file"] === $req["file_download"]) /* Already downloaded this file? If yes, mark this flag as true. */
200
+ $user_already_downloaded_this_file = $_user_already_downloaded_this_file = true; /* Already downloaded this file? If yes, mark as true. */
201
+ /**/
202
+ else if (preg_replace ($streaming_variations, "", $user_file_download_access_log_entry["file"]) === preg_replace ($streaming_variations, "", $req["file_download"]))
203
+ $user_already_downloaded_this_file = $_user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = true;
204
+ /**/
205
+ if ( /* Updating counter? */$updating_user_counter && ($_user_already_downloaded_this_file || $_user_already_downloaded_a_streaming_variation_of_this_file))
206
+ {
207
+ $_user_file_download_access_log_entry /* First, we update the last download time for this file. */["ltime"] = time ();
208
+ /**/
209
+ if ( /* Backward compatiility here. Is this even set? */!empty ($user_file_download_access_log_entry["counter"]))
210
+ $_user_file_download_access_log_entry["counter"] = (int)$user_file_download_access_log_entry["counter"] + 1;
211
+ else /* Backward compatiility here. Default value to `1`, if this is NOT even set yet. */
212
+ $_user_file_download_access_log_entry["counter"] = 1 + 1;
213
+ }
214
+ }
215
}
216
+ else /* Weed out empty log entries. Some older versions of s2Member may have corrupt/empty log entries by mistake. */
217
+ unset ($user_file_download_access_log[$user_file_download_access_log_entry_key]); /* Remove from `log`. */
218
}
219
+ if ( /* Updating counter? */$updating_user_counter && /* Do we need a new log entry for this file? */ !$user_already_downloaded_this_file && !$user_already_downloaded_a_streaming_variation_of_this_file)
220
+ $user_file_download_access_log[] = array ("date" => date ("Y-m-d"), "time" => time (), "ltime" => time (), "file" => $req["file_download"], "counter" => 1);
221
/**/
222
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"])
223
{
227
else /* Else return false. */
228
return false;
229
}
230
+ else if /* Save/update counter? */ ($updating_user_counter) /* By default, we do NOT update the counter when a URL is simply being created for access. */
231
+ update_user_option ($user_id, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($user_file_download_access_log)) . update_user_option ($user_id, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($user_file_download_access_arc));
232
}
233
}
234
}
237
if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
238
{
239
if ($serving) /* We only need this section when/if we're actually serving. */
240
+ status_header (404) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
241
. exit (_x ('<strong>404: Sorry, file not found.</strong> Please contact Support for assistance.', "s2member-front", "s2member"));
242
/**/
243
else /* Else return false. */
270
$mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream";
271
$length = (!$using_amazon_storage && $file) ? filesize ($file) : -1;
272
/**/
273
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
274
do_action ("ws_plugin__s2member_during_file_download_access", get_defined_vars ());
275
unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
/**/
277
if ($using_amazon_s3_storage && ($serving || ($creating && $url_to_storage_source)))
278
{
279
if ($serving) /* We only need this section when/if we're actually serving. */
280
+ wp_redirect (c_ws_plugin__s2member_files_in::amazon_s3_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit ();
281
/**/
282
else /* Else return File Download URL. */
283
return apply_filters ("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_s3_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars ());
286
else if ($using_amazon_cf_storage && ($serving || ($creating && $url_to_storage_source)))
287
{
288
if ($serving) /* We only need this section when/if we're actually serving. */
289
+ wp_redirect (c_ws_plugin__s2member_files_in::amazon_cf_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit ();
290
/**/
291
else /* Else return File Download URL. */
292
return apply_filters ("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_cf_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars ());
330
/**/
331
else /* Else, ``if ($serving)`` , use local storage option (default). */
332
{
333
+ @set_time_limit (0) . @ini_set ("zlib.output_compression", 0);
334
/**/
335
+ status_header (200); /* 200 OK status header. */
336
/**/
337
+ header ("Accept-Ranges: none");
338
+ header ("Content-Encoding: none");
339
+ header ("Content-Type: " . $mimetype);
340
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
341
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
342
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
343
header ("Cache-Control: post-check=0, pre-check=0", false);
344
+ header ("Pragma: no-cache");
345
+ /**/
346
+ header ('Content-Disposition: ' . (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"');
347
/**/
348
+ eval ('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist already. Prep for content delivery. */
349
/**/
350
+ $_chunk_file = ($_SERVER["SERVER_PROTOCOL"] === "HTTP/1.1" && preg_match ("/apache/i", $_SERVER["SERVER_SOFTWARE"])) ? true : false;
351
/**/
352
+ if ($length && apply_filters ("ws_plugin__s2member_chunk_file_downloads", $_chunk_file, get_defined_vars ()) && is_resource ($resource = fopen ($file, "rb")))
353
{
354
$_chunk_size = apply_filters ("ws_plugin__s2member_chunk_file_downloads_w_chunk_size", 2097152, get_defined_vars ());
355
/**/
356
+ if (apply_filters ("ws_plugin__s2member_chunk_file_downloads_w_content_length", true, get_defined_vars ()))
357
+ header ("Content-Length: " . $length);
358
/**/
359
+ header ("Transfer-Encoding: chunked"); /* `Transfer-Encoding: chunked` conserves memory. */
360
/**/
361
while (!feof ($resource) && ($chunk_size = strlen ($data = fread ($resource, $_chunk_size))))
362
+ eval ('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
363
+ /**/
364
+ fclose ($resource) . exit ("0\r\n\r\n");
365
+ }
366
+ else if ($length && apply_filters ("ws_plugin__s2member_flush_file_downloads", true, get_defined_vars ()) && is_resource ($resource = fopen ($file, "rb")))
367
+ {
368
+ $_flush_size = apply_filters ("ws_plugin__s2member_flush_file_downloads_w_flush_size", 2097152, get_defined_vars ());
369
+ /**/
370
+ if (apply_filters ("ws_plugin__s2member_flush_file_downloads_w_content_length", true, get_defined_vars ()))
371
+ header ("Content-Length: " . $length);
372
/**/
373
+ while (!feof ($resource) && ($flush_size = strlen ($data = fread ($resource, $_flush_size))))
374
+ eval ('echo $data; @flush ();'); /* Conserves memory. */
375
}
376
else if ($length) /* Else, use: ``file_get_contents()``. */
377
{
378
+ @ini_set ("memory_limit", WP_MAX_MEMORY_LIMIT); /* RAM/memory. */
379
+ header ("Content-Length: " . $length) . exit (file_get_contents ($file));
380
}
381
else /* Else, we have an empty file with no length. */
382
{
383
+ header ("Content-Length: 0") . exit ();
384
}
385
}
386
}
387
}
388
/**/
389
else if ($serving && $req["file_download"]) /* We only need this section when/if we're actually serving. */
390
+ status_header (503) . header ("Content-Type: text/html; charset=utf-8") . eval ('while (@ob_end_clean ());') #
391
. exit (_x ('<strong>503: Access denied.</strong> Invalid File Download specs.', "s2member-front", "s2member"));
392
/**/
393
else if ($creating) /* We only need this section when/if we're creating a URL. */
412
*/
413
public static function create_file_download_url ($config = FALSE, $get_streamer_array = FALSE)
414
{
415
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
416
do_action ("ws_plugin__s2member_before_create_file_download_url", get_defined_vars ()); /* Be VERY careful, if you use this Hook. */
417
unset ($__refs, $__v); /* Unset defined __refs, __v. */
418
/**/
426
/**/
427
if (($_url = c_ws_plugin__s2member_files_in::check_file_download_access (($create_file_download_url = $config))) /* Successfully created a URL to the file? */)
428
{
429
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
430
do_action ("ws_plugin__s2member_during_create_file_download_url", get_defined_vars ()); /* Be VERY careful, if you use this Hook. */
431
unset ($__refs, $__v); /* Unset defined __refs, __v. */
432
/**/
434
$streaming = (isset ($config["file_stream"])) ? filter_var ($config["file_stream"], FILTER_VALIDATE_BOOLEAN) : ((in_array ($extension, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_stream_extensions"]))) ? true : false);
435
$ssl = (isset ($config["file_ssl"])) ? filter_var ($config["file_ssl"], FILTER_VALIDATE_BOOLEAN) : ((is_ssl ()) ? true : false);
436
/**/
437
+ if ($get_streamer_array && $streaming && ($cfx = "/cfx/st") && ($cfx_pos = strpos ($_url, $cfx)) !== false && ($streamer = substr ($_url, 0, $cfx_pos + strlen ($cfx))) && ($url = c_ws_plugin__s2member_files_in::check_file_download_access (array_merge ($config, array ("file_stream" => false, "check_user" => false, "count_against_user" => false)))))
438
$return = array ("streamer" => $streamer, "file" => preg_replace ("/^" . preg_quote ($streamer, "/") . "\//", "", $_url), "url" => preg_replace ("/^.+?\:/", (($ssl) ? "https:" : "http:"), $url));
439
/**/
440
+ else if ($get_streamer_array && $streaming && is_array ($ups = c_ws_plugin__s2member_utils_urls::parse_url ($_url)) && isset ($ups["scheme"], $ups["host"]) && ($streamer = $ups["scheme"] . "://" . $ups["host"] . ((!empty ($ups["port"])) ? ":" . $ups["port"] : "")) && ($url = c_ws_plugin__s2member_files_in::check_file_download_access (array_merge ($config, array ("file_stream" => false, "check_user" => false, "count_against_user" => false)))))
441
$return = array ("streamer" => $streamer, "file" => preg_replace ("/^" . preg_quote ($streamer, "/") . "\//", "", $_url), "url" => preg_replace ("/^.+?\:/", (($ssl) ? "https:" : "http:"), $url));
442
/**/
443
else if ($get_streamer_array) /* Else, we MUST return false here, unable to acquire streamer/file. */
462
*/
463
public static function check_file_remote_authorization ($user = FALSE)
464
{
465
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
466
do_action ("ws_plugin__s2member_before_check_file_remote_authorization", get_defined_vars ());
467
unset ($__refs, $__v); /* Unset defined __refs, __v. */
468
/**/
474
/**/
475
if (empty ($_SERVER["PHP_AUTH_USER"]) || empty ($_SERVER["PHP_AUTH_PW"]) || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
476
{
477
+ header ('WWW-Authenticate: Basic realm="' . c_ws_plugin__s2member_utils_strings::esc_dq (strip_tags (_x ("Members Only", "s2member-front", "s2member"))) . '"');
478
/**/
479
+ status_header (401); /* Send an unauthorized 401 status header now. */
480
+ header ("Content-Type: text/html; charset=utf-8"); /* Content-Type with UTF-8. */
481
+ eval ('while (@ob_end_clean ());'); /* End/clean any output buffers that may exist. */
482
/**/
483
+ exit (_x ('<strong>401:</strong> Sorry, access denied.', "s2member-front", "s2member"));
484
}
485
else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && !empty ($_user->ID))
486
$user = $_user; /* Now assign ``$user``. */
502
*/
503
public static function check_file_download_key ($file = FALSE, $key = FALSE)
504
{
505
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
506
do_action ("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars ());
507
unset ($__refs, $__v); /* Unset defined __refs, __v. */
508
/**/
includes/classes/files.inc.php CHANGED
@@ -100,9 +100,9 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
100
* @return int Number of days, where 0 means no access to files is allowed.
101
* Will not return a value > `365`, because this routine also controls the age of download logs to archives.
102
*
103
- * @todo Remove the limitation of `365` days somehow.
104
*/
105
- public static function max_download_period ()
106
{
107
do_action ("ws_plugin__s2member_before_max_download_period", get_defined_vars ());
108
/**/
@@ -122,7 +122,7 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
122
*
123
* @return bool|int False if no access is allowed, else Level number (int) 0+.
124
*/
125
- public static function min_level_4_downloads ()
126
{
127
do_action ("ws_plugin__s2member_before_min_level_4_downloads", get_defined_vars ());
128
/**/
@@ -179,18 +179,24 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
179
* @package s2Member\Files
180
* @since 3.5
181
*
182
- * @param obj $user Optional. Defaults to the current User's object.
183
- * @param str $not_counting_this_particular_file Optional. If you want to exclude a particular file.
184
- * @param array $log Optional. Prevents another database connection *( i.e. the log does not need to be pulled again )*.
185
- * @return array An array with three elements: `allowed`, `allowed_days`, `currently`.
186
*/
187
- public static function user_downloads ($user = FALSE, $not_counting_this_particular_file = FALSE, $log = NULL)
188
{
189
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
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
{
@@ -198,26 +204,95 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
198
{
199
if ($user->has_cap ("access_s2member_level" . $n)) /* Do they have access? */
200
{
201
- if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"]))
202
- if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"]))
203
- {
204
- $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"];
205
- $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"];
206
- }
207
if ($user->has_cap ("s2member_level" . $n)) /* We can stop now, if this is their Role. */
208
break; /* Break now. */
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
}
100
* @return int Number of days, where 0 means no access to files is allowed.
101
* Will not return a value > `365`, because this routine also controls the age of download logs to archives.
102
*
103
+ * @deprecated Deprecated in v111029. This function is no longer used by s2Member.
104
*/
105
+ public static function max_download_period /* No longer used by s2Member. */ ()
106
{
107
do_action ("ws_plugin__s2member_before_max_download_period", get_defined_vars ());
108
/**/
122
*
123
* @return bool|int False if no access is allowed, else Level number (int) 0+.
124
*/
125
+ public static function min_level_4_downloads () /* Multipurpose. False if no access. */
126
{
127
do_action ("ws_plugin__s2member_before_min_level_4_downloads", get_defined_vars ());
128
/**/
179
* @package s2Member\Files
180
* @since 3.5
181
*
182
+ * @param obj $user Optional. A `WP_User` object. Defaults to the current User's object.
183
+ * @param str $not_counting_this_particular_file Optional. If you want to exclude a particular file,
184
+ * relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *( when applicable )*.
185
+ * @param array $user_log Optional. Prevents another database connection *( i.e. the User's log does not need to be pulled again )*.
186
+ * @param array $user_arc Optional. Prevents another database connection *( i.e. the User's archive does not need to be pulled again )*.
187
+ * @return array An array with the following elements... File Downloads allowed for this User: (int)`allowed`, Download Period for this User in days: (int)`allowed_days`, Files downloaded by this User in the current Period: (int)`currently`, log of all Files downloaded in the current Period, with file names/dates: (array)`log`, archive of all Files downloaded in prior Periods, with file names/dates: (array)`archive`.
188
+ *
189
+ * @note Calculations returned by this function do NOT include File Downloads that were accessed with an Advanced File Download Key.
190
+ * @todo Make it possible for s2Member to keep a count of files downloaded with an Advanced Download Key.
191
*/
192
+ public static function user_downloads ($user = FALSE, $not_counting_this_particular_file = FALSE, $user_log = FALSE, $user_arc = FALSE)
193
{
194
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
195
do_action ("ws_plugin__s2member_before_user_downloads", get_defined_vars ());
196
unset ($__refs, $__v); /* Unset defined __refs, __v. */
197
/**/
198
+ $allowed = $allowed_days = $currently = 0; /* Initialize these to zero. */
199
+ $log = $arc = array (); /* Initialize these to a default empty array value. */
200
/**/
201
if ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty ($user->ID) && ($user_id = $user->ID))
202
{
204
{
205
if ($user->has_cap ("access_s2member_level" . $n)) /* Do they have access? */
206
{
207
+ if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"]))
208
+ {
209
+ $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"];
210
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"];
211
+ }
212
if ($user->has_cap ("s2member_level" . $n)) /* We can stop now, if this is their Role. */
213
break; /* Break now. */
214
}
215
}
216
+ $log = (is_array ($user_log)) ? $user_log : ((is_array ($log = get_user_option ("s2member_file_download_access_log", $user_id)) && $log !== array (false)) ? $log : array ());
217
+ $arc = (is_array ($user_arc)) ? $user_arc : ((is_array ($arc = get_user_option ("s2member_file_download_access_arc", $user_id)) && $arc !== array (false)) ? $arc : array ());
218
/**/
219
+ foreach (($user_file_download_access_log = $log) as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry)
220
+ if (isset ($user_file_download_access_log_entry["date"]) && strtotime ($user_file_download_access_log_entry["date"]) >= strtotime ("-" . $allowed_days . " days"))
221
+ if (isset ($user_file_download_access_log_entry["file"]) && $user_file_download_access_log_entry["file"] !== $not_counting_this_particular_file)
222
$currently = $currently + 1;
223
}
224
/**/
225
+ return apply_filters ("ws_plugin__s2member_user_downloads", array ("allowed" => $allowed, "allowed_days" => $allowed_days, "currently" => $currently, "log" => $log, "archive" => $arc), get_defined_vars ());
226
+ }
227
+ /**
228
+ * Total downloads of a particular file; possibly by a particular User.
229
+ *
230
+ * @package s2Member\Files
231
+ * @since 111026
232
+ *
233
+ * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *( when applicable )*.
234
+ * @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *( i.e among all Users/Members )*.
235
+ * @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
236
+ * @return int The total for this particular ``$file``, based on configuration of function arguments.
237
+ *
238
+ * @note Calculations returned by this function do NOT include File Downloads that were accessed with an Advanced File Download Key.
239
+ * @todo Make it possible for s2Member to keep a count of files downloaded with an Advanced Download Key.
240
+ */
241
+ public static function total_downloads_of ($file = FALSE, $user_id = FALSE, $check_archives_too = TRUE)
242
+ {
243
+ global $wpdb; /* Global database object reference. */
244
+ /**/
245
+ if ($file && is_string ($file)) /* Was ``$file`` passed in properly? */
246
+ {
247
+ if (is_array ($results = $wpdb->get_results ("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE " . ((is_numeric ($user_id)) ? "`user_id` = '" . esc_sql ($user_id) . "' AND " : "") . "(`meta_key` = '" . $wpdb->prefix . "s2member_file_download_access_log'" . (($check_archives_too) ? " OR `meta_key` = '" . $wpdb->prefix . "s2member_file_download_access_arc'" : "") . ") AND `meta_value` REGEXP '.*\"file\";s:[0-9]+:\"" . esc_sql ($file) . "\".*'")))
248
+ {
249
+ foreach ($results as $r /* Go through the entire array of results found in the `REGEXP` database query above. */)
250
+ if (is_array ($la_entries = /* Unserialize the array. */ maybe_unserialize ($r->meta_value)) && !empty ($la_entries))
251
+ /**/
252
+ foreach ($la_entries as $la_entry /* Go through all of the entries in each result ``$r``; collecting `counter` values. */)
253
+ if (!empty ($la_entry["file"]) && $la_entry["file"] === $file && /* Back compatibility. Is `counter` even set? */ (!empty ($la_entry["counter"]) || ($la_entry["counter"] = 1)))
254
+ {
255
+ $total = (!empty ($total)) ? $total + (int)$la_entry["counter"] : (int)$la_entry["counter"];
256
+ break; /* Break now. No need to continue looping; ``$file`` found in these entries. */
257
+ }
258
+ }
259
+ }
260
+ return (!empty ($total)) ? $total : /* Else return zero by default. */ 0;
261
+ }
262
+ /**
263
+ * Total unique downloads of a particular file; possibly by a particular User.
264
+ *
265
+ * @package s2Member\Files
266
+ * @since 111026
267
+ *
268
+ * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *( when applicable )*.
269
+ * @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *( i.e among all Users/Members )*.
270
+ * @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
271
+ * @return int The total for this particular ``$file``, based on configuration of function arguments.
272
+ *
273
+ * @note Calculations returned by this function do NOT include File Downloads that were accessed with an Advanced File Download Key.
274
+ * @todo Make it possible for s2Member to keep a count of files downloaded with an Advanced Download Key.
275
+ */
276
+ public static function total_unique_downloads_of ($file = FALSE, $user_id = FALSE, $check_archives_too = TRUE)
277
+ {
278
+ global $wpdb; /* Global database object reference. */
279
+ /**/
280
+ if ($file && is_string ($file)) /* Was ``$file`` passed in properly? */
281
+ {
282
+ if (is_array ($results = $wpdb->get_results ("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE " . ((is_numeric ($user_id)) ? "`user_id` = '" . esc_sql ($user_id) . "' AND " : "") . "(`meta_key` = '" . $wpdb->prefix . "s2member_file_download_access_log'" . (($check_archives_too) ? " OR `meta_key` = '" . $wpdb->prefix . "s2member_file_download_access_arc'" : "") . ") AND `meta_value` REGEXP '.*\"file\";s:[0-9]+:\"" . esc_sql ($file) . "\".*'")))
283
+ {
284
+ foreach ($results as $r /* Go through the entire array of results found in the `REGEXP` database query above. */)
285
+ if (is_array ($la_entries = /* Unserialize the array. */ maybe_unserialize ($r->meta_value)) && !empty ($la_entries))
286
+ /**/
287
+ foreach ($la_entries as $la_entry /* Go through all of the entries in each result ``$r``; collecting `counter` values. */)
288
+ if (!empty ($la_entry["file"]) && $la_entry["file"] === $file && /* Back compatibility. Is `counter` even set? */ (!empty ($la_entry["counter"]) || ($la_entry["counter"] = 1)))
289
+ {
290
+ $total = (!empty ($total)) ? /* Only count `1` here ( i.e. unique downloads ). */ $total + 1 : 1;
291
+ break; /* Break now. No need to continue looping; ``$file`` found in these entries. */
292
+ }
293
+ }
294
+ }
295
+ return (!empty ($total)) ? $total : /* Else return zero by default. */ 0;
296
}
297
}
298
}
includes/classes/login-customizations.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_login_customizations"))
21
{
@@ -80,7 +80,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
80
$s = ""; /* Initialize styles string here to give Hooks a chance. */
81
$a = array (); /* Initialize here to give Filters a chance. */
82
/**/
83
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
84
do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
85
unset ($__refs, $__v); /* Unset defined __refs, __v. */
86
/**/
@@ -106,7 +106,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
106
$a[] = 'div#login p#backtoblog, div#login p#backtoblog a, div#login p#backtoblog a:hover, div#login p#backtoblog a:active, div#login p#backtoblog a:focus { color:#' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . $i . '; text-shadow:1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . $i . '; }';
107
/**/
108
$a[] = 'div#login form p { margin:2px 0 16px 0' . $i . '; }'; /* Handles paragraph margins inside the form. */
109
- $a[] = 'div#login form input[type="text"], div#login form input[type="password"], div#login form textarea, div#login form select { font-weight:normal' . $i . '; color:#333333' . $i . '; background:none repeat scroll 0 0 #FBFBFB' . $i . '; border:1px solid #E5E5E5' . $i . '; font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; margin:0' . $i . '; padding:3px' . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; width:100%' . $i . '; width:98%' . $i . ' !ie<8; margin-right:2%' . $i . ' !ie<8; box-sizing:border-box' . $i . '; -ms-box-sizing:border-box' . $i . '; -moz-box-sizing:border-box' . $i . '; -webkit-box-sizing:border-box' . $i . '; }';
110
$a[] = 'div#login form select { width:99.5%' . $i . ' !ie<8; } div#login form select > option { font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; }';
111
$a[] = 'div#login form label { cursor:pointer' . $i . '; } div#login form label.ws-plugin--s2member-custom-reg-field-op-l { opacity:0.7' . $i . '; font-size:90%' . $i . '; vertical-align:middle' . $i . '; }';
112
$a[] = 'div#login form input[type="checkbox"], div#login form input[type="radio"] { margin:0 3px 0 0' . $i . '; vertical-align:middle' . $i . '; }';
@@ -118,8 +118,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
118
$a[] = 'div#login form p.submit { margin-bottom:0' . $i . '; }';
119
$a[] = 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color:#666666' . $i . '; text-shadow:2px 2px 5px #EEEEEE' . $i . '; border:1px solid #999999' . $i . '; background:#FBFBFB' . $i . '; padding:5px' . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; }';
120
$a[] = 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color:#000000' . $i . '; text-shadow:2px 2px 5px #CCCCCC' . $i . '; border-color:#000000' . $i . '; }';
121
- $a[] = 'div#login form#registerform { padding-bottom:16px' . $i . '; } div#login form#registerform p.submit { float:none' . $i . '; margin-top:-10px' . $i . '; } div#login form#registerform input[type="submit"] { width:100%' . $i . '; }';
122
- $a[] = 'div#login form#lostpasswordform { padding-bottom:16px' . $i . '; } div#login form#lostpasswordform p.submit { float:none' . $i . '; } div#login form#lostpasswordform input[type="submit"] { width:100%' . $i . '; }';
123
/**/
124
$a[] = 'div.ws-plugin--s2member-password-strength { margin-top:3px' . $i . '; font-color:#000000' . $i . '; background-color:#EEEEEE' . $i . '; padding:3px' . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; } div.ws-plugin--s2member-password-strength-short { background-color:#FFA0A0' . $i . '; } div.ws-plugin--s2member-password-strength-bad { background-color:#FFB78C' . $i . '; } div.ws-plugin--s2member-password-strength-good { background-color:#FFEC8B' . $i . '; } div.ws-plugin--s2member-password-strength-strong { background-color:#C3FF88' . $i . '; } div.ws-plugin--s2member-password-strength-mismatch { background-color:#D6C1AB' . $i . '; }';
125
/**/
@@ -131,7 +131,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
131
$a = apply_filters ("ws_plugin__s2member_login_header_styles_array_before_close", $a, get_defined_vars ());
132
$a[] = '</style>'; /* Now close style tag. There are other Filters below. */
133
/**/
134
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
135
do_action ("ws_plugin__s2member_during_login_header_styles", get_defined_vars ());
136
unset ($__refs, $__v); /* Unset defined __refs, __v. */
137
/**/
@@ -166,7 +166,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
166
}
167
else /* Otherwise, safe to allow PHP code. */
168
{
169
- eval ("?>" . $code);
170
}
171
/**/
172
do_action ("ws_plugin__s2member_after_login_footer_design", get_defined_vars ());
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
21
{
80
$s = ""; /* Initialize styles string here to give Hooks a chance. */
81
$a = array (); /* Initialize here to give Filters a chance. */
82
/**/
83
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
84
do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
85
unset ($__refs, $__v); /* Unset defined __refs, __v. */
86
/**/
106
$a[] = 'div#login p#backtoblog, div#login p#backtoblog a, div#login p#backtoblog a:hover, div#login p#backtoblog a:active, div#login p#backtoblog a:focus { color:#' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . $i . '; text-shadow:1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . $i . '; }';
107
/**/
108
$a[] = 'div#login form p { margin:2px 0 16px 0' . $i . '; }'; /* Handles paragraph margins inside the form. */
109
+ $a[] = 'div#login form input[type="text"], div#login form input[type="email"], div#login form input[type="password"], div#login form textarea, div#login form select { font-weight:normal' . $i . '; color:#333333' . $i . '; background:none repeat scroll 0 0 #FBFBFB' . $i . '; border:1px solid #E5E5E5' . $i . '; font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; margin:0' . $i . '; padding:3px' . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; width:100%' . $i . '; width:98%' . $i . ' !ie<8; margin-right:2%' . $i . ' !ie<8; box-sizing:border-box' . $i . '; -ms-box-sizing:border-box' . $i . '; -moz-box-sizing:border-box' . $i . '; -webkit-box-sizing:border-box' . $i . '; }';
110
$a[] = 'div#login form select { width:99.5%' . $i . ' !ie<8; } div#login form select > option { font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; }';
111
$a[] = 'div#login form label { cursor:pointer' . $i . '; } div#login form label.ws-plugin--s2member-custom-reg-field-op-l { opacity:0.7' . $i . '; font-size:90%' . $i . '; vertical-align:middle' . $i . '; }';
112
$a[] = 'div#login form input[type="checkbox"], div#login form input[type="radio"] { margin:0 3px 0 0' . $i . '; vertical-align:middle' . $i . '; }';
118
$a[] = 'div#login form p.submit { margin-bottom:0' . $i . '; }';
119
$a[] = 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color:#666666' . $i . '; text-shadow:2px 2px 5px #EEEEEE' . $i . '; border:1px solid #999999' . $i . '; background:#FBFBFB' . $i . '; padding:5px' . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; }';
120
$a[] = 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color:#000000' . $i . '; text-shadow:2px 2px 5px #CCCCCC' . $i . '; border-color:#000000' . $i . '; }';
121
+ $a[] = 'div#login form#registerform { padding-bottom:16px' . $i . '; } div#login form#registerform p.submit { float:none' . $i . '; margin-top:-10px' . $i . '; } div#login form#registerform input[type="submit"] { float:none' . $i . '; width:100%' . $i . '; width:98%' . $i . ' !ie<8; margin-right:2%' . $i . ' !ie<8; box-sizing:border-box' . $i . '; -ms-box-sizing:border-box' . $i . '; -moz-box-sizing:border-box' . $i . '; -webkit-box-sizing:border-box' . $i . '; }';
122
+ $a[] = 'div#login form#lostpasswordform { padding-bottom:16px' . $i . '; } div#login form#lostpasswordform p.submit { float:none' . $i . '; } div#login form#lostpasswordform input[type="submit"] { float:none' . $i . '; width:100%' . $i . '; width:98%' . $i . ' !ie<8; margin-right:2%' . $i . ' !ie<8; box-sizing:border-box' . $i . '; -ms-box-sizing:border-box' . $i . '; -moz-box-sizing:border-box' . $i . '; -webkit-box-sizing:border-box' . $i . '; }';
123
/**/
124
$a[] = 'div.ws-plugin--s2member-password-strength { margin-top:3px' . $i . '; font-color:#000000' . $i . '; background-color:#EEEEEE' . $i . '; padding:3px' . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; } div.ws-plugin--s2member-password-strength-short { background-color:#FFA0A0' . $i . '; } div.ws-plugin--s2member-password-strength-bad { background-color:#FFB78C' . $i . '; } div.ws-plugin--s2member-password-strength-good { background-color:#FFEC8B' . $i . '; } div.ws-plugin--s2member-password-strength-strong { background-color:#C3FF88' . $i . '; } div.ws-plugin--s2member-password-strength-mismatch { background-color:#D6C1AB' . $i . '; }';
125
/**/
131
$a = apply_filters ("ws_plugin__s2member_login_header_styles_array_before_close", $a, get_defined_vars ());
132
$a[] = '</style>'; /* Now close style tag. There are other Filters below. */
133
/**/
134
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
135
do_action ("ws_plugin__s2member_during_login_header_styles", get_defined_vars ());
136
unset ($__refs, $__v); /* Unset defined __refs, __v. */
137
/**/
166
}
167
else /* Otherwise, safe to allow PHP code. */
168
{
169
+ eval("?>" . $code);
170
}
171
/**/
172
do_action ("ws_plugin__s2member_after_login_footer_design", get_defined_vars ());
includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php CHANGED
@@ -15,7 +15,7 @@
15
* @since 110720
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level"))
21
{
@@ -40,13 +40,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
40
*/
41
public static function cp ($vars = array ()) /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
42
{
43
- extract ($vars); /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
44
/**/
45
if (/**/(!empty ($paypal["txn_type"]) && preg_match ("/^subscr_modify#x2F;i", $paypal["txn_type"]))/**/
46
&& (!empty ($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))/**/
47
&& (!empty ($paypal["subscr_id"])) && (!empty ($paypal["payer_email"]))/**/)
48
{
49
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
50
do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
51
unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
/**/
@@ -68,7 +68,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
68
$paypal["regular_term"] = $paypal["period3"]; /* This is just set to keep a standard; this way both initial_term & regular_term are available. */
69
$paypal["recurring"] = ($paypal["recurring"]) ? $paypal["mc_amount3"] : "0"; /* If non-recurring, this should be zero, otherwise Regular. */
70
/**/
71
- eval ('$ipn_signup_vars = $paypal; unset($ipn_signup_vars["s2member_log"]);'); /* Create array of IPN signup vars w/o s2member_log. */
72
/**/
73
if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
74
{
@@ -76,7 +76,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
76
{
77
$processing = $modifying = $during = true; /* Yes, we ARE processing this. */
78
/**/
79
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
80
do_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", get_defined_vars ());
81
do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", "modification", "s2member_level" . $paypal["level"]);
82
unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -87,7 +87,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
87
/**/
88
if (is_multisite () && !is_user_member_of_blog ($user_id)) /* Must have a Role on this Blog. */
89
{
90
- add_existing_user_to_blog (array ("user_id" => $user_id, "role" => "s2member_level" . $paypal["level"]));
91
$user = new WP_User ($user_id);
92
}
93
/**/
@@ -115,7 +115,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
115
/**/
116
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
117
/**/
118
- delete_user_option ($user_id, "s2member_file_download_access_arc");
119
delete_user_option ($user_id, "s2member_file_download_access_log");
120
/**/
121
delete_user_option ($user_id, "s2member_auto_eot_time");
@@ -265,7 +264,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
265
}
266
}
267
/**/
268
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
269
do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
270
unset ($__refs, $__v); /* Unset defined __refs, __v. */
271
}
@@ -282,7 +281,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
282
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
283
}
284
/**/
285
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
286
do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
287
unset ($__refs, $__v); /* Unset defined __refs, __v. */
288
/**/
15
* @since 110720
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level"))
21
{
40
*/
41
public static function cp ($vars = array ()) /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
42
{
43
+ extract($vars); /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
44
/**/
45
if (/**/(!empty ($paypal["txn_type"]) && preg_match ("/^subscr_modify#x2F;i", $paypal["txn_type"]))/**/
46
&& (!empty ($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))/**/
47
&& (!empty ($paypal["subscr_id"])) && (!empty ($paypal["payer_email"]))/**/)
48
{
49
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
50
do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
51
unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
/**/
68
$paypal["regular_term"] = $paypal["period3"]; /* This is just set to keep a standard; this way both initial_term & regular_term are available. */
69
$paypal["recurring"] = ($paypal["recurring"]) ? $paypal["mc_amount3"] : "0"; /* If non-recurring, this should be zero, otherwise Regular. */
70
/**/
71
+ eval('$ipn_signup_vars = $paypal; unset($ipn_signup_vars["s2member_log"]);'); /* Create array of IPN signup vars w/o s2member_log. */
72
/**/
73
if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
74
{
76
{
77
$processing = $modifying = $during = true; /* Yes, we ARE processing this. */
78
/**/
79
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
80
do_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", get_defined_vars ());
81
do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", "modification", "s2member_level" . $paypal["level"]);
82
unset ($__refs, $__v); /* Unset defined __refs, __v. */
87
/**/
88
if (is_multisite () && !is_user_member_of_blog ($user_id)) /* Must have a Role on this Blog. */
89
{
90
+ add_existing_user_to_blog(array ("user_id" => $user_id, "role" => "s2member_level" . $paypal["level"]));
91
$user = new WP_User ($user_id);
92
}
93
/**/
115
/**/
116
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
117
/**/
118
delete_user_option ($user_id, "s2member_file_download_access_log");
119
/**/
120
delete_user_option ($user_id, "s2member_auto_eot_time");
264
}
265
}
266
/**/
267
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
268
do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
269
unset ($__refs, $__v); /* Unset defined __refs, __v. */
270
}
281
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
282
}
283
/**/
284
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
285
do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
286
unset ($__refs, $__v); /* Unset defined __refs, __v. */
287
/**/
includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php CHANGED
@@ -49,9 +49,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_l
49
&& (!empty ($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)) || (!empty ($paypal["parent_txn_id"]) && ($paypal["subscr_id"] = $paypal["parent_txn_id"]))) /* Or `parent_txn_id`? */
50
&& (!empty ($paypal["period1"]) || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal, false)) || empty ($recurring) || ($paypal["period1"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("period1", false, $paypal["subscr_id"])) || ($paypal["period1"] = "0 D"))/**/
51
&& (!empty ($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal, false)) || empty ($recurring) || ($paypal["period3"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("period3", false, $paypal["subscr_id"])) || ($paypal["period3"] = "1 D"))/**/
52
- && ((!empty ($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))/**/
53
- && (!empty ($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))/**/
54
- && (!empty ($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))/**/)
55
{
56
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
57
do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
@@ -78,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_l
78
$paypal["ip"] = (preg_match ("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"]) ? $paypal["option_selection2"] : "";
79
$paypal["ip"] = (!$paypal["ip"] && preg_match ("/^[a-z0-9]+~[0-9\.]+#x2F;i", $paypal["invoice"])) ? preg_replace ("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
80
/**/
81
- if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
82
{
83
$fields = get_user_option ("s2member_custom_fields", $user_id); /* These will be needed below. */
84
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); /* Needed below. */
@@ -130,7 +130,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_l
130
delete_user_option ($user_id, "s2member_last_payment_time");
131
delete_user_option ($user_id, "s2member_auto_eot_time");
132
/**/
133
- delete_user_option ($user_id, "s2member_file_download_access_arc");
134
delete_user_option ($user_id, "s2member_file_download_access_log");
135
/**/
136
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
49
&& (!empty ($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)) || (!empty ($paypal["parent_txn_id"]) && ($paypal["subscr_id"] = $paypal["parent_txn_id"]))) /* Or `parent_txn_id`? */
50
&& (!empty ($paypal["period1"]) || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal, false)) || empty ($recurring) || ($paypal["period1"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("period1", false, $paypal["subscr_id"])) || ($paypal["period1"] = "0 D"))/**/
51
&& (!empty ($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal, false)) || empty ($recurring) || ($paypal["period3"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("period3", false, $paypal["subscr_id"])) || ($paypal["period3"] = "1 D"))/**/
52
+ && ((!empty ($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)) || ($paypal["item_number"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("item_number", false, $paypal["subscr_id"]))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))/**/
53
+ && (!empty ($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("item_name", false, $paypal["subscr_id"])) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))/**/
54
+ && (!empty ($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var ("payer_email", false, $paypal["subscr_id"])) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))/**/)
55
{
56
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
57
do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
78
$paypal["ip"] = (preg_match ("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"]) ? $paypal["option_selection2"] : "";
79
$paypal["ip"] = (!$paypal["ip"] && preg_match ("/^[a-z0-9]+~[0-9\.]+#x2F;i", $paypal["invoice"])) ? preg_replace ("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
80
/**/
81
+ if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && !empty ($user->ID))
82
{
83
$fields = get_user_option ("s2member_custom_fields", $user_id); /* These will be needed below. */
84
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); /* Needed below. */
130
delete_user_option ($user_id, "s2member_last_payment_time");
131
delete_user_option ($user_id, "s2member_auto_eot_time");
132
/**/
133
delete_user_option ($user_id, "s2member_file_download_access_log");
134
/**/
135
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php CHANGED
@@ -136,7 +136,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
136
/**/
137
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
138
/**/
139
- delete_user_option ($user_id, "s2member_file_download_access_arc");
140
delete_user_option ($user_id, "s2member_file_download_access_log");
141
/**/
142
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["eotper"])
136
/**/
137
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
138
/**/
139
delete_user_option ($user_id, "s2member_file_download_access_log");
140
/**/
141
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["eotper"])
includes/classes/paypal-return-in-subscr-modify-w-level.inc.php CHANGED
@@ -113,7 +113,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level
113
if (!get_user_option ("s2member_registration_ip", $user_id))
114
update_user_option ($user_id, "s2member_registration_ip", $paypal["ip"]);
115
/**/
116
- delete_user_option ($user_id, "s2member_file_download_access_arc");
117
delete_user_option ($user_id, "s2member_file_download_access_log");
118
/**/
119
delete_user_option ($user_id, "s2member_auto_eot_time");
113
if (!get_user_option ("s2member_registration_ip", $user_id))
114
update_user_option ($user_id, "s2member_registration_ip", $paypal["ip"]);
115
/**/
116
delete_user_option ($user_id, "s2member_file_download_access_log");
117
/**/
118
delete_user_option ($user_id, "s2member_auto_eot_time");
includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php CHANGED
@@ -151,7 +151,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"
151
if (!get_user_option ("s2member_registration_ip", $user_id))
152
update_user_option ($user_id, "s2member_registration_ip", $paypal["ip"]);
153
/**/
154
- delete_user_option ($user_id, "s2member_file_download_access_arc");
155
delete_user_option ($user_id, "s2member_file_download_access_log");
156
/**/
157
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["eotper"])
151
if (!get_user_option ("s2member_registration_ip", $user_id))
152
update_user_option ($user_id, "s2member_registration_ip", $paypal["ip"]);
153
/**/
154
delete_user_option ($user_id, "s2member_file_download_access_log");
155
/**/
156
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["eotper"])
includes/classes/profile-mods-4bp-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_profile_mods_4bp_in"))
21
{
@@ -51,7 +51,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_4bp_in"))
51
{
52
$GLOBALS["ws_plugin__s2member_profile_4bp_saved"] = true; /* Global flag as having been saved/updated successfully. */
53
/**/
54
- $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
55
/**/
56
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
57
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
@@ -68,24 +68,24 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_4bp_in"))
68
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
69
$fields[$field_var] = $_existing_fields[$field_var];
70
else /* Else ``unset()``. */
71
- unset ($fields[$field_var]);
72
}
73
else if ($field["required"] === "yes" && (!isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) || (!is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])) || (is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && empty ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])) || (is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !strlen ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))))
74
{
75
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
76
$fields[$field_var] = $_existing_fields[$field_var];
77
else /* Else ``unset()``. */
78
- unset ($fields[$field_var]);
79
}
80
else if (isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))
81
{
82
if ((is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !empty ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])) || (is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && strlen ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])))
83
$fields[$field_var] = $_p["ws_plugin__s2member_profile_4bp_" . $field_var];
84
else /* Else ``unset()``. */
85
- unset ($fields[$field_var]);
86
}
87
else /* Else ``unset()``. */
88
- unset ($fields[$field_var]);
89
}
90
/**/
91
if (!empty ($fields))
@@ -94,11 +94,11 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_4bp_in"))
94
delete_user_option ($user_id, "s2member_custom_fields");
95
}
96
/**/
97
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
98
do_action ("ws_plugin__s2member_during_handle_profile_modifications_4bp", get_defined_vars ());
99
unset ($__refs, $__v); /* Unset defined __refs, __v. */
100
/**/
101
- $user = new WP_User ($user_id); /* Update the WP_User object for the current User/Member. */
102
(function_exists ("setup_userdata")) ? setup_userdata () : null; /* Update global vars. */
103
}
104
}
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_profile_mods_4bp_in"))
21
{
51
{
52
$GLOBALS["ws_plugin__s2member_profile_4bp_saved"] = true; /* Global flag as having been saved/updated successfully. */
53
/**/
54
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean ``$_POST`` vars. */
55
/**/
56
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
57
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
68
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
69
$fields[$field_var] = $_existing_fields[$field_var];
70
else /* Else ``unset()``. */
71
+ unset($fields[$field_var]);
72
}
73
else if ($field["required"] === "yes" && (!isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) || (!is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])) || (is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && empty ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])) || (is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !strlen ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))))
74
{
75
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
76
$fields[$field_var] = $_existing_fields[$field_var];
77
else /* Else ``unset()``. */
78
+ unset($fields[$field_var]);
79
}
80
else if (isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))
81
{
82
if ((is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !empty ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])) || (is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && strlen ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])))
83
$fields[$field_var] = $_p["ws_plugin__s2member_profile_4bp_" . $field_var];
84
else /* Else ``unset()``. */
85
+ unset($fields[$field_var]);
86
}
87
else /* Else ``unset()``. */
88
+ unset($fields[$field_var]);
89
}
90
/**/
91
if (!empty ($fields))
94
delete_user_option ($user_id, "s2member_custom_fields");
95
}
96
/**/
97
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
98
do_action ("ws_plugin__s2member_during_handle_profile_modifications_4bp", get_defined_vars ());
99
unset ($__refs, $__v); /* Unset defined __refs, __v. */
100
/**/
101
+ $user = new WP_User ($user_id); /* Update the ``WP_User`` object for the current User/Member. */
102
(function_exists ("setup_userdata")) ? setup_userdata () : null; /* Update global vars. */
103
}
104
}
includes/classes/profile-mods-in.inc.php CHANGED
@@ -52,7 +52,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
52
{
53
$GLOBALS["ws_plugin__s2member_profile_saved"] = true; /* Global flag as having been saved/updated successfully. */
54
/**/
55
- $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
56
/**/
57
$userdata["ID"] = $user_id; /* Needed for database update. */
58
/**/
@@ -121,7 +121,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
121
do_action ("ws_plugin__s2member_during_handle_profile_modifications", get_defined_vars ());
122
unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
/**/
124
- $user = new WP_User ($user_id); /* Update the WP_User object for the current User/Member. */
125
(function_exists ("setup_userdata")) ? setup_userdata () : null; /* Update global vars. */
126
/**/
127
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
52
{
53
$GLOBALS["ws_plugin__s2member_profile_saved"] = true; /* Global flag as having been saved/updated successfully. */
54
/**/
55
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean ``$_POST`` vars. */
56
/**/
57
$userdata["ID"] = $user_id; /* Needed for database update. */
58
/**/
121
do_action ("ws_plugin__s2member_during_handle_profile_modifications", get_defined_vars ());
122
unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
/**/
124
+ $user = new WP_User ($user_id); /* Update the ``WP_User`` object for the current User/Member. */
125
(function_exists ("setup_userdata")) ? setup_userdata () : null; /* Update global vars. */
126
/**/
127
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
includes/classes/querys.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_querys"))
21
{
@@ -35,7 +35,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
35
*
36
* @var null|obj
37
*/
38
- static $current_wp_query;
39
/**
40
* Forces query Filters *( on-demand )*.
41
*
@@ -52,13 +52,13 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
52
*/
53
public static function force_query_level_access (&$wp_query = FALSE)
54
{
55
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
56
do_action ("ws_plugin__s2member_before_force_query_level_access", get_defined_vars ());
57
unset ($__refs, $__v); /* Unset defined __refs, __v. */
58
/**/
59
c_ws_plugin__s2member_querys::query_level_access ($wp_query, true);
60
/**/
61
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
62
do_action ("ws_plugin__s2member_after_force_query_level_access", get_defined_vars ());
63
unset ($__refs, $__v); /* Unset defined __refs, __v. */
64
/**/
@@ -86,7 +86,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
86
static $initial_query = true; /* Tracks initial query. */
87
c_ws_plugin__s2member_querys::$current_wp_query = &$wp_query;
88
/**/
89
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
90
do_action ("ws_plugin__s2member_before_query_level_access", get_defined_vars ());
91
unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
/**/
@@ -214,14 +214,14 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
214
}
215
}
216
/**/
217
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
218
do_action ("ws_plugin__s2member_during_query_level_access", get_defined_vars ());
219
unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
}
221
}
222
}
223
/**/
224
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
225
do_action ("ws_plugin__s2member_after_query_level_access", get_defined_vars ());
226
unset ($__refs, $__v); /* Unset defined __refs, __v. */
227
/**/
@@ -245,7 +245,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
245
{
246
global $wpdb; /* Global database object reference. */
247
/**/
248
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
249
do_action ("_ws_plugin__s2member_before_query_level_access_sys", get_defined_vars ());
250
unset ($__refs, $__v); /* Unset defined __refs, __v. */
251
/**/
@@ -257,12 +257,12 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
257
$wp_query->set ("post__in", array_unique (array_diff ((array)$wp_query->get ("post__in"), $s)));
258
$wp_query->set ("post__not_in", array_unique (array_merge ((array)$wp_query->get ("post__not_in"), $s)));
259
/**/
260
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
261
do_action ("_ws_plugin__s2member_during_query_level_access_sys", get_defined_vars ());
262
unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
}
264
/**/
265
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
266
do_action ("_ws_plugin__s2member_after_query_level_access_sys", get_defined_vars ());
267
unset ($__refs, $__v); /* Unset defined __refs, __v. */
268
/**/
@@ -296,9 +296,9 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
296
{
297
foreach ($items as $child_item_key => $child_item)
298
if (!empty ($child_item->menu_item_parent) && (int)$child_item->menu_item_parent === (int)$item->ID)
299
- unset ($items[$child_item_key]);
300
/**/
301
- unset ($items[$item_key]);
302
}
303
}
304
/**/
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_querys"))
21
{
35
*
36
* @var null|obj
37
*/
38
+ public static $current_wp_query;
39
/**
40
* Forces query Filters *( on-demand )*.
41
*
52
*/
53
public static function force_query_level_access (&$wp_query = FALSE)
54
{
55
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
56
do_action ("ws_plugin__s2member_before_force_query_level_access", get_defined_vars ());
57
unset ($__refs, $__v); /* Unset defined __refs, __v. */
58
/**/
59
c_ws_plugin__s2member_querys::query_level_access ($wp_query, true);
60
/**/
61
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
62
do_action ("ws_plugin__s2member_after_force_query_level_access", get_defined_vars ());
63
unset ($__refs, $__v); /* Unset defined __refs, __v. */
64
/**/
86
static $initial_query = true; /* Tracks initial query. */
87
c_ws_plugin__s2member_querys::$current_wp_query = &$wp_query;
88
/**/
89
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
90
do_action ("ws_plugin__s2member_before_query_level_access", get_defined_vars ());
91
unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
/**/
214
}
215
}
216
/**/
217
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
218
do_action ("ws_plugin__s2member_during_query_level_access", get_defined_vars ());
219
unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
}
221
}
222
}
223
/**/
224
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
225
do_action ("ws_plugin__s2member_after_query_level_access", get_defined_vars ());
226
unset ($__refs, $__v); /* Unset defined __refs, __v. */
227
/**/
245
{
246
global $wpdb; /* Global database object reference. */
247
/**/
248
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
249
do_action ("_ws_plugin__s2member_before_query_level_access_sys", get_defined_vars ());
250
unset ($__refs, $__v); /* Unset defined __refs, __v. */
251
/**/
257
$wp_query->set ("post__in", array_unique (array_diff ((array)$wp_query->get ("post__in"), $s)));
258
$wp_query->set ("post__not_in", array_unique (array_merge ((array)$wp_query->get ("post__not_in"), $s)));
259
/**/
260
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
261
do_action ("_ws_plugin__s2member_during_query_level_access_sys", get_defined_vars ());
262
unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
}
264
/**/
265
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
266
do_action ("_ws_plugin__s2member_after_query_level_access_sys", get_defined_vars ());
267
unset ($__refs, $__v); /* Unset defined __refs, __v. */
268
/**/
296
{
297
foreach ($items as $child_item_key => $child_item)
298
if (!empty ($child_item->menu_item_parent) && (int)$child_item->menu_item_parent === (int)$item->ID)
299
+ unset($items[$child_item_key]);
300
/**/
301
+ unset($items[$item_key]);
302
}
303
}
304
/**/
includes/classes/ssl.inc.php CHANGED
@@ -50,7 +50,7 @@ if (!class_exists ("c_ws_plugin__s2member_ssl"))
50
do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
51
/**/
52
if (!$forced) /* Only force SSL here once. We definitely do NOT need to run this particular routine more than ONE time. */
53
- if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Exclude all WordPress® Systematics. */
54
{
55
$s2_ssl_gv = apply_filters ("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", get_defined_vars ());
56
$_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|off|false)#x2F;i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
50
do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
51
/**/
52
if (!$forced) /* Only force SSL here once. We definitely do NOT need to run this particular routine more than ONE time. */
53
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page () /* NOT on WordPress® Systematics. */)
54
{
55
$s2_ssl_gv = apply_filters ("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", get_defined_vars ());
56
$_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|off|false)#x2F;i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
includes/classes/systematics-sp.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_systematics_sp"))
21
{
@@ -42,6 +42,8 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
42
*/
43
public static function is_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
44
{
45
$singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
46
$uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
47
/**/
@@ -69,6 +71,14 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
69
{
70
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
71
}
72
else /* Otherwise, we return false ( i.e. it's NOT a Systematic area ). */
73
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
74
}
@@ -84,8 +94,6 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
84
*/
85
public static function is_wp_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
86
{
87
- global $bp; /* If BuddyPress is installed, we'll need this global reference. */
88
- /**/
89
$singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
90
$uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
91
/**/
@@ -97,14 +105,6 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
97
{
98
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
99
}
100
- else if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(" . preg_quote (trim (((function_exists ("bp_get_signup_slug")) ? bp_get_signup_slug () : BP_REGISTER_SLUG), "/"), "/") . "|" . preg_quote (trim (((function_exists ("bp_get_activate_slug")) ? bp_get_activate_slug () : BP_ACTIVATION_SLUG), "/"), "/") . ")(\/|$)/", $uri))
101
- {
102
- return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
103
- }
104
- else if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty ($bp->pages->register->id) && $singular_id === (int)$bp->pages->register->id) || (!empty ($bp->pages->activate->id) && $singular_id === (int)$bp->pages->activate->id)))
105
- {
106
- return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
107
- }
108
else /* Otherwise, we return false ( i.e. it's NOT a WordPress® Systematic area ). */
109
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", false, get_defined_vars ()));
110
}
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_systematics_sp"))
21
{
42
*/
43
public static function is_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
44
{
45
+ global $bp; /* If BuddyPress is installed, we'll need this global reference. */
46
+ /**/
47
$singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
48
$uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
49
/**/
71
{
72
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
73
}
74
+ else if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(" . preg_quote (trim (((function_exists ("bp_get_signup_slug")) ? bp_get_signup_slug () : BP_REGISTER_SLUG), "/"), "/") . "|" . preg_quote (trim (((function_exists ("bp_get_activate_slug")) ? bp_get_activate_slug () : BP_ACTIVATION_SLUG), "/"), "/") . ")(\/|$)/", $uri))
75
+ {
76
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
77
+ }
78
+ else if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty ($bp->pages->register->id) && $singular_id === (int)$bp->pages->register->id) || (!empty ($bp->pages->activate->id) && $singular_id === (int)$bp->pages->activate->id)))
79
+ {
80
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
81
+ }
82
else /* Otherwise, we return false ( i.e. it's NOT a Systematic area ). */
83
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
84
}
94
*/
95
public static function is_wp_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
96
{
97
$singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
98
$uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
99
/**/
105
{
106
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
107
}
108
else /* Otherwise, we return false ( i.e. it's NOT a WordPress® Systematic area ). */
109
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", false, get_defined_vars ()));
110
}
includes/classes/systematics.inc.php CHANGED
@@ -34,6 +34,9 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
34
* @since 3.5
35
*
36
* @return bool True if Systematic, else false.
37
*/
38
public static function is_systematic_use_page ()
39
{
@@ -67,6 +70,10 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
67
{
68
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
69
}
70
else /* Otherwise, we return false ( it's NOT Systematic ). */
71
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
72
}
@@ -77,6 +84,9 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
77
* @since 111002
78
*
79
* @return bool True if WordPress® Systematic, else false.
80
*/
81
public static function is_wp_systematic_use_page ()
82
{
@@ -110,10 +120,6 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
110
{
111
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
112
}
113
- else if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ()))
114
- {
115
- return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
116
- }
117
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && stripos ($_SERVER["HTTP_HOST"], "localhost") === false && strpos ($_SERVER["HTTP_HOST"], "127.0.0.1") === false && (!defined ("LOCALHOST") || !LOCALHOST))
118
{
119
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
34
* @since 3.5
35
*
36
* @return bool True if Systematic, else false.
37
+ *
38
+ * @note The results of this function are cached staticially.
39
+ * Do NOT call upon this until the `wp` Hook is fired.
40
*/
41
public static function is_systematic_use_page ()
42
{
70
{
71
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
72
}
73
+ else if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ()))
74
+ {
75
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
76
+ }
77
else /* Otherwise, we return false ( it's NOT Systematic ). */
78
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
79
}
84
* @since 111002
85
*
86
* @return bool True if WordPress® Systematic, else false.
87
+ *
88
+ * @note The results of this function are cached staticially.
89
+ * Do NOT call upon this until the `wp` Hook is fired.
90
*/
91
public static function is_wp_systematic_use_page ()
92
{
120
{
121
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
122
}
123
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && stripos ($_SERVER["HTTP_HOST"], "localhost") === false && strpos ($_SERVER["HTTP_HOST"], "127.0.0.1") === false && (!defined ("LOCALHOST") || !LOCALHOST))
124
{
125
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
includes/classes/utils-arrays.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_utils_arrays"))
21
{
@@ -38,26 +38,17 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
38
*/
39
public static function array_unique ($array = FALSE)
40
{
41
- if (!is_array ($array))
42
- {
43
- return array ($array);
44
- }
45
- else /* Serialized array_unique. */
46
- {
47
- foreach ($array as &$value)
48
- {
49
- $value = serialize ($value);
50
- }
51
- /**/
52
- $array = array_unique ($array);
53
- /**/
54
- foreach ($array as &$value)
55
- {
56
- $value = unserialize ($value);
57
- }
58
- /**/
59
- return $array;
60
- }
61
}
62
/**
63
* Searches an array *( or even a multi-dimensional array )* using a regular expression match against array values.
@@ -137,16 +128,13 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
137
{
138
if (is_array ($array) && !empty ($array))
139
{
140
- foreach ($array as $key => $value)
141
{
142
- if (is_array ($value)) /* Recursive function call. */
143
- {
144
- $array[$key] = c_ws_plugin__s2member_utils_arrays::remove_null_keys ($value);
145
- }
146
else if (is_null ($value)) /* Is it null? */
147
- {
148
- unset($array[$key]);
149
- }
150
}
151
/**/
152
return $array;
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
/**/
20
if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
21
{
38
*/
39
public static function array_unique ($array = FALSE)
40
{
41
+ $array = (array)$array;
42
+ /**/
43
+ foreach ($array as &$value)
44
+ $value = serialize ($value);
45
+ /**/
46
+ $array = array_unique ($array);
47
+ /**/
48
+ foreach ($array as &$value)
49
+ $value = unserialize ($value);
50
+ /**/
51
+ return $array;
52
}
53
/**
54
* Searches an array *( or even a multi-dimensional array )* using a regular expression match against array values.
128
{
129
if (is_array ($array) && !empty ($array))
130
{
131
+ foreach ($array as $key => &$value)
132
{
133
+ if (is_array ($value)) /* Recursive function call here. */
134
+ $value = c_ws_plugin__s2member_utils_arrays::remove_null_keys ($value);
135
+ /**/
136
else if (is_null ($value)) /* Is it null? */
137
+ unset ($array[$key]);
138
}
139
/**/
140
return $array;
includes/classes/utils-gets.inc.php CHANGED
@@ -156,7 +156,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
156
{
157
foreach ($results as $result) /* Now we need to check Custom Capabilities against $user. */
158
{
159
- if (!is_object ($user) || !$user->ID) /* No ``$user``, not logged-in?. */
160
$singular_ids[] = $result->post_id; /* No way to satisfy. */
161
/**/
162
else if (is_array ($ccaps = @unserialize ($result->meta_value)))
156
{
157
foreach ($results as $result) /* Now we need to check Custom Capabilities against $user. */
158
{
159
+ if (!is_object ($user) || empty ($user->ID)) /* No ``$user``, not logged-in?. */
160
$singular_ids[] = $result->post_id; /* No way to satisfy. */
161
/**/
162
else if (is_array ($ccaps = @unserialize ($result->meta_value)))
includes/classes/utils-users.inc.php CHANGED
@@ -65,7 +65,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
65
{
66
global $wpdb; /* Need global DB obj. */
67
/**/
68
- if ($subscr_or_txn_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
69
{
70
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND (`meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
71
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
97
{
98
global $wpdb; /* Need global DB obj. */
99
/**/
100
- if ($subscr_or_txn_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
101
{
102
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND (`meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
103
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
@@ -127,17 +127,17 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
127
{
128
global $wpdb; /* Need global DB obj. */
129
/**/
130
- if ($subscr_or_txn_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
131
{
132
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND (`meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
133
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
134
- if (is_object ($user = new WP_User ($q->user_id)) && $user->ID && ($email = $user->user_email))
135
return $email;
136
}
137
else if ($subscr_or_txn_id) /* Otherwise, if all we have is a Subscr./Txn. ID value. */
138
{
139
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND `meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' LIMIT 1")))
140
- if (is_object ($user = new WP_User ($q->user_id)) && $user->ID && ($email = $user->user_email))
141
return $email;
142
}
143
/**/
@@ -159,7 +159,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
159
*/
160
public static function get_user_ipn_signup_vars ($user_id = FALSE, $subscr_id = FALSE)
161
{
162
- if ($user_id || ($subscr_id && ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($subscr_id))) || (!$user_id && !$subscr_id && is_object ($user = wp_get_current_user ()) && ($user_id = $user->ID)))
163
{
164
if (($_subscr_id = get_user_option ("s2member_subscr_id", $user_id)) && (!$subscr_id || $subscr_id === $_subscr_id) && ($subscr_id = $_subscr_id))
165
if (is_array ($ipn_signup_vars = get_user_option ("s2member_ipn_signup_vars", $user_id)))
@@ -209,9 +209,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
209
*/
210
public static function get_user_subscr_or_wp_id ($user = FALSE)
211
{
212
- if ((func_num_args () && (!is_object ($user) || !$user->ID)) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !$user->ID)))
213
{
214
- return false; /* The $user was passed in but is NOT an object; or nobody is logged in. */
215
}
216
else /* Else return Paid Subscr. ID ( if available ), otherwise return their WP database User ID. */
217
return ($subscr_id = get_user_option ("s2member_subscr_id", $user->ID)) ? $subscr_id : $user->ID;
@@ -288,7 +288,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
288
* Or, this could be set to any property that exists on the WP_User object for a particular User;
289
* ( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
290
* `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
291
- * `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_log`,
292
* `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
293
* `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
294
* `s2member_access_ccaps`, etc, etc. ).
@@ -301,7 +301,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
301
/**/
302
$current_user = wp_get_current_user (); /* Current User's object ( used when/if `$user_id` is empty ). */
303
/**/
304
- if (is_object ($user = ($user_id) ? new WP_User ($user_id) : $current_user) && ($user_id = $user->ID))
305
{
306
if (isset ($user->$field_id)) /* Immediate User object property? ( most likely ) */
307
return $user->$field_id;
@@ -336,7 +336,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
336
else if (strcasecmp ($field_id, "s2member_access_ccaps") === 0) /* Custom Caps? */
337
return c_ws_plugin__s2member_user_access::user_access_ccaps ($user);
338
/**/
339
- else if (strcasecmp ($field_id, "ip") === 0 && is_object ($current_user) && $current_user->ID === $user_id)
340
return $_SERVER["REMOTE_ADDR"]; /* The current User's IP address, right now. */
341
/**/
342
else if (strcasecmp ($field_id, "s2member_registration_ip") === 0 || strcasecmp ($field_id, "reg_ip") === 0 || strcasecmp ($field_id, "ip") === 0)
65
{
66
global $wpdb; /* Need global DB obj. */
67
/**/
68
+ if ($subscr_or_txn_id && $os0) /* This case includes some additional routines that can use the ``$os0`` value. */
69
{
70
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND (`meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
71
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
97
{
98
global $wpdb; /* Need global DB obj. */
99
/**/
100
+ if ($subscr_or_txn_id && $os0) /* This case includes some additional routines that can use the ``$os0`` value. */
101
{
102
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND (`meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
103
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
127
{
128
global $wpdb; /* Need global DB obj. */
129
/**/
130
+ if ($subscr_or_txn_id && $os0) /* This case includes some additional routines that can use the ``$os0`` value. */
131
{
132
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND (`meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
133
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
134
+ if (is_object ($user = new WP_User ($q->user_id)) && !empty ($user->ID) && ($email = $user->user_email))
135
return $email;
136
}
137
else if ($subscr_or_txn_id) /* Otherwise, if all we have is a Subscr./Txn. ID value. */
138
{
139
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' OR `meta_key` = '" . $wpdb->prefix . "s2member_first_payment_txn_id') AND `meta_value` = '" . $wpdb->escape ($subscr_or_txn_id) . "' LIMIT 1")))
140
+ if (is_object ($user = new WP_User ($q->user_id)) && !empty ($user->ID) && ($email = $user->user_email))
141
return $email;
142
}
143
/**/
159
*/
160
public static function get_user_ipn_signup_vars ($user_id = FALSE, $subscr_id = FALSE)
161
{
162
+ if ($user_id || ($subscr_id && ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($subscr_id))) || (!$user_id && !$subscr_id && is_object ($user = wp_get_current_user ()) && !empty ($user->ID) && ($user_id = $user->ID)))
163
{
164
if (($_subscr_id = get_user_option ("s2member_subscr_id", $user_id)) && (!$subscr_id || $subscr_id === $_subscr_id) && ($subscr_id = $_subscr_id))
165
if (is_array ($ipn_signup_vars = get_user_option ("s2member_ipn_signup_vars", $user_id)))
209
*/
210
public static function get_user_subscr_or_wp_id ($user = FALSE)
211
{
212
+ if ((func_num_args () && (!is_object ($user) || empty ($user->ID))) || (!func_num_args () && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty ($user->ID))))
213
{
214
+ return false; /* The ``$user`` was passed in but is NOT an object; or nobody is logged in. */
215
}
216
else /* Else return Paid Subscr. ID ( if available ), otherwise return their WP database User ID. */
217
return ($subscr_id = get_user_option ("s2member_subscr_id", $user->ID)) ? $subscr_id : $user->ID;
288
* Or, this could be set to any property that exists on the WP_User object for a particular User;
289
* ( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
290
* `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
291
+ * `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
292
* `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
293
* `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
294
* `s2member_access_ccaps`, etc, etc. ).
301
/**/
302
$current_user = wp_get_current_user (); /* Current User's object ( used when/if `$user_id` is empty ). */
303
/**/
304
+ if (is_object ($user = ($user_id) ? new WP_User ($user_id) : $current_user) && !empty ($user->ID) && ($user_id = $user->ID))
305
{
306
if (isset ($user->$field_id)) /* Immediate User object property? ( most likely ) */
307
return $user->$field_id;
336
else if (strcasecmp ($field_id, "s2member_access_ccaps") === 0) /* Custom Caps? */
337
return c_ws_plugin__s2member_user_access::user_access_ccaps ($user);
338
/**/
339
+ else if (strcasecmp ($field_id, "ip") === 0 && is_object ($current_user) && !empty ($current_user->ID) && $current_user->ID === ($user_id = $user->ID))
340
return $_SERVER["REMOTE_ADDR"]; /* The current User's IP address, right now. */
341
/**/
342
else if (strcasecmp ($field_id, "s2member_registration_ip") === 0 || strcasecmp ($field_id, "reg_ip") === 0 || strcasecmp ($field_id, "ip") === 0)
includes/functions/api-functions.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
* Conditional to determine if the current User is NOT logged in.
21
*
@@ -1972,6 +1972,162 @@ if (!function_exists ("s2member_file_download_key"))
1972
}
1973
}
1974
/**
1975
* Obtains the Registration Time for the current User, and/or for a particular User.
1976
*
1977
* The Registration Time, is the time at which the Username was created for the account, that's it.
@@ -2091,7 +2247,8 @@ if (!function_exists ("s2member_paid_registration_time"))
2091
* $s2member_subscr_gateway = get_user_field ("s2member_subscr_gateway"); # Paid Subscr. Gateway Code for the current User.
2092
* $s2member_registration_ip = get_user_field ("s2member_registration_ip"); # IP the current User had during registration.
2093
* $s2member_custom_fields = get_user_field ("s2member_custom_fields"); # Associative array of all Custom Registration/Profile Fields.
2094
- * $s2member_file_download_access_log = get_user_field ("s2member_file_download_access_log"); # Associative array of all File Downloads by the current User.
2095
* $s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time"); # Auto EOT-Time for the current User ( when applicable ).
2096
* $s2member_last_payment_time = get_user_field ("s2member_last_payment_time"); # Timestamp. Last time an actual payment was received by s2Member.
2097
* $s2member_paid_registration_times = get_user_field ("s2member_paid_registration_times"); # Timestamps. Associative array of all Paid Registration Times.
@@ -2172,7 +2329,8 @@ if (!function_exists ("s2member_paid_registration_time"))
2172
* $s2member_subscr_gateway = get_user_option ("s2member_subscr_gateway"); # Paid Subscr. Gateway Code for the current User.
2173
* $s2member_registration_ip = get_user_option ("s2member_registration_ip"); # IP the current User had during registration.
2174
* $s2member_custom_fields = get_user_option ("s2member_custom_fields"); # Associative array of all Custom Registration/Profile Fields.
2175
- * $s2member_file_download_access_log = get_user_option ("s2member_file_download_access_log"); # Associative array of all File Downloads by the current User.
2176
* $s2member_auto_eot_time = get_user_option ("s2member_auto_eot_time"); # Auto EOT-Time for the current User ( when applicable ).
2177
* $s2member_last_payment_time = get_user_option ("s2member_last_payment_time"); # Timestamp. Last time an actual payment was received by s2Member.
2178
* $s2member_paid_registration_times = get_user_option ("s2member_paid_registration_times"); # Timestamps. Associative array of all Paid Registration Times.
@@ -2195,7 +2353,7 @@ if (!function_exists ("s2member_paid_registration_time"))
2195
* Or, this could be set to any property that exists on the WP_User object for a particular User;
2196
* ( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
2197
* `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
2198
- * `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_log`,
2199
* `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
2200
* `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
2201
* `s2member_access_ccaps`, `s2member_login_counter`, etc, etc. ).
15
* @since 3.5
16
*/
17
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
/**
20
* Conditional to determine if the current User is NOT logged in.
21
*
1972
}
1973
}
1974
/**
1975
+ * Retrieves an array of details, related to a User's File Downloads.
1976
+ *
1977
+ * ———— PHP Code Samples ————
1978
+ * ```
1979
+ * <!php
1980
+ * $user_downloads = s2member_user_downloads();
1981
+ * $specific_user_downloads = s2member_user_downloads(($user_id = 123));
1982
+ * !>
1983
+ * ```
1984
+ * ———— Shortcode Equivalent ————
1985
+ * ```
1986
+ * There is NO Shortcode equivalent for this yet.
1987
+ * ```
1988
+ *
1989
+ * @package s2Member\API_Functions
1990
+ * @since 111026
1991
+ *
1992
+ * @param str|int $user_id Optional. Defaults to the currently logged-in User's ID.
1993
+ * @param str $not_counting_this_particular_file Optional. If you want to exclude a particular file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *( when applicable )*.
1994
+ * @return array An array with the following elements... File Downloads allowed for this User: (int)`allowed`, Download Period for this User in days: (int)`allowed_days`, Files downloaded by this User in the current Period: (int)`currently`, log of all Files downloaded in the current Period, with file names/dates: (array)`log`, archive of all Files downloaded in prior Periods, with file names/dates: (array)`archive`.
1995
+ *
1996
+ * @note Calculations returned by this function do NOT include File Downloads that were accessed with an Advanced File Download Key.
1997
+ *
1998
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
1999
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
2000
+ *
2001
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
2002
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
2003
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
2004
+ *
2005
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
2006
+ *
2007
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
2008
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
2009
+ *
2010
+ * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
2011
+ * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
2012
+ *
2013
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
2014
+ *
2015
+ * @todo Make it possible for s2Member to keep a count of files downloaded with an Advanced Download Key.
2016
+ * @todo Create a Shortcode equivalent.
2017
+ */
2018
+ if (!function_exists ("s2member_user_downloads"))
2019
+ {
2020
+ function s2member_user_downloads ($user_id = FALSE, $not_counting_this_particular_file = FALSE)
2021
+ {
2022
+ $user = ($user_id && is_object ($user = new WP_User ((int)$user_id)) && !empty ($user->ID)) ? $user : false;
2023
+ return c_ws_plugin__s2member_files::user_downloads ($user, $not_counting_this_particular_file);
2024
+ }
2025
+ }
2026
+ /**
2027
+ * Total downloads of a particular file; possibly by a particular User.
2028
+ *
2029
+ * ———— PHP Code Samples ————
2030
+ * ```
2031
+ * File: `example-file.zip`, has been downloaded a total of <!php echo s2member_total_downloads_of("example-file.zip"); !> times; collectively, among all Users/Members, for all time *( includes all duplicate downloads of the same file by the same User/Member )*.
2032
+ * File: `example-file.zip`, has been downloaded a total of <!php echo s2member_total_downloads_of("example-file.zip", false, false); !> times; collectively, among all Users/Members, in this Period only *( includes all duplicate downloads of the same file by the same User/Member )*.
2033
+ * File: `example-file.zip`, has been downloaded by User ID# 123, a total of <!php echo s2member_total_downloads_of("example-file.zip", 123); !> times; for all time, since they first became a User/Member of the site *( includes all duplicate downloads of the same file by this User/Member )*.
2034
+ * File: `example-file.zip`, has been downloaded by User ID# 123, a total of <!php echo s2member_total_downloads_of("example-file.zip", 123, false); !> times; in this Period only *( includes all duplicate downloads of the same file by this User/Member )*.
2035
+ * ```
2036
+ * ———— Shortcode Equivalent ————
2037
+ * ```
2038
+ * There is NO Shortcode equivalent for this yet.
2039
+ * ```
2040
+ *
2041
+ * @package s2Member\API_Functions
2042
+ * @since 111026
2043
+ *
2044
+ * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *( when applicable )*.
2045
+ * @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *( i.e among all Users/Members )*.
2046
+ * @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
2047
+ * @return int The total for this particular ``$file``, based on configuration of function arguments.
2048
+ *
2049
+ * @note Calculations returned by this function do NOT include File Downloads that were accessed with an Advanced File Download Key.
2050
+ *
2051
+ * @see s2Member\API_Functions\s2member_user_downloads()
2052
+ * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
2053
+ *
2054
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
2055
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
2056
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
2057
+ *
2058
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
2059
+ *
2060
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
2061
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
2062
+ *
2063
+ * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
2064
+ * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
2065
+ *
2066
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
2067
+ *
2068
+ * @todo Make it possible for s2Member to keep a count of files downloaded with an Advanced Download Key.
2069
+ * @todo Create a Shortcode equivalent.
2070
+ */
2071
+ if (!function_exists ("s2member_total_downloads_of"))
2072
+ {
2073
+ function s2member_total_downloads_of ($file = FALSE, $user_id = FALSE, $check_archives_too = TRUE)
2074
+ {
2075
+ return c_ws_plugin__s2member_files::total_downloads_of ($file, $user_id, $check_archives_too);
2076
+ }
2077
+ }
2078
+ /**
2079
+ * Total unique downloads of a particular file; possibly by a particular User.
2080
+ *
2081
+ * ———— PHP Code Samples ————
2082
+ * ```
2083
+ * File: `example-file.zip`, has been downloaded a total of <!php echo s2member_total_unique_downloads_of("example-file.zip"); !> times; collectively, among all Users/Members, for all time *( does NOT include duplicate downloads of the same file, in a single Period, by the same User/Member )*.
2084
+ * File: `example-file.zip`, has been downloaded a total of <!php echo s2member_total_unique_downloads_of("example-file.zip", false, false); !> times; collectively, among all Users/Members, in this Period only *( does NOT include duplicate downloads of the same file, in a single Period, by the same User/Member )*.
2085
+ * File: `example-file.zip`, has been downloaded by User ID# 123, a total of <!php echo s2member_total_unique_downloads_of("example-file.zip", 123); !> times; for all time, since they first became a User/Member of the site *( does NOT include duplicate downloads of the same file, in a single Period, by this User/Member )*.
2086
+ * File: `example-file.zip`, has been downloaded by User ID# 123, a total of <!php echo s2member_total_unique_downloads_of("example-file.zip", 123, false); !> times; in this Period only *( does NOT include duplicate downloads of the same file, in a single Period, by this User/Member )*.
2087
+ * ```
2088
+ * ———— Shortcode Equivalent ————
2089
+ * ```
2090
+ * There is NO Shortcode equivalent for this yet.
2091
+ * ```
2092
+ *
2093
+ * @package s2Member\API_Functions
2094
+ * @since 111026
2095
+ *
2096
+ * @param str $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon® S3 Bucket *( when applicable )*.
2097
+ * @param str|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *( i.e among all Users/Members )*.
2098
+ * @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
2099
+ * @return int The total for this particular ``$file``, based on configuration of function arguments.
2100
+ *
2101
+ * @note Calculations returned by this function do NOT include File Downloads that were accessed with an Advanced File Download Key.
2102
+ *
2103
+ * @see s2Member\API_Functions\s2member_user_downloads()
2104
+ * @see s2Member\API_Functions\s2member_total_downloads_of()
2105
+ *
2106
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
2107
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
2108
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
2109
+ *
2110
+ * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
2111
+ *
2112
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
2113
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
2114
+ *
2115
+ * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
2116
+ * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
2117
+ *
2118
+ * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
2119
+ *
2120
+ * @todo Make it possible for s2Member to keep a count of files downloaded with an Advanced Download Key.
2121
+ * @todo Create a Shortcode equivalent.
2122
+ */
2123
+ if (!function_exists ("s2member_total_unique_downloads_of"))
2124
+ {
2125
+ function s2member_total_unique_downloads_of ($file = FALSE, $user_id = FALSE, $check_archives_too = TRUE)
2126
+ {
2127
+ return c_ws_plugin__s2member_files::total_unique_downloads_of ($file, $user_id, $check_archives_too);
2128
+ }
2129
+ }
2130
+ /**
2131
* Obtains the Registration Time for the current User, and/or for a particular User.
2132
*
2133
* The Registration Time, is the time at which the Username was created for the account, that's it.
2247
* $s2member_subscr_gateway = get_user_field ("s2member_subscr_gateway"); # Paid Subscr. Gateway Code for the current User.
2248
* $s2member_registration_ip = get_user_field ("s2member_registration_ip"); # IP the current User had during registration.
2249
* $s2member_custom_fields = get_user_field ("s2member_custom_fields"); # Associative array of all Custom Registration/Profile Fields.
2250
+ * $s2member_file_download_access_log = get_user_field ("s2member_file_download_access_log"); # Associative array of all File Downloads by the current User, in the current Period *( Period is based on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level )*.
2251
+ * $s2member_file_download_access_arc = get_user_field ("s2member_file_download_access_arc"); # Associative array of all File Downloads by the current User, in previous Periods *( Periods are based on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's Membership Levels in the past )*.
2252
* $s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time"); # Auto EOT-Time for the current User ( when applicable ).
2253
* $s2member_last_payment_time = get_user_field ("s2member_last_payment_time"); # Timestamp. Last time an actual payment was received by s2Member.
2254
* $s2member_paid_registration_times = get_user_field ("s2member_paid_registration_times"); # Timestamps. Associative array of all Paid Registration Times.
2329
* $s2member_subscr_gateway = get_user_option ("s2member_subscr_gateway"); # Paid Subscr. Gateway Code for the current User.
2330
* $s2member_registration_ip = get_user_option ("s2member_registration_ip"); # IP the current User had during registration.
2331
* $s2member_custom_fields = get_user_option ("s2member_custom_fields"); # Associative array of all Custom Registration/Profile Fields.
2332
+ * $s2member_file_download_access_log = get_user_option ("s2member_file_download_access_log"); # Associative array of all File Downloads by the current User, in the current Period *( Period is based on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level )*.
2333
+ * $s2member_file_download_access_arc = get_user_option ("s2member_file_download_access_arc"); # Associative array of all File Downloads by the current User, in previous Periods *( Periods are based on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's Membership Levels in the past )*.
2334
* $s2member_auto_eot_time = get_user_option ("s2member_auto_eot_time"); # Auto EOT-Time for the current User ( when applicable ).
2335
* $s2member_last_payment_time = get_user_option ("s2member_last_payment_time"); # Timestamp. Last time an actual payment was received by s2Member.
2336
* $s2member_paid_registration_times = get_user_option ("s2member_paid_registration_times"); # Timestamps. Associative array of all Paid Registration Times.
2353
* Or, this could be set to any property that exists on the WP_User object for a particular User;
2354
* ( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
2355
* `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
2356
+ * `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
2357
* `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
2358
* `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
2359
* `s2member_access_ccaps`, `s2member_login_counter`, etc, etc. ).
includes/hooks.inc.php CHANGED
@@ -171,6 +171,6 @@ add_action ("bbp_activation", "c_ws_plugin__s2member_roles_caps::config_roles",
171
/*
172
Register the activation | de-activation routines.
173
*/
174
- register_activation_hook ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"], "c_ws_plugin__s2member_installation::activate");
175
- register_deactivation_hook ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"], "c_ws_plugin__s2member_installation::deactivate");
176
?>
171
/*
172
Register the activation | de-activation routines.
173
*/
174
+ register_activation_hook ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"], "c_ws_plugin__s2member_installation::activate");
175
+ register_deactivation_hook ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"], "c_ws_plugin__s2member_installation::deactivate");
176
?>
includes/menu-pages/menu-pages-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(b){b("div#ws-menu-page-js-c-w").hide();var a=b("div.ws-menu-page-group");a.each(function(e){var g=b(this),d="<ins>+</ins>",f=g,h=b.trim(f.attr("title"));var c=b('<div class="ws-menu-page-group-header">'+d+h+"</div>");c.css({"z-index":100-e});c.insertBefore(f),f.hide(),c.click(function(){var k=b(this),j=b("ins",k),i=k.next();if(i.css("display")==="none"){k.addClass("open"),j.html("-"),i.show()}else{k.removeClass("open"),j.html("+"),i.hide()}return false});if(a.length>1&&e===0){b('<div class="ws-menu-page-groups-show">+</div>').insertBefore(c).click(function(){b("div.ws-menu-page-group-header").each(function(){var k=b(this),j=b("ins",k),i=k.next();k.addClass("open"),j.html("-"),i.show();return});return false});b('<div class="ws-menu-page-groups-hide">-</div>').insertBefore(c).click(function(){b("div.ws-menu-page-group-header").each(function(){var k=b(this),j=b("ins",k),i=k.next();k.removeClass("open"),j.html("+"),i.hide();return});return false})}if(f.attr("default-state")==="open"){c.trigger("click")}return});if(a.length>1){b("div.ws-menu-page-group-header:first").css({"margin-right":"140px"});b("div.ws-menu-page-group:first").css({"margin-right":"145px"})}b("div.ws-menu-page-r-group-header").click(function(){var d=b(this),c=d.next("div.ws-menu-page-r-group");if(c.css("display")==="none"){b("ins",d).html("-"),d.addClass("open"),c.show()}else{b("ins",d).html("+"),d.removeClass("open");c.hide()}return false});b("div.ws-menu-page-group-header:first, div.ws-menu-page-r-group-header:first").css({"margin-top":"0"});b("div.ws-menu-page-group > div.ws-menu-page-section:first-child > h3").css({"margin-top":"0"});b("div.ws-menu-page-readme > div.readme > div.section:last-child").css({"border-bottom-width":"0"});b("input.ws-menu-page-media-btn").filter(function(){return(b(this).attr("rel"))?true:false}).click(function(){var c=b(this);window.send_to_editor=function(g){var h,f,d=b.trim(c.attr("rel"));if(d&&(h=b("input#"+d)).length>0){var e=h.css("background-color"),i=b.trim(b(g).attr("src"));i=(!i)?b.trim(b("img",g).attr("src")):i;h.val(i),h.css({"background-color":"#FFFFCC"}),setTimeout(function(){h.css({"background-color":e})},2000);tb_remove();return}else{if(d&&(f=b("textarea#"+d)).length>0){var e=f.css("background-color"),i=b.trim(b(g).attr("src"));i=(!i)?b.trim(b("img",g).attr("src")):i;f.val(b.trim(f.val())+"\n"+i),f.css({"background-color":"#FFFFCC"}),setTimeout(function(){f.css({"background-color":e})},2000);tb_remove();return}}};tb_show("","./media-upload.php?type=image&TB_iframe=true");return false});b("form#ws-mlist-form").submit(function(){var c="";if(!b.trim(b("input#ws-mlist-fname").val())){c+="First Name missing, please try again.\n\n"}if(!b.trim(b("input#ws-mlist-lname").val())){c+="Last Name missing, please try again.\n\n"}if(!b.trim(b("input#ws-mlist-email").val())){c+="Email missing, please try again.\n\n"}else{if(!b("input#ws-mlist-email").val().match(/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})#x2F;i)){c+="Invalid email address, please try again.\n\n"}}if(c=b.trim(c)){alert("— Oops, you missed something: —\n\n"+c);return false}return true})});
1
+ jQuery(document).ready(function(b){b("div#ws-menu-page-js-c-w").hide();b(window).resize(tb_position=function(){var c=(b(window).width()>720)?720:b(window).width(),e=b(window).height(),d=(b("body.admin-bar").length)?28:0;b("#TB_window").css({width:c-50+"px",height:e-45-d+"px",top:25+d+"px","margin-top":0,"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});b("#TB_ajaxContent").css({width:c-50+"px",height:e-75-d+"px",margin:0,padding:0})});var a=b("div.ws-menu-page-group");a.each(function(e){var g=b(this),d="<ins>+</ins>",f=g,h=b.trim(f.attr("title"));var c=b('<div class="ws-menu-page-group-header">'+d+h+"</div>");c.css({"z-index":100-e});c.insertBefore(f),f.hide(),c.click(function(){var k=b(this),j=b("ins",k),i=k.next();if(i.css("display")==="none"){k.addClass("open"),j.html("-"),i.show()}else{k.removeClass("open"),j.html("+"),i.hide()}return false});if(a.length>1&&e===0){b('<div class="ws-menu-page-groups-show">+</div>').insertBefore(c).click(function(){b("div.ws-menu-page-group-header").each(function(){var k=b(this),j=b("ins",k),i=k.next();k.addClass("open"),j.html("-"),i.show();return});return false});b('<div class="ws-menu-page-groups-hide">-</div>').insertBefore(c).click(function(){b("div.ws-menu-page-group-header").each(function(){var k=b(this),j=b("ins",k),i=k.next();k.removeClass("open"),j.html("+"),i.hide();return});return false})}if(f.attr("default-state")==="open"){c.trigger("click")}return});if(a.length>1){b("div.ws-menu-page-group-header:first").css({"margin-right":"140px"});b("div.ws-menu-page-group:first").css({"margin-right":"145px"})}b("div.ws-menu-page-r-group-header").click(function(){var d=b(this),c=d.next("div.ws-menu-page-r-group");if(c.css("display")==="none"){b("ins",d).html("-"),d.addClass("open"),c.show()}else{b("ins",d).html("+"),d.removeClass("open");c.hide()}return false});b("div.ws-menu-page-group-header:first, div.ws-menu-page-r-group-header:first").css({"margin-top":"0"});b("div.ws-menu-page-group > div.ws-menu-page-section:first-child > h3").css({"margin-top":"0"});b("div.ws-menu-page-readme > div.readme > div.section:last-child").css({"border-bottom-width":"0"});b("input.ws-menu-page-media-btn").filter(function(){return(b(this).attr("rel"))?true:false}).click(function(){var c=b(this);window.send_to_editor=function(g){var h,f,d=b.trim(c.attr("rel"));if(d&&(h=b("input#"+d)).length>0){var e=h.css("background-color"),i=b.trim(b(g).attr("src"));i=(!i)?b.trim(b("img",g).attr("src")):i;h.val(i),h.css({"background-color":"#FFFFCC"}),setTimeout(function(){h.css({"background-color":e})},2000);tb_remove();return}else{if(d&&(f=b("textarea#"+d)).length>0){var e=f.css("background-color"),i=b.trim(b(g).attr("src"));i=(!i)?b.trim(b("img",g).attr("src")):i;f.val(b.trim(f.val())+"\n"+i),f.css({"background-color":"#FFFFCC"}),setTimeout(function(){f.css({"background-color":e})},2000);tb_remove();return}}};tb_show("","./media-upload.php?type=image&TB_iframe=true");return false});b("form#ws-mlist-form").submit(function(){var c="";if(!b.trim(b("input#ws-mlist-fname").val())){c+="First Name missing, please try again.\n\n"}if(!b.trim(b("input#ws-mlist-lname").val())){c+="Last Name missing, please try again.\n\n"}if(!b.trim(b("input#ws-mlist-email").val())){c+="Email missing, please try again.\n\n"}else{if(!b("input#ws-mlist-email").val().match(/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})#x2F;i)){c+="Invalid email address, please try again.\n\n"}}if(c=b.trim(c)){alert("— Oops, you missed something: —\n\n"+c);return false}return true})});
includes/menu-pages/menu-pages-s-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){var esc_attr=esc_html=function(str){return String(str).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};if(location.href.match(/page\=ws-plugin--s2member/)){$("input.ws-plugin--s2member-update-roles-button, input.ws-plugin--s2member-reset-roles-button").click(function(){var $this=$(this);$this.val("one moment please ...");var levels='<?php echo (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; ?>';var resetUpdate=($this.hasClass("ws-plugin--s2member-reset-roles-button"))?"Reset":"Update";$.post(ajaxurl,{action:"ws_plugin__s2member_update_roles_via_ajax",ws_plugin__s2member_update_roles_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-update-roles-via-ajax")); ?>'},function(response){if(response==="1"){alert("s2Member's Roles/Capabilities "+((resetUpdate.toLowerCase()==="reset")?"have been successfully reset":"updated successfully")+".\nYour installation of s2Member has Membership Levels 0-"+levels+"."),$this.val(resetUpdate+" Roles/Capabilities")}else{if(response==="l"){alert("Sorry, your request failed.\ns2Member's Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps"),$this.val(resetUpdate+" Roles/Capabilities")}else{alert("Sorry, your request failed.\nAccess denied. Do you have the ability to `create_users`?"),$this.val(resetUpdate+" Roles/Capabilities")}}});return false})}if(location.href.match(/page\=ws-plugin--s2member-mms-ops/)){$("select#ws-plugin--s2member-mms-registration-file").change(function(){if($(this).val()==="wp-signup"){var gv=$("select#ws-plugin--s2member-mms-registration-grants").val(),l0v=$("input#ws-plugin--s2member-mms-registration-blogs-level0").val();$("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),$("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),$("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show();$("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((gv==="all")?"show":"hide")]();$("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((gv==="all")?((l0v>0)?l0v:"1"):"0"))}else{if($(this).val()==="wp-login"){var gv=$("select#ws-plugin--s2member-mms-registration-grants").val(),l0v=$("input#ws-plugin--s2member-mms-registration-blogs-level0").val();$("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),$("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),$("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide();$("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0").hide();$("input#ws-plugin--s2member-mms-registration-blogs-level0").val("0")}}}).trigger("change");$("select#ws-plugin--s2member-mms-registration-grants").change(function(){$("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}if(location.href.match(/page\=ws-plugin--s2member-gen-ops/)){ws_plugin__s2member_generateSecurityKey=function(){var mt_rand=function(min,max){min=(arguments.length<1)?0:min;max=(arguments.length<2)?2147483647:max;return Math.floor(Math.random()*(max-min+1))+min};var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";for(var i=0,key="";i<64;i++){key+=chars.substr(mt_rand(0,chars.length-1),1)}$("input#ws-plugin--s2member-sec-encryption-key").val(key);return false};ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have unhappy Customers. Data corruption WILL occur! For your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){$("input#ws-plugin--s2member-sec-encryption-key").removeAttr("disabled")}return false};ws_plugin__s2member_securityKeyHistory=function(){$("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false};$("select#ws-plugin--s2member-new-user-emails-enabled").change(function(){var $pluggable=$("input#ws-plugin--s2member-pluggables-wp-new-user-notification"),$this=$(this),$newUserEmails=$("div#ws-plugin--s2member-new-user-emails");if($pluggable.val()==="0"||$this.val()==="0"){($pluggable.val()==="0")?$this.attr("disabled","disabled"):$this.removeAttr("disabled");$(":input",$newUserEmails).attr("disabled","disabled"),$newUserEmails.css("opacity","0.5")}else{$this.removeAttr("disabled"),$(":input",$newUserEmails).removeAttr("disabled"),$newUserEmails.css("opacity","")}}).trigger("change");if($("input#ws-plugin--s2member-custom-reg-fields").length&&$("div#ws-plugin--s2member-custom-reg-field-configuration").length){(function(){var i,fieldDefaults,tools,table,$tools,$table;var $fields=$("input#ws-plugin--s2member-custom-reg-fields");var $configuration=$("div#ws-plugin--s2member-custom-reg-field-configuration");var fields=($fields.val())?$.JSON.parse($fields.val()):[];fields=(fields instanceof Array)?fields:[];fieldDefaults={section:"no",sectitle:"",id:"",label:"",type:"text",deflt:"",options:"",expected:"",required:"yes",levels:"all",editable:"yes",classes:"",styles:"",attrs:""};for(i=0;i<fields.length;i++){fields[i]=$.extend(true,{},fieldDefaults,fields[i])}tools='<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>',table='<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';$configuration.html(tools+table);$tools=$("div#ws-plugin--s2member-custom-reg-field-configuration-tools"),$table=$("table#ws-plugin--s2member-custom-reg-field-configuration-table");ws_plugin__s2member_customRegFieldSectionChange=function(select){var section=$(select).val();var sectitle_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle";(section==="yes")?$(sectitle_trs).css("display",""):$(sectitle_trs).css("display","none")};ws_plugin__s2member_customRegFieldTypeChange=function(select){var type=$(select).val();var deflt_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt",options_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options",expected_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected";(type.match(/^(text|textarea)#x2F;))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)#x2F;))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)#x2F;))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i<fields.length;i++){if(i!==index){newFields.push(fields[i])}}fields=newFields,updateFields(),buildTable()};ws_plugin__s2member_customRegFieldMoveUp=function(index){if(typeof fields[index]==="object"&&typeof fields[index-1]==="object"){var prevFieldObj=fields[index-1],thisFieldObj=fields[index];fields[index-1]=thisFieldObj,fields[index]=prevFieldObj;updateFields(),buildTable()}};ws_plugin__s2member_customRegFieldMoveDown=function(index){if(typeof fields[index]==="object"&&typeof fields[index+1]==="object"){var nextFieldObj=fields[index+1],thisFieldObj=fields[index];fields[index+1]=thisFieldObj,fields[index]=nextFieldObj;updateFields(),buildTable()}};ws_plugin__s2member_customRegFieldCreate=function(){var $table=$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),field={};$(":input[property]",$table).each(function(){var $this=$(this),property=$this.attr("property"),val=$.trim($this.val());field[property]=val});if((field=validateField(field))){fields.push(field),updateFields(),buildTools(),buildTable(),scrollReset();setTimeout(function(){var row="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+(fields.length-1);alert('Field created successfully.\n* Remember to "Save All Changes".');$(row).effect("highlight",1500)},500)}};ws_plugin__s2member_customRegFieldUpdate=function(index){var $table=$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),field={};$(":input[property]",$table).each(function(){var $this=$(this),property=$this.attr("property"),val=$.trim($this.val());field[property]=val});if((field=validateField(field,index))){fields[index]=field,updateFields(),buildTools(),buildTable(),scrollReset();setTimeout(function(){var row="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+index;alert('Field updated successfully.\n* Remember to "Save All Changes".');$(row).effect("highlight",1500)},500)}};ws_plugin__s2member_customRegFieldAdd=function(){buildTools(true)};ws_plugin__s2member_customRegFieldEdit=function(index){buildTools(false,index),scrollReset()};ws_plugin__s2member_customRegFieldCancel=function(){buildTools(),scrollReset()};var validateField=function(field,index){var editing=(typeof index==="number"&&typeof fields[index]==="object")?true:false,errors=[],options,i;if(typeof field!=="object"||typeof(field=$.extend(true,{},fieldDefaults,field))!=="object"){alert("Invalid field object. Please try again.");return false}field.sectitle=(field.section==="yes")?field.sectitle:"";field.deflt=(field.type.match(/^(text|textarea)#x2F;))?field.deflt:"";field.deflt=(field.type.match(/^(text)#x2F;))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?field.options:"";field.expected=(field.type.match(/^(text|textarea)#x2F;))?field.expected:"";if(!field.id){errors.push("Unique Field ID:\nThis is required. Please try again.")}else{if(fieldIdExists(field.id)&&(!editing||field.id!==fields[index].id)){errors.push("Unique Field ID:\nThat Field ID already exists. Please try again.")}}if(!field.label){errors.push("Field Label/Description:\nThis is required. Please try again.")}if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?#x2F;)){errors.push("Option Configuration File:\nInvalid configuration at line #"+(i+1)+".");break}}field.options=$.trim(options.join("\n"))}}if(!(field.levels=field.levels.replace(/ /g,""))){errors.push("Applicable Levels:\nThis is required. Please try again.")}else{if(!field.levels.match(/^(all|[0-9,]+)#x2F;)){errors.push("Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )")}}if(field.classes&&field.classes.match(/[^a-z 0-9 _ \-]/i)){errors.push("CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )")}if(field.styles&&field.styles.match(/["\=\>\<]/)){errors.push('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )')}if(field.attrs&&field.attrs.match(/[\>\<]/)){errors.push("Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )")}if(errors.length>0){alert(errors.join("\n\n"));return false}else{return field}};var updateFields=function(){$fields.val(((fields.length>0)?$.JSON.stringify(fields):""))};var fieldId2Var=function(fieldId){return(typeof fieldId==="string")?$.trim(fieldId).toLowerCase().replace(/[^a-z0-9]/g,"_"):""};var fieldTypeDesc=function(type){var types={text:"Text ( single line )",textarea:"Textarea ( multi-line )",select:"Select Menu ( drop-down )",selects:"Select Menu ( multi-option )",checkbox:"Checkbox ( single )",pre_checkbox:"Checkbox ( pre-checked )",checkboxes:"Checkboxes ( multi-option )",radios:"Radio Buttons ( multi-option )"};if(typeof types[type]==="string"){return types[type]}return""};var fieldIdExists=function(fieldId){for(var i=0;i<fields.length;i++){if(fields[i].id===fieldId){return true}}};var scrollReset=function(){scrollTo(0,$("div.ws-plugin--s2member-custom-reg-fields-section").offset()["top"]-100)};var buildTools=function(adding,index){var i=0,html="",form="",w=0,h=0,editing=(typeof index==="number"&&typeof fields[index]==="object")?true:false,displayForm=(adding||editing)?true:false,field=(editing)?$.extend(true,{},fieldDefaults,fields[index]):fieldDefaults;html+='<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';tb_remove(),$("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(displayForm){form+='<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';form+='<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';form+="<tbody>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">Starts A New Section?</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<td colspan="2">';form+='<select property="section" onchange="ws_plugin__s2member_customRegFieldSectionChange(this);" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<option value="no"'+((field.section==="no")?' selected="selected"':"")+'">No ( this Field flows normally )</option>';form+='<option value="yes"'+((field.section==="yes")?' selected="selected"':"")+'">Yes ( this Field begins a new section )</option>';form+="</select><br />";form+="<small>Optional. Allows Fields to be grouped into sections.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section==="yes")?"":' style="display:none;"')+'><td colspan="2"><hr /></td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section==="yes")?"":' style="display:none;"')+">";form+='<td colspan="2">';form+="Title for this new section? ( optional )<br />";form+='<input type="text" property="sectitle" value="'+esc_attr(field.sectitle)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle" /><br />';form+="<small>If empty, a simple divider will be used by default.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-type"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<td colspan="2">';form+='<select property="type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<option value="text"'+((field.type==="text")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("text"))+"</option>";form+='<option value="textarea"'+((field.type==="textarea")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("textarea"))+"</option>";form+='<option value="select"'+((field.type==="select")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("select"))+"</option>";form+='<option value="selects"'+((field.type==="selects")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("selects"))+"</option>";form+='<option value="checkbox"'+((field.type==="checkbox")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("checkbox"))+"</option>";form+='<option value="pre_checkbox"'+((field.type==="pre_checkbox")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("pre_checkbox"))+"</option>";form+='<option value="checkboxes"'+((field.type==="checkboxes")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("checkboxes"))+"</option>";form+='<option value="radios"'+((field.type==="radios")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("radios"))+"</option>";form+="</select><br />";form+="<small>The options below may change, based on the Field Type you choose here.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-label"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';form+='<td colspan="2">';form+='<input type="text" property="label" value="'+esc_attr(field.label)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" /><br />';form+="<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-id"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';form+='<td colspan="2">';form+='<input type="text" property="id" value="'+esc_attr(field.id)+'" maxlength="25" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" /><br />';form+="<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />";form+='<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-required"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<td colspan="2">';form+='<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<option value="yes"'+((field.required==="yes")?' selected="selected"':"")+'">Yes ( required )</option>';form+='<option value="no"'+((field.required==="no")?' selected="selected"':"")+'">No ( optional )</option>';form+="</select><br />";form+='<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';form+="<small>* Administrators are exempt from this requirement.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt">Default Text Value: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<textarea property="deflt" rows="1" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt">'+esc_html(field.deflt)+"</textarea><br />";form+="<small>Default value before user input is received.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';form+="<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<textarea property="options" rows="3" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">'+esc_html(field.options)+"</textarea><br />";form+="Here is a quick example:<br />";form+="<small>You can also specify a <em>default</em> option:</small><br />";form+="<code>US|United States|default</code><br />";form+="<code>CA|Canada</code><br />";form+="<code>VI|Virgin Islands (U.S.)</code>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';form+='<option value=""'+((field.expected==="")?' selected="selected"':"")+'">Anything Goes</option>';form+='<option disabled="disabled"></option>';form+='<optgroup label="Specific Input Types">';form+='<option value="numeric-wp-commas"'+((field.expected==="numeric-wp-commas")?' selected="selected"':"")+'">Numeric ( with or without decimals, commas allowed )</option>';form+='<option value="numeric"'+((field.expected==="numeric")?' selected="selected"':"")+'">Numeric ( with or without decimals, no commas )</option>';form+='<option value="integer"'+((field.expected==="integer")?' selected="selected"':"")+'">Integer ( whole number, without any decimals )</option>';form+='<option value="integer-gt-0"'+((field.expected==="integer-gt-0")?' selected="selected"':"")+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';form+='<option value="float"'+((field.expected==="float")?' selected="selected"':"")+'">Float ( floating point number, decimals required )</option>';form+='<option value="float-gt-0"'+((field.expected==="float-gt-0")?' selected="selected"':"")+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';form+='<option value="date"'+((field.expected==="date")?' selected="selected"':"")+'">Date ( required date format: dd/mm/yyyy )</option>';form+='<option value="email"'+((field.expected==="email")?' selected="selected"':"")+'">Email ( require valid email )</option>';form+='<option value="url"'+((field.expected==="url")?' selected="selected"':"")+'">Full URL ( starting with http or https )</option>';form+='<option value="domain"'+((field.expected==="domain")?' selected="selected"':"")+'">Domain Name ( domain name only, without http )</option>';form+='<option value="phone"'+((field.expected==="phone")?' selected="selected"':"")+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';form+='<option value="uszip"'+((field.expected==="uszip")?' selected="selected"':"")+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';form+='<option value="cazip"'+((field.expected==="cazip")?' selected="selected"':"")+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';form+='<option value="uczip"'+((field.expected==="uczip")?' selected="selected"':"")+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Any Character Combination">';for(i=1;i<=25;i++){form+='<option value="any-'+i+'"'+((field.expected==="any-"+i)?' selected="selected"':"")+'">Any Character Combination ( '+i+" character minimum )</option>";form+='<option value="any-'+i+'-e"'+((field.expected==="any-"+i+"-e")?' selected="selected"':"")+'">Any Character Combination ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-punctuation-'+i+'"'+((field.expected==="alphanumerics-spaces-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-spaces-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics &amp; Spaces Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-'+i+'"'+((field.expected==="alphanumerics-spaces-"+i)?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-'+i+'-e"'+((field.expected==="alphanumerics-spaces-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics &amp; Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-punctuation-'+i+'"'+((field.expected==="alphanumerics-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-'+i+'"'+((field.expected==="alphanumerics-"+i)?' selected="selected"':"")+'">Alphanumerics ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-'+i+'-e"'+((field.expected==="alphanumerics-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphabetics Only">';for(i=1;i<=25;i++){form+='<option value="alphabetics-'+i+'"'+((field.expected==="alphabetics-"+i)?' selected="selected"':"")+'">Alphabetics ( '+i+" character minimum )</option>";form+='<option value="alphabetics-'+i+'-e"'+((field.expected==="alphabetics-"+i+"-e")?' selected="selected"':"")+'">Alphabetics ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Numeric Digits Only">';for(i=1;i<=25;i++){form+='<option value="numerics-'+i+'"'+((field.expected==="numerics-"+i)?' selected="selected"':"")+'">Numeric Digits ( '+i+" digit minimum )</option>";form+='<option value="numerics-'+i+'-e"'+((field.expected==="numerics-"+i+"-e")?' selected="selected"':"")+'">Numeric Digits ( exactly '+i+" digit"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+="</select><br />";form+="<small>Only Users/Members will be required to meet this criteria.</small><br />";form+="<small>* Administrators are exempt from this.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';form+='<td colspan="2">';form+='<input type="text" property="levels" value="'+esc_attr(field.levels)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" /><br />';form+="<small>Please use comma-delimited Level #'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />";form+="<small>This allows you to enable this field - only at specific Membership Levels.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<td colspan="2">';form+='<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<option value="yes"'+((field.editable==="yes")?' selected="selected"':"")+'">Yes ( editable )</option>';form+='<option value="no"'+((field.editable==="no")?' selected="selected"':"")+'">No ( uneditable after registration )</option>';form+='<option value="no-invisible"'+((field.editable==="no-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible after registration )</option>';form+='<option value="yes-invisible"'+((field.editable==="yes-invisible")?' selected="selected"':"")+'">Yes ( editable after registration / invisible during registration )</option>';form+="</select><br />";form+="<small>If <code>No</code>, this field will be un-editable after registration.</small><br />";form+="<small>* Administrators are exempt from this.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';form+='<td colspan="2">';form+='<input type="text" property="classes" value="'+esc_attr(field.classes)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" /><br />';form+="<small>Example: <code>my-style-1 my-style-2</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';form+='<td colspan="2">';form+='<input type="text" property="styles" value="'+esc_attr(field.styles)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" /><br />';form+="<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';form+='<td colspan="2">';form+='<input type="text" property="attrs" value="'+esc_attr(field.attrs)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" /><br />';form+='<small>Example: <code>onkeyup="" onblur=""</code></small>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';form+='<td align="left">';form+='<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';form+="</td>";form+='<td align="right">';form+='<input type="button" value="'+((editing)?"Update This Field":"Create Registration Field")+'" onclick="'+((editing)?"ws_plugin__s2member_customRegFieldUpdate("+index+");":"ws_plugin__s2member_customRegFieldCreate();")+'" />';form+="</td>";form+="</tr>";form+="</tbody>";form+="</table>";form+="<div>";$("body").append(form);tb_show(((editing)?"Editing Registration/Profile Field":"New Custom Registration/Profile Field"),"#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form"),$(window).trigger("resize");$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form").show()}$tools.html(html)};var attachTBResizer=function(){$(window).resize(function(){var w,h;w=$(window).width(),h=$(window).height(),w=(w>720)?720:w;$("#TB_ajaxContent").css({width:w-50,height:h-75,margin:0,padding:0})})};var buildTable=function(){var l=fields.length,i=0,html="",eo="o";html+="<tbody>";html+="<tr>";html+="<th>Order</th>";html+="<th>Field Type</th>";html+="<th>Unique ID</th>";html+="<th>Required</th>";html+="<th>Levels</th>";html+="<th>- Tools -</th>";html+="</tr>";if(fields.length>0){for(i=0;i<fields.length;i++){html+='<tr class="'+esc_attr((eo=(eo==="o")?"e":"o"))+((fields[i].section==="yes")?" s":"")+" ws-plugin--s2member-custom-reg-field-configuration-table-row-"+i+'">';html+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+i+'); return false;"></a></td>';html+='<td nowrap="nowrap">'+esc_html(fieldTypeDesc(fields[i].type))+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].id)+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].required)+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].levels)+"</td>";html+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+i+'); return false;"></a></td>';html+="</tr>"}}else{html+="<tr>";html+='<td colspan="6">No Custom Fields are configured.</td>';html+="</tr>"}html+="</tbody>";$table.html(html)};buildTools(),attachTBResizer(),buildTable()})()}}if(location.href.match(/page\=ws-plugin--s2member-res-ops/)){$("input#ws-plugin--s2member-brute-force-restrictions-reset-button").click(function(){var $this=$(this);$this.val("one moment please ...");$.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(response){alert("s2Member's Brute Force Restriction Logs have all been reset."),$this.val("Reset Brute Force Logs")});return false});$("input#ws-plugin--s2member-ip-restrictions-reset-button").click(function(){var $this=$(this);$this.val("one moment please ...");$.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(response){alert("s2Member's IP Restriction Logs have all been reset."),$this.val("Reset IP Restriction Logs")});return false});$('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query[]"]').change(function(){var thisChange=$(this).val();$('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="all"&&this.checked){$this.nextAll(checkboxes).attr({checked:"checked",disabled:"disabled"})}else{if(val==="all"&&!this.checked){$this.nextAll(checkboxes).removeAttr("disabled");(thisChange==="all")?$this.nextAll(checkboxes).removeAttr("checked"):null}}})}).last().trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-down-ops/)){var updateCloudFrontPrivateKey=function(){var $hiddenPrivateKey=$("input#ws-plugin--s2member-amazon-cf-files-private-key");var $visiblePrivateKeyEntry=$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry");var hiddenPrivateKeyValue=$.trim($hiddenPrivateKey.val()),visiblePrivateKeyEntryValue=$.trim($visiblePrivateKeyEntry.val());if((hiddenPrivateKeyValue&&!visiblePrivateKeyEntryValue)||visiblePrivateKeyEntryValue.match(/[^\r\n\u25CF]/)){$hiddenPrivateKey.val(visiblePrivateKeyEntryValue),$visiblePrivateKeyEntry.val(visiblePrivateKeyEntryValue.replace(/[^\r\n]/g,String.fromCharCode(9679)))}};$("form#ws-plugin--s2member-options-form").submit(updateCloudFrontPrivateKey);$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry").change(updateCloudFrontPrivateKey).trigger("change");var updateCloudFrontDistroCfgs=function(){var $hiddenPrivateKey=$("input#ws-plugin--s2member-amazon-cf-files-private-key");var $visiblePrivateKeyId=$("input#ws-plugin--s2member-amazon-cf-files-private-key-id");var $autoConfigDistros=$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros");var $autoConfigDistrosStatus=$("input#ws-plugin--s2member-amazon-cf-files-distros-auto-config-status");var autoConfigDistrosStatusValue=$.trim($autoConfigDistrosStatus.val());var hiddenPrivateKeyValue=$.trim($hiddenPrivateKey.val()),visiblePrivateKeyIdValue=$.trim($visiblePrivateKeyId.val());var hiddenPrivateKeyPrevConfigValue=$.trim($hiddenPrivateKey.attr("data-s-prev-config-value")),visiblePrivateKeyIdPrevConfigValue=$.trim($visiblePrivateKeyId.attr("data-s-prev-config-value"));if(autoConfigDistrosStatusValue==="configured"&&((visiblePrivateKeyIdPrevConfigValue&&visiblePrivateKeyIdValue!==visiblePrivateKeyIdPrevConfigValue)||(hiddenPrivateKeyPrevConfigValue&&hiddenPrivateKeyValue!==hiddenPrivateKeyPrevConfigValue))){alert("s2Member will need to delete and re-configure your Amazon® CloudFront distributions if you change this. When you're done editing, click (Save All Changes) below.");$autoConfigDistros.attr("checked","checked")}else{if(autoConfigDistrosStatusValue!=="configured"&&visiblePrivateKeyIdValue&&hiddenPrivateKeyValue){alert("s2Member will need to auto-configure your Amazon® CloudFront distributions for you. When you're done editing, click (Save All Changes) below.");$autoConfigDistros.attr("checked","checked")}}};$("input#ws-plugin--s2member-amazon-cf-files-private-key-id").change(updateCloudFrontDistroCfgs);$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry").change(updateCloudFrontDistroCfgs);$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames").change(function(){var $this=$(this),thisChecked=(this.checked)?true:false;var $autoConfigDistros=$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros");var $autoConfigDistroCnames=$("div#ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames");(thisChecked)?$autoConfigDistroCnames.show():$autoConfigDistroCnames.hide();(thisChecked)?$autoConfigDistros.attr("checked","checked"):null}).trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){$("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var $this=$(this),val=$this.val();var $viaCron=$("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(val==2){$viaCron.show()}else{$viaCron.hide()}})}if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){$("div.ws-menu-page select[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification)-term#x2F;)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term#x2F;g,"$1");var trialDisabled=($(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;$("p#ws-plugin--s2member-"+button+"-trial-line").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-trial-then").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-20p-rule").css("display",(trialDisabled?"none":""));(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-period").val(0):null;(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-amount").val("0.00"):null});$("div.ws-menu-page input[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps#x2F;)}).keyup(function(){var value=this.value.replace(/^(-all|-al|-a|-)[;,]*/gi,""),_all=(this.value.match(/^(-all|-al|-a|-)[;,]*/i))?"-all,":"";if(value.match(/[^a-z_0-9,]/)){this.value=_all+$.trim($.trim(value).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(button){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="",labels={};eval("<?php echo c_ws_plugin__s2member_utils_strings::esc_dq($labels); ?>");var shortCode=$("input#ws-plugin--s2member-"+button+"-shortcode");var code=$("textarea#ws-plugin--s2member-"+button+"-button");var modLevel=$("select#ws-plugin--s2member-modification-level");var level=(button==="modification")?modLevel.val().split(":",2)[1]:button.replace(/^level/,"");var label=labels["level"+level].replace(/"/g,"");var desc=$.trim($("input#ws-plugin--s2member-"+button+"-desc").val().replace(/"/g,""));var trialAmount=$("input#ws-plugin--s2member-"+button+"-trial-amount").val().replace(/[^0-9\.]/g,"");var trialPeriod=$("input#ws-plugin--s2member-"+button+"-trial-period").val().replace(/[^0-9]/g,"");var trialTerm=$("select#ws-plugin--s2member-"+button+"-trial-term").val().replace(/[^A-Z]/g,"");var regAmount=$("input#ws-plugin--s2member-"+button+"-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var regRecurTimes="",regRecurRetry="1";var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-"+button+"-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-"+button+"-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-"+button+"-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-"+button+"-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();trialPeriod=(regRecur==="BN")?"0":trialPeriod;trialAmount=(!trialAmount||isNaN(trialAmount)||trialAmount<0.01||trialPeriod<=0)?"0":trialAmount;var levelCcapsPer=(regRecur==="BN"&&regTerm!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;g,"");if(trialAmount!=="0"&&(isNaN(trialAmount)||trialAmount<0)){alert("— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(trialAmount!=="0"&&trialAmount>10000){alert("— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00");return false}else{if(trialTerm==="D"&&trialPeriod>7){alert("— Oops, a slight problem: —\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 days, please choose Weeks or Months from the drop-down.");return false}else{if(trialTerm==="W"&&trialPeriod>52){alert("— Oops, a slight problem: —\n\nMaximum Trial Weeks is: 52.\nIf you want to offer more than 52 weeks, please choose Months from the drop-down.");return false}else{if(trialTerm==="M"&&trialPeriod>12){alert("— Oops, a slight problem: —\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.");return false}else{if(trialTerm==="Y"&&trialPeriod>1){alert("— Oops, a slight problem: —\n\nMax Trial Period Years is: 1.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}}}}}}code.html(code.val().replace(/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(trialPeriod)<=0)?code.html(code.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="(src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(regRecur!=