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

Version Description

Download this release

Release Info

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

Code changes from version 110915 to 110926

Files changed (53) hide show
  1. images/jwplayer-logo.png +0 -0
  2. includes/_xtnls/mailchimp/nc-mcapi.inc.php +32 -92
  3. includes/classes/admin-lockouts.inc.php +14 -13
  4. includes/classes/auto-eots.inc.php +6 -3
  5. includes/classes/cache.inc.php +22 -22
  6. includes/classes/custom-reg-fields-4bp.inc.php +22 -20
  7. includes/classes/email-configs.inc.php +16 -13
  8. includes/classes/files-in.inc.php +1190 -197
  9. includes/classes/files.inc.php +60 -20
  10. includes/classes/list-servers.inc.php +2 -2
  11. includes/classes/login-redirects-r.inc.php +27 -3
  12. includes/classes/login-redirects.inc.php +15 -15
  13. includes/classes/menu-pages.inc.php +43 -33
  14. includes/classes/option-forces.inc.php +3 -2
  15. includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +1 -1
  16. includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +0 -1
  17. includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +2 -2
  18. includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +8 -8
  19. includes/classes/paypal-notify-in-web-accept-sp.inc.php +1 -1
  20. includes/classes/paypal-notify-in.inc.php +14 -10
  21. includes/classes/paypal-return-in-no-tx-data.inc.php +1 -0
  22. includes/classes/register-access.inc.php +6 -4
  23. includes/classes/registration-times.inc.php +12 -13
  24. includes/classes/registrations.inc.php +193 -187
  25. includes/classes/sc-files-in.inc.php +85 -0
  26. includes/classes/sc-files.inc.php +49 -0
  27. includes/classes/systematics-sp.inc.php +19 -6
  28. includes/classes/systematics.inc.php +3 -3
  29. includes/classes/translations.inc.php +23 -1
  30. includes/classes/user-deletions.inc.php +24 -16
  31. includes/classes/utils-conds.inc.php +68 -8
  32. includes/classes/utils-strings.inc.php +56 -11
  33. includes/classes/utils-urls.inc.php +21 -11
  34. includes/codes.inc.php +2 -1
  35. includes/functions/api-functions.inc.php +55 -6
  36. includes/functions/pluggables.inc.php +2 -1
  37. includes/hooks.inc.php +2 -1
  38. includes/menu-pages/code-samples/jwplayer-standard-mp4.php +23 -0
  39. includes/menu-pages/code-samples/jwplayer-streaming-mp4-sca.php +35 -0
  40. includes/menu-pages/code-samples/jwplayer-streaming-mp4-webm.php +37 -0
  41. includes/menu-pages/code-samples/jwplayer-streaming-mp4.php +31 -0
  42. includes/menu-pages/down-ops.inc.php +205 -15
  43. includes/menu-pages/menu-pages-s-min.js +1 -1
  44. includes/menu-pages/menu-pages-s.js +145 -91
  45. includes/menu-pages/res-ops.inc.php +4 -4
  46. includes/s2member-min.js +1 -1
  47. includes/s2member.js +25 -15
  48. includes/syscon.inc.php +25 -8
  49. includes/templates/cfg-files/s2-cross-xml.php +10 -0
  50. includes/templates/cfg-files/s2member-files.php +26 -5
  51. includes/translations/s2member.pot +600 -179
  52. readme.txt +10 -2
  53. s2member.php +4 -4
images/jwplayer-logo.png ADDED
Binary file
includes/_xtnls/mailchimp/nc-mcapi.inc.php CHANGED
@@ -2398,119 +2398,59 @@ class NC_MCAPI {
2398
  }
2399
 
2400
  /**
2401
- * Actually connect to the server and call the requested methods, parsing the result
2402
- * You should never have to call this function manually
2403
  */
2404
  function callServer($method, $params) {
2405
- $dc = "us1";
2406
- if (strstr($this->api_key,"-")){
2407
  list($key, $dc) = explode("-",$this->api_key,2);
2408
  if (!$dc) $dc = "us1";
2409
  }
 
2410
  $this->apiUrl["prefix"] = $dc;
2411
  $host = $dc.".".$this->apiUrl["host"];
2412
  $params["apikey"] = $this->api_key;
2413
 
2414
  $this->errorMessage = "";
2415
  $this->errorCode = "";
2416
- $sep_changed = false;
2417
- //sigh, apparently some distribs change this to & by default
2418
- if (ini_get("arg_separator.output")!="&"){
2419
- $sep_changed = true;
2420
- $orig_sep = ini_get("arg_separator.output");
2421
- ini_set("arg_separator.output", "&");
2422
- }
2423
  $post_vars = http_build_query($params);
2424
- if ($sep_changed){
2425
- ini_set("arg_separator.output", $orig_sep);
2426
- }
2427
-
2428
- # $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
2429
- # $payload .= "Host: " . $host . "\r\n";
2430
- # $payload .= "User-Agent: MCAPI/" . $this->version ."\r\n";
2431
- # $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
2432
- # $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
2433
- # $payload .= "Connection: close \r\n\r\n";
2434
- # $payload .= $post_vars;
2435
-
2436
- ob_start();
2437
-
2438
- $s2_ags = array("user-agent" => "MCAPI/" . $this->version, "timeout" => $this->timeout);
2439
-
2440
- $s2_url = $host . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method;
2441
- $s2_url = ($this->secure) ? "https://" . $s2_url : "http://" . $s2_url;
2442
-
2443
- if (!strlen ($response = c_ws_plugin__s2member_utils_urls::remote ($s2_url, $post_vars, $s2_ags, true))){
2444
- $this->errorMessage = "Could not connect.";
2445
- $this->errorCode = "-99";
2446
- ob_end_clean();
2447
- return false;
2448
- }
2449
-
2450
- ob_end_clean();
2451
-
2452
- # if ($this->secure){
2453
- # $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
2454
- # } else {
2455
- # $sock = fsockopen($host, 80, $errno, $errstr, 30);
2456
- # }
2457
- # if(!$sock) {
2458
- # $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
2459
- # $this->errorCode = "-99";
2460
- # ob_end_clean();
2461
- # return false;
2462
- # }
2463
-
2464
- # $response = "";
2465
- # fwrite($sock, $payload);
2466
- # stream_set_timeout($sock, $this->timeout);
2467
- # $info = stream_get_meta_data($sock);
2468
- # while ((!feof($sock)) && (!$info["timed_out"])) {
2469
- # $response .= fread($sock, $this->chunkSize);
2470
- # $info = stream_get_meta_data($sock);
2471
- # }
2472
- # fclose($sock);
2473
- # ob_end_clean();
2474
- # if ($info["timed_out"]) {
2475
- # $this->errorMessage = "Could not read response (timed out)";
2476
- # $this->errorCode = -98;
2477
- # return false;
2478
- # }
2479
-
2480
- list($headers, $response) = explode("\r\n\r\n", $response, 2);
2481
- $headers = explode("\r\n", $headers);
2482
- $errored = false;
2483
- foreach($headers as $h){
2484
- if (substr( /* WebSharks, Inc. ( lowercase ). */
2485
- strtolower($h),0,26)==="x-mailchimp-api-error-code"){
2486
- $errored = true;
2487
- $error_code = trim(substr($h,27));
2488
- break;
2489
- }
2490
  }
2491
-
2492
- # if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
2493
-
2494
- $serial = /* WebSharks, Inc. ( maybe ). */ maybe_unserialize($response);
2495
-
2496
- if($response && $serial === false) {
2497
- $response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
2498
- } else {
2499
- $response = $serial;
2500
  }
2501
- if($errored && is_array($response) && isset($response["error"])) {
 
2502
  $this->errorMessage = $response["error"];
2503
  $this->errorCode = $response["code"];
2504
  return false;
2505
- } elseif($errored){
2506
- $this->errorMessage = "No error message was found.";
2507
- $this->errorCode = $error_code;
 
 
 
 
2508
  return false;
2509
  }
2510
-
2511
  return $response;
2512
  }
2513
 
2514
  }
2515
-
2516
  ?>
2398
  }
2399
 
2400
  /**
2401
+ * Actually connect to the server and call the requested methods, parsing the result.
2402
+ * You should never have to call this function manually.
2403
  */
2404
  function callServer($method, $params) {
2405
+
2406
+ $dc = "us1"; if (strstr($this->api_key,"-")){
2407
  list($key, $dc) = explode("-",$this->api_key,2);
2408
  if (!$dc) $dc = "us1";
2409
  }
2410
+
2411
  $this->apiUrl["prefix"] = $dc;
2412
  $host = $dc.".".$this->apiUrl["host"];
2413
  $params["apikey"] = $this->api_key;
2414
 
2415
  $this->errorMessage = "";
2416
  $this->errorCode = "";
2417
+ $error = false;
2418
+
 
 
 
 
 
2419
  $post_vars = http_build_query($params);
2420
+
2421
+ $s2_ags = array("user-agent" => "MCAPI/" . $this->version, "timeout" => $this->timeout);
2422
+ $s2_url = $host . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method;
2423
+ $s2_url = ($this->secure) ? "https://" . $s2_url : "http://" . $s2_url;
2424
+
2425
+ if (!is_array ($_response = c_ws_plugin__s2member_utils_urls::remote ($s2_url, $post_vars, $s2_ags, "array"))){
2426
+ $this->errorMessage = "Could not connect to API server.";
2427
+ $this->errorCode = "-99";
2428
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2429
  }
2430
+
2431
+ $headers = $_response["headers"];
2432
+ $body = $response = maybe_unserialize($_response["body"]);
2433
+
2434
+ if (!empty($headers["x-mailchimp-api-error-code"])){
2435
+ $error = trim($headers["x-mailchimp-api-error-code"]);
 
 
 
2436
  }
2437
+
2438
+ if($error && isset($response["error"], $response["code"])) {
2439
  $this->errorMessage = $response["error"];
2440
  $this->errorCode = $response["code"];
2441
  return false;
2442
+ } else if($error){
2443
+ $this->errorMessage = "No error message from API server.";
2444
+ $this->errorCode = $error;
2445
+ return false;
2446
+ } else if(!is_array($response) || empty($response)){
2447
+ $this->errorMessage = "No response from API server.";
2448
+ $this->errorCode = "-98";
2449
  return false;
2450
  }
2451
+
2452
  return $response;
2453
  }
2454
 
2455
  }
 
2456
  ?>
includes/classes/admin-lockouts.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_admin_lockouts"))
21
  {
@@ -41,16 +41,17 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
41
  {
42
  do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
43
  /**/
44
- if (!current_user_can ("edit_posts") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"] && apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ()))
45
- {
46
- if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
47
- wp_redirect($redirection_url); /* Special Redirection. */
48
- /**/
49
- else /* Else we use the Login Welcome Page configured for s2Member. */
50
- wp_redirect(get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
51
- /**/
52
- exit (); /* Clean exit. */
53
- }
 
54
  /**/
55
  do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
56
  /**/
@@ -76,7 +77,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
76
  if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts"))
77
  {
78
  if (isset ($wp_admin_bar->menu->{"dashboard"})) /* We don't need this. */
79
- unset($wp_admin_bar->menu->{"dashboard"}); /* Remove this entire menu. */
80
  /**/
81
  if (is_multisite () && !c_ws_plugin__s2member_utils_conds::is_multisite_farm () && isset ($wp_admin_bar->menu->{"my-blogs"}))
82
  {
@@ -87,7 +88,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
87
  if (is_array ($blog) && isset ($blog["href"], $blog["children"]) && is_object ($blog["children"]))
88
  {
89
  $blog["href"] = preg_replace ("/\/wp-admin/", "", $blog["href"]);
90
- unset($blog["children"]); /* Cause all we need is the link. */
91
  }
92
  }
93
  /**/
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
21
  {
41
  {
42
  do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
43
  /**/
44
+ if ((!defined ("DOING_AJAX") || !DOING_AJAX) && !current_user_can ("edit_posts") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"])
45
+ if (apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ()) /* Give Filters a chance here too. */)
46
+ {
47
+ if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
48
+ wp_redirect ($redirection_url); /* Special Redirection. */
49
+ /**/
50
+ else /* Else we use the Login Welcome Page configured for s2Member. */
51
+ wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
52
+ /**/
53
+ exit (); /* Clean exit. */
54
+ }
55
  /**/
56
  do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
57
  /**/
77
  if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts"))
78
  {
79
  if (isset ($wp_admin_bar->menu->{"dashboard"})) /* We don't need this. */
80
+ unset ($wp_admin_bar->menu->{"dashboard"}); /* Remove this entire menu. */
81
  /**/
82
  if (is_multisite () && !c_ws_plugin__s2member_utils_conds::is_multisite_farm () && isset ($wp_admin_bar->menu->{"my-blogs"}))
83
  {
88
  if (is_array ($blog) && isset ($blog["href"], $blog["children"]) && is_object ($blog["children"]))
89
  {
90
  $blog["href"] = preg_replace ("/\/wp-admin/", "", $blog["href"]);
91
+ unset ($blog["children"]); /* Cause all we need is the link. */
92
  }
93
  }
94
  /**/
includes/classes/auto-eots.inc.php CHANGED
@@ -119,7 +119,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
119
  {
120
  if (($user_id = $eot->ID) && is_object ($user = new WP_User ($user_id)) && $user->ID)
121
  {
122
- delete_user_option ($user_id, "s2member_auto_eot_time"); /* ALWAYS delete this. */
123
  /**/
124
  if (!$user->has_cap ("administrator")) /* Do NOT process Administrator accounts. */
125
  {
@@ -154,7 +154,6 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
154
  delete_user_option ($user_id, "s2member_subscr_gateway");
155
  /**/
156
  delete_user_option ($user_id, "s2member_ipn_signup_vars");
157
- /**/
158
  if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
159
  delete_user_option ($user_id, "s2member_paid_registration_times");
160
  /**/
@@ -192,7 +191,8 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
192
  /**/
193
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
194
  {
195
- c_ws_plugin__s2member_email_configs::email_config_release (); /* Release all Filters applied to wp_mail() From: headers. */
 
196
  /**/
197
  $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
198
  $msg .= "\n\n"; /* Spacing in the message body. */
@@ -239,6 +239,9 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
239
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
240
  ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
241
  }
 
 
 
242
  }
243
  /**/
244
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
119
  {
120
  if (($user_id = $eot->ID) && is_object ($user = new WP_User ($user_id)) && $user->ID)
121
  {
122
+ delete_user_option ($user_id, "s2member_auto_eot_time"); /* Always delete. */
123
  /**/
124
  if (!$user->has_cap ("administrator")) /* Do NOT process Administrator accounts. */
125
  {
154
  delete_user_option ($user_id, "s2member_subscr_gateway");
155
  /**/
156
  delete_user_option ($user_id, "s2member_ipn_signup_vars");
 
157
  if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
158
  delete_user_option ($user_id, "s2member_paid_registration_times");
159
  /**/
191
  /**/
192
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
193
  {
194
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
195
+ c_ws_plugin__s2member_email_configs::email_config_release ();
196
  /**/
197
  $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
198
  $msg .= "\n\n"; /* Spacing in the message body. */
239
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
240
  ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
241
  }
242
+ /**/
243
+ if ($email_configs_were_on) /* Back on? */
244
+ c_ws_plugin__s2member_email_configs::email_config ();
245
  }
246
  /**/
247
  eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
includes/classes/cache.inc.php CHANGED
@@ -44,51 +44,51 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
44
  {
45
  do_action ("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
46
  /**/
47
- $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
48
- $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
49
- $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
50
  /**/
51
- $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
52
- $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
53
- $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
54
  /**/
55
  $links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
56
  /**/
57
- if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes") && $login_welcome_page_cache["link"])
58
  {
59
- $links["login_welcome_page"] = $login_welcome_page_cache["link"];
60
  }
61
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
62
  {
 
63
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
64
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
65
- $links["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
66
  /**/
67
  $cache_needs_updating = true; /* Flag for cache update. */
68
  }
69
  /**/
70
- if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes") && $membership_options_page_cache["link"])
71
  {
72
- $links["membership_options_page"] = $membership_options_page_cache["link"];
73
  }
74
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
75
  {
 
76
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
77
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
78
- $links["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
79
  /**/
80
  $cache_needs_updating = true; /* Flag for cache update. */
81
  }
82
  /**/
83
- if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes") && $file_download_limit_exceeded_page_cache["link"])
84
  {
85
- $links["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
86
  }
87
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
88
  {
 
89
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
90
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
91
- $links["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
92
  /**/
93
  $cache_needs_updating = true; /* Flag for cache update. */
94
  }
@@ -100,7 +100,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
100
  /**/
101
  $scheme = (is_ssl ()) ? "https" : "http"; /* SSL mode? */
102
  foreach ($links as &$link) /* Conversions for SSL and non-SSL mode. */
103
- $link = preg_replace ("/^http(s)?\:\/\//i", $scheme . "://", $link);
104
  /**/
105
  return apply_filters ("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
106
  }
44
  {
45
  do_action ("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
46
  /**/
47
+ $lwp = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
48
+ $mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
49
+ $fdlep = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
50
  /**/
51
+ $lwp_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
52
+ $mop_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
53
+ $fdlep_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
54
  /**/
55
  $links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
56
  /**/
57
+ if (isset ($lwp_cache["page"], $lwp_cache["time"], $lwp_cache["link"]) && $lwp_cache["page"] === $lwp && $lwp_cache["time"] >= strtotime ("-15 minutes") && $lwp_cache["link"])
58
  {
59
+ $links["login_welcome_page"] = $lwp_cache["link"];
60
  }
61
+ else /* Otherwise, query the database using ``get_page_link()`` and update the cache. */
62
  {
63
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $lwp;
64
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
65
+ $links["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($lwp);
 
66
  /**/
67
  $cache_needs_updating = true; /* Flag for cache update. */
68
  }
69
  /**/
70
+ if (isset ($mop_cache["page"], $mop_cache["time"], $mop_cache["link"]) && $mop_cache["page"] === $mop && $mop_cache["time"] >= strtotime ("-15 minutes") && $mop_cache["link"])
71
  {
72
+ $links["membership_options_page"] = $mop_cache["link"];
73
  }
74
+ else /* Otherwise, query the database using ``get_page_link()`` and update the cache. */
75
  {
76
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $mop;
77
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
78
+ $links["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($mop);
 
79
  /**/
80
  $cache_needs_updating = true; /* Flag for cache update. */
81
  }
82
  /**/
83
+ if (isset ($fdlep_cache["page"], $fdlep_cache["time"], $fdlep_cache["link"]) && $fdlep_cache["page"] === $fdlep && $fdlep_cache["time"] >= strtotime ("-15 minutes") && $fdlep_cache["link"])
84
  {
85
+ $links["file_download_limit_exceeded_page"] = $fdlep_cache["link"];
86
  }
87
+ else /* Otherwise, query the database using ``get_page_link()`` and update the cache. */
88
  {
89
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $fdlep;
90
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
91
+ $links["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($fdlep);
 
92
  /**/
93
  $cache_needs_updating = true; /* Flag for cache update. */
94
  }
100
  /**/
101
  $scheme = (is_ssl ()) ? "https" : "http"; /* SSL mode? */
102
  foreach ($links as &$link) /* Conversions for SSL and non-SSL mode. */
103
+ $link = preg_replace ("/^https?\:\/\//i", $scheme . "://", $link);
104
  /**/
105
  return apply_filters ("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
106
  }
includes/classes/custom-reg-fields-4bp.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_custom_reg_fields_4bp"))
21
  {
@@ -61,7 +61,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
61
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
62
  }
63
  /**/
64
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  /**/
@@ -70,7 +70,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
70
  {
71
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
72
  {
73
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
74
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_custom_fields", get_defined_vars ());
75
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
76
  /**/
@@ -79,7 +79,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
79
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
80
  $field_id_class = preg_replace ("/_/", "-", $field_var);
81
  /**/
82
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
83
  if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
84
  {
85
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -94,7 +94,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
94
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
95
  }
96
  /**/
97
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
98
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_custom_fields", get_defined_vars ());
99
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
100
  }
@@ -102,7 +102,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
102
  /**/
103
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
104
  {
105
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
106
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_opt_in", get_defined_vars ());
107
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
108
  /**/
@@ -113,7 +113,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
113
  echo '</label>' . "\n";
114
  echo '</div>' . "\n";
115
  /**/
116
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
117
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_opt_in", get_defined_vars ());
118
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
119
  }
@@ -121,7 +121,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
121
  if ($close_section_container)
122
  echo '</div></div>' . "\n";
123
  /**/
124
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
125
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after", get_defined_vars ());
126
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
127
  }
@@ -149,13 +149,14 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
149
  /**/
150
  if (!$processed && in_array ("profile", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
151
  if (apply_filters ("ws_plugin__s2member_custom_profile_fields_4bp_display", true, get_defined_vars ()))
152
- if (bp_is_user_profile () && bp_is_profile_edit () && (int)bp_get_the_profile_group_id () === 1)
 
153
  if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
154
  if (($processed = true)) /* Mark as having been processed now. */
155
  {
156
  echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
157
  /**/
158
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
159
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
160
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
161
  /**/
@@ -167,7 +168,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
167
  /**/
168
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
169
  {
170
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
171
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
172
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
173
  /**/
@@ -176,7 +177,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
176
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
177
  $field_id_class = preg_replace ("/_/", "-", $field_var);
178
  /**/
179
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
180
  if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
181
  {
182
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -191,13 +192,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
191
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
  }
193
  /**/
194
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
195
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
196
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
197
  }
198
  }
199
  /**/
200
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
201
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
202
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
203
  }
@@ -225,11 +226,12 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
225
  /**/
226
  if (!$processed && in_array ("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
227
  if (apply_filters ("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars ()))
228
- if (bp_is_user_profile () && !bp_is_profile_edit () && (int)bp_get_the_profile_group_id () === 1)
 
229
  if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
230
  if (($processed = true)) /* Mark as having been processed now. */
231
  {
232
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
233
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
234
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
235
  /**/
@@ -241,7 +243,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
241
  /**/
242
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
243
  {
244
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
245
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
246
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
247
  /**/
@@ -250,7 +252,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
250
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
251
  $field_id_class = preg_replace ("/_/", "-", $field_var);
252
  /**/
253
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
254
  if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
255
  {
256
  if (!empty ($field["section"]) && $field["section"] === "yes") /* New section? */
@@ -268,13 +270,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
268
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
269
  }
270
  /**/
271
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
272
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
273
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
274
  }
275
  }
276
  /**/
277
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
278
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
279
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
280
  }
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
21
  {
61
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
62
  }
63
  /**/
64
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  /**/
70
  {
71
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
72
  {
73
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
74
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_custom_fields", get_defined_vars ());
75
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
76
  /**/
79
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
80
  $field_id_class = preg_replace ("/_/", "-", $field_var);
81
  /**/
82
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
83
  if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
84
  {
85
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
94
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
95
  }
96
  /**/
97
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
98
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_custom_fields", get_defined_vars ());
99
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
100
  }
102
  /**/
103
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
104
  {
105
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
106
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_opt_in", get_defined_vars ());
107
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
108
  /**/
113
  echo '</label>' . "\n";
114
  echo '</div>' . "\n";
115
  /**/
116
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
117
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_opt_in", get_defined_vars ());
118
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
119
  }
121
  if ($close_section_container)
122
  echo '</div></div>' . "\n";
123
  /**/
124
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
125
  do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after", get_defined_vars ());
126
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
127
  }
149
  /**/
150
  if (!$processed && in_array ("profile", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
151
  if (apply_filters ("ws_plugin__s2member_custom_profile_fields_4bp_display", true, get_defined_vars ()))
152
+ if (bp_is_user_profile () && (( /* BuddyPress v1.5. */function_exists ("bp_is_user_profile_edit") && bp_is_user_profile_edit ())/**/
153
+ || ( /* for BuddyPress < v1.5. */function_exists ("bp_is_profile_edit") && bp_is_profile_edit ())) && (int)bp_get_the_profile_group_id () === 1)
154
  if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
155
  if (($processed = true)) /* Mark as having been processed now. */
156
  {
157
  echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
158
  /**/
159
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
160
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
161
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
162
  /**/
168
  /**/
169
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
170
  {
171
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
172
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
173
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
174
  /**/
177
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
178
  $field_id_class = preg_replace ("/_/", "-", $field_var);
179
  /**/
180
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
181
  if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
182
  {
183
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
192
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
193
  }
194
  /**/
195
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
196
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
197
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
198
  }
199
  }
200
  /**/
201
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
202
  do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
203
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
204
  }
226
  /**/
227
  if (!$processed && in_array ("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
228
  if (apply_filters ("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars ()))
229
+ if (bp_is_user_profile () && (( /* BuddyPress v1.5. */function_exists ("bp_is_user_profile_edit") && !bp_is_user_profile_edit ())/**/
230
+ || ( /* for BuddyPress < v1.5. */function_exists ("bp_is_profile_edit") && !bp_is_profile_edit ())) && (int)bp_get_the_profile_group_id () === 1)
231
  if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
232
  if (($processed = true)) /* Mark as having been processed now. */
233
  {
234
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
235
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
236
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
237
  /**/
243
  /**/
244
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
245
  {
246
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
247
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
248
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
249
  /**/
252
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
253
  $field_id_class = preg_replace ("/_/", "-", $field_var);
254
  /**/
255
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
256
  if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
257
  {
258
  if (!empty ($field["section"]) && $field["section"] === "yes") /* New section? */
270
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
271
  }
272
  /**/
273
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
274
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
275
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
  }
277
  }
278
  /**/
279
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
280
  do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
281
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
282
  }
includes/classes/email-configs.inc.php CHANGED
@@ -49,7 +49,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
49
  return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
50
  }
51
  /**
52
- * Modifies email From: "Name" <address>.
53
  *
54
  * These Filters are only needed during registration.
55
  *
@@ -62,8 +62,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
62
  {
63
  do_action ("ws_plugin__s2member_before_email_config", get_defined_vars ());
64
  /**/
65
- c_ws_plugin__s2member_email_configs::email_config_release (); /* Release all. */
66
- /**/
67
  add_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
68
  add_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
69
  /**/
@@ -111,10 +110,10 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
111
  * @package s2Member\Email_Configs
112
  * @since 3.5
113
  *
114
- * @param bool $any Optional. Defaults to true. If true, return true if ANY Filters are being applied, not just those applied by s2Member.
115
  * @return bool True if Filters are being applied, else false.
116
  */
117
- public static function email_config_status ($any = TRUE)
118
  {
119
  do_action ("ws_plugin__s2member_before_email_config_status", get_defined_vars ());
120
  /**/
@@ -132,17 +131,17 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
132
  * @package s2Member\Email_Configs
133
  * @since 3.5
134
  *
135
- * @param bool $all Optional. Defaults to true. If true, remove ALL Filters, not just those applied by s2Member.
136
  * @return null
137
  */
138
- public static function email_config_release ($all = TRUE)
139
  {
140
  do_action ("ws_plugin__s2member_before_email_config_release", get_defined_vars ());
141
  /**/
142
  remove_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
143
  remove_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
144
  /**/
145
- if ($all) /* If $all is true, then we remove all attached WordPress® Filters. */
146
  remove_all_filters("wp_mail_from") . remove_all_filters ("wp_mail_from_name");
147
  /**/
148
  do_action ("ws_plugin__s2member_after_email_config_release", get_defined_vars ());
@@ -190,9 +189,12 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
190
  do_action ("ws_plugin__s2member_before_new_user_notification", get_defined_vars ());
191
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
  /**/
193
- if ($user_id && ($user = new WP_User ($user_id)) && ($user_id = $user->ID) && is_array ($notify) && !empty ($notify))
194
  {
195
- if (in_array ("user", $notify) && !empty ($user_pass)) /* Send User a notification? */
 
 
 
196
  {
197
  $fields = get_user_option ("s2member_custom_fields", $user_id);
198
  $cv = preg_split ("/\|/", get_user_option ("s2member_custom", $user_id));
@@ -234,9 +236,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
234
  break;
235
  /**/
236
  if (($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
237
- {
238
- wp_mail ('"' . c_ws_plugin__s2member_utils_strings::esc_dq ($user_full_name) . '" <' . $user->user_email . '>', $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
239
- }
240
  }
241
  }
242
  }
@@ -309,6 +309,9 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
309
  }
310
  }
311
  /**/
 
 
 
312
  return apply_filters ("ws_plugin__s2member_new_user_notification", true, get_defined_vars ());
313
  }
314
  else
49
  return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
50
  }
51
  /**
52
+ * Modifies email From: `"Name" <address>`.
53
  *
54
  * These Filters are only needed during registration.
55
  *
62
  {
63
  do_action ("ws_plugin__s2member_before_email_config", get_defined_vars ());
64
  /**/
65
+ c_ws_plugin__s2member_email_configs::email_config_release ();
 
66
  add_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
67
  add_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
68
  /**/
110
  * @package s2Member\Email_Configs
111
  * @since 3.5
112
  *
113
+ * @param bool $any Optional. Defaults to false. If true, return true if ANY Filters are being applied, not just those applied by s2Member.
114
  * @return bool True if Filters are being applied, else false.
115
  */
116
+ public static function email_config_status ($any = FALSE)
117
  {
118
  do_action ("ws_plugin__s2member_before_email_config_status", get_defined_vars ());
119
  /**/
131
  * @package s2Member\Email_Configs
132
  * @since 3.5
133
  *
134
+ * @param bool $all Optional. Defaults to false. If true, remove ALL Filters, not just those applied by s2Member.
135
  * @return null
136
  */
137
+ public static function email_config_release ($all = FALSE)
138
  {
139
  do_action ("ws_plugin__s2member_before_email_config_release", get_defined_vars ());
140
  /**/
141
  remove_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
142
  remove_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
143
  /**/
144
+ if ($all) /* If ``$all`` is true, remove ALL attached WordPress® Filters. */
145
  remove_all_filters("wp_mail_from") . remove_all_filters ("wp_mail_from_name");
146
  /**/
147
  do_action ("ws_plugin__s2member_after_email_config_release", get_defined_vars ());
189
  do_action ("ws_plugin__s2member_before_new_user_notification", get_defined_vars ());
190
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
191
  /**/
192
+ if ($user_id && ($user = new WP_User ($user_id)) && !empty ($user->ID) && ($user_id = $user->ID) && is_array ($notify) && !empty ($notify))
193
  {
194
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
195
+ c_ws_plugin__s2member_email_configs::email_config_release ();
196
+ /**/
197
+ if (in_array ("user", $notify) && $user_pass) /* Send User a notification? */
198
  {
199
  $fields = get_user_option ("s2member_custom_fields", $user_id);
200
  $cv = preg_split ("/\|/", get_user_option ("s2member_custom", $user_id));
236
  break;
237
  /**/
238
  if (($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
239
+ c_ws_plugin__s2member_email_configs::email_config () . wp_mail ('"' . c_ws_plugin__s2member_utils_strings::esc_dq ($user_full_name) . '" <' . $user->user_email . '>', $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
 
 
240
  }
241
  }
242
  }
309
  }
310
  }
311
  /**/
312
+ if ($email_configs_were_on) /* Back on? */
313
+ c_ws_plugin__s2member_email_configs::email_config ();
314
+ /**/
315
  return apply_filters ("ws_plugin__s2member_new_user_notification", true, get_defined_vars ());
316
  }
317
  else
includes/classes/files-in.inc.php CHANGED
@@ -34,257 +34,1250 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
34
  * @since 3.5
35
  *
36
  * @attaches-to: ``add_action("init");``
 
37
  *
38
- * @return null Or exits script execution after serving a File Download.
 
 
 
39
  */
40
- public static function check_file_download_access ()
41
  {
 
42
  do_action ("ws_plugin__s2member_before_file_download_access", get_defined_vars ());
 
43
  /**/
44
- if (!empty ($_GET["s2member_file_download"])) /* Ignore `..`, and `^.` files like `.htaccess`. */
45
- if (strpos ($_GET["s2member_file_download"], "..") === false) /* Ignore `..` if it appears anywhere. */
46
- if (strpos (basename ($_GET["s2member_file_download"]), ".") !== 0) /* Ignore any/all hidden files. */
47
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  @set_time_limit(0) . @ini_set ("zlib.output_compression", 0) . eval ('while (@ob_end_clean ());');
49
- /**/
50
- $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
51
- /**/
52
- if (!($using_amazon_s3_storage = 0) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"])
53
- $using_amazon_s3_storage = true; /* Amazon® S3 storage has been configured! */
54
- /**/
55
- if (!$excluded && (empty ($_GET["s2member_file_download_key"]) || (!empty ($_GET["s2member_file_download_key"]) && !($file_download_key_is_valid = ($_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"]) || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], "ip-forever") || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], "universal"))))))
56
- {
57
- $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Trim slashes after Key comparison. */
58
- /**/
59
- if (!$using_amazon_s3_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
60
- {
 
 
 
61
  status_header(404) . exit (_x ("404: Sorry, file not found. Please contact Support for assistance.", "s2member-front", "s2member"));
62
- }
63
- /**/
64
- else if (!empty ($_GET["s2member_file_download_key"]) && !$file_download_key_is_valid)
65
- {
 
 
 
 
66
  status_header(503) . exit (_x ("503 ( Invalid Key ): Sorry, your access to this file has expired. Please contact Support for assistance.", "s2member-front", "s2member"));
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  /**/
69
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] || ($file_download_access_is_allowed = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
70
  {
71
- if (!has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::_file_remote_authorization"))
72
- add_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::_file_remote_authorization", 10, 2);
73
- /**/
74
- if ((isset ($file_download_access_is_allowed, $min_level_4_downloads) && $file_download_access_is_allowed === false) || ($file_download_access_is_allowed = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
75
- {
76
- status_header(503) . exit (_x ("503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`.", "s2member-front", "s2member"));
77
- }
78
- /**/
79
- else if (!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ((is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || !($user_id = $user->ID))
80
- {
81
- if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $_GET["s2member_file_download"], $m))
82
- {
83
- $level_req = $m[1]; /* Which Level does this require? */
84
- if (wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
85
- exit ();
86
- }
87
- else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $_GET["s2member_file_download"], $m))
88
- {
89
- $ccap_req = preg_replace ("/-/", "_", $m[1]); /* Which Capability does this require? */
90
- if (wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
91
- exit ();
92
- }
93
- else if (wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => (string)$min_level_4_downloads)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
94
- exit ();
95
- }
96
- /**/
97
- else if ((!is_array ($file_downloads = c_ws_plugin__s2member_files::user_downloads ($user)) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
98
- && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
99
- exit ();
100
- /**/
101
- else if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $_GET["s2member_file_download"], $m))
102
- {
103
- $level_req = $m[1]; /* Which Level does this require? */
104
- if (!$user->has_cap ("access_s2member_level" . $level_req) /* Does the User have access to this Level? */
105
- && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
106
- exit ();
107
- }
108
  /**/
109
- else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $_GET["s2member_file_download"], $m))
110
  {
111
- $ccap_req = preg_replace ("/-/", "_", $m[1]); /* Which Capability does this require? */
112
- if (!$user->has_cap ("access_s2member_ccap_" . $ccap_req) /* Does the User have access to this Custom Capability? */
113
- && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
114
- exit ();
 
 
 
 
 
 
 
 
 
 
115
  }
 
 
 
116
  /**/
117
- $already_downloaded = false; /* Initialize this to a false value. */
118
- $previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
119
- $max_days_logged = c_ws_plugin__s2member_files::max_download_period (); /* Longest period/days. */
120
- $file_download_access_log = (array)get_user_option ("s2member_file_download_access_log", $user_id);
121
- $file_download_access_arc = (array)get_user_option ("s2member_file_download_access_arc", $user_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  /**/
123
- foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
124
  {
125
- if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $max_days_logged . " days"))
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  {
127
- unset($file_download_access_log[$file_download_access_log_entry_key]);
128
- $file_download_access_arc[] = $file_download_access_log_entry;
129
- }
130
- else if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . $file_downloads["allowed_days"] . " days"))
131
- {
132
- $previous_file_downloads++;
133
- if ($file_download_access_log_entry["file"] === $_GET["s2member_file_download"])
134
- $already_downloaded = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
 
 
136
  }
 
 
 
137
  /**/
138
- if (!$already_downloaded && $previous_file_downloads >= $file_downloads["allowed"] /* They have NOT already downloaded this file, and they're over their limit. */
139
- && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
140
- exit ();
141
- /**/
142
- if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
143
- $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
144
- /**/
145
- update_user_option ($user_id, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_arc));
146
- update_user_option ($user_id, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_log));
147
- }
148
- }
149
- else /* Otherwise... it's either $excluded; or permission was granted with a valid Download Key. */
150
- {
151
- $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
152
- /**/
153
- if (!$using_amazon_s3_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
154
- {
155
- status_header(404) . exit (_x ("404: Sorry, file not found. Please contact Support for assistance.", "s2member-front", "s2member"));
156
  }
 
 
157
  }
158
- /*
159
- Here we are going to put together all of the File Download information.
160
- */
161
- $extension = strtolower (substr ($_GET["s2member_file_download"], strrpos ($_GET["s2member_file_download"], ".") + 1)); /* To lowercase. */
162
- /**/
163
- $mimetypes = parse_ini_file (dirname (dirname (dirname (__FILE__))) . "/includes/mime-types.ini"); /* Types provided by: `mime-types.ini`. */
164
- $mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream"; /* Lookup the MIME type for this file extension. */
165
- /**/
166
- $inline = (isset ($_GET["s2member_file_inline"])) ? filter_var ($_GET["s2member_file_inline"], FILTER_VALIDATE_BOOLEAN) : ((in_array ($extension, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]))) ? true : false);
167
- /**/
168
- $basename = basename ($_GET["s2member_file_download"]); /* The actual name of this File Download ( i.e. the basename ); including its file extension too. */
169
  /**/
170
- $pathinfo = (!$using_amazon_s3_storage) ? pathinfo (($file = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"])) : array ();
171
- $length = (!$using_amazon_s3_storage && $file) ? filesize ($file) : -1; /* The overall file size, in bytes. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /**/
173
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
174
- do_action ("ws_plugin__s2member_during_file_download_access", get_defined_vars ());
175
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  /**/
177
- if ($using_amazon_s3_storage) /* Using Amazon® S3 storage? In this case, we use an authenticated redirection to S3 storage. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  {
179
- $amazon_s3_file_expires = strtotime ("+" . apply_filters ("ws_plugin__s2member_amazon_s3_file_expires_time", "30 seconds", get_defined_vars ()));
 
 
180
  /**/
181
- $amazon_s3_file = "/" . $_GET["s2member_file_download"] . "?response-cache-control=" . urlencode (($amazon_s3_cache_control = "no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0")) . "&response-content-disposition=" . urlencode (($amazon_s3_content_disposition = (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"')) . "&response-content-type=" . urlencode (($amazon_s3_content_type = $mimetype)) . "&response-expires=" . urlencode (($amazon_s3_expires = gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT"));
182
- $amazon_s3_raw_file = "/" . $_GET["s2member_file_download"] . "?response-cache-control=" . $amazon_s3_cache_control . "&response-content-disposition=" . $amazon_s3_content_disposition . "&response-content-type=" . $amazon_s3_content_type . "&response-expires=" . $amazon_s3_expires;
183
- $amazon_s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("GET\n\n\n" . $amazon_s3_file_expires . "\n" . "/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . $amazon_s3_raw_file));
184
  /**/
185
- $amazon_s3_redirection_url = "http://" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . ".s3.amazonaws.com" . $amazon_s3_file;
186
- if (strtolower ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"]) !== $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"])
187
- $amazon_s3_redirection_url = "http://s3.amazonaws.com/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . $amazon_s3_file;
 
 
 
188
  /**/
189
- $amazon_s3_redirection_url .= "&AWSAccessKeyId=" . urlencode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"]);
190
- $amazon_s3_redirection_url .= "&Expires=" . urlencode ($amazon_s3_file_expires);
191
- $amazon_s3_redirection_url .= "&Signature=" . urlencode ($amazon_s3_signature);
192
  /**/
193
- wp_redirect($amazon_s3_redirection_url) . exit ();
194
- }
195
- /**/
196
- else /* Else, using localized storage ( default ). */
197
- {
198
- status_header(200);
199
- header("Accept-Ranges: none");
200
- header("Content-Encoding: none");
201
- header("Content-Type: " . $mimetype);
202
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
203
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
204
- header("Cache-Control: no-cache, must-revalidate, max-age=0");
205
- header ("Cache-Control: post-check=0, pre-check=0", false);
206
- header("Pragma: no-cache");
207
  /**/
208
- header('Content-Disposition: ' . (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"');
209
- /**/
210
- if ($length && apply_filters ("ws_plugin__s2member_stream_file_downloads", true, get_defined_vars ()) && ($stream = fopen ($file, "rb")))
211
- {
212
- $_stream_w_content_length = (stripos (PHP_OS, "win") === 0 && (!function_exists ("apache_get_version") || apache_get_version () === false)) ? false : true;
213
- /* Windows® IIS doesn't seem to like it when both `Content-Length` and `Transfer-Encoding: chunked` are sent together. */
214
- if (apply_filters ("ws_plugin__s2member_stream_file_downloads_w_content_length", $_stream_w_content_length, get_defined_vars ()))
215
- header("Content-Length: " . $length);
216
- /**/
217
- header("Transfer-Encoding: chunked"); /* Uses `Transfer-Encoding: chunked` for simulated streaming. */
218
- /**/
219
- while (!feof ($stream) && ($chunk_size = strlen ($data = fread ($stream, 2097152))))
220
- eval('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
221
- /**/
222
- fclose($stream) . exit ("0\r\n\r\n");
223
- }
224
- else if ($length) /* Else `file_get_contents()`. */
225
- {
226
- header("Content-Length: " . $length) . exit (file_get_contents ($file));
227
- }
228
- else /* Else, we have an empty file. */
229
- {
230
- header("Content-Length: 0") . exit (); /* Empty file. */
231
- }
232
  }
 
 
233
  }
234
- /**/
235
- do_action ("ws_plugin__s2member_after_file_download_access", get_defined_vars ());
 
 
 
236
  }
237
  /**
238
- * Creates an Amazon® S3 HMAC-SHA1 signature.
239
  *
240
  * @package s2Member\Files
241
- * @since 110524RC
242
  *
243
- * @param str $data Input data, to be signed by this routine.
244
- * @return str An HMAC-SHA1 signature for Amazon® S3.
 
 
 
245
  */
246
- public static function amazon_s3_sign ($data = FALSE)
247
  {
248
- $key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
249
- $key = str_pad (((strlen ($key) > 64) ? pack ('H*', sha1 ($key)) : $key), 64, chr (0x00));
250
- return pack ('H*', sha1 (($key ^ str_repeat (chr (0x5c), 64)) . pack ('H*', sha1 (($key ^ str_repeat (chr (0x36), 64)) . $data))));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
252
  /**
253
- * A sort of callback function that handles Header Authorization for File Downloads.
254
  *
255
  * @package s2Member\Files
256
- * @since 3.5
257
  *
258
- * @attaches-to: ``add_filter("ws_plugin__s2member_check_file_download_access_user");``
259
- *
260
- * @param obj $user Expects a WP_User object passed in by the Filter.
261
- * @return obj A WP_User object, possibly obtained through Header Authorization.
262
  */
263
- public static function _file_remote_authorization ($user = FALSE)
264
  {
265
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
266
- do_action ("_ws_plugin__s2member_before_file_remote_authorization", get_defined_vars ());
267
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
268
- /**/
269
- if (!is_object ($user) && isset ($_GET["s2member_file_remote"]) && filter_var ($_GET["s2member_file_remote"], FILTER_VALIDATE_BOOLEAN))
270
  {
271
- do_action ("_ws_plugin__s2member_during_file_remote_authorization_before", get_defined_vars ());
 
 
272
  /**/
273
- if (empty ($_SERVER["PHP_AUTH_USER"]) || empty ($_SERVER["PHP_AUTH_PW"]) || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
 
 
 
 
 
 
 
 
274
  {
275
- header('WWW-Authenticate: Basic realm="' . _x ("Members Only", "s2member-front", "s2member") . '"');
276
- status_header(401); /* Unauthorized status header. */
277
- exit(_x ("Access Denied", "s2member-front", "s2member"));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  }
279
- else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && $_user->ID)
 
280
  {
281
- $user = $_user; /* Now assign $user. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  }
283
- /**/
284
- do_action ("_ws_plugin__s2member_during_file_remote_authorization_after", get_defined_vars ());
285
  }
286
- /**/
287
- return apply_filters ("_ws_plugin__s2member_file_remote_authorization", $user, get_defined_vars ());
288
  }
289
  }
290
  }
34
  * @since 3.5
35
  *
36
  * @attaches-to: ``add_action("init");``
37
+ * @also-called-by: API Function {@link s2Member\API_Functions\s2member_file_download_url()}, w/ ``$create_file_download_url`` param.
38
  *
39
+ * @param array $create_file_download_url Optional. If this function is called directly, we can pass arguments through this array.
40
+ * Possible array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `ignore_user`.
41
+ * @return null|str If called directly with ``$create_file_download_url``, returns a string with the URL, based on configuration.
42
+ * Else, this function may exit script execution after serving a File Download.
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
  /**/
50
+ $_g = !empty ($_GET) ? $_GET : array ();
51
+ $_g = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_g));
52
+ /**/
53
+ $creating = (is_array ($create = $create_file_download_url)) ? true : false; /* Creating URL? */
54
+ $serving = (!$creating) ? true : false; /* If NOT creating a File Download URL, we're serving one. */
55
+ /**/
56
+ $req["file_download"] = ($creating) ? @$create["file_download"] : @$_g["s2member_file_download"];
57
+ $req["file_download_key"] = ($creating) ? @$create["file_download_key"] : @$_g["s2member_file_download_key"];
58
+ /**/
59
+ $req["file_stream"] = ($creating) ? @$create["file_stream"] : @$_g["s2member_file_stream"];
60
+ $req["file_inline"] = ($creating) ? @$create["file_inline"] : @$_g["s2member_file_inline"];
61
+ $req["file_storage"] = ($creating) ? @$create["file_storage"] : @$_g["s2member_file_storage"];
62
+ $req["file_remote"] = ($creating) ? @$create["file_remote"] : @$_g["s2member_file_remote"];
63
+ $req["file_ssl"] = ($creating) ? @$create["file_ssl"] : @$_g["s2member_file_ssl"];
64
+ /**/
65
+ $req["file_rewrite"] = ($creating) ? @$create["file_rewrite"] : /* N/A. */ null;
66
+ $req["file_rewrite_base"] = ($creating) ? @$create["file_rewrite_base"] : /* N/A. */ null;
67
+ /**/
68
+ $req["skip_confirmation"] = ($creating) ? @$create["skip_confirmation"] : /* N/A. */ null;
69
+ $req["url_to_storage_source"] = ($creating) ? @$create["url_to_storage_source"] : /* N/A. */ null;
70
+ $req["count_against_user"] = ($creating) ? @$create["count_against_user"] : /* N/A. */ null;
71
+ $req["ignore_user"] = ($creating) ? @$create["ignore_user"] : /* N/A. */ null;
72
+ /**/
73
+ if ($req["file_download"] && is_string ($req["file_download"]) && ($req["file_download"] = trim ($req["file_download"], "/")))
74
+ if (strpos ($req["file_download"], "..") === false && strpos (basename ($req["file_download"]), ".") !== 0)
75
+ {
76
+ if ($serving) /* We only need this section when/if we're actually serving. */
77
  @set_time_limit(0) . @ini_set ("zlib.output_compression", 0) . eval ('while (@ob_end_clean ());');
78
+ /**/
79
+ $using_amazon_s3_storage = ((!$req["file_storage"] || strcasecmp ((string)$req["file_storage"], "s3") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage ()) ? true : false;
80
+ $using_amazon_cf_storage = ((!$req["file_storage"] || strcasecmp ((string)$req["file_storage"], "cf") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage ()) ? true : false;
81
+ $using_amazon_storage = ($using_amazon_s3_storage || $using_amazon_cf_storage) ? true : false; /* Either/or? */
82
+ /**/
83
+ $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
84
+ $valid_file_download_key = ($req["file_download_key"] && is_string ($req["file_download_key"])) ? c_ws_plugin__s2member_files_in::check_file_download_key ($req["file_download"], $req["file_download_key"]) : false;
85
+ $checking_user = ($excluded || $valid_file_download_key || ($creating && isset ($req["ignore_user"]) && filter_var ($req["ignore_user"], FILTER_VALIDATE_BOOLEAN))) ? false : true; /* Checking User? */
86
+ $updating_user_counter = (!$checking_user || ($creating && (!isset ($req["count_against_user"]) || !filter_var ($req["count_against_user"], FILTER_VALIDATE_BOOLEAN)))) ? false : true;
87
+ /**/
88
+ if (($serving || $creating) && $checking_user) /* In either case, the following routines apply whenever we ARE ``$checking_user``. */
89
+ {
90
+ if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
91
+ {
92
+ if ($serving) /* We only need this section when/if we're actually serving. */
93
  status_header(404) . exit (_x ("404: Sorry, file not found. Please contact Support for assistance.", "s2member-front", "s2member"));
94
+ /**/
95
+ else /* Else return false. */
96
+ return false;
97
+ }
98
+ /**/
99
+ else if ($req["file_download_key"] && is_string ($req["file_download_key"]) && !$valid_file_download_key)
100
+ {
101
+ if ($serving) /* We only need this section when/if we're actually serving. */
102
  status_header(503) . exit (_x ("503 ( Invalid Key ): Sorry, your access to this file has expired. Please contact Support for assistance.", "s2member-front", "s2member"));
103
+ /**/
104
+ else /* Else return false. */
105
+ return false;
106
+ }
107
+ /**/
108
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] || ($file_downloads_enabled = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
109
+ {
110
+ if ($serving) /* We only need remote functionality when/if we're actually serving. */
111
+ if (!has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization"))
112
+ add_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
113
+ /**/
114
+ if ($creating) /* We only need remote functionality when/if we're actually serving. */
115
+ if (has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization"))
116
+ remove_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
117
+ /**/
118
+ if ((isset ($file_downloads_enabled, $min_level_4_downloads) && $file_downloads_enabled === false) || ($file_downloads_enabled = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
119
+ {
120
+ if ($serving) /* We only need this section when/if we're actually serving. */
121
+ status_header(503) . exit (_x ("503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`.", "s2member-front", "s2member"));
122
+ /**/
123
+ else /* Else return false. */
124
+ return false;
125
+ }
126
+ /**/
127
+ else if (!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ((is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || empty ($user->ID) || !($user_id = $user->ID))
128
+ {
129
+ if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m))
130
+ {
131
+ $level_req = $m[1]; /* Memebership Level required. */
132
+ /**/
133
+ if ($serving) /* We only need this section when/if we're actually serving. */
134
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
135
+ /**/
136
+ else /* Else return false. */
137
+ return false;
138
+ }
139
+ /**/
140
+ else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $req["file_download"], $m))
141
+ {
142
+ $ccap_req = preg_replace ("/-/", "_", $m[1]); /* Custom Capability required. */
143
+ /**/
144
+ if ($serving) /* We only need this section when/if we're actually serving. */
145
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
146
+ /**/
147
+ else /* Else return false. */
148
+ return false;
149
+ }
150
+ /**/
151
+ else if ($serving) /* We only need this section when/if we're actually serving. */
152
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_level_req" => (string)$min_level_4_downloads)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
153
+ /**/
154
+ else /* Else return false. */
155
+ return false;
156
+ }
157
+ /**/
158
+ else if (!is_array ($file_downloads = c_ws_plugin__s2member_files::user_downloads ($user)) || (!$user->has_cap ("administrator") && (!$file_downloads["allowed"] || !$file_downloads["allowed_days"])))
159
+ {
160
+ if ($serving) /* We only need this section when/if we're actually serving. */
161
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
162
+ /**/
163
+ else /* Else return false. */
164
+ return false;
165
+ }
166
+ /**/
167
+ else if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m) && strlen ($level_req = $m[1]) && !$user->has_cap ("access_s2member_level" . $level_req))
168
+ {
169
+ if ($serving) /* We only need this section when/if we're actually serving. */
170
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
171
+ /**/
172
+ else /* Else return false. */
173
+ return false;
174
+ }
175
+ /**/
176
+ else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $req["file_download"], $m) && strlen ($ccap_req = preg_replace ("/-/", "_", $m[1])) && !$user->has_cap ("access_s2member_ccap_" . $ccap_req))
177
+ {
178
+ if ($serving) /* We only need this section when/if we're actually serving. */
179
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
180
+ /**/
181
+ else /* Else return false. */
182
+ return false;
183
+ }
184
+ /**/
185
+ else if ($serving || $creating) /* In either case, the following routines apply. */
186
+ {
187
+ $already_downloaded = $streaming_variation_already_downloaded = false;
188
+ $previous_file_downloads = 0; /* Here we're going to count how many downloads they have. */
189
+ $max_days_logged = c_ws_plugin__s2member_files::max_download_period (); /* Max period/days. */
190
+ $file_download_access_log = (array)get_user_option ("s2member_file_download_access_log", $user_id);
191
+ $file_download_access_arc = (array)get_user_option ("s2member_file_download_access_arc", $user_id);
192
+ $streaming_file_extns = c_ws_plugin__s2member_utils_strings::preg_quote_deep ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"], "/");
193
+ $streaming_variations = /* Only count one streaming media file variation. */ "/\.(" . implode ("|", $streaming_file_extns) . ")$/i";
194
+ /**/
195
+ foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
196
+ {
197
+ if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $max_days_logged . " days"))
198
+ {
199
+ unset($file_download_access_log[$file_download_access_log_entry_key]);
200
+ $file_download_access_arc[] = $file_download_access_log_entry;
201
+ }
202
+ else if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . $file_downloads["allowed_days"] . " days"))
203
+ {
204
+ $previous_file_downloads++; /* A previous file that counts. */
205
+ /**/
206
+ if ($file_download_access_log_entry["file"] === $req["file_download"]) /* Already downloaded this file? Or another streaming variation? */
207
+ $already_downloaded = true; /* Already downloaded this file? Or another streaming variation? */
208
+ /**/
209
+ else if (preg_replace ($streaming_variations, "", $file_download_access_log_entry["file"]) === preg_replace ($streaming_variations, "", $req["file_download"]))
210
+ $already_downloaded = $streaming_variation_already_downloaded = true;
211
+ }
212
+ }
213
+ /**/
214
+ if (!$already_downloaded && !$streaming_variation_already_downloaded && !$user->has_cap ("administrator") && $previous_file_downloads >= $file_downloads["allowed"])
215
+ {
216
+ if ($serving) /* We only need this section when/if we're actually serving. */
217
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $req["file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
218
+ /**/
219
+ else /* Else return false. */
220
+ return false;
221
+ }
222
+ /**/
223
+ else if (!$already_downloaded && !$streaming_variation_already_downloaded)
224
+ $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $req["file_download"]);
225
+ /**/
226
+ if ($updating_user_counter) /* By default, we do NOT update the counter when a URL is being created; but this behavior can be modified. */
227
+ {
228
+ update_user_option ($user_id, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_arc));
229
+ update_user_option ($user_id, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_log));
230
+ }
231
+ }
232
+ }
233
+ }
234
+ else /* Otherwise, we're either NOT ``$checking_user``; or permission was granted with a valid File Download Key. */
235
+ {
236
+ if (!$using_amazon_storage && !file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]))
237
+ {
238
+ if ($serving) /* We only need this section when/if we're actually serving. */
239
+ status_header(404) . exit (_x ("404: Sorry, file not found. Please contact Support for assistance.", "s2member-front", "s2member"));
240
+ /**/
241
+ else /* Else return false. */
242
+ return false;
243
+ }
244
+ }
245
+ /**/
246
+ if ($serving || $creating) /* In either case, the following routines apply. */
247
+ {
248
+ $basename = basename ($req["file_download"]);
249
+ $mimetypes = parse_ini_file (dirname (dirname (dirname (__FILE__))) . "/includes/mime-types.ini");
250
+ $extension = strtolower (substr ($req["file_download"], strrpos ($req["file_download"], ".") + 1));
251
+ /**/
252
+ $key = ($req["file_download_key"] && is_string ($req["file_download_key"])) ? $req["file_download_key"] : false;
253
+ /**/
254
+ $stream = (isset ($req["file_stream"])) ? filter_var ($req["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);
255
+ $inline = (!$stream && isset ($req["file_inline"])) ? filter_var ($req["file_inline"], FILTER_VALIDATE_BOOLEAN) : (($stream || in_array ($extension, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]))) ? true : false);
256
+ $ssl = (isset ($req["file_ssl"])) ? filter_var ($req["file_ssl"], FILTER_VALIDATE_BOOLEAN) : ((is_ssl ()) ? true : false);
257
+ $storage = ($req["file_storage"] && is_string ($req["file_storage"])) ? strtolower ($req["file_storage"]) : false;
258
+ $remote = (isset ($req["file_remote"])) ? filter_var ($req["file_remote"], FILTER_VALIDATE_BOOLEAN) : false;
259
+ /**/
260
+ $rewrite_base_guess = dirname ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . "/" . c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]);
261
+ $rewrite_base = ($req["file_rewrite_base"] && is_string ($req["file_rewrite_base"])) ? $req["file_rewrite_base"] : false;
262
+ $rewrite = $rewriting = (!$rewrite_base && isset ($req["file_rewrite"])) ? filter_var ($req["file_rewrite"], FILTER_VALIDATE_BOOLEAN) : (($rewrite_base) ? true : false);
263
+ /**/
264
+ $skip_confirmation = (isset ($req["skip_confirmation"])) ? filter_var ($req["skip_confirmation"], FILTER_VALIDATE_BOOLEAN) : false;
265
+ $url_to_storage_source = (isset ($req["url_to_storage_source"])) ? filter_var ($req["url_to_storage_source"], FILTER_VALIDATE_BOOLEAN) : false;
266
+ /**/
267
+ $pathinfo = (!$using_amazon_storage) ? pathinfo (($file = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"])) : array ();
268
+ $mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream";
269
+ $length = (!$using_amazon_storage && $file) ? filesize ($file) : -1;
270
+ /**/
271
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
272
+ do_action ("ws_plugin__s2member_during_file_download_access", get_defined_vars ());
273
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
274
+ /**/
275
+ if ($using_amazon_s3_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_s3_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_s3_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars ());
282
+ }
283
+ /**/
284
+ else if ($using_amazon_cf_storage && ($serving || ($creating && $url_to_storage_source)))
285
+ {
286
+ if ($serving) /* We only need this section when/if we're actually serving. */
287
+ wp_redirect(c_ws_plugin__s2member_files_in::amazon_cf_url ($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit ();
288
+ /**/
289
+ else /* Else return File Download URL. */
290
+ 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 ());
291
+ }
292
+ /**/
293
+ else if ($creating && $rewriting) /* Creating a rewrite URL, pointing to local storage. */
294
+ {
295
+ $url = ($rewrite_base) ? rtrim ($rewrite_base, "/") : rtrim ($rewrite_base_guess, "/");
296
+ $url .= (isset ($req["file_download_key"])) ? (($key) ? "/s2member-file-download-key-" . $key : "") : "";
297
+ $url .= (isset ($req["file_stream"])) ? (($stream) ? "/s2member-file-stream" : "/s2member-file-stream-no") : "";
298
+ $url .= (isset ($req["file_inline"])) ? (($inline) ? "/s2member-file-inline" : "/s2member-file-inline-no") : "";
299
+ $url .= (isset ($req["file_storage"])) ? (($storage) ? "/s2member-file-storage-" . $storage : "") : "";
300
+ $url .= (isset ($req["file_remote"])) ? (($remote) ? "/s2member-file-remote" : "/s2member-file-remote-no") : "";
301
+ $url .= (isset ($req["skip_confirmation"])) ? (($skip_confirmation) ? "/s2member-skip-confirmation" : "/s2member-skip-confirmation-no") : "";
302
+ /**/
303
+ $url = $url . "/" . $req["file_download"]; /* File Download Access URL via `mod_rewrite` functionality. */
304
+ $url = ($ssl) ? preg_replace ("/^https?/", "https", $url) : preg_replace ("/^https?/", "http", $url);
305
+ /**/
306
+ return apply_filters ("ws_plugin__s2member_file_download_access_url", $url, get_defined_vars ());
307
+ }
308
+ /**/
309
+ else if ($creating) /* Else we're creating a URL w/ a query-string, pointing to local storage. */
310
+ {
311
+ $url = (isset ($req["file_download_key"])) ? (($key) ? "&s2member_file_download_key=" . urlencode ($key) : "") : "";
312
+ $url .= (isset ($req["file_stream"])) ? (($stream) ? "&s2member_file_stream=yes" : "&s2member_file_stream=no") : "";
313
+ $url .= (isset ($req["file_inline"])) ? (($inline) ? "&s2member_file_inline=yes" : "&s2member_file_inline=no") : "";
314
+ $url .= (isset ($req["file_storage"])) ? (($storage) ? "&s2member_file_storage=" . urlencode ($storage) : "") : "";
315
+ $url .= (isset ($req["file_remote"])) ? (($remote) ? "&s2member_file_remote=yes" : "&s2member_file_remote=no") : "";
316
+ $url .= (isset ($req["skip_confirmation"])) ? (($skip_confirmation) ? "&s2member_skip_confirmation=yes" : "&s2member_skip_confirmation=no") : "";
317
+ /**/
318
+ $url = site_url ("/?" . ltrim ($url . "&s2member_file_download=/" . urlencode ($req["file_download"]), "&"));
319
+ $url = ($ssl) ? preg_replace ("/^https?/", "https", $url) : preg_replace ("/^https?/", "http", $url);
320
+ /**/
321
+ return apply_filters ("ws_plugin__s2member_file_download_access_url", $url, get_defined_vars ());
322
+ }
323
+ /**/
324
+ else /* Else, ``if ($serving)`` , use local storage option (default). */
325
+ {
326
+ status_header(200);
327
+ /**/
328
+ header("Accept-Ranges: none");
329
+ header("Content-Encoding: none");
330
+ header("Content-Type: " . $mimetype);
331
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
332
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
333
+ header("Cache-Control: no-cache, must-revalidate, max-age=0");
334
+ header ("Cache-Control: post-check=0, pre-check=0", false);
335
+ header("Pragma: no-cache");
336
+ /**/
337
+ header('Content-Disposition: ' . (($inline) ? "inline" : "attachment") . '; filename="' . $basename . '"');
338
+ /**/
339
+ if ($length && apply_filters ("ws_plugin__s2member_chunk_file_downloads", true, get_defined_vars ()) && is_resource ($resource = fopen ($file, "rb")))
340
+ {
341
+ $_chunk_size = apply_filters ("ws_plugin__s2member_chunk_file_downloads_w_chunk_size", 2097152, get_defined_vars ());
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) . exit (_x ("503: Access denied. Invalid File Download specs.", "s2member-front", "s2member"));
369
+ /**/
370
+ else if ($creating) /* We only need this section when/if we're creating a URL. */
371
+ return false;
372
+ /**/
373
+ do_action ("ws_plugin__s2member_after_file_download_access", get_defined_vars ());
374
+ /**/
375
+ return ($creating) ? false : null; /* If creating, false. */
376
+ }
377
+ /**
378
+ * Generates a File Download URL for access to a file protected by s2Member.
379
+ *
380
+ * @package s2Member\Files
381
+ * @since 110926
382
+ *
383
+ * @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
384
+ * Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `ignore_user`.
385
+ * @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
386
+ * Note: by default, this function DOES consider the current User/Member. If `ignore_user` is NOT set, or is set to false, this function MAY very well return false, when/if the current User/Member is NOT allowed access to the `file_download`, based on configuration.
387
+ */
388
+ public static function create_file_download_url ($config = FALSE, $get_streamer_array = FALSE)
389
+ {
390
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
391
+ do_action ("ws_plugin__s2member_before_create_file_download_url", get_defined_vars ()); /* Be VERY careful, if you use this Hook. */
392
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
393
+ /**/
394
+ $config = (is_array ($config)) ? $config : array (); /* This absolutely MUST be an array. */
395
+ /**/
396
+ $config["file_download"] = (isset ($config["file_download"]) && is_string ($config["file_download"])) ? trim ($config["file_download"], "/") : @$config["file_download"];
397
+ $config["file_download_key"] = (isset ($config["file_download"]) && is_string ($config["file_download"]) && !empty ($config["file_download_key"])) /* Automatically generate a File Download Key here? */
398
+ ? c_ws_plugin__s2member_files::file_download_key ($config["file_download"], ((in_array ($config["file_download_key"], array ("ip-forever", "universal", "cache-compatible"))) ? $config["file_download_key"] : false)) : @$config["file_download_key"];
399
+ /**/
400
+ $config["url_to_storage_source"] = /* Force a streaming URL here via ``$get_streamer_array``? */ ($get_streamer_array) ? true : @$config["url_to_storage_source"];
401
+ $config["file_stream"] = /* Force a streaming URL here via ``$get_streamer_array``? */ ($get_streamer_array) ? true : @$config["file_stream"];
402
+ /**/
403
+ if (($_url = c_ws_plugin__s2member_files_in::check_file_download_access (($create_file_download_url = $config))) /* Successfully created a URL to the file? */)
404
+ {
405
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
406
+ do_action ("ws_plugin__s2member_during_create_file_download_url", get_defined_vars ()); /* Be VERY careful, if you use this Hook. */
407
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
408
+ /**/
409
+ $extension = strtolower (substr ($config["file_download"], strrpos ($config["file_download"], ".") + 1));
410
+ $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);
411
+ $ssl = (isset ($config["file_ssl"])) ? filter_var ($config["file_ssl"], FILTER_VALIDATE_BOOLEAN) : ((is_ssl ()) ? true : false);
412
+ /**/
413
+ 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, "ignore_user" => true)))))
414
+ $return = array ("streamer" => $streamer, "file" => preg_replace ("/^" . preg_quote ($streamer, "/") . "\//", "", $_url), "url" => preg_replace ("/^.+?\:/", (($ssl) ? "https:" : "http:"), $url));
415
+ /**/
416
+ else if ($get_streamer_array && $streaming && is_array ($ups = @parse_url ($_url)) && ($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, "ignore_user" => true)))))
417
+ $return = array ("streamer" => $streamer, "file" => preg_replace ("/^" . preg_quote ($streamer, "/") . "\//", "", $_url), "url" => preg_replace ("/^.+?\:/", (($ssl) ? "https:" : "http:"), $url));
418
+ /**/
419
+ else if ($get_streamer_array) /* Else, we MUST return false here, unable to acquire streamer/file. */
420
+ $return = false; /* We MUST return false here, unable to acquire streamer. */
421
+ /**/
422
+ else /* Else return URL string ( ``$get_streamer_array`` is false ). */
423
+ $return = $_url; /* Else return URL string. */
424
+ }
425
+ /**/
426
+ return apply_filters ("ws_plugin__s2member_create_file_download_url", ((isset ($return)) ? $return : false), get_defined_vars ());
427
+ }
428
+ /**
429
+ * Checks Header Authorization for Remote File Downloads.
430
+ *
431
+ * @package s2Member\Files
432
+ * @since 110926
433
+ *
434
+ * @attaches-to: ``add_filter("ws_plugin__s2member_check_file_download_access_user");``
435
+ *
436
+ * @param obj $user Expects a WP_User object passed in by the Filter.
437
+ * @return obj A `WP_User` object, possibly obtained through Header Authorization.
438
+ */
439
+ public static function check_file_remote_authorization ($user = FALSE)
440
+ {
441
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
442
+ do_action ("ws_plugin__s2member_before_check_file_remote_authorization", get_defined_vars ());
443
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
444
+ /**/
445
+ $_g = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep (((!empty ($_GET)) ? $_GET : array ())));
446
+ /**/
447
+ if (!is_object ($user) && isset ($_g["s2member_file_remote"]) && filter_var ($_g["s2member_file_remote"], FILTER_VALIDATE_BOOLEAN))
448
+ {
449
+ do_action ("ws_plugin__s2member_during_check_file_remote_authorization_before", get_defined_vars ());
450
+ /**/
451
+ if (empty ($_SERVER["PHP_AUTH_USER"]) || empty ($_SERVER["PHP_AUTH_PW"]) || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
452
+ {
453
+ header('WWW-Authenticate: Basic realm="' . _x ("Members Only", "s2member-front", "s2member") . '"');
454
+ status_header(401); /* Unauthorized status header. */
455
+ exit(_x ("Access Denied", "s2member-front", "s2member"));
456
+ }
457
+ else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && !empty ($_user->ID))
458
+ $user = $_user; /* Now assign ``$user``. */
459
+ /**/
460
+ do_action ("ws_plugin__s2member_during_check_file_remote_authorization_after", get_defined_vars ());
461
+ }
462
+ /**/
463
+ return apply_filters ("ws_plugin__s2member_check_file_remote_authorization", $user, get_defined_vars ());
464
+ }
465
+ /**
466
+ * Checks a File Download Key for validity.
467
+ *
468
+ * @package s2Member\Files
469
+ * @since 110926
470
+ *
471
+ * @param str $file Input File Download to validate.
472
+ * @param str $key Input File Download Key to validate.
473
+ * @return bool True if valid, else false.
474
+ */
475
+ public static function check_file_download_key ($file = FALSE, $key = FALSE)
476
+ {
477
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
478
+ do_action ("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars ());
479
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
480
+ /**/
481
+ if ($file && is_string ($file) && ($file = trim ($file, "/")) && $key && is_string ($key)) /* Requirements to properly validate. */
482
+ {
483
+ if ($key === c_ws_plugin__s2member_files::file_download_key ($file) || $key === c_ws_plugin__s2member_files::file_download_key ("/" . $file))
484
+ $valid = true; /* File Download Key is valid. */
485
+ else if ($key === c_ws_plugin__s2member_files::file_download_key ($file, "ip-forever") || $key === c_ws_plugin__s2member_files::file_download_key ("/" . $file, "ip-forever"))
486
+ $valid = true; /* File Download Key is valid. */
487
+ else if ($key === c_ws_plugin__s2member_files::file_download_key ($file, "universal") || $key === c_ws_plugin__s2member_files::file_download_key ("/" . $file, "universal"))
488
+ $valid = true; /* File Download Key is valid. */
489
+ }
490
+ /**/
491
+ return apply_filters ("ws_plugin__s2member_check_file_download_key", ((isset ($valid) && $valid) ? true : false), get_defined_vars ());
492
+ }
493
+ /**
494
+ * Creates an Amazon® S3 HMAC-SHA1 signature.
495
+ *
496
+ * @package s2Member\Files
497
+ * @since 110524RC
498
+ *
499
+ * @param str $string Input string/data, to be signed by this routine.
500
+ * @return str An HMAC-SHA1 signature for Amazon® S3.
501
+ */
502
+ public static function amazon_s3_sign ($string = FALSE)
503
+ {
504
+ $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
505
+ /**/
506
+ $s3_signature = str_pad (((strlen ($s3c["secret_key"]) > 64) ? pack ('H*', sha1 ($s3c["secret_key"])) : $s3c["secret_key"]), 64, chr (0x00));
507
+ return pack ('H*', sha1 (($s3_signature ^ str_repeat (chr (0x5c), 64)) . pack ('H*', sha1 (($s3_signature ^ str_repeat (chr (0x36), 64)) . (string)$string))));
508
+ }
509
+ /**
510
+ * Creates an Amazon® S3 HMAC-SHA1 signature URL.
511
+ *
512
+ * @package s2Member\Files
513
+ * @since 110926
514
+ *
515
+ * @param str $file Input file path, to be signed by this routine.
516
+ * @param bool $stream Is this resource file to be served as streaming media?
517
+ * @param bool $inline Is this resource file to be served inline, or no?
518
+ * @param bool $ssl Is this resource file to be served via SSL, or no?
519
+ * @param str $basename The absolute basename of the resource file.
520
+ * @param str $mimetype The MIME content-type of the resource file.
521
+ * @return str An HMAC-SHA1 signature URL for Amazon® S3.
522
+ */
523
+ public static function amazon_s3_url ($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
524
+ {
525
+ $file = trim ((string)$file, "/"); /* Trim / force string. */
526
+ /**/
527
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
528
+ if (preg_match ("/^amazon_s3_files_/", $option) && ($option = preg_replace ("/^amazon_s3_files_/", "", $option)))
529
+ $s3c[$option] = $option_value;
530
+ /**/
531
+ $s3c["expires"] = strtotime ("+" . apply_filters ("ws_plugin__s2member_amazon_s3_file_expires_time", "30 seconds", get_defined_vars ()));
532
+ /**/
533
+ $s3_file = add_query_arg (urlencode_deep (array ("response-cache-control" => ($s3_cache_control = "no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"), "response-content-disposition" => ($s3_content_disposition = (((bool)$inline) ? "inline" : "attachment") . '; filename="' . (string)$basename . '"'), "response-content-type" => ($s3_content_type = (string)$mimetype), "response-expires" => ($s3_expires = gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT"))), "/" . $file);
534
+ $s3_raw_file = add_query_arg (array ("response-cache-control" => $s3_cache_control, "response-content-disposition" => $s3_content_disposition, "response-content-type" => $s3_content_type, "response-expires" => $s3_expires), "/" . $file);
535
+ $s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("GET\n\n\n" . $s3c["expires"] . "\n" . "/" . $s3c["bucket"] . $s3_raw_file));
536
+ /**/
537
+ $s3_url = ((strtolower ($s3c["bucket"]) !== $s3c["bucket"])) ? "http" . (($ssl) ? "s" : "") . "://s3.amazonaws.com/" . $s3c["bucket"] . $s3_file : "http" . (($ssl) ? "s" : "") . "://" . $s3c["bucket"] . ".s3.amazonaws.com" . $s3_file;
538
+ return add_query_arg (urlencode_deep (array ("AWSAccessKeyId" => $s3c["access_key"], "Expires" => $s3c["expires"], "Signature" => $s3_signature)), $s3_url);
539
+ }
540
+ /**
541
+ * Auto-configures an Amazon® S3 Bucket's ACLs.
542
+ *
543
+ * @package s2Member\Files
544
+ * @since 110926
545
+ *
546
+ * @return array Array containing a true `success` element on success, else a failure array.
547
+ * Failure array will contain a failure `code`, and a failure `message`.
548
+ */
549
+ public static function amazon_s3_auto_configure_acls ()
550
+ {
551
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
552
+ if (preg_match ("/^amazon_s3_files_/", $option) && ($option = preg_replace ("/^amazon_s3_files_/", "", $option)))
553
+ $s3c[$option] = $option_value;
554
+ /**/
555
+ $cfc["distros_s3_access_id"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_s3_access_id"];
556
+ /**/
557
+ if ($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"]) /* Must have Amazon® S3 Bucket/Keys. */
558
+ {
559
+ $s3_date = gmdate ("D, d M Y H:i:s") . " GMT";
560
+ $s3_location = ((strtolower ($s3c["bucket"]) !== $s3c["bucket"])) ? "/" . $s3c["bucket"] . "/?acl" : "/?acl";
561
+ $s3_domain = ((strtolower ($s3c["bucket"]) !== $s3c["bucket"])) ? "s3.amazonaws.com" : $s3c["bucket"] . ".s3.amazonaws.com";
562
+ $s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("GET\n\n\n" . $s3_date . "\n/" . $s3c["bucket"] . "/?acl"));
563
+ $s3_args = array ("method" => "GET", "headers" => array ("Host" => $s3_domain, "Date" => $s3_date, "Authorization" => "AWS " . $s3c["access_key"] . ":" . $s3_signature));
564
+ /**/
565
+ if (($s3_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $s3_domain . $s3_location, false, array_merge ($s3_args, array ("timeout" => 20)), "array")) && $s3_response["code"] === 200)
566
+ {
567
+ if (preg_match ("/\<Owner\>(.+?)\<\/Owner\>/is", $s3_response["body"], $s3_owner_tag) && preg_match ("/\<ID\>(.+?)\<\/ID\>/is", $s3_owner_tag[1], $s3_owner_id_tag) && (preg_match ("/\<DisplayName\>(.*?)\<\/DisplayName\>/is", $s3_owner_tag[1], $s3_owner_display_name_tag) || ($s3_owner_display_name_tag = array ("-", "Owner"))))
568
+ {
569
+ $s3_owner = array ("access_id" => trim ($s3_owner_id_tag[1]), "display_name" => trim ($s3_owner_display_name_tag[1]));
570
+ $s3_acls_xml = '<AccessControlPolicy><Owner><ID>' . esc_html ($s3_owner["access_id"]) . '</ID><DisplayName>' . esc_html ($s3_owner["display_name"]) . '</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>' . esc_html ($s3_owner["access_id"]) . '</ID><DisplayName>' . esc_html ($s3_owner["display_name"]) . '</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant>' . (($cfc["distros_s3_access_id"]) ? '<Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>' . esc_html ($cfc["distros_s3_access_id"]) . '</ID><DisplayName>s2Member/CloudFront</DisplayName></Grantee><Permission>READ</Permission></Grant>' : '') . '</AccessControlList></AccessControlPolicy>';
571
+ $s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("PUT\n\napplication/xml\n" . $s3_date . "\n/" . $s3c["bucket"] . "/?acl"));
572
+ $s3_args = array ("method" => "PUT", "body" => $s3_acls_xml, "headers" => array ("Host" => $s3_domain, "Content-Type" => "application/xml", "Date" => $s3_date, "Authorization" => "AWS " . $s3c["access_key"] . ":" . $s3_signature));
573
  /**/
574
+ if (($s3_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $s3_domain . $s3_location, false, array_merge ($s3_args, array ("timeout" => 20)), "array")) && $s3_response["code"] === 200)
575
  {
576
+ $s3_location = ((strtolower ($s3c["bucket"]) !== $s3c["bucket"])) ? "/" . $s3c["bucket"] . "/?policy" : "/?policy";
577
+ $s3_policy_json = '{"Version":"2008-10-17","Id":"' . md5 ("s2Member/CloudFront") . '","Statement":[{"Sid":"s2Member/CloudFront","Effect":"Allow","Principal":{"CanonicalUser":"' . c_ws_plugin__s2member_utils_strings::esc_dq ($cfc["distros_s3_access_id"]) . '"},"Action":"s3:GetObject","Resource":"arn:aws:s3:::' . c_ws_plugin__s2member_utils_strings::esc_dq ($s3c["bucket"]) . '/*"}]}';
578
+ $s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("PUT\n\napplication/json\n" . $s3_date . "\n/" . $s3c["bucket"] . "/?policy"));
579
+ $s3_args = array ("method" => "PUT", "body" => $s3_policy_json, "headers" => array ("Host" => $s3_domain, "Content-Type" => "application/json", "Date" => $s3_date, "Authorization" => "AWS " . $s3c["access_key"] . ":" . $s3_signature));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  /**/
581
+ if (!$cfc["distros_s3_access_id"] || (($s3_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $s3_domain . $s3_location, false, array_merge ($s3_args, array ("timeout" => 20)), "array")) && ($s3_response["code"] === 200 || $s3_response["code"] === 204 /* Also OK. */)))
582
  {
583
+ $s3_location = ((strtolower ($s3c["bucket"]) !== $s3c["bucket"])) ? "/" . $s3c["bucket"] . "/crossdomain.xml" : "/crossdomain.xml";
584
+ $s3_policy_xml = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/cfg-files/s2-cross-xml.php")));
585
+ $s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("PUT\n\ntext/xml\n" . $s3_date . "\nx-amz-acl:public-read\n/" . $s3c["bucket"] . "/crossdomain.xml"));
586
+ $s3_args = array ("method" => "PUT", "body" => $s3_policy_xml, "headers" => array ("Host" => $s3_domain, "Content-Type" => "text/xml", "Date" => $s3_date, "X-Amz-Acl" => "public-read", "Authorization" => "AWS " . $s3c["access_key"] . ":" . $s3_signature));
587
+ /**/
588
+ if (($s3_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $s3_domain . $s3_location, false, array_merge ($s3_args, array ("timeout" => 20)), "array")) && $s3_response["code"] === 200)
589
+ return array ("success" => true, "code" => null, "message" => null); /* Successfully configured Amazon® S3 Bucket ACLs and Policy. */
590
+ /**/
591
+ else if (isset ($s3_response["code"], $s3_response["message"]))
592
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
593
+ return array ("success" => false, "code" => $s3_response["code"], "message" => sprintf (_x ("Unable to update existing Amazon® S3 Cross-Domain Policy. %s", "s2member-admin", "s2member"), $s3_response["message"]));
594
+ /**/
595
+ else /* Else, we use a default error code and message. */
596
+ return array ("success" => false, "code" => -94, "message" => _x ("Unable to update existing Amazon® S3 Cross-Domain Policy. Connection failed.", "s2member-admin", "s2member"));
597
  }
598
+ else if (isset ($s3_response["code"], $s3_response["message"]))
599
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
600
+ return array ("success" => false, "code" => $s3_response["code"], "message" => sprintf (_x ("Unable to update existing Amazon® S3 Bucket Policy. %s", "s2member-admin", "s2member"), $s3_response["message"]));
601
  /**/
602
+ else /* Else, we use a default error code and message. */
603
+ return array ("success" => false, "code" => -95, "message" => _x ("Unable to update existing Amazon® S3 Bucket Policy. Connection failed.", "s2member-admin", "s2member"));
604
+ }
605
+ else if (isset ($s3_response["code"], $s3_response["message"]))
606
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
607
+ return array ("success" => false, "code" => $s3_response["code"], "message" => sprintf (_x ("Unable to update existing Amazon® S3 Bucket ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
608
+ /**/
609
+ else /* Else, we use a default error code and message. */
610
+ return array ("success" => false, "code" => -96, "message" => _x ("Unable to update existing Amazon® S3 Bucket ACLs. Connection failed.", "s2member-admin", "s2member"));
611
+ }
612
+ else /* Else, we use a default error code and message. */
613
+ return array ("success" => false, "code" => -97, "message" => _x ("Unable to acquire/read existing Amazon® S3 Bucket ACLs. Unexpected response.", "s2member-admin", "s2member"));
614
+ }
615
+ else if (isset ($s3_response["code"], $s3_response["message"]))
616
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
617
+ return array ("success" => false, "code" => $s3_response["code"], "message" => sprintf (_x ("Unable to acquire existing Amazon® S3 Bucket ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
618
+ /**/
619
+ else /* Else, we use a default error code and message. */
620
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to acquire existing Amazon® S3 Bucket ACLs. Connection failed.", "s2member-admin", "s2member"));
621
+ }
622
+ else /* Else, we use a default error code and message. */
623
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to auto-configure existing Amazon® S3 Bucket ACLs. Incomplete Amazon® S3 configuration options. Missing one of: Amazon® S3 Bucket, Access Key, or Secret Key.", "s2member-admin", "s2member"));
624
+ }
625
+ /**
626
+ * Creates an Amazon® CloudFront HMAC-SHA1 signature.
627
+ *
628
+ * @package s2Member\Files
629
+ * @since 110926
630
+ *
631
+ * @param str $string Input string/data, to be signed by this routine.
632
+ * @return str An HMAC-SHA1 signature for Amazon® CloudFront.
633
+ */
634
+ public static function amazon_cf_sign ($string = FALSE)
635
+ {
636
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
637
+ /**/
638
+ $cf_signature = str_pad (((strlen ($cfc["secret_key"]) > 64) ? pack ('H*', sha1 ($cfc["secret_key"])) : $cfc["secret_key"]), 64, chr (0x00));
639
+ return pack ('H*', sha1 (($cf_signature ^ str_repeat (chr (0x5c), 64)) . pack ('H*', sha1 (($cf_signature ^ str_repeat (chr (0x36), 64)) . (string)$string))));
640
+ }
641
+ /**
642
+ * Creates an Amazon® CloudFront RSA-SHA1 signature.
643
+ *
644
+ * @package s2Member\Files
645
+ * @since 110926
646
+ *
647
+ * @param str $string Input string/data, to be signed by this routine.
648
+ * @return str|bool An RSA-SHA1 signature for Amazon® CloudFront, else false on failure.
649
+ */
650
+ public static function amazon_cf_rsa_sign ($string = FALSE)
651
+ {
652
+ $cfc["private_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"];
653
+ /**/
654
+ if (stripos (PHP_SAPI, "apache") !== false) /* PHP is running as an Apache module? */
655
+ if ( /* Some `mod_php` installs have issues with OpenSSL version conflicts. See: <http://www.apachelounge.com/viewtopic.php?t=4180>. */
656
+ ($signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_shell_sign ($string)) /* Also try some other OpenSSL locations on Windows®. */
657
+ || (stripos (PHP_OS, "win") === 0 && ($signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_shell_sign ($string, "C:\openssl-win32\bin\openssl.exe"))) #
658
+ || (stripos (PHP_OS, "win") === 0 && ($signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_shell_sign ($string, "C:\openssl-win64\bin\openssl.exe"))))
659
+ return $signature;
660
+ /**/
661
+ if (function_exists ("openssl_get_privatekey") && function_exists ("openssl_sign") && is_resource ($private_key = openssl_get_privatekey ($cfc["private_key"])))
662
+ openssl_sign ((string)$string, $signature, $private_key, OPENSSL_ALGO_SHA1) . openssl_free_key ($private_key);
663
+ /**/
664
+ else if (function_exists ("shell_exec")) /* Last ditch effort here. */
665
+ $signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_shell_sign ($string);
666
+ /**/
667
+ return (!empty ($signature)) ? $signature : false;
668
+ }
669
+ /**
670
+ * Creates an Amazon® CloudFront RSA-SHA1 signature via ``shell_exec()`` to `openssl`.
671
+ *
672
+ * @package s2Member\Files
673
+ * @since 110926
674
+ *
675
+ * @param str $string Input string/data, to be signed by this routine.
676
+ * @param str $openssl Optional. A specific absolute path to OpenSSL application.
677
+ * @return str|bool An RSA-SHA1 signature for Amazon® CloudFront, else false on failure.
678
+ */
679
+ public static function amazon_cf_rsa_shell_sign ($string = FALSE, $openssl = FALSE)
680
+ {
681
+ $cfc["private_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"];
682
+ /**/
683
+ if (function_exists ("shell_exec") && ($openssl = (($openssl && is_string ($openssl)) ? $openssl : "openssl")) && ($esa = "escapeshellarg"))
684
+ {
685
+ file_put_contents (($cf_string_file = get_temp_dir () . wp_unique_filename (get_temp_dir (), md5 (time () . "cf-string") . ".tmp")), (string)$string);
686
+ file_put_contents (($cf_private_key_file = get_temp_dir () . wp_unique_filename (get_temp_dir (), md5 (time () . "cf-private-key") . ".tmp")), $cfc["private_key"]);
687
+ file_put_contents (($cf_rsa_sha1_sig_file = get_temp_dir () . wp_unique_filename (get_temp_dir (), md5 (time () . "cf-rsa-sha1-signature-file") . ".tmp")), "");
688
+ /**/
689
+ @shell_exec($esa ($openssl) . " sha1 -sign " . $esa ($cf_private_key_file) . " -out " . $esa ($cf_rsa_sha1_sig_file) . " " . $esa ($cf_string_file));
690
+ $signature = trim (file_get_contents ($cf_rsa_sha1_sig_file)); /* Now try to obtain signature file contents. */
691
+ unlink($cf_rsa_sha1_sig_file) . unlink ($cf_private_key_file) . unlink ($cf_string_file); /* Cleanup. */
692
+ }
693
+ /**/
694
+ return (!empty ($signature)) ? $signature : false;
695
+ }
696
+ /**
697
+ * Creates an Amazon® CloudFront RSA-SHA1 signature URL.
698
+ *
699
+ * @package s2Member\Files
700
+ * @since 110926
701
+ *
702
+ * @param str $file Input file path, to be signed by this routine.
703
+ * @param bool $stream Is this resource file to be served as streaming media?
704
+ * @param bool $inline Is this resource file to be served inline, or no?
705
+ * @param bool $ssl Is this resource file to be served via SSL, or no?
706
+ * @param str $basename The absolute basename of the resource file.
707
+ * @param str $mimetype The MIME content-type of the resource file.
708
+ * @return str An RSA-SHA1 signature URL for Amazon® CloudFront.
709
+ */
710
+ public static function amazon_cf_url ($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
711
+ {
712
+ $file = trim ((string)$file, "/"); /* Trim / force string. */
713
+ /**/
714
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
715
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
716
+ $cfc[$option] = $option_value;
717
+ /**/
718
+ $cfc["expires"] = strtotime ("+" . apply_filters ("ws_plugin__s2member_amazon_cf_file_expires_time", "24 hours", get_defined_vars ()));
719
+ /**/
720
+ $cf_extn = strtolower (substr ($file, strrpos ($file, ".") + 1)); /* Parses the file extension out so we can scan it in some special scenarios. */
721
+ $cf_stream_extn_resource_exclusions = array_unique ((array)apply_filters ("ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions", array ("mp3" /* MP3 files should NOT include an extension in their resource reference. */), get_defined_vars ()));
722
+ $cf_resource = ($stream) ? ((in_array ($cf_extn, $cf_stream_extn_resource_exclusions)) ? substr ($file, 0, strrpos ($file, ".")) : $file) : "http" . (($ssl) ? "s" : "") . "://" . (($cfc["distro_downloads_cname"]) ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $file;
723
+ $cf_url = ($stream) ? "rtmp" . (($ssl) ? "e" : "") . "://" . (($cfc["distro_streaming_cname"]) ? $cfc["distro_streaming_cname"] : $cfc["distro_streaming_dname"]) . "/cfx/st/" . $file : "http" . (($ssl) ? "s" : "") . "://" . (($cfc["distro_downloads_cname"]) ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $file;
724
+ $cf_ip_res = (stripos ($_SERVER["HTTP_HOST"], "localhost") === false && strpos ($_SERVER["HTTP_HOST"], "127.0.0.1") === false && (!defined ("LOCALHOST") || !LOCALHOST)) ? true : false; /* Don NOT restrict access to a particular IP during `localhost` development. The IP will NOT be the same one Amazon® CloudFront sees ( so will NOT jive ). */
725
+ $cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq ($cf_resource) . '","Condition":{' . (($cf_ip_res) ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq ($_SERVER["REMOTE_ADDR"]) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int)$cfc["expires"] . '}}}]}';
726
+ /**/
727
+ $cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign ($cf_policy);
728
+ $cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode ($cf_policy, array ("+", "=", "/"), array ("-", "_", "~"), false);
729
+ $cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode ($cf_signature, array ("+", "=", "/"), array ("-", "_", "~"), false);
730
+ /**/
731
+ return add_query_arg (urlencode_deep (array ("Policy" => $cf_base64_url_safe_policy, "Signature" => $cf_base64_url_safe_signature, "Key-Pair-Id" => $cfc["private_key_id"])), $cf_url);
732
+ }
733
+ /**
734
+ * Auto-configures Amazon® S3/CloudFront distros.
735
+ *
736
+ * @package s2Member\Files
737
+ * @since 110926
738
+ *
739
+ * @return array Array containing a true `success` element on success, else a failure array.
740
+ * Failure array will contain a failure `code`, and a failure `message`.
741
+ */
742
+ public static function amazon_cf_auto_configure_distros ()
743
+ {
744
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
745
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
746
+ $cfc[$option] = $option_value;
747
+ /**/
748
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
749
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
750
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
751
+ /**/
752
+ if ($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"]) /* We MUST have an Amazon® S3 Bucket and Keys. */
753
+ {
754
+ if ($cfc["private_key"] && $cfc["private_key_id"]) /* We MUST have Amazon® CloudFront Keys in order to auto-configure. */
755
+ {
756
+ if (!$cfc["distro_downloads_id"] || ($cfc["distro_downloads_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro ($cfc["distro_downloads_id"], "downloads")) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)))
757
+ {
758
+ if (!$cfc["distro_downloads_id"] || ($cfc["distro_downloads_id"] && $cf_get_response && !$cf_get_response["success"] && $cf_get_response["code"] === 404))
759
+ $cf_distro_downloads_clear = true; /* Clear, ready for a new one. */
760
+ /**/
761
+ else if ($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"])
762
+ return array ("success" => false, "code" => -86, "message" => _x ("Unable to delete existing Amazon® CloudFront Downloads Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
763
+ /**/
764
+ else if ($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro ($cfc["distro_downloads_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
765
+ $cf_distro_downloads_clear = true; /* Clear, ready for a new one. */
766
+ /**/
767
+ else if (isset ($cf_del_response["code"], $cf_del_response["message"]))
768
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
769
+ return array ("success" => false, "code" => $cf_del_response["code"], "message" => sprintf (_x ("Unable to delete existing Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
770
+ /**/
771
+ if (isset ($cf_distro_downloads_clear) && $cf_distro_downloads_clear) /* Successfully cleared? Ready for a new one? */
772
+ {
773
+ unset ($cf_get_response, $cf_del_response); /* Unset these before processing additional routines. Prevents problems in error reporting. */
774
  /**/
775
+ if (!$cfc["distro_streaming_id"] || ($cfc["distro_streaming_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro ($cfc["distro_streaming_id"], "streaming")) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)))
776
  {
777
+ if (!$cfc["distro_streaming_id"] || ($cfc["distro_streaming_id"] && $cf_get_response && !$cf_get_response["success"] && $cf_get_response["code"] === 404))
778
+ $cf_distro_streaming_clear = true; /* Clear, ready for a new one. */
779
+ /**/
780
+ else if ($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"])
781
+ return array ("success" => false, "code" => -87, "message" => _x ("Unable to delete existing Amazon® CloudFront Streaming Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
782
+ /**/
783
+ else if ($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro ($cfc["distro_streaming_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
784
+ $cf_distro_streaming_clear = true; /* Clear, ready for a new one. */
785
+ /**/
786
+ else if (isset ($cf_del_response["code"], $cf_del_response["message"]))
787
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
788
+ return array ("success" => false, "code" => $cf_del_response["code"], "message" => sprintf (_x ("Unable to delete existing Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
789
+ /**/
790
+ if (isset ($cf_distro_streaming_clear) && $cf_distro_streaming_clear) /* Successfully cleared? Ready for a new one? */
791
  {
792
+ unset ($cf_get_response, $cf_del_response); /* Unset these before processing additional routines. Prevents problems in error reporting. */
793
+ /**/
794
+ if (!$cfc["distros_access_id"] || ($cfc["distros_access_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_access_origin_identity ($cfc["distros_access_id"])) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)))
795
+ {
796
+ if (!$cfc["distros_access_id"] || ($cfc["distros_access_id"] && $cf_get_response && !$cf_get_response["success"] && $cf_get_response["code"] === 404))
797
+ $cf_distros_access_clear = true; /* Clear, ready for a new one. */
798
+ /**/
799
+ else if ($cfc["distros_access_id"] && $cf_get_response && $cf_get_response["success"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_access_origin_identity ($cfc["distros_access_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"])
800
+ $cf_distros_access_clear = true; /* Clear, ready for a new one. */
801
+ /**/
802
+ else if (isset ($cf_del_response["code"], $cf_del_response["message"]))
803
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
804
+ return array ("success" => false, "code" => $cf_del_response["code"], "message" => sprintf (_x ("Unable to delete existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
805
+ /**/
806
+ if (isset ($cf_distros_access_clear) && $cf_distros_access_clear) /* Successfully cleared? Ready for a new one? */
807
+ {
808
+ unset ($cf_get_response, $cf_del_response); /* Unset these before processing additional routines. Prevents problems in error reporting. */
809
+ /**/
810
+ $cfc = array_merge ($cfc, array ("distros_access_id" => "", "distros_s3_access_id" => "", "distro_downloads_id" => "", "distro_downloads_dname" => "", "distro_streaming_id" => "", "distro_streaming_dname" => "", "distros_auto_config_status" => ""));
811
+ $cf_options = array ("ws_plugin__s2member_amazon_cf_files_distros_access_id" => "", "ws_plugin__s2member_amazon_cf_files_distros_s3_access_id" => "", "ws_plugin__s2member_amazon_cf_files_distro_downloads_id" => "", "ws_plugin__s2member_amazon_cf_files_distro_downloads_dname" => "", "ws_plugin__s2member_amazon_cf_files_distro_streaming_id" => "", "ws_plugin__s2member_amazon_cf_files_distro_streaming_dname" => "", "ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" => "");
812
+ c_ws_plugin__s2member_menu_pages::update_all_options ($cf_options, true, false, false, false, false);
813
+ /**/
814
+ if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_create_distros_access_origin_identity ()) && $cf_response["success"])
815
+ {
816
+ $cfc = array_merge ($cfc, array ("distros_access_id" => $cf_response["distros_access_id"], "distros_s3_access_id" => $cf_response["distros_s3_access_id"]));
817
+ $cf_options = array ("ws_plugin__s2member_amazon_cf_files_distros_access_id" => $cf_response["distros_access_id"], "ws_plugin__s2member_amazon_cf_files_distros_s3_access_id" => $cf_response["distros_s3_access_id"]);
818
+ c_ws_plugin__s2member_menu_pages::update_all_options ($cf_options, true, false, false, false, false);
819
+ /**/
820
+ if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_create_distro ("downloads")) && $cf_response["success"])
821
+ {
822
+ $cfc = array_merge ($cfc, array ("distro_downloads_id" => $cf_response["distro_downloads_id"], "distro_downloads_dname" => $cf_response["distro_downloads_dname"]));
823
+ $cf_options = array ("ws_plugin__s2member_amazon_cf_files_distro_downloads_id" => $cf_response["distro_downloads_id"], "ws_plugin__s2member_amazon_cf_files_distro_downloads_dname" => $cf_response["distro_downloads_dname"]);
824
+ c_ws_plugin__s2member_menu_pages::update_all_options ($cf_options, true, false, false, false, false);
825
+ /**/
826
+ if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_create_distro ("streaming")) && $cf_response["success"])
827
+ {
828
+ $cfc = array_merge ($cfc, array ("distro_streaming_id" => $cf_response["distro_streaming_id"], "distro_streaming_dname" => $cf_response["distro_streaming_dname"]));
829
+ $cf_options = array ("ws_plugin__s2member_amazon_cf_files_distro_streaming_id" => $cf_response["distro_streaming_id"], "ws_plugin__s2member_amazon_cf_files_distro_streaming_dname" => $cf_response["distro_streaming_dname"]);
830
+ c_ws_plugin__s2member_menu_pages::update_all_options ($cf_options, true, false, false, false, false);
831
+ /**/
832
+ if (($s3_response = c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls ()) && $s3_response["success"])
833
+ {
834
+ $cfc = array_merge ($cfc, array ("distros_auto_config_status" => "success"));
835
+ $cf_options = array ("ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" => "configured");
836
+ c_ws_plugin__s2member_menu_pages::update_all_options ( /* Now configured! */$cf_options, true, false, false, false, false);
837
+ /**/
838
+ return array ("success" => true, "code" => null, "message" => null); /* Successfully configured Amazon® S3/CloudFront distros. */
839
+ }
840
+ /**/
841
+ else if (isset ($s3_response["code"], $s3_response["message"]))
842
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® S3 API call. Feel free to exclude `%s` if you like. */
843
+ return array ("success" => false, "code" => $s3_response["code"], "message" => sprintf (_x ("Unable to update existing Amazon® S3 ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
844
+ /**/
845
+ else /* Else, we use a default error code and message. */
846
+ return array ("success" => false, "code" => -88, "message" => _x ("Unable to update existing Amazon® S3 ACLs. Connection failed.", "s2member-admin", "s2member"));
847
+ }
848
+ else if (isset ($cf_response["code"], $cf_response["message"]))
849
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
850
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to create Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
851
+ /**/
852
+ else /* Else, we use a default error code and message. */
853
+ return array ("success" => false, "code" => -89, "message" => _x ("Unable to create Amazon® CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
854
+ }
855
+ else if (isset ($cf_response["code"], $cf_response["message"]))
856
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
857
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to create Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
858
+ /**/
859
+ else /* Else, we use a default error code and message. */
860
+ return array ("success" => false, "code" => -90, "message" => _x ("Unable to create Amazon® CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
861
+ }
862
+ else if (isset ($cf_response["code"], $cf_response["message"]))
863
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
864
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to create Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
865
+ /**/
866
+ else /* Else, we use a default error code and message. */
867
+ return array ("success" => false, "code" => -91, "message" => _x ("Unable to create Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
868
+ }
869
+ else /* Else, we use a default error code and message. */
870
+ return array ("success" => false, "code" => -92, "message" => _x ("Unable to clear existing Amazon® CloudFront Origin Access Identity.", "s2member-admin", "s2member"));
871
+ }
872
+ else if (isset ($cf_get_response["code"], $cf_get_response["message"]))
873
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
874
+ return array ("success" => false, "code" => $cf_get_response["code"], "message" => sprintf (_x ("Unable to acquire existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
875
+ /**/
876
+ else /* Else, we use a default error code and message. */
877
+ return array ("success" => false, "code" => -93, "message" => _x ("Unable to acquire existing Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
878
  }
879
+ else /* Else, we use a default error code and message. */
880
+ return array ("success" => false, "code" => -94, "message" => _x ("Unable to clear existing Amazon® CloudFront Streaming Distro.", "s2member-admin", "s2member"));
881
  }
882
+ else if (isset ($cf_get_response["code"], $cf_get_response["message"]))
883
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
884
+ return array ("success" => false, "code" => $cf_get_response["code"], "message" => sprintf (_x ("Unable to acquire existing Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
885
  /**/
886
+ else /* Else, we use a default error code and message. */
887
+ return array ("success" => false, "code" => -95, "message" => _x ("Unable to acquire existing Amazon® CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  }
889
+ else /* Else, we use a default error code and message. */
890
+ return array ("success" => false, "code" => -96, "message" => _x ("Unable to clear existing Amazon® CloudFront Downloads Distro.", "s2member-admin", "s2member"));
891
  }
892
+ else if (isset ($cf_get_response["code"], $cf_get_response["message"]))
893
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
894
+ return array ("success" => false, "code" => $cf_get_response["code"], "message" => sprintf (_x ("Unable to acquire existing Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
 
 
 
 
 
 
 
 
895
  /**/
896
+ else /* Else, we use a default error code and message. */
897
+ return array ("success" => false, "code" => -97, "message" => _x ("Unable to acquire existing Amazon® CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
898
+ }
899
+ else /* Else, we use a default error code and message. */
900
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to auto-configure Amazon® CloudFront Distros. Incomplete Amazon® CloudFront configuration options. Missing of one: Amazon® CloudFront Private Key-Pair-ID, or Private Key file contents.", "s2member-admin", "s2member"));
901
+ }
902
+ else /* Else, we use a default error code and message. */
903
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to auto-configure Amazon® S3/CloudFront Distros. Incomplete Amazon® S3 configuration options. Missing one of: Amazon® S3 Bucket, Access Key, or Secret Key. You must provide s2Member with an Amazon® S3 configuration before enabling CloudFront.", "s2member-admin", "s2member"));
904
+ }
905
+ /**
906
+ * Acquires an Amazon® S3/CloudFront Access Origin Identity.
907
+ *
908
+ * @package s2Member\Files
909
+ * @since 110926
910
+ *
911
+ * @param str $access_id Required. An Origin Access ID.
912
+ * @return array Array containing a true `success` and `etag`, `xml` elements on success, else a failure array.
913
+ * Failure array will contain a failure `code`, and a failure `message`.
914
+ */
915
+ public static function amazon_cf_get_access_origin_identity ($access_id = FALSE)
916
+ {
917
+ if ($access_id && is_string ($access_id)) /* Valid parameters? */
918
+ {
919
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
920
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
921
+ $cfc[$option] = $option_value;
922
+ /**/
923
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
924
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
925
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
926
+ /**/
927
+ $cf_domain = "cloudfront.amazonaws.com";
928
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
929
+ $cf_location = "/2010-11-01/origin-access-identity/cloudfront/" . $access_id;
930
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
931
+ $cf_args = array ("method" => "GET", "headers" => array ("Host" => $cf_domain, "Date" => $cf_date, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
932
+ /**/
933
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && (($cf_response["code"] === 404 && $cf_response["message"]) || ($cf_response["code"] === 200 && !empty ($cf_response["headers"]["etag"]) && !empty ($cf_response["body"]))))
934
+ {
935
+ if ($cf_response["code"] === 200 && !empty ($cf_response["headers"]["etag"]) && !empty ($cf_response["body"]))
936
+ return array ("success" => true, "code" => null, "message" => null, "etag" => trim ($cf_response["headers"]["etag"]), "xml" => trim ($cf_response["body"]));
937
  /**/
938
+ else /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
939
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Existing Amazon® CloudFront Origin Access Identity NOT found. %s", "s2member-admin", "s2member"), $cf_response["message"]));
940
+ }
941
+ else if (isset ($cf_response["code"], $cf_response["message"]))
942
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
943
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to acquire existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
944
+ /**/
945
+ else /* Else, we use a default error code and message. */
946
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to acquire existing Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
947
+ }
948
+ else /* Else, we use a default error code and message. */
949
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to acquire existing Amazon® CloudFront Origin Access Identity. Invalid Access ID.", "s2member-admin", "s2member"));
950
+ }
951
+ /**
952
+ * Deletes an Amazon® S3/CloudFront Access Origin Identity.
953
+ *
954
+ * @package s2Member\Files
955
+ * @since 110926
956
+ *
957
+ * @param str $access_id Required. An Origin Access ID.
958
+ * @param str $access_id_etag Required. An Origin Access ETag header.
959
+ * @param str $access_id_xml Required. An Origin Access Identity's XML configuration.
960
+ * @return array Array containing a true `success` element on success, else a failure array.
961
+ * Failure array will contain a failure `code`, and a failure `message`.
962
+ */
963
+ public static function amazon_cf_del_access_origin_identity ($access_id = FALSE, $access_id_etag = FALSE, $access_id_xml = FALSE)
964
+ {
965
+ if ($access_id && is_string ($access_id) && $access_id_etag && is_string ($access_id_etag) && $access_id_xml && is_string ($access_id_xml))
966
+ {
967
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
968
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
969
+ $cfc[$option] = $option_value;
970
+ /**/
971
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
972
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
973
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
974
+ /**/
975
+ $cf_domain = "cloudfront.amazonaws.com";
976
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
977
+ $cf_location = "/2010-11-01/origin-access-identity/cloudfront/" . $access_id;
978
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
979
+ $cf_args = array ("method" => "DELETE", "headers" => array ("Host" => $cf_domain, "Date" => $cf_date, "If-Match" => $access_id_etag, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
980
+ /**/
981
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && ($cf_response["code"] === 200 || $cf_response["code"] === 204 /* Deleted. */))
982
+ return array ("success" => true, "code" => null, "message" => null); /* Deleted successfully. */
983
+ /**/
984
+ else if (isset ($cf_response["code"], $cf_response["message"]))
985
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
986
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to delete existing Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
987
+ /**/
988
+ else /* Else, we use a default error code and message. */
989
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to delete existing Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
990
+ }
991
+ else /* Else, we use a default error code and message. */
992
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to delete existing Amazon® CloudFront Origin Access Identity. Invalid Access ID, ETag, or XML config.", "s2member-admin", "s2member"));
993
+ }
994
+ /**
995
+ * Creates an Amazon® S3/CloudFront Access Origin Identity for all Distros.
996
+ *
997
+ * @package s2Member\Files
998
+ * @since 110926
999
+ *
1000
+ * @return array Array containing a true `success` and `distros_access_id`, `distros_s3_access_id` elements on success, else a failure array.
1001
+ * Failure array will contain a failure `code`, and a failure `message`.
1002
+ */
1003
+ public static function amazon_cf_create_distros_access_origin_identity ()
1004
+ {
1005
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
1006
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
1007
+ $cfc[$option] = $option_value;
1008
+ /**/
1009
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
1010
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
1011
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
1012
+ /**/
1013
+ $cf_domain = "cloudfront.amazonaws.com";
1014
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
1015
+ $cf_location = "/2010-11-01/origin-access-identity/cloudfront";
1016
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
1017
+ $cf_distros_access_reference = time () . "." . md5 ("access" . $s3c["bucket"] . $s3c["access_key"] . $s3c["secret_key"] . $cfc["private_key"] . $cfc["private_key_id"]);
1018
+ $cf_distros_access_xml = '<?xml version="1.0" encoding="UTF-8"?><CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/"><CallerReference>' . esc_html ($cf_distros_access_reference) . '</CallerReference><Comment>' . esc_html (sprintf (_x ("Created by s2Member, for S3 Bucket: %s.", "s2member-admin", "s2member"), $s3c["bucket"])) . '</Comment></CloudFrontOriginAccessIdentityConfig>';
1019
+ $cf_args = array ("method" => "POST", "body" => $cf_distros_access_xml, "headers" => array ("Host" => $cf_domain, "Content-Type" => "application/xml", "Date" => $cf_date, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
1020
+ /**/
1021
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && ($cf_response["code"] === 200 || $cf_response["code"] === 201 /* Created. */))
1022
+ {
1023
+ if (preg_match ("/\<CloudFrontOriginAccessIdentity.*?\>(.+?)\<\/CloudFrontOriginAccessIdentity\>/is", $cf_response["body"], $cf_distros_access_tag) && preg_match ("/\<Id\>(.+?)\<\/Id\>/is", $cf_distros_access_tag[1], $cf_distros_access_id_tag) && preg_match ("/\<S3CanonicalUserId\>(.+?)\<\/S3CanonicalUserId\>/is", $cf_distros_access_tag[1], $cf_distros_s3_access_id_tag))
1024
+ return array ("success" => true, "code" => null, "message" => null, "distros_access_id" => trim ($cf_distros_access_id_tag[1]), "distros_s3_access_id" => trim ($cf_distros_s3_access_id_tag[1]));
1025
+ /**/
1026
+ else /* Else, we use a default error code and message. */
1027
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to create/read Amazon® CloudFront Origin Access Identity. Unexpected response.", "s2member-admin", "s2member"));
1028
+ }
1029
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1030
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1031
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to create Amazon® CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1032
+ /**/
1033
+ else /* Else, we use a default error code and message. */
1034
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to create Amazon® CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
1035
+ }
1036
+ /**
1037
+ * Acquires an Amazon® S3/CloudFront Distro.
1038
+ *
1039
+ * @package s2Member\Files
1040
+ * @since 110926
1041
+ *
1042
+ * @param str $distro_id Required. A Distro ID.
1043
+ * @param str $distro_type Required: `downloads|streaming`.
1044
+ * @return array Array containing a true `success` and `etag`, `xml`, `deployed` elements on success, else a failure array.
1045
+ * Failure array will contain a failure `code`, and a failure `message`.
1046
+ */
1047
+ public static function amazon_cf_get_distro ($distro_id = FALSE, $distro_type = FALSE)
1048
+ {
1049
+ if ($distro_id && is_string ($distro_id) && $distro_type && is_string ($distro_type) && in_array ($distro_type, array ("downloads", "streaming")))
1050
+ {
1051
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
1052
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
1053
+ $cfc[$option] = $option_value;
1054
+ /**/
1055
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
1056
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
1057
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
1058
+ /**/
1059
+ $cf_domain = "cloudfront.amazonaws.com";
1060
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
1061
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
1062
+ $cf_location = ($distro_type === "streaming") ? "/2010-11-01/streaming-distribution/" . $distro_id : "/2010-11-01/distribution/" . $distro_id;
1063
+ $cf_args = array ("method" => "GET", "headers" => array ("Host" => $cf_domain, "Date" => $cf_date, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
1064
+ /**/
1065
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && (($cf_response["code"] === 404 && $cf_response["message"]) || ($cf_response["code"] === 200 && !empty ($cf_response["headers"]["etag"]) && !empty ($cf_response["body"]))))
1066
+ {
1067
+ if ($cf_response["code"] === 200 && !empty ($cf_response["headers"]["etag"]) && !empty ($cf_response["body"]))
1068
+ return array ("success" => true, "code" => null, "message" => null, "etag" => trim ($cf_response["headers"]["etag"]), "xml" => trim ($cf_response["body"]), "deployed" => ((stripos ($cf_response["body"], "<Status>Deployed</Status>") !== false) ? true : false));
1069
  /**/
1070
+ else /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1071
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Existing Amazon® CloudFront Distro NOT found. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1072
+ }
1073
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1074
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1075
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to acquire existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1076
+ /**/
1077
+ else /* Else, we use a default error code and message. */
1078
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to acquire existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1079
+ }
1080
+ else /* Else, we use a default error code and message. */
1081
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to acquire existing Amazon® CloudFront Distro. Invalid Distro ID and/or Distro type.", "s2member-admin", "s2member"));
1082
+ }
1083
+ /**
1084
+ * Disables an Amazon® S3/CloudFront Distro.
1085
+ *
1086
+ * @package s2Member\Files
1087
+ * @since 110926
1088
+ *
1089
+ * @param str $distro_id Required. A Distro ID.
1090
+ * @param str $distro_id_etag Required. A Distro ETag header.
1091
+ * @param str $distro_id_xml Required. A Distro's XML configuration.
1092
+ * @return array Array containing a true `success` and `etag`, `xml`, `deployed` elements on success, else a failure array.
1093
+ * Failure array will contain a failure `code`, and a failure `message`.
1094
+ */
1095
+ public static function amazon_cf_disable_distro ($distro_id = FALSE, $distro_id_etag = FALSE, $distro_id_xml = FALSE)
1096
+ {
1097
+ if ($distro_id && is_string ($distro_id) && $distro_id_etag && is_string ($distro_id_etag) && $distro_id_xml && is_string ($distro_id_xml) /* Parse type/reference too. */
1098
+ && ($distro_id_type = (stripos ($distro_id_xml, "<StreamingDistribution") !== false) ? "streaming" : ((stripos ($distro_id_xml, "<Distribution") !== false) ? "downloads" : false)) #
1099
+ && preg_match ("/\<CallerReference\>(.+?)\<\/CallerReference\>/is", $distro_id_xml, $distro_id_reference_tag) && ($distro_id_reference = $distro_id_reference_tag[1]))
1100
+ {
1101
+ if (stripos ($distro_id_xml, "<Enabled>false</Enabled>") === false) /* Only if it has NOT already been disabled. We do NOT need to do it again. */
1102
+ {
1103
+ if (stripos ($distro_id_xml, "<Status>Deployed</Status>") !== false) /* Check distro status before we even begin processing. */
1104
  {
1105
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
1106
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
1107
+ $cfc[$option] = $option_value;
1108
  /**/
1109
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
1110
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
1111
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
1112
  /**/
1113
+ $cf_domain = "cloudfront.amazonaws.com";
1114
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
1115
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
1116
+ $cf_location = ($distro_id_type === "streaming") ? "/2010-11-01/streaming-distribution/" . $distro_id . "/config" : "/2010-11-01/distribution/" . $distro_id . "/config";
1117
+ $cf_distro_xml = ($distro_id_type === "streaming") ? '<?xml version="1.0" encoding="UTF-8"?><StreamingDistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/"><S3Origin><DNSName>' . esc_html ($s3c["bucket"]) . '.s3.amazonaws.com</DNSName></S3Origin><CallerReference>' . esc_html ($distro_id_reference) . '</CallerReference><Enabled>false</Enabled><TrustedSigners><Self/></TrustedSigners></StreamingDistributionConfig>' : '<?xml version="1.0" encoding="UTF-8"?><DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/"><S3Origin><DNSName>' . esc_html ($s3c["bucket"]) . '.s3.amazonaws.com</DNSName></S3Origin><CallerReference>' . esc_html ($distro_id_reference) . '</CallerReference><Enabled>false</Enabled><TrustedSigners><Self/></TrustedSigners></DistributionConfig>';
1118
+ $cf_args = array ("method" => "PUT", "body" => $cf_distro_xml, "headers" => array ("Host" => $cf_domain, "Content-Type" => "application/xml", "Date" => $cf_date, "If-Match" => $distro_id_etag, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
1119
  /**/
1120
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && $cf_response["code"] === 200 && !empty ($cf_response["headers"]["etag"]) && !empty ($cf_response["body"]))
1121
+ return array ("success" => true, "code" => null, "message" => null, "etag" => trim ($cf_response["headers"]["etag"]), "xml" => trim ($cf_response["body"]), "deployed" => ((stripos ($cf_response["body"], "<Status>Deployed</Status>") !== false) ? true : false));
 
1122
  /**/
1123
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1124
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1125
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to disable existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
 
 
 
 
 
 
 
 
 
 
 
1126
  /**/
1127
+ else /* Else, we use a default error code and message. */
1128
+ return array ("success" => false, "code" => -97, "message" => _x ("Unable to disable existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
  }
1130
+ else /* Else, we use a default error code and message. */
1131
+ return array ("success" => false, "code" => -98, "message" => _x ("Existing Amazon® CloudFront Distro cannot be disabled at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1132
  }
1133
+ else /* Else, we use a default error code and message. */
1134
+ return array ("success" => true, "code" => null, "message" => null, "etag" => $distro_id_etag, "xml" => $distro_id_xml, "deployed" => ((stripos ($distro_id_xml, "<Status>Deployed</Status>") !== false) ? true : false));
1135
+ }
1136
+ else /* Else, we use a default error code and message. */
1137
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to disable existing Amazon® CloudFront Distro. Invalid Distro ID, ETag, or XML config.", "s2member-admin", "s2member"));
1138
  }
1139
  /**
1140
+ * Deletes an Amazon® S3/CloudFront Distro.
1141
  *
1142
  * @package s2Member\Files
1143
+ * @since 110926
1144
  *
1145
+ * @param str $distro_id Required. A Distro ID.
1146
+ * @param str $distro_id_etag Required. A Distro ETag header.
1147
+ * @param str $distro_id_xml Required. A Distro's XML configuration.
1148
+ * @return array Array containing a true `success` element on success, else a failure array.
1149
+ * Failure array will contain a failure `code`, and a failure `message`.
1150
  */
1151
+ public static function amazon_cf_del_distro ($distro_id = FALSE, $distro_id_etag = FALSE, $distro_id_xml = FALSE)
1152
  {
1153
+ if ($distro_id && is_string ($distro_id) && $distro_id_etag && is_string ($distro_id_etag) && $distro_id_xml && is_string ($distro_id_xml) /* Parse type/reference too. */
1154
+ && ($distro_id_type = (stripos ($distro_id_xml, "<StreamingDistribution") !== false) ? "streaming" : ((stripos ($distro_id_xml, "<Distribution") !== false) ? "downloads" : false)) #
1155
+ && preg_match ("/\<CallerReference\>(.+?)\<\/CallerReference\>/is", $distro_id_xml, $distro_id_reference_tag) && ($distro_id_reference = $distro_id_reference_tag[1]))
1156
+ {
1157
+ if (stripos ($distro_id_xml, "<Status>Deployed</Status>") !== false) /* Check distro status before we even begin processing this deletion. */
1158
+ {
1159
+ if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_disable_distro ($distro_id, $distro_id_etag, $distro_id_xml)) && $cf_response["success"])
1160
+ {
1161
+ if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro ($distro_id, $distro_id_type)) && $cf_response["success"] && $cf_response["deployed"])
1162
+ {
1163
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
1164
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
1165
+ $cfc[$option] = $option_value;
1166
+ /**/
1167
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
1168
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
1169
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
1170
+ /**/
1171
+ $cf_domain = "cloudfront.amazonaws.com";
1172
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
1173
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
1174
+ $cf_location = ($distro_id_type === "streaming") ? "/2010-11-01/streaming-distribution/" . $distro_id : "/2010-11-01/distribution/" . $distro_id;
1175
+ $cf_args = array ("method" => "DELETE", "headers" => array ("Host" => $cf_domain, "Date" => $cf_date, "If-Match" => $cf_response["etag"], "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
1176
+ /**/
1177
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && ($cf_response["code"] === 200 || $cf_response["code"] === 204 /* Deleted. */))
1178
+ return array ("success" => true, "code" => null, "message" => null); /* Deleted successfully. */
1179
+ /**/
1180
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1181
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1182
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to delete existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1183
+ /**/
1184
+ else /* Else, we use a default error code and message. */
1185
+ return array ("success" => false, "code" => -94, "message" => _x ("Unable to delete existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1186
+ }
1187
+ else if (isset ($cf_response["success"], $cf_response["deployed"]) && $cf_response["success"] && !$cf_response["deployed"])
1188
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1189
+ return array ("success" => false, "code" => -95, "message" => _x ("Existing Amazon® CloudFront Distro cannot be deleted at this time. Still in a `pending` state after having been disabled by s2Member. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1190
+ /**/
1191
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1192
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1193
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to check status of existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1194
+ /**/
1195
+ else /* Else, we use a default error code and message. */
1196
+ return array ("success" => false, "code" => -96, "message" => _x ("Unable to check status of existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1197
+ }
1198
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1199
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1200
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to disable existing Amazon® CloudFront Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1201
+ /**/
1202
+ else /* Else, we use a default error code and message. */
1203
+ return array ("success" => false, "code" => -97, "message" => _x ("Unable to disable existing Amazon® CloudFront Distro. Connection failed.", "s2member-admin", "s2member"));
1204
+ }
1205
+ else /* Else, we use a default error code and message. */
1206
+ return array ("success" => false, "code" => -98, "message" => _x ("Existing Amazon® CloudFront Distro cannot be deleted at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
1207
+ }
1208
+ else /* Else, we use a default error code and message. */
1209
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to delete existing Amazon® CloudFront Distro. Invalid Distro ID or ETag.", "s2member-admin", "s2member"));
1210
  }
1211
  /**
1212
+ * Creates an Amazon® S3/CloudFront Distro.
1213
  *
1214
  * @package s2Member\Files
1215
+ * @since 110926
1216
  *
1217
+ * @param str $distro_type Required: `downloads|streaming`.
1218
+ * @return array Array containing a true `success` and `distro_[distro_type]_id`, `distro_[distro_type]_dname` elements on success, else a failure array.
1219
+ * Failure array will contain a failure `code`, and a failure `message`.
 
1220
  */
1221
+ public static function amazon_cf_create_distro ($distro_type = FALSE)
1222
  {
1223
+ if ($distro_type && is_string ($distro_type) && in_array ($distro_type, array ("downloads", "streaming")))
 
 
 
 
1224
  {
1225
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
1226
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
1227
+ $cfc[$option] = $option_value;
1228
  /**/
1229
+ $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
1230
+ $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
1231
+ $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
1232
+ /**/
1233
+ $cf_domain = "cloudfront.amazonaws.com";
1234
+ $cf_date = gmdate ("D, d M Y H:i:s") . " GMT";
1235
+ $cf_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_cf_sign ($cf_date));
1236
+ /**/
1237
+ if ($distro_type === "downloads") /* Create a `downloads` Distro? This uses a different XML schema. */
1238
  {
1239
+ $cf_location = "/2010-11-01/distribution"; /* Create distro. */
1240
+ $cf_distro_downloads_reference = time () . "." . md5 ("downloads" . $s3c["bucket"] . $s3c["access_key"] . $s3c["secret_key"] . $cfc["private_key"] . $cfc["private_key_id"] . $cfc["distro_downloads_cname"]);
1241
+ $cf_distro_downloads_xml = '<?xml version="1.0" encoding="UTF-8"?><DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/"><S3Origin><DNSName>' . esc_html ($s3c["bucket"]) . '.s3.amazonaws.com</DNSName><OriginAccessIdentity>origin-access-identity/cloudfront/' . esc_html ($cfc["distros_access_id"]) . '</OriginAccessIdentity></S3Origin><CallerReference>' . esc_html ($cf_distro_downloads_reference) . '</CallerReference>' . (($cfc["distro_downloads_cname"]) ? '<CNAME>' . esc_html ($cfc["distro_downloads_cname"]) . '</CNAME>' : '') . '<Comment>' . esc_html (sprintf (_x ("Created by s2Member, for S3 Bucket: %s.", "s2member-admin", "s2member"), $s3c["bucket"])) . '</Comment><Enabled>true</Enabled><DefaultRootObject>index.html</DefaultRootObject><TrustedSigners><Self/></TrustedSigners></DistributionConfig>';
1242
+ $cf_args = array ("method" => "POST", "body" => $cf_distro_downloads_xml, "headers" => array ("Host" => $cf_domain, "Content-Type" => "application/xml", "Date" => $cf_date, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
1243
+ /**/
1244
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && ($cf_response["code"] === 200 || $cf_response["code"] === 201 /* Created. */))
1245
+ {
1246
+ if (preg_match ("/\<Distribution.*?\>(.+?)\<\/Distribution\>/is", $cf_response["body"], $cf_distro_downloads_tag) && preg_match ("/\<Id\>(.+?)\<\/Id\>/is", $cf_distro_downloads_tag[1], $cf_distro_downloads_id_tag) && preg_match ("/\<DomainName\>(.+?)\<\/DomainName\>/is", $cf_distro_downloads_tag[1], $cf_distro_downloads_dname_tag))
1247
+ return array ("success" => true, "code" => null, "message" => null, "distro_downloads_id" => trim ($cf_distro_downloads_id_tag[1]), "distro_downloads_dname" => trim ($cf_distro_downloads_dname_tag[1]));
1248
+ else /* Else, we use a default error code and message. */
1249
+ return array ("success" => false, "code" => -97, "message" => _x ("Unable to create/read Amazon® CloudFront Downloads Distro. Unexpected response.", "s2member-admin", "s2member"));
1250
+ }
1251
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1252
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1253
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to create Amazon® CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1254
+ else /* Else, we use a default error code and message. */
1255
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to create Amazon® CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
1256
  }
1257
+ /**/
1258
+ else if ($distro_type === "streaming") /* Create a `streaming` Distro? A different XML schema. */
1259
  {
1260
+ $cf_location = "/2010-11-01/streaming-distribution"; /* Create streaming distro. */
1261
+ $cf_distro_streaming_reference = time () . "." . md5 ("streaming" . $s3c["bucket"] . $s3c["access_key"] . $s3c["secret_key"] . $cfc["private_key"] . $cfc["private_key_id"] . $cfc["distro_streaming_cname"]);
1262
+ $cf_distro_streaming_xml = '<?xml version="1.0" encoding="UTF-8"?><StreamingDistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/"><S3Origin><DNSName>' . esc_html ($s3c["bucket"]) . '.s3.amazonaws.com</DNSName><OriginAccessIdentity>origin-access-identity/cloudfront/' . esc_html ($cfc["distros_access_id"]) . '</OriginAccessIdentity></S3Origin><CallerReference>' . esc_html ($cf_distro_streaming_reference) . '</CallerReference>' . (($cfc["distro_streaming_cname"]) ? '<CNAME>' . esc_html ($cfc["distro_streaming_cname"]) . '</CNAME>' : '') . '<Comment>' . esc_html (sprintf (_x ("Created by s2Member, for S3 Bucket: %s.", "s2member-admin", "s2member"), $s3c["bucket"])) . '</Comment><Enabled>true</Enabled><DefaultRootObject>index.html</DefaultRootObject><TrustedSigners><Self/></TrustedSigners></StreamingDistributionConfig>';
1263
+ $cf_args = array ("method" => "POST", "body" => $cf_distro_streaming_xml, "headers" => array ("Host" => $cf_domain, "Content-Type" => "application/xml", "Date" => $cf_date, "Authorization" => "AWS " . $cfc["access_key"] . ":" . $cf_signature));
1264
+ /**/
1265
+ if (($cf_response = c_ws_plugin__s2member_utils_urls::remote ("https://" . $cf_domain . $cf_location, false, array_merge ($cf_args, array ("timeout" => 20)), "array")) && ($cf_response["code"] === 200 || $cf_response["code"] === 201 /* Created. */))
1266
+ {
1267
+ if (preg_match ("/\<StreamingDistribution.*?\>(.+?)\<\/StreamingDistribution\>/is", $cf_response["body"], $cf_distro_streaming_tag) && preg_match ("/\<Id\>(.+?)\<\/Id\>/is", $cf_distro_streaming_tag[1], $cf_distro_streaming_id_tag) && preg_match ("/\<DomainName\>(.+?)\<\/DomainName\>/is", $cf_distro_streaming_tag[1], $cf_distro_streaming_dname_tag))
1268
+ return array ("success" => true, "code" => null, "message" => null, "distro_streaming_id" => trim ($cf_distro_streaming_id_tag[1]), "distro_streaming_dname" => trim ($cf_distro_streaming_dname_tag[1]));
1269
+ else /* Else, we use a default error code and message. */
1270
+ return array ("success" => false, "code" => -97, "message" => _x ("Unable to create/read Amazon® CloudFront Streaming Distro. Unexpected response.", "s2member-admin", "s2member"));
1271
+ }
1272
+ else if (isset ($cf_response["code"], $cf_response["message"]))
1273
+ /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon® CloudFront API call. Feel free to exclude `%s` if you like. */
1274
+ return array ("success" => false, "code" => $cf_response["code"], "message" => sprintf (_x ("Unable to create Amazon® CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
1275
+ else /* Else, we use a default error code and message. */
1276
+ return array ("success" => false, "code" => -98, "message" => _x ("Unable to create Amazon® CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
1277
  }
 
 
1278
  }
1279
+ else /* Else, we use a default error code and message. */
1280
+ return array ("success" => false, "code" => -99, "message" => _x ("Unable to create Amazon® CloudFront Distro. Invalid Distro type.", "s2member-admin", "s2member"));
1281
  }
1282
  }
1283
  }
includes/classes/files.inc.php CHANGED
@@ -34,17 +34,62 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
34
  * @since 110524RC
35
  *
36
  * @attaches-to: ``add_action("init");``
 
37
  *
38
- * @return null|inner Return-value of inner routine.
 
 
 
39
  */
40
- public static function check_file_download_access ()
41
  {
42
- if (!empty ($_GET["s2member_file_download"])) /* Call inner routine? */
43
  {
44
- return c_ws_plugin__s2member_files_in::check_file_download_access ();
45
  }
46
  }
47
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  * Determines the max period ( in days ), for Download Access.
49
  *
50
  * @package s2Member\Files
@@ -106,7 +151,7 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
106
  /**/
107
  $allowed = $allowed_days = $currently = 0; /* Initialize all of these to zero. */
108
  /**/
109
- if ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && ($user_id = $user->ID))
110
  {
111
  for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
112
  {
@@ -153,21 +198,16 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
153
  do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
154
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
155
  /**/
156
- if ($directive === "ip-forever")
157
- {
158
- $allow_caching = false;
159
- $salt = $file . $_SERVER["REMOTE_ADDR"];
160
- }
161
- else if ($directive === "universal" || $directive === "cache-compatible" || !empty ($directive))
162
- {
163
- $allow_caching = true;
164
- $salt = $file;
165
- }
166
- else /* Otherwise, we use the default ``$salt``. */
167
- {
168
- $allow_caching = false;
169
- $salt = date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file;
170
- }
171
  /**/
172
  $key = md5 (c_ws_plugin__s2member_utils_encryption::xencrypt ($salt));
173
  /**/
34
  * @since 110524RC
35
  *
36
  * @attaches-to: ``add_action("init");``
37
+ * @also-called-by: API Function {@link s2Member\API_Functions\s2member_file_download_url()}, w/ ``$create_file_download_url`` param.
38
  *
39
+ * @param array $create_file_download_url Optional. If this function is called directly, we can pass arguments through this array.
40
+ * Possible array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `ignore_user`.
41
+ * @return null|str If called directly with ``$create_file_download_url``, returns a string with the URL, based on configuration.
42
+ * Else, this function may exit script execution after serving a File Download.
43
  */
44
+ public static function check_file_download_access ($create_file_download_url = FALSE) /* Calls inner routine. */
45
  {
46
+ if (is_array ($create_file_download_url) || !empty ($_GET["s2member_file_download"])) /* Call inner routine? */
47
  {
48
+ return c_ws_plugin__s2member_files_in::check_file_download_access ($create_file_download_url);
49
  }
50
  }
51
  /**
52
+ * Generates a File Download URL for access to a file protected by s2Member.
53
+ *
54
+ * @package s2Member\Files
55
+ * @since 110926
56
+ *
57
+ * @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
58
+ * Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `ignore_user`.
59
+ * @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
60
+ * Note: by default, this function DOES consider the current User/Member. If `ignore_user` is NOT set, or is set to false, this function MAY very well return false, when/if the current User/Member is NOT allowed access to the `file_download`, based on configuration.
61
+ */
62
+ public static function create_file_download_url ($config = FALSE, $get_streamer_array = FALSE) /* Calls inner routine. */
63
+ {
64
+ return c_ws_plugin__s2member_files_in::create_file_download_url ($config, $get_streamer_array);
65
+ }
66
+ /**
67
+ * Auto-configures an Amazon® S3 Bucket's ACLs.
68
+ *
69
+ * @package s2Member\Files
70
+ * @since 110926
71
+ *
72
+ * @return bool|array True on success, else array on failure.
73
+ * Failure array will contain a failure `code`, and a failure `message`.
74
+ */
75
+ public static function amazon_s3_auto_configure_acls () /* Calls inner routine. */
76
+ {
77
+ return c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls ();
78
+ }
79
+ /**
80
+ * Auto-configures Amazon® S3/CloudFront distros.
81
+ *
82
+ * @package s2Member\Files
83
+ * @since 110926
84
+ *
85
+ * @return bool|array True on success, else array on failure.
86
+ * Failure array will contain a failure `code`, and a failure `message`.
87
+ */
88
+ public static function amazon_s3_cf_auto_configure_distros () /* Calls inner routine. */
89
+ {
90
+ return c_ws_plugin__s2member_files_in::amazon_s3_cf_auto_configure_distros ();
91
+ }
92
+ /**
93
  * Determines the max period ( in days ), for Download Access.
94
  *
95
  * @package s2Member\Files
151
  /**/
152
  $allowed = $allowed_days = $currently = 0; /* Initialize all of these to zero. */
153
  /**/
154
+ if ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty ($user->ID) && ($user_id = $user->ID))
155
  {
156
  for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
157
  {
198
  do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
199
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
200
  /**/
201
+ $file = ($file && is_string ($file) && ($file = trim ($file, "/"))) ? $file : "";
202
+ /**/
203
+ if ($directive === "ip-forever") /* Allows the current IP forever. */
204
+ eval ('$allow_caching = false; $salt = $file . $_SERVER["REMOTE_ADDR"];');
205
+ /**/
206
+ else if ($directive === "universal" || $directive === "cache-compatible" || $directive)
207
+ eval ('$allow_caching = true; $salt = $file;');
208
+ /**/
209
+ else /* Otherwise, we use the default ``$salt``, which is VERY restrictive; even to a specific browser. */
210
+ eval ('$allow_caching = false; $salt = date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file;');
 
 
 
 
 
211
  /**/
212
  $key = md5 (c_ws_plugin__s2member_utils_encryption::xencrypt ($salt));
213
  /**/
includes/classes/list-servers.inc.php CHANGED
@@ -80,7 +80,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
80
  {
81
  $ccaps = implode (",", c_ws_plugin__s2member_user_access::user_access_ccaps ($user)); /* Get Custom Capabilities ( comma-delimited ). */
82
  /**/
83
- $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (false); /* s2Member Filters enabled? */
84
  c_ws_plugin__s2member_email_configs::email_config_release (true); /* Release all mail Filters before we begin this routine. */
85
  /**/
86
  if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
@@ -216,7 +216,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
216
  /**/
217
  if (($args = func_get_args ()) && $role && strlen ($level) && $login && is_email ($email) && $opt_out && $user_id && is_object ($user = new WP_User ($user_id)) && ($user_id = $user->ID))
218
  {
219
- $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (false); /* s2Member Filters enabled? */
220
  c_ws_plugin__s2member_email_configs::email_config_release (true); /* Release all mail Filters before we begin this routine. */
221
  /**/
222
  if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
80
  {
81
  $ccaps = implode (",", c_ws_plugin__s2member_user_access::user_access_ccaps ($user)); /* Get Custom Capabilities ( comma-delimited ). */
82
  /**/
83
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (); /* s2Member Filters enabled? */
84
  c_ws_plugin__s2member_email_configs::email_config_release (true); /* Release all mail Filters before we begin this routine. */
85
  /**/
86
  if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
216
  /**/
217
  if (($args = func_get_args ()) && $role && strlen ($level) && $login && is_email ($email) && $opt_out && $user_id && is_object ($user = new WP_User ($user_id)) && ($user_id = $user->ID))
218
  {
219
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (); /* s2Member Filters enabled? */
220
  c_ws_plugin__s2member_email_configs::email_config_release (true); /* Release all mail Filters before we begin this routine. */
221
  /**/
222
  if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
includes/classes/login-redirects-r.inc.php CHANGED
@@ -28,7 +28,26 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects_r"))
28
  class c_ws_plugin__s2member_login_redirects_r
29
  {
30
  /**
31
- * Removes ``login_redirect`` Filters to prevent conflicts with s2Member.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  *
33
  * @attaches-to: ``add_action("init");``
34
  *
@@ -37,12 +56,17 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects_r"))
37
  *
38
  * @return null
39
  */
40
- public static function remove_login_redirect_filters () /* For compatibility. */
41
  {
42
  do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
43
  /**/
44
  if (!apply_filters ("ws_plugin__s2member_allow_other_login_redirect_filters", false, get_defined_vars ()))
45
- remove_all_filters("login_redirect"); /* Removes all `login_redirect` Filters. */
 
 
 
 
 
46
  /**/
47
  do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
48
  /**/
28
  class c_ws_plugin__s2member_login_redirects_r
29
  {
30
  /**
31
+ * Handles completely empty ``login_redirect`` values.
32
+ *
33
+ * Some plugins ( most notably BuddyPress v1.5 ) have a nasty habit of sending an empty ``$_REQUEST["redirect_to"]`` input field with login widgets.
34
+ * In the case of BuddyPress, it's own Filter against `login_redirect` will deal with empty values. However, since s2Member removes all Filters
35
+ * against `login_redirect` ( for compatibility ), we NEED this simple routine to check empty values, and default them to ``admin_url()``.
36
+ *
37
+ * @attaches-to: ``add_filter("login_redirect");``
38
+ *
39
+ * @package s2Member\Login_Redirects
40
+ * @since 110926
41
+ *
42
+ * @param str $redirect_to Expects the current ``$redirect_to`` value, passed in by the Filter.
43
+ * @return str A non-empty string value. s2Member will NEVER allow this to be completely empty.
44
+ */
45
+ public static function _empty_login_redirect_filter ($redirect_to = FALSE)
46
+ {
47
+ return (empty ($redirect_to)) ? admin_url () : $redirect_to;
48
+ }
49
+ /**
50
+ * Removes all other ``login_redirect`` Filters to prevent conflicts with s2Member.
51
  *
52
  * @attaches-to: ``add_action("init");``
53
  *
56
  *
57
  * @return null
58
  */
59
+ public static function remove_login_redirect_filters () /* Prevents conflicts. */
60
  {
61
  do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
62
  /**/
63
  if (!apply_filters ("ws_plugin__s2member_allow_other_login_redirect_filters", false, get_defined_vars ()))
64
+ {
65
+ remove_all_filters("login_redirect"); /* Removes all `login_redirect` Filters. */
66
+ add_filter ("login_redirect", "c_ws_plugin__s2member_login_redirects_r::_empty_login_redirect_filter");
67
+ /**/
68
+ do_action ("ws_plugin__s2member_during_remove_login_redirect_filters", get_defined_vars ());
69
+ }
70
  /**/
71
  do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
72
  /**/
includes/classes/login-redirects.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_redirects"))
21
  {
@@ -40,13 +40,13 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
40
  */
41
  public static function login_redirect ($username = FALSE)
42
  {
43
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
  do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
45
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
  /**/
47
- $username = (!$username && is_object ($user = wp_get_current_user ())) ? strtolower ($user->user_login) : strtolower ($username);
48
  /**/
49
- if ($username && (is_object ($user) || is_object ($user = new WP_User ($username))) && ($user_id = $user->ID))
50
  {
51
  if (!get_user_option ("s2member_registration_ip", $user_id)) /* Have we got this yet? */
52
  update_user_option ($user_id, "s2member_registration_ip", $_SERVER["REMOTE_ADDR"]);
@@ -55,7 +55,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
55
  update_user_option ($user_id, "s2member_login_counter", $logins);
56
  /**/
57
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) /* Nag em? */
58
- delete_user_setting("default_password_nag") . update_user_option ($user_id, "default_password_nag", false, true);
59
  /**/
60
  $disable_login_ip_restrictions = apply_filters ("ws_plugin__s2member_disable_login_ip_restrictions", false, get_defined_vars ());
61
  /**/
@@ -66,27 +66,27 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
66
  {
67
  $obey_redirect_to = apply_filters ("ws_plugin__s2member_obey_login_redirect_to", /* By default, we obey this. */ true, get_defined_vars ());
68
  /**/
69
- if (!$obey_redirect_to || empty ($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === "wp-admin/" || $_REQUEST["redirect_to"] === admin_url ())
70
  {
71
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
  do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
73
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
  /**/
75
  if ($redirect && is_string ($redirect)) /* Is this a string? */
76
- wp_redirect($redirect); /* Dynamic URL introduced by a Filter. */
77
  /**/
78
  else if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
79
- wp_redirect($redirection_url); /* Special Redirection URL configured with s2Member. */
80
  /**/
81
  else /* Else we use the Login Welcome Page configured for s2Member. */
82
- wp_redirect(get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
83
  /**/
84
  exit (); /* Clean exit. */
85
  }
86
  }
87
  }
88
  /**/
89
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
90
  do_action ("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
91
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
  /**/
@@ -104,7 +104,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
104
  */
105
  public static function login_redirection_url ($user = FALSE, $root_returns_false = FALSE)
106
  {
107
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
108
  do_action ("ws_plugin__s2member_before_login_redirection_url", get_defined_vars ());
109
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
110
  /**/
@@ -125,7 +125,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
125
  */
126
  public static function login_redirection_uri ($user = FALSE, $root_returns_false = FALSE)
127
  {
128
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
129
  do_action ("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
130
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
131
  /**/
@@ -147,7 +147,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
147
  */
148
  public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
149
  {
150
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
151
  do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
152
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
  /**/
@@ -155,8 +155,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
155
  /**/
156
  $user = ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty ($user->ID)) ? $user : false;
157
  /**/
158
- $user_login = ($user) ? (string)strtolower ($user->user_login) : "";
159
  $user_id = ($user) ? (string)$user->ID : "";
 
160
  /**/
161
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
162
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
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_redirects"))
21
  {
40
  */
41
  public static function login_redirect ($username = FALSE)
42
  {
43
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
  do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
45
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
  /**/
47
+ $username = (!$username && is_object ($user = wp_get_current_user ()) && !empty ($user->user_login)) ? strtolower ($user->user_login) : strtolower ($username);
48
  /**/
49
+ if ($username && ((isset ($user) && is_object ($user)) || is_object ($user = new WP_User ($username))) && !empty ($user->ID) && ($user_id = $user->ID))
50
  {
51
  if (!get_user_option ("s2member_registration_ip", $user_id)) /* Have we got this yet? */
52
  update_user_option ($user_id, "s2member_registration_ip", $_SERVER["REMOTE_ADDR"]);
55
  update_user_option ($user_id, "s2member_login_counter", $logins);
56
  /**/
57
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) /* Nag em? */
58
+ delete_user_setting ("default_password_nag") . update_user_option ($user_id, "default_password_nag", false, true);
59
  /**/
60
  $disable_login_ip_restrictions = apply_filters ("ws_plugin__s2member_disable_login_ip_restrictions", false, get_defined_vars ());
61
  /**/
66
  {
67
  $obey_redirect_to = apply_filters ("ws_plugin__s2member_obey_login_redirect_to", /* By default, we obey this. */ true, get_defined_vars ());
68
  /**/
69
+ if (!$obey_redirect_to || empty ($_REQUEST["redirect_to"]) || !is_string ($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === admin_url () || preg_match ("/^\/?wp-admin\/?$/", $_REQUEST["redirect_to"]))
70
  {
71
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
  do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
73
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
  /**/
75
  if ($redirect && is_string ($redirect)) /* Is this a string? */
76
+ wp_redirect ($redirect); /* Dynamic URL introduced by a Filter? */
77
  /**/
78
  else if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
79
+ wp_redirect ($redirection_url); /* Special Redirection URL configured with s2Member. */
80
  /**/
81
  else /* Else we use the Login Welcome Page configured for s2Member. */
82
+ wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
83
  /**/
84
  exit (); /* Clean exit. */
85
  }
86
  }
87
  }
88
  /**/
89
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
90
  do_action ("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
91
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
  /**/
104
  */
105
  public static function login_redirection_url ($user = FALSE, $root_returns_false = FALSE)
106
  {
107
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
108
  do_action ("ws_plugin__s2member_before_login_redirection_url", get_defined_vars ());
109
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
110
  /**/
125
  */
126
  public static function login_redirection_uri ($user = FALSE, $root_returns_false = FALSE)
127
  {
128
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
129
  do_action ("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
130
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
131
  /**/
147
  */
148
  public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
149
  {
150
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
151
  do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
152
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
  /**/
155
  /**/
156
  $user = ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty ($user->ID)) ? $user : false;
157
  /**/
 
158
  $user_id = ($user) ? (string)$user->ID : "";
159
+ $user_login = ($user) ? (string)strtolower ($user->user_login) : "";
160
  /**/
161
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
162
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
includes/classes/menu-pages.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_menu_pages"))
21
  {
@@ -36,45 +36,45 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
36
  * @since 3.5
37
  *
38
  * @param array $new_options Optional. Force feed an array of new options. Defaults to ``$_POST`` vars.
 
39
  * @param bool $verified Optional. Defaults to false. If true, ``wp_verify_nonce()`` is skipped in this routine.
40
  * @param bool $update_other Optional. Defaults to true. If false, other option-dependent routines will not be processed.
41
  * @param bool|array $display_notices Optional. Defaults to true. Can be false, or an array of certain notices that can be displayed.
42
  * @param bool|array $enqueue_notices Optional. Defaults to false. Can be true, or an array of certain notices that should be enqueued.
43
  * @param bool $request_refresh Optional. Defaults to false. If true, resulting `success` notice will include a link to refresh the menu page.
44
- * @return bool True if options were updated successfully.
45
  */
46
  public static function update_all_options ($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE, $request_refresh = FALSE)
47
  {
48
- do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use `wp_verify_nonce()`. */
 
 
 
 
49
  /**/
50
  if ($verified || (!empty ($_POST["ws_plugin__s2member_options_save"]) && ($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save")))
51
  {
52
- $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Here we get all of the existing options. */
53
- $new_options = (is_array ($new_options)) ? $new_options : ((!empty ($_POST)) ? stripslashes_deep ($_POST) : array ());
 
54
  $new_options = c_ws_plugin__s2member_utils_strings::trim_deep ($new_options);
55
  /**/
56
- foreach ((array)$new_options as $key => $value) /* Looking for relevant keys. */
57
- if (preg_match ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", $key))
58
  /**/
59
- if ($key === "ws_plugin__s2member_configured") /* Configured. */
60
- {
61
- update_option ("ws_plugin__s2member_configured", $value);
62
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = $value;
63
- }
64
- else /* Place this option into the array. Remove ws_plugin__s2member_. */
65
- {
66
- (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded. */
67
- $key = preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key);
68
- $options[$key] = $value; /* Overriding a possible existing option. */
69
- }
70
  /**/
71
- $options["options_version"] = (string)($options["options_version"] + 0.001);
72
- $options = ws_plugin__s2member_configure_options_and_their_defaults ($options);
73
  /**/
74
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
75
- do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ());
76
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
77
  /**/
 
78
  update_option ("ws_plugin__s2member_options", $options) . ((is_multisite () && is_main_site ()) ? update_site_option ("ws_plugin__s2member_options", $options) : null) . update_option ("ws_plugin__s2member_cache", array ());
79
  /**/
80
  if ($update_other === true || in_array ("auto_eot_system", (array)$update_other)) /* Handle the Auto-EOT System now ( enable/disable ). */
@@ -83,7 +83,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
83
  if (($display_notices === true || in_array ("success", (array)$display_notices)) && ($notice = '<strong>Options saved.' . (($request_refresh) ? ' Please <a href="' . esc_attr ($_SERVER["REQUEST_URI"]) . '">refresh</a>.' : '') . '</strong>'))
84
  ($enqueue_notices === true || in_array ("success", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*") : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice);
85
  /**/
86
- if ($_GET["page"] !== "ws-plugin--s2member-mms-ops") /* Do NOT display page-conflict-warnings on the Main Multisite Configuration panel. */
87
  {
88
  if (!$options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <code>s2Member -> General Options -> Membership Options Page</code>.'))
89
  ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
@@ -107,12 +107,14 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
107
  ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
108
  }
109
  /**/
110
- $updated_all_options = true; /* Flag indicating this routine was indeed processed. */
111
  }
112
  /**/
113
- do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ());
 
 
114
  /**/
115
- return isset ($updated_all_options) ? $updated_all_options : false;
116
  }
117
  /**
118
  * Adds option menus / sub-menus.
@@ -259,7 +261,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
259
  */
260
  public static function _add_settings_link ($links = FALSE, $file = FALSE)
261
  {
262
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
263
  do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
264
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
265
  /**/
@@ -268,7 +270,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
268
  $settings = '<a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-gen-ops")) . '">Settings</a>';
269
  array_unshift ($links, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
270
  /**/
271
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
272
  do_action ("_ws_plugin__s2member_during_add_settings_link", get_defined_vars ());
273
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
274
  }
@@ -291,10 +293,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
291
  /**/
292
  if (!empty ($_GET["page"]) && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
293
  {
294
- wp_enqueue_script ("jquery");
295
- wp_enqueue_script ("thickbox");
296
- wp_enqueue_script ("media-upload");
297
- wp_enqueue_script ("jquery-ui-core");
298
  wp_enqueue_script ("jquery-sprintf", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/jquery/jquery.sprintf/jquery.sprintf-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
299
  wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/jquery/jquery.json-ps/jquery.json-ps-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
300
  wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/jquery/jquery.ui-effects/jquery.ui-effects-min.js", array ("jquery", "jquery-ui-core"), c_ws_plugin__s2member_utilities::ver_checksum ());
@@ -323,7 +325,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
323
  /**/
324
  if (!empty ($_GET["page"]) && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
325
  {
326
- wp_enqueue_style ("thickbox");
327
  wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
328
  /**/
329
  do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
@@ -492,6 +494,14 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
492
  else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
493
  c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unprotected. The .htaccess protection file ( <code>' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($htaccess)) . '</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html ($htaccess_contents) . '</pre>', true);
494
  /**/
 
 
 
 
 
 
 
 
495
  include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
496
  /**/
497
  do_action ("ws_plugin__s2member_after_down_ops_page", 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_menu_pages"))
21
  {
36
  * @since 3.5
37
  *
38
  * @param array $new_options Optional. Force feed an array of new options. Defaults to ``$_POST`` vars.
39
+ * If ``$new_options`` are passed in, be SURE that you've already applied ``stripslashes_deep()``.
40
  * @param bool $verified Optional. Defaults to false. If true, ``wp_verify_nonce()`` is skipped in this routine.
41
  * @param bool $update_other Optional. Defaults to true. If false, other option-dependent routines will not be processed.
42
  * @param bool|array $display_notices Optional. Defaults to true. Can be false, or an array of certain notices that can be displayed.
43
  * @param bool|array $enqueue_notices Optional. Defaults to false. Can be true, or an array of certain notices that should be enqueued.
44
  * @param bool $request_refresh Optional. Defaults to false. If true, resulting `success` notice will include a link to refresh the menu page.
45
+ * @return bool True if all s2Member options were updated successfully, else false.
46
  */
47
  public static function update_all_options ($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE, $request_refresh = FALSE)
48
  {
49
+ $updated_all_options = false; /* Initialize this to a value of false. Initializing this variable here makes it an available reference-variable to Hooks/Filters. */
50
+ /**/
51
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
+ do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use ``wp_verify_nonce()``. */
53
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
  /**/
55
  if ($verified || (!empty ($_POST["ws_plugin__s2member_options_save"]) && ($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save")))
56
  {
57
+ $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Acquire the full existing configuration options array here. */
58
+ /**/
59
+ $new_options = (is_array ($new_options)) ? $new_options : ((!empty ($_POST) && is_array ($_POST)) ? stripslashes_deep ($_POST) : array ());
60
  $new_options = c_ws_plugin__s2member_utils_strings::trim_deep ($new_options);
61
  /**/
62
+ foreach ($new_options as $key => $value) /* Find all keys contained within ``$new_options`` matching `^ws_plugin__s2member_`. */
63
+ if (strpos ($key, "ws_plugin__s2member_") === 0) /* A relevant ``$new_options`` key matching `^ws_plugin__s2member_`? */
64
  /**/
65
+ if ($key === "ws_plugin__s2member_configured") /* s2Member is now configured ( according to these options )? */
66
+ ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = $value) . update_option ("ws_plugin__s2member_configured", $value);
67
+ /**/
68
+ else if (!is_array ($value) || (is_array ($value) && /* Updating an array? */ array_shift ($value) === "update-signal"))
69
+ $options[preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key)] = $value;
 
 
 
 
 
 
70
  /**/
71
+ unset ($key, $value); /* Unset these utility variables now. This prevents bleeding vars into Hooks/Filters that are of no use. */
 
72
  /**/
73
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
74
+ do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use ``wp_verify_nonce()``. */
75
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
76
  /**/
77
+ $options = ws_plugin__s2member_configure_options_and_their_defaults (($options = array_merge ($options, array ("options_version" => (string)($options["options_version"] + 0.001)))));
78
  update_option ("ws_plugin__s2member_options", $options) . ((is_multisite () && is_main_site ()) ? update_site_option ("ws_plugin__s2member_options", $options) : null) . update_option ("ws_plugin__s2member_cache", array ());
79
  /**/
80
  if ($update_other === true || in_array ("auto_eot_system", (array)$update_other)) /* Handle the Auto-EOT System now ( enable/disable ). */
83
  if (($display_notices === true || in_array ("success", (array)$display_notices)) && ($notice = '<strong>Options saved.' . (($request_refresh) ? ' Please <a href="' . esc_attr ($_SERVER["REQUEST_URI"]) . '">refresh</a>.' : '') . '</strong>'))
84
  ($enqueue_notices === true || in_array ("success", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*") : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice);
85
  /**/
86
+ if (empty ($_GET["page"]) || $_GET["page"] !== "ws-plugin--s2member-mms-ops") /* Do NOT display page-conflict-warnings on the Main Multisite Configuration panel. */
87
  {
88
  if (!$options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <code>s2Member -> General Options -> Membership Options Page</code>.'))
89
  ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
107
  ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "*:*", true) : c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice, true);
108
  }
109
  /**/
110
+ $updated_all_options = true; /* Flag indicating this routine was processed successfully; and that all s2Member options have been updated successfully.*/
111
  }
112
  /**/
113
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
114
+ do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use ``wp_verify_nonce()``. */
115
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
116
  /**/
117
+ return apply_filters ("ws_plugin__s2member_update_all_options", (($updated_all_options) ? true : false), get_defined_vars ());
118
  }
119
  /**
120
  * Adds option menus / sub-menus.
261
  */
262
  public static function _add_settings_link ($links = FALSE, $file = FALSE)
263
  {
264
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
265
  do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
266
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
267
  /**/
270
  $settings = '<a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-gen-ops")) . '">Settings</a>';
271
  array_unshift ($links, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
272
  /**/
273
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
274
  do_action ("_ws_plugin__s2member_during_add_settings_link", get_defined_vars ());
275
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
  }
293
  /**/
294
  if (!empty ($_GET["page"]) && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
295
  {
296
+ wp_enqueue_script("jquery");
297
+ wp_enqueue_script("thickbox");
298
+ wp_enqueue_script("media-upload");
299
+ wp_enqueue_script("jquery-ui-core");
300
  wp_enqueue_script ("jquery-sprintf", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/jquery/jquery.sprintf/jquery.sprintf-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
301
  wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/jquery/jquery.json-ps/jquery.json-ps-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
302
  wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/jquery/jquery.ui-effects/jquery.ui-effects-min.js", array ("jquery", "jquery-ui-core"), c_ws_plugin__s2member_utilities::ver_checksum ());
325
  /**/
326
  if (!empty ($_GET["page"]) && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
327
  {
328
+ wp_enqueue_style("thickbox");
329
  wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
330
  /**/
331
  do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
494
  else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
495
  c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unprotected. The .htaccess protection file ( <code>' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($htaccess)) . '</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html ($htaccess_contents) . '</pre>', true);
496
  /**/
497
+ if (!empty ($_POST["ws_plugin__s2member_amazon_cf_files_auto_configure_distros"]) && ($nonce = $_POST["ws_plugin__s2member_amazon_cf_files_auto_configure_distros"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-amazon-cf-files-auto-configure-distros"))
498
+ /**/
499
+ if (($amazon_cf_auto_configure_distros = c_ws_plugin__s2member_files_in::amazon_cf_auto_configure_distros ()) && $amazon_cf_auto_configure_distros["success"]) /* CNAME instructions here too. */
500
+ c_ws_plugin__s2member_admin_notices::display_admin_notice ('Amazon® CloudFront Distributions auto-configured successfully. Please allow 30 minutes for propagation.' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) ? '<br /><em>Downloads Distribution CNAME: <code>' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . ' &mdash;&raquo; ' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]) . '</code></em>' : '') . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) ? '<br /><em>Streaming Distribution CNAME: <code>' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . ' &mdash;&raquo; ' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]) . '</code></em>' : ''));
501
+ /**/
502
+ else /* Else there was an error. We need to report this back to the site owner so they can understand what's going on. */
503
+ ($GLOBALS["ws_plugin__s2member_cf_auto_configure_distros_error"] = true) . c_ws_plugin__s2member_admin_notices::display_admin_notice ('Unable to auto-configure Amazon® CloudFront Distributions.<br />Error code: <code>' . esc_html ($amazon_cf_auto_configure_distros["code"]) . '</code>. Error Message: <code>' . esc_html ($amazon_cf_auto_configure_distros["message"]) . '</code>', true);
504
+ /**/
505
  include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
506
  /**/
507
  do_action ("ws_plugin__s2member_after_down_ops_page", get_defined_vars ());
includes/classes/option-forces.inc.php CHANGED
@@ -236,12 +236,13 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
236
  /**
237
  * Register access in BuddyPress, for Multisite compatibility.
238
  *
239
- * BuddyPress bypasses the default Filter `pre_site_option_registration`, and instead uses: ``bp_core_get_site_options()``.
240
  *
241
  * @package s2Member\Option_Forces
242
  * @since 3.5
243
  *
244
- * @attaches-to: ``add_filter("bp_core_get_site_options");``
 
245
  *
246
  * @param array $site_options Expects array of BuddyPress site options.
247
  * @return array Site options array, after having been Filtered by this routine.
236
  /**
237
  * Register access in BuddyPress, for Multisite compatibility.
238
  *
239
+ * BuddyPress bypasses the default Filter `pre_site_option_registration`, and instead uses: ``bp_core_get_root_options()``.
240
  *
241
  * @package s2Member\Option_Forces
242
  * @since 3.5
243
  *
244
+ * @attaches-to: ``add_filter("bp_core_get_root_options");``
245
+ * @attaches-to: ``add_filter("bp_core_get_site_options");`` **( before BuddyPress v1.5 )**.
246
  *
247
  * @param array $site_options Expects array of BuddyPress site options.
248
  * @return array Site options array, after having been Filtered by this routine.
includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php CHANGED
@@ -129,7 +129,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
129
  /**/
130
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
131
  /**/
132
- wp_mail ($paypal["payer_email"], apply_filters ("ws_plugin__s2member_modification_email_sbj", _x ("Thank you! Your account has been updated.", "s2member-front", "s2member"), get_defined_vars ()), apply_filters ("ws_plugin__s2member_modification_email_msg", _x ("Thank you! You've been updated to:", "s2member-front", "s2member") . "\n" . $paypal["item_name"] . "\n\n" . _x ("Please log back in now.", "s2member-front", "s2member") . "\n" . wp_login_url (), get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
133
  /**/
134
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
135
  /**/
129
  /**/
130
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
131
  /**/
132
+ c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($paypal["payer_email"], apply_filters ("ws_plugin__s2member_modification_email_sbj", _x ("Thank you! Your account has been updated.", "s2member-front", "s2member"), get_defined_vars ()), apply_filters ("ws_plugin__s2member_modification_email_msg", _x ("Thank you! You've been updated to:", "s2member-front", "s2member") . "\n" . $paypal["item_name"] . "\n\n" . _x ("Please log back in now.", "s2member-front", "s2member") . "\n" . wp_login_url (), get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
133
  /**/
134
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
135
  /**/
includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php CHANGED
@@ -122,7 +122,6 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_l
122
  delete_user_option ($user_id, "s2member_subscr_gateway");
123
  /**/
124
  delete_user_option ($user_id, "s2member_ipn_signup_vars");
125
- /**/
126
  if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
127
  delete_user_option ($user_id, "s2member_paid_registration_times");
128
  /**/
122
  delete_user_option ($user_id, "s2member_subscr_gateway");
123
  /**/
124
  delete_user_option ($user_id, "s2member_ipn_signup_vars");
 
125
  if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
126
  delete_user_option ($user_id, "s2member_paid_registration_times");
127
  /**/
includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php CHANGED
@@ -157,7 +157,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
157
  /**/
158
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
159
  /**/
160
- wp_mail ($paypal["payer_email"], apply_filters ("ws_plugin__s2member_modification_email_sbj", _x ("Thank you! Your account has been updated.", "s2member-front", "s2member"), get_defined_vars ()), apply_filters ("ws_plugin__s2member_modification_email_msg", _x ("Thank you! You've been updated to:", "s2member-front", "s2member") . "\n" . $paypal["item_name"] . "\n\n" . _x ("Please log back in now.", "s2member-front", "s2member") . "\n" . wp_login_url (), get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
161
  /**/
162
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
163
  /**/
@@ -361,7 +361,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
361
  if (($recipients = preg_split ("/;+/", preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
362
  {
363
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep ($recipients) as $recipient) /* Go through the full list of recipients. */
364
- ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_signup_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_signup_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
365
  /**/
366
  $paypal["s2member_log"][] = "Signup Confirmation Email sent to: " . implode ("; ", $recipients) . ".";
367
  }
157
  /**/
158
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
159
  /**/
160
+ c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($paypal["payer_email"], apply_filters ("ws_plugin__s2member_modification_email_sbj", _x ("Thank you! Your account has been updated.", "s2member-front", "s2member"), get_defined_vars ()), apply_filters ("ws_plugin__s2member_modification_email_msg", _x ("Thank you! You've been updated to:", "s2member-front", "s2member") . "\n" . $paypal["item_name"] . "\n\n" . _x ("Please log back in now.", "s2member-front", "s2member") . "\n" . wp_login_url (), get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
161
  /**/
162
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
163
  /**/
361
  if (($recipients = preg_split ("/;+/", preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
362
  {
363
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep ($recipients) as $recipient) /* Go through the full list of recipients. */
364
+ ($recipient) ? c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters ("ws_plugin__s2member_signup_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_signup_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release () : null;
365
  /**/
366
  $paypal["s2member_log"][] = "Signup Confirmation Email sent to: " . implode ("; ", $recipients) . ".";
367
  }
includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 110815
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_wa_ccaps_wo_level"))
21
  {
@@ -40,14 +40,14 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_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 ("/^web_accept$/i", $paypal["txn_type"]))/**/
46
  && (!empty ($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))/**/
47
  && (empty ($paypal["payment_status"]) || empty ($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
48
  && (!empty ($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && (!empty ($paypal["payer_email"]))/**/)
49
  {
50
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
51
  do_action ("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars ());
52
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
53
  /**/
@@ -68,7 +68,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
68
  {
69
  $processing = $during = true; /* Yes, we ARE processing this. */
70
  /**/
71
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
  do_action ("ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps", get_defined_vars ());
73
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
  /**/
@@ -78,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
78
  /**/
79
  if (is_multisite () && !is_user_member_of_blog ($user_id)) /* Must have a Role on this Blog. */
80
  {
81
- add_existing_user_to_blog (array ("user_id" => $user_id, "role" => get_option ("default_role")));
82
  $user = new WP_User ($user_id);
83
  }
84
  /**/
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
97
  /**/
98
  $paypal["s2member_log"][] = "s2Member Custom Capabilities updated w/ advanced update routines.";
99
  /**/
100
- wp_mail ($paypal["payer_email"], apply_filters ("ws_plugin__s2member_capabilities_email_sbj", _x ("Thank you! Your account has been updated.", "s2member-front", "s2member"), get_defined_vars ()), apply_filters ("ws_plugin__s2member_capabilities_email_msg", _x ("Thank you! You now have access to:", "s2member-front", "s2member") . "\n" . $paypal["item_name"] . "\n\n" . _x ("Please log back in now.", "s2member-front", "s2member") . "\n" . wp_login_url (), get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
101
  /**/
102
  $paypal["s2member_log"][] = "Capability Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
103
  /**/
@@ -258,7 +258,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
258
  }
259
  }
260
  /**/
261
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
262
  do_action ("ws_plugin__s2member_during_paypal_notify_during_new_ccaps", get_defined_vars ());
263
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
  }
@@ -278,7 +278,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
278
  $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
279
  }
280
  /**/
281
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
282
  do_action ("ws_plugin__s2member_during_paypal_notify_after_new_ccaps", get_defined_vars ());
283
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
284
  /**/
15
  * @since 110815
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_wa_ccaps_wo_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 ("/^web_accept$/i", $paypal["txn_type"]))/**/
46
  && (!empty ($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))/**/
47
  && (empty ($paypal["payment_status"]) || empty ($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
48
  && (!empty ($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && (!empty ($paypal["payer_email"]))/**/)
49
  {
50
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
51
  do_action ("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars ());
52
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
53
  /**/
68
  {
69
  $processing = $during = true; /* Yes, we ARE processing this. */
70
  /**/
71
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
  do_action ("ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps", get_defined_vars ());
73
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
  /**/
78
  /**/
79
  if (is_multisite () && !is_user_member_of_blog ($user_id)) /* Must have a Role on this Blog. */
80
  {
81
+ add_existing_user_to_blog(array ("user_id" => $user_id, "role" => get_option ("default_role")));
82
  $user = new WP_User ($user_id);
83
  }
84
  /**/
97
  /**/
98
  $paypal["s2member_log"][] = "s2Member Custom Capabilities updated w/ advanced update routines.";
99
  /**/
100
+ c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($paypal["payer_email"], apply_filters ("ws_plugin__s2member_capabilities_email_sbj", _x ("Thank you! Your account has been updated.", "s2member-front", "s2member"), get_defined_vars ()), apply_filters ("ws_plugin__s2member_capabilities_email_msg", _x ("Thank you! You now have access to:", "s2member-front", "s2member") . "\n" . $paypal["item_name"] . "\n\n" . _x ("Please log back in now.", "s2member-front", "s2member") . "\n" . wp_login_url (), get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
101
  /**/
102
  $paypal["s2member_log"][] = "Capability Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
103
  /**/
258
  }
259
  }
260
  /**/
261
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
262
  do_action ("ws_plugin__s2member_during_paypal_notify_during_new_ccaps", get_defined_vars ());
263
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
  }
278
  $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
279
  }
280
  /**/
281
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
282
  do_action ("ws_plugin__s2member_during_paypal_notify_after_new_ccaps", get_defined_vars ());
283
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
284
  /**/
includes/classes/paypal-notify-in-web-accept-sp.inc.php CHANGED
@@ -111,7 +111,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
111
  if (($recipients = preg_split ("/;+/", preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
112
  {
113
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep ($recipients) as $recipient) /* Go through the full list of recipients. */
114
- ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_sp_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_sp_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
115
  /**/
116
  $paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to: " . implode ("; ", $recipients) . ".";
117
  }
111
  if (($recipients = preg_split ("/;+/", preg_replace ("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim (preg_replace ("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
112
  {
113
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep ($recipients) as $recipient) /* Go through the full list of recipients. */
114
+ ($recipient) ? c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters ("ws_plugin__s2member_sp_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_sp_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release () : null;
115
  /**/
116
  $paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to: " . implode ("; ", $recipients) . ".";
117
  }
includes/classes/paypal-notify-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_paypal_notify_in"))
21
  {
@@ -55,11 +55,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
55
  /**/
56
  if (!empty ($_GET["s2member_paypal_notify"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !empty ($_GET["s2member_paypal_proxy"])))
57
  {
58
- @ignore_user_abort(true); /* Important. Continue processing even if/when the connection is broken by the sending party. */
59
  /**/
60
  include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get administrative functions. Needed for `wp_delete_user()`. */
61
  /**/
62
- c_ws_plugin__s2member_email_configs::email_config_release (); /* Release Filters on wp_mail() / From: headers. */
 
63
  /**/
64
  if (is_array ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal) && ($_paypal_s = serialize ($_paypal)))
65
  {
@@ -77,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
77
  {
78
  $paypal["s2member_log"][] = "s2Member originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
79
  /**/
80
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
81
  if (!apply_filters ("ws_plugin__s2member_during_paypal_notify_conditionals", false, get_defined_vars ()))
82
  {
83
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -152,6 +153,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
152
  $paypal["s2member_log"][] = "Please see this thread: `http://www.primothemes.com/forums/viewtopic.php?f=36&t=2636` for details regarding the ideal server configuration for s2Member.";
153
  $paypal["s2member_log"][] = var_export ($_REQUEST, true); /* Recording _POST + _GET vars for analysis and debugging. */
154
  }
 
 
 
155
  /*
156
  Add IPN proxy ( when available ) to the ``$paypal`` array.
157
  */
@@ -182,20 +186,20 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
182
  if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
183
  file_put_contents ($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export ($paypal, true) . "\n\n", FILE_APPEND);
184
  /**/
185
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
186
  do_action ("ws_plugin__s2member_during_paypal_notify", get_defined_vars ());
187
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
188
  /**/
189
  @ini_set ("zlib.output_compression", 0); /* Turn off. */
190
  /**/
191
- status_header(200); /* Send a 200 OK status header. */
192
- header("Content-Type: text/plain; charset=utf-8"); /* With text/plain. */
193
- eval('while (@ob_end_clean ());'); /* End/clean all output buffers that may or may not exist. */
194
  /**/
195
- exit(((!empty ($paypal["s2member_paypal_proxy_return_url"])) ? $paypal["s2member_paypal_proxy_return_url"] : ""));
196
  }
197
  /**/
198
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
199
  do_action ("ws_plugin__s2member_after_paypal_notify", get_defined_vars ());
200
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
201
  }
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
21
  {
55
  /**/
56
  if (!empty ($_GET["s2member_paypal_notify"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !empty ($_GET["s2member_paypal_proxy"])))
57
  {
58
+ @ignore_user_abort (true); /* Important. Continue processing even if/when the connection is broken by the sending party. */
59
  /**/
60
  include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get administrative functions. Needed for `wp_delete_user()`. */
61
  /**/
62
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (); /* Filters on? */
63
+ c_ws_plugin__s2member_email_configs::email_config_release (); /* Release s2Member Filters. */
64
  /**/
65
  if (is_array ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal) && ($_paypal_s = serialize ($_paypal)))
66
  {
78
  {
79
  $paypal["s2member_log"][] = "s2Member originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
80
  /**/
81
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
82
  if (!apply_filters ("ws_plugin__s2member_during_paypal_notify_conditionals", false, get_defined_vars ()))
83
  {
84
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
  $paypal["s2member_log"][] = "Please see this thread: `http://www.primothemes.com/forums/viewtopic.php?f=36&t=2636` for details regarding the ideal server configuration for s2Member.";
154
  $paypal["s2member_log"][] = var_export ($_REQUEST, true); /* Recording _POST + _GET vars for analysis and debugging. */
155
  }
156
+ /**/
157
+ if ($email_configs_were_on) /* Back on? */
158
+ c_ws_plugin__s2member_email_configs::email_config ();
159
  /*
160
  Add IPN proxy ( when available ) to the ``$paypal`` array.
161
  */
186
  if (is_writable ($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files ())
187
  file_put_contents ($logs_dir . "/" . $log2, $logv . "\n" . $logm . "\n" . $log4 . "\n" . var_export ($paypal, true) . "\n\n", FILE_APPEND);
188
  /**/
189
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
190
  do_action ("ws_plugin__s2member_during_paypal_notify", get_defined_vars ());
191
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
  /**/
193
  @ini_set ("zlib.output_compression", 0); /* Turn off. */
194
  /**/
195
+ status_header (200); /* Send a 200 OK status header. */
196
+ header ("Content-Type: text/plain; charset=utf-8"); /* With text/plain. */
197
+ eval ('while (@ob_end_clean ());'); /* End/clean all output buffers that may or may not exist. */
198
  /**/
199
+ exit (((!empty ($paypal["s2member_paypal_proxy_return_url"])) ? $paypal["s2member_paypal_proxy_return_url"] : ""));
200
  }
201
  /**/
202
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
203
  do_action ("ws_plugin__s2member_after_paypal_notify", get_defined_vars ());
204
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
205
  }
includes/classes/paypal-return-in-no-tx-data.inc.php CHANGED
@@ -56,6 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_no_tx_data"))
56
  $paypal["s2member_log"][] = "Redirecting Customer to the Home Page. Customer must wait for Email Confirmation.";
57
  /**/
58
  $paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering a free Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only ( i.e. behind-the-scene ), and the Customer must wait for Email Confirmation in these cases.";
 
59
  /**/
60
  echo c_ws_plugin__s2member_return_templates::return_template ($paypal["subscr_gateway"],/**/
61
  _x ('<strong>Thank you! ( you MUST check your email before proceeding ).</strong><br /><br />* Note: It can take <em>( up to 15 minutes )</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]))) ? '<br /><br />' . _x ('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''),/**/
56
  $paypal["s2member_log"][] = "Redirecting Customer to the Home Page. Customer must wait for Email Confirmation.";
57
  /**/
58
  $paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering a free Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only ( i.e. behind-the-scene ), and the Customer must wait for Email Confirmation in these cases.";
59
+ $paypal["s2member_log"][] = var_export ($_REQUEST, true); /* Recording _POST + _GET vars for analysis and debugging. */
60
  /**/
61
  echo c_ws_plugin__s2member_return_templates::return_template ($paypal["subscr_gateway"],/**/
62
  _x ('<strong>Thank you! ( you MUST check your email before proceeding ).</strong><br /><br />* Note: It can take <em>( up to 15 minutes )</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]))) ? '<br /><br />' . _x ('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''),/**/
includes/classes/register-access.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_register_access"))
21
  {
@@ -42,7 +42,7 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
42
  */
43
  public static function register_link_gen ($subscr_gateway = FALSE, $subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
44
  {
45
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
46
  do_action ("ws_plugin__s2member_before_register_link_gen", get_defined_vars ());
47
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
  /**/
@@ -97,8 +97,10 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
97
  /**/
98
  do_action ("ws_plugin__s2member_before_reg_cookies_ok", get_defined_vars ());
99
  /**/
100
- if (isset ($_COOKIE["s2member_subscr_gateway"], $_COOKIE["s2member_subscr_id"], $_COOKIE["s2member_custom"], $_COOKIE["s2member_item_number"]) && ($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_custom"]))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], ($item_number = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_item_number"]))) && !$wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
101
- $reg_cookies = array ("subscr_gateway" => $subscr_gateway, "subscr_id" => $subscr_id, "custom" => $custom, "item_number" => $item_number);
 
 
102
  /**/
103
  return apply_filters ("ws_plugin__s2member_reg_cookies_ok", ((isset ($reg_cookies) && is_array ($reg_cookies)) ? $reg_cookies : false), get_defined_vars ());
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_register_access"))
21
  {
42
  */
43
  public static function register_link_gen ($subscr_gateway = FALSE, $subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
44
  {
45
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
46
  do_action ("ws_plugin__s2member_before_register_link_gen", get_defined_vars ());
47
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
  /**/
97
  /**/
98
  do_action ("ws_plugin__s2member_before_reg_cookies_ok", get_defined_vars ());
99
  /**/
100
+ if (isset ($_COOKIE["s2member_subscr_gateway"], $_COOKIE["s2member_subscr_id"], $_COOKIE["s2member_custom"], $_COOKIE["s2member_item_number"]))
101
+ if (is_string ($_COOKIE["s2member_subscr_gateway"]) && is_string ($_COOKIE["s2member_subscr_id"]) && is_string ($_COOKIE["s2member_custom"]) && is_string ($_COOKIE["s2member_item_number"]))
102
+ if (($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_custom"]))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], ($item_number = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_item_number"]))) && !$wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
103
+ $reg_cookies = array ("subscr_gateway" => $subscr_gateway, "subscr_id" => $subscr_id, "custom" => $custom, "item_number" => $item_number);
104
  /**/
105
  return apply_filters ("ws_plugin__s2member_reg_cookies_ok", ((isset ($reg_cookies) && is_array ($reg_cookies)) ? $reg_cookies : false), get_defined_vars ());
106
  }
includes/classes/registration-times.inc.php CHANGED
@@ -45,14 +45,13 @@ if (!class_exists ("c_ws_plugin__s2member_registration_times"))
45
  do_action ("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars ());
46
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
  /**/
48
- if ($user_id && is_object ($user = new WP_User ($user_id)) && $user->ID)
49
- if (($level = c_ws_plugin__s2member_user_access::user_access_level ($user)) > 0)
50
- {
51
- $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
52
- $pr_times["level"] = (!$pr_times["level"]) ? time () : $pr_times["level"]; /* Preserve. */
53
- $pr_times["level" . $level] = (!$pr_times["level" . $level]) ? time () : $pr_times["level" . $level];
54
- update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
55
- }
56
  /**/
57
  return; /* Return for uniformity. */
58
  }
@@ -73,7 +72,7 @@ if (!class_exists ("c_ws_plugin__s2member_registration_times"))
73
  /**/
74
  $user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in ()) ? wp_get_current_user () : false);
75
  /**/
76
- if (is_object ($user) && ($user_id = $user->ID) && $user->user_registered)
77
  {
78
  return apply_filters ("ws_plugin__s2member_registration_time", strtotime ($user->user_registered), get_defined_vars ());
79
  }
@@ -96,14 +95,14 @@ if (!class_exists ("c_ws_plugin__s2member_registration_times"))
96
  do_action ("ws_plugin__s2member_before_paid_registration_time", get_defined_vars ());
97
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
98
  /**/
99
- $level = (!strlen ($level)) ? "level" : "level" . preg_replace ("/[^0-9]/", "", $level);
100
  $user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in ()) ? wp_get_current_user () : false);
101
  /**/
102
- if ($level && is_object ($user) && ($user_id = $user->ID) && is_array ($pr_times = get_user_option ("s2member_paid_registration_times", $user_id)))
103
  {
104
- return apply_filters ("ws_plugin__s2member_paid_registration_time", (int)$pr_times[$level], get_defined_vars ());
105
  }
106
- else /* Else we return a default value of 0, because there is insufficient data. */
107
  return apply_filters ("ws_plugin__s2member_paid_registration_time", 0, get_defined_vars ());
108
  }
109
  }
45
  do_action ("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars ());
46
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
  /**/
48
+ if ($user_id && is_object ($user = new WP_User ($user_id)) && !empty ($user->ID) && ($level = c_ws_plugin__s2member_user_access::user_access_level ($user)) > 0)
49
+ {
50
+ $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
51
+ $pr_times["level"] = (empty ($pr_times["level"])) ? time () : $pr_times["level"];
52
+ $pr_times["level" . $level] = (empty ($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
53
+ update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
54
+ }
 
55
  /**/
56
  return; /* Return for uniformity. */
57
  }
72
  /**/
73
  $user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in ()) ? wp_get_current_user () : false);
74
  /**/
75
+ if (is_object ($user) && !empty ($user->ID) && ($user_id = $user->ID) && $user->user_registered)
76
  {
77
  return apply_filters ("ws_plugin__s2member_registration_time", strtotime ($user->user_registered), get_defined_vars ());
78
  }
95
  do_action ("ws_plugin__s2member_before_paid_registration_time", get_defined_vars ());
96
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
97
  /**/
98
+ $level = (!is_numeric ($level)) ? "level" : "level" . preg_replace ("/[^0-9]/", "", (string)$level);
99
  $user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in ()) ? wp_get_current_user () : false);
100
  /**/
101
+ if ($level && is_object ($user) && !empty ($user->ID) && ($user_id = $user->ID) && is_array ($pr_times = get_user_option ("s2member_paid_registration_times", $user_id)))
102
  {
103
+ return apply_filters ("ws_plugin__s2member_paid_registration_time", ((isset ($pr_times[$level])) ? (int)$pr_times[$level] : 0), get_defined_vars ());
104
  }
105
+ else /* Else we return a default value of `0`, because there is insufficient data. */
106
  return apply_filters ("ws_plugin__s2member_paid_registration_time", 0, get_defined_vars ());
107
  }
108
  }
includes/classes/registrations.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_registrations"))
21
  {
@@ -43,7 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
43
  */
44
  public static function generate_password ($password = FALSE)
45
  {
46
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
47
  do_action ("ws_plugin__s2member_before_generate_password", get_defined_vars ());
48
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
49
  /**/
@@ -51,19 +51,17 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
51
  {
52
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && !empty ($_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))
53
  {
54
- if (($custom = trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))))
55
  $password = $custom; /* Yes, use s2Member custom Password supplied by User. */
56
  }
57
  else if (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !empty ($GLOBALS["ws_plugin__s2member_generate_password_return"]))
58
  {
59
- if (($custom = trim (stripslashes ($GLOBALS["ws_plugin__s2member_generate_password_return"]))))
60
  $password = $custom; /* Yes, use s2Member custom Password supplied by Remote Op. */
61
  }
62
  }
63
  /**/
64
- $GLOBALS["ws_plugin__s2member_generate_password_return"] = $password; /* Global reference. */
65
- /**/
66
- return apply_filters ("ws_plugin__s2member_generate_password", $password, get_defined_vars ());
67
  }
68
  /**
69
  * Filters Multisite User validation.
@@ -81,17 +79,18 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
81
  */
82
  public static function ms_validate_user_signup ($result = FALSE)
83
  {
84
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
85
  do_action ("ws_plugin__s2member_before_ms_validate_user_signup", get_defined_vars ());
86
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
87
  /**/
88
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
89
- if (!is_admin () && isset ($result["user_name"], $result["user_email"]) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty ($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", $_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))
90
  {
91
- if (c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($result["user_name"], $result["user_email"]))
92
- $result["errors"] = new WP_Error ();
 
93
  /**/
94
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
95
  do_action ("ws_plugin__s2member_during_ms_validate_user_signup", get_defined_vars ());
96
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
97
  }
@@ -116,9 +115,9 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
116
  do_action ("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
117
  /**/
118
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
119
- if (!is_admin () && !empty ($_POST) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty ($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", $_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))
120
  {
121
- foreach ((array)c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
122
  if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
123
  if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
124
  echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr (maybe_serialize ($value)) . '" />' . "\n";
@@ -148,18 +147,22 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
148
  */
149
  public static function ms_process_signup_meta ($meta = FALSE)
150
  {
 
151
  global $pagenow; /* Need this to detect the current admin page. */
152
  /**/
153
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
154
  do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
155
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
156
  /**/
157
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
158
- if ((is_blog_admin () && !empty ($_POST) && $pagenow === "user-new.php") || (!is_admin () && !empty ($_POST) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty ($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", $_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ()))))
159
  {
160
- c_ws_plugin__s2member_email_configs::email_config (); /* Configures From: header used in notifications. */
 
 
 
161
  /**/
162
- foreach ((array)c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
163
  if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
164
  if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
165
  $meta["s2member_ms_signup_meta"][$key] = maybe_unserialize ($value);
@@ -188,23 +191,23 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
188
  */
189
  public static function ms_activate_existing_user ($_error = FALSE, $vars = FALSE)
190
  {
191
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
192
  do_action ("ws_plugin__s2member_before_ms_activate_existing_user", get_defined_vars ());
193
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
194
  /**/
195
- extract($vars); /* Extract all variables from ``wpmu_activate_signup()`` function. */
196
  /**/
197
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
198
  if (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page ())))
199
  {
200
  if (!empty ($user_id) && !empty ($user_login) && !empty ($user_email) && !empty ($password) && !empty ($meta) && !empty ($meta["add_to_blog"]) && !empty ($meta["new_role"]))
201
- if (!empty ($user_already_exists) && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))
202
  {
203
  add_user_to_blog ($meta["add_to_blog"], $user_id, $meta["new_role"]); /* Add this User to the specified Blog. */
204
- wp_update_user(array ("ID" => $user_id, "user_pass" => $password)); /* Update Password so it's the same as in the following msg. */
205
  wpmu_welcome_user_notification ($user_id, $password, $meta); /* Send welcome letter via email just like ``wpmu_activate_signup()`` does. */
206
  /**/
207
- do_action ("wpmu_activate_user", $user_id, $password, $meta); /* Process Hook that would have been fired inside `wpmu_activate_signup()`. */
208
  /**/
209
  return apply_filters ("ws_plugin__s2member_ms_activate_existing_user", array ("user_id" => $user_id, "password" => $password, "meta" => $meta), get_defined_vars ());
210
  }
@@ -233,7 +236,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
233
  {
234
  global $pagenow; /* Need this to detect the current admin page. */
235
  /**/
236
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
237
  do_action ("ws_plugin__s2member_before_configure_user_on_ms_user_activation", get_defined_vars ());
238
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
239
  /**/
@@ -272,7 +275,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
272
  */
273
  public static function configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
274
  {
275
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
276
  do_action ("ws_plugin__s2member_before_configure_user_on_ms_blog_activation", get_defined_vars ());
277
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
278
  /**/
@@ -307,42 +310,40 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
307
  */
308
  public static function ms_register_existing_user ($errors = FALSE, $user_login = FALSE, $user_email = FALSE)
309
  {
310
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
311
  do_action ("ws_plugin__s2member_before_ms_register_existing_user", get_defined_vars ());
312
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
313
  /**/
314
- if (is_multisite ()) /* Should ONLY be processed with Multisite Networking. */
315
- if (!is_admin () && preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
316
- if (is_wp_error ($errors) && $errors->get_error_code ())
317
  {
318
  if (($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email)))
319
  {
320
  foreach ($errors->get_error_codes () as $error_code)
321
- if (!preg_match ("/^(username_exists|email_exists)$/i", $error_code))
322
  $other_important_errors_exist = true;
323
  /**/
324
- if (empty ($other_important_errors_exist)) /* Only if/when NO other important errors exist. */
325
  {
326
- $user_pass = wp_generate_password (); /* A new Password is now generated here. */
327
  c_ws_plugin__s2member_registrations::ms_create_existing_user ($user_login, $user_email, $user_pass, $user_id);
328
- update_user_option ($user_id, "default_password_nag", true, true); /* Set up the Password change nag screen. */
329
- wp_new_user_notification ($user_id, $user_pass); /* Welcome email, just like `register_new_user()` does. */
330
  /**/
331
  $redirect_to = (!empty ($_REQUEST["redirect_to"])) ? trim (stripslashes ($_REQUEST["redirect_to"])) : false;
332
  $redirect_to = ($redirect_to) ? $redirect_to : add_query_arg ("checkemail", urlencode ("registered"), wp_login_url ());
333
  /**/
334
  do_action ("ws_plugin__s2member_during_ms_register_existing_user", get_defined_vars ());
335
  /**/
336
- wp_safe_redirect($redirect_to); /* Use safe redirect; like `register_new_user()`. */
337
  /**/
338
  exit (); /* Clean exit. */
339
  }
340
  }
341
  }
342
- else if (($r = wpmu_validate_user_signup ($user_login, $user_email)) && isset ($r["errors"]) && is_wp_error ($e = $r["errors"]) && $e->get_error_code ())
343
- $errors->add ($e->get_error_code (), $e->get_error_message ());
344
- /**/
345
- do_action ("ws_plugin__s2member_after_ms_register_existing_user", get_defined_vars ());
346
  /**/
347
  return apply_filters ("ws_plugin__s2member_ms_register_existing_user", $errors, get_defined_vars ());
348
  }
@@ -364,7 +365,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
364
  */
365
  public static function ms_create_existing_user ($user_login = FALSE, $user_email = FALSE, $user_pass = FALSE, $user_id = FALSE)
366
  {
367
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
368
  do_action ("ws_plugin__s2member_before_ms_create_existing_user", get_defined_vars ());
369
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
370
  /**/
@@ -373,8 +374,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
373
  if (($user_id || ($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))) && $user_pass)
374
  {
375
  $role = get_option ("default_role"); /* Use default Role. */
376
- add_existing_user_to_blog(array ("user_id" => $user_id, "role" => $role)); /* Add existing User. */
377
- wp_update_user(array ("ID" => $user_id, "user_pass" => $user_pass)); /* Update Password to $user_pass. */
378
  /**/
379
  do_action ("ws_plugin__s2member_during_ms_create_existing_user", get_defined_vars ());
380
  do_action ("user_register", $user_id); /* So s2Member knows a User is registering. */
@@ -392,7 +393,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
392
  * ``c_ws_plugin__s2member_registrations::ms_create_existing_user()`` and/or ``wpmu_create_user()``.
393
  *
394
  * This function also receives hand-offs from s2Member's handlers for these two Hooks:
395
- * ``wpmu_activate_user`` and ``wpmu_activate_blog``.
396
  *
397
  * @package s2Member\Registrations
398
  * @since 3.5
@@ -405,23 +406,22 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
405
  * @param array $meta Optional in most cases. An array of meta data added by s2Member for Multisite Network processing.
406
  * @return null
407
  *
408
- * @todo Continue optimizing with ``empty()`` and ``isset()``.
409
  * @todo Impossible to delete cookies when fired inside: `/wp-activate.php`?
410
  */
411
  public static function configure_user_registration ($user_id = FALSE, $password = FALSE, $meta = FALSE)
412
  {
413
- global $wpdb; /* Global database object may be required for this routine. */
414
- global $pagenow; /* Need this to detect the current admin page. */
415
  global $current_site, $current_blog; /* Multisite Networking. */
416
  static $email_config, $processed; /* No duplicate processing. */
417
  /**/
418
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
419
  do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
420
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
421
  /**/
422
  /* With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_user|blog`. */
423
- if (!$email_config && ($email_config = true)) /* Anytime this routine is fired; we config email; no exceptions. */
424
- c_ws_plugin__s2member_email_configs::email_config (); /* Configures From: header in new user notifications. */
425
  /**/
426
  if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
427
  /**/
@@ -429,16 +429,16 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
429
  /**/
430
  /* These negative matches are designed to prevent this routine from running under certain conditions; where we need to wait for `wpmu_activate_user|blog`. */
431
  && !(is_multisite () && is_blog_admin () && $pagenow === "user-new.php" && isset ($_p["noconfirmation"]) && is_super_admin () && func_num_args () !== 3) /* OK? */
432
- && !(preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && func_num_args () !== 3) /* If activating; we MUST have a $meta arg to proceed. Otherwise ignore. */
433
  && !(c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && empty ($GLOBALS["ws_plugin__s2member_registration_vars"]))/**/
434
  && !(c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page () && func_num_args () !== 3)
435
  /**/
436
- && $user_id && is_object ($user = new WP_User ($user_id)) && ($user_id = $user->ID) && ($processed = true))
437
  {
438
  settype ($_p, "array") . settype ($meta, "array");
439
  settype ($GLOBALS["ws_plugin__s2member_registration_vars"], "array");
440
  /**/
441
- foreach ($_p as $key => $value) /* Scan $_p vars; adding `custom_reg_field` keys. */
442
  if (preg_match ("/^ws_plugin__s2member_user_new_/", $key)) /* Look for `user_new` keys. */
443
  if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
444
  $_p[$key] = $value; /* Add these keys for uniformity. */
@@ -447,71 +447,71 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
447
  $meta = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($meta));
448
  /**/
449
  if (!is_admin () && (isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_custom"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_ccaps"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_notes"])))
450
- exit(_x ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
451
  /**/
452
  $_pmr = array_merge ($_p, $meta, $GLOBALS["ws_plugin__s2member_registration_vars"]); /* Merge these all together now. */
453
- unset ($_p, $meta, $GLOBALS["ws_plugin__s2member_registration_vars"]); /* These vars can all be unset now; we now have them all inside $_pmr. */
454
  /**/
455
  $custom_reg_display_name = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_display_name"]; /* Can be configured by the site owner. */
456
  /**/
457
- if (!is_admin () && (!c_ws_plugin__s2member_utils_conds::pro_is_installed () || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user"))/**/
458
- && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies)) /* A Customer? */
459
- { /* This routine could be processed through `wp-login.php?action=register`, `wp-activate.php`, or `/activate` via BuddyPress`.
460
- This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
461
- If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`. */
462
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
463
  /**/
464
  $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
465
- list ($level, $ccaps, $eotper) = preg_split ("/\:/", $item_number, 3);
466
  $role = "s2member_level" . $level; /* Membership Level. */
467
  /**/
468
  $email = $user->user_email;
469
  $login = $user->user_login;
470
- $ip = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
471
- $ip = (!$ip) ? $_SERVER["REMOTE_ADDR"] : $ip; /* Else use this value. */
472
  $cv = preg_split ("/\|/", $custom);
473
  /**/
474
  if (!($auto_eot_time = "") && $eotper) /* If a specific EOT Period is included. */
475
  $auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time ("", "", "", $eotper);
476
  /**/
477
- $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
478
  /**/
479
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
480
- $opt_in = (!$opt_in && $_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
481
  /**/
482
  if (!($fname = $user->first_name))
483
- if ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])
484
- $fname = $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
485
  /**/
486
  if (!$fname) /* Also try BuddyPress. */
487
- if ($_pmr["field_1"]) /* BuddyPress. */
488
- $fname = trim (preg_replace ("/ (.*)$/", "", $_pmr["field_1"]));
489
  /**/
490
  if (!($lname = $user->last_name))
491
- if ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])
492
- $lname = $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
493
  /**/
494
  if (!$lname) /* Also try BuddyPress. */
495
- if ($_pmr["field_1"] && preg_match ("/^(.+?) (.+)$/", $_pmr["field_1"]))
496
- $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", $_pmr["field_1"]));
497
  /**/
498
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname)
499
  if ($login) /* Username and empty Last Name. */
500
- eval('$fname = trim ($login); $lname = "";');
501
  /**/
502
  $name = trim ($fname . " " . $lname); /* Both names. */
503
  /**/
504
  if (!($pass = $password)) /* Try s2Member's generator. */
505
- if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
506
- $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
507
  /**/
508
  if (!$pass) /* Also try BuddyPress Password. */
509
- if ($_pmr["signup_password"]) /* BuddyPress. */
510
- $pass = $_pmr["signup_password"];
511
  /**/
512
  if ($pass) /* No Password nag. Update this globally. */
513
  {
514
- /* Note: `delete_user_setting()` uses cookies. */
515
  delete_user_setting ("default_password_nag", $user_id);
516
  update_user_option ($user_id, "default_password_nag", false, true);
517
  }
@@ -532,13 +532,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
532
  if (!$user->display_name || $user->display_name === $user->user_login)
533
  {
534
  if ($custom_reg_display_name === "full" && $name)
535
- wp_update_user(array ("ID" => $user_id, "display_name" => $name));
536
  else if ($custom_reg_display_name === "first" && $fname)
537
- wp_update_user(array ("ID" => $user_id, "display_name" => $fname));
538
  else if ($custom_reg_display_name === "last" && $lname)
539
- wp_update_user(array ("ID" => $user_id, "display_name" => $lname));
540
  else if ($custom_reg_display_name === "login" && $login)
541
- wp_update_user(array ("ID" => $user_id, "display_name" => $login));
542
  }
543
  /**/
544
  if (is_multisite ()) /* Should we handle Main Site permissions and Originating Blog ID#? */
@@ -563,7 +563,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
563
  if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
564
  $user->add_cap ("access_s2member_ccap_" . $ccap);
565
  /**/
566
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
567
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
568
  {
569
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
@@ -573,112 +573,114 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
573
  $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
574
  }
575
  /**/
576
- update_user_option ($user_id, "s2member_custom_fields", $fields);
 
577
  /**/
578
  if ($level > 0) /* We ONLY process this if they are higher than Level#0. */
579
  {
580
  $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
581
- $pr_times["level"] = (!$pr_times["level"]) ? time () : $pr_times["level"]; /* Preserve. */
582
- $pr_times["level" . $level] = (!$pr_times["level" . $level]) ? time () : $pr_times["level" . $level];
583
  update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
584
  }
585
  /**/
586
  if (($transient = "s2m_" . md5 ("s2member_transient_ipn_signup_vars_" . $subscr_id)) && is_array ($ipn_signup_vars = get_transient ($transient)))
587
  {
588
  update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars); /* For future reference. */
589
- delete_transient($transient); /* This can be deleted now. */
590
  }
591
- if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)))
592
  {
593
- $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => stripslashes ($subscr_payment["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen ());
594
  c_ws_plugin__s2member_utils_urls::remote (add_query_arg (urlencode_deep ($proxy), site_url ("/")), stripslashes_deep ($subscr_payment), array ("timeout" => 20));
595
- delete_transient($transient); /* This can be deleted now. */
596
  }
597
- if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_eot_" . $subscr_id)) && is_array ($subscr_eot = get_transient ($transient)))
598
  {
599
- $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => stripslashes ($subscr_eot["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen ());
600
  c_ws_plugin__s2member_utils_urls::remote (add_query_arg (urlencode_deep ($proxy), site_url ("/")), stripslashes_deep ($subscr_eot), array ("timeout" => 20));
601
- delete_transient($transient); /* This can be deleted now. */
602
  }
603
  /**/
604
  if (!headers_sent ()) /* Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies. */
605
  @setcookie ("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt ($subscr_id)), time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie ("s2member_tracking", $s2member_tracking, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
606
  /**/
607
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
608
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars ());
609
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
610
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
611
  }
612
  /**/
613
  else if (!is_admin () && (!c_ws_plugin__s2member_utils_conds::pro_is_installed () || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
614
- { /* This routine could be processed through `wp-login.php?action=register`, `wp-activate.php`, or `/activate` via BuddyPress`.
615
- This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
616
- If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`. */
617
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
 
618
  /**/
619
  $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
620
- $role = ""; /* Initialize $role to an empty string here, before processing. */
621
- $role = (!$role && ($level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) > 0) ? "s2member_level" . $level : $role;
622
- $role = (!$role && ($level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) === "0") ? "subscriber" : $role;
623
  $role = (!$role && $current_role) ? $current_role : $role; /* Use existing Role? */
624
  $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
625
  /**/
626
- $level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
627
  $level = (!$level && preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
628
  $level = (!$level && preg_match ("/^s2member_level[1-9][0-9]*$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
629
  $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
630
  $level = (!$level) ? "0" : $level;
631
  /**/
632
- $ccaps = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
633
  /**/
634
  $email = $user->user_email;
635
  $login = $user->user_login;
636
- $ip = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
637
- $ip = (!$ip) ? $_SERVER["REMOTE_ADDR"] : $ip; /* Else use this value. */
638
- $custom = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
639
- $subscr_id = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
640
- $subscr_gateway = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
641
- $cv = preg_split ("/\|/", $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
642
  /**/
643
- $auto_eot_time = ($eot = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
644
- $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
645
  /**/
646
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
647
- $opt_in = (!$opt_in && $_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
648
  /**/
649
  if (!($fname = $user->first_name))
650
- if ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])
651
- $fname = $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
652
  /**/
653
  if (!$fname) /* Also try BuddyPress. */
654
- if ($_pmr["field_1"]) /* BuddyPress. */
655
- $fname = trim (preg_replace ("/ (.*)$/", "", $_pmr["field_1"]));
656
  /**/
657
  if (!($lname = $user->last_name))
658
- if ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])
659
- $lname = $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
660
  /**/
661
  if (!$lname) /* Also try BuddyPress. */
662
- if ($_pmr["field_1"] && preg_match ("/^(.+?) (.+)$/", $_pmr["field_1"]))
663
- $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", $_pmr["field_1"]));
664
  /**/
665
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname)
666
  if ($login) /* Username and empty Last Name. */
667
- eval('$fname = trim ($login); $lname = "";');
668
  /**/
669
  $name = trim ($fname . " " . $lname); /* Both names. */
670
  /**/
671
  if (!($pass = $password)) /* Try s2Member's generator. */
672
- if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
673
- $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
674
  /**/
675
  if (!$pass) /* Also try BuddyPress Password. */
676
- if ($_pmr["signup_password"]) /* BuddyPress. */
677
- $pass = $_pmr["signup_password"];
678
  /**/
679
  if ($pass) /* No Password nag. Update this globally. */
680
  {
681
- /* Note: `delete_user_setting()` uses cookies. */
682
  delete_user_setting ("default_password_nag", $user_id);
683
  update_user_option ($user_id, "default_password_nag", false, true);
684
  }
@@ -699,13 +701,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
699
  if (!$user->display_name || $user->display_name === $user->user_login)
700
  {
701
  if ($custom_reg_display_name === "full" && $name)
702
- wp_update_user(array ("ID" => $user_id, "display_name" => $name));
703
  else if ($custom_reg_display_name === "first" && $fname)
704
- wp_update_user(array ("ID" => $user_id, "display_name" => $fname));
705
  else if ($custom_reg_display_name === "last" && $lname)
706
- wp_update_user(array ("ID" => $user_id, "display_name" => $lname));
707
  else if ($custom_reg_display_name === "login" && $login)
708
- wp_update_user(array ("ID" => $user_id, "display_name" => $login));
709
  }
710
  /**/
711
  if (is_multisite ()) /* Should we handle Main Site permissions and Originating Blog ID#? */
@@ -730,7 +732,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
730
  if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
731
  $user->add_cap ("access_s2member_ccap_" . $ccap);
732
  /**/
733
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
734
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
735
  {
736
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
@@ -740,79 +742,81 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
740
  $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
741
  }
742
  /**/
743
- update_user_option ($user_id, "s2member_custom_fields", $fields);
 
744
  /**/
745
  if ($level > 0) /* We ONLY process this if they are higher than Level#0. */
746
  {
747
  $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
748
- $pr_times["level"] = (!$pr_times["level"]) ? time () : $pr_times["level"]; /* Preserve. */
749
- $pr_times["level" . $level] = (!$pr_times["level" . $level]) ? time () : $pr_times["level" . $level];
750
  update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
751
  }
752
  /**/
753
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
754
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side_free", get_defined_vars ());
755
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
756
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
757
  }
758
  /**/
759
  else if ((is_blog_admin () && $pagenow === "user-new.php") || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
760
- { /* Can only be processed through `user-new.php` in the Admin panel, or through Remote Op: `create_user`. */
 
761
  $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
762
  /**/
763
  $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
764
  $role = ""; /* Initialize $role to an empty string here, before processing. */
765
- $role = (!$role && ($level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) > 0) ? "s2member_level" . $level : $role;
766
- $role = (!$role && ($level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) === "0") ? "subscriber" : $role;
767
  $role = (!$role && $current_role) ? $current_role : $role; /* Use existing Role? */
768
  $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
769
  /**/
770
- $level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
771
  $level = (!$level && preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
772
  $level = (!$level && preg_match ("/^s2member_level[1-9][0-9]*$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
773
  $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
774
  $level = (!$level) ? "0" : $level;
775
  /**/
776
- $ccaps = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
777
  /**/
778
  $email = $user->user_email;
779
  $login = $user->user_login;
780
- $ip = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
781
- $custom = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
782
- $subscr_id = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
783
- $subscr_gateway = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
784
- $cv = preg_split ("/\|/", $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
785
  /**/
786
- $auto_eot_time = ($eot = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
787
- $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
788
  /**/
789
- $opt_in = ($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
790
  /**/
791
  if (!($fname = $user->first_name)) /* `Users -> Add New`. */
792
- if ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])
793
- $fname = $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
794
  /**/
795
  if (!($lname = $user->last_name)) /* `Users -> Add New`. */
796
- if ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])
797
- $lname = $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
798
  /**/
799
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname)
800
  if ($login) /* Username and empty Last Name. */
801
- eval('$fname = trim ($login); $lname = "";');
802
  /**/
803
  $name = trim ($fname . " " . $lname); /* Both names. */
804
  /**/
805
  if (!($pass = $password)) /* Try s2Member's generator. */
806
- if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
807
- $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
808
  /**/
809
  if (!$pass) /* Also try the `Users -> Add New` form. */
810
- if ($_pmr["pass1"]) /* Field in user-new.php. */
811
- $pass = $_pmr["pass1"];
812
  /**/
813
  if ($pass) /* No Password nag. Update this globally. */
814
  {
815
- /* Note: `delete_user_setting()` uses cookies. */
816
  delete_user_setting ("default_password_nag", $user_id);
817
  update_user_option ($user_id, "default_password_nag", false, true);
818
  }
@@ -833,13 +837,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
833
  if (!$user->display_name || $user->display_name === $user->user_login)
834
  {
835
  if ($custom_reg_display_name === "full" && $name)
836
- wp_update_user(array ("ID" => $user_id, "display_name" => $name));
837
  else if ($custom_reg_display_name === "first" && $fname)
838
- wp_update_user(array ("ID" => $user_id, "display_name" => $fname));
839
  else if ($custom_reg_display_name === "last" && $lname)
840
- wp_update_user(array ("ID" => $user_id, "display_name" => $lname));
841
  else if ($custom_reg_display_name === "login" && $login)
842
- wp_update_user(array ("ID" => $user_id, "display_name" => $login));
843
  }
844
  /**/
845
  if (is_multisite ()) /* Should we handle Main Site permissions and Originating Blog ID#? */
@@ -864,7 +868,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
864
  if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
865
  $user->add_cap ("access_s2member_ccap_" . $ccap);
866
  /**/
867
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
868
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
869
  {
870
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
@@ -874,17 +878,18 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
874
  $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
875
  }
876
  /**/
877
- update_user_option ($user_id, "s2member_custom_fields", $fields);
 
878
  /**/
879
  if ($level > 0) /* We ONLY process this if they are higher than Level#0. */
880
  {
881
  $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
882
- $pr_times["level"] = (!$pr_times["level"]) ? time () : $pr_times["level"]; /* Preserve. */
883
- $pr_times["level" . $level] = (!$pr_times["level" . $level]) ? time () : $pr_times["level" . $level];
884
  update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
885
  }
886
  /**/
887
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
888
  do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
889
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
890
  }
@@ -909,10 +914,9 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
909
  if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($ip)), $url)))
910
  if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
911
  {
912
- if (is_array ($fields) && !empty ($fields))
913
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
914
- if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
915
- break;
916
  /**/
917
  if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
918
  c_ws_plugin__s2member_utils_urls::remote ($url);
@@ -920,6 +924,9 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
920
  /**/
921
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
922
  {
 
 
 
923
  $msg = $sbj = "( s2Member / API Notification Email ) - Registration";
924
  $msg .= "\n\n"; /* Spacing in the message body. */
925
  /**/
@@ -936,9 +943,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
936
  $msg .= "user_ip: %%user_ip%%\n";
937
  $msg .= "user_id: %%user_id%%\n";
938
  /**/
939
- if (is_array ($fields) && !empty ($fields))
940
- foreach ($fields as $var => $val)
941
- $msg .= $var . ": %%" . $var . "%%\n";
942
  /**/
943
  $msg .= "cv0: %%cv0%%\n";
944
  $msg .= "cv1: %%cv1%%\n";
@@ -965,15 +971,17 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
965
  if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($ip), $msg)))
966
  if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
967
  {
968
- if (is_array ($fields) && !empty ($fields))
969
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
970
- if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
971
- break;
972
  /**/
973
  if (($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
974
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
975
  ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_registration_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
976
  }
 
 
 
977
  }
978
  /**/
979
  if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
@@ -992,13 +1000,11 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
992
  if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($ip)), $url)))
993
  if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
994
  {
995
- if (is_array ($fields) && !empty ($fields))
996
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
997
- if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
998
- break;
999
  /**/
1000
- if (($url = trim ($url))) /* Preserve remaining Replacements. */
1001
- /* Because the parent routine may perform replacements too. */
1002
  $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
1003
  }
1004
  /**/
@@ -1015,13 +1021,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
1015
  @setcookie ("s2member_item_number", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie ("s2member_item_number", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
1016
  }
1017
  /**/
1018
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1019
  do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
1020
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1021
  }
1022
  }
1023
  /**/
1024
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1025
  do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
1026
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1027
  /**/
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_registrations"))
21
  {
43
  */
44
  public static function generate_password ($password = FALSE)
45
  {
46
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
47
  do_action ("ws_plugin__s2member_before_generate_password", get_defined_vars ());
48
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
49
  /**/
51
  {
52
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && !empty ($_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))
53
  {
54
+ if (($custom = trim (stripslashes ((string)$_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))))
55
  $password = $custom; /* Yes, use s2Member custom Password supplied by User. */
56
  }
57
  else if (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !empty ($GLOBALS["ws_plugin__s2member_generate_password_return"]))
58
  {
59
+ if (($custom = trim (stripslashes ((string)$GLOBALS["ws_plugin__s2member_generate_password_return"]))))
60
  $password = $custom; /* Yes, use s2Member custom Password supplied by Remote Op. */
61
  }
62
  }
63
  /**/
64
+ return apply_filters ("ws_plugin__s2member_generate_password", ($GLOBALS["ws_plugin__s2member_generate_password_return"] = $password), get_defined_vars ());
 
 
65
  }
66
  /**
67
  * Filters Multisite User validation.
79
  */
80
  public static function ms_validate_user_signup ($result = FALSE)
81
  {
82
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
83
  do_action ("ws_plugin__s2member_before_ms_validate_user_signup", get_defined_vars ());
84
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
85
  /**/
86
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
87
+ if (!is_admin () && isset ($result["user_name"], $result["user_email"], $result["errors"]) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty ($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", (string)$_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))
88
  {
89
+ if (in_array ($result["errors"]->get_error_code (), array ("user_name", "user_email", "user_email_used")))
90
+ if (c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($result["user_name"], $result["user_email"]))
91
+ $result["errors"] = new WP_Error ();
92
  /**/
93
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
94
  do_action ("ws_plugin__s2member_during_ms_validate_user_signup", get_defined_vars ());
95
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
96
  }
115
  do_action ("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
116
  /**/
117
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
118
+ if (!is_admin () && !empty ($_POST) && is_array ($_POST) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty ($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", (string)$_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))
119
  {
120
+ foreach (c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
121
  if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
122
  if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
123
  echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr (maybe_serialize ($value)) . '" />' . "\n";
147
  */
148
  public static function ms_process_signup_meta ($meta = FALSE)
149
  {
150
+ global $current_site, $current_blog; /* Multisite Networking. */
151
  global $pagenow; /* Need this to detect the current admin page. */
152
  /**/
153
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
154
  do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
155
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
156
  /**/
157
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
158
+ if (!empty ($_POST) && is_array ($_POST) && ((is_blog_admin () && $pagenow === "user-new.php") || (!is_admin () && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty ($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", (string)$_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))))
159
  {
160
+ c_ws_plugin__s2member_email_configs::email_config (); /* Configures `From:` header used in notifications. */
161
+ /**/
162
+ $meta["add_to_blog"] = (empty ($meta["add_to_blog"])) ? $current_blog->blog_id : $meta["add_to_blog"];
163
+ $meta["new_role"] = (empty ($meta["new_role"])) ? get_option ("default_role") : $meta["new_role"];
164
  /**/
165
+ foreach (c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
166
  if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
167
  if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
168
  $meta["s2member_ms_signup_meta"][$key] = maybe_unserialize ($value);
191
  */
192
  public static function ms_activate_existing_user ($_error = FALSE, $vars = FALSE)
193
  {
194
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
195
  do_action ("ws_plugin__s2member_before_ms_activate_existing_user", get_defined_vars ());
196
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
197
  /**/
198
+ extract ($vars); /* Extract all variables from ``wpmu_activate_signup()`` function. */
199
  /**/
200
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
201
  if (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page ())))
202
  {
203
  if (!empty ($user_id) && !empty ($user_login) && !empty ($user_email) && !empty ($password) && !empty ($meta) && !empty ($meta["add_to_blog"]) && !empty ($meta["new_role"]))
204
+ if (!empty ($user_already_exists) && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email, $meta["add_to_blog"]))
205
  {
206
  add_user_to_blog ($meta["add_to_blog"], $user_id, $meta["new_role"]); /* Add this User to the specified Blog. */
207
+ wp_update_user (array ("ID" => $user_id, "user_pass" => $password)); /* Update Password so it's the same as in the following msg. */
208
  wpmu_welcome_user_notification ($user_id, $password, $meta); /* Send welcome letter via email just like ``wpmu_activate_signup()`` does. */
209
  /**/
210
+ do_action ("wpmu_activate_user", $user_id, $password, $meta); /* Process Hook that would have been fired inside ``wpmu_activate_signup()``. */
211
  /**/
212
  return apply_filters ("ws_plugin__s2member_ms_activate_existing_user", array ("user_id" => $user_id, "password" => $password, "meta" => $meta), get_defined_vars ());
213
  }
236
  {
237
  global $pagenow; /* Need this to detect the current admin page. */
238
  /**/
239
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
240
  do_action ("ws_plugin__s2member_before_configure_user_on_ms_user_activation", get_defined_vars ());
241
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
242
  /**/
275
  */
276
  public static function configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
277
  {
278
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
279
  do_action ("ws_plugin__s2member_before_configure_user_on_ms_blog_activation", get_defined_vars ());
280
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
281
  /**/
310
  */
311
  public static function ms_register_existing_user ($errors = FALSE, $user_login = FALSE, $user_email = FALSE)
312
  {
313
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
314
  do_action ("ws_plugin__s2member_before_ms_register_existing_user", get_defined_vars ());
315
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
316
  /**/
317
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
318
+ if (!is_admin () && /* `/wp-login.php`? */ preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
319
+ if (is_wp_error ($errors) && $errors->get_error_codes ()) /* Errors? */
320
  {
321
  if (($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email)))
322
  {
323
  foreach ($errors->get_error_codes () as $error_code)
324
+ if (!in_array ($error_code, array ("username_exists", "email_exists")))
325
  $other_important_errors_exist = true;
326
  /**/
327
+ if (empty ($other_important_errors_exist)) /* Only if/when NO other important errors exist already. */
328
  {
329
+ $user_pass = wp_generate_password (); /* A new Password for this User/Member will be generated now. */
330
  c_ws_plugin__s2member_registrations::ms_create_existing_user ($user_login, $user_email, $user_pass, $user_id);
331
+ update_user_option ($user_id, "default_password_nag", true, true); /* Setup Password-change nag screen. */
332
+ wp_new_user_notification ($user_id, $user_pass); /* Welcome email, just like ``register_new_user()``. */
333
  /**/
334
  $redirect_to = (!empty ($_REQUEST["redirect_to"])) ? trim (stripslashes ($_REQUEST["redirect_to"])) : false;
335
  $redirect_to = ($redirect_to) ? $redirect_to : add_query_arg ("checkemail", urlencode ("registered"), wp_login_url ());
336
  /**/
337
  do_action ("ws_plugin__s2member_during_ms_register_existing_user", get_defined_vars ());
338
  /**/
339
+ wp_safe_redirect ($redirect_to); /* Use safe redirect; like ``register_new_user()``. */
340
  /**/
341
  exit (); /* Clean exit. */
342
  }
343
  }
344
  }
345
+ else if (($ms = wpmu_validate_user_signup ($user_login, $user_email)) && isset ($ms["errors"]) && is_wp_error ($ms["errors"]) && $ms["errors"]->get_error_code ())
346
+ $errors->add ($ms["errors"]->get_error_code (), $ms["errors"]->get_error_message ());
 
 
347
  /**/
348
  return apply_filters ("ws_plugin__s2member_ms_register_existing_user", $errors, get_defined_vars ());
349
  }
365
  */
366
  public static function ms_create_existing_user ($user_login = FALSE, $user_email = FALSE, $user_pass = FALSE, $user_id = FALSE)
367
  {
368
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
369
  do_action ("ws_plugin__s2member_before_ms_create_existing_user", get_defined_vars ());
370
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
371
  /**/
374
  if (($user_id || ($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))) && $user_pass)
375
  {
376
  $role = get_option ("default_role"); /* Use default Role. */
377
+ add_existing_user_to_blog (array ("user_id" => $user_id, "role" => $role)); /* Add User. */
378
+ wp_update_user (array ("ID" => $user_id, "user_pass" => $user_pass)); /* Update to ``$user_pass``. */
379
  /**/
380
  do_action ("ws_plugin__s2member_during_ms_create_existing_user", get_defined_vars ());
381
  do_action ("user_register", $user_id); /* So s2Member knows a User is registering. */
393
  * ``c_ws_plugin__s2member_registrations::ms_create_existing_user()`` and/or ``wpmu_create_user()``.
394
  *
395
  * This function also receives hand-offs from s2Member's handlers for these two Hooks:
396
+ * `wpmu_activate_user` and `wpmu_activate_blog`.
397
  *
398
  * @package s2Member\Registrations
399
  * @since 3.5
406
  * @param array $meta Optional in most cases. An array of meta data added by s2Member for Multisite Network processing.
407
  * @return null
408
  *
 
409
  * @todo Impossible to delete cookies when fired inside: `/wp-activate.php`?
410
  */
411
  public static function configure_user_registration ($user_id = FALSE, $password = FALSE, $meta = FALSE)
412
  {
413
+ global $wpdb; /* Global database object reference. */
414
+ global $pagenow; /* Need this to detect current admin page. */
415
  global $current_site, $current_blog; /* Multisite Networking. */
416
  static $email_config, $processed; /* No duplicate processing. */
417
  /**/
418
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
419
  do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
420
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
421
  /**/
422
  /* With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_user|blog`. */
423
+ if (!isset ($email_config) && ($email_config = true)) /* Anytime this routine is fired; we configure email. */
424
+ c_ws_plugin__s2member_email_configs::email_config (); /* Configures `From:` header in new User notifications. */
425
  /**/
426
  if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
427
  /**/
429
  /**/
430
  /* These negative matches are designed to prevent this routine from running under certain conditions; where we need to wait for `wpmu_activate_user|blog`. */
431
  && !(is_multisite () && is_blog_admin () && $pagenow === "user-new.php" && isset ($_p["noconfirmation"]) && is_super_admin () && func_num_args () !== 3) /* OK? */
432
+ && !(preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && func_num_args () !== 3) /* If activating; we MUST have a ``$meta`` arg to proceed. Otherwise ignore. */
433
  && !(c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && empty ($GLOBALS["ws_plugin__s2member_registration_vars"]))/**/
434
  && !(c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page () && func_num_args () !== 3)
435
  /**/
436
+ && $user_id && is_object ($user = new WP_User ($user_id)) && !empty ($user->ID) && ($user_id = $user->ID) && ($processed = true))
437
  {
438
  settype ($_p, "array") . settype ($meta, "array");
439
  settype ($GLOBALS["ws_plugin__s2member_registration_vars"], "array");
440
  /**/
441
+ foreach ($_p as $key => $value) /* Scan ``$_p`` vars; adding `custom_reg_field` keys. */
442
  if (preg_match ("/^ws_plugin__s2member_user_new_/", $key)) /* Look for `user_new` keys. */
443
  if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
444
  $_p[$key] = $value; /* Add these keys for uniformity. */
447
  $meta = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($meta));
448
  /**/
449
  if (!is_admin () && (isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_custom"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_ccaps"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) || isset ($_p["ws_plugin__s2member_custom_reg_field_s2member_notes"])))
450
+ exit (_x ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
451
  /**/
452
  $_pmr = array_merge ($_p, $meta, $GLOBALS["ws_plugin__s2member_registration_vars"]); /* Merge these all together now. */
453
+ unset ($_p, $meta, $GLOBALS["ws_plugin__s2member_registration_vars"]); /* These vars can all be unset now; we now have them all in ``$_pmr``. */
454
  /**/
455
  $custom_reg_display_name = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_display_name"]; /* Can be configured by the site owner. */
456
  /**/
457
+ if (!is_admin () && (!c_ws_plugin__s2member_utils_conds::pro_is_installed () || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")) && /* A paying Customer? */ ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies))
458
+ { /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
459
+ This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
460
+ If processed through `/wp-activate.php`, it could've originated inside the admin, via `/user-new.php`. */
461
+ /**/
462
+ $processed = "yes"; /* Mark this as yes. */
463
  /**/
464
  $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
465
+ @list ($level, $ccaps, $eotper) = preg_split ("/\:/", $item_number, 3);
466
  $role = "s2member_level" . $level; /* Membership Level. */
467
  /**/
468
  $email = $user->user_email;
469
  $login = $user->user_login;
470
+ $ip = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
471
+ $ip = (!$ip) ? $_SERVER["REMOTE_ADDR"] : $ip; /* Else use environment variable. */
472
  $cv = preg_split ("/\|/", $custom);
473
  /**/
474
  if (!($auto_eot_time = "") && $eotper) /* If a specific EOT Period is included. */
475
  $auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time ("", "", "", $eotper);
476
  /**/
477
+ $notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
478
  /**/
479
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
480
+ $opt_in = (!$opt_in && !empty ($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"])) ? true : $opt_in;
481
  /**/
482
  if (!($fname = $user->first_name))
483
+ if (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"]))
484
+ $fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
485
  /**/
486
  if (!$fname) /* Also try BuddyPress. */
487
+ if (!empty ($_pmr["field_1"])) /* BuddyPress? */
488
+ $fname = trim (preg_replace ("/ (.*)$/", "", (string)$_pmr["field_1"]));
489
  /**/
490
  if (!($lname = $user->last_name))
491
+ if (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"]))
492
+ $lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
493
  /**/
494
  if (!$lname) /* Also try BuddyPress. */
495
+ if (!empty ($_pmr["field_1"]) && preg_match ("/^(.+?) (.+)$/", (string)$_pmr["field_1"]))
496
+ $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", (string)$_pmr["field_1"]));
497
  /**/
498
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname)
499
  if ($login) /* Username and empty Last Name. */
500
+ eval ('$fname = trim ($login); $lname = "";');
501
  /**/
502
  $name = trim ($fname . " " . $lname); /* Both names. */
503
  /**/
504
  if (!($pass = $password)) /* Try s2Member's generator. */
505
+ if (!empty ($GLOBALS["ws_plugin__s2member_generate_password_return"]))
506
+ $pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
507
  /**/
508
  if (!$pass) /* Also try BuddyPress Password. */
509
+ if (!empty ($_pmr["signup_password"])) /* BuddyPress? */
510
+ $pass = (string)$_pmr["signup_password"];
511
  /**/
512
  if ($pass) /* No Password nag. Update this globally. */
513
  {
514
+ /* Note: ``delete_user_setting()`` uses cookies. */
515
  delete_user_setting ("default_password_nag", $user_id);
516
  update_user_option ($user_id, "default_password_nag", false, true);
517
  }
532
  if (!$user->display_name || $user->display_name === $user->user_login)
533
  {
534
  if ($custom_reg_display_name === "full" && $name)
535
+ wp_update_user (array ("ID" => $user_id, "display_name" => $name));
536
  else if ($custom_reg_display_name === "first" && $fname)
537
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
538
  else if ($custom_reg_display_name === "last" && $lname)
539
+ wp_update_user (array ("ID" => $user_id, "display_name" => $lname));
540
  else if ($custom_reg_display_name === "login" && $login)
541
+ wp_update_user (array ("ID" => $user_id, "display_name" => $login));
542
  }
543
  /**/
544
  if (is_multisite ()) /* Should we handle Main Site permissions and Originating Blog ID#? */
563
  if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
564
  $user->add_cap ("access_s2member_ccap_" . $ccap);
565
  /**/
566
+ if (!($fields = array ()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
567
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
568
  {
569
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
573
  $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
574
  }
575
  /**/
576
+ if (!empty ($fields)) /* Only if NOT empty. */
577
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
578
  /**/
579
  if ($level > 0) /* We ONLY process this if they are higher than Level#0. */
580
  {
581
  $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
582
+ $pr_times["level"] = (empty ($pr_times["level"])) ? time () : $pr_times["level"];
583
+ $pr_times["level" . $level] = (empty ($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
584
  update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
585
  }
586
  /**/
587
  if (($transient = "s2m_" . md5 ("s2member_transient_ipn_signup_vars_" . $subscr_id)) && is_array ($ipn_signup_vars = get_transient ($transient)))
588
  {
589
  update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars); /* For future reference. */
590
+ delete_transient ($transient); /* This can be deleted now. */
591
  }
592
+ if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)) && !empty ($subscr_payment["subscr_gateway"]))
593
  {
594
+ $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => stripslashes ((string)$subscr_payment["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen ());
595
  c_ws_plugin__s2member_utils_urls::remote (add_query_arg (urlencode_deep ($proxy), site_url ("/")), stripslashes_deep ($subscr_payment), array ("timeout" => 20));
596
+ delete_transient ($transient); /* This can be deleted now. */
597
  }
598
+ if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_eot_" . $subscr_id)) && is_array ($subscr_eot = get_transient ($transient)) && !empty ($subscr_eot["subscr_gateway"]))
599
  {
600
+ $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => stripslashes ((string)$subscr_eot["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen ());
601
  c_ws_plugin__s2member_utils_urls::remote (add_query_arg (urlencode_deep ($proxy), site_url ("/")), stripslashes_deep ($subscr_eot), array ("timeout" => 20));
602
+ delete_transient ($transient); /* This can be deleted now. */
603
  }
604
  /**/
605
  if (!headers_sent ()) /* Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies. */
606
  @setcookie ("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt ($subscr_id)), time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie ("s2member_tracking", $s2member_tracking, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
607
  /**/
608
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
609
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars ());
610
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
611
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
612
  }
613
  /**/
614
  else if (!is_admin () && (!c_ws_plugin__s2member_utils_conds::pro_is_installed () || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
615
+ { /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
616
+ This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
617
+ If processed through `/wp-activate.php`, it could've originated inside the admin, via `/user-new.php`. */
618
+ /**/
619
+ $processed = "yes"; /* Mark this as yes. */
620
  /**/
621
  $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
622
+ $role = ""; /* Initialize ``$role`` to an empty string here, before processing. */
623
+ $role = (!$role && ($level = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) > 0) ? "s2member_level" . $level : $role;
624
+ $role = (!$role && ($level = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) === "0") ? "subscriber" : $role;
625
  $role = (!$role && $current_role) ? $current_role : $role; /* Use existing Role? */
626
  $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
627
  /**/
628
+ $level = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
629
  $level = (!$level && preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
630
  $level = (!$level && preg_match ("/^s2member_level[1-9][0-9]*$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
631
  $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
632
  $level = (!$level) ? "0" : $level;
633
  /**/
634
+ $ccaps = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
635
  /**/
636
  $email = $user->user_email;
637
  $login = $user->user_login;
638
+ $ip = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
639
+ $ip = (!$ip) ? $_SERVER["REMOTE_ADDR"] : $ip; /* Else use environment variable. */
640
+ $custom = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
641
+ $subscr_id = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
642
+ $subscr_gateway = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
643
+ $cv = preg_split ("/\|/", (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
644
  /**/
645
+ $auto_eot_time = ($eot = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
646
+ $notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
647
  /**/
648
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
649
+ $opt_in = (!$opt_in && !empty ($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"])) ? true : $opt_in;
650
  /**/
651
  if (!($fname = $user->first_name))
652
+ if (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"]))
653
+ $fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
654
  /**/
655
  if (!$fname) /* Also try BuddyPress. */
656
+ if (!empty ($_pmr["field_1"])) /* BuddyPress? */
657
+ $fname = trim (preg_replace ("/ (.*)$/", "", (string)$_pmr["field_1"]));
658
  /**/
659
  if (!($lname = $user->last_name))
660
+ if (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"]))
661
+ $lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
662
  /**/
663
  if (!$lname) /* Also try BuddyPress. */
664
+ if (!empty ($_pmr["field_1"]) && preg_match ("/^(.+?) (.+)$/", (string)$_pmr["field_1"]))
665
+ $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", (string)$_pmr["field_1"]));
666
  /**/
667
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname)
668
  if ($login) /* Username and empty Last Name. */
669
+ eval ('$fname = trim ($login); $lname = "";');
670
  /**/
671
  $name = trim ($fname . " " . $lname); /* Both names. */
672
  /**/
673
  if (!($pass = $password)) /* Try s2Member's generator. */
674
+ if (!empty ($GLOBALS["ws_plugin__s2member_generate_password_return"]))
675
+ $pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
676
  /**/
677
  if (!$pass) /* Also try BuddyPress Password. */
678
+ if (!empty ($_pmr["signup_password"])) /* BuddyPress? */
679
+ $pass = (string)$_pmr["signup_password"];
680
  /**/
681
  if ($pass) /* No Password nag. Update this globally. */
682
  {
683
+ /* Note: ``delete_user_setting()`` uses cookies. */
684
  delete_user_setting ("default_password_nag", $user_id);
685
  update_user_option ($user_id, "default_password_nag", false, true);
686
  }
701
  if (!$user->display_name || $user->display_name === $user->user_login)
702
  {
703
  if ($custom_reg_display_name === "full" && $name)
704
+ wp_update_user (array ("ID" => $user_id, "display_name" => $name));
705
  else if ($custom_reg_display_name === "first" && $fname)
706
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
707
  else if ($custom_reg_display_name === "last" && $lname)
708
+ wp_update_user (array ("ID" => $user_id, "display_name" => $lname));
709
  else if ($custom_reg_display_name === "login" && $login)
710
+ wp_update_user (array ("ID" => $user_id, "display_name" => $login));
711
  }
712
  /**/
713
  if (is_multisite ()) /* Should we handle Main Site permissions and Originating Blog ID#? */
732
  if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
733
  $user->add_cap ("access_s2member_ccap_" . $ccap);
734
  /**/
735
+ if (!($fields = array ()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
736
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
737
  {
738
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
742
  $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
743
  }
744
  /**/
745
+ if (!empty ($fields)) /* Only if NOT empty. */
746
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
747
  /**/
748
  if ($level > 0) /* We ONLY process this if they are higher than Level#0. */
749
  {
750
  $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
751
+ $pr_times["level"] = (empty ($pr_times["level"])) ? time () : $pr_times["level"];
752
+ $pr_times["level" . $level] = (empty ($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
753
  update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
754
  }
755
  /**/
756
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
757
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side_free", get_defined_vars ());
758
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
759
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
760
  }
761
  /**/
762
  else if ((is_blog_admin () && $pagenow === "user-new.php") || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
763
+ { /* Can only be processed through `/user-new.php` in the Admin panel, or through Remote Op: `create_user`. */
764
+ /**/
765
  $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
766
  /**/
767
  $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
768
  $role = ""; /* Initialize $role to an empty string here, before processing. */
769
+ $role = (!$role && ($level = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) > 0) ? "s2member_level" . $level : $role;
770
+ $role = (!$role && ($level = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) === "0") ? "subscriber" : $role;
771
  $role = (!$role && $current_role) ? $current_role : $role; /* Use existing Role? */
772
  $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
773
  /**/
774
+ $level = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
775
  $level = (!$level && preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
776
  $level = (!$level && preg_match ("/^s2member_level[1-9][0-9]*$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
777
  $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
778
  $level = (!$level) ? "0" : $level;
779
  /**/
780
+ $ccaps = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
781
  /**/
782
  $email = $user->user_email;
783
  $login = $user->user_login;
784
+ $ip = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
785
+ $custom = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
786
+ $subscr_id = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
787
+ $subscr_gateway = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
788
+ $cv = preg_split ("/\|/", (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
789
  /**/
790
+ $auto_eot_time = ($eot = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
791
+ $notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
792
  /**/
793
+ $opt_in = (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"])) ? true : false;
794
  /**/
795
  if (!($fname = $user->first_name)) /* `Users -> Add New`. */
796
+ if (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"]))
797
+ $fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
798
  /**/
799
  if (!($lname = $user->last_name)) /* `Users -> Add New`. */
800
+ if (!empty ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"]))
801
+ $lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
802
  /**/
803
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname)
804
  if ($login) /* Username and empty Last Name. */
805
+ eval ('$fname = trim ($login); $lname = "";');
806
  /**/
807
  $name = trim ($fname . " " . $lname); /* Both names. */
808
  /**/
809
  if (!($pass = $password)) /* Try s2Member's generator. */
810
+ if (!empty ($GLOBALS["ws_plugin__s2member_generate_password_return"]))
811
+ $pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
812
  /**/
813
  if (!$pass) /* Also try the `Users -> Add New` form. */
814
+ if (!empty ($_pmr["pass1"])) /* Field in `/user-new.php`. */
815
+ $pass = (string)$_pmr["pass1"];
816
  /**/
817
  if ($pass) /* No Password nag. Update this globally. */
818
  {
819
+ /* Note: ``delete_user_setting()`` uses cookies. */
820
  delete_user_setting ("default_password_nag", $user_id);
821
  update_user_option ($user_id, "default_password_nag", false, true);
822
  }
837
  if (!$user->display_name || $user->display_name === $user->user_login)
838
  {
839
  if ($custom_reg_display_name === "full" && $name)
840
+ wp_update_user (array ("ID" => $user_id, "display_name" => $name));
841
  else if ($custom_reg_display_name === "first" && $fname)
842
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
843
  else if ($custom_reg_display_name === "last" && $lname)
844
+ wp_update_user (array ("ID" => $user_id, "display_name" => $lname));
845
  else if ($custom_reg_display_name === "login" && $login)
846
+ wp_update_user (array ("ID" => $user_id, "display_name" => $login));
847
  }
848
  /**/
849
  if (is_multisite ()) /* Should we handle Main Site permissions and Originating Blog ID#? */
868
  if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
869
  $user->add_cap ("access_s2member_ccap_" . $ccap);
870
  /**/
871
+ if (!($fields = array ()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
872
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
873
  {
874
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
878
  $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
879
  }
880
  /**/
881
+ if (!empty ($fields)) /* Only if NOT empty. */
882
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
883
  /**/
884
  if ($level > 0) /* We ONLY process this if they are higher than Level#0. */
885
  {
886
  $pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
887
+ $pr_times["level"] = (empty ($pr_times["level"])) ? time () : $pr_times["level"];
888
+ $pr_times["level" . $level] = (empty ($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
889
  update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); /* Update now. */
890
  }
891
  /**/
892
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
893
  do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
894
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
895
  }
914
  if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($ip)), $url)))
915
  if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
916
  {
917
+ foreach ($fields as $var => $val) /* Custom Fields. */
918
+ if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
919
+ break;
 
920
  /**/
921
  if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
922
  c_ws_plugin__s2member_utils_urls::remote ($url);
924
  /**/
925
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
926
  {
927
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
928
+ c_ws_plugin__s2member_email_configs::email_config_release ();
929
+ /**/
930
  $msg = $sbj = "( s2Member / API Notification Email ) - Registration";
931
  $msg .= "\n\n"; /* Spacing in the message body. */
932
  /**/
943
  $msg .= "user_ip: %%user_ip%%\n";
944
  $msg .= "user_id: %%user_id%%\n";
945
  /**/
946
+ foreach ($fields as $var => $val)
947
+ $msg .= $var . ": %%" . $var . "%%\n";
 
948
  /**/
949
  $msg .= "cv0: %%cv0%%\n";
950
  $msg .= "cv1: %%cv1%%\n";
971
  if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($ip), $msg)))
972
  if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
973
  {
974
+ foreach ($fields as $var => $val) /* Custom Fields. */
975
+ if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
976
+ break;
 
977
  /**/
978
  if (($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
979
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
980
  ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_registration_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
981
  }
982
+ /**/
983
+ if ($email_configs_were_on) /* Back on? */
984
+ c_ws_plugin__s2member_email_configs::email_config ();
985
  }
986
  /**/
987
  if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
1000
  if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($ip)), $url)))
1001
  if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
1002
  {
1003
+ foreach ($fields as $var => $val) /* Custom Fields. */
1004
+ if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
1005
+ break;
 
1006
  /**/
1007
+ if (($url = trim ($url))) /* Preserve remaining Replacements; because the parent routine may perform replacements too. */
 
1008
  $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
1009
  }
1010
  /**/
1021
  @setcookie ("s2member_item_number", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie ("s2member_item_number", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
1022
  }
1023
  /**/
1024
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1025
  do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
1026
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1027
  }
1028
  }
1029
  /**/
1030
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1031
  do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
1032
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1033
  /**/
includes/classes/sc-files-in.inc.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shortcode `[s2File /]` ( inner processing routines ).
4
+ *
5
+ * Copyright: © 2009-2011
6
+ * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
7
+ * ( coded in the USA )
8
+ *
9
+ * Released under the terms of the GNU General Public License.
10
+ * You should have received a copy of the GNU General Public License,
11
+ * along with this software. In the main directory, see: /licensing/
12
+ * If not, see: {@link http://www.gnu.org/licenses/}.
13
+ *
14
+ * @package s2Member\s2File
15
+ * @since 110926
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_sc_files_in"))
21
+ {
22
+ /**
23
+ * Shortcode `[s2File /]` ( inner processing routines ).
24
+ *
25
+ * @package s2Member\s2File
26
+ * @since 110926
27
+ */
28
+ class c_ws_plugin__s2member_sc_files_in
29
+ {
30
+ /**
31
+ * Handles the Shortcode for: `[s2File /]`.
32
+ *
33
+ * @package s2Member\s2File
34
+ * @since 110926
35
+ *
36
+ * @attaches-to: ``add_shortcode("s2File");``
37
+ *
38
+ * @param array $attr An array of Attributes.
39
+ * @param str $content Content inside the Shortcode.
40
+ * @param str $shortcode The actual Shortcode name itself.
41
+ * @return str Value of requested File Download URL, streamer array element; or null on failure.
42
+ */
43
+ public static function sc_get_file ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
44
+ {
45
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
46
+ do_action ("ws_plugin__s2member_before_sc_get_file", get_defined_vars ());
47
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
+ /**/
49
+ $attr = c_ws_plugin__s2member_utils_strings::trim_quot_deep ((array)$attr);
50
+ /**/
51
+ $attr = shortcode_atts (array ("download" => "", "download_key" => "", "stream" => "", "inline" => "", "storage" => "", "remote" => "", "ssl" => "", "rewrite" => "", "rewrite_base" => "", "skip_confirmation" => "", "url_to_storage_source" => "", "count_against_user" => "", "ignore_user" => "", /* Shortcode-specifics » */ "get_streamer_json" => ""), $attr);
52
+ /**/
53
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
54
+ do_action ("ws_plugin__s2member_before_sc_get_file_after_shortcode_atts", get_defined_vars ());
55
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
56
+ /**/
57
+ $get_streamer_json = $get_streamer_array = filter_var ($attr["get_streamer_json"], FILTER_VALIDATE_BOOLEAN); /* Getting a streamer? */
58
+ /**/
59
+ foreach ($attr as $key => $value) /* Now we need to go through and a `file_` prefix to certain Attribute keys, for compatibility. */
60
+ if (strlen ($value) && in_array ($key, array ("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base")))
61
+ $config["file_" . $key] = $value; /* Set prefixed config parameter here so we can pass properly in ``$config`` array. */
62
+ else if (strlen ($value) && !in_array ($key, array ("get_streamer_json"))) /* Else, exclude certain keys? */
63
+ $config[$key] = $value;
64
+ /**/
65
+ unset ($key, $value); /* Ditch these now. We don't want these bleeding into Hooks/Filters anyway. */
66
+ /**/
67
+ if (!empty ($config) && isset ($config["file_download"])) /* Looking for a File Download URL? */
68
+ {
69
+ $_get = c_ws_plugin__s2member_files::create_file_download_url ($config, $get_streamer_array);
70
+ /**/
71
+ if ($get_streamer_array && $get_streamer_json && is_array ($_get))
72
+ $get = json_encode ($_get);
73
+ /**/
74
+ else if ($get_streamer_array && $get_streamer_json)
75
+ $get = "null"; /* Null object value. */
76
+ /**/
77
+ else if (!empty ($_get)) /* Else ``$get``. */
78
+ $get = $_get; /* Default return. */
79
+ }
80
+ /**/
81
+ return apply_filters ("ws_plugin__s2member_sc_get_file", ((isset ($get)) ? $get : null), get_defined_vars ());
82
+ }
83
+ }
84
+ }
85
+ ?>
includes/classes/sc-files.inc.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shortcode `[s2File /]`.
4
+ *
5
+ * Copyright: © 2009-2011
6
+ * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
7
+ * ( coded in the USA )
8
+ *
9
+ * Released under the terms of the GNU General Public License.
10
+ * You should have received a copy of the GNU General Public License,
11
+ * along with this software. In the main directory, see: /licensing/
12
+ * If not, see: {@link http://www.gnu.org/licenses/}.
13
+ *
14
+ * @package s2Member\s2File
15
+ * @since 110926
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_sc_files"))
21
+ {
22
+ /**
23
+ * Shortcode `[s2File /]`.
24
+ *
25
+ * @package s2Member\s2File
26
+ * @since 110926
27
+ */
28
+ class c_ws_plugin__s2member_sc_files
29
+ {
30
+ /**
31
+ * Handles the Shortcode for: `[s2File /]`.
32
+ *
33
+ * @package s2Member\s2File
34
+ * @since 110926
35
+ *
36
+ * @attaches-to: ``add_shortcode("s2File");``
37
+ *
38
+ * @param array $attr An array of Attributes.
39
+ * @param str $content Content inside the Shortcode.
40
+ * @param str $shortcode The actual Shortcode name itself.
41
+ * @return str Value of the requested File Download URL, or null on failure.
42
+ */
43
+ public static function sc_get_file ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
44
+ {
45
+ return c_ws_plugin__s2member_sc_files_in::sc_get_file ($attr, $content, $shortcode);
46
+ }
47
+ }
48
+ }
49
+ ?>
includes/classes/systematics-sp.inc.php CHANGED
@@ -42,19 +42,32 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
42
  */
43
  public static function is_systematic_use_specific_page ($page_id = FALSE, $uri = FALSE)
44
  {
45
- if ($uri && strpos ($uri, "/wp-admin/") !== false) /* In the admin area? - All admin pages are considered Systematic. */
 
 
 
 
 
46
  {
47
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
48
  }
49
- else if ($uri && (preg_match ("/\/(wp-app|wp-signup|wp-register|wp-activate|wp-login|xmlrpc)\.php/", $uri) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(" . preg_quote (BP_REGISTER_SLUG, "/") . "|" . preg_quote (BP_ACTIVATION_SLUG, "/") . ")/", $uri))))
50
  {
51
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
52
  }
53
- else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
54
  {
55
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
56
  }
57
- else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
 
 
 
 
 
 
 
 
58
  {
59
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
60
  }
@@ -62,7 +75,7 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
62
  {
63
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
64
  }
65
- else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
66
  {
67
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
68
  }
@@ -70,7 +83,7 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
70
  {
71
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
72
  }
73
- else /* Otherwise, we return false ( it's NOT a Systematic ). */
74
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
75
  }
76
  }
42
  */
43
  public static function is_systematic_use_specific_page ($page_id = FALSE, $uri = FALSE)
44
  {
45
+ global $bp; /* If BuddyPress is installed, we'll need this global reference. */
46
+ /**/
47
+ $page_id = ($page_id && is_numeric ($page_id)) ? (int)$page_id : false; /* Force types. */
48
+ $uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
49
+ /**/
50
+ if ($uri && preg_match ("/\/wp-admin(\/|$)/", $uri)) /* Inside a WordPress® administrative area? */
51
  {
52
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
53
  }
54
+ else if ($uri && preg_match ("/\/(wp-app|wp-signup|wp-register|wp-activate|wp-login|xmlrpc)\.php/", $uri))
55
  {
56
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
57
  }
58
+ 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))
59
  {
60
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
61
  }
62
+ else if ($page_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty ($bp->pages->register->id) && $page_id === (int)$bp->pages->register->id) || (!empty ($bp->pages->activate->id) && $page_id === (int)$bp->pages->activate->id)))
63
+ {
64
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
65
+ }
66
+ else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
67
+ {
68
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
69
+ }
70
+ else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
71
  {
72
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
73
  }
75
  {
76
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
77
  }
78
+ else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
79
  {
80
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
81
  }
83
  {
84
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
85
  }
86
+ else /* Otherwise, we return false ( i.e. it's NOT a Systematic area ). */
87
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
88
  }
89
  }
includes/classes/systematics.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"))
21
  {
@@ -47,11 +47,11 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
47
  {
48
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
49
  }
50
- else if (preg_match ("/^CLI$/i", PHP_SAPI)) /* CLI = Command Line. Normally indicates a running cron job. */
51
  {
52
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
53
  }
54
- else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && stripos ($_SERVER["HTTP_HOST"], "localhost") === false && strpos ($_SERVER["HTTP_HOST"], "127.0.0.1") !== 0 && (!defined ("LOCALHOST") || !LOCALHOST))
55
  {
56
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
57
  }
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"))
21
  {
47
  {
48
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
49
  }
50
+ else if (strcasecmp (PHP_SAPI, "CLI") === 0) /* CLI = Command Line. Normally indicates a running cron job. */
51
  {
52
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
53
  }
54
+ 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))
55
  {
56
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
57
  }
includes/classes/translations.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_translations"))
21
  {
@@ -145,6 +145,28 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
145
  }
146
  }
147
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  return $translated; /* No Filters. */
149
  }
150
  }
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_translations"))
21
  {
145
  }
146
  }
147
  /**/
148
+ else if ((isset ($s["is_bp_blog_creation"]) && $s["is_bp_blog_creation"]) || (!isset ($s["is_bp_blog_creation"]) && ($s["is_bp_blog_creation"] = (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_create_blog ()) ? true : false)))
149
+ {
150
+ if ($original === "If you&#8217;re not going to use a great domain, leave it for a new user. Now have at it!")
151
+ {
152
+ $translated = apply_filters ("ws_plugin__s2member_translation_mangler", "", get_defined_vars ());
153
+ }
154
+ else if ($original === "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!")
155
+ {
156
+ if (is_user_logged_in () && !(is_main_site () && current_user_can ("create_users")) && !is_super_admin () && is_object ($user = wp_get_current_user ()) && $user->ID && is_object ($user = new WP_User ($user->ID, $current_site->blog_id)) && $user->ID)
157
+ {
158
+ $mms_options = c_ws_plugin__s2member_utilities::mms_options ();
159
+ $blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
160
+ $user_blogs = (is_array ($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
161
+ /**/
162
+ $user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; /* NOT less than zero. */
163
+ $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
164
+ /**/
165
+ $translated = apply_filters ("ws_plugin__s2member_translation_mangler", _x ('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . (($blogs_allowed > 1) ? '<br />' . sprintf (_nx ('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars ());
166
+ }
167
+ }
168
+ }
169
+ /**/
170
  return $translated; /* No Filters. */
171
  }
172
  }
includes/classes/user-deletions.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_user_deletions"))
21
  {
@@ -46,7 +46,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
46
  static $processed = array (); /* No duplicate processing. */
47
  global $pagenow; /* Need this to detect the current admin page. */
48
  /**/
49
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
  do_action ("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars ());
51
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
  /**/
@@ -55,19 +55,19 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
55
  if (($s2says || (is_blog_admin () && $pagenow === "users.php")) && ($processed[$user_id] = true))
56
  /* Do NOT react on this globally. There are many routines that remove Users for different/minor reasons. */
57
  {
58
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
59
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars ());
60
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
61
  /**/
62
  c_ws_plugin__s2member_user_deletions::handle_user_deletions ($user_id); /* Hand this over. */
63
  /**/
64
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  }
68
  }
69
  /**/
70
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
71
  do_action ("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars ());
72
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
73
  /**/
@@ -89,7 +89,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
89
  {
90
  static $processed = array (); /* No duplicate processing. */
91
  /**/
92
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
93
  do_action ("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
94
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
95
  /**/
@@ -104,29 +104,33 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
104
  $fields = get_user_option ("s2member_custom_fields", $user_id); /* Used in API Notifications. */
105
  $user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); /* In API Notifications. */
106
  /**/
107
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
108
  do_action ("ws_plugin__s2member_during_handle_user_before_deletions", get_defined_vars ());
109
  do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
110
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
111
  /**/
112
- delete_user_option ($user_id, "s2member_custom"); /* Now we can remove these User options ( for this Blog ). */
113
- delete_user_option ($user_id, "s2member_subscr_id"); /* The `wpmu_delete_user` Hook also handles this. */
114
  delete_user_option ($user_id, "s2member_subscr_gateway");
 
 
115
  delete_user_option ($user_id, "s2member_registration_ip");
116
  /**/
117
- delete_user_option ($user_id, "s2member_sp_references");
118
  delete_user_option ($user_id, "s2member_ipn_signup_vars");
119
  delete_user_option ($user_id, "s2member_paid_registration_times");
 
 
 
120
  delete_user_option ($user_id, "s2member_first_payment_txn_id");
121
  delete_user_option ($user_id, "s2member_last_payment_time");
122
- delete_user_option ($user_id, "s2member_last_status_scan");
123
  delete_user_option ($user_id, "s2member_auto_eot_time");
124
- delete_user_option ($user_id, "s2member_login_counter");
125
- delete_user_option ($user_id, "s2member_notes");
126
  /**/
127
  delete_user_option ($user_id, "s2member_file_download_access_arc");
128
  delete_user_option ($user_id, "s2member_file_download_access_log");
129
  /**/
 
 
 
130
  if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
131
  {
132
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications on user deletion. */
@@ -151,7 +155,8 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
151
  /**/
152
  if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
153
  {
154
- c_ws_plugin__s2member_email_configs::email_config_release (); /* Release all Filters applied to wp_mail() From: headers. */
 
155
  /**/
156
  $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
157
  $msg .= "\n\n"; /* Spacing in the message body. */
@@ -198,14 +203,17 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
198
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
199
  ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
200
  }
 
 
 
201
  }
202
  /**/
203
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
204
  do_action ("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
205
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
206
  }
207
  /**/
208
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
209
  do_action ("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
210
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
211
  /**/
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
21
  {
46
  static $processed = array (); /* No duplicate processing. */
47
  global $pagenow; /* Need this to detect the current admin page. */
48
  /**/
49
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
  do_action ("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars ());
51
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
  /**/
55
  if (($s2says || (is_blog_admin () && $pagenow === "users.php")) && ($processed[$user_id] = true))
56
  /* Do NOT react on this globally. There are many routines that remove Users for different/minor reasons. */
57
  {
58
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
59
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars ());
60
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
61
  /**/
62
  c_ws_plugin__s2member_user_deletions::handle_user_deletions ($user_id); /* Hand this over. */
63
  /**/
64
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  do_action ("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  }
68
  }
69
  /**/
70
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
71
  do_action ("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars ());
72
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
73
  /**/
89
  {
90
  static $processed = array (); /* No duplicate processing. */
91
  /**/
92
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
93
  do_action ("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
94
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
95
  /**/
104
  $fields = get_user_option ("s2member_custom_fields", $user_id); /* Used in API Notifications. */
105
  $user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); /* In API Notifications. */
106
  /**/
107
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
108
  do_action ("ws_plugin__s2member_during_handle_user_before_deletions", get_defined_vars ());
109
  do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
110
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
111
  /**/
112
+ delete_user_option ($user_id, "s2member_custom"); /* Remove User options ( for this Blog ). */
113
+ delete_user_option ($user_id, "s2member_subscr_id");
114
  delete_user_option ($user_id, "s2member_subscr_gateway");
115
+ /**/
116
+ delete_user_option ($user_id, "s2member_custom_fields");
117
  delete_user_option ($user_id, "s2member_registration_ip");
118
  /**/
 
119
  delete_user_option ($user_id, "s2member_ipn_signup_vars");
120
  delete_user_option ($user_id, "s2member_paid_registration_times");
121
+ delete_user_option ($user_id, "s2member_sp_references");
122
+ /**/
123
+ delete_user_option ($user_id, "s2member_last_status_scan");
124
  delete_user_option ($user_id, "s2member_first_payment_txn_id");
125
  delete_user_option ($user_id, "s2member_last_payment_time");
 
126
  delete_user_option ($user_id, "s2member_auto_eot_time");
 
 
127
  /**/
128
  delete_user_option ($user_id, "s2member_file_download_access_arc");
129
  delete_user_option ($user_id, "s2member_file_download_access_log");
130
  /**/
131
+ delete_user_option ($user_id, "s2member_login_counter");
132
+ delete_user_option ($user_id, "s2member_notes");
133
+ /**/
134
  if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
135
  {
136
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications on user deletion. */
155
  /**/
156
  if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
157
  {
158
+ $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
159
+ c_ws_plugin__s2member_email_configs::email_config_release ();
160
  /**/
161
  $msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
162
  $msg .= "\n\n"; /* Spacing in the message body. */
203
  foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"])) as $recipient)
204
  ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
205
  }
206
+ /**/
207
+ if ($email_configs_were_on) /* Back on? */
208
+ c_ws_plugin__s2member_email_configs::email_config ();
209
  }
210
  /**/
211
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
212
  do_action ("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
213
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
214
  }
215
  /**/
216
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
217
  do_action ("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
218
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
219
  /**/
includes/classes/utils-conds.inc.php CHANGED
@@ -28,28 +28,42 @@ if (!class_exists ("c_ws_plugin__s2member_utils_conds"))
28
  class c_ws_plugin__s2member_utils_conds
29
  {
30
  /**
31
- * Determines whether or not BuddyPress is installed.
32
  *
33
  * @package s2Member\Utilities
34
  * @since 110720
35
  *
36
- * @return bool True if BuddyPress is installed, else false.
37
  */
38
- public static function bp_is_installed ()
39
  {
40
- return defined ("BP_VERSION");
41
  }
42
  /**
43
- * Determines whether or not s2Member Pro is installed.
44
  *
45
  * @package s2Member\Utilities
46
  * @since 110720
47
  *
48
- * @return bool True if s2Member Pro is installed, else false.
 
49
  */
50
- public static function pro_is_installed ()
51
  {
52
- return defined ("WS_PLUGIN__S2MEMBER_PRO_VERSION");
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
  /**
55
  * Determines whether or not this is a Multisite Farm;
@@ -111,6 +125,52 @@ if (!class_exists ("c_ws_plugin__s2member_utils_conds"))
111
  /**/
112
  return false;
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
  }
116
  ?>
28
  class c_ws_plugin__s2member_utils_conds
29
  {
30
  /**
31
+ * Determines whether or not s2Member Pro is installed.
32
  *
33
  * @package s2Member\Utilities
34
  * @since 110720
35
  *
36
+ * @return bool True if s2Member Pro is installed, else false.
37
  */
38
+ public static function pro_is_installed ()
39
  {
40
+ return defined ("WS_PLUGIN__S2MEMBER_PRO_VERSION");
41
  }
42
  /**
43
+ * Determines whether or not BuddyPress is installed.
44
  *
45
  * @package s2Member\Utilities
46
  * @since 110720
47
  *
48
+ * @param bool $query_active_plugins Optional. If true, this conditional will query active plugins too. Defaults to false.
49
+ * @return bool True if BuddyPress is installed, else false.
50
  */
51
+ public static function bp_is_installed ($query_active_plugins = FALSE)
52
  {
53
+ if (defined ("BP_VERSION")) /* Installed and active? */
54
+ return true;
55
+ /**/
56
+ if ($query_active_plugins) /* Else, query active plugins? */
57
+ {
58
+ $active_plugins = (is_multisite ()) ? wp_get_active_network_plugins () : array ();
59
+ $active_plugins = array_unique (array_merge ($active_plugins, wp_get_active_and_valid_plugins ()));
60
+ /**/
61
+ foreach ($active_plugins as $active_plugin) /* BuddyPress active? */
62
+ if (plugin_basename ($active_plugin) === "buddypress/bp-loader.php")
63
+ return true;
64
+ }
65
+ /**/
66
+ return false; /* Default return false. */
67
  }
68
  /**
69
  * Determines whether or not this is a Multisite Farm;
125
  /**/
126
  return false;
127
  }
128
+ /**
129
+ * Checks to see if we're using Amazon® S3.
130
+ *
131
+ * @package s2Member\Utilities
132
+ * @since 110926
133
+ *
134
+ * @return bool True if using Amazon® S3, else false.
135
+ */
136
+ public static function using_amazon_s3_storage ()
137
+ {
138
+ if (!c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage ())
139
+ {
140
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
141
+ if (preg_match ("/^amazon_s3_files_/", $option) && ($option = preg_replace ("/^amazon_s3_files_/", "", $option)))
142
+ $s3c[$option] = $option_value;
143
+ /**/
144
+ if ($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"])
145
+ return true;
146
+ }
147
+ /**/
148
+ return false;
149
+ }
150
+ /**
151
+ * Checks to see if we're using Amazon® CloudFront.
152
+ *
153
+ * @package s2Member\Utilities
154
+ * @since 110926
155
+ *
156
+ * @return bool True if using Amazon® CloudFront, else false.
157
+ */
158
+ public static function using_amazon_cf_storage ()
159
+ {
160
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
161
+ if (preg_match ("/^amazon_s3_files_/", $option) && ($option = preg_replace ("/^amazon_s3_files_/", "", $option)))
162
+ $s3c[$option] = $option_value;
163
+ /**/
164
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value)
165
+ if (preg_match ("/^amazon_cf_files_/", $option) && ($option = preg_replace ("/^amazon_cf_files_/", "", $option)))
166
+ $cfc[$option] = $option_value;
167
+ /**/
168
+ if ($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"])
169
+ if ($cfc["private_key"] && $cfc["private_key_id"] && $cfc["distros_access_id"] && $cfc["distros_s3_access_id"] && $cfc["distro_downloads_id"] && $cfc["distro_downloads_dname"] && $cfc["distro_streaming_id"] && $cfc["distro_streaming_dname"])
170
+ return true;
171
+ /**/
172
+ return false;
173
+ }
174
  }
175
  }
176
  ?>
includes/classes/utils-strings.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_strings"))
21
  {
@@ -154,13 +154,43 @@ if (!class_exists ("c_ws_plugin__s2member_utils_strings"))
154
  * @since 3.5
155
  *
156
  * @param str|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
157
- * @param str $beg A string value to wrap at the beginning of each value.
158
- * @param str $end A string value to wrap at the ending of each value.
159
  * @return str|array Either the input string, or the input array; after all data is wrapped up.
160
  */
161
  public static function wrap_deep ($value = FALSE, $beg = FALSE, $end = FALSE)
162
  {
163
- return (is_array ($value) && !empty ($value)) ? array_map ("c_ws_plugin__s2member_utils_strings::wrap_deep", $value, array_fill (0, count ($value), $beg), array_fill (0, count ($value), $end)) : ((is_string ($value) && strlen ($value)) ? (string)$beg . (string)$value . (string)$end : ((is_array ($value)) ? $value : (string)$value));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
  /**
166
  * Generates a random string with letters/numbers/symbols.
@@ -219,12 +249,19 @@ if (!class_exists ("c_ws_plugin__s2member_utils_strings"))
219
  * @since 110913
220
  *
221
  * @param str $string Input string to be base64 encoded.
 
 
 
222
  * @return str The base64 URL-safe encoded string.
223
  */
224
- public static function base64_url_safe_encode ($string = FALSE)
225
  {
226
- $string = (string)$string; /* Force to a string value. */
227
- return rtrim (str_replace (array ("+", "/"), array ("-", "_"), base64_encode ($string)), "=");
 
 
 
 
228
  }
229
  /**
230
  * Base64 URL-safe decoding.
@@ -235,13 +272,21 @@ if (!class_exists ("c_ws_plugin__s2member_utils_strings"))
235
  * @package s2Member\Utilities
236
  * @since 110913
237
  *
238
- * @param str $string Input string to be base64 decoded.
 
 
 
239
  * @return str The decoded string.
240
  */
241
- public static function base64_url_safe_decode ($string = FALSE)
242
  {
243
- $string = rtrim ((string)$string, "=~."); /* Remove padding chars `=~.`; we'll add `=` padding below. */
244
- return base64_decode (str_pad (str_replace (array ("-", "_"), array ("+", "/"), $string), strlen ($string) % 4, "=", STR_PAD_RIGHT));
 
 
 
 
 
245
  }
246
  }
247
  }
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_strings"))
21
  {
154
  * @since 3.5
155
  *
156
  * @param str|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
157
+ * @param str $beg Optional. A string value to wrap at the beginning of each value.
158
+ * @param str $end Optional. A string value to wrap at the ending of each value.
159
  * @return str|array Either the input string, or the input array; after all data is wrapped up.
160
  */
161
  public static function wrap_deep ($value = FALSE, $beg = FALSE, $end = FALSE)
162
  {
163
+ if (is_array ($value)) /* Handles all types of arrays.
164
+ Note, we do NOT use ``array_map()`` here, because multiple args to ``array_map()`` causes a loss of string keys.
165
+ For further details, see: <http://php.net/manual/en/function.array-map.php>. */
166
+ {
167
+ foreach ($value as &$r) /* Reference. */
168
+ $r = c_ws_plugin__s2member_utils_strings::wrap_deep ($r, $beg, $end);
169
+ return $value; /* Return modified array. */
170
+ }
171
+ return (is_string ($value) && strlen ($value)) ? (string)$beg . $value . (string)$end : (string)$value;
172
+ }
173
+ /**
174
+ * Escapes meta characters with ``preg_quote()`` deeply.
175
+ *
176
+ * @package s2Member\Utilities
177
+ * @since 110926
178
+ *
179
+ * @param str|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
180
+ * @param str $delimiter Optional. If a delimiting character is specified, it will also be escaped via ``preg_quote()``.
181
+ * @return str|array Either the input string, or the input array; after all data is escaped with ``preg_quote()``.
182
+ */
183
+ public static function preg_quote_deep ($value = FALSE, $delimiter = FALSE)
184
+ {
185
+ if (is_array ($value)) /* Handles all types of arrays.
186
+ Note, we do NOT use ``array_map()`` here, because multiple args to ``array_map()`` causes a loss of string keys.
187
+ For further details, see: <http://php.net/manual/en/function.array-map.php>. */
188
+ {
189
+ foreach ($value as &$r) /* Reference. */
190
+ $r = c_ws_plugin__s2member_utils_strings::preg_quote_deep ($r, $delimiter);
191
+ return $value; /* Return modified array. */
192
+ }
193
+ return preg_quote ((string)$value, (string)$delimiter);
194
  }
195
  /**
196
  * Generates a random string with letters/numbers/symbols.
249
  * @since 110913
250
  *
251
  * @param str $string Input string to be base64 encoded.
252
+ * @param array $url_unsafe_chars Optional. An array of un-safe characters. Defaults to: ``array("+", "/")``.
253
+ * @param array $url_safe_chars Optional. An array of safe character replacements. Defaults to: ``array("-", "_")``.
254
+ * @param str $trim_padding_chars Optional. A string of padding chars to rtrim. Defaults to: `=~.`.
255
  * @return str The base64 URL-safe encoded string.
256
  */
257
+ public static function base64_url_safe_encode ($string = FALSE, $url_unsafe_chars = array ("+", "/"), $url_safe_chars = array ("-", "_"), $trim_padding_chars = "=~.")
258
  {
259
+ eval ('$string = (string)$string; $trim_padding_chars = (string)$trim_padding_chars;');
260
+ /**/
261
+ $base64_url_safe = str_replace ((array)$url_unsafe_chars, (array)$url_safe_chars, base64_encode ($string));
262
+ $base64_url_safe = (strlen ($trim_padding_chars)) ? rtrim ($base64_url_safe, $trim_padding_chars) : $base64_url_safe;
263
+ /**/
264
+ return $base64_url_safe; /* Base64 encoded, with URL-safe replacements. */
265
  }
266
  /**
267
  * Base64 URL-safe decoding.
272
  * @package s2Member\Utilities
273
  * @since 110913
274
  *
275
+ * @param str $base64_url_safe Input string to be base64 decoded.
276
+ * @param array $url_unsafe_chars Optional. An array of un-safe character replacements. Defaults to: ``array("+", "/")``.
277
+ * @param array $url_safe_chars Optional. An array of safe characters. Defaults to: ``array("-", "_")``.
278
+ * @param str $trim_padding_chars Optional. A string of padding chars to rtrim. Defaults to: `=~.`.
279
  * @return str The decoded string.
280
  */
281
+ public static function base64_url_safe_decode ($base64_url_safe = FALSE, $url_unsafe_chars = array ("+", "/"), $url_safe_chars = array ("-", "_"), $trim_padding_chars = "=~.")
282
  {
283
+ eval ('$base64_url_safe = (string)$base64_url_safe; $trim_padding_chars = (string)$trim_padding_chars;');
284
+ /**/
285
+ $string = (strlen ($trim_padding_chars)) ? rtrim ($base64_url_safe, $trim_padding_chars) : $base64_url_safe;
286
+ $string = (strlen ($trim_padding_chars)) ? str_pad ($string, strlen ($string) % 4, "=", STR_PAD_RIGHT) : $string;
287
+ $string = base64_decode (str_replace ((array)$url_safe_chars, (array)$url_unsafe_chars, $string));
288
+ /**/
289
+ return $string; /* Base64 decoded, with URL-safe replacements. */
290
  }
291
  }
292
  }
includes/classes/utils-urls.inc.php CHANGED
@@ -65,10 +65,11 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
65
  * @param str $url Full URL with possible query string parameters.
66
  * @param str|array $post_vars Optional. Either a string of POST vars, or an array.
67
  * @param array $args Optional. An array of additional arguments used by ``wp_remote_request()``.
68
- * @param bool $raw Optional. Return raw data w/ headers too? Defaults to false.
69
- * @return str|bool The data received in the response from the remote location, else false on failure.
 
70
  */
71
- public static function remote ($url = FALSE, $post_vars = FALSE, $args = array (), $raw = FALSE)
72
  {
73
  static $http_response_filtered = false; /* Apply GZ filters only once. */
74
  /**/
@@ -86,19 +87,28 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
86
  if ((is_array ($post_vars) || is_string ($post_vars)) && !empty ($post_vars))
87
  $args = array_merge ($args, array ("method" => "POST", "body" => $post_vars));
88
  /**/
89
- $response = wp_remote_request ($url, $args); /* Get response array. */
90
  /**/
91
- if ($raw && !($r = "")) /* Return a raw response w/ all headers too? */
92
  {
93
- foreach (wp_remote_retrieve_headers ($response) as $header => $header_v)
94
- $r .= $header . ": " . $header_v . "\r\n";
95
- $r = trim ($r) . "\r\n\r\n"; /* Separate headers. */
96
- $r .= wp_remote_retrieve_response_message ($response);
 
 
 
 
 
97
  }
98
- else /* Else we just retrieve the body. */
 
99
  $r = wp_remote_retrieve_body ($response);
100
  /**/
101
- if ($curl_was_disabled_by_this_routine_with_1352_priority = $curl_disabled)
 
 
 
102
  remove_filter ("use_curl_transport", "__return_false", 1352);
103
  /**/
104
  return $r; /* The return value. */
65
  * @param str $url Full URL with possible query string parameters.
66
  * @param str|array $post_vars Optional. Either a string of POST vars, or an array.
67
  * @param array $args Optional. An array of additional arguments used by ``wp_remote_request()``.
68
+ * @param bool $return Optional. One of: `body|array`. Defaults to `body`. If `array`, an array with the following elements is returned:
69
+ * `headers` *(an array of headers)*, `body` *(the response body string)*, `code` *(http response code)*, `message` *(http response message)*, `response` *(response array)*.
70
+ * @return str|array|bool Requested response data from the remote location *(see ``$return`` parameter )*, else false on failure.
71
  */
72
+ public static function remote ($url = FALSE, $post_vars = FALSE, $args = FALSE, $return = FALSE)
73
  {
74
  static $http_response_filtered = false; /* Apply GZ filters only once. */
75
  /**/
87
  if ((is_array ($post_vars) || is_string ($post_vars)) && !empty ($post_vars))
88
  $args = array_merge ($args, array ("method" => "POST", "body" => $post_vars));
89
  /**/
90
+ $response = wp_remote_request ($url, $args); /* Get remote request response. */
91
  /**/
92
+ if ($return === "array" && !is_wp_error ($response) && is_array ($response))
93
  {
94
+ $r["code"] = (int)wp_remote_retrieve_response_code ($response);
95
+ $r["message"] = wp_remote_retrieve_response_message ($response);
96
+ /**/
97
+ $r["headers"] = array (); /* Creates an array of lowercase headers. */
98
+ foreach (array_keys ($r["o_headers"] = wp_remote_retrieve_headers ($response)) as $header)
99
+ $r["headers"][strtolower ($header)] = $r["o_headers"][$header];
100
+ /**/
101
+ $r["body"] = wp_remote_retrieve_body ($response);
102
+ $r["response"] = $response;
103
  }
104
+ /**/
105
+ else if (!is_wp_error ($response) && is_array ($response))
106
  $r = wp_remote_retrieve_body ($response);
107
  /**/
108
+ else /* Else the request has failed. */
109
+ $r = false; /* Request failed. */
110
+ /**/
111
+ if (!empty ($curl_disabled) && $curl_disabled === 1352)
112
  remove_filter ("use_curl_transport", "__return_false", 1352);
113
  /**/
114
  return $r; /* The return value. */
includes/codes.inc.php CHANGED
@@ -15,12 +15,13 @@
15
  * @since 3.0
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
  /*
20
  Add WordPress® Editor Shortcodes.
21
  */
22
  add_shortcode ("s2Key", "c_ws_plugin__s2member_sc_keys::sc_get_key");
23
  add_shortcode ("s2Get", "c_ws_plugin__s2member_sc_gets::sc_get_details");
 
24
  /**/
25
  add_shortcode ("s2If", "c_ws_plugin__s2member_sc_if_conds::sc_if_conditionals");
26
  add_shortcode ("_s2If", "c_ws_plugin__s2member_sc_if_conds::sc_if_conditionals");
15
  * @since 3.0
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /*
20
  Add WordPress® Editor Shortcodes.
21
  */
22
  add_shortcode ("s2Key", "c_ws_plugin__s2member_sc_keys::sc_get_key");
23
  add_shortcode ("s2Get", "c_ws_plugin__s2member_sc_gets::sc_get_details");
24
+ add_shortcode ("s2File", "c_ws_plugin__s2member_sc_files::sc_get_file");
25
  /**/
26
  add_shortcode ("s2If", "c_ws_plugin__s2member_sc_if_conds::sc_if_conditionals");
27
  add_shortcode ("_s2If", "c_ws_plugin__s2member_sc_if_conds::sc_if_conditionals");
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
  *
@@ -1849,6 +1849,57 @@ if (!function_exists ("detach_s2member_query_filters"))
1849
  }
1850
  }
1851
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1852
  * Generates a File Download Key that provides access to a File protected by s2Member.
1853
  *
1854
  * By default, s2Member uses your Basic Download Restrictions. For more information on this,
@@ -1858,7 +1909,7 @@ if (!function_exists ("detach_s2member_query_filters"))
1858
  *
1859
  * Or, you can also force s2Member to allow File Downloads, using an extra query string parameter `s2member_file_download_key`.
1860
  * A File Download Key is passed through this parameter; it tells s2Member to allow the download of this particular file,
1861
- * regardless of Membership Level; and WITHOUT checking any Basic Restrictions, that you may, or may not, have configured.
1862
  *
1863
  * ———— Code Sample Using A Download Key ————
1864
  * ```
@@ -1889,6 +1940,8 @@ if (!function_exists ("detach_s2member_query_filters"))
1889
  * It is also possible to pass in the $directive string `ip-forever`, making the Key last forever, but only for a specific IP address.
1890
  * @return str The File Download Key. Which is an MD5 hash *( always 32 characters )*, URL-safe.
1891
  *
 
 
1892
  * @todo Allow custom expiration times.
1893
  */
1894
  if (!function_exists ("s2member_file_download_key"))
@@ -1927,8 +1980,6 @@ if (!function_exists ("s2member_file_download_key"))
1927
  * The Registration Time, is the time at which the Username was created for the account, that's it.
1928
  *
1929
  * @see s2Member\API_Functions\get_user_field()
1930
- *
1931
- * @todo Create a Shortcode equivalent.
1932
  */
1933
  if (!function_exists ("s2member_registration_time"))
1934
  {
@@ -1972,8 +2023,6 @@ if (!function_exists ("s2member_registration_time"))
1972
  * @return int A {@link http://en.wikipedia.org/wiki/Unix_time Unix Timestamp}.
1973
  *
1974
  * @see s2Member\API_Functions\get_user_field()
1975
- *
1976
- * @todo Create a Shortcode equivalent.
1977
  */
1978
  if (!function_exists ("s2member_paid_registration_time"))
1979
  {
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
  *
1849
  }
1850
  }
1851
  /**
1852
+ * Generates a File Download URL that provides access to a File protected by s2Member.
1853
+ *
1854
+ * By default, s2Member uses your Basic Download Restrictions. For more information on this,
1855
+ * please check your Dashboard under: `s2Member -> Download Options -> Basic Download Restrictions`.
1856
+ *
1857
+ * ———— HTML/PHP Code Samples ————
1858
+ * ```
1859
+ * <a href="<!php echo s2member_file_download_url(array("file_download" => "file.zip")); !>">Download Now</a>
1860
+ * <a href="<!php echo s2member_file_download_url(array("file_download" => "file.pdf", "file_inline" => true)); !>">View PDF</a>
1861
+ * ```
1862
+ * ———— Shortcode Equivalents ————
1863
+ * ```
1864
+ * <a href="[s2File download="file.zip" /]">Download Now</a>
1865
+ * <a href="[s2File download="file.pdf" inline="true" /]">View PDF</a>
1866
+ * ```
1867
+ *
1868
+ * ———— Advanced Download Restrictions ————
1869
+ *
1870
+ * Or, you can also force s2Member to allow File Downloads, by requesting a File Download Key ( i.e. `file_download_key => true` ).
1871
+ * When a File Download Key is requested through this parameter ( i.e. `file_download_key => true` ); it tells s2Member to allow the download of this particular file,
1872
+ * regardless of Membership Level; and WITHOUT checking any Basic Restrictions, that you may, or may not have configured.
1873
+ *
1874
+ * ———— HTML/PHP Code Samples Using A Download Key ————
1875
+ * ```
1876
+ * <a href="<!php echo s2member_file_download_url(array("file_download" => "file.zip", file_download_key => true)); !>">Download Now</a>
1877
+ * <a href="<!php echo s2member_file_download_url(array("file_download" => "file.pdf", file_download_key => true, "file_inline" => true)); !>">View PDF</a>
1878
+ * ```
1879
+ * ———— Shortcode Equivalents Using A Download Key ————
1880
+ * ```
1881
+ * <a href="[s2File download="file.zip" download_key="true" /]">Download Now</a>
1882
+ * <a href="[s2File download="file.zip" download_key="true" inline="true" /]">View PDF</a>
1883
+ * ```
1884
+ *
1885
+ * @package s2Member\API_Functions
1886
+ * @since 110926
1887
+ *
1888
+ * @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
1889
+ * Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `ignore_user`.
1890
+ * @return str A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
1891
+ * Note: by default, this function DOES consider the current User/Member. If `ignore_user` is NOT set, or is set to false, this function MAY very well return false, when/if the current User/Member is NOT allowed access to the `file_download`, based on configuration.
1892
+ *
1893
+ * @see s2Member\API_Functions\s2member_file_download_key()
1894
+ */
1895
+ if (!function_exists ("s2member_file_download_url"))
1896
+ {
1897
+ function s2member_file_download_url ($config = FALSE, $get_streamer_array = FALSE)
1898
+ {
1899
+ return c_ws_plugin__s2member_files::create_file_download_url ($config, $get_streamer_array);
1900
+ }
1901
+ }
1902
+ /**
1903
  * Generates a File Download Key that provides access to a File protected by s2Member.
1904
  *
1905
  * By default, s2Member uses your Basic Download Restrictions. For more information on this,
1909
  *
1910
  * Or, you can also force s2Member to allow File Downloads, using an extra query string parameter `s2member_file_download_key`.
1911
  * A File Download Key is passed through this parameter; it tells s2Member to allow the download of this particular file,
1912
+ * regardless of Membership Level; and WITHOUT checking any Basic Restrictions, that you may, or may not have configured.
1913
  *
1914
  * ———— Code Sample Using A Download Key ————
1915
  * ```
1940
  * It is also possible to pass in the $directive string `ip-forever`, making the Key last forever, but only for a specific IP address.
1941
  * @return str The File Download Key. Which is an MD5 hash *( always 32 characters )*, URL-safe.
1942
  *
1943
+ * @see s2Member\API_Functions\s2member_file_download_url()
1944
+ *
1945
  * @todo Allow custom expiration times.
1946
  */
1947
  if (!function_exists ("s2member_file_download_key"))
1980
  * The Registration Time, is the time at which the Username was created for the account, that's it.
1981
  *
1982
  * @see s2Member\API_Functions\get_user_field()
 
 
1983
  */
1984
  if (!function_exists ("s2member_registration_time"))
1985
  {
2023
  * @return int A {@link http://en.wikipedia.org/wiki/Unix_time Unix Timestamp}.
2024
  *
2025
  * @see s2Member\API_Functions\get_user_field()
 
 
2026
  */
2027
  if (!function_exists ("s2member_paid_registration_time"))
2028
  {
includes/functions/pluggables.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 110707
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
  /**/
20
  if (!function_exists ("wp_new_user_notification"))
21
  {
@@ -37,6 +37,7 @@ if (!function_exists ("wp_new_user_notification"))
37
  /**/
38
  return call_user_func_array ("c_ws_plugin__s2member_email_configs::new_user_notification", $args);
39
  }
 
40
  }
41
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["pluggables"]["wp_new_user_notification"] = true;
42
  }
15
  * @since 110707
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
  /**/
20
  if (!function_exists ("wp_new_user_notification"))
21
  {
37
  /**/
38
  return call_user_func_array ("c_ws_plugin__s2member_email_configs::new_user_notification", $args);
39
  }
40
+ add_filter ("wpmu_welcome_user_notification", "wp_new_user_notification", 10, 2); /* Combine. */
41
  }
42
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["pluggables"]["wp_new_user_notification"] = true;
43
  }
includes/hooks.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.0
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
  /*
20
  Add the plugin Actions/Filters here.
21
  */
@@ -79,6 +79,7 @@ add_filter ("pre_site_option_add_new_users", "c_ws_plugin__s2member_option_force
79
  add_filter ("pre_site_option_dashboard_blog", "c_ws_plugin__s2member_option_forces::mms_dashboard_blog");
80
  add_filter ("pre_option_users_can_register", "c_ws_plugin__s2member_option_forces::check_register_access");
81
  add_filter ("pre_site_option_registration", "c_ws_plugin__s2member_option_forces::check_mms_register_access");
 
82
  add_filter ("bp_core_get_site_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
83
  /**/
84
  add_filter ("random_password", "c_ws_plugin__s2member_registrations::generate_password");
15
  * @since 3.0
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit("Do not access this file directly.");
19
  /*
20
  Add the plugin Actions/Filters here.
21
  */
79
  add_filter ("pre_site_option_dashboard_blog", "c_ws_plugin__s2member_option_forces::mms_dashboard_blog");
80
  add_filter ("pre_option_users_can_register", "c_ws_plugin__s2member_option_forces::check_register_access");
81
  add_filter ("pre_site_option_registration", "c_ws_plugin__s2member_option_forces::check_mms_register_access");
82
+ add_filter ("bp_core_get_root_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
83
  add_filter ("bp_core_get_site_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
84
  /**/
85
  add_filter ("random_password", "c_ws_plugin__s2member_registrations::generate_password");
includes/menu-pages/code-samples/jwplayer-standard-mp4.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="jw-container">JW Player® appears here.</div>
2
+ <script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
3
+ <script type="text/javascript">
4
+ jwplayer("jw-container").setup({modes: /* JW Player®. */
5
+ [
6
+ /* First try psuedo-streaming with Flash® player. */
7
+ {type: "flash", provider: "http", src: "/jwplayer/player.swf",
8
+ config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4"}},
9
+ /* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="video.mp4" /] */
10
+
11
+ /* Else, try an HTML5 video tag. */
12
+ {type: "html5", provider: "video",
13
+ config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4"}},
14
+ /* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="video.mp4" /] */
15
+
16
+ /* Else, this is a safe fallback. */
17
+ {type: "download", /* Download the file. */
18
+ config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4"}}
19
+ /* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="video.mp4" /] */
20
+ ],
21
+ /* Set video dimensions. */ width: 480, height: 270
22
+ });
23
+ </script>
includes/menu-pages/code-samples/jwplayer-streaming-mp4-sca.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="jw-container">JW Player® appears here.</div>
2
+ <script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
3
+
4
+ <script type="text/javascript">
5
+ /* The Shortcode here will return a JSON object for JavaScript notation. */
6
+ /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
7
+ /* API Shortcode `s2File` returns a null object if access is denied to the current User/Member. */
8
+ var mp4 = [s2File download="video.mp4" url_to_storage_source="true" count_against_user="true" get_streamer_json="true" /];
9
+ </script>
10
+
11
+ <script type="text/javascript">
12
+ if(typeof mp4 === 'object') /* `s2File` returns a null object if access is denied to the current User. */
13
+ {
14
+ jwplayer("jw-container").setup({modes: /* JW Player®. */
15
+ [
16
+ /* First try real-time streaming with Flash® player. */
17
+ {type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
18
+ config: {streamer: mp4['streamer'], file: mp4['file']}},
19
+
20
+ /* Else, try an HTML5 video tag. */
21
+ {type: "html5", provider: "video",
22
+ config: {file: mp4['url']}},
23
+
24
+ /* Else, this is a safe fallback. */
25
+ {type: "download", /* Download the file. */
26
+ config: {file: mp4['url']}}
27
+ ],
28
+ /* Set video dimensions. */ width: 480, height: 270
29
+ });
30
+ }
31
+ else /* Else, `s2File` returned a null object value. */
32
+ {
33
+ document.write('Sorry, you do NOT have access to this file.');
34
+ }
35
+ </script>
includes/menu-pages/code-samples/jwplayer-streaming-mp4-webm.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="jw-container">JW Player® appears here.</div>
2
+ <script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
3
+
4
+ <?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
5
+ $mp4_cfg = array ("file_download" => "video.mp4", "url_to_storage_source" => true, "count_against_user" => true);
6
+ $webm_cfg = array ("file_download" => "video.webm", "url_to_storage_source" => true /* Don't count variations. */); ?>
7
+
8
+ <?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
9
+ if (($mp4 = s2member_file_download_url ($mp4_cfg, "get-streamer-array"))
10
+ && ($webm["url"] = s2member_file_download_url ($webm_cfg))) { ?>
11
+
12
+ <script type="text/javascript">
13
+ jwplayer("jw-container").setup({modes: /* JW Player®. */
14
+ [
15
+ /* First try real-time streaming with Flash® player. */
16
+ {type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
17
+ config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
18
+
19
+ /* Else, try an HTML5 video tag with the `mp4` file. */
20
+ {type: "html5", provider: "video",
21
+ config: {file: "<?php echo $mp4["url"]; ?>"}},
22
+
23
+ /* Else, try an HTML5 video tag with a `webm` file. */
24
+ {type: "html5", provider: "video",
25
+ config: {file: "<?php echo $webm["url"]; ?>"}},
26
+
27
+ /* Else, this is a safe fallback. */
28
+ {type: "download", /* Download the file. */
29
+ config: {file: "<?php echo $mp4["url"]; ?>"}}
30
+ ],
31
+ /* Set video dimensions. */ width: 480, height: 270
32
+ });
33
+ </script>
34
+
35
+ <?php } else /* Access is denied to the current User. */ { ?>
36
+ Sorry, you do NOT have access to this file.
37
+ <?php } ?>
includes/menu-pages/code-samples/jwplayer-streaming-mp4.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="jw-container">JW Player® appears here.</div>
2
+ <script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
3
+
4
+ <?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
5
+ $cfg = array ("file_download" => "video.mp4", "url_to_storage_source" => true, "count_against_user" => true); ?>
6
+
7
+ <?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
8
+ if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>
9
+
10
+ <script type="text/javascript">
11
+ jwplayer("jw-container").setup({modes: /* JW Player®. */
12
+ [
13
+ /* First try real-time streaming with Flash® player. */
14
+ {type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
15
+ config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
16
+
17
+ /* Else, try an HTML5 video tag. */
18
+ {type: "html5", provider: "video",
19
+ config: {file: "<?php echo $mp4["url"]; ?>"}},
20
+
21
+ /* Else, this is a safe fallback. */
22
+ {type: "download", /* Download the file. */
23
+ config: {file: "<?php echo $mp4["url"]; ?>"}}
24
+ ],
25
+ /* Set video dimensions. */ width: 480, height: 270
26
+ });
27
+ </script>
28
+
29
+ <?php } else /* Access is denied to the current User. */ { ?>
30
+ Sorry, you do NOT have access to this file.
31
+ <?php } ?>
includes/menu-pages/down-ops.inc.php CHANGED
@@ -41,6 +41,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
41
  /**/
42
  echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form">' . "\n";
43
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
 
44
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
45
  /**/
46
  do_action ("ws_plugin__s2member_during_down_ops_page_before_left_sections", get_defined_vars ());
@@ -60,6 +61,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
60
  /**/
61
  echo '<p><strong>Upload restricted files to this security-enabled directory:</strong><br /><code>' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '</code></p>' . "\n";
62
  echo '<p>- Now, you can link to any protected file, using this special format:<br />&nbsp;&nbsp;<code>' . esc_html (site_url ("/?s2member_file_download=example-file.zip")) . '</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download</strong> = file, relative to the /' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory. In other words, just the file name.</em></small></p>' . "\n";
 
63
  /**/
64
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
65
  /**/
@@ -168,6 +170,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
168
  /**/
169
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
170
  /**/
 
 
 
 
171
  echo '<p>The function <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12453#src_doc_s2member_file_download_key%28%29" target="_blank" rel="external">s2member_file_download_key()</a>, is part of the s2Member API. It produces a time-sensitive File Download Key that is unique to each and every visitor. Each Key it produces <em>( at the time it is produced )</em>, will be valid for the current day, and only for a specific IP address and User-Agent string; as detected by s2Member. This makes it possible for you to create links on your site, which provide access to protected file downloads; and without having to worry about one visitor sharing their link with another. So let\'s take a quick look at what <code>s2member_file_download_key()</code> actually produces.</p>' . "\n";
172
  echo '<p><code>s2member_file_download_key("example-file.zip")</code> = a site-specific hash of: <code>date("Y-m-d").$_SERVER["REMOTE_ADDR"].$_SERVER["HTTP_USER_AGENT"].$file</code></p>' . "\n";
173
  echo '<p>When <code>s2member_file_download_key = <em>a valid Key</em></code>, it works independently from Member Level Access. That is, a visitor does NOT have to be logged in to receive access; they just need a valid Key. Using this advanced technique, you could extend s2Member\'s file protection routines, or even combine them with Specific Post/Page Access, and more. The possibilities are limitless really.</p>' . "\n";
@@ -188,7 +194,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
188
  echo '<div class="ws-menu-page-section ws-plugin--s2member-inline-extensions-section">' . "\n";
189
  echo '<h3>Inline File Extensions ( optional, for content-disposition )</h3>' . "\n";
190
  echo '<p>There are two ways to serve files. Inline, or as an Attachment. By default, s2Member will serve all of your protected files, as downloadable attachments. Meaning, visitors will be given a file download prompt. Otherwise known as <code>Content-Disposition: attachment</code>. In some cases though, you may wish to serve files inline. For example, PDF files and images should usually be served inline. When you serve a file inline, it is displayed in your browser immediately, rather than your browser prompting you to download the file as an attachment.</p>' . "\n";
191
- echo '<p>Using the field below, you can list all of the extensions that you want s2Member to serve inline ( ex: <code>htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv</code> ). Please understand, some files just cannot be displayed inline. For instance, there is no way to display an <code>exe</code> file inline. So only specify extensions that can, and should be displayed inline by a web browser. Alternatively, if you would rather handle this on a case-by-case basis, you can simply add the following to the end of your download links: <code>&amp;s2member_file_inline=yes</code>.</p>' . "\n";
192
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_inline_extensions", get_defined_vars ());
193
  /**/
194
  echo '<table class="form-table">' . "\n";
@@ -206,7 +212,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
206
  /**/
207
  echo '<td>' . "\n";
208
  echo '<input type="text" name="ws_plugin__s2member_file_download_inline_extensions" id="ws-plugin--s2member-file-download-inline-extensions" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]) . '" /><br />' . "\n";
209
- echo 'Inline extensions in comma-delimited format. Example: <code>htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv</code>' . "\n";
210
  echo '</td>' . "\n";
211
  /**/
212
  echo '</tr>' . "\n";
@@ -227,7 +233,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
227
  /**/
228
  echo '<div class="ws-menu-page-section ws-plugin--s2member-remote-authorization-section">' . "\n";
229
  echo '<h3>Remote Header Authorization ( optional )</h3>' . "\n";
230
- echo '<p>This can be enabled on a case-by-case basis. Just add this to the end of your download links: <code>&amp;s2member_file_remote=yes</code>.</p>' . "\n";
231
  echo '<p>Remote Header Authorization allows access to file downloads through an entirely different approach. Instead of asking the Member to log into your site through a browser, a Member will be prompted automatically, to log in through HTTP Header Authorization prompts; which is the same technique used in more traditional security systems via .htaccess files. In other words, Remote Header Authorization makes it possible for your Members to access files through remote applications that may NOT use a browser. This is often the case when a Member needs to access protected files through a software client like iTunes®; typical with podcasts. See <a href="http://www.primothemes.com/forums/viewtopic.php?f=4&t=837&p=28558#p28558" target="_blank" rel="external">tutorial here</a> for details about how to setup a Podcast for iTunes®.</p>' . "\n";
232
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_remote_authorization", get_defined_vars ());
233
  echo '</div>' . "\n";
@@ -241,19 +247,22 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
241
  {
242
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_amazon_s3", get_defined_vars ());
243
  /**/
244
- echo '<div class="ws-menu-page-group" title="Amazon® S3/CDN Storage Option">' . "\n";
245
  /**/
246
- echo '<div class="ws-menu-page-section ws-plugin--s2member-inline-extensions-section">' . "\n";
247
  echo '<h3>Amazon® S3/CDN Storage &amp; Delivery ( optional )</h3>' . "\n";
248
  echo '<a href="http://aws.amazon.com/s3/" target="_blank"><img src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/amazon-logo.png" class="ws-menu-page-right" style="width:250px; height:100px; border:0;" alt="." /></a>' . "\n";
 
249
  echo '<p>Amazon® Simple Storage Service ( <a href="http://aws.amazon.com/s3/" target="_blank" rel="external">Amazon® S3</a> ). Amazon® S3 is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon® S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives developers access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon® uses to run its own global network of web sites. s2Member has been integrated with Amazon® S3, so that <em>( if you wish )</em>, instead of using the <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, you can store all of your protected files inside an Amazon® S3 Bucket.</p>' . "\n";
250
- echo '<p>If you configure the options below, s2Member will assume all protected files are inside your Amazon® S3 Bucket; and the <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected Files. In other words, Basic Download Restrictions, Download Keys, Inline Extensions, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon® S3 Bucket as a CDN <em>( i.e. Content Delivery Network )</em> instead of the local <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory.</p>' . "\n";
251
- echo '<p>s2Member assumes that you\'re creating a new Amazon® S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser ( i.e. <code>http://s3.amazonaws.com/your-bucket-name/</code> ), you should get an error that says: <code>Access Denied</code>. That\'s good, that\'s exactly what you want. You can create your Amazon® S3 Bucket using the <a href="https://console.aws.amazon.com/s3/home" target="_blank" rel="external">Amazon® interface</a>. Or, some people prefer to use this popular Firefox® extension ( <a href="http://www.s3fox.net/" target="_blank" rel="external">S3 Fox Organizer</a> ).</p>' . "\n";
252
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_amazon_s3", get_defined_vars ());
253
  /**/
254
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
255
  /**/
256
- echo '<p><em><strong>*Dev Note*</strong> s2Member uses "Query String Authentication", provided by the Amazon® S3 API. Documented for developers <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html" target="_blank" rel="external">here</a>. To put it simply, s2Member will generate S3 authenticated redirect URLs ( internally ); which allow Customers temporary access to specific files inside your S3 Bucket. s2Member\'s Query String Authentication through Amazon® S3 gives a Customer 30 seconds to connect to the file inside your S3 Bucket ( i.e. the automatic redirection URL ). This connection period of 30 seconds is largely irrelevant when used in combination with s2Member. It just needs to be a low value, to further prevent any possibility of S3 authenticated link sharing. If you need to change this connection timeout of <code>30 seconds</code> for some reason ( not likely ), you can use this WordPress® Filter: <code>ws_plugin__s2member_amazon_s3_file_expires_time</code>. If you need help, please check the s2Member Forums.</em></p>' . "\n";
 
 
257
  /**/
258
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
259
  /**/
@@ -263,7 +272,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
263
  /**/
264
  echo '<th style="padding-top:0;">' . "\n";
265
  echo '<label for="ws-plugin--s2member-amazon-s3-files-bucket">' . "\n";
266
- echo 'Amazon® S3 File Bucket: ( where protected files are )' . "\n";
267
  echo '</label>' . "\n";
268
  echo '</th>' . "\n";
269
  /**/
@@ -280,7 +289,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
280
  /**/
281
  echo '<th>' . "\n";
282
  echo '<label for="ws-plugin--s2member-amazon-s3-files-access-key">' . "\n";
283
- echo 'Amazon® Access Key: ( Access Key ID )' . "\n";
284
  echo '</label>' . "\n";
285
  echo '</th>' . "\n";
286
  /**/
@@ -289,7 +298,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
289
  /**/
290
  echo '<td>' . "\n";
291
  echo '<input type="text" name="ws_plugin__s2member_amazon_s3_files_access_key" id="ws-plugin--s2member-amazon-s3-files-access-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"]) . '" /><br />' . "\n";
292
- echo 'See: <code>Amazon® Web Services -> Account -> Security Credentials</code>.' . "\n";
293
  echo '</td>' . "\n";
294
  /**/
295
  echo '</tr>' . "\n";
@@ -297,7 +306,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
297
  /**/
298
  echo '<th>' . "\n";
299
  echo '<label for="ws-plugin--s2member-amazon-s3-files-secret-key">' . "\n";
300
- echo 'Amazon® Secret Key: ( Secret Access Key )' . "\n";
301
  echo '</label>' . "\n";
302
  echo '</th>' . "\n";
303
  /**/
@@ -306,7 +315,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
306
  /**/
307
  echo '<td>' . "\n";
308
  echo '<input type="password" name="ws_plugin__s2member_amazon_s3_files_secret_key" id="ws-plugin--s2member-amazon-s3-files-secret-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"]) . '" /><br />' . "\n";
309
- echo 'See: <code>Amazon® Web Services -> Account -> Security Credentials</code>.' . "\n";
310
  echo '</td>' . "\n";
311
  /**/
312
  echo '</tr>' . "\n";
@@ -316,7 +325,187 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
316
  /**/
317
  echo '</div>' . "\n";
318
  /**/
319
- do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_inline_extensions", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  }
321
  /**/
322
  if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_rewrite_linkage", true, get_defined_vars ()))
@@ -332,8 +521,9 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
332
  echo '<p>It is also possible to pass query string parameters through a direct link:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/example-file.zip?s2member_file_inline=yes&amp;s2member_file_download_key=[key]</code>.</p>' . "\n";
333
  echo '<p>That being said, s2Member\'s <code>mod_rewrite</code> rules allow for more advanced control over s2Member-specific parameters.</p>' . "\n";
334
  echo '<p>For example, you could just do this for inline files:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline</strong>/example-file.zip</code></p>' . "\n";
335
- echo '<p>Or, if you really want to get advanced, you could do something like this:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-[yes|no]/s2member-file-download-key-[key]</strong>/example-file.zip</code></p>' . "\n";
336
  echo '<p>Or even this, if you\'re using Remote Header Authorization:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-remote</strong>/example-file.zip</code></p>' . "\n";
 
337
  echo '<p><em>* Note, the order of your s2Member-specific parameters with Advanced Mod-Rewrite Linkage is irrelevant. Feel free to add/remove, or even change the order. Everything discussed here is also Multisite compatible. Everything discussed here is also compatible when/if combined with Amazon® S3/CDN Storage. However, NONE of this will work on servers that do NOT support <code>mod_rewrite</code>. Almost all web servers do though.</em></p>' . "\n";
338
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_rewrite_linkage", get_defined_vars ());
339
  echo '</div>' . "\n";
41
  /**/
42
  echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form">' . "\n";
43
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
44
+ echo '<input type="hidden" name="ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" id="ws-plugin--s2member-amazon-cf-files-distros-auto-config-status" value="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"]) . '" />' . "\n";
45
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
46
  /**/
47
  do_action ("ws_plugin__s2member_during_down_ops_page_before_left_sections", get_defined_vars ());
61
  /**/
62
  echo '<p><strong>Upload restricted files to this security-enabled directory:</strong><br /><code>' . esc_html (c_ws_plugin__s2member_utils_dirs::doc_root_path ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '</code></p>' . "\n";
63
  echo '<p>- Now, you can link to any protected file, using this special format:<br />&nbsp;&nbsp;<code>' . esc_html (site_url ("/?s2member_file_download=example-file.zip")) . '</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download</strong> = file, relative to the /' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory. In other words, just the file name.</em></small></p>' . "\n";
64
+ echo '<p>- Or, use: <code>[s2File download="example-file.zip" /]</code> <em>( easier Shortcode if you prefer )</em><br />&nbsp;&nbsp;<small><em><strong>Shortcode equivalent:</strong> <code>[s2File /]</code> produces the entire URL for you, easier.</em></small></p>' . "\n";
65
  /**/
66
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
67
  /**/
170
  /**/
171
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
172
  /**/
173
+ echo '<p><code>[s2File download="example-file.zip" download_key="true" /]</code> <em>( Key is auto-generated in this case )</em><br />&nbsp;&nbsp;<small><em><strong>Shortcode equivalent:</strong> <code>[s2File /]</code> produces the entire URL, no need to generate a Key yourself.</em></small></p>' . "\n";
174
+ /**/
175
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
176
+ /**/
177
  echo '<p>The function <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12453#src_doc_s2member_file_download_key%28%29" target="_blank" rel="external">s2member_file_download_key()</a>, is part of the s2Member API. It produces a time-sensitive File Download Key that is unique to each and every visitor. Each Key it produces <em>( at the time it is produced )</em>, will be valid for the current day, and only for a specific IP address and User-Agent string; as detected by s2Member. This makes it possible for you to create links on your site, which provide access to protected file downloads; and without having to worry about one visitor sharing their link with another. So let\'s take a quick look at what <code>s2member_file_download_key()</code> actually produces.</p>' . "\n";
178
  echo '<p><code>s2member_file_download_key("example-file.zip")</code> = a site-specific hash of: <code>date("Y-m-d").$_SERVER["REMOTE_ADDR"].$_SERVER["HTTP_USER_AGENT"].$file</code></p>' . "\n";
179
  echo '<p>When <code>s2member_file_download_key = <em>a valid Key</em></code>, it works independently from Member Level Access. That is, a visitor does NOT have to be logged in to receive access; they just need a valid Key. Using this advanced technique, you could extend s2Member\'s file protection routines, or even combine them with Specific Post/Page Access, and more. The possibilities are limitless really.</p>' . "\n";
194
  echo '<div class="ws-menu-page-section ws-plugin--s2member-inline-extensions-section">' . "\n";
195
  echo '<h3>Inline File Extensions ( optional, for content-disposition )</h3>' . "\n";
196
  echo '<p>There are two ways to serve files. Inline, or as an Attachment. By default, s2Member will serve all of your protected files, as downloadable attachments. Meaning, visitors will be given a file download prompt. Otherwise known as <code>Content-Disposition: attachment</code>. In some cases though, you may wish to serve files inline. For example, PDF files and images should usually be served inline. When you serve a file inline, it is displayed in your browser immediately, rather than your browser prompting you to download the file as an attachment.</p>' . "\n";
197
+ echo '<p>Using the field below, you can list all of the extensions that you want s2Member to serve inline ( ex: <code>htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv,ogg,webm</code> ). Please understand, some files just cannot be displayed inline. For instance, there is no way to display an <code>exe</code> file inline. So only specify extensions that can, and should be displayed inline by a web browser. Alternatively, if you would rather handle this on a case-by-case basis, you can simply add the following to the end of your download links: <code>&amp;s2member_file_inline=yes</code>. Shortcode alternative: <code>[s2File download="example-file.zip" inline="yes" /]</code>.</p>' . "\n";
198
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_inline_extensions", get_defined_vars ());
199
  /**/
200
  echo '<table class="form-table">' . "\n";
212
  /**/
213
  echo '<td>' . "\n";
214
  echo '<input type="text" name="ws_plugin__s2member_file_download_inline_extensions" id="ws-plugin--s2member-file-download-inline-extensions" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]) . '" /><br />' . "\n";
215
+ echo 'Inline extensions, comma-delimited. Ex: <code>htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv,ogg,webm</code>' . "\n";
216
  echo '</td>' . "\n";
217
  /**/
218
  echo '</tr>' . "\n";
233
  /**/
234
  echo '<div class="ws-menu-page-section ws-plugin--s2member-remote-authorization-section">' . "\n";
235
  echo '<h3>Remote Header Authorization ( optional )</h3>' . "\n";
236
+ echo '<p>This can be enabled on a case-by-case basis. Just add this to the end of your download links: <code>&amp;s2member_file_remote=yes</code>. Shortcode alternative: <code>[s2File download="example-file.zip" remote="yes" /]</code>.</p>' . "\n";
237
  echo '<p>Remote Header Authorization allows access to file downloads through an entirely different approach. Instead of asking the Member to log into your site through a browser, a Member will be prompted automatically, to log in through HTTP Header Authorization prompts; which is the same technique used in more traditional security systems via .htaccess files. In other words, Remote Header Authorization makes it possible for your Members to access files through remote applications that may NOT use a browser. This is often the case when a Member needs to access protected files through a software client like iTunes®; typical with podcasts. See <a href="http://www.primothemes.com/forums/viewtopic.php?f=4&t=837&p=28558#p28558" target="_blank" rel="external">tutorial here</a> for details about how to setup a Podcast for iTunes®.</p>' . "\n";
238
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_remote_authorization", get_defined_vars ());
239
  echo '</div>' . "\n";
247
  {
248
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_amazon_s3", get_defined_vars ());
249
  /**/
250
+ echo '<div class="ws-menu-page-group" title="Amazon® S3/CDN Storage Option"' . (($GLOBALS["ws_plugin__s2member_cf_auto_configure_distros_error"]) ? ' default-state="open"' : '') . '>' . "\n";
251
  /**/
252
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-amazon-s3-section">' . "\n";
253
  echo '<h3>Amazon® S3/CDN Storage &amp; Delivery ( optional )</h3>' . "\n";
254
  echo '<a href="http://aws.amazon.com/s3/" target="_blank"><img src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/amazon-logo.png" class="ws-menu-page-right" style="width:250px; height:100px; border:0;" alt="." /></a>' . "\n";
255
+ echo '<p>Please note, all of this is optional. s2Member can be configured here to ONLY use Amazon® S3 <em>( i.e. without Amazon® CloudFront )</em>. Or, s2Member can be configured to use BOTH Amazon® S3 and Amazon® CloudFront together. If you want to use Amazon® S3 Storage, but you don\'t care about Amazon® CloudFront, feel free to leave the entire Amazon® CloudFront section empty. The configuration options in the Amazon® CloudFront section are ONLY required if you are planning to use both Amazon® S3 and Amazon® CloudFront together.</p>' . "\n";
256
  echo '<p>Amazon® Simple Storage Service ( <a href="http://aws.amazon.com/s3/" target="_blank" rel="external">Amazon® S3</a> ). Amazon® S3 is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon® S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives developers access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon® uses to run its own global network of web sites. s2Member has been integrated with Amazon® S3, so that <em>( if you wish )</em>, instead of using the <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, you can store all of your protected files inside an Amazon® S3 Bucket.</p>' . "\n";
257
+ echo '<p>If you configure the options below, s2Member will assume all protected files are inside your Amazon® S3 Bucket; and the <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Inline Extensions, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon® S3 Bucket as a CDN <em>( i.e. Content Delivery Network )</em> instead of the local <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory.</p>' . "\n";
258
+ echo '<p>s2Member assumes that you\'re creating a new Amazon® S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser <em>( i.e. <code>http://your-bucket-name.s3.amazonaws.com/</code> )</em>, you should get an error that says: <code>Access Denied</code>. That\'s good, that\'s exactly what you want. You can create your Amazon® S3 Bucket using the <a href="https://console.aws.amazon.com/s3/home" target="_blank" rel="external">Amazon® interface</a>. Or, some people prefer to use this popular Firefox® extension ( <a href="http://www.s3fox.net/" target="_blank" rel="external">S3 Fox Organizer</a> ).</p>' . "\n";
259
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_amazon_s3", get_defined_vars ());
260
  /**/
261
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
262
  /**/
263
+ echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member uses "Query String Authentication", provided by the Amazon® S3 API. Documented for developers <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html" target="_blank" rel="external">here</a>. To put it simply, s2Member will generate S3 authenticated redirect URLs ( internally ); which allow Customers temporary access to specific files inside your S3 Bucket. s2Member\'s Query String Authentication through Amazon® S3 gives a Customer 30 seconds to connect to the file inside your S3 Bucket ( i.e. the automatic redirection URL ). This connection period of 30 seconds is largely irrelevant when used in combination with s2Member. It just needs to be a low value, to further prevent any possibility of S3 authenticated link sharing. If you need to change this connection timeout of <code>30 seconds</code> for some reason ( not likely ), you can use this WordPress® Filter: <code>ws_plugin__s2member_amazon_s3_file_expires_time</code>. If you need help, please check the s2Member Forums.</em></p>' . "\n";
264
+ echo '<p><em><strong>Linking To Protected Files:</strong> Nothing changes. s2Member\'s integration with Amazon® S3 serves protected files through the same links that all s2Member site owners use. For example, you might use: <code>' . esc_html (site_url ("/?s2member_file_download=example-file.zip")) . '</code>, where <strong>s2member_file_download</strong> = the file, relative to the root of your Amazon® S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon® S3 URL, which allows them access to a particular file via Amazon® S3. For further details, please review this section of your Dashboard: <code>s2Member -> Download Options -> Basic Download Restrictions</code>. Also see: <code>s2Member -> Download Options -> Advanced Mod-Rewrite Linkage</code>.</em></p>' . "\n";
265
+ echo '<p><em><strong>Content Type, Disposition &amp; Inline Files:</strong> The query string parameter <code>&amp;s2member_file_inline=yes</code> DOES work for files served directly through Amazon® S3. s2Member DOES have control over the <code>Content-Type</code> and <code>Content-Disposition</code> headers for files being served through Amazon® S3. However, Amazon® CloudFront servers do NOT automatically determine the MIME type for the objects they serve. If you integrate both Amazon® S3 and CloudFront, s2Member will NOT have control over headers. Therefore, when you upload a file to your Amazon® S3 Bucket, you should set its Content-Type header. Again, with the Amazon® S3/CloudFront combination, you MUST configure headers yourself ( such as <code>Content-Type: video/webm</code>, or <code>Content-Disposition: inline|attachment</code> ) that you want Amazon® CloudFront to send for a particular file. It\'s quite easy. You do this by setting <code>Properties -> Metadata ( i.e. headers )</code> on a per-file basis, from inside your Amazon® S3 Management Console. In short, when you upload a file to your Amazon® S3 Bucket, if you want that file to be served a certain way, be sure to configure its <code>Properties -> Metadata</code> accordingly.</em></p>' . "\n";
266
  /**/
267
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
268
  /**/
272
  /**/
273
  echo '<th style="padding-top:0;">' . "\n";
274
  echo '<label for="ws-plugin--s2member-amazon-s3-files-bucket">' . "\n";
275
+ echo 'Amazon® S3 File Bucket ( where protected files are ):' . "\n";
276
  echo '</label>' . "\n";
277
  echo '</th>' . "\n";
278
  /**/
289
  /**/
290
  echo '<th>' . "\n";
291
  echo '<label for="ws-plugin--s2member-amazon-s3-files-access-key">' . "\n";
292
+ echo 'Amazon® Access Key ( Access Key ID ):' . "\n";
293
  echo '</label>' . "\n";
294
  echo '</th>' . "\n";
295
  /**/
298
  /**/
299
  echo '<td>' . "\n";
300
  echo '<input type="text" name="ws_plugin__s2member_amazon_s3_files_access_key" id="ws-plugin--s2member-amazon-s3-files-access-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"]) . '" /><br />' . "\n";
301
+ echo 'See: <code>Amazon® Web Services Account -> Security Credentials -> Access Credentials</code>.' . "\n";
302
  echo '</td>' . "\n";
303
  /**/
304
  echo '</tr>' . "\n";
306
  /**/
307
  echo '<th>' . "\n";
308
  echo '<label for="ws-plugin--s2member-amazon-s3-files-secret-key">' . "\n";
309
+ echo 'Amazon® Secret Key ( Secret Access Key ):' . "\n";
310
  echo '</label>' . "\n";
311
  echo '</th>' . "\n";
312
  /**/
315
  /**/
316
  echo '<td>' . "\n";
317
  echo '<input type="password" name="ws_plugin__s2member_amazon_s3_files_secret_key" id="ws-plugin--s2member-amazon-s3-files-secret-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"]) . '" /><br />' . "\n";
318
+ echo 'See: <code>Amazon® Web Services Account -> Security Credentials -> Access Credentials</code>.' . "\n";
319
  echo '</td>' . "\n";
320
  /**/
321
  echo '</tr>' . "\n";
325
  /**/
326
  echo '</div>' . "\n";
327
  /**/
328
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_amazon_s3", get_defined_vars ());
329
+ }
330
+ /**/
331
+ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_amazon_cf", true, get_defined_vars ()))
332
+ {
333
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_amazon_cf", get_defined_vars ());
334
+ /**/
335
+ echo '<div class="ws-menu-page-group" title="Amazon® S3/CloudFront CDN Storage Option"' . (($GLOBALS["ws_plugin__s2member_cf_auto_configure_distros_error"]) ? ' default-state="open"' : '') . '>' . "\n";
336
+ /**/
337
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-amazon-cf-section">' . "\n";
338
+ echo '<h3>Amazon® S3/CloudFront CDN Storage &amp; Delivery ( optional )</h3>' . "\n";
339
+ echo '<a href="http://aws.amazon.com/cloudfront/" target="_blank"><img src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/amazon-logo.png" class="ws-menu-page-right" style="width:250px; height:100px; border:0;" alt="." /></a>' . "\n";
340
+ echo '<p>Please note, all of this is optional. s2Member can be configured to ONLY use Amazon® S3 <em>( i.e. without Amazon® CloudFront )</em>. Or, s2Member can be configured to use BOTH Amazon® S3 and Amazon® CloudFront together. If you don\'t want to use Amazon® CloudFront, please leave this entire section empty. The configuration options in this section are ONLY required if you are planning to use both Amazon® S3 and Amazon® CloudFront together.</p>' . "\n";
341
+ echo '<p>Amazon® Simple Storage Service ( <a href="http://aws.amazon.com/s3/" target="_blank" rel="external">Amazon® S3</a> ) combined with <a href="http://aws.amazon.com/cloudfront/" target="_blank" rel="external">Amazon® CloudFront</a>. Amazon® CloudFront is a web service for content delivery. It integrates with other Amazon® Web Services <em>( i.e. Amazon® S3 Storage )</em> to give developers and businesses an easy way to distribute content to end users with low latency, and with high data transfer speeds. Amazon® CloudFront delivers your static and streaming content using a global network of edge locations. Requests for your Amazon® S3 Bucket Objects <em>( i.e. your protected files )</em> are automatically routed to the nearest edge location, so content is delivered with the best possible performance. s2Member has been integrated with both Amazon® S3 and with Amazon® CloudFront. So <em>( if you wish )</em>, instead of using the <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, you can store all of your protected files inside an Amazon® S3 Bucket and serve them via Amazon® CloudFront. But again, please understand, the configuration options in this section are ONLY required if you\'re going to use both Amazon® S3 &amp; CloudFront together.</p>' . "\n";
342
+ echo '<p><strong>One of the great things about Amazon® CloudFront</strong>, is its ability to <strong>stream/seek media files</strong> in the truest sense of the word. For sites delivering protected <em>FLV/MP4/OGG/WEBM</em> and other streaming audio/video file types over the <em>RTMP</em> protocol, Amazon® CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon® S3 and Amazon® CloudFront together, please review the section below regarding <code>JW Player® &amp; RTMP Protocol Examples</code>. s2Member will automatically serve your protected files over the <em>RTMP</em> protocol using an Amazon® CloudFront Streaming Distribution.</p>' . "\n";
343
+ echo '<p>If you configure the options below, s2Member will assume all protected files are inside your Amazon® S3 Bucket; and the <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon® S3 Bucket, automatically connecting it to both of the Amazon® CloudFront Distributions, which s2Member auto-configures for you <em>( see below )</em>. In this way, s2Member uses Amazon® CloudFront as a CDN <em>( i.e. Content Delivery Network )</em> for your protected files.</p>' . "\n";
344
+ echo '<p>s2Member assumes that you\'re creating a new Amazon® S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser <em>( i.e. <code>http://your-bucket-name.s3.amazonaws.com/</code> )</em>, you should get an error that says: <code>Access Denied</code>. That\'s good, that\'s exactly what you want. You can create your Amazon® S3 Bucket using the <a href="https://console.aws.amazon.com/s3/home" target="_blank" rel="external">Amazon® interface</a>. Or, some people prefer to use this popular Firefox® extension ( <a href="http://www.s3fox.net/" target="_blank" rel="external">S3 Fox Organizer</a> ). You will also need to enable CloudFront inside your Web Services account at Amazon®. Don\'t worry about creating or configuring any CloudFront Distributions, s2Member will auto-create and auto-configure those for you, allowing you to serve protected files.</p>' . "\n";
345
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_amazon_cf", get_defined_vars ());
346
+ /**/
347
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
348
+ /**/
349
+ echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member\'s auto-configuration routines for Amazon® CloudFront (below), are designed to create &amp; configure various components on your Amazon® Web Services account, which are all requirements for you to <a href="http://docs.amazonwebservices.com/AmazonCloudFront/2010-11-01/DeveloperGuide/index.html?HowToPrivateContent.html" target="_blank" rel="external">serve protected files through the Amazon® S3/CloudFront combination</a>. These components include: an Origin Access Identity, read permissions for the Origin Access Identity, and two private content Distributions. One private content Distribution for file downloads, and another private content Distribution for streaming media files; both connected to and sourced by your Amazon® S3 Bucket. In addition, s2Member will automatically configure an ACL &amp; Policy ( i.e. permissions ) on your Amazon® S3 Bucket to make sure your protected object/files are NOT available to the public.</em></p>' . "\n";
350
+ echo '<p><em><strong>Linking To Protected Files:</strong> Streamed files are special, but nothing else changes. s2Member\'s integration with Amazon® S3/CloudFront serves protected files through the same links that all s2Member site owners use. For example, you might use: <code>' . esc_html (site_url ("/?s2member_file_download=example-file.zip")) . '</code>, where <strong>s2member_file_download</strong> = the file, relative to the root of your Amazon® S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon® CloudFront URL, which allows them access to a particular file via Amazon® CloudFront. For further details, please review this section of your Dashboard: <code>s2Member -> Download Options -> Basic Download Restrictions</code>. Also see: <code>s2Member -> Download Options -> Advanced Mod-Rewrite Linkage</code>. For streaming audio/video files, please review the section below: <code>JW Player® &amp; RTMP Protocol Examples</code>.</em></p>' . "\n";
351
+ echo '<p><em><strong>Content Type, Disposition &amp; Inline Files:</strong> An IMPORTANT issue. The query string parameter <code>&amp;s2member_file_inline=yes</code> does NOTHING for files served via Amazon® CloudFront. s2Member has NO control over the <code>Content-Type</code> and/or <code>Content-Disposition</code> headers for a file being served through Amazon® CloudFront, and CloudFront servers do NOT automatically determine the MIME type for the objects they serve. Therefore, when you upload a file to your Amazon® S3 Bucket, you should set its Content-Type header. That is, you MUST configure headers yourself ( such as <code>Content-Type: video/webm</code>, or <code>Content-Disposition: inline|attachment</code> ) that you want Amazon® CloudFront to send for a particular file. It\'s quite easy. You do this by setting <code>Properties -> Metadata ( i.e. headers )</code> on a per-file basis, from inside your Amazon® S3 Management Console. In short, when you upload a file to your Amazon® S3 Bucket, if you want that file to be served a certain way, be sure to configure its <code>Properties -> Metadata</code> accordingly.</em></p>' . "\n";
352
+ echo (stripos (PHP_OS, "win") === 0 && (stripos ($_SERVER["HTTP_HOST"], "localhost") !== false || strpos ($_SERVER["HTTP_HOST"], "127.0.0.1") !== false || (defined ("LOCALHOST") && LOCALHOST))) ? '<p><em><strong>Localhost Developers:</strong> s2Member\'s Amazon® CloudFront integration requires the <a href="http://php.net/manual/en/function.openssl-sign.php" target="_blank" rel="external">openssl_sign()</a> function in PHP so it can digitially sign CloudFront URLs. This function is sometimes problematic on localhost servers such as WAMP &amp; EasyPHP. We recommend installing <a href="http://www.slproweb.com/products/Win32OpenSSL.html" target="_blank" rel="external">this lightweight alternative for Windows®</a> while you\'re developing. s2Member will automatically find it here: <code>C:\OpenSSL-Win[32/64]\bin\openssl.exe</code>.' . ((file_exists ("C:\OpenSSL-Win32\bin\openssl.exe") || file_exists ("C:\OpenSSL-Win64\bin\openssl.exe")) ? ' <strong class="ws-menu-page-hilite">( s2Member has detected that OpenSSL-Win[32/64] is installed in the correct location, thank you! )</strong>' : ' <strong class="ws-menu-page-hilite">( s2Member has detected that OpenSSL-Win[32/64] is currently unavailable )</strong>') . '</em></p>' . "\n" : '';
353
+ /**/
354
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"] === "configured")
355
+ echo '<p><em class="ws-menu-page-hilite"><strong>Your Amazon® CloudFront Distributions are: ( ALREADY configured! )</strong></em>' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) ? '<br /><em class="ws-menu-page-hilite">Downloads Distribution CNAME:</em> <em><code>' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . ' &mdash;&raquo; ' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]) . '</code></em>' : '') . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) ? '<br /><em class="ws-menu-page-hilite">Streaming Distribution CNAME:</em> <em><code>' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . ' &mdash;&raquo; ' . esc_html ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]) . '</code></em>' : '') . '</p>' . "\n";
356
+ /**/
357
+ else if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"])
358
+ echo '<p><em class="ws-menu-page-hilite"><strong>Your Amazon® CloudFront Distributions are: ( NOT yet auto-configured ).</strong></em></p>' . "\n";
359
+ /**/
360
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
361
+ /**/
362
+ echo '<table class="form-table" style="margin-top:0;">' . "\n";
363
+ echo '<tbody>' . "\n";
364
+ echo '<tr>' . "\n";
365
+ /**/
366
+ echo '<th style="padding-top:0;">' . "\n";
367
+ echo '<label for="ws-plugin--s2member-amazon-cf-files-private-key-id">' . "\n";
368
+ echo 'Amazon® CloudFront Key Pair ID ( your Key Pair ID ):' . "\n";
369
+ echo '</label>' . "\n";
370
+ echo '</th>' . "\n";
371
+ /**/
372
+ echo '</tr>' . "\n";
373
+ echo '<tr>' . "\n";
374
+ /**/
375
+ echo '<td>' . "\n";
376
+ echo '<input type="text" name="ws_plugin__s2member_amazon_cf_files_private_key_id" id="ws-plugin--s2member-amazon-cf-files-private-key-id" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key_id"]) . '" data-s-prev-config-value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key_id"]) . '" /><br />' . "\n";
377
+ echo 'See: <code>Amazon® Web Services Account -> Security Credentials -> Key Pairs</code>.' . "\n";
378
+ echo '</td>' . "\n";
379
+ /**/
380
+ echo '</tr>' . "\n";
381
+ echo '<tr>' . "\n";
382
+ /**/
383
+ echo '<th>' . "\n";
384
+ echo '<label for="ws-plugin--s2member-amazon-cf-files-private-key-entry">' . "\n";
385
+ echo 'Amazon® CloudFront Private Key ( contents of your <code>pk-[***].pem</code> file ):' . "\n";
386
+ echo '</label>' . "\n";
387
+ echo '</th>' . "\n";
388
+ /**/
389
+ echo '</tr>' . "\n";
390
+ echo '<tr>' . "\n";
391
+ /**/
392
+ echo '<td>' . "\n";
393
+ echo '<input type="hidden" name="ws_plugin__s2member_amazon_cf_files_private_key" id="ws-plugin--s2member-amazon-cf-files-private-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"]) . '" data-s-prev-config-value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"]) . '" />' . "\n";
394
+ echo '<textarea name="ws_plugin__s2member_amazon_cf_files_private_key_entry" id="ws-plugin--s2member-amazon-cf-files-private-key-entry" rows="3" wrap="off" spellcheck="false" style="font-family:Consolas, monospace;">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key"]) . '</textarea><br />' . "\n";
395
+ echo 'See: <code>Amazon® Web Services Account -> Security Credentials -> Key Pairs</code>.<br />' . "\n";
396
+ echo '<em>* Note, s2Member needs your <strong>Private Key file</strong>, NOT your Public Key file.</em>' . "\n";
397
+ echo '</td>' . "\n";
398
+ /**/
399
+ echo '</tr>' . "\n";
400
+ echo '<tr>' . "\n";
401
+ /**/
402
+ echo '<th>' . "\n";
403
+ echo '<label for="ws-plugin--s2member-amazon-cf-files-auto-configure-distros">' . "\n";
404
+ echo 'Auto-Configure your Amazon® S3/CloudFront combination?' . "\n";
405
+ echo '</label>' . "\n";
406
+ echo '</th>' . "\n";
407
+ /**/
408
+ echo '</tr>' . "\n";
409
+ echo '<tr>' . "\n";
410
+ /**/
411
+ echo '<td>' . "\n";
412
+ echo '<input type="checkbox" name="ws_plugin__s2member_amazon_cf_files_auto_configure_distros" id="ws-plugin--s2member-amazon-cf-files-auto-configure-distros" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-amazon-cf-files-auto-configure-distros")) . '"' . (($GLOBALS["ws_plugin__s2member_cf_auto_configure_distros_error"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-amazon-cf-files-auto-configure-distros"><strong>Yes</strong>, automatically configure my Amazon® CloudFront Distributions &amp; Amazon® S3 ACLs for me.</label><br />' . "\n";
413
+ echo '<em>s2Member will auto-configure and/or delete &amp; re-configure your Amazon® CloudFront Distributions for you.</em>' . "\n";
414
+ echo '</td>' . "\n";
415
+ /**/
416
+ echo '</tr>' . "\n";
417
+ echo '<tr>' . "\n";
418
+ /**/
419
+ echo '<td>' . "\n";
420
+ echo '<input type="checkbox" name="ws_plugin__s2member_amazon_cf_files_auto_configure_distros_w_cnames" id="ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames")) . '"' . (($GLOBALS["ws_plugin__s2member_cf_auto_configure_distros_error"] && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"] || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"])) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames"><strong>Yes</strong>, I want s2Member to auto-configure using custom CNAMES that I\'ll setup.</label><br />' . "\n";
421
+ echo '<em>* Optional, do NOT check this box unless you know what you\'re doing. This requires DNS changes.</em>' . "\n";
422
+ echo '</td>' . "\n";
423
+ /**/
424
+ echo '</tr>' . "\n";
425
+ echo '</tbody>' . "\n";
426
+ echo '</table>' . "\n";
427
+ /**/
428
+ echo '<div id="ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames" style="display:none;">' . "\n";
429
+ echo '<table class="form-table">' . "\n";
430
+ echo '<tbody>' . "\n";
431
+ echo '<tr>' . "\n";
432
+ /**/
433
+ echo '<th>' . "\n";
434
+ echo '<label for="ws-plugin--s2member-amazon-cf-files-downloads-distro-cname">' . "\n";
435
+ echo 'Amazon® CloudFront CNAME for File Downloads ( optional ):' . "\n";
436
+ echo '</label>' . "\n";
437
+ echo '</th>' . "\n";
438
+ /**/
439
+ echo '</tr>' . "\n";
440
+ echo '<tr>' . "\n";
441
+ /**/
442
+ echo '<td>' . "\n";
443
+ echo '<input type="text" name="ws_plugin__s2member_amazon_cf_files_distro_downloads_cname" id="ws-plugin--s2member-amazon-cf-files-downloads-distro-cname" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . '" /><br />' . "\n";
444
+ echo 'Example: <code>s2-file-downloads.' . esc_html (parse_url (site_url (), PHP_URL_HOST)) . '</code>.<br />' . "\n";
445
+ echo '<em>* Optional, do NOT fill this in unless you know what you\'re doing. This requires DNS changes.</em>' . "\n";
446
+ echo '</td>' . "\n";
447
+ /**/
448
+ echo '</tr>' . "\n";
449
+ echo '<tr>' . "\n";
450
+ /**/
451
+ echo '<th>' . "\n";
452
+ echo '<label for="ws-plugin--s2member-amazon-cf-files-streaming-distro-cname">' . "\n";
453
+ echo 'Amazon® CloudFront CNAME for Streaming Files ( optional ):' . "\n";
454
+ echo '</label>' . "\n";
455
+ echo '</th>' . "\n";
456
+ /**/
457
+ echo '</tr>' . "\n";
458
+ echo '<tr>' . "\n";
459
+ /**/
460
+ echo '<td>' . "\n";
461
+ echo '<input type="text" name="ws_plugin__s2member_amazon_cf_files_distro_streaming_cname" id="ws-plugin--s2member-amazon-cf-files-streaming-distro-cname" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . '" /><br />' . "\n";
462
+ echo 'Example: <code>s2-streaming-files.' . esc_html (parse_url (site_url (), PHP_URL_HOST)) . '</code>.<br />' . "\n";
463
+ echo '<em>* Optional, do NOT fill this in unless you know what you\'re doing. This requires DNS changes.</em>' . "\n";
464
+ echo '</td>' . "\n";
465
+ /**/
466
+ echo '</tr>' . "\n";
467
+ echo '</tbody>' . "\n";
468
+ echo '</table>' . "\n";
469
+ echo '</div>' . "\n";
470
+ echo '</div>' . "\n";
471
+ /**/
472
+ echo '</div>' . "\n";
473
+ /**/
474
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_amazon_cf", get_defined_vars ());
475
+ }
476
+ /**/
477
+ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_rtmp_streaming", true, get_defined_vars ()))
478
+ {
479
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_rtmp_streaming", get_defined_vars ());
480
+ /**/
481
+ echo '<div class="ws-menu-page-group" title="JW Player® &amp; RTMP Protocol Examples">' . "\n";
482
+ /**/
483
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-rtmp-streaming-section">' . "\n";
484
+ echo '<h3>JW Player® &amp; RTMP Protocol Examples</h3>' . "\n";
485
+ echo '<a href="http://www.longtailvideo.com/players/" target="_blank"><img src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/jwplayer-logo.png" class="ws-menu-page-right" style="width:179px; height:58px; border:0;" alt="." /></a>' . "\n";
486
+ echo '<p>While it is possible to serve audio/video files protected by s2Member, without needing to integrate Amazon® S3 or CloudFront; we DO highly recommend that you integrate both Amazon® S3 and Amazon® CloudFront in order to maximize speed and compatibility across various viewing platforms. That being said, there are code samples below that will serve audio/video files both with and without Amazon® S3/CloudFront. You can also check the <a href="' . esc_attr (c_ws_plugin__s2member_readmes::parse_readme_value ("Forum URI")) . '" target="_blank" rel="external">s2Member Support Forums</a> for tips/tricks if you like.</p>' . "\n";
487
+ echo '<p><strong>One of the great things about Amazon® CloudFront</strong>, is its ability to <strong>stream/seek media files</strong> in the truest sense of the word. For sites delivering protected <em>FLV/MP4/OGG/WEBM</em> and other streaming audio/video file types over the <em>RTMP</em> protocol, Amazon® CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon® S3 and Amazon® CloudFront together, please review the code samples below. s2Member can automatically serve your protected files over the <em>RTMP</em> protocol using an Amazon® CloudFront Streaming Distribution.</p>' . "\n";
488
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_rtmp_streaming", get_defined_vars ());
489
+ /**/
490
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
491
+ /**/
492
+ echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-standard-mp4\').toggle(); return false;" class="ws-dotted-link">JW Player® ( MP4 file, via Rewrite URLs. Amazon® S3/CloudFront NOT required )</a></p>' . "\n";
493
+ echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-standard-mp4" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player® here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This does NOT require s2Member to be integrated with Amazon® S3/CloudFront.<br />Also see: <code>s2Member -> Download Options -> Advanced Mod Rewrite Linkage</code>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/jwplayer-standard-mp4.php")) . '</p>' . "\n";
494
+ /**/
495
+ echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4\').toggle(); return false;" class="ws-dotted-link">JW Player® ( RTMP streaming MP4, via s2Member\'s Amazon® S3/CloudFront integration )</a></p>' . "\n";
496
+ echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player® here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This requires s2Member to be integrated with Amazon® S3/CloudFront.<br />Also see: <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12455" target="_blank" rel="external">s2Member Codex -> API Functions</a>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/jwplayer-streaming-mp4.php")) . '</p>' . "\n";
497
+ /**/
498
+ echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-sca\').toggle(); return false;" class="ws-dotted-link">JW Player® ( RTMP streaming MP4, via s2Member\'s JSON/Shortcode alternative )</a></p>' . "\n";
499
+ echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-sca" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player® here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This requires s2Member to be integrated with Amazon® S3/CloudFront.<br />Also see: <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12455" target="_blank" rel="external">s2Member Codex -> API Functions</a>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/jwplayer-streaming-mp4-sca.php")) . '</p>' . "\n";
500
+ /**/
501
+ echo '<p style="font-size:110%;"><a href="#" onclick="jQuery(\'p#ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-webm\').toggle(); return false;" class="ws-dotted-link">JW Player® ( RTMP streaming MP4, advanced w/ multiple HTML5 fallbacks )</a></p>' . "\n";
502
+ echo '<p id="ws-plugin--s2member-rtmp-streaming-details-jwplayer-streaming-mp4-webm" style="display:none;">Download <a href="http://www.longtailvideo.com/players/" target="_blank" rel="external">JW Player® here</a>, and upload <code>/jwplayer/</code> to your website\'s root directory.<br />This requires s2Member to be integrated with Amazon® S3/CloudFront.<br />Also see: <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12455" target="_blank" rel="external">s2Member Codex -> API Functions</a>.<br /><br />' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/jwplayer-streaming-mp4-webm.php")) . '</p>' . "\n";
503
+ /**/
504
+ echo '</div>' . "\n";
505
+ /**/
506
+ echo '</div>' . "\n";
507
+ /**/
508
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_rtmp_streaming", get_defined_vars ());
509
  }
510
  /**/
511
  if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_rewrite_linkage", true, get_defined_vars ()))
521
  echo '<p>It is also possible to pass query string parameters through a direct link:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/example-file.zip?s2member_file_inline=yes&amp;s2member_file_download_key=[key]</code>.</p>' . "\n";
522
  echo '<p>That being said, s2Member\'s <code>mod_rewrite</code> rules allow for more advanced control over s2Member-specific parameters.</p>' . "\n";
523
  echo '<p>For example, you could just do this for inline files:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline</strong>/example-file.zip</code></p>' . "\n";
524
+ echo '<p>Or, if you really want to get advanced, you could do something like this:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-[yes|no]/s2member-file-download-key-[key]</strong>/example-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-yes/s2member-file-download-key-xS54df5ER4d5x</strong>/example-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-inline-yes/s2member-skip-confirmation</strong>/example-file.zip</code></p>' . "\n";
525
  echo '<p>Or even this, if you\'re using Remote Header Authorization:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-remote</strong>/example-file.zip</code></p>' . "\n";
526
+ echo '<p>Specifying storage location option dynamically:<br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-storage-[local|s3|cf]</strong>/example-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-storage-cf</strong>/example-cloudfront-file.zip</code><br /><code>... /wp-content/plugins/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '<strong class="ws-menu-page-hilite">/s2member-file-storage-s3/s2member-file-inline</strong>/example-s3-file.html</code></p>' . "\n";
527
  echo '<p><em>* Note, the order of your s2Member-specific parameters with Advanced Mod-Rewrite Linkage is irrelevant. Feel free to add/remove, or even change the order. Everything discussed here is also Multisite compatible. Everything discussed here is also compatible when/if combined with Amazon® S3/CDN Storage. However, NONE of this will work on servers that do NOT support <code>mod_rewrite</code>. Almost all web servers do though.</em></p>' . "\n";
528
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_rewrite_linkage", get_defined_vars ());
529
  echo '</div>' . "\n";
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").click(function(){var $this=$(this);$this.val("one moment please ...");$.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==="0"){alert("Sorry, your request failed.\ns2Member's Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps"),$this.val("Update Roles/Capabilities")}else{if(response==="1"){alert("s2Member's Roles/Capabilities updated successfully."),$this.val("Update 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")})}else{if(location.href.match(/page\=ws-plugin--s2member-integrations/)){$("select#ws-plugin--s2member-bbpress-ovg").change(function(){if($(this).val()==="0"){$("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","inline");var l='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';$(l).text($(l).text().replace(/to (read\/)?participate/i,"to read/participate")),$("select#ws-plugin--s2member-bbpress-min-level option").each(function(){$(this).text($(this).text().replace(/\( to( read and)? participate \)/i,"( to read and participate )"))})}else{if($(this).val()==="1"){$("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","none");var l='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';$(l).text($(l).text().replace(/to (read\/)?participate/i,"to participate")),$("select#ws-plugin--s2member-bbpress-min-level option").each(function(){$(this).text($(this).text().replace(/\( to( read and)? participate \)/i,"( to participate )"))})}}}).trigger("change")}else{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 some very unhappy Customers. Data corruption WILL occur!\n\nFor 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)$/))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)$/))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)$/))?$(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)$/))?field.deflt:"";field.deflt=(field.type.match(/^(text)$/))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)$/))?field.options:"";field.expected=(field.type.match(/^(text|textarea)$/))?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)$/)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)$/)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){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,]+)$/)){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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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 Field":"New Custom Registration 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()})()}}else{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")}else{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()}})}else{if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){$("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var $this=$(this),val=$this.val();var $rows=$("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var $prevImg=$("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(val<=0){$rows.css("display","none"),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}});$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').change(function(){var thisChange=$(this).val(),checkedIndexes=[];$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="removal-deletion"&&this.checked){$this.nextAll(checkboxes).slice(0,2).attr({checked:"checked",disabled:"disabled"})}else{if(val==="removal-deletion"&&!this.checked){$this.nextAll(checkboxes).slice(0,2).removeAttr("disabled");(thisChange==="removal-deletion")?$this.nextAll(checkboxes).slice(0,2).removeAttr("checked"):null}else{if(val==="modification"&&this.checked){$this.nextAll(checkboxes).slice(0,3).attr({checked:"checked",disabled:"disabled"})}else{if(val==="modification"&&!this.checked){(thisChange==="modification")?$this.nextAll(checkboxes).slice(0,3).removeAttr("checked"):null;$this.nextAll(checkboxes).slice(0,3).removeAttr("disabled")}}}}}).each(function(index){(this.checked)?checkedIndexes.push(index):null});$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").removeAttr("disabled");if($.inArray(3,checkedIndexes)===-1&&$.inArray(4,checkedIndexes)===-1&&$.inArray(5,checkedIndexes)===-1&&$.inArray(6,checkedIndexes)===-1){$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").attr("disabled","disabled")}}).last().trigger("change")}else{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$/)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/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$/)}).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(/\:+$/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!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;shortCodeTemplateAttrs+=(button==="modification")?'modify="1" ':"";shortCodeTemplateAttrs+='level="'+esc_attr(level)+'" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'" custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';shortCodeTemplateAttrs+=' ta="'+esc_attr(trialAmount)+'" tp="'+esc_attr(trialPeriod)+'" tt="'+esc_attr(trialTerm)+'" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'" rrt="'+esc_attr(regRecurTimes)+'" rra="'+esc_attr(regRecurRetry)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));code.html(code.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((button==="modification")?"1":"0")+'"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+esc_attr(regRecur)+'"'));code.html(code.val().replace(/ name\="srt" value\="(.*?)"/,' name="srt" value="'+esc_attr(regRecurTimes)+'"'));code.html(code.val().replace(/ name\="sra" value\="(.*?)"/,' name="sra" value="'+esc_attr(regRecurRetry)+'"'));code.html(code.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+esc_attr(trialAmount)+'"'));code.html(code.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+esc_attr(trialPeriod)+'"'));code.html(code.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+esc_attr(trialTerm)+'"'));code.html(code.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+esc_attr(regPeriod)+'"'));code.html(code.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+esc_attr(regTerm)+'"'));$("div#ws-plugin--s2member-"+button+"-button-prev").html(code.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));(button==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Modification Buttons should be displayed to existing Users/Members, and they should be logged-in, BEFORE clicking this Button."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalCcapButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-ccap-shortcode");var code=$("textarea#ws-plugin--s2member-ccap-button");var desc=$.trim($("input#ws-plugin--s2member-ccap-desc").val().replace(/"/g,""));var regAmount=$("input#ws-plugin--s2member-ccap-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-ccap-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-ccap-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-ccap-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-ccap-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-ccap-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();var levelCcapsPer=(regRecur==="BN"&&regTerm!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!cCaps||cCaps==="-all"){alert("— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.");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}}}}shortCodeTemplateAttrs+='level="*" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'"';shortCodeTemplateAttrs+=' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-ccap-button-prev").html(code.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-sp-shortcode");var code=$("textarea#ws-plugin--s2member-sp-button");var leading=$("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var regAmount=$("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var desc=$.trim($("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.");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}}}}for(var i=0,ids=leading;i<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}var spIdsHours="sp:"+ids+":"+hours;shortCodeTemplateAttrs+='sp="1" ids="'+esc_attr(ids)+'" exp="'+esc_attr(hours)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'"';shortCodeTemplateAttrs+=' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+esc_attr(regAmount)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(spIdsHours)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-sp-button-prev").html(code.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your WordPress® Editor.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalRegLinkGenerate=function(){var level=$("select#ws-plugin--s2member-reg-link-level").val().replace(/[^0-9]/g,"");var subscrID=$.trim($("input#ws-plugin--s2member-reg-link-subscr-id").val());var custom=$.trim($("input#ws-plugin--s2member-reg-link-custom").val());var cCaps=$.trim($.trim($("input#ws-plugin--s2member-reg-link-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());var fixedTerm=$.trim($("input#ws-plugin--s2member-reg-link-fixed-term").val().replace(/[^A-Z 0-9]/gi,"").toUpperCase());var $link=$("p#ws-plugin--s2member-reg-link"),$loading=$("img#ws-plugin--s2member-reg-link-loading");var levelCcapsPer=(fixedTerm&&!fixedTerm.match(/L$/))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq ($_SERVER["HTTP_HOST"]); ?>')!==0){alert("— Oops, a slight problem: —\n\nThe Custom Value MUST start with your domain name.");return false}else{if(fixedTerm&&!fixedTerm.match(/^[1-9]+ (D|W|M|Y|L)$/)){alert("— Oops, a slight problem: —\n\nThe Fixed Term Length is not formatted properly.");return false}}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_reg_access_link_via_ajax",ws_plugin__s2member_reg_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-reg-access-link-via-ajax")); ?>',s2member_reg_access_link_subscr_gateway:"paypal",s2member_reg_access_link_subscr_id:subscrID,s2member_reg_access_link_custom:custom,s2member_reg_access_link_item_number:levelCcapsPer},function(response){$link.show().html('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$loading.hide()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var leading=$("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var $link=$("p#ws-plugin--s2member-sp-link"),$loading=$("img#ws-plugin--s2member-sp-link-loading");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.");return false}for(var i=0,ids=leading;i<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:ids,s2member_sp_access_link_hours:hours},function(response){$link.show().html('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$loading.hide()});return false}}}}}}}}});
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").click(function(){var $this=$(this);$this.val("one moment please ...");$.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==="0"){alert("Sorry, your request failed.\ns2Member's Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps"),$this.val("Update Roles/Capabilities")}else{if(response==="1"){alert("s2Member's Roles/Capabilities updated successfully."),$this.val("Update 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)$/))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)$/))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)$/))?$(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)$/))?field.deflt:"";field.deflt=(field.type.match(/^(text)$/))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)$/))?field.options:"";field.expected=(field.type.match(/^(text|textarea)$/))?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)$/)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)$/)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){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,]+)$/)){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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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)$/))?"":' 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 Field":"New Custom Registration 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$/)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/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$/)}).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(/\:+$/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!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;shortCodeTemplateAttrs+=(button==="modification")?'modify="1" ':"";shortCodeTemplateAttrs+='level="'+esc_attr(level)+'" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'" custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';shortCodeTemplateAttrs+=' ta="'+esc_attr(trialAmount)+'" tp="'+esc_attr(trialPeriod)+'" tt="'+esc_attr(trialTerm)+'" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'" rrt="'+esc_attr(regRecurTimes)+'" rra="'+esc_attr(regRecurRetry)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));code.html(code.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((button==="modification")?"1":"0")+'"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+esc_attr(regRecur)+'"'));code.html(code.val().replace(/ name\="srt" value\="(.*?)"/,' name="srt" value="'+esc_attr(regRecurTimes)+'"'));code.html(code.val().replace(/ name\="sra" value\="(.*?)"/,' name="sra" value="'+esc_attr(regRecurRetry)+'"'));code.html(code.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+esc_attr(trialAmount)+'"'));code.html(code.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+esc_attr(trialPeriod)+'"'));code.html(code.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+esc_attr(trialTerm)+'"'));code.html(code.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+esc_attr(regPeriod)+'"'));code.html(code.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+esc_attr(regTerm)+'"'));$("div#ws-plugin--s2member-"+button+"-button-prev").html(code.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));(button==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Modification Buttons should be displayed to existing Users/Members, and they should be logged-in, BEFORE clicking this Button."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalCcapButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-ccap-shortcode");var code=$("textarea#ws-plugin--s2member-ccap-button");var desc=$.trim($("input#ws-plugin--s2member-ccap-desc").val().replace(/"/g,""));var regAmount=$("input#ws-plugin--s2member-ccap-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-ccap-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-ccap-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-ccap-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-ccap-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-ccap-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();var levelCcapsPer=(regRecur==="BN"&&regTerm!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!cCaps||cCaps==="-all"){alert("— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.");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}}}}shortCodeTemplateAttrs+='level="*" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'"';shortCodeTemplateAttrs+=' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-ccap-button-prev").html(code.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-sp-shortcode");var code=$("textarea#ws-plugin--s2member-sp-button");var leading=$("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var regAmount=$("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var desc=$.trim($("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.");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}}}}for(var i=0,ids=leading;i<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}var spIdsHours="sp:"+ids+":"+hours;shortCodeTemplateAttrs+='sp="1" ids="'+esc_attr(ids)+'" exp="'+esc_attr(hours)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'"';shortCodeTemplateAttrs+=' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+esc_attr(regAmount)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(spIdsHours)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-sp-button-prev").html(code.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your WordPress® Editor.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalRegLinkGenerate=function(){var level=$("select#ws-plugin--s2member-reg-link-level").val().replace(/[^0-9]/g,"");var subscrID=$.trim($("input#ws-plugin--s2member-reg-link-subscr-id").val());var custom=$.trim($("input#ws-plugin--s2member-reg-link-custom").val());var cCaps=$.trim($.trim($("input#ws-plugin--s2member-reg-link-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());var fixedTerm=$.trim($("input#ws-plugin--s2member-reg-link-fixed-term").val().replace(/[^A-Z 0-9]/gi,"").toUpperCase());var $link=$("p#ws-plugin--s2member-reg-link"),$loading=$("img#ws-plugin--s2member-reg-link-loading");var levelCcapsPer=(fixedTerm&&!fixedTerm.match(/L$/))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq ($_SERVER["HTTP_HOST"]); ?>')!==0){alert("— Oops, a slight problem: —\n\nThe Custom Value MUST start with your domain name.");return false}else{if(fixedTerm&&!fixedTerm.match(/^[1-9]+ (D|W|M|Y|L)$/)){alert("— Oops, a slight problem: —\n\nThe Fixed Term Length is not formatted properly.");return false}}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_reg_access_link_via_ajax",ws_plugin__s2member_reg_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-reg-access-link-via-ajax")); ?>',s2member_reg_access_link_subscr_gateway:"paypal",s2member_reg_access_link_subscr_id:subscrID,s2member_reg_access_link_custom:custom,s2member_reg_access_link_item_number:levelCcapsPer},function(response){$link.show().html('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$loading.hide()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var leading=$("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var $link=$("p#ws-plugin--s2member-sp-link"),$loading=$("img#ws-plugin--s2member-sp-link-loading");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.");return false}for(var i=0,ids=leading;i<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:ids,s2member_sp_access_link_hours:hours},function(response){$link.show().html('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$loading.hide()});return false}}if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){$("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var $this=$(this),val=$this.val();var $rows=$("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var $prevImg=$("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(val<=0){$rows.css("display","none"),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}});$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').change(function(){var thisChange=$(this).val(),checkedIndexes=[];$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="removal-deletion"&&this.checked){$this.nextAll(checkboxes).slice(0,2).attr({checked:"checked",disabled:"disabled"})}else{if(val==="removal-deletion"&&!this.checked){$this.nextAll(checkboxes).slice(0,2).removeAttr("disabled");(thisChange==="removal-deletion")?$this.nextAll(checkboxes).slice(0,2).removeAttr("checked"):null}else{if(val==="modification"&&this.checked){$this.nextAll(checkboxes).slice(0,3).attr({checked:"checked",disabled:"disabled"})}else{if(val==="modification"&&!this.checked){(thisChange==="modification")?$this.nextAll(checkboxes).slice(0,3).removeAttr("checked"):null;$this.nextAll(checkboxes).slice(0,3).removeAttr("disabled")}}}}}).each(function(index){(this.checked)?checkedIndexes.push(index):null});$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").removeAttr("disabled");if($.inArray(3,checkedIndexes)===-1&&$.inArray(4,checkedIndexes)===-1&&$.inArray(5,checkedIndexes)===-1&&$.inArray(6,checkedIndexes)===-1){$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").attr("disabled","disabled")}}).last().trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-integrations/)){$("select#ws-plugin--s2member-bbpress-ovg").change(function(){if($(this).val()==="0"){$("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","inline");var l='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';$(l).text($(l).text().replace(/to (read\/)?participate/i,"to read/participate")),$("select#ws-plugin--s2member-bbpress-min-level option").each(function(){$(this).text($(this).text().replace(/\( to( read and)? participate \)/i,"( to read and participate )"))})}else{if($(this).val()==="1"){$("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","none");var l='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';$(l).text($(l).text().replace(/to (read\/)?participate/i,"to participate")),$("select#ws-plugin--s2member-bbpress-min-level option").each(function(){$(this).text($(this).text().replace(/\( to( read and)? participate \)/i,"( to participate )"))})}}}).trigger("change")}});
includes/menu-pages/menu-pages-s.js CHANGED
@@ -69,37 +69,7 @@ jQuery(document).ready (function($)
69
  });
70
  }
71
  /**/
72
- else if (location.href.match (/page\=ws-plugin--s2member-integrations/))
73
- {
74
- $('select#ws-plugin--s2member-bbpress-ovg').change (function()
75
- {
76
- if ($(this).val () === '0') /* Expand/collapse notation; based on selection. */
77
- {
78
- $('span#ws-plugin--s2member-bbpress-ovg-off-note').css ('display', 'inline');
79
- /**/
80
- var l = 'form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';
81
- /**/
82
- $(l).text ($(l).text ().replace (/to (read\/)?participate/i, 'to read/participate')), $('select#ws-plugin--s2member-bbpress-min-level option').each (function()
83
- {
84
- $(this).text ($(this).text ().replace (/\( to( read and)? participate \)/i, '( to read and participate )'));
85
- });
86
- }
87
- else if ($(this).val () === '1') /* Expand/collapse notation. */
88
- {
89
- $('span#ws-plugin--s2member-bbpress-ovg-off-note').css ('display', 'none');
90
- /**/
91
- var l = 'form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';
92
- /**/
93
- $(l).text ($(l).text ().replace (/to (read\/)?participate/i, 'to participate')), $('select#ws-plugin--s2member-bbpress-min-level option').each (function()
94
- {
95
- $(this).text ($(this).text ().replace (/\( to( read and)? participate \)/i, '( to participate )'));
96
- });
97
- }
98
- /**/
99
- }).trigger ('change'); /* Fire on ready too. */
100
- }
101
- /**/
102
- else if (location.href.match (/page\=ws-plugin--s2member-gen-ops/))
103
  {
104
  ws_plugin__s2member_generateSecurityKey = function() /* Generates a unique Security Key. */
105
  {
@@ -824,7 +794,7 @@ jQuery(document).ready (function($)
824
  }
825
  }
826
  /**/
827
- else if (location.href.match (/page\=ws-plugin--s2member-res-ops/))
828
  {
829
  $('input#ws-plugin--s2member-brute-force-restrictions-reset-button').click (function()
830
  {
@@ -873,78 +843,75 @@ jQuery(document).ready (function($)
873
  }).last ().trigger ('change');
874
  }
875
  /**/
876
- else if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
877
  {
878
- $('select#ws-plugin--s2member-auto-eot-system-enabled').change (function()
879
  {
880
- var $this = $(this), val = $this.val ();
881
- var $viaCron = $('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
 
882
  /**/
883
- if (val == 2) /* Display Cron instructions. */
884
- $viaCron.show ()
885
- else /* Hide instructions. */
886
- $viaCron.hide ();
887
- });
888
- }
889
- /**/
890
- else if (location.href.match (/page\=ws-plugin--s2member-els-ops/))
891
- {
892
- $('select#ws-plugin--s2member-custom-reg-opt-in').change (function()
893
  {
894
- var $this = $(this), val = $this.val ();
895
- var $rows = $('tr.ws-plugin--s2member-custom-reg-opt-in-label-row');
896
- var $prevImg = $('img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img');
897
- /**/
898
- if (val <= 0) /* Checkbox disabled. */
899
- $rows.css ('display', 'none'), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
900
  /**/
901
- else if (val == 1) /* Enabled, checked by default. */
902
- $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/unchecked\.png$/, '/checked.png'));
903
  /**/
904
- else if (val == 2) /* Enabled, unchecked by default. */
905
- $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
906
- });
907
- /**/
908
- $('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs\[\]"]').change (function()
909
- {
910
- var thisChange = $(this).val (), checkedIndexes = []; /* Record value associated with change event. Also initialize checkedIndexes array. */
911
  /**/
912
- $('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs\[\]"]').each (function()
913
  {
914
- var $this = $(this), val = $this.val (), checkboxes = 'input[type="checkbox"]';
915
- /**/
916
- if (val === 'removal-deletion' && this.checked) /* All sub-items get checked/disabled too. */
917
- $this.nextAll (checkboxes).slice (0, 2).attr ({'checked': 'checked', 'disabled': 'disabled'});
918
- /**/
919
- else if (val === 'removal-deletion' && !this.checked)
920
- {
921
- $this.nextAll (checkboxes).slice (0, 2).removeAttr ('disabled');
922
- (thisChange === 'removal-deletion') ? $this.nextAll (checkboxes).slice (0, 2).removeAttr ('checked') : null;
923
- }
924
- /**/
925
- else if (val === 'modification' && this.checked) /* All sub-items get checked/disabled too. */
926
- $this.nextAll (checkboxes).slice (0, 3).attr ({'checked': 'checked', 'disabled': 'disabled'});
927
- /**/
928
- else if (val === 'modification' && !this.checked)
929
- {
930
- (thisChange === 'modification') ? $this.nextAll (checkboxes).slice (0, 3).removeAttr ('checked') : null;
931
- $this.nextAll (checkboxes).slice (0, 3).removeAttr ('disabled');
932
- }
933
- })
934
- /**/
935
- .each (function(index) /* Now, which ones are checked? */
936
  {
937
- (this.checked) ? checkedIndexes.push (index) : null;
938
- });
 
 
 
 
 
 
 
 
 
 
 
939
  /**/
940
- $('select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions').removeAttr ('disabled');
941
- if ($.inArray (3, checkedIndexes) === -1 && $.inArray (4, checkedIndexes) === -1 && $.inArray (5, checkedIndexes) === -1 && $.inArray (6, checkedIndexes) === -1)
942
- $('select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions').attr ('disabled', 'disabled');
943
  /**/
944
- }).last ().trigger ('change');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
945
  }
946
  /**/
947
- else if (location.href.match (/page\=ws-plugin--s2member-paypal-buttons/))
948
  {
949
  $('div.ws-menu-page select[id]').filter (function() /* Filter all select elements with an id. */
950
  {
@@ -1305,4 +1272,91 @@ jQuery(document).ready (function($)
1305
  return false;
1306
  };
1307
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1308
  });
69
  });
70
  }
71
  /**/
72
+ if (location.href.match (/page\=ws-plugin--s2member-gen-ops/))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  {
74
  ws_plugin__s2member_generateSecurityKey = function() /* Generates a unique Security Key. */
75
  {
794
  }
795
  }
796
  /**/
797
+ if (location.href.match (/page\=ws-plugin--s2member-res-ops/))
798
  {
799
  $('input#ws-plugin--s2member-brute-force-restrictions-reset-button').click (function()
800
  {
843
  }).last ().trigger ('change');
844
  }
845
  /**/
846
+ if (location.href.match (/page\=ws-plugin--s2member-down-ops/))
847
  {
848
+ var updateCloudFrontPrivateKey = function() /* Attaches to events below. */
849
  {
850
+ var $hiddenPrivateKey = $('input#ws-plugin--s2member-amazon-cf-files-private-key');
851
+ var $visiblePrivateKeyEntry = $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry');
852
+ var hiddenPrivateKeyValue = $.trim ($hiddenPrivateKey.val ()), visiblePrivateKeyEntryValue = $.trim ($visiblePrivateKeyEntry.val ());
853
  /**/
854
+ if ((hiddenPrivateKeyValue && !visiblePrivateKeyEntryValue) || visiblePrivateKeyEntryValue.match (/[^\r\n\u25CF]/)) /* 9679.toString(16).toUpperCase() = 25CF ( i.e the hex value ). */
855
+ $hiddenPrivateKey.val (visiblePrivateKeyEntryValue), $visiblePrivateKeyEntry.val (visiblePrivateKeyEntryValue.replace (/[^\r\n]/g, String.fromCharCode (9679)));
856
+ };
857
+ /**/
858
+ $('form#ws-plugin--s2member-options-form').submit (updateCloudFrontPrivateKey);
859
+ $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry').change (updateCloudFrontPrivateKey).trigger ('change');
860
+ /**/
861
+ var updateCloudFrontDistroCfgs = function() /* Attaches to events below. */
 
 
862
  {
863
+ var $hiddenPrivateKey = $('input#ws-plugin--s2member-amazon-cf-files-private-key');
864
+ var $visiblePrivateKeyId = $('input#ws-plugin--s2member-amazon-cf-files-private-key-id');
 
 
 
 
865
  /**/
866
+ var $autoConfigDistros = $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros');
867
+ var $autoConfigDistrosStatus = $('input#ws-plugin--s2member-amazon-cf-files-distros-auto-config-status');
868
  /**/
869
+ var autoConfigDistrosStatusValue = $.trim ($autoConfigDistrosStatus.val ());
870
+ var hiddenPrivateKeyValue = $.trim ($hiddenPrivateKey.val ()), visiblePrivateKeyIdValue = $.trim ($visiblePrivateKeyId.val ());
871
+ var hiddenPrivateKeyPrevConfigValue = $.trim ($hiddenPrivateKey.attr ('data-s-prev-config-value')), visiblePrivateKeyIdPrevConfigValue = $.trim ($visiblePrivateKeyId.attr ('data-s-prev-config-value'));
 
 
 
 
872
  /**/
873
+ if (autoConfigDistrosStatusValue === 'configured' && ((visiblePrivateKeyIdPrevConfigValue && visiblePrivateKeyIdValue !== visiblePrivateKeyIdPrevConfigValue) || (hiddenPrivateKeyPrevConfigValue && hiddenPrivateKeyValue !== hiddenPrivateKeyPrevConfigValue)))
874
  {
875
+ 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.');
876
+ $autoConfigDistros.attr ('checked', 'checked'); /* Forcibly check. */
877
+ }
878
+ else if (autoConfigDistrosStatusValue !== 'configured' && visiblePrivateKeyIdValue && hiddenPrivateKeyValue)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
879
  {
880
+ alert('s2Member will need to auto-configure your Amazon® CloudFront distributions for you. When you\'re done editing, click (Save All Changes) below.');
881
+ $autoConfigDistros.attr ('checked', 'checked'); /* Forcibly check. */
882
+ }
883
+ };
884
+ /**/
885
+ $('input#ws-plugin--s2member-amazon-cf-files-private-key-id').change (updateCloudFrontDistroCfgs);
886
+ $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry').change (updateCloudFrontDistroCfgs);
887
+ /**/
888
+ $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames').change (function()
889
+ {
890
+ var $this = $(this), thisChecked = (this.checked) ? true : false;
891
+ var $autoConfigDistros = $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros');
892
+ var $autoConfigDistroCnames = $('div#ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames');
893
  /**/
894
+ (thisChecked) ? $autoConfigDistroCnames.show () : $autoConfigDistroCnames.hide ();
895
+ (thisChecked) ? $autoConfigDistros.attr ('checked', 'checked') : null;
 
896
  /**/
897
+ }).trigger ('change');
898
+ }
899
+ /**/
900
+ if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
901
+ {
902
+ $('select#ws-plugin--s2member-auto-eot-system-enabled').change (function()
903
+ {
904
+ var $this = $(this), val = $this.val ();
905
+ var $viaCron = $('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
906
+ /**/
907
+ if (val == 2) /* Display Cron instructions. */
908
+ $viaCron.show ()
909
+ else /* Hide instructions. */
910
+ $viaCron.hide ();
911
+ });
912
  }
913
  /**/
914
+ if (location.href.match (/page\=ws-plugin--s2member-paypal-buttons/))
915
  {
916
  $('div.ws-menu-page select[id]').filter (function() /* Filter all select elements with an id. */
917
  {
1272
  return false;
1273
  };
1274
  }
1275
+ /**/
1276
+ if (location.href.match (/page\=ws-plugin--s2member-els-ops/))
1277
+ {
1278
+ $('select#ws-plugin--s2member-custom-reg-opt-in').change (function()
1279
+ {
1280
+ var $this = $(this), val = $this.val ();
1281
+ var $rows = $('tr.ws-plugin--s2member-custom-reg-opt-in-label-row');
1282
+ var $prevImg = $('img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img');
1283
+ /**/
1284
+ if (val <= 0) /* Checkbox disabled. */
1285
+ $rows.css ('display', 'none'), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
1286
+ /**/
1287
+ else if (val == 1) /* Enabled, checked by default. */
1288
+ $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/unchecked\.png$/, '/checked.png'));
1289
+ /**/
1290
+ else if (val == 2) /* Enabled, unchecked by default. */
1291
+ $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
1292
+ });
1293
+ /**/
1294
+ $('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs\[\]"]').change (function()
1295
+ {
1296
+ var thisChange = $(this).val (), checkedIndexes = []; /* Record value associated with change event. Also initialize checkedIndexes array. */
1297
+ /**/
1298
+ $('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs\[\]"]').each (function()
1299
+ {
1300
+ var $this = $(this), val = $this.val (), checkboxes = 'input[type="checkbox"]';
1301
+ /**/
1302
+ if (val === 'removal-deletion' && this.checked) /* All sub-items get checked/disabled too. */
1303
+ $this.nextAll (checkboxes).slice (0, 2).attr ({'checked': 'checked', 'disabled': 'disabled'});
1304
+ /**/
1305
+ else if (val === 'removal-deletion' && !this.checked)
1306
+ {
1307
+ $this.nextAll (checkboxes).slice (0, 2).removeAttr ('disabled');
1308
+ (thisChange === 'removal-deletion') ? $this.nextAll (checkboxes).slice (0, 2).removeAttr ('checked') : null;
1309
+ }
1310
+ /**/
1311
+ else if (val === 'modification' && this.checked) /* All sub-items get checked/disabled too. */
1312
+ $this.nextAll (checkboxes).slice (0, 3).attr ({'checked': 'checked', 'disabled': 'disabled'});
1313
+ /**/
1314
+ else if (val === 'modification' && !this.checked)
1315
+ {
1316
+ (thisChange === 'modification') ? $this.nextAll (checkboxes).slice (0, 3).removeAttr ('checked') : null;
1317
+ $this.nextAll (checkboxes).slice (0, 3).removeAttr ('disabled');
1318
+ }
1319
+ })
1320
+ /**/
1321
+ .each (function(index) /* Now, which ones are checked? */
1322
+ {
1323
+ (this.checked) ? checkedIndexes.push (index) : null;
1324
+ });
1325
+ /**/
1326
+ $('select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions').removeAttr ('disabled');
1327
+ if ($.inArray (3, checkedIndexes) === -1 && $.inArray (4, checkedIndexes) === -1 && $.inArray (5, checkedIndexes) === -1 && $.inArray (6, checkedIndexes) === -1)
1328
+ $('select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions').attr ('disabled', 'disabled');
1329
+ /**/
1330
+ }).last ().trigger ('change');
1331
+ }
1332
+ /**/
1333
+ if (location.href.match (/page\=ws-plugin--s2member-integrations/))
1334
+ {
1335
+ $('select#ws-plugin--s2member-bbpress-ovg').change (function()
1336
+ {
1337
+ if ($(this).val () === '0') /* Expand/collapse notation; based on selection. */
1338
+ {
1339
+ $('span#ws-plugin--s2member-bbpress-ovg-off-note').css ('display', 'inline');
1340
+ /**/
1341
+ var l = 'form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';
1342
+ /**/
1343
+ $(l).text ($(l).text ().replace (/to (read\/)?participate/i, 'to read/participate')), $('select#ws-plugin--s2member-bbpress-min-level option').each (function()
1344
+ {
1345
+ $(this).text ($(this).text ().replace (/\( to( read and)? participate \)/i, '( to read and participate )'));
1346
+ });
1347
+ }
1348
+ else if ($(this).val () === '1') /* Expand/collapse notation. */
1349
+ {
1350
+ $('span#ws-plugin--s2member-bbpress-ovg-off-note').css ('display', 'none');
1351
+ /**/
1352
+ var l = 'form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';
1353
+ /**/
1354
+ $(l).text ($(l).text ().replace (/to (read\/)?participate/i, 'to participate')), $('select#ws-plugin--s2member-bbpress-min-level option').each (function()
1355
+ {
1356
+ $(this).text ($(this).text ().replace (/\( to( read and)? participate \)/i, '( to participate )'));
1357
+ });
1358
+ }
1359
+ /**/
1360
+ }).trigger ('change'); /* Fire on ready too. */
1361
+ }
1362
  });
includes/menu-pages/res-ops.inc.php CHANGED
@@ -232,13 +232,13 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_res_ops"))
232
  {
233
  do_action ("ws_plugin__s2member_during_res_ops_page_during_left_sections_before_uri_level_access", get_defined_vars ());
234
  /**/
235
- echo '<div class="ws-menu-page-group" title="URI Restrictions ( typical w/ BuddyPress )">' . "\n";
236
  /**/
237
  echo '<div class="ws-menu-page-section ws-plugin--s2member-uri-level-access-section">' . "\n";
238
  echo '<h3>URI Level Access Restrictions ( optional )</h3>' . "\n";
239
- echo '<p>Here you can specify URIs ( or word fragments found in URIs ) that are restricted to certain Membership Access Levels. Control over URIs is a little more complex. This section is intended for advanced webmasters only. That being said, here are the basics... A REQUEST_URI, is the portion of the URL that comes after the domain. This is a URL <code>http://www.example.com/path/to/file.php</code>, and this is the URI: <code>/path/to/file.php</code>.</p>' . "\n";
240
- echo '<p>In the fields below, you can provide a list ( one per line ) of URIs on your site that should be off-limits based on Membership Level. You can also use word fragments instead of a full URI. If a word fragment is found anywhere in the URI, it will be protected. Wildcards and other regex patterns are not supported here, and therefore you don\'t need to escape special characters or anything. Please note, these ARE caSe sensitive. You must be specific with respect to case sensitivity. The word fragment <code>some-path/</code> would NOT match a URI that contains <code>some-Path/</code>. <em>A few <a href="#" onclick="alert(\'URI Replacement Codes:\\n\\n%%current_user_login%% = The current User\\\'s Username, lowercase.\\n%%current_user_id%% = The current User\\\'s ID.\\n%%current_user_level%% = The current User\\\'s s2Member Level.\\n%%current_user_role%% = The current User\\\'s WordPress® Role.' . ((!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? '\\n%%current_user_ccaps%% = The current User\\\'s Custom Capabilities.' : '') . '\\n%%current_user_logins%% = Number of times the current User has logged in.\\n\\nFor example, if you\\\'re using BuddyPress, and want to protect BuddyPress Groups, you could add URI protection, like this: /members/%%current_user_login%%/groups/\'); return false;">Replacement Codes</a> are also supported here.</em></p>' . "\n";
241
- echo '<p><em><strong>*BuddyPress ( and similar )*</strong> URI Restrictions work great with plugins like BuddyPress that add new areas to your site ( where those new areas are NOT necessarily a Post/Page/Tag/Category ). In other words, anytime you\'d like to protect a specific feature offered by BuddyPress ( or other plugins ), you\'ll need to nail down some word fragments found in the URIs associated with those areas. For instance, with BuddyPress you might have: [ <a href="#" onclick="alert(\'/members/\\n/groups/\\n/blogs/\\n/activity/\\n/messages/\\n/profile/\\n/friends/\\n/settings/\'); return false;">click for example</a> ].</em></p>' . "\n";
242
  do_action ("ws_plugin__s2member_during_res_ops_page_during_left_sections_during_uri_level_access", get_defined_vars ());
243
  /**/
244
  echo '<table class="form-table">' . "\n";
232
  {
233
  do_action ("ws_plugin__s2member_during_res_ops_page_during_left_sections_before_uri_level_access", get_defined_vars ());
234
  /**/
235
+ echo '<div class="ws-menu-page-group" title="URI Restrictions ( typical w/BuddyPress )">' . "\n";
236
  /**/
237
  echo '<div class="ws-menu-page-section ws-plugin--s2member-uri-level-access-section">' . "\n";
238
  echo '<h3>URI Level Access Restrictions ( optional )</h3>' . "\n";
239
+ echo '<p>Here you can specify URIs ( or word fragments found in URIs ) that are restricted to certain Membership Access Levels. Control over URIs is a little more complex. This section is intended for advanced webmasters only. That being said, here are the basics... A <code>REQUEST_URI</code>, is the portion of a <code>URL</code> that comes immediately after the domain. This is a URL <code>http://www.example.com/path/to/file.php</code>, and this is the URI: <code>/path/to/file.php</code>.</p>' . "\n";
240
+ echo '<p>In the fields below, you can provide a list <em>( one per line )</em> of URIs on your site that should be off-limits based on Membership Level. You can also use word fragments instead of a full URI. If a word fragment is found anywhere in the URI, it will be protected. Wildcards and other regex patterns are NOT supported here, and therefore you don\'t need to escape special characters or anything. Please note, these ARE caSe sensitive. You must be specific with respect to case sensitivity. The word fragment <code>some-path/</code> would NOT match a URI that contains <code>some-Path/</code>. <em>A few <a href="#" onclick="alert(\'URI Replacement Codes:\\n\\n%%current_user_login%% = The current User\\\'s Username, lowercase.\\n%%current_user_id%% = The current User\\\'s ID.\\n%%current_user_level%% = The current User\\\'s s2Member Level.\\n%%current_user_role%% = The current User\\\'s WordPress® Role.' . ((!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? '\\n%%current_user_ccaps%% = The current User\\\'s Custom Capabilities.' : '') . '\\n%%current_user_logins%% = Number of times the current User has logged in.\\n\\nFor example, if you\\\'re using BuddyPress, and want to protect BuddyPress Groups, you could add URI protection, like this: /members/%%current_user_login%%/groups/\'); return false;">Replacement Codes</a> are also supported here.</em></p>' . "\n";
241
+ echo '<p><em><strong>*BuddyPress ( and similar )*</strong> URI Restrictions work great with plugins like BuddyPress that add new areas to your site ( where those new areas are NOT necessarily a Post/Page/Tag/Category ). In other words, anytime you\'d like to protect a specific feature offered by BuddyPress ( or other plugins ), you\'ll need to nail down specific word fragments found in the URIs associated with those areas. For instance, with BuddyPress you might have: [ <a href="#" onclick="alert(\'/members/\\n/groups/\\n/blogs/\\n/activity/\\n/messages/\\n/profile/\\n/friends/\\n/settings/\'); return false;">click for example</a> ].</em></p>' . "\n";
242
  do_action ("ws_plugin__s2member_during_res_ops_page_during_left_sections_during_uri_level_access", get_defined_vars ());
243
  /**/
244
  echo '<table class="form-table">' . "\n";
includes/s2member-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(b){ws_plugin__s2member_uniqueFilesDownloaded=[];var a='<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (preg_quote ((c_ws_plugin__s2member_utils_conds::bp_is_installed ()) ? "/" . ltrim (BP_REGISTER_SLUG,"/") : "register"), "/"); ?>';var c='<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (preg_quote ((c_ws_plugin__s2member_utils_conds::bp_is_installed ()) ? "/" . ltrim (BP_XPROFILE_SLUG,"/") : "profile"), "/"); ?>';if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){b('a[href*="s2member_file_download"], a[href*="s2member-file"').click(function(){if(!this.href.match(/s2member_file_download_key\=(.+)/i)){var d='<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Confirm File Download —", "s2member-front", "s2member")); ?>\n\n';d+=b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`ve downloaded %s protected %s in the last %s.", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY,((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("file", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("files", "s2member-front", "s2member")); ?>'),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("24 hours", "s2member-front", "s2member")); ?>':b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("%s days", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)))+"\n\n";d+=(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to UNLIMITED downloads though ( so, no worries ).", "s2member-front", "s2member")); ?>':b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to %s unique %s %s.", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED,((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("download", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("downloads", "s2member-front", "s2member")); ?>'),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("each day", "s2member-front", "s2member")); ?>':b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("every %s-day period", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));if(this.href.match(/s2member_skip_confirmation/i)||confirm(d)){if(b.inArray(this.href,ws_plugin__s2member_uniqueFilesDownloaded)===-1){ws_plugin__s2member_uniqueFilesDownloaded.push(this.href),S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++}return true}else{return false}}else{return true}})}if(!location.href.match(/\/wp-admin\//)){b("input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2").keyup(function(){ws_plugin__s2member_passwordStrength(b("input#ws-plugin--s2member-profile-login"),b("input#ws-plugin--s2member-profile-password1"),b("input#ws-plugin--s2member-profile-password2"),b("div#ws-plugin--s2member-profile-password-strength"))});b("form#ws-plugin--s2member-profile").submit(function(){var f=this,e="",d="",j="";var h=b("input#ws-plugin--s2member-profile-password1",f);var g=b("input#ws-plugin--s2member-profile-password2",f);var i=b("input#ws-plugin--s2member-profile-submit",f);b(":input",f).each(function(){var k=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(k&&(e=b.trim(b('label[for="'+k+'"]',f).first().children("strong").first().text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){j+=d+"\n\n"}}});if(j=b.trim(j)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+j);return false}else{if(b.trim(h.val())&&b.trim(h.val())!==b.trim(g.val())){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Passwords do not match up. Please try again.", "s2member-front", "s2member")); ?>');return false}}ws_plugin__s2member_animateProcessing(i);return true})}if(location.href.match(/\/wp-signup\.php/)){b("div#content > div.mu_register > form#setupform").submit(function(){var f=this,e="",d="",h="";b("input#user_email",f).attr("data-expected","email");var g=b('p.submit input[type="submit"]',f);b("input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code",f).attr({"aria-required":"true"});b(":input",f).each(function(){var i=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(i&&(e=b.trim(b('label[for="'+i+'"]',f).first().text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){h+=d+"\n\n"}}});if(h=b.trim(h)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+h);return false}ws_plugin__s2member_animateProcessing(g);return true})}else{if(location.href.match(/\/wp-login\.php/)){b("input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2").keyup(function(){ws_plugin__s2member_passwordStrength(b("input#user_login"),b("input#ws-plugin--s2member-custom-reg-field-user-pass1"),b("input#ws-plugin--s2member-custom-reg-field-user-pass2"),b("div#ws-plugin--s2member-custom-reg-field-user-pass-strength"))});b("div#login > form#registerform input#wp-submit").attr("tabindex","1000");b("div#login > form#registerform").submit(function(){var f=this,e="",d="",j="";b("input#user_email",f).attr("data-expected","email");var i=b('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]',f);var g=b("input#ws-plugin--s2member-custom-reg-field-user-pass2",f);var h=b("input#wp-submit",f);b("input#user_login, input#user_email, input#captcha_code",f).attr({"aria-required":"true"});b(":input",f).each(function(){var k=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(b.inArray(k,["user_login","user_email","captcha_code"])!==-1){if((e=b.trim(b(this).parent("label").text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){j+=d+"\n\n"}}}else{if(k&&(e=b.trim(b('label[for="'+k+'"]',f).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){j+=d+"\n\n"}}}});if(j=b.trim(j)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+j);return false}else{if(i.length&&b.trim(i.val())!==b.trim(g.val())){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Passwords do not match up. Please try again.", "s2member-front", "s2member")); ?>');return false}}ws_plugin__s2member_animateProcessing(h);return true})}else{if(location.href.match(/\/wp-admin\/(user\/)?profile\.php/)){b("form#your-profile").submit(function(){var f=this,e="",d="",g="";b("input#email",f).attr("data-expected","email");b(':input[id^="ws-plugin--s2member-profile-"]',f).each(function(){var h=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(h&&(e=b.trim(b('label[for="'+h+'"]',f).first().text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){g+=d+"\n\n"}}});if(g=b.trim(g)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+g);return false}return true})}else{if(a&&location.href.match(a)){b("body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section").closest("form").submit(function(){var f=this,e="",d="",g="";b("input#signup_email",f).attr("data-expected","email");b("input#signup_username, input#signup_email, input#signup_password, input#field_1",f).attr({"aria-required":"true"});b(":input",f).each(function(){var h=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(h&&(e=b.trim(b('label[for="'+h+'"]',f).first().text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){g+=d+"\n\n"}}});if(g=b.trim(g)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+g);return false}return true})}else{if(c&&location.href.match(c)&&location.href.match(/\/edit\//)){b('body.logged-in.profile.profile-edit input.ws-plugin--s2member-profile-field-4bp[type = "text"]').closest("form").submit(function(){var f=this,e="",d="",g="";b("input#field_1",f).attr({"aria-required":"true"});b(":input",f).each(function(){var h=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(h&&(e=b.trim(b('label[for="'+h+'"]',f).first().text().replace(/[\r\n\t]+/g," ")))){if(d=ws_plugin__s2member_validationErrors(e,this,f)){g+=d+"\n\n"}}});if(g=b.trim(g)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+g);return false}return true})}}}}}ws_plugin__s2member_passwordStrength=function(e,g,f,d){if(e instanceof jQuery&&g instanceof jQuery&&f instanceof jQuery&&d instanceof jQuery&&typeof passwordStrength==="function"&&typeof pwsL10n==="object"){d.removeClass("ws-plugin--s2member-password-strength-short ws-plugin--s2member-password-strength-bad ws-plugin--s2member-password-strength-good ws-plugin--s2member-password-strength-strong ws-plugin--s2member-password-strength-mismatch");switch(passwordStrength(g.val(),e.val(),f.val())){case 1:d.addClass("ws-plugin--s2member-password-strength-short").html(pwsL10n["short"]);break;case 2:d.addClass("ws-plugin--s2member-password-strength-bad").html(pwsL10n.bad);break;case 3:d.addClass("ws-plugin--s2member-password-strength-good").html(pwsL10n.good);break;case 4:d.addClass("ws-plugin--s2member-password-strength-strong").html(pwsL10n.strong);break;case 5:d.addClass("ws-plugin--s2member-password-strength-mismatch").html(pwsL10n.mismatch);break;default:d.addClass("ws-plugin--s2member-password-strength-short").html(pwsL10n["short"])}}return};ws_plugin__s2member_validationErrors=function(p,o,e,k,j){if(typeof p==="string"&&p&&typeof o==="object"&&typeof e==="object"){if(typeof o.tagName==="string"&&o.tagName.match(/^(input|textarea|select)$/i)&&!o.disabled){var r=o.tagName.toLowerCase(),n=b(o),m=b.trim(n.attr("type")).toLowerCase(),d=b.trim(n.attr("name")),q=n.val();var k=(typeof k==="boolean")?k:(n.attr("aria-required")==="true"),j=(typeof j==="string")?j:b.trim(n.attr("data-expected"));var i=('<?php echo strlen($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_force_personal_emails"]); ?>'>0)?true:false;var g=new RegExp('^(<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (implode ("|", preg_split ("/[\r\n\t ;,]+/", preg_quote ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_force_personal_emails"], "/")))); ?>)@',"i");if(r==="input"&&m==="checkbox"&&d.match(/\[\]$/)){if(typeof o.id==="string"&&o.id.match(/-0$/)){if(k&&!b('input[name="'+d.replace(/([\[\]])/g,"$1")+'"]:checked',e).length){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please check at least one of the boxes.", "s2member-front", "s2member")); ?>'}}}else{if(r==="input"&&m==="checkbox"){if(k&&!o.checked){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Required. This box must be checked.", "s2member-front", "s2member")); ?>'}}else{if(r==="input"&&m==="radio"){if(typeof o.id==="string"&&o.id.match(/-0$/)){if(k&&!b('input[name="'+d.replace(/([\[\]])/g,"$1")+'"]:checked',e).length){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please select one of the options.", "s2member-front", "s2member")); ?>'}}}else{if(r==="select"&&n.attr("multiple")){if(k&&(!(q instanceof Array)||!q.length)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please select at least one of the options.", "s2member-front", "s2member")); ?>'}}else{if(typeof q!=="string"||(k&&!(q=b.trim(q)).length)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("This is a required field, please try again.", "s2member-front", "s2member")); ?>'}else{if((q=b.trim(q)).length&&((r==="input"&&m.match(/^(text|password)$/i))||r==="textarea")&&typeof j==="string"&&j.length){if(j==="numeric-wp-commas"&&(!q.match(/^[0-9\.,]+$/)||isNaN(q.replace(/,/g,"")))){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be numeric ( with or without decimals, commas allowed ).", "s2member-front", "s2member")); ?>'}else{if(j==="numeric"&&(!q.match(/^[0-9\.]+$/)||isNaN(q))){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be numeric ( with or without decimals, no commas ).", "s2member-front", "s2member")); ?>'}else{if(j==="integer"&&(!q.match(/^[0-9]+$/)||isNaN(q))){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be an integer ( a whole number, without any decimals ).", "s2member-front", "s2member")); ?>'}else{if(j==="integer-gt-0"&&(!q.match(/^[0-9]+$/)||isNaN(q)||q<=0)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be an integer > 0 ( whole number, no decimals, greater than 0 ).", "s2member-front", "s2member")); ?>'}else{if(j==="float"&&(!q.match(/^[0-9\.]+$/)||!q.match(/[0-9]/)||!q.match(/\./)||isNaN(q))){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a float ( floating point number, decimals required ).", "s2member-front", "s2member")); ?>'}else{if(j==="float-gt-0"&&(!q.match(/^[0-9\.]+$/)||!q.match(/[0-9]/)||!q.match(/\./)||isNaN(q)||q<=0)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a float > 0 ( floating point number, decimals required, greater than 0 ).", "s2member-front", "s2member")); ?>'}else{if(j==="date"&&!q.match(/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a date ( required date format: dd/mm/yyyy ).", "s2member-front", "s2member")); ?>'}else{if(j==="email"&&!q.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})$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a valid email address.", "s2member-front", "s2member")); ?>'}else{if(j==="email"&&i&&q.match(g)){return p+"\n"+b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use a personal email address.\nAddresses like <%s@> are problematic.", "s2member-front", "s2member")); ?>',q.split("@")[0])}else{if(j==="url"&&!q.match(/^http(s?)\:\/\/(.{5,})$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a full URL ( starting with http or https ).", "s2member-front", "s2member")); ?>'}else{if(j==="domain"&&!q.match(/^([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a domain name ( domain name only, without http ).", "s2member-front", "s2member")); ?>'}else{if(j==="phone"&&(!q.match(/^[0-9 \(\)\-]+$/)||q.replace(/[^0-9]/g,"").length!==10)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a phone # ( 10 digits w/possible hyphens,spaces,brackets ).", "s2member-front", "s2member")); ?>'}else{if(j==="uszip"&&!q.match(/^[0-9]{5}(-[0-9]{4})?$/)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a US zipcode ( 5-9 digits w/possible hyphen ).", "s2member-front", "s2member")); ?>'}else{if(j==="cazip"&&!q.match(/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a Canadian zipcode ( 6 alpha-numerics w/possible space ).", "s2member-front", "s2member")); ?>'}else{if(j==="uczip"&&!q.match(/^[0-9]{5}(-[0-9]{4})?$/)&&!q.match(/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a zipcode ( either a US or Canadian zipcode ).", "s2member-front", "s2member")); ?>'}else{if(j.match(/^alphanumerics-spaces-punctuation-([0-9]+)(-e)?$/)&&!q.match(/^[a-z 0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics, spaces & punctuation only.", "s2member-front", "s2member")); ?>'}else{if(j.match(/^alphanumerics-spaces-([0-9]+)(-e)?$/)&&!q.match(/^[a-z 0-9]+$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics & spaces only.", "s2member-front", "s2member")); ?>'}else{if(j.match(/^alphanumerics-punctuation-([0-9]+)(-e)?$/)&&!q.match(/^[a-z0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics & punctuation only ( no spaces ).", "s2member-front", "s2member")); ?>'}else{if(j.match(/^alphanumerics-([0-9]+)(-e)?$/)&&!q.match(/^[a-z0-9]+$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics only ( no spaces/punctuation ).", "s2member-front", "s2member")); ?>'}else{if(j.match(/^alphabetics-([0-9]+)(-e)?$/)&&!q.match(/^[a-z]+$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphabetics only ( no digits/spaces/punctuation ).", "s2member-front", "s2member")); ?>'}else{if(j.match(/^numerics-([0-9]+)(-e)?$/)&&!q.match(/^[0-9]+$/i)){return p+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use numeric digits only.", "s2member-front", "s2member")); ?>'}else{if(j.match(/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/)){var l=j.split("-"),f=Number(l[1]),h=(l.length>2)?Number(l[2]):"";if(h&&q.length!==f){return p+"\n"+b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be exactly %s %s.", "s2member-front", "s2member")); ?>',f,((l[0]==="numerics")?((f===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digit", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digits", "s2member-front", "s2member")); ?>'):((f===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("character", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("characters", "s2member-front", "s2member")); ?>')))}else{if(q.length<f){return p+"\n"+b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be at least %s %s.", "s2member-front", "s2member")); ?>',f,((l[0]==="numerics")?((f===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digit", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digits", "s2member-front", "s2member")); ?>'):((f===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("character", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("characters", "s2member-front", "s2member")); ?>')))}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return""};ws_plugin__s2member_animateProcessingConfig={originalText:"",interval:null,speed:100},ws_plugin__s2member_animateProcessing=function(e,d){if(e instanceof jQuery){if(d){clearInterval(ws_plugin__s2member_animateProcessingConfig.interval);if(ws_plugin__s2member_animateProcessingConfig.originalText){e.val(ws_plugin__s2member_animateProcessingConfig.originalText)}return}e.first().each(function(){var h=b(this),g=0,f="r",j=[".","..","..."];ws_plugin__s2member_animateProcessingConfig.originalText=h.val();clearInterval(ws_plugin__s2member_animateProcessingConfig.interval);ws_plugin__s2member_animateProcessingConfig.interval=setInterval(function(){if(f==="r"){if(g+1<=j.length-1){g=g+1,f="r"}else{g=g-1,f="l"}}else{if(f==="l"){if(g-1>=0){g=g-1,f="l"}else{g=g+1,f="r"}}}for(var k=j[g],i=j[g].length;i<j.length;i++){k+=" "}h.val('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Processing", "s2member-front", "s2member")); ?>'+k)},ws_plugin__s2member_animateProcessingConfig.speed)})}}});
1
+ jQuery(document).ready(function(b){ws_plugin__s2member_uniqueFilesDownloaded=[];var a='<?php echo c_ws_plugin__s2member_utils_conds::bp_is_installed ("query-active-plugins") ? "1" : ""; ?>';if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){b('a[href*="s2member_file_download"], a[href*="s2member-file"').click(function(){if(!this.href.match(/s2member_file_download_key\=(.+)/i)){var d='<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Confirm File Download —", "s2member-front", "s2member")); ?>\n\n';d+=b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`ve downloaded %s protected %s in the last %s.", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY,((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("file", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("files", "s2member-front", "s2member")); ?>'),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("24 hours", "s2member-front", "s2member")); ?>':b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("%s days", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)))+"\n\n";d+=(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to UNLIMITED downloads though ( so, no worries ).", "s2member-front", "s2member")); ?>':b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to %s unique %s %s.", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED,((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("download", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("downloads", "s2member-front", "s2member")); ?>'),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("each day", "s2member-front", "s2member")); ?>':b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("every %s-day period", "s2member-front", "s2member")); ?>',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));if(this.href.match(/s2member[_\-]skip[_\-]confirmation/i)&&!this.href.match(/s2member[_\-]skip[_\-]confirmation[\=\-](0|no|false)/i)||confirm(d)){if(b.inArray(this.href,ws_plugin__s2member_uniqueFilesDownloaded)===-1){ws_plugin__s2member_uniqueFilesDownloaded.push(this.href),S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++}return true}else{return false}}else{return true}})}if(!location.href.match(/\/wp-admin(\/|$)/)){b("input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2").keyup(function(){ws_plugin__s2member_passwordStrength(b("input#ws-plugin--s2member-profile-login"),b("input#ws-plugin--s2member-profile-password1"),b("input#ws-plugin--s2member-profile-password2"),b("div#ws-plugin--s2member-profile-password-strength"))});b("form#ws-plugin--s2member-profile").submit(function(){var e=this,d="",c="",i="";var g=b("input#ws-plugin--s2member-profile-password1",e);var f=b("input#ws-plugin--s2member-profile-password2",e);var h=b("input#ws-plugin--s2member-profile-submit",e);b(":input",e).each(function(){var j=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(j&&(d=b.trim(b('label[for="'+j+'"]',e).first().children("strong").first().text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){i+=c+"\n\n"}}});if(i=b.trim(i)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+i);return false}else{if(b.trim(g.val())&&b.trim(g.val())!==b.trim(f.val())){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Passwords do not match up. Please try again.", "s2member-front", "s2member")); ?>');return false}else{if(b.trim(g.val())&&b.trim(g.val()).length<6){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Password MUST be at least 6 characters. Please try again.", "s2member-front", "s2member")); ?>');return false}}}ws_plugin__s2member_animateProcessing(h);return true})}if(location.href.match(/\/wp-signup\.php/)){b("div#content > div.mu_register > form#setupform").submit(function(){var e=this,d="",c="",g="";b("input#user_email",e).attr("data-expected","email");var f=b('p.submit input[type="submit"]',e);b("input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code",e).attr({"aria-required":"true"});b(":input",e).each(function(){var h=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(h&&(d=b.trim(b('label[for="'+h+'"]',e).first().text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){g+=c+"\n\n"}}});if(g=b.trim(g)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+g);return false}ws_plugin__s2member_animateProcessing(f);return true})}if(location.href.match(/\/wp-login\.php/)){b("input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2").keyup(function(){ws_plugin__s2member_passwordStrength(b("input#user_login"),b("input#ws-plugin--s2member-custom-reg-field-user-pass1"),b("input#ws-plugin--s2member-custom-reg-field-user-pass2"),b("div#ws-plugin--s2member-custom-reg-field-user-pass-strength"))});b("div#login > form#registerform input#wp-submit").attr("tabindex","1000");b("div#login > form#registerform").submit(function(){var e=this,d="",c="",i="";b("input#user_email",e).attr("data-expected","email");var h=b('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]',e);var f=b("input#ws-plugin--s2member-custom-reg-field-user-pass2",e);var g=b("input#wp-submit",e);b("input#user_login, input#user_email, input#captcha_code",e).attr({"aria-required":"true"});b(":input",e).each(function(){var j=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(b.inArray(j,["user_login","user_email","captcha_code"])!==-1){if((d=b.trim(b(this).parent("label").text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){i+=c+"\n\n"}}}else{if(j&&(d=b.trim(b('label[for="'+j+'"]',e).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){i+=c+"\n\n"}}}});if(i=b.trim(i)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+i);return false}else{if(h.length&&b.trim(h.val())!==b.trim(f.val())){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Passwords do not match up. Please try again.", "s2member-front", "s2member")); ?>');return false}else{if(h.length&&b.trim(h.val()).length<6){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Password MUST be at least 6 characters. Please try again.", "s2member-front", "s2member")); ?>');return false}}}ws_plugin__s2member_animateProcessing(g);return true})}if(location.href.match(/\/wp-admin\/(user\/)?profile\.php/)){b("form#your-profile").submit(function(){var e=this,d="",c="",f="";b("input#email",e).attr("data-expected","email");b(':input[id^="ws-plugin--s2member-profile-"]',e).each(function(){var g=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(g&&(d=b.trim(b('label[for="'+g+'"]',e).first().text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){f+=c+"\n\n"}}});if(f=b.trim(f)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+f);return false}return true})}if(a){b("body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section").closest("form").submit(function(){var e=this,d="",c="",f="";b("input#signup_email",e).attr("data-expected","email");b("input#signup_username, input#signup_email, input#signup_password, input#field_1",e).attr({"aria-required":"true"});b(":input",e).each(function(){var g=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(g&&(d=b.trim(b('label[for="'+g+'"]',e).first().text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){f+=c+"\n\n"}}});if(f=b.trim(f)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+f);return false}return true});b('body.logged-in.profile.profile-edit input.ws-plugin--s2member-profile-field-4bp[type = "text"]').closest("form").submit(function(){var e=this,d="",c="",f="";b("input#field_1",e).attr({"aria-required":"true"});b(":input",e).each(function(){var g=b.trim(b(this).attr("id")).replace(/-[0-9]+$/g,"");if(g&&(d=b.trim(b('label[for="'+g+'"]',e).first().text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){f+=c+"\n\n"}}});if(f=b.trim(f)){alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>\n\n'+f);return false}return true})}ws_plugin__s2member_passwordStrength=function(d,f,e,c){if(d instanceof jQuery&&f instanceof jQuery&&e instanceof jQuery&&c instanceof jQuery&&typeof passwordStrength==="function"&&typeof pwsL10n==="object"){c.removeClass("ws-plugin--s2member-password-strength-short ws-plugin--s2member-password-strength-bad ws-plugin--s2member-password-strength-good ws-plugin--s2member-password-strength-strong ws-plugin--s2member-password-strength-mismatch");switch(passwordStrength(f.val(),d.val(),e.val())){case 1:c.addClass("ws-plugin--s2member-password-strength-short").html(pwsL10n["short"]);break;case 2:c.addClass("ws-plugin--s2member-password-strength-bad").html(pwsL10n.bad);break;case 3:c.addClass("ws-plugin--s2member-password-strength-good").html(pwsL10n.good);break;case 4:c.addClass("ws-plugin--s2member-password-strength-strong").html(pwsL10n.strong);break;case 5:c.addClass("ws-plugin--s2member-password-strength-mismatch").html(pwsL10n.mismatch);break;default:c.addClass("ws-plugin--s2member-password-strength-short").html(pwsL10n["short"])}}return};ws_plugin__s2member_validationErrors=function(o,n,d,j,i){if(typeof o==="string"&&o&&typeof n==="object"&&typeof d==="object"){if(typeof n.tagName==="string"&&n.tagName.match(/^(input|textarea|select)$/i)&&!n.disabled){var q=n.tagName.toLowerCase(),m=b(n),l=b.trim(m.attr("type")).toLowerCase(),c=b.trim(m.attr("name")),p=m.val();var j=(typeof j==="boolean")?j:(m.attr("aria-required")==="true"),i=(typeof i==="string")?i:b.trim(m.attr("data-expected"));var h=('<?php echo strlen($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_force_personal_emails"]); ?>'>0)?true:false;var f=new RegExp('^(<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (implode ("|", preg_split ("/[\r\n\t ;,]+/", preg_quote ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_force_personal_emails"], "/")))); ?>)@',"i");if(q==="input"&&l==="checkbox"&&c.match(/\[\]$/)){if(typeof n.id==="string"&&n.id.match(/-0$/)){if(j&&!b('input[name="'+c.replace(/([\[\]])/g,"$1")+'"]:checked',d).length){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please check at least one of the boxes.", "s2member-front", "s2member")); ?>'}}}else{if(q==="input"&&l==="checkbox"){if(j&&!n.checked){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Required. This box must be checked.", "s2member-front", "s2member")); ?>'}}else{if(q==="input"&&l==="radio"){if(typeof n.id==="string"&&n.id.match(/-0$/)){if(j&&!b('input[name="'+c.replace(/([\[\]])/g,"$1")+'"]:checked',d).length){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please select one of the options.", "s2member-front", "s2member")); ?>'}}}else{if(q==="select"&&m.attr("multiple")){if(j&&(!(p instanceof Array)||!p.length)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please select at least one of the options.", "s2member-front", "s2member")); ?>'}}else{if(typeof p!=="string"||(j&&!(p=b.trim(p)).length)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("This is a required field, please try again.", "s2member-front", "s2member")); ?>'}else{if((p=b.trim(p)).length&&((q==="input"&&l.match(/^(text|password)$/i))||q==="textarea")&&typeof i==="string"&&i.length){if(i==="numeric-wp-commas"&&(!p.match(/^[0-9\.,]+$/)||isNaN(p.replace(/,/g,"")))){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be numeric ( with or without decimals, commas allowed ).", "s2member-front", "s2member")); ?>'}else{if(i==="numeric"&&(!p.match(/^[0-9\.]+$/)||isNaN(p))){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be numeric ( with or without decimals, no commas ).", "s2member-front", "s2member")); ?>'}else{if(i==="integer"&&(!p.match(/^[0-9]+$/)||isNaN(p))){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be an integer ( a whole number, without any decimals ).", "s2member-front", "s2member")); ?>'}else{if(i==="integer-gt-0"&&(!p.match(/^[0-9]+$/)||isNaN(p)||p<=0)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be an integer > 0 ( whole number, no decimals, greater than 0 ).", "s2member-front", "s2member")); ?>'}else{if(i==="float"&&(!p.match(/^[0-9\.]+$/)||!p.match(/[0-9]/)||!p.match(/\./)||isNaN(p))){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a float ( floating point number, decimals required ).", "s2member-front", "s2member")); ?>'}else{if(i==="float-gt-0"&&(!p.match(/^[0-9\.]+$/)||!p.match(/[0-9]/)||!p.match(/\./)||isNaN(p)||p<=0)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a float > 0 ( floating point number, decimals required, greater than 0 ).", "s2member-front", "s2member")); ?>'}else{if(i==="date"&&!p.match(/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a date ( required date format: dd/mm/yyyy ).", "s2member-front", "s2member")); ?>'}else{if(i==="email"&&!p.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})$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a valid email address.", "s2member-front", "s2member")); ?>'}else{if(i==="email"&&h&&p.match(f)){return o+"\n"+b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use a personal email address.\nAddresses like <%s@> are problematic.", "s2member-front", "s2member")); ?>',p.split("@")[0])}else{if(i==="url"&&!p.match(/^http(s?)\:\/\/(.{5,})$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a full URL ( starting with http or https ).", "s2member-front", "s2member")); ?>'}else{if(i==="domain"&&!p.match(/^([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a domain name ( domain name only, without http ).", "s2member-front", "s2member")); ?>'}else{if(i==="phone"&&(!p.match(/^[0-9 \(\)\-]+$/)||p.replace(/[^0-9]/g,"").length!==10)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a phone # ( 10 digits w/possible hyphens,spaces,brackets ).", "s2member-front", "s2member")); ?>'}else{if(i==="uszip"&&!p.match(/^[0-9]{5}(-[0-9]{4})?$/)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a US zipcode ( 5-9 digits w/possible hyphen ).", "s2member-front", "s2member")); ?>'}else{if(i==="cazip"&&!p.match(/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a Canadian zipcode ( 6 alpha-numerics w/possible space ).", "s2member-front", "s2member")); ?>'}else{if(i==="uczip"&&!p.match(/^[0-9]{5}(-[0-9]{4})?$/)&&!p.match(/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be a zipcode ( either a US or Canadian zipcode ).", "s2member-front", "s2member")); ?>'}else{if(i.match(/^alphanumerics-spaces-punctuation-([0-9]+)(-e)?$/)&&!p.match(/^[a-z 0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics, spaces & punctuation only.", "s2member-front", "s2member")); ?>'}else{if(i.match(/^alphanumerics-spaces-([0-9]+)(-e)?$/)&&!p.match(/^[a-z 0-9]+$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics & spaces only.", "s2member-front", "s2member")); ?>'}else{if(i.match(/^alphanumerics-punctuation-([0-9]+)(-e)?$/)&&!p.match(/^[a-z0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics & punctuation only ( no spaces ).", "s2member-front", "s2member")); ?>'}else{if(i.match(/^alphanumerics-([0-9]+)(-e)?$/)&&!p.match(/^[a-z0-9]+$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphanumerics only ( no spaces/punctuation ).", "s2member-front", "s2member")); ?>'}else{if(i.match(/^alphabetics-([0-9]+)(-e)?$/)&&!p.match(/^[a-z]+$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use alphabetics only ( no digits/spaces/punctuation ).", "s2member-front", "s2member")); ?>'}else{if(i.match(/^numerics-([0-9]+)(-e)?$/)&&!p.match(/^[0-9]+$/i)){return o+'\n<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Please use numeric digits only.", "s2member-front", "s2member")); ?>'}else{if(i.match(/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/)){var k=i.split("-"),e=Number(k[1]),g=(k.length>2&&k[2]==="e")?true:false;if(g&&p.length!==e){return o+"\n"+b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be exactly %s %s.", "s2member-front", "s2member")); ?>',e,((k[0]==="numerics")?((e===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digit", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digits", "s2member-front", "s2member")); ?>'):((e===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("character", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("characters", "s2member-front", "s2member")); ?>')))}else{if(p.length<e){return o+"\n"+b.sprintf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be at least %s %s.", "s2member-front", "s2member")); ?>',e,((k[0]==="numerics")?((e===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digit", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digits", "s2member-front", "s2member")); ?>'):((e===1)?'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("character", "s2member-front", "s2member")); ?>':'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("characters", "s2member-front", "s2member")); ?>')))}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return""};ws_plugin__s2member_animateProcessingConfig={originalText:"",interval:null,speed:100},ws_plugin__s2member_animateProcessing=function(d,c){if(d instanceof jQuery){if(c){clearInterval(ws_plugin__s2member_animateProcessingConfig.interval);if(ws_plugin__s2member_animateProcessingConfig.originalText){d.val(ws_plugin__s2member_animateProcessingConfig.originalText)}return}d.first().each(function(){var g=b(this),f=0,e="r",h=[".","..","..."];ws_plugin__s2member_animateProcessingConfig.originalText=g.val();clearInterval(ws_plugin__s2member_animateProcessingConfig.interval);ws_plugin__s2member_animateProcessingConfig.interval=setInterval(function(){if(e==="r"){if(f+1<=h.length-1){f=f+1,e="r"}else{f=f-1,e="l"}}else{if(e==="l"){if(f-1>=0){f=f-1,e="l"}else{f=f+1,e="r"}}}for(var j=h[f],i=h[f].length;i<h.length;i++){j+=" "}g.val('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Processing", "s2member-front", "s2member")); ?>'+j)},ws_plugin__s2member_animateProcessingConfig.speed)})}}});
includes/s2member.js CHANGED
@@ -24,8 +24,7 @@ jQuery(document).ready (function($)
24
  ws_plugin__s2member_uniqueFilesDownloaded = []; /* Real-time counts. */
25
  /* This is used in case a user downloads multiple files from a single page. */
26
  /**/
27
- var bpRegisterSlug = '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (preg_quote ((c_ws_plugin__s2member_utils_conds::bp_is_installed ()) ? "/" . ltrim (BP_REGISTER_SLUG,"/") : "register"), "/"); ?>';
28
- var bpxProfileSlug = '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (preg_quote ((c_ws_plugin__s2member_utils_conds::bp_is_installed ()) ? "/" . ltrim (BP_XPROFILE_SLUG,"/") : "profile"), "/"); ?>';
29
  /**/
30
  if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED)
31
  {
@@ -37,7 +36,7 @@ jQuery(document).ready (function($)
37
  c += $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`ve downloaded %s protected %s in the last %s.", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY, ((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("file", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("files", "s2member-front", "s2member")); ?>'), ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("24 hours", "s2member-front", "s2member")); ?>' : $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("%s days", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS))) + '\n\n';
38
  c += (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to UNLIMITED downloads though ( so, no worries ).", "s2member-front", "s2member")); ?>' : $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to %s unique %s %s.", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED, ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("download", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("downloads", "s2member-front", "s2member")); ?>'), ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("each day", "s2member-front", "s2member")); ?>' : $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("every %s-day period", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));
39
  /**/
40
- if (this.href.match (/s2member_skip_confirmation/i) || confirm(c))
41
  {
42
  if ($.inArray (this.href, ws_plugin__s2member_uniqueFilesDownloaded) === -1)
43
  ws_plugin__s2member_uniqueFilesDownloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++;
@@ -54,7 +53,7 @@ jQuery(document).ready (function($)
54
  Deals with form field validation on Profile editing panels.
55
  `[s2Member-Profile /]` could appear on any Post/Page/Widget.
56
  */
57
- if (!location.href.match (/\/wp-admin\//))
58
  {
59
  $('input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2').keyup (function()
60
  {
@@ -95,6 +94,13 @@ jQuery(document).ready (function($)
95
  return false;
96
  }
97
  /**/
 
 
 
 
 
 
 
98
  ws_plugin__s2member_animateProcessing($submissionButton);
99
  /**/
100
  return true;
@@ -141,7 +147,7 @@ jQuery(document).ready (function($)
141
  /*
142
  Attach form submission handler to `/wp-login.php?action=register`.
143
  */
144
- else if (location.href.match (/\/wp-login\.php/))
145
  {
146
  $('input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2').keyup (function()
147
  {
@@ -196,6 +202,13 @@ jQuery(document).ready (function($)
196
  return false;
197
  }
198
  /**/
 
 
 
 
 
 
 
199
  ws_plugin__s2member_animateProcessing($submissionButton);
200
  /**/
201
  return true;
@@ -204,7 +217,7 @@ jQuery(document).ready (function($)
204
  /*
205
  Attach form submission handler to `/wp-admin/(user/)?profile.php`.
206
  */
207
- else if (location.href.match (/\/wp-admin\/(user\/)?profile\.php/))
208
  {
209
  $('form#your-profile').submit (function() /* Validation. */
210
  {
@@ -234,9 +247,9 @@ jQuery(document).ready (function($)
234
  });
235
  }
236
  /*
237
- Attach form submission handler to `/register` for BuddyPress.
238
  */
239
- else if (bpRegisterSlug && location.href.match (bpRegisterSlug))
240
  {
241
  $('body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section').closest ('form').submit (function()
242
  {
@@ -266,12 +279,9 @@ jQuery(document).ready (function($)
266
  /**/
267
  return true;
268
  });
269
- }
270
- /*
271
- Attach form submission handler to `/profile/edit/` for BuddyPress.
272
- */
273
- else if (bpxProfileSlug && location.href.match (bpxProfileSlug) && location.href.match (/\/edit\//))
274
- {
275
  $('body.logged-in.profile.profile-edit input.ws-plugin--s2member-profile-field-4bp[type = "text"]').closest ('form').submit (function()
276
  {
277
  var context = this, label = '', error = '', errors = '';
@@ -460,7 +470,7 @@ jQuery(document).ready (function($)
460
  }
461
  else if (expected.match (/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/))
462
  {
463
- var split = expected.split ('-'), length = Number(split[1]), exactLength = (split.length > 2) ? Number(split[2]) : '';
464
  /**/
465
  if (exactLength && value.length !== length) /* An exact length is required? */
466
  return label + '\n' + $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be exactly %s %s.", "s2member-front", "s2member")); ?>', length, ((split[0] === 'numerics') ? ((length === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digit", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digits", "s2member-front", "s2member")); ?>') : ((length === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("character", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("characters", "s2member-front", "s2member")); ?>')));
24
  ws_plugin__s2member_uniqueFilesDownloaded = []; /* Real-time counts. */
25
  /* This is used in case a user downloads multiple files from a single page. */
26
  /**/
27
+ var runningBuddyPress = '<?php echo c_ws_plugin__s2member_utils_conds::bp_is_installed ("query-active-plugins") ? "1" : ""; ?>';
 
28
  /**/
29
  if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED)
30
  {
36
  c += $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`ve downloaded %s protected %s in the last %s.", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY, ((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("file", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("files", "s2member-front", "s2member")); ?>'), ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("24 hours", "s2member-front", "s2member")); ?>' : $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("%s days", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS))) + '\n\n';
37
  c += (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to UNLIMITED downloads though ( so, no worries ).", "s2member-front", "s2member")); ?>' : $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("You`re entitled to %s unique %s %s.", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED, ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("download", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("downloads", "s2member-front", "s2member")); ?>'), ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("each day", "s2member-front", "s2member")); ?>' : $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("every %s-day period", "s2member-front", "s2member")); ?>', S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));
38
  /**/
39
+ if (this.href.match (/s2member[_\-]skip[_\-]confirmation/i) && !this.href.match (/s2member[_\-]skip[_\-]confirmation[\=\-](0|no|false)/i) || confirm(c))
40
  {
41
  if ($.inArray (this.href, ws_plugin__s2member_uniqueFilesDownloaded) === -1)
42
  ws_plugin__s2member_uniqueFilesDownloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++;
53
  Deals with form field validation on Profile editing panels.
54
  `[s2Member-Profile /]` could appear on any Post/Page/Widget.
55
  */
56
+ if (!location.href.match (/\/wp-admin(\/|$)/))
57
  {
58
  $('input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2').keyup (function()
59
  {
94
  return false;
95
  }
96
  /**/
97
+ else if ($.trim ($password1.val ()) && $.trim ($password1.val ()).length < 6) /* Enforce minimum length requirement here. */
98
+ {
99
+ alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>' + '\n\n' + '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Password MUST be at least 6 characters. Please try again.", "s2member-front", "s2member")); ?>');
100
+ /**/
101
+ return false;
102
+ }
103
+ /**/
104
  ws_plugin__s2member_animateProcessing($submissionButton);
105
  /**/
106
  return true;
147
  /*
148
  Attach form submission handler to `/wp-login.php?action=register`.
149
  */
150
+ if (location.href.match (/\/wp-login\.php/))
151
  {
152
  $('input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2').keyup (function()
153
  {
202
  return false;
203
  }
204
  /**/
205
+ else if ($pass1.length && $.trim ($pass1.val ()).length < 6) /* Enforce minimum length requirement here. */
206
+ {
207
+ alert('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("— Oops, you missed something: —", "s2member-front", "s2member")); ?>' + '\n\n' + '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Password MUST be at least 6 characters. Please try again.", "s2member-front", "s2member")); ?>');
208
+ /**/
209
+ return false;
210
+ }
211
+ /**/
212
  ws_plugin__s2member_animateProcessing($submissionButton);
213
  /**/
214
  return true;
217
  /*
218
  Attach form submission handler to `/wp-admin/(user/)?profile.php`.
219
  */
220
+ if (location.href.match (/\/wp-admin\/(user\/)?profile\.php/))
221
  {
222
  $('form#your-profile').submit (function() /* Validation. */
223
  {
247
  });
248
  }
249
  /*
250
+ We can ONLY check if BuddyPress is installed. We can't test BP slugs inside: `/s2member-o.php`.
251
  */
252
+ if (runningBuddyPress) /* Attach form submission handler to `/register` for BuddyPress. */
253
  {
254
  $('body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section').closest ('form').submit (function()
255
  {
279
  /**/
280
  return true;
281
  });
282
+ /*
283
+ Attach form submission handler to `/profile/edit/` for BuddyPress.
284
+ */
 
 
 
285
  $('body.logged-in.profile.profile-edit input.ws-plugin--s2member-profile-field-4bp[type = "text"]').closest ('form').submit (function()
286
  {
287
  var context = this, label = '', error = '', errors = '';
470
  }
471
  else if (expected.match (/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/))
472
  {
473
+ var split = expected.split ('-'), length = Number(split[1]), exactLength = (split.length > 2 && split[2] === 'e') ? true : false;
474
  /**/
475
  if (exactLength && value.length !== length) /* An exact length is required? */
476
  return label + '\n' + $.sprintf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Must be exactly %s %s.", "s2member-front", "s2member")); ?>', length, ((split[0] === 'numerics') ? ((length === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digit", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("digits", "s2member-front", "s2member")); ?>') : ((length === 1) ? '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("character", "s2member-front", "s2member")); ?>' : '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("characters", "s2member-front", "s2member")); ?>')));
includes/syscon.inc.php CHANGED
@@ -18,7 +18,7 @@
18
  * @since 3.0
19
  */
20
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
21
- exit ("Do not access this file directly.");
22
  /*
23
  Determine the directory.
24
  */
@@ -58,6 +58,10 @@ Configure multibyte detection order when charset is unknown ( used by calls to `
58
  */
59
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["mb_detection_order"] = "UTF-8, ISO-8859-1, WINDOWS-1252, ASCII, JIS, EUC-JP, SJIS";
60
  /*
 
 
 
 
61
  Configure directory and .htaccess for files protected by s2Member.
62
  */
63
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] = apply_filters ("ws_plugin__s2member_files_dir", dirname (dirname (__FILE__)) . "-files" . ((stripos (PHP_OS, "win") === 0 && (!function_exists ("apache_get_version") || apache_get_version () === false)) ? "/app_data" : ""));
@@ -182,11 +186,11 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
182
  $default_options["new_user_emails_enabled"] = "0";
183
  /**/
184
  $default_options["new_user_email_subject"] = sprintf (_x ("[%s] Username/Password", "s2member-front", "s2member"), get_bloginfo ("name"));
185
- $default_options["new_user_email_message"] = sprintf (_x ("Your Username/Password for:\n%s\n\nUsername: %%user_login%%\nPassword: %%user_pass%%\n%%wp_login_url%%", "s2member-front", "s2member"), get_bloginfo ("name"));
186
  /**/
187
  $default_options["new_user_admin_email_recipients"] = get_bloginfo ("admin_email");
188
  $default_options["new_user_admin_email_subject"] = sprintf (_x ("[%s] New User Registration", "s2member-front", "s2member"), get_bloginfo ("name"));
189
- $default_options["new_user_admin_email_message"] = sprintf (_x ("New User Registration on your site:\n%s\n\nUser ID: %%user_id%%\nUsername: %%user_login%%\nEmail: %%user_email%%\nIP Address: %%user_ip%%", "s2member-front", "s2member"), get_bloginfo ("name"));
190
  /**/
191
  $default_options["paypal_sandbox"] = "0";
192
  $default_options["paypal_business"] = "";
@@ -203,11 +207,11 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
203
  /**/
204
  $default_options["signup_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
205
  $default_options["signup_email_subject"] = _x ("Congratulations! ( your membership has been approved )", "s2member-front", "s2member");
206
- $default_options["signup_email_message"] = sprintf (_x ("Thanks %%first_name%%! Your membership has been approved.\n\nIf you haven't already done so, the next step is to Register a Username.\n\nComplete your registration here:\n%%registration_url%%\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo ("name"));
207
  /**/
208
  $default_options["sp_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
209
  $default_options["sp_email_subject"] = _x ("Thank You! ( instructions for access )", "s2member-front", "s2member");
210
- $default_options["sp_email_message"] = sprintf (_x ("Thanks %%first_name%%!\n\n%%item_name%%\n\nYour order can be retrieved here:\n%%sp_access_url%%\n( link expires in %%sp_access_exp%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo ("name"));
211
  /**/
212
  $default_options["mailchimp_api_key"] = "";
213
  /**/
@@ -250,11 +254,24 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
250
  /**/
251
  $default_options["file_download_limit_exceeded_page"] = "";
252
  $default_options["file_download_inline_extensions"] = "";
 
253
  /**/
254
  $default_options["amazon_s3_files_bucket"] = "";
255
  $default_options["amazon_s3_files_access_key"] = "";
256
  $default_options["amazon_s3_files_secret_key"] = "";
257
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
258
  for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
259
  $default_options["level" . $n . "_ruris"] = "";
260
  /**/
@@ -316,7 +333,7 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
316
  foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
317
  {
318
  if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
319
- unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
320
  /**/
321
  else if ($key === "options_checksum" && (!is_string ($value) || !strlen ($value)))
322
  $value = $default_options[$key];
@@ -468,10 +485,10 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
468
  else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
469
  $value = $default_options[$key];
470
  /**/
471
- else if ($key === "file_download_inline_extensions" && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
472
  $value = $default_options[$key];
473
  /**/
474
- else if (preg_match ("/^amazon_s3_files_(bucket|access_key|secret_key)$/", $key) && (!is_string ($value) || !strlen ($value)))
475
  $value = $default_options[$key];
476
  /**/
477
  else if (preg_match ("/^level[0-9]+_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
18
  * @since 3.0
19
  */
20
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
21
+ exit("Do not access this file directly.");
22
  /*
23
  Determine the directory.
24
  */
58
  */
59
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["mb_detection_order"] = "UTF-8, ISO-8859-1, WINDOWS-1252, ASCII, JIS, EUC-JP, SJIS";
60
  /*
61
+ Configure an array of file extensions associated with streaming media file types. See: <http://www.spartanicus.utvinternet.ie/streaming.htm> Also see: <http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12539/supported-video-and-audio-formats>
62
+ */
63
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"] = array_unique (array ("wav", "mpa", "mpeg", "mpv", "mps", "m1v", "m2v", "mp4"/**/, "mp3", "m3u"/**/, "mp4", "flv", "f4v", "3gp", "3g2", "aac", "m4a"/**/, "webm"/**/, "ogg", "ogv", "pls", "m3u", "ogm", "m4u"/**/, "mov", "qtl", "mp4"/**/, "asf", "wmv", "wvx", "wma", "wax"/**/, "ra", "rm", "ram"));
64
+ /*
65
  Configure directory and .htaccess for files protected by s2Member.
66
  */
67
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] = apply_filters ("ws_plugin__s2member_files_dir", dirname (dirname (__FILE__)) . "-files" . ((stripos (PHP_OS, "win") === 0 && (!function_exists ("apache_get_version") || apache_get_version () === false)) ? "/app_data" : ""));
186
  $default_options["new_user_emails_enabled"] = "0";
187
  /**/
188
  $default_options["new_user_email_subject"] = sprintf (_x ("[%s] Username/Password", "s2member-front", "s2member"), get_bloginfo ("name"));
189
+ $default_options["new_user_email_message"] = sprintf (_x ("Your Username/Password for:\n%s\n\nUsername: %%%%user_login%%%%\nPassword: %%%%user_pass%%%%\n%%%%wp_login_url%%%%", "s2member-front", "s2member"), get_bloginfo ("name"));
190
  /**/
191
  $default_options["new_user_admin_email_recipients"] = get_bloginfo ("admin_email");
192
  $default_options["new_user_admin_email_subject"] = sprintf (_x ("[%s] New User Registration", "s2member-front", "s2member"), get_bloginfo ("name"));
193
+ $default_options["new_user_admin_email_message"] = sprintf (_x ("New User Registration on your site:\n%s\n\nUser ID: %%%%user_id%%%%\nUsername: %%%%user_login%%%%\nEmail: %%%%user_email%%%%\nIP Address: %%%%user_ip%%%%", "s2member-front", "s2member"), get_bloginfo ("name"));
194
  /**/
195
  $default_options["paypal_sandbox"] = "0";
196
  $default_options["paypal_business"] = "";
207
  /**/
208
  $default_options["signup_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
209
  $default_options["signup_email_subject"] = _x ("Congratulations! ( your membership has been approved )", "s2member-front", "s2member");
210
+ $default_options["signup_email_message"] = sprintf (_x ("Thanks %%%%first_name%%%%! Your membership has been approved.\n\nIf you haven't already done so, the next step is to Register a Username.\n\nComplete your registration here:\n%%%%registration_url%%%%\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo ("name"));
211
  /**/
212
  $default_options["sp_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
213
  $default_options["sp_email_subject"] = _x ("Thank You! ( instructions for access )", "s2member-front", "s2member");
214
+ $default_options["sp_email_message"] = sprintf (_x ("Thanks %%%%first_name%%%%!\n\n%%%%item_name%%%%\n\nYour order can be retrieved here:\n%%%%sp_access_url%%%%\n( link expires in %%%%sp_access_exp%%%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo ("name"));
215
  /**/
216
  $default_options["mailchimp_api_key"] = "";
217
  /**/
254
  /**/
255
  $default_options["file_download_limit_exceeded_page"] = "";
256
  $default_options["file_download_inline_extensions"] = "";
257
+ $default_options["file_download_stream_extensions"] = "";
258
  /**/
259
  $default_options["amazon_s3_files_bucket"] = "";
260
  $default_options["amazon_s3_files_access_key"] = "";
261
  $default_options["amazon_s3_files_secret_key"] = "";
262
  /**/
263
+ $default_options["amazon_cf_files_private_key"] = "";
264
+ $default_options["amazon_cf_files_private_key_id"] = "";
265
+ $default_options["amazon_cf_files_distros_access_id"] = "";
266
+ $default_options["amazon_cf_files_distros_s3_access_id"] = "";
267
+ $default_options["amazon_cf_files_distro_downloads_id"] = "";
268
+ $default_options["amazon_cf_files_distro_downloads_cname"] = "";
269
+ $default_options["amazon_cf_files_distro_downloads_dname"] = "";
270
+ $default_options["amazon_cf_files_distro_streaming_id"] = "";
271
+ $default_options["amazon_cf_files_distro_streaming_cname"] = "";
272
+ $default_options["amazon_cf_files_distro_streaming_dname"] = "";
273
+ $default_options["amazon_cf_files_distros_auto_config_status"] = "";
274
+ /**/
275
  for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
276
  $default_options["level" . $n . "_ruris"] = "";
277
  /**/
333
  foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
334
  {
335
  if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
336
+ unset($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
337
  /**/
338
  else if ($key === "options_checksum" && (!is_string ($value) || !strlen ($value)))
339
  $value = $default_options[$key];
485
  else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
486
  $value = $default_options[$key];
487
  /**/
488
+ else if (preg_match ("/^file_download_(inline|stream)_extensions$/", $key) && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
489
  $value = $default_options[$key];
490
  /**/
491
+ else if (preg_match ("/^amazon_(s3|cf)_files_/", $key) && (!is_string ($value) || !strlen ($value)))
492
  $value = $default_options[$key];
493
  /**/
494
  else if (preg_match ("/^level[0-9]+_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
includes/templates/cfg-files/s2-cross-xml.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
3
+ exit("Do not access this file directly.");
4
+ ?>
5
+
6
+ <?xml version="1.0"?>
7
+ <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
8
+ <cross-domain-policy>
9
+ <allow-access-from domain="*" />
10
+ </cross-domain-policy>
includes/templates/cfg-files/s2member-files.php CHANGED
@@ -21,11 +21,11 @@ Options +FollowSymLinks -MultiViews
21
  RewriteCond %{ENV:s2member_file_download_scan} !^complete$
22
  RewriteRule ^(.*)$ - [E=s2member_file_download_scan:complete,E=s2member_file_download:$1]
23
 
24
- RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-remote/)(.+)$
25
- RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_file_remote:&s2member_file_remote=yes]
26
 
27
- RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-remote-(.+?)/)(.+)$
28
- RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_remote:&s2member_file_remote=%2]
29
 
30
  RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-inline/)(.+)$
31
  RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_file_inline:&s2member_file_inline=yes]
@@ -33,10 +33,31 @@ Options +FollowSymLinks -MultiViews
33
  RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-inline-(.+?)/)(.+)$
34
  RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_inline:&s2member_file_inline=%2]
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-download-key-(.+?)/)(.+)$
37
  RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_download_key:&s2member_file_download_key=%2]
38
 
39
- RewriteRule ^(.*)$ %{ENV:s2_blog}?s2member_file_download=%{ENV:s2member_file_download}%{ENV:s2member_file_inline}%{ENV:s2member_file_download_key}%{ENV:s2member_file_remote} [QSA,L]
 
 
 
 
 
 
40
  </IfModule>
41
 
42
  <IfModule !mod_rewrite.c>
21
  RewriteCond %{ENV:s2member_file_download_scan} !^complete$
22
  RewriteRule ^(.*)$ - [E=s2member_file_download_scan:complete,E=s2member_file_download:$1]
23
 
24
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-stream/)(.+)$
25
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_file_stream:&s2member_file_stream=yes]
26
 
27
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-stream-(.+?)/)(.+)$
28
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_stream:&s2member_file_stream=%2]
29
 
30
  RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-inline/)(.+)$
31
  RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_file_inline:&s2member_file_inline=yes]
33
  RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-inline-(.+?)/)(.+)$
34
  RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_inline:&s2member_file_inline=%2]
35
 
36
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-storage-(.+?)/)(.+)$
37
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_storage:&s2member_file_storage=%2]
38
+
39
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-remote/)(.+)$
40
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_file_remote:&s2member_file_remote=yes]
41
+
42
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-remote-(.+?)/)(.+)$
43
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_remote:&s2member_file_remote=%2]
44
+
45
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-ssl/)(.+)$
46
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_file_ssl:&s2member_file_ssl=yes]
47
+
48
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-ssl-(.+?)/)(.+)$
49
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_ssl:&s2member_file_ssl=%2]
50
+
51
  RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-download-key-(.+?)/)(.+)$
52
  RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_file_download_key:&s2member_file_download_key=%2]
53
 
54
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-skip-confirmation/)(.+)$
55
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%2,E=s2member_skip_confirmation:&s2member_skip_confirmation=yes]
56
+
57
+ RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-skip-confirmation-(.+?)/)(.+)$
58
+ RewriteRule ^(.*)$ - [N,E=s2member_file_download:%1%3,E=s2member_skip_confirmation:&s2member_skip_confirmation=%2]
59
+
60
+ RewriteRule ^(.*)$ %{ENV:s2_blog}?s2member_file_download=%{ENV:s2member_file_download}%{ENV:s2member_file_stream}%{ENV:s2member_file_inline}%{ENV:s2member_file_storage}%{ENV:s2member_file_remote}%{ENV:s2member_file_ssl}%{ENV:s2member_file_download_key}%{ENV:s2member_skip_confirmation} [QSA,L]
61
  </IfModule>
62
 
63
  <IfModule !mod_rewrite.c>
includes/translations/s2member.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the s2Member package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: s2Member 110915\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/.__s2member\n"
7
- "POT-Creation-Date: 2011-09-15 19:04:31+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -71,37 +71,429 @@ msgctxt "s2member-front"
71
  msgid "password strength indicator"
72
  msgstr ""
73
 
74
- #: s2member/includes/classes/email-configs.inc.php:171
75
  msgctxt "s2member-front"
76
  msgid "as a Member"
77
  msgstr ""
78
 
79
- #: s2member/includes/classes/files-in.inc.php:61
80
- #: s2member/includes/classes/files-in.inc.php:155
81
  msgctxt "s2member-front"
82
  msgid "404: Sorry, file not found. Please contact Support for assistance."
83
  msgstr ""
84
 
85
- #: s2member/includes/classes/files-in.inc.php:66
86
  msgctxt "s2member-front"
87
  msgid "503 ( Invalid Key ): Sorry, your access to this file has expired. Please contact Support for assistance."
88
  msgstr ""
89
 
90
- #: s2member/includes/classes/files-in.inc.php:76
91
  msgctxt "s2member-front"
92
  msgid "503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`."
93
  msgstr ""
94
 
95
- #: s2member/includes/classes/files-in.inc.php:275
 
 
 
 
 
96
  msgctxt "s2member-front"
97
  msgid "Members Only"
98
  msgstr ""
99
 
100
- #: s2member/includes/classes/files-in.inc.php:277
101
  msgctxt "s2member-front"
102
  msgid "Access Denied"
103
  msgstr ""
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  #: s2member/includes/classes/ip-restrictions.inc.php:76
106
  #: s2member/includes/classes/ip-restrictions.inc.php:90
107
  msgctxt "s2member-front"
@@ -136,25 +528,25 @@ msgctxt "s2member-front"
136
  msgid "Thank you! You now have access to:"
137
  msgstr ""
138
 
139
- #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:61
140
  #: s2member/includes/classes/paypal-return-in-proxy-ty-email.inc.php:59
141
  msgctxt "s2member-front"
142
  msgid "<strong>Thank you! ( you MUST check your email before proceeding ).</strong><br /><br />* Note: It can take <em>( up to 15 minutes )</em> for Email Confirmation with important details. If you don't receive email confirmation in the next 15 minutes, please contact Support."
143
  msgstr ""
144
 
145
- #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:61
146
  #: s2member/includes/classes/paypal-return-in-proxy-ty-email.inc.php:59
147
  msgctxt "s2member-front"
148
  msgid "<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing)."
149
  msgstr ""
150
 
151
- #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:62
152
  #: s2member/includes/classes/paypal-return-in-proxy-ty-email.inc.php:60
153
  msgctxt "s2member-front"
154
  msgid "Check Your Email ( Then Click Here )"
155
  msgstr ""
156
 
157
- #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:62
158
  #: s2member/includes/classes/paypal-return-in-subscr-modify-w-level.inc.php:192
159
  #: s2member/includes/classes/paypal-return-in-subscr-modify-w-level.inc.php:203
160
  #: s2member/includes/classes/paypal-return-in-subscr-modify-w-level.inc.php:214
@@ -399,8 +791,8 @@ msgstr ""
399
  #: s2member/includes/templates/buttons/paypal-checkout-button.php:46
400
  #: s2member/includes/templates/buttons/paypal-sp-checkout-button.php:34
401
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
402
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:262
403
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:505
404
  msgctxt "s2member-front paypal-button-lang-code"
405
  msgid "en_US"
406
  msgstr ""
@@ -450,11 +842,13 @@ msgid "Your account is now active. <a href=\"%1$s\">Visit site</a> or <a href=\"
450
  msgstr ""
451
 
452
  #: s2member/includes/classes/translations.inc.php:143
 
453
  msgctxt "s2member-front"
454
  msgid "By filling out the form below, you can <strong>add a site to your account</strong>."
455
  msgstr ""
456
 
457
  #: s2member/includes/classes/translations.inc.php:143
 
458
  msgctxt "s2member-front"
459
  msgid "You may create up to <strong>%s</strong> site."
460
  msgid_plural "You may create up to <strong>%s</strong> sites."
@@ -725,71 +1119,72 @@ msgid_plural "for %1$s %3$s"
725
  msgstr[0] ""
726
  msgstr[1] ""
727
 
728
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:36
729
  msgctxt "s2member-front"
730
  msgid "— Confirm File Download —"
731
  msgstr ""
732
 
733
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
734
  msgctxt "s2member-front"
735
  msgid "You`ve downloaded %s protected %s in the last %s."
736
  msgstr ""
737
 
738
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
739
  msgctxt "s2member-front"
740
  msgid "file"
741
  msgstr ""
742
 
743
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
744
  msgctxt "s2member-front"
745
  msgid "files"
746
  msgstr ""
747
 
748
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
749
  msgctxt "s2member-front"
750
  msgid "24 hours"
751
  msgstr ""
752
 
753
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
754
  msgctxt "s2member-front"
755
  msgid "%s days"
756
  msgstr ""
757
 
758
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:38
759
  msgctxt "s2member-front"
760
  msgid "You`re entitled to UNLIMITED downloads though ( so, no worries )."
761
  msgstr ""
762
 
763
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:38
764
  msgctxt "s2member-front"
765
  msgid "You`re entitled to %s unique %s %s."
766
  msgstr ""
767
 
768
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:38
769
  msgctxt "s2member-front"
770
  msgid "download"
771
  msgstr ""
772
 
773
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:38
774
  msgctxt "s2member-front"
775
  msgid "downloads"
776
  msgstr ""
777
 
778
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:38
779
  msgctxt "s2member-front"
780
  msgid "each day"
781
  msgstr ""
782
 
783
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:38
784
  msgctxt "s2member-front"
785
  msgid "every %s-day period"
786
  msgstr ""
787
 
788
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:86
789
- #: s2member/includes/s2member.js:93 s2member/includes/s2member.js:131
790
- #: s2member/includes/s2member.js:187 s2member/includes/s2member.js:194
791
- #: s2member/includes/s2member.js:228 s2member/includes/s2member.js:262
792
- #: s2member/includes/s2member.js:294
 
793
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
794
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:66
795
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:73
@@ -798,11 +1193,13 @@ msgstr ""
798
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:232
799
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:239
800
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:246
801
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:446
802
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:453
803
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:674
804
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:681
805
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:688
 
 
806
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
807
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:66
808
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:73
@@ -811,255 +1208,269 @@ msgstr ""
811
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:232
812
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:239
813
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:246
814
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:481
815
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:488
816
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:744
817
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:751
818
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:758
 
 
819
  msgctxt "s2member-front"
820
  msgid "— Oops, you missed something: —"
821
  msgstr ""
822
 
823
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:93
824
- #: s2member/includes/s2member.js:194
825
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
826
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:239
827
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:681
828
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
829
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:239
830
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:751
831
  msgctxt "s2member-front"
832
  msgid "Passwords do not match up. Please try again."
833
  msgstr ""
834
 
835
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:353
 
 
 
 
 
 
 
 
 
 
 
 
836
  msgctxt "s2member-front"
837
  msgid "Please check at least one of the boxes."
838
  msgstr ""
839
 
840
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:358
841
  msgctxt "s2member-front"
842
  msgid "Required. This box must be checked."
843
  msgstr ""
844
 
845
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:364
846
  msgctxt "s2member-front"
847
  msgid "Please select one of the options."
848
  msgstr ""
849
 
850
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:369
851
  msgctxt "s2member-front"
852
  msgid "Please select at least one of the options."
853
  msgstr ""
854
 
855
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:373
856
  msgctxt "s2member-front"
857
  msgid "This is a required field, please try again."
858
  msgstr ""
859
 
860
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:379
861
  msgctxt "s2member-front"
862
  msgid "Must be numeric ( with or without decimals, commas allowed )."
863
  msgstr ""
864
 
865
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:383
866
  msgctxt "s2member-front"
867
  msgid "Must be numeric ( with or without decimals, no commas )."
868
  msgstr ""
869
 
870
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:387
871
  msgctxt "s2member-front"
872
  msgid "Must be an integer ( a whole number, without any decimals )."
873
  msgstr ""
874
 
875
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:391
876
  msgctxt "s2member-front"
877
  msgid "Must be an integer > 0 ( whole number, no decimals, greater than 0 )."
878
  msgstr ""
879
 
880
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:395
881
  msgctxt "s2member-front"
882
  msgid "Must be a float ( floating point number, decimals required )."
883
  msgstr ""
884
 
885
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:399
886
  msgctxt "s2member-front"
887
  msgid "Must be a float > 0 ( floating point number, decimals required, greater than 0 )."
888
  msgstr ""
889
 
890
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:403
891
  msgctxt "s2member-front"
892
  msgid "Must be a date ( required date format: dd/mm/yyyy )."
893
  msgstr ""
894
 
895
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:407
896
  msgctxt "s2member-front"
897
  msgid "Must be a valid email address."
898
  msgstr ""
899
 
900
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:411
901
  msgctxt "s2member-front"
902
  msgid ""
903
  "Please use a personal email address.\n"
904
  "Addresses like <%s@> are problematic."
905
  msgstr ""
906
 
907
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:415
908
  msgctxt "s2member-front"
909
  msgid "Must be a full URL ( starting with http or https )."
910
  msgstr ""
911
 
912
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:419
913
  msgctxt "s2member-front"
914
  msgid "Must be a domain name ( domain name only, without http )."
915
  msgstr ""
916
 
917
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:423
918
  msgctxt "s2member-front"
919
  msgid "Must be a phone # ( 10 digits w/possible hyphens,spaces,brackets )."
920
  msgstr ""
921
 
922
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:427
923
  msgctxt "s2member-front"
924
  msgid "Must be a US zipcode ( 5-9 digits w/possible hyphen )."
925
  msgstr ""
926
 
927
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:431
928
  msgctxt "s2member-front"
929
  msgid "Must be a Canadian zipcode ( 6 alpha-numerics w/possible space )."
930
  msgstr ""
931
 
932
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:435
933
  msgctxt "s2member-front"
934
  msgid "Must be a zipcode ( either a US or Canadian zipcode )."
935
  msgstr ""
936
 
937
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:439
938
  msgctxt "s2member-front"
939
  msgid "Please use alphanumerics, spaces & punctuation only."
940
  msgstr ""
941
 
942
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:443
943
  msgctxt "s2member-front"
944
  msgid "Please use alphanumerics & spaces only."
945
  msgstr ""
946
 
947
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:447
948
  msgctxt "s2member-front"
949
  msgid "Please use alphanumerics & punctuation only ( no spaces )."
950
  msgstr ""
951
 
952
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:451
953
  msgctxt "s2member-front"
954
  msgid "Please use alphanumerics only ( no spaces/punctuation )."
955
  msgstr ""
956
 
957
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:455
958
  msgctxt "s2member-front"
959
  msgid "Please use alphabetics only ( no digits/spaces/punctuation )."
960
  msgstr ""
961
 
962
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:459
963
  msgctxt "s2member-front"
964
  msgid "Please use numeric digits only."
965
  msgstr ""
966
 
967
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:466
968
  msgctxt "s2member-front"
969
  msgid "Must be exactly %s %s."
970
  msgstr ""
971
 
972
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:466
973
- #: s2member/includes/s2member.js:469
974
  msgctxt "s2member-front"
975
  msgid "digit"
976
  msgstr ""
977
 
978
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:466
979
- #: s2member/includes/s2member.js:469
980
  msgctxt "s2member-front"
981
  msgid "digits"
982
  msgstr ""
983
 
984
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:466
985
- #: s2member/includes/s2member.js:469
986
  msgctxt "s2member-front"
987
  msgid "character"
988
  msgstr ""
989
 
990
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:466
991
- #: s2member/includes/s2member.js:469
992
  msgctxt "s2member-front"
993
  msgid "characters"
994
  msgstr ""
995
 
996
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:469
997
  msgctxt "s2member-front"
998
  msgid "Must be at least %s %s."
999
  msgstr ""
1000
 
1001
- #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:522
1002
  msgctxt "s2member-front"
1003
  msgid "Processing"
1004
  msgstr ""
1005
 
1006
- #: s2member/includes/syscon.inc.php:73
1007
  msgctxt "s2member-front recaptcha-lang-code"
1008
  msgid "en"
1009
  msgstr ""
1010
 
1011
- #: s2member/includes/syscon.inc.php:136
1012
  msgctxt "s2member-front"
1013
  msgid "Yes, I want to receive updates via email."
1014
  msgstr ""
1015
 
1016
- #: s2member/includes/syscon.inc.php:184
1017
  msgctxt "s2member-front"
1018
  msgid "[%s] Username/Password"
1019
  msgstr ""
1020
 
1021
- #: s2member/includes/syscon.inc.php:185
1022
  msgctxt "s2member-front"
1023
  msgid ""
1024
  "Your Username/Password for:\n"
1025
  "%s\n"
1026
  "\n"
1027
- "Username: %%user_login%%\n"
1028
- "Password: %%user_pass%%\n"
1029
- "%%wp_login_url%%"
1030
  msgstr ""
1031
 
1032
- #: s2member/includes/syscon.inc.php:188
1033
  msgctxt "s2member-front"
1034
  msgid "[%s] New User Registration"
1035
  msgstr ""
1036
 
1037
- #: s2member/includes/syscon.inc.php:189
1038
  msgctxt "s2member-front"
1039
  msgid ""
1040
  "New User Registration on your site:\n"
1041
  "%s\n"
1042
  "\n"
1043
- "User ID: %%user_id%%\n"
1044
- "Username: %%user_login%%\n"
1045
- "Email: %%user_email%%\n"
1046
- "IP Address: %%user_ip%%"
1047
  msgstr ""
1048
 
1049
- #: s2member/includes/syscon.inc.php:205 s2member-pro/includes/syscon.inc.php:90
1050
  msgctxt "s2member-front"
1051
  msgid "Congratulations! ( your membership has been approved )"
1052
  msgstr ""
1053
 
1054
- #: s2member/includes/syscon.inc.php:206
1055
  msgctxt "s2member-front"
1056
  msgid ""
1057
- "Thanks %%first_name%%! Your membership has been approved.\n"
1058
  "\n"
1059
  "If you haven't already done so, the next step is to Register a Username.\n"
1060
  "\n"
1061
  "Complete your registration here:\n"
1062
- "%%registration_url%%\n"
1063
  "\n"
1064
  "If you have any trouble, please feel free to contact us.\n"
1065
  "\n"
@@ -1067,21 +1478,21 @@ msgid ""
1067
  "%s"
1068
  msgstr ""
1069
 
1070
- #: s2member/includes/syscon.inc.php:209 s2member-pro/includes/syscon.inc.php:94
1071
  msgctxt "s2member-front"
1072
  msgid "Thank You! ( instructions for access )"
1073
  msgstr ""
1074
 
1075
- #: s2member/includes/syscon.inc.php:210
1076
  msgctxt "s2member-front"
1077
  msgid ""
1078
- "Thanks %%first_name%%!\n"
1079
  "\n"
1080
- "%%item_name%%\n"
1081
  "\n"
1082
  "Your order can be retrieved here:\n"
1083
- "%%sp_access_url%%\n"
1084
- "( link expires in %%sp_access_exp%% )\n"
1085
  "\n"
1086
  "If you have any trouble, please feel free to contact us.\n"
1087
  "\n"
@@ -1089,32 +1500,32 @@ msgid ""
1089
  "%s"
1090
  msgstr ""
1091
 
1092
- #: s2member/includes/syscon.inc.php:240
1093
  msgctxt "s2member-front"
1094
  msgid "Free Subscriber"
1095
  msgstr ""
1096
 
1097
- #: s2member/includes/syscon.inc.php:240
1098
  msgctxt "s2member-front"
1099
  msgid "Bronze Member"
1100
  msgstr ""
1101
 
1102
- #: s2member/includes/syscon.inc.php:240
1103
  msgctxt "s2member-front"
1104
  msgid "Silver Member"
1105
  msgstr ""
1106
 
1107
- #: s2member/includes/syscon.inc.php:240
1108
  msgctxt "s2member-front"
1109
  msgid "Gold Member"
1110
  msgstr ""
1111
 
1112
- #: s2member/includes/syscon.inc.php:240
1113
  msgctxt "s2member-front"
1114
  msgid "Platinum Member"
1115
  msgstr ""
1116
 
1117
- #: s2member/includes/syscon.inc.php:241
1118
  msgctxt "s2member-front"
1119
  msgid "Level %s Member"
1120
  msgstr ""
@@ -2859,26 +3270,26 @@ msgctxt "s2member-front"
2859
  msgid "Error #%1$s. %2$s."
2860
  msgstr ""
2861
 
2862
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:701
2863
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:842
2864
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:272
2865
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:413
2866
  msgctxt "s2member-front percentage-symbol"
2867
  msgid "%"
2868
  msgstr ""
2869
 
2870
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:841
2871
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:412
2872
  msgctxt "s2member-front"
2873
  msgid " + tax"
2874
  msgstr ""
2875
 
2876
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:868
2877
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:912
2878
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:923
2879
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:943
2880
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:995
2881
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1008
2882
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:439
2883
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:483
2884
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:494
@@ -2889,12 +3300,12 @@ msgctxt "s2member-front"
2889
  msgid "COUPON %s off. ( Now: %s )"
2890
  msgstr ""
2891
 
2892
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:869
2893
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:913
2894
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:924
2895
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:944
2896
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:996
2897
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1009
2898
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:440
2899
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:484
2900
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:495
@@ -2905,12 +3316,12 @@ msgctxt "s2member-front"
2905
  msgid "<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s</strong> )</div>"
2906
  msgstr ""
2907
 
2908
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:879
2909
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:890
2910
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:901
2911
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:956
2912
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:969
2913
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:982
2914
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:450
2915
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:461
2916
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:472
@@ -2921,12 +3332,12 @@ msgctxt "s2member-front"
2921
  msgid "COUPON %s off. ( Now: %s, then %s )"
2922
  msgstr ""
2923
 
2924
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:880
2925
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:891
2926
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:902
2927
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:957
2928
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:970
2929
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:983
2930
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:451
2931
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:462
2932
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:473
@@ -2937,21 +3348,21 @@ msgctxt "s2member-front"
2937
  msgid "<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s, then %s</strong> )</div>"
2938
  msgstr ""
2939
 
2940
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:928
2941
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1013
2942
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:499
2943
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:584
2944
  msgctxt "s2member-front"
2945
  msgid "<div>Sorry, your Coupon is not applicable.</div>"
2946
  msgstr ""
2947
 
2948
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1017
2949
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:588
2950
  msgctxt "s2member-front"
2951
  msgid "<div>Coupon: <strong>%s0.00 off</strong>.</div>"
2952
  msgstr ""
2953
 
2954
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1021
2955
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:592
2956
  msgctxt "s2member-front"
2957
  msgid "<div>Sorry, your Coupon <strong>expired</strong>: <em>%s</em>.</div>"
@@ -2960,14 +3371,14 @@ msgstr ""
2960
  #. translators: `%1$s` is the new price/description, after coupon is applied.
2961
  #. `%2$s` was the original description.
2962
 
2963
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1029
2964
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:600
2965
  msgctxt "s2member-front"
2966
  msgid "%1$s ~ ORIGINALLY: %2$s"
2967
  msgstr ""
2968
 
2969
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1032
2970
- #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1036
2971
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:603
2972
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:607
2973
  msgctxt "s2member-front"
@@ -3268,23 +3679,23 @@ msgstr ""
3268
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3269
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:73
3270
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:167
3271
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:246
3272
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:453
3273
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:688
3274
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3275
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:73
3276
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:167
3277
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:246
3278
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:488
3279
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:758
3280
  msgctxt "s2member-front"
3281
  msgid "Security Code missing. Please try again."
3282
  msgstr ""
3283
 
3284
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3285
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:142
3286
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:428
3287
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:656
3288
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3289
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:142
3290
  msgctxt "s2member-front"
@@ -3292,39 +3703,49 @@ msgid "Please choose a Billing Method."
3292
  msgstr ""
3293
 
3294
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3295
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:295
3296
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:503
3297
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3298
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:298
3299
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:541
3300
  msgctxt "s2member-front"
3301
  msgid "Calculating Sales Tax..."
3302
  msgstr ""
3303
 
3304
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3305
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:295
3306
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:503
3307
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3308
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:298
3309
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:541
3310
  msgctxt "s2member-front"
3311
  msgid "calculating sales tax..."
3312
  msgstr ""
3313
 
3314
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3315
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:306
3316
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:514
3317
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3318
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:309
3319
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:552
3320
  msgctxt "s2member-front"
3321
  msgid "<strong>Sales Tax%s:</strong> %s<br /><strong>— Total%s:</strong> %s"
3322
  msgstr ""
3323
 
3324
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3325
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:576
 
 
 
 
 
 
 
 
 
 
3326
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3327
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:614
3328
  #: s2member-pro/includes/templates/forms/authnet-checkout-form.php:47
3329
  #: s2member-pro/includes/templates/forms/authnet-registration-form.php:28
3330
  #: s2member-pro/includes/templates/forms/paypal-checkout-form.php:47
@@ -3334,18 +3755,18 @@ msgid "Create Profile"
3334
  msgstr ""
3335
 
3336
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3337
- #: s2member-pro/includes/separates/gateways/authnet/authnet.js:577
3338
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3339
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:615
3340
  msgctxt "s2member-front"
3341
  msgid "Your Profile"
3342
  msgstr ""
3343
 
3344
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3345
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:261
3346
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:262
3347
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:504
3348
- #: s2member-pro/includes/separates/gateways/paypal/paypal.js:505
3349
  #: s2member-pro/includes/templates/forms/authnet-cancellation-form.php:34
3350
  #: s2member-pro/includes/templates/forms/authnet-checkout-form.php:178
3351
  #: s2member-pro/includes/templates/forms/authnet-registration-form.php:79
@@ -3363,13 +3784,13 @@ msgstr ""
3363
  #: s2member-pro/includes/syscon.inc.php:91
3364
  msgctxt "s2member-front"
3365
  msgid ""
3366
- "Thanks %%first_name%%! Your membership has been approved.\n"
3367
  "\n"
3368
- "%%item_name%%\n"
3369
  "\n"
3370
- "Subscr. ID: %%subscr_id%%\n"
3371
- "Charges today: $%%initial%%\n"
3372
- "Recurring charges: $%%recurring/regular_cycle%%\n"
3373
  "\n"
3374
  "Your Username/Password will arrive shortly, in a separate email. If you have any trouble, please feel free to contact us.\n"
3375
  "\n"
@@ -3380,16 +3801,16 @@ msgstr ""
3380
  #: s2member-pro/includes/syscon.inc.php:95
3381
  msgctxt "s2member-front"
3382
  msgid ""
3383
- "Thanks %%first_name%%!\n"
3384
  "\n"
3385
- "%%item_name%%\n"
3386
  "\n"
3387
- "Transaction ID: %%txn_id%%\n"
3388
- "Charges today: $%%amount%%\n"
3389
  "\n"
3390
  "Your order can be retrieved here:\n"
3391
- "%%sp_access_url%%\n"
3392
- "( link expires in %%sp_access_exp%% )\n"
3393
  "\n"
3394
  "If you have any trouble, please feel free to contact us.\n"
3395
  "\n"
2
  # This file is distributed under the same license as the s2Member package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: s2Member 110926\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/.__s2member\n"
7
+ "POT-Creation-Date: 2011-09-27 01:19:21+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
71
  msgid "password strength indicator"
72
  msgstr ""
73
 
74
+ #: s2member/includes/classes/email-configs.inc.php:170
75
  msgctxt "s2member-front"
76
  msgid "as a Member"
77
  msgstr ""
78
 
79
+ #: s2member/includes/classes/files-in.inc.php:93
80
+ #: s2member/includes/classes/files-in.inc.php:239
81
  msgctxt "s2member-front"
82
  msgid "404: Sorry, file not found. Please contact Support for assistance."
83
  msgstr ""
84
 
85
+ #: s2member/includes/classes/files-in.inc.php:102
86
  msgctxt "s2member-front"
87
  msgid "503 ( Invalid Key ): Sorry, your access to this file has expired. Please contact Support for assistance."
88
  msgstr ""
89
 
90
+ #: s2member/includes/classes/files-in.inc.php:121
91
  msgctxt "s2member-front"
92
  msgid "503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`."
93
  msgstr ""
94
 
95
+ #: s2member/includes/classes/files-in.inc.php:368
96
+ msgctxt "s2member-front"
97
+ msgid "503: Access denied. Invalid File Download specs."
98
+ msgstr ""
99
+
100
+ #: s2member/includes/classes/files-in.inc.php:453
101
  msgctxt "s2member-front"
102
  msgid "Members Only"
103
  msgstr ""
104
 
105
+ #: s2member/includes/classes/files-in.inc.php:455
106
  msgctxt "s2member-front"
107
  msgid "Access Denied"
108
  msgstr ""
109
 
110
+ #. translators: In this translation, `%s` may be filled with an English
111
+ #. message, which comes from the Amazon® S3 API call. Feel free to exclude
112
+ #. `%s` if you like.
113
+
114
+ #: s2member/includes/classes/files-in.inc.php:593
115
+ msgctxt "s2member-admin"
116
+ msgid "Unable to update existing Amazon® S3 Cross-Domain Policy. %s"
117
+ msgstr ""
118
+
119
+ #: s2member/includes/classes/files-in.inc.php:596
120
+ msgctxt "s2member-admin"
121
+ msgid "Unable to update existing Amazon® S3 Cross-Domain Policy. Connection failed."
122
+ msgstr ""
123
+
124
+ #. translators: In this translation, `%s` may be filled with an English
125
+ #. message, which comes from the Amazon® S3 API call. Feel free to exclude
126
+ #. `%s` if you like.
127
+
128
+ #: s2member/includes/classes/files-in.inc.php:600
129
+ msgctxt "s2member-admin"
130
+ msgid "Unable to update existing Amazon® S3 Bucket Policy. %s"
131
+ msgstr ""
132
+
133
+ #: s2member/includes/classes/files-in.inc.php:603
134
+ msgctxt "s2member-admin"
135
+ msgid "Unable to update existing Amazon® S3 Bucket Policy. Connection failed."
136
+ msgstr ""
137
+
138
+ #. translators: In this translation, `%s` may be filled with an English
139
+ #. message, which comes from the Amazon® S3 API call. Feel free to exclude
140
+ #. `%s` if you like.
141
+
142
+ #: s2member/includes/classes/files-in.inc.php:607
143
+ msgctxt "s2member-admin"
144
+ msgid "Unable to update existing Amazon® S3 Bucket ACLs. %s"
145
+ msgstr ""
146
+
147
+ #: s2member/includes/classes/files-in.inc.php:610
148
+ msgctxt "s2member-admin"
149
+ msgid "Unable to update existing Amazon® S3 Bucket ACLs. Connection failed."
150
+ msgstr ""
151
+
152
+ #: s2member/includes/classes/files-in.inc.php:613
153
+ msgctxt "s2member-admin"
154
+ msgid "Unable to acquire/read existing Amazon® S3 Bucket ACLs. Unexpected response."
155
+ msgstr ""
156
+
157
+ #. translators: In this translation, `%s` may be filled with an English
158
+ #. message, which comes from the Amazon® S3 API call. Feel free to exclude
159
+ #. `%s` if you like.
160
+
161
+ #: s2member/includes/classes/files-in.inc.php:617
162
+ msgctxt "s2member-admin"
163
+ msgid "Unable to acquire existing Amazon® S3 Bucket ACLs. %s"
164
+ msgstr ""
165
+
166
+ #: s2member/includes/classes/files-in.inc.php:620
167
+ msgctxt "s2member-admin"
168
+ msgid "Unable to acquire existing Amazon® S3 Bucket ACLs. Connection failed."
169
+ msgstr ""
170
+
171
+ #: s2member/includes/classes/files-in.inc.php:623
172
+ msgctxt "s2member-admin"
173
+ msgid "Unable to auto-configure existing Amazon® S3 Bucket ACLs. Incomplete Amazon® S3 configuration options. Missing one of: Amazon® S3 Bucket, Access Key, or Secret Key."
174
+ msgstr ""
175
+
176
+ #: s2member/includes/classes/files-in.inc.php:762
177
+ msgctxt "s2member-admin"
178
+ msgid "Unable to delete existing Amazon® CloudFront Downloads Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again."
179
+ msgstr ""
180
+
181
+ #. translators: In this translation, `%s` may be filled with an English
182
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
183
+ #. exclude `%s` if you like.
184
+
185
+ #: s2member/includes/classes/files-in.inc.php:769
186
+ msgctxt "s2member-admin"
187
+ msgid "Unable to delete existing Amazon® CloudFront Downloads Distro. %s"
188
+ msgstr ""
189
+
190
+ #: s2member/includes/classes/files-in.inc.php:781
191
+ msgctxt "s2member-admin"
192
+ msgid "Unable to delete existing Amazon® CloudFront Streaming Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again."
193
+ msgstr ""
194
+
195
+ #. translators: In this translation, `%s` may be filled with an English
196
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
197
+ #. exclude `%s` if you like.
198
+
199
+ #: s2member/includes/classes/files-in.inc.php:788
200
+ msgctxt "s2member-admin"
201
+ msgid "Unable to delete existing Amazon® CloudFront Streaming Distro. %s"
202
+ msgstr ""
203
+
204
+ #. translators: In this translation, `%s` may be filled with an English
205
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
206
+ #. exclude `%s` if you like.
207
+
208
+ #: s2member/includes/classes/files-in.inc.php:804
209
+ #: s2member/includes/classes/files-in.inc.php:986
210
+ msgctxt "s2member-admin"
211
+ msgid "Unable to delete existing Amazon® CloudFront Origin Access Identity. %s"
212
+ msgstr ""
213
+
214
+ #. translators: In this translation, `%s` may be filled with an English
215
+ #. message, which comes from the Amazon® S3 API call. Feel free to exclude
216
+ #. `%s` if you like.
217
+
218
+ #: s2member/includes/classes/files-in.inc.php:843
219
+ msgctxt "s2member-admin"
220
+ msgid "Unable to update existing Amazon® S3 ACLs. %s"
221
+ msgstr ""
222
+
223
+ #: s2member/includes/classes/files-in.inc.php:846
224
+ msgctxt "s2member-admin"
225
+ msgid "Unable to update existing Amazon® S3 ACLs. Connection failed."
226
+ msgstr ""
227
+
228
+ #. translators: In this translation, `%s` may be filled with an English
229
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
230
+ #. exclude `%s` if you like.
231
+
232
+ #: s2member/includes/classes/files-in.inc.php:850
233
+ #: s2member/includes/classes/files-in.inc.php:1274
234
+ msgctxt "s2member-admin"
235
+ msgid "Unable to create Amazon® CloudFront Streaming Distro. %s"
236
+ msgstr ""
237
+
238
+ #: s2member/includes/classes/files-in.inc.php:853
239
+ #: s2member/includes/classes/files-in.inc.php:1276
240
+ msgctxt "s2member-admin"
241
+ msgid "Unable to create Amazon® CloudFront Streaming Distro. Connection failed."
242
+ msgstr ""
243
+
244
+ #. translators: In this translation, `%s` may be filled with an English
245
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
246
+ #. exclude `%s` if you like.
247
+
248
+ #: s2member/includes/classes/files-in.inc.php:857
249
+ #: s2member/includes/classes/files-in.inc.php:1253
250
+ msgctxt "s2member-admin"
251
+ msgid "Unable to create Amazon® CloudFront Downloads Distro. %s"
252
+ msgstr ""
253
+
254
+ #: s2member/includes/classes/files-in.inc.php:860
255
+ #: s2member/includes/classes/files-in.inc.php:1255
256
+ msgctxt "s2member-admin"
257
+ msgid "Unable to create Amazon® CloudFront Downloads Distro. Connection failed."
258
+ msgstr ""
259
+
260
+ #. translators: In this translation, `%s` may be filled with an English
261
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
262
+ #. exclude `%s` if you like.
263
+
264
+ #: s2member/includes/classes/files-in.inc.php:864
265
+ #: s2member/includes/classes/files-in.inc.php:1031
266
+ msgctxt "s2member-admin"
267
+ msgid "Unable to create Amazon® CloudFront Origin Access Identity. %s"
268
+ msgstr ""
269
+
270
+ #: s2member/includes/classes/files-in.inc.php:867
271
+ #: s2member/includes/classes/files-in.inc.php:1034
272
+ msgctxt "s2member-admin"
273
+ msgid "Unable to create Amazon® CloudFront Origin Access Identity. Connection failed."
274
+ msgstr ""
275
+
276
+ #: s2member/includes/classes/files-in.inc.php:870
277
+ msgctxt "s2member-admin"
278
+ msgid "Unable to clear existing Amazon® CloudFront Origin Access Identity."
279
+ msgstr ""
280
+
281
+ #. translators: In this translation, `%s` may be filled with an English
282
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
283
+ #. exclude `%s` if you like.
284
+
285
+ #: s2member/includes/classes/files-in.inc.php:874
286
+ #: s2member/includes/classes/files-in.inc.php:943
287
+ msgctxt "s2member-admin"
288
+ msgid "Unable to acquire existing Amazon® CloudFront Origin Access Identity. %s"
289
+ msgstr ""
290
+
291
+ #: s2member/includes/classes/files-in.inc.php:877
292
+ #: s2member/includes/classes/files-in.inc.php:946
293
+ msgctxt "s2member-admin"
294
+ msgid "Unable to acquire existing Amazon® CloudFront Origin Access Identity. Connection failed."
295
+ msgstr ""
296
+
297
+ #: s2member/includes/classes/files-in.inc.php:880
298
+ msgctxt "s2member-admin"
299
+ msgid "Unable to clear existing Amazon® CloudFront Streaming Distro."
300
+ msgstr ""
301
+
302
+ #. translators: In this translation, `%s` may be filled with an English
303
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
304
+ #. exclude `%s` if you like.
305
+
306
+ #: s2member/includes/classes/files-in.inc.php:884
307
+ msgctxt "s2member-admin"
308
+ msgid "Unable to acquire existing Amazon® CloudFront Streaming Distro. %s"
309
+ msgstr ""
310
+
311
+ #: s2member/includes/classes/files-in.inc.php:887
312
+ msgctxt "s2member-admin"
313
+ msgid "Unable to acquire existing Amazon® CloudFront Streaming Distro. Connection failed."
314
+ msgstr ""
315
+
316
+ #: s2member/includes/classes/files-in.inc.php:890
317
+ msgctxt "s2member-admin"
318
+ msgid "Unable to clear existing Amazon® CloudFront Downloads Distro."
319
+ msgstr ""
320
+
321
+ #. translators: In this translation, `%s` may be filled with an English
322
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
323
+ #. exclude `%s` if you like.
324
+
325
+ #: s2member/includes/classes/files-in.inc.php:894
326
+ msgctxt "s2member-admin"
327
+ msgid "Unable to acquire existing Amazon® CloudFront Downloads Distro. %s"
328
+ msgstr ""
329
+
330
+ #: s2member/includes/classes/files-in.inc.php:897
331
+ msgctxt "s2member-admin"
332
+ msgid "Unable to acquire existing Amazon® CloudFront Downloads Distro. Connection failed."
333
+ msgstr ""
334
+
335
+ #: s2member/includes/classes/files-in.inc.php:900
336
+ msgctxt "s2member-admin"
337
+ msgid "Unable to auto-configure Amazon® CloudFront Distros. Incomplete Amazon® CloudFront configuration options. Missing of one: Amazon® CloudFront Private Key-Pair-ID, or Private Key file contents."
338
+ msgstr ""
339
+
340
+ #: s2member/includes/classes/files-in.inc.php:903
341
+ msgctxt "s2member-admin"
342
+ msgid "Unable to auto-configure Amazon® S3/CloudFront Distros. Incomplete Amazon® S3 configuration options. Missing one of: Amazon® S3 Bucket, Access Key, or Secret Key. You must provide s2Member with an Amazon® S3 configuration before enabling CloudFront."
343
+ msgstr ""
344
+
345
+ #. translators: In this translation, `%s` may be filled with an English
346
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
347
+ #. exclude `%s` if you like.
348
+
349
+ #: s2member/includes/classes/files-in.inc.php:939
350
+ msgctxt "s2member-admin"
351
+ msgid "Existing Amazon® CloudFront Origin Access Identity NOT found. %s"
352
+ msgstr ""
353
+
354
+ #: s2member/includes/classes/files-in.inc.php:949
355
+ msgctxt "s2member-admin"
356
+ msgid "Unable to acquire existing Amazon® CloudFront Origin Access Identity. Invalid Access ID."
357
+ msgstr ""
358
+
359
+ #: s2member/includes/classes/files-in.inc.php:989
360
+ msgctxt "s2member-admin"
361
+ msgid "Unable to delete existing Amazon® CloudFront Origin Access Identity. Connection failed."
362
+ msgstr ""
363
+
364
+ #: s2member/includes/classes/files-in.inc.php:992
365
+ msgctxt "s2member-admin"
366
+ msgid "Unable to delete existing Amazon® CloudFront Origin Access Identity. Invalid Access ID, ETag, or XML config."
367
+ msgstr ""
368
+
369
+ #: s2member/includes/classes/files-in.inc.php:1018
370
+ #: s2member/includes/classes/files-in.inc.php:1241
371
+ #: s2member/includes/classes/files-in.inc.php:1262
372
+ msgctxt "s2member-admin"
373
+ msgid "Created by s2Member, for S3 Bucket: %s."
374
+ msgstr ""
375
+
376
+ #: s2member/includes/classes/files-in.inc.php:1027
377
+ msgctxt "s2member-admin"
378
+ msgid "Unable to create/read Amazon® CloudFront Origin Access Identity. Unexpected response."
379
+ msgstr ""
380
+
381
+ #. translators: In this translation, `%s` may be filled with an English
382
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
383
+ #. exclude `%s` if you like.
384
+
385
+ #: s2member/includes/classes/files-in.inc.php:1071
386
+ msgctxt "s2member-admin"
387
+ msgid "Existing Amazon® CloudFront Distro NOT found. %s"
388
+ msgstr ""
389
+
390
+ #. translators: In this translation, `%s` may be filled with an English
391
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
392
+ #. exclude `%s` if you like.
393
+
394
+ #: s2member/includes/classes/files-in.inc.php:1075
395
+ msgctxt "s2member-admin"
396
+ msgid "Unable to acquire existing Amazon® CloudFront Distro. %s"
397
+ msgstr ""
398
+
399
+ #: s2member/includes/classes/files-in.inc.php:1078
400
+ msgctxt "s2member-admin"
401
+ msgid "Unable to acquire existing Amazon® CloudFront Distro. Connection failed."
402
+ msgstr ""
403
+
404
+ #: s2member/includes/classes/files-in.inc.php:1081
405
+ msgctxt "s2member-admin"
406
+ msgid "Unable to acquire existing Amazon® CloudFront Distro. Invalid Distro ID and/or Distro type."
407
+ msgstr ""
408
+
409
+ #. translators: In this translation, `%s` may be filled with an English
410
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
411
+ #. exclude `%s` if you like.
412
+
413
+ #: s2member/includes/classes/files-in.inc.php:1125
414
+ #: s2member/includes/classes/files-in.inc.php:1200
415
+ msgctxt "s2member-admin"
416
+ msgid "Unable to disable existing Amazon® CloudFront Distro. %s"
417
+ msgstr ""
418
+
419
+ #: s2member/includes/classes/files-in.inc.php:1128
420
+ #: s2member/includes/classes/files-in.inc.php:1203
421
+ msgctxt "s2member-admin"
422
+ msgid "Unable to disable existing Amazon® CloudFront Distro. Connection failed."
423
+ msgstr ""
424
+
425
+ #: s2member/includes/classes/files-in.inc.php:1131
426
+ msgctxt "s2member-admin"
427
+ msgid "Existing Amazon® CloudFront Distro cannot be disabled at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again."
428
+ msgstr ""
429
+
430
+ #: s2member/includes/classes/files-in.inc.php:1137
431
+ msgctxt "s2member-admin"
432
+ msgid "Unable to disable existing Amazon® CloudFront Distro. Invalid Distro ID, ETag, or XML config."
433
+ msgstr ""
434
+
435
+ #. translators: In this translation, `%s` may be filled with an English
436
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
437
+ #. exclude `%s` if you like.
438
+
439
+ #: s2member/includes/classes/files-in.inc.php:1182
440
+ msgctxt "s2member-admin"
441
+ msgid "Unable to delete existing Amazon® CloudFront Distro. %s"
442
+ msgstr ""
443
+
444
+ #: s2member/includes/classes/files-in.inc.php:1185
445
+ msgctxt "s2member-admin"
446
+ msgid "Unable to delete existing Amazon® CloudFront Distro. Connection failed."
447
+ msgstr ""
448
+
449
+ #. translators: In this translation, `%s` may be filled with an English
450
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
451
+ #. exclude `%s` if you like.
452
+
453
+ #: s2member/includes/classes/files-in.inc.php:1189
454
+ msgctxt "s2member-admin"
455
+ msgid "Existing Amazon® CloudFront Distro cannot be deleted at this time. Still in a `pending` state after having been disabled by s2Member. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again."
456
+ msgstr ""
457
+
458
+ #. translators: In this translation, `%s` may be filled with an English
459
+ #. message, which comes from the Amazon® CloudFront API call. Feel free to
460
+ #. exclude `%s` if you like.
461
+
462
+ #: s2member/includes/classes/files-in.inc.php:1193
463
+ msgctxt "s2member-admin"
464
+ msgid "Unable to check status of existing Amazon® CloudFront Distro. %s"
465
+ msgstr ""
466
+
467
+ #: s2member/includes/classes/files-in.inc.php:1196
468
+ msgctxt "s2member-admin"
469
+ msgid "Unable to check status of existing Amazon® CloudFront Distro. Connection failed."
470
+ msgstr ""
471
+
472
+ #: s2member/includes/classes/files-in.inc.php:1206
473
+ msgctxt "s2member-admin"
474
+ msgid "Existing Amazon® CloudFront Distro cannot be deleted at this time. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon® CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon® CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again."
475
+ msgstr ""
476
+
477
+ #: s2member/includes/classes/files-in.inc.php:1209
478
+ msgctxt "s2member-admin"
479
+ msgid "Unable to delete existing Amazon® CloudFront Distro. Invalid Distro ID or ETag."
480
+ msgstr ""
481
+
482
+ #: s2member/includes/classes/files-in.inc.php:1249
483
+ msgctxt "s2member-admin"
484
+ msgid "Unable to create/read Amazon® CloudFront Downloads Distro. Unexpected response."
485
+ msgstr ""
486
+
487
+ #: s2member/includes/classes/files-in.inc.php:1270
488
+ msgctxt "s2member-admin"
489
+ msgid "Unable to create/read Amazon® CloudFront Streaming Distro. Unexpected response."
490
+ msgstr ""
491
+
492
+ #: s2member/includes/classes/files-in.inc.php:1280
493
+ msgctxt "s2member-admin"
494
+ msgid "Unable to create Amazon® CloudFront Distro. Invalid Distro type."
495
+ msgstr ""
496
+
497
  #: s2member/includes/classes/ip-restrictions.inc.php:76
498
  #: s2member/includes/classes/ip-restrictions.inc.php:90
499
  msgctxt "s2member-front"
528
  msgid "Thank you! You now have access to:"
529
  msgstr ""
530
 
531
+ #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:62
532
  #: s2member/includes/classes/paypal-return-in-proxy-ty-email.inc.php:59
533
  msgctxt "s2member-front"
534
  msgid "<strong>Thank you! ( you MUST check your email before proceeding ).</strong><br /><br />* Note: It can take <em>( up to 15 minutes )</em> for Email Confirmation with important details. If you don't receive email confirmation in the next 15 minutes, please contact Support."
535
  msgstr ""
536
 
537
+ #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:62
538
  #: s2member/includes/classes/paypal-return-in-proxy-ty-email.inc.php:59
539
  msgctxt "s2member-front"
540
  msgid "<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing)."
541
  msgstr ""
542
 
543
+ #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:63
544
  #: s2member/includes/classes/paypal-return-in-proxy-ty-email.inc.php:60
545
  msgctxt "s2member-front"
546
  msgid "Check Your Email ( Then Click Here )"
547
  msgstr ""
548
 
549
+ #: s2member/includes/classes/paypal-return-in-no-tx-data.inc.php:63
550
  #: s2member/includes/classes/paypal-return-in-subscr-modify-w-level.inc.php:192
551
  #: s2member/includes/classes/paypal-return-in-subscr-modify-w-level.inc.php:203
552
  #: s2member/includes/classes/paypal-return-in-subscr-modify-w-level.inc.php:214
791
  #: s2member/includes/templates/buttons/paypal-checkout-button.php:46
792
  #: s2member/includes/templates/buttons/paypal-sp-checkout-button.php:34
793
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
794
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:269
795
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:512
796
  msgctxt "s2member-front paypal-button-lang-code"
797
  msgid "en_US"
798
  msgstr ""
842
  msgstr ""
843
 
844
  #: s2member/includes/classes/translations.inc.php:143
845
+ #: s2member/includes/classes/translations.inc.php:165
846
  msgctxt "s2member-front"
847
  msgid "By filling out the form below, you can <strong>add a site to your account</strong>."
848
  msgstr ""
849
 
850
  #: s2member/includes/classes/translations.inc.php:143
851
+ #: s2member/includes/classes/translations.inc.php:165
852
  msgctxt "s2member-front"
853
  msgid "You may create up to <strong>%s</strong> site."
854
  msgid_plural "You may create up to <strong>%s</strong> sites."
1119
  msgstr[0] ""
1120
  msgstr[1] ""
1121
 
1122
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:35
1123
  msgctxt "s2member-front"
1124
  msgid "— Confirm File Download —"
1125
  msgstr ""
1126
 
1127
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:36
1128
  msgctxt "s2member-front"
1129
  msgid "You`ve downloaded %s protected %s in the last %s."
1130
  msgstr ""
1131
 
1132
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:36
1133
  msgctxt "s2member-front"
1134
  msgid "file"
1135
  msgstr ""
1136
 
1137
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:36
1138
  msgctxt "s2member-front"
1139
  msgid "files"
1140
  msgstr ""
1141
 
1142
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:36
1143
  msgctxt "s2member-front"
1144
  msgid "24 hours"
1145
  msgstr ""
1146
 
1147
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:36
1148
  msgctxt "s2member-front"
1149
  msgid "%s days"
1150
  msgstr ""
1151
 
1152
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
1153
  msgctxt "s2member-front"
1154
  msgid "You`re entitled to UNLIMITED downloads though ( so, no worries )."
1155
  msgstr ""
1156
 
1157
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
1158
  msgctxt "s2member-front"
1159
  msgid "You`re entitled to %s unique %s %s."
1160
  msgstr ""
1161
 
1162
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
1163
  msgctxt "s2member-front"
1164
  msgid "download"
1165
  msgstr ""
1166
 
1167
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
1168
  msgctxt "s2member-front"
1169
  msgid "downloads"
1170
  msgstr ""
1171
 
1172
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
1173
  msgctxt "s2member-front"
1174
  msgid "each day"
1175
  msgstr ""
1176
 
1177
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:37
1178
  msgctxt "s2member-front"
1179
  msgid "every %s-day period"
1180
  msgstr ""
1181
 
1182
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:85
1183
+ #: s2member/includes/s2member.js:92 s2member/includes/s2member.js:99
1184
+ #: s2member/includes/s2member.js:137 s2member/includes/s2member.js:193
1185
+ #: s2member/includes/s2member.js:200 s2member/includes/s2member.js:207
1186
+ #: s2member/includes/s2member.js:241 s2member/includes/s2member.js:275
1187
+ #: s2member/includes/s2member.js:304
1188
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
1189
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:66
1190
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:73
1193
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:232
1194
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:239
1195
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:246
1196
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:253
1197
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:453
1198
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:460
1199
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:681
1200
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:688
1201
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:695
1202
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:702
1203
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
1204
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:66
1205
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:73
1208
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:232
1209
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:239
1210
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:246
1211
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:253
1212
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:488
1213
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:495
1214
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:751
1215
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:758
1216
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:765
1217
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:772
1218
  msgctxt "s2member-front"
1219
  msgid "— Oops, you missed something: —"
1220
  msgstr ""
1221
 
1222
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:92
1223
+ #: s2member/includes/s2member.js:200
1224
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
1225
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:239
1226
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:688
1227
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
1228
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:239
1229
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:758
1230
  msgctxt "s2member-front"
1231
  msgid "Passwords do not match up. Please try again."
1232
  msgstr ""
1233
 
1234
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:99
1235
+ #: s2member/includes/s2member.js:207
1236
+ #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
1237
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:246
1238
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:695
1239
+ #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
1240
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:246
1241
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:765
1242
+ msgctxt "s2member-front"
1243
+ msgid "Password MUST be at least 6 characters. Please try again."
1244
+ msgstr ""
1245
+
1246
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:363
1247
  msgctxt "s2member-front"
1248
  msgid "Please check at least one of the boxes."
1249
  msgstr ""
1250
 
1251
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:368
1252
  msgctxt "s2member-front"
1253
  msgid "Required. This box must be checked."
1254
  msgstr ""
1255
 
1256
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:374
1257
  msgctxt "s2member-front"
1258
  msgid "Please select one of the options."
1259
  msgstr ""
1260
 
1261
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:379
1262
  msgctxt "s2member-front"
1263
  msgid "Please select at least one of the options."
1264
  msgstr ""
1265
 
1266
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:383
1267
  msgctxt "s2member-front"
1268
  msgid "This is a required field, please try again."
1269
  msgstr ""
1270
 
1271
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:389
1272
  msgctxt "s2member-front"
1273
  msgid "Must be numeric ( with or without decimals, commas allowed )."
1274
  msgstr ""
1275
 
1276
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:393
1277
  msgctxt "s2member-front"
1278
  msgid "Must be numeric ( with or without decimals, no commas )."
1279
  msgstr ""
1280
 
1281
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:397
1282
  msgctxt "s2member-front"
1283
  msgid "Must be an integer ( a whole number, without any decimals )."
1284
  msgstr ""
1285
 
1286
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:401
1287
  msgctxt "s2member-front"
1288
  msgid "Must be an integer > 0 ( whole number, no decimals, greater than 0 )."
1289
  msgstr ""
1290
 
1291
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:405
1292
  msgctxt "s2member-front"
1293
  msgid "Must be a float ( floating point number, decimals required )."
1294
  msgstr ""
1295
 
1296
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:409
1297
  msgctxt "s2member-front"
1298
  msgid "Must be a float > 0 ( floating point number, decimals required, greater than 0 )."
1299
  msgstr ""
1300
 
1301
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:413
1302
  msgctxt "s2member-front"
1303
  msgid "Must be a date ( required date format: dd/mm/yyyy )."
1304
  msgstr ""
1305
 
1306
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:417
1307
  msgctxt "s2member-front"
1308
  msgid "Must be a valid email address."
1309
  msgstr ""
1310
 
1311
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:421
1312
  msgctxt "s2member-front"
1313
  msgid ""
1314
  "Please use a personal email address.\n"
1315
  "Addresses like <%s@> are problematic."
1316
  msgstr ""
1317
 
1318
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:425
1319
  msgctxt "s2member-front"
1320
  msgid "Must be a full URL ( starting with http or https )."
1321
  msgstr ""
1322
 
1323
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:429
1324
  msgctxt "s2member-front"
1325
  msgid "Must be a domain name ( domain name only, without http )."
1326
  msgstr ""
1327
 
1328
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:433
1329
  msgctxt "s2member-front"
1330
  msgid "Must be a phone # ( 10 digits w/possible hyphens,spaces,brackets )."
1331
  msgstr ""
1332
 
1333
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:437
1334
  msgctxt "s2member-front"
1335
  msgid "Must be a US zipcode ( 5-9 digits w/possible hyphen )."
1336
  msgstr ""
1337
 
1338
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:441
1339
  msgctxt "s2member-front"
1340
  msgid "Must be a Canadian zipcode ( 6 alpha-numerics w/possible space )."
1341
  msgstr ""
1342
 
1343
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:445
1344
  msgctxt "s2member-front"
1345
  msgid "Must be a zipcode ( either a US or Canadian zipcode )."
1346
  msgstr ""
1347
 
1348
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:449
1349
  msgctxt "s2member-front"
1350
  msgid "Please use alphanumerics, spaces & punctuation only."
1351
  msgstr ""
1352
 
1353
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:453
1354
  msgctxt "s2member-front"
1355
  msgid "Please use alphanumerics & spaces only."
1356
  msgstr ""
1357
 
1358
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:457
1359
  msgctxt "s2member-front"
1360
  msgid "Please use alphanumerics & punctuation only ( no spaces )."
1361
  msgstr ""
1362
 
1363
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:461
1364
  msgctxt "s2member-front"
1365
  msgid "Please use alphanumerics only ( no spaces/punctuation )."
1366
  msgstr ""
1367
 
1368
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:465
1369
  msgctxt "s2member-front"
1370
  msgid "Please use alphabetics only ( no digits/spaces/punctuation )."
1371
  msgstr ""
1372
 
1373
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:469
1374
  msgctxt "s2member-front"
1375
  msgid "Please use numeric digits only."
1376
  msgstr ""
1377
 
1378
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:476
1379
  msgctxt "s2member-front"
1380
  msgid "Must be exactly %s %s."
1381
  msgstr ""
1382
 
1383
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:476
1384
+ #: s2member/includes/s2member.js:479
1385
  msgctxt "s2member-front"
1386
  msgid "digit"
1387
  msgstr ""
1388
 
1389
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:476
1390
+ #: s2member/includes/s2member.js:479
1391
  msgctxt "s2member-front"
1392
  msgid "digits"
1393
  msgstr ""
1394
 
1395
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:476
1396
+ #: s2member/includes/s2member.js:479
1397
  msgctxt "s2member-front"
1398
  msgid "character"
1399
  msgstr ""
1400
 
1401
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:476
1402
+ #: s2member/includes/s2member.js:479
1403
  msgctxt "s2member-front"
1404
  msgid "characters"
1405
  msgstr ""
1406
 
1407
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:479
1408
  msgctxt "s2member-front"
1409
  msgid "Must be at least %s %s."
1410
  msgstr ""
1411
 
1412
+ #: s2member/includes/s2member-min.js:1 s2member/includes/s2member.js:532
1413
  msgctxt "s2member-front"
1414
  msgid "Processing"
1415
  msgstr ""
1416
 
1417
+ #: s2member/includes/syscon.inc.php:77
1418
  msgctxt "s2member-front recaptcha-lang-code"
1419
  msgid "en"
1420
  msgstr ""
1421
 
1422
+ #: s2member/includes/syscon.inc.php:140
1423
  msgctxt "s2member-front"
1424
  msgid "Yes, I want to receive updates via email."
1425
  msgstr ""
1426
 
1427
+ #: s2member/includes/syscon.inc.php:188
1428
  msgctxt "s2member-front"
1429
  msgid "[%s] Username/Password"
1430
  msgstr ""
1431
 
1432
+ #: s2member/includes/syscon.inc.php:189
1433
  msgctxt "s2member-front"
1434
  msgid ""
1435
  "Your Username/Password for:\n"
1436
  "%s\n"
1437
  "\n"
1438
+ "Username: %%%%user_login%%%%\n"
1439
+ "Password: %%%%user_pass%%%%\n"
1440
+ "%%%%wp_login_url%%%%"
1441
  msgstr ""
1442
 
1443
+ #: s2member/includes/syscon.inc.php:192
1444
  msgctxt "s2member-front"
1445
  msgid "[%s] New User Registration"
1446
  msgstr ""
1447
 
1448
+ #: s2member/includes/syscon.inc.php:193
1449
  msgctxt "s2member-front"
1450
  msgid ""
1451
  "New User Registration on your site:\n"
1452
  "%s\n"
1453
  "\n"
1454
+ "User ID: %%%%user_id%%%%\n"
1455
+ "Username: %%%%user_login%%%%\n"
1456
+ "Email: %%%%user_email%%%%\n"
1457
+ "IP Address: %%%%user_ip%%%%"
1458
  msgstr ""
1459
 
1460
+ #: s2member/includes/syscon.inc.php:209 s2member-pro/includes/syscon.inc.php:90
1461
  msgctxt "s2member-front"
1462
  msgid "Congratulations! ( your membership has been approved )"
1463
  msgstr ""
1464
 
1465
+ #: s2member/includes/syscon.inc.php:210
1466
  msgctxt "s2member-front"
1467
  msgid ""
1468
+ "Thanks %%%%first_name%%%%! Your membership has been approved.\n"
1469
  "\n"
1470
  "If you haven't already done so, the next step is to Register a Username.\n"
1471
  "\n"
1472
  "Complete your registration here:\n"
1473
+ "%%%%registration_url%%%%\n"
1474
  "\n"
1475
  "If you have any trouble, please feel free to contact us.\n"
1476
  "\n"
1478
  "%s"
1479
  msgstr ""
1480
 
1481
+ #: s2member/includes/syscon.inc.php:213 s2member-pro/includes/syscon.inc.php:94
1482
  msgctxt "s2member-front"
1483
  msgid "Thank You! ( instructions for access )"
1484
  msgstr ""
1485
 
1486
+ #: s2member/includes/syscon.inc.php:214
1487
  msgctxt "s2member-front"
1488
  msgid ""
1489
+ "Thanks %%%%first_name%%%%!\n"
1490
  "\n"
1491
+ "%%%%item_name%%%%\n"
1492
  "\n"
1493
  "Your order can be retrieved here:\n"
1494
+ "%%%%sp_access_url%%%%\n"
1495
+ "( link expires in %%%%sp_access_exp%%%% )\n"
1496
  "\n"
1497
  "If you have any trouble, please feel free to contact us.\n"
1498
  "\n"
1500
  "%s"
1501
  msgstr ""
1502
 
1503
+ #: s2member/includes/syscon.inc.php:244
1504
  msgctxt "s2member-front"
1505
  msgid "Free Subscriber"
1506
  msgstr ""
1507
 
1508
+ #: s2member/includes/syscon.inc.php:244
1509
  msgctxt "s2member-front"
1510
  msgid "Bronze Member"
1511
  msgstr ""
1512
 
1513
+ #: s2member/includes/syscon.inc.php:244
1514
  msgctxt "s2member-front"
1515
  msgid "Silver Member"
1516
  msgstr ""
1517
 
1518
+ #: s2member/includes/syscon.inc.php:244
1519
  msgctxt "s2member-front"
1520
  msgid "Gold Member"
1521
  msgstr ""
1522
 
1523
+ #: s2member/includes/syscon.inc.php:244
1524
  msgctxt "s2member-front"
1525
  msgid "Platinum Member"
1526
  msgstr ""
1527
 
1528
+ #: s2member/includes/syscon.inc.php:245
1529
  msgctxt "s2member-front"
1530
  msgid "Level %s Member"
1531
  msgstr ""
3270
  msgid "Error #%1$s. %2$s."
3271
  msgstr ""
3272
 
3273
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:702
3274
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:843
3275
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:272
3276
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:413
3277
  msgctxt "s2member-front percentage-symbol"
3278
  msgid "%"
3279
  msgstr ""
3280
 
3281
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:842
3282
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:412
3283
  msgctxt "s2member-front"
3284
  msgid " + tax"
3285
  msgstr ""
3286
 
3287
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:869
3288
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:913
3289
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:924
3290
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:944
3291
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:996
3292
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1009
3293
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:439
3294
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:483
3295
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:494
3300
  msgid "COUPON %s off. ( Now: %s )"
3301
  msgstr ""
3302
 
3303
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:870
3304
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:914
3305
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:925
3306
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:945
3307
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:997
3308
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1010
3309
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:440
3310
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:484
3311
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:495
3316
  msgid "<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s</strong> )</div>"
3317
  msgstr ""
3318
 
3319
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:880
3320
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:891
3321
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:902
3322
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:957
3323
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:970
3324
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:983
3325
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:450
3326
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:461
3327
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:472
3332
  msgid "COUPON %s off. ( Now: %s, then %s )"
3333
  msgstr ""
3334
 
3335
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:881
3336
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:892
3337
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:903
3338
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:958
3339
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:971
3340
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:984
3341
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:451
3342
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:462
3343
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:473
3348
  msgid "<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s, then %s</strong> )</div>"
3349
  msgstr ""
3350
 
3351
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:929
3352
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1014
3353
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:499
3354
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:584
3355
  msgctxt "s2member-front"
3356
  msgid "<div>Sorry, your Coupon is not applicable.</div>"
3357
  msgstr ""
3358
 
3359
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1018
3360
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:588
3361
  msgctxt "s2member-front"
3362
  msgid "<div>Coupon: <strong>%s0.00 off</strong>.</div>"
3363
  msgstr ""
3364
 
3365
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1022
3366
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:592
3367
  msgctxt "s2member-front"
3368
  msgid "<div>Sorry, your Coupon <strong>expired</strong>: <em>%s</em>.</div>"
3371
  #. translators: `%1$s` is the new price/description, after coupon is applied.
3372
  #. `%2$s` was the original description.
3373
 
3374
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1030
3375
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:600
3376
  msgctxt "s2member-front"
3377
  msgid "%1$s ~ ORIGINALLY: %2$s"
3378
  msgstr ""
3379
 
3380
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1033
3381
+ #: s2member-pro/includes/classes/gateways/authnet/authnet-utilities.inc.php:1037
3382
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:603
3383
  #: s2member-pro/includes/classes/gateways/paypal/paypal-utilities.inc.php:607
3384
  msgctxt "s2member-front"
3679
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3680
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:73
3681
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:167
3682
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:253
3683
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:460
3684
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:702
3685
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3686
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:73
3687
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:167
3688
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:253
3689
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:495
3690
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:772
3691
  msgctxt "s2member-front"
3692
  msgid "Security Code missing. Please try again."
3693
  msgstr ""
3694
 
3695
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3696
  #: s2member-pro/includes/separates/gateways/authnet/authnet.js:142
3697
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:435
3698
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:663
3699
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3700
  #: s2member-pro/includes/separates/gateways/paypal/paypal.js:142
3701
  msgctxt "s2member-front"
3703
  msgstr ""
3704
 
3705
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3706
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:302
3707
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:510
3708
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3709
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:305
3710
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:548
3711
  msgctxt "s2member-front"
3712
  msgid "Calculating Sales Tax..."
3713
  msgstr ""
3714
 
3715
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3716
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:302
3717
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:510
3718
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3719
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:305
3720
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:548
3721
  msgctxt "s2member-front"
3722
  msgid "calculating sales tax..."
3723
  msgstr ""
3724
 
3725
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3726
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:313
3727
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:521
3728
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3729
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:316
3730
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:559
3731
  msgctxt "s2member-front"
3732
  msgid "<strong>Sales Tax%s:</strong> %s<br /><strong>— Total%s:</strong> %s"
3733
  msgstr ""
3734
 
3735
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3736
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:313
3737
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:521
3738
+ #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3739
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:316
3740
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:559
3741
+ msgctxt "s2member-front"
3742
+ msgid "Today"
3743
+ msgstr ""
3744
+
3745
+ #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3746
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:583
3747
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3748
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:621
3749
  #: s2member-pro/includes/templates/forms/authnet-checkout-form.php:47
3750
  #: s2member-pro/includes/templates/forms/authnet-registration-form.php:28
3751
  #: s2member-pro/includes/templates/forms/paypal-checkout-form.php:47
3755
  msgstr ""
3756
 
3757
  #: s2member-pro/includes/separates/gateways/authnet/authnet-min.js:1
3758
+ #: s2member-pro/includes/separates/gateways/authnet/authnet.js:584
3759
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3760
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:622
3761
  msgctxt "s2member-front"
3762
  msgid "Your Profile"
3763
  msgstr ""
3764
 
3765
  #: s2member-pro/includes/separates/gateways/paypal/paypal-min.js:1
3766
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:268
3767
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:269
3768
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:511
3769
+ #: s2member-pro/includes/separates/gateways/paypal/paypal.js:512
3770
  #: s2member-pro/includes/templates/forms/authnet-cancellation-form.php:34
3771
  #: s2member-pro/includes/templates/forms/authnet-checkout-form.php:178
3772
  #: s2member-pro/includes/templates/forms/authnet-registration-form.php:79
3784
  #: s2member-pro/includes/syscon.inc.php:91
3785
  msgctxt "s2member-front"
3786
  msgid ""
3787
+ "Thanks %%%%first_name%%%%! Your membership has been approved.\n"
3788
  "\n"
3789
+ "%%%%item_name%%%%\n"
3790
  "\n"
3791
+ "Subscr. ID: %%%%subscr_id%%%%\n"
3792
+ "Charges today: $%%%%initial%%%%\n"
3793
+ "Recurring charges: $%%%%recurring/regular_cycle%%%%\n"
3794
  "\n"
3795
  "Your Username/Password will arrive shortly, in a separate email. If you have any trouble, please feel free to contact us.\n"
3796
  "\n"
3801
  #: s2member-pro/includes/syscon.inc.php:95
3802
  msgctxt "s2member-front"
3803
  msgid ""
3804
+ "Thanks %%%%first_name%%%%!\n"
3805
  "\n"
3806
+ "%%%%item_name%%%%\n"
3807
  "\n"
3808
+ "Transaction ID: %%%%txn_id%%%%\n"
3809
+ "Charges today: $%%%%amount%%%%\n"
3810
  "\n"
3811
  "Your order can be retrieved here:\n"
3812
+ "%%%%sp_access_url%%%%\n"
3813
+ "( link expires in %%%%sp_access_exp%%%% )\n"
3814
  "\n"
3815
  "If you have any trouble, please feel free to contact us.\n"
3816
  "\n"
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === s2Member® ( Membership w/ PayPal® ) ===
2
 
3
- Version: 110915
4
- Stable tag: 110915
5
  Framework: WS-P-110523
6
 
7
  SSL Compatible: yes
@@ -178,6 +178,14 @@ Please visit s2Member.com for [video tutorials](http://www.s2member.com/videos/)
178
 
179
  == Changelog ==
180
 
 
 
 
 
 
 
 
 
181
  = v110915 =
182
  * (s2Member Pro) **Bug fix**. A bug first introduced in s2Member/s2Member Pro v110912+ was causing parse errors on Authorize.Net Free Regisration Forms. Fixed in this release.
183
 
1
  === s2Member® ( Membership w/ PayPal® ) ===
2
 
3
+ Version: 110926
4
+ Stable tag: 110926
5
  Framework: WS-P-110523
6
 
7
  SSL Compatible: yes
178
 
179
  == Changelog ==
180
 
181
+ = v110926 =
182
+ * (s2Member/s2Member Pro) **BuddyPress v1.5**. Updated for compatibility with BuddyPress v1.5.
183
+ * (s2Member Pro) **Bug fix**. A bug first introduced in s2Member Pro v110912 was causing problems for Pro Forms integrated on a Child Blog of Multisite Blog Farm. Fixed in this release.
184
+ * (s2Member/s2Member Pro) **Bug fix**. Custom Registration Fields configured to require an EXACT number of characters and/or digits was NOT being handled properly by s2Member in all cases. Fixed in this release.
185
+ * (s2Member/s2Member Pro) **Bug fix**. A bug first introduced in s2Member v110912 was causing problems with s2Member's default email customization templates. Double percent signs `%%` for Replacement Codes were being reduced by s2Member's internationalization routines, to just single percent signs `%`, thereby nullifying them as valid Replacement Codes. Fixed in this release. If you installed s2Member and/or s2Member Pro v110912 - v110915 on a clean installation of WordPress®, it would be a good idea to have a quick look at your email customizations with s2Member, just to make sure your Replacement Codes have double percent signs around them *( for example, this is valid: `%%registration_url%%`, and this is NOT valid: `%registration_url%` )*.
186
+ * (s2Member) **Amazon® S3/CloudFront**. s2Member is now fully integrated with Amazon® CloudFront, in addition to its existing support for Amazon® S3. Please note, one of the greatest things about Amazon® CloudFront, is its ability to `stream/seek` media files in the truest sense of the word over the RTMP protocol. For sites delivering protected `FLV/MP4/OGG/WEBM` and other streaming audio/video file types over the RTMP protocol, Amazon® CloudFront is our recommendation. Once you've successfully configured s2Member to use both Amazon® S3 and Amazon® CloudFront together, please review this section in your Dashboard: `s2Member -> Download Options -> JW Player® & RTMP Protocol Examples`. s2Member will automatically serve your protected files over the RTMP protocol, using an Amazon® CloudFront Streaming Distribution. In fact, s2Member can even configure all of your Amazon® S3/CloudFront Distros, ACLs, and Policies automatically; making it possible for just about anyone to stream media s2Member-protected files in real-time.
187
+ * (s2Member) **s2File Shortcode**. s2Member now provides a new Shortcode: `[s2File /]`. For further details, please check your Dashboard, under: `s2Member -> Download Options -> Basic Download Restrictions`.
188
+
189
  = v110915 =
190
  * (s2Member Pro) **Bug fix**. A bug first introduced in s2Member/s2Member Pro v110912+ was causing parse errors on Authorize.Net Free Regisration Forms. Fixed in this release.
191
 
s2member.php CHANGED
@@ -19,8 +19,8 @@
19
  */
20
  /* -- This section for WordPress® parsing. ------------------------------------------------------------------------------
21
 
22
- Version: 110915
23
- Stable tag: 110915
24
  Framework: WS-P-110523
25
 
26
  SSL Compatible: yes
@@ -75,7 +75,7 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
75
  * @var str
76
  */
77
  if (!defined ("WS_PLUGIN__S2MEMBER_VERSION"))
78
- define ("WS_PLUGIN__S2MEMBER_VERSION", "110915");
79
  /**
80
  * Minimum PHP version required to run s2Member.
81
  *
@@ -105,7 +105,7 @@ if (!defined ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION"))
105
  * @var str
106
  */
107
  if (!defined ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION"))
108
- define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "110915");
109
  /*
110
  Several compatibility checks.
111
  If all pass, load the s2Member plugin.
19
  */
20
  /* -- This section for WordPress® parsing. ------------------------------------------------------------------------------
21
 
22
+ Version: 110926
23
+ Stable tag: 110926
24
  Framework: WS-P-110523
25
 
26
  SSL Compatible: yes
75
  * @var str
76
  */
77
  if (!defined ("WS_PLUGIN__S2MEMBER_VERSION"))
78
+ define ("WS_PLUGIN__S2MEMBER_VERSION", "110926");
79
  /**
80
  * Minimum PHP version required to run s2Member.
81
  *
105
  * @var str
106
  */
107
  if (!defined ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION"))
108
+ define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "110926");
109
  /*
110
  Several compatibility checks.
111
  If all pass, load the s2Member plugin.