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

Version Description

Download this release

Release Info

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

Code changes from version 110927 to 111002

Files changed (149) hide show
  1. includes/.htaccess +1 -0
  2. includes/classes/catgs-sp.inc.php +32 -28
  3. includes/classes/catgs.inc.php +28 -38
  4. includes/classes/files.inc.php +7 -7
  5. includes/classes/menu-pages.inc.php +1 -1
  6. includes/classes/no-cache.inc.php +13 -12
  7. includes/classes/pages-sp.inc.php +49 -43
  8. includes/classes/pages.inc.php +48 -69
  9. includes/classes/posts-sp.inc.php +51 -45
  10. includes/classes/posts.inc.php +47 -70
  11. includes/classes/profile-in.inc.php +1 -1
  12. includes/classes/ptags-sp.inc.php +37 -37
  13. includes/classes/ptags.inc.php +22 -29
  14. includes/classes/querys.inc.php +17 -17
  15. includes/classes/register-access.inc.php +5 -8
  16. includes/classes/ruris-sp.inc.php +19 -15
  17. includes/classes/ruris.inc.php +17 -18
  18. includes/classes/security.inc.php +30 -46
  19. includes/classes/sp-access.inc.php +7 -10
  20. includes/classes/ssl-in.inc.php +54 -64
  21. includes/classes/ssl.inc.php +13 -15
  22. includes/classes/systematics-sp.inc.php +42 -20
  23. includes/classes/systematics.inc.php +48 -13
  24. includes/classes/utils-conds.inc.php +11 -8
  25. includes/classes/utils-s2o.inc.php +80 -59
  26. includes/classes/utils-urls.inc.php +98 -57
  27. includes/functions/api-functions.inc.php +4 -4
  28. includes/hooks.inc.php +7 -8
  29. includes/jquery/.htaccess +1 -0
  30. includes/menu-pages/code-samples/{api-mop-vars.php → api-mop-vars.x-php} +0 -0
  31. includes/menu-pages/code-samples/{ccap-file-downloads.php → ccap-file-downloads.x-php} +0 -0
  32. includes/menu-pages/code-samples/{current-user-access-label.php → current-user-access-label.x-php} +0 -0
  33. includes/menu-pages/code-samples/{current-user-access-level-conditional-upgrades.php → current-user-access-level-conditional-upgrades.x-php} +0 -0
  34. includes/menu-pages/code-samples/{current-user-access-level.php → current-user-access-level.x-php} +0 -0
  35. includes/menu-pages/code-samples/{current-user-can-ccaps-1.php → current-user-can-ccaps-1.x-php} +0 -0
  36. includes/menu-pages/code-samples/{current-user-can-ccaps-2.php → current-user-can-ccaps-2.x-php} +0 -0
  37. includes/menu-pages/code-samples/{current-user-can-constants-1.php → current-user-can-constants-1.x-php} +0 -0
  38. includes/menu-pages/code-samples/{current-user-can-constants-2.php → current-user-can-constants-2.x-php} +0 -0
  39. includes/menu-pages/code-samples/{current-user-can-full-access.php → current-user-can-full-access.x-php} +0 -0
  40. includes/menu-pages/code-samples/{current-user-custom.php → current-user-custom.x-php} +0 -0
  41. includes/menu-pages/code-samples/{current-user-display-name.php → current-user-display-name.x-php} +0 -0
  42. includes/menu-pages/code-samples/{current-user-downloads-allowed-days.php → current-user-downloads-allowed-days.x-php} +0 -0
  43. includes/menu-pages/code-samples/{current-user-downloads-allowed-is-unlimited.php → current-user-downloads-allowed-is-unlimited.x-php} +0 -0
  44. includes/menu-pages/code-samples/{current-user-downloads-allowed.php → current-user-downloads-allowed.x-php} +0 -0
  45. includes/menu-pages/code-samples/{current-user-downloads-currently.php → current-user-downloads-currently.x-php} +0 -0
  46. includes/menu-pages/code-samples/{current-user-email.php → current-user-email.x-php} +0 -0
  47. includes/menu-pages/code-samples/{current-user-fields.php → current-user-fields.x-php} +0 -0
  48. includes/menu-pages/code-samples/{current-user-first-name.php → current-user-first-name.x-php} +0 -0
  49. includes/menu-pages/code-samples/{current-user-id.php → current-user-id.x-php} +0 -0
  50. includes/menu-pages/code-samples/{current-user-ip.php → current-user-ip.x-php} +0 -0
  51. includes/menu-pages/code-samples/{current-user-is-logged-in-as-member.php → current-user-is-logged-in-as-member.x-php} +0 -0
  52. includes/menu-pages/code-samples/{current-user-is-logged-in.php → current-user-is-logged-in.x-php} +0 -0
  53. includes/menu-pages/code-samples/{current-user-is-specific-content.php → current-user-is-specific-content.x-php} +0 -0
  54. includes/menu-pages/code-samples/{current-user-last-name.php → current-user-last-name.x-php} +0 -0
  55. includes/menu-pages/code-samples/{current-user-login-counter.php → current-user-login-counter.x-php} +0 -0
  56. includes/menu-pages/code-samples/{current-user-login.php → current-user-login.x-php} +0 -0
  57. includes/menu-pages/code-samples/{current-user-paid-registration-days-dripping.php → current-user-paid-registration-days-dripping.x-php} +0 -0
  58. includes/menu-pages/code-samples/{current-user-paid-registration-days.php → current-user-paid-registration-days.x-php} +0 -0
  59. includes/menu-pages/code-samples/{current-user-paid-registration-time.php → current-user-paid-registration-time.x-php} +0 -0
  60. includes/menu-pages/code-samples/{current-user-profile-modification-page-url-1-ops.php → current-user-profile-modification-page-url-1-ops.x-php} +0 -0
  61. includes/menu-pages/code-samples/{current-user-profile-modification-page-url-1.php → current-user-profile-modification-page-url-1.x-php} +0 -0
  62. includes/menu-pages/code-samples/{current-user-profile-modification-page-url-2-ops.php → current-user-profile-modification-page-url-2-ops.x-php} +0 -0
  63. includes/menu-pages/code-samples/{current-user-profile-modification-page-url-2.php → current-user-profile-modification-page-url-2.x-php} +0 -0
  64. includes/menu-pages/code-samples/{current-user-profile-modification-page-url-3-ops.php → current-user-profile-modification-page-url-3-ops.x-php} +0 -0
  65. includes/menu-pages/code-samples/{current-user-profile-modification-page-url-3.php → current-user-profile-modification-page-url-3.x-php} +0 -0
  66. includes/menu-pages/code-samples/{current-user-registration-days.php → current-user-registration-days.x-php} +0 -0
  67. includes/menu-pages/code-samples/{current-user-registration-ip.php → current-user-registration-ip.x-php} +0 -0
  68. includes/menu-pages/code-samples/{current-user-registration-time.php → current-user-registration-time.x-php} +0 -0
  69. includes/menu-pages/code-samples/{current-user-subscr-gateway.php → current-user-subscr-gateway.x-php} +0 -0
  70. includes/menu-pages/code-samples/{current-user-subscr-id.php → current-user-subscr-id.x-php} +0 -0
  71. includes/menu-pages/code-samples/{current-user-subscr-or-wp-id.php → current-user-subscr-or-wp-id.x-php} +0 -0
  72. includes/menu-pages/code-samples/{current-user-value-for-pp-on0-os0-on1-os1.php → current-user-value-for-pp-on0-os0-on1-os1.x-php} +0 -0
  73. includes/menu-pages/code-samples/{custom-queries-loop.php → custom-queries-loop.x-php} +0 -0
  74. includes/menu-pages/code-samples/{custom-queries.php → custom-queries.x-php} +0 -0
  75. includes/menu-pages/code-samples/{file-download-inline-extensions.php → file-download-inline-extensions.x-php} +0 -0
  76. includes/menu-pages/code-samples/{file-download-limit-exceeded-page-url.php → file-download-limit-exceeded-page-url.x-php} +0 -0
  77. includes/menu-pages/code-samples/{idev-ccap-tracking-code.php → idev-ccap-tracking-code.x-php} +0 -0
  78. includes/menu-pages/code-samples/{idev-modification-tracking-code.php → idev-modification-tracking-code.x-php} +0 -0
  79. includes/menu-pages/code-samples/{idev-signup-tracking-code.php → idev-signup-tracking-code.x-php} +0 -0
  80. includes/menu-pages/code-samples/{idev-sp-tracking-code.php → idev-sp-tracking-code.x-php} +0 -0
  81. includes/menu-pages/code-samples/{is-user-logged-in.php → is-user-logged-in.x-php} +0 -0
  82. includes/menu-pages/code-samples/{jwplayer-standard-mp4.php → jwplayer-standard-mp4.x-php} +0 -0
  83. includes/menu-pages/code-samples/{jwplayer-streaming-mp4-sca.php → jwplayer-streaming-mp4-sca.x-php} +0 -0
  84. includes/menu-pages/code-samples/{jwplayer-streaming-mp4-webm.php → jwplayer-streaming-mp4-webm.x-php} +0 -0
  85. includes/menu-pages/code-samples/{jwplayer-streaming-mp4.php → jwplayer-streaming-mp4.x-php} +0 -0
  86. includes/menu-pages/code-samples/{level-file-downloads.php → level-file-downloads.x-php} +0 -0
  87. includes/menu-pages/code-samples/{leveln-file-downloads-allowed-days.php → leveln-file-downloads-allowed-days.x-php} +0 -0
  88. includes/menu-pages/code-samples/{leveln-file-downloads-allowed.php → leveln-file-downloads-allowed.x-php} +0 -0
  89. includes/menu-pages/code-samples/{leveln-label.php → leveln-label.x-php} +0 -0
  90. includes/menu-pages/code-samples/{login-page-url.php → login-page-url.x-php} +0 -0
  91. includes/menu-pages/code-samples/{login-welcome-page-url.php → login-welcome-page-url.x-php} +0 -0
  92. includes/menu-pages/code-samples/{logout-page-url.php → logout-page-url.x-php} +0 -0
  93. includes/menu-pages/code-samples/{membership-options-page-url.php → membership-options-page-url.x-php} +0 -0
  94. includes/menu-pages/code-samples/{mms-patch-load.php → mms-patch-load.x-php} +0 -0
  95. includes/menu-pages/code-samples/{mms-patch-ms-functions.php → mms-patch-ms-functions.x-php} +0 -0
  96. includes/menu-pages/code-samples/{mms-patch-user-new.php → mms-patch-user-new.x-php} +0 -0
  97. includes/menu-pages/code-samples/{mms-patch-wp-login.php → mms-patch-wp-login.x-php} +0 -0
  98. includes/menu-pages/code-samples/{paypal-api-endpoint.php → paypal-api-endpoint.x-php} +0 -0
  99. includes/menu-pages/code-samples/{paypal-api-password.php → paypal-api-password.x-php} +0 -0
  100. includes/menu-pages/code-samples/{paypal-api-signature.php → paypal-api-signature.x-php} +0 -0
  101. includes/menu-pages/code-samples/{paypal-api-username.php → paypal-api-username.x-php} +0 -0
  102. includes/menu-pages/code-samples/{paypal-business.php → paypal-business.x-php} +0 -0
  103. includes/menu-pages/code-samples/{paypal-endpoint.php → paypal-endpoint.x-php} +0 -0
  104. includes/menu-pages/code-samples/{paypal-notify-url.php → paypal-notify-url.x-php} +0 -0
  105. includes/menu-pages/code-samples/{paypal-pdt-identity-token.php → paypal-pdt-identity-token.x-php} +0 -0
  106. includes/menu-pages/code-samples/{paypal-return-url.php → paypal-return-url.x-php} +0 -0
  107. includes/menu-pages/code-samples/{reg-email-from-email.php → reg-email-from-email.x-php} +0 -0
  108. includes/menu-pages/code-samples/{reg-email-from-name.php → reg-email-from-name.x-php} +0 -0
  109. includes/menu-pages/code-samples/{s2-conditional-supplements-1.php → s2-conditional-supplements-1.x-php} +0 -0
  110. includes/menu-pages/code-samples/{s2-conditional-supplements-2.php → s2-conditional-supplements-2.x-php} +0 -0
  111. includes/menu-pages/code-samples/{s2-conditional-supplements-3.php → s2-conditional-supplements-3.x-php} +0 -0
  112. includes/menu-pages/code-samples/{s2member-paid-registration-time-examples.php → s2member-paid-registration-time-examples.x-php} +0 -0
  113. includes/menu-pages/code-samples/{s2member-paid-registration-time.php → s2member-paid-registration-time.x-php} +0 -0
  114. includes/menu-pages/code-samples/{sas-ccap-tracking-code.php → sas-ccap-tracking-code.x-php} +0 -0
  115. includes/menu-pages/code-samples/{sas-modification-tracking-code.php → sas-modification-tracking-code.x-php} +0 -0
  116. includes/menu-pages/code-samples/{sas-signup-tracking-code.php → sas-signup-tracking-code.x-php} +0 -0
  117. includes/menu-pages/code-samples/{sas-sp-tracking-code.php → sas-sp-tracking-code.x-php} +0 -0
  118. includes/menu-pages/code-samples/{sc-current-user-can-full-access-farm.php → sc-current-user-can-full-access-farm.x-php} +0 -0
  119. includes/menu-pages/code-samples/{sc-current-user-can-full-access.php → sc-current-user-can-full-access.x-php} +0 -0
  120. includes/menu-pages/code-samples/{sc-current-user-is-specific-content-farm.php → sc-current-user-is-specific-content-farm.x-php} +0 -0
  121. includes/menu-pages/code-samples/{sc-current-user-is-specific-content.php → sc-current-user-is-specific-content.x-php} +0 -0
  122. includes/menu-pages/code-samples/{sc-is-user-logged-in-farm.php → sc-is-user-logged-in-farm.x-php} +0 -0
  123. includes/menu-pages/code-samples/{sc-is-user-logged-in.php → sc-is-user-logged-in.x-php} +0 -0
  124. includes/menu-pages/code-samples/{sc-s2-conditional-nesting.php → sc-s2-conditional-nesting.x-php} +0 -0
  125. includes/menu-pages/code-samples/{sc-s2-conditional-supplements-1-farm.php → sc-s2-conditional-supplements-1-farm.x-php} +0 -0
  126. includes/menu-pages/code-samples/{sc-s2-conditional-supplements-1.php → sc-s2-conditional-supplements-1.x-php} +0 -0
  127. includes/menu-pages/code-samples/{sc-s2-conditional-supplements-2-farm.php → sc-s2-conditional-supplements-2-farm.x-php} +0 -0
  128. includes/menu-pages/code-samples/{sc-s2-conditional-supplements-2.php → sc-s2-conditional-supplements-2.x-php} +0 -0
  129. includes/menu-pages/code-samples/{sc-s2-conditional-supplements-3-farm.php → sc-s2-conditional-supplements-3-farm.x-php} +0 -0
  130. includes/menu-pages/code-samples/{sc-s2-conditional-supplements-3.php → sc-s2-conditional-supplements-3.x-php} +0 -0
  131. includes/menu-pages/code-samples/{specific-category-restrictions.php → specific-category-restrictions.x-php} +0 -0
  132. includes/menu-pages/code-samples/{specific-page-restrictions.php → specific-page-restrictions.x-php} +0 -0
  133. includes/menu-pages/code-samples/{specific-post-restrictions.php → specific-post-restrictions.x-php} +0 -0
  134. includes/menu-pages/code-samples/{specific-tag-restrictions.php → specific-tag-restrictions.x-php} +0 -0
  135. includes/menu-pages/code-samples/{version.php → version.x-php} +0 -0
  136. includes/menu-pages/down-ops.inc.php +4 -4
  137. includes/menu-pages/gen-ops.inc.php +51 -10
  138. includes/menu-pages/mms-ops.inc.php +4 -4
  139. includes/menu-pages/paypal-ops.inc.php +4 -4
  140. includes/menu-pages/scripting.inc.php +90 -90
  141. includes/menu-pages/trk-ops.inc.php +8 -8
  142. includes/syscon.inc.php +36 -26
  143. includes/templates/cfg-files/s2o-mu-plugins.php +9 -0
  144. includes/templates/cfg-files/s2o-nw-plugins.php +21 -0
  145. includes/templates/cfg-files/s2o-st-plugins.php +21 -0
  146. includes/templates/cfg-files/s2o-th-funcs.php +6 -0
  147. readme.txt +11 -4
  148. s2member-o.php +6 -6
  149. s2member.php +4 -4
includes/.htaccess ADDED
@@ -0,0 +1 @@
 
1
+ deny from all
includes/classes/catgs-sp.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
21
  {
@@ -43,41 +43,45 @@ if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && $cat_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Check? */
47
  {
48
- $cat_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_category_link ($cat_id));
49
  /**/
50
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
51
- /**/
52
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $cat_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level0")))
53
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
54
- /**/
55
- else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $cat_uri)) /* Never restrict Systematics. However, there is 1 exception ^. */
56
  {
57
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level restrictions. Go through each Level. We also check nested Categories. */
58
- {
59
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
60
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
61
- /**/
62
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
63
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
64
- /**/
65
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) /* Check Category ancestry. */
66
- foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
67
- if ($catg && cat_is_ancestor_of ($catg, $cat_id) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
68
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
69
- }
70
  /**/
71
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
72
  {
73
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
74
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
75
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
 
 
 
76
  return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
 
 
78
  }
79
- /**/
80
- do_action ("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars ());
81
  }
82
  /**/
83
  return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", null, 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_catgs_sp"))
21
  {
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_numeric ($cat_id) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ $cat_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_category_link ($cat_id)); /* Get a full valid URI for this Category. */
49
  /**/
50
+ if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $cat_uri)) /* Do NOT touch WordPress® Systematics. */
 
 
 
 
 
51
  {
52
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
53
+ /**/
54
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
55
+ return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
 
 
 
 
 
 
 
 
 
56
  /**/
57
+ else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $cat_uri)) /* Never restrict Systematics. However, there is 1 exception ^. */
58
  {
59
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level restrictions. Go through each Level. We also check nested Categories. */
60
+ {
61
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
62
+ return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
63
+ /**/
64
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
65
  return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
66
+ /**/
67
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) /* Check Category ancestry. */
68
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
69
+ if ($catg && cat_is_ancestor_of ($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
70
+ return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
71
+ }
72
+ /**/
73
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
74
+ {
75
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
76
+ /**/
77
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
78
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
79
+ return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
80
+ }
81
  }
82
+ /**/
83
+ do_action ("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars ());
84
  }
 
 
85
  }
86
  /**/
87
  return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars ());
includes/classes/catgs.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_catgs"))
21
  {
@@ -37,59 +37,49 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
37
  */
38
  public static function check_catg_level_access ()
39
  {
40
- global $post; /* get_the_ID() is NOT available outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
49
- /**/
50
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")))
51
  {
52
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
53
- exit ();
54
- }
55
- else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above ^. */
56
- {
57
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level restrictions. Go through each Level. We also check nested Categories. */
58
  {
59
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
60
  {
61
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
62
- exit ();
 
 
 
 
 
 
 
 
63
  }
64
  /**/
65
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
66
  {
67
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
68
- exit ();
 
 
 
69
  }
70
- /**/
71
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) /* Check Category ancestry. */
72
- foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
73
- if ($catg && cat_is_ancestor_of ($catg, $cat_id) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
74
- {
75
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
76
- exit ();
77
- }
78
  }
79
  /**/
80
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
81
- {
82
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
83
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
84
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
85
- {
86
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
87
- exit ();
88
- }
89
- }
90
  }
91
- /**/
92
- do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
93
  }
94
  /**/
95
  do_action ("ws_plugin__s2member_after_check_catg_level_access", 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_catgs"))
21
  {
37
  */
38
  public static function check_catg_level_access ()
39
  {
40
+ global $post; /* ``get_the_ID()`` is NOT available outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */
 
 
49
  {
50
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
51
+ /**/
52
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
53
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
54
+ /**/
55
+ else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above. */
56
  {
57
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level restrictions. Go through each Level. We also check nested Categories. */
58
  {
59
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
60
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
61
+ /**/
62
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
63
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
64
+ /**/
65
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) /* Check Category ancestry. */
66
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
67
+ if ($catg && cat_is_ancestor_of ($catg, $cat_id) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
68
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
69
  }
70
  /**/
71
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
72
  {
73
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
74
+ /**/
75
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
76
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
77
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "catg-" . $cat_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
78
  }
 
 
 
 
 
 
 
 
79
  }
80
  /**/
81
+ do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
 
 
 
 
 
 
 
 
 
82
  }
 
 
83
  }
84
  /**/
85
  do_action ("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars ());
includes/classes/files.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_files"))
21
  {
@@ -147,7 +147,7 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
147
  */
148
  public static function user_downloads ($user = FALSE, $not_counting_this_particular_file = FALSE, $log = NULL)
149
  {
150
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
151
  do_action ("ws_plugin__s2member_before_user_downloads", get_defined_vars ());
152
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
  /**/
@@ -196,25 +196,25 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
196
  */
197
  public static function file_download_key ($file = FALSE, $directive = FALSE)
198
  {
199
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
200
  do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
201
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
  /**/
203
  $file = ($file && is_string ($file) && ($file = trim ($file, "/"))) ? $file : "";
204
  /**/
205
  if ($directive === "ip-forever") /* Allows the current IP forever. */
206
- eval('$allow_caching = false; $salt = $file . $_SERVER["REMOTE_ADDR"];');
207
  /**/
208
  else if ($directive === "universal" || $directive === "cache-compatible" || $directive)
209
- eval('$allow_caching = true; $salt = $file;');
210
  /**/
211
  else /* Otherwise, we use the default ``$salt``, which is VERY restrictive; even to a specific browser. */
212
- eval('$allow_caching = false; $salt = date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file;');
213
  /**/
214
  $key = md5 (c_ws_plugin__s2member_utils_encryption::xencrypt ($salt));
215
  /**/
216
  if ($allow_caching === false) /* Disallow caching? */
217
- c_ws_plugin__s2member_no_cache::no_cache_constants (true);
218
  /**/
219
  return apply_filters ("ws_plugin__s2member_file_download_key", $key, get_defined_vars ());
220
  }
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_files"))
21
  {
147
  */
148
  public static function user_downloads ($user = FALSE, $not_counting_this_particular_file = FALSE, $log = NULL)
149
  {
150
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
151
  do_action ("ws_plugin__s2member_before_user_downloads", get_defined_vars ());
152
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
  /**/
196
  */
197
  public static function file_download_key ($file = FALSE, $directive = FALSE)
198
  {
199
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
200
  do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
201
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
  /**/
203
  $file = ($file && is_string ($file) && ($file = trim ($file, "/"))) ? $file : "";
204
  /**/
205
  if ($directive === "ip-forever") /* Allows the current IP forever. */
206
+ eval ('$allow_caching = false; $salt = $file . $_SERVER["REMOTE_ADDR"];');
207
  /**/
208
  else if ($directive === "universal" || $directive === "cache-compatible" || $directive)
209
+ eval ('$allow_caching = true; $salt = $file;');
210
  /**/
211
  else /* Otherwise, we use the default ``$salt``, which is VERY restrictive; even to a specific browser. */
212
+ eval ('$allow_caching = false; $salt = date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file;');
213
  /**/
214
  $key = md5 (c_ws_plugin__s2member_utils_encryption::xencrypt ($salt));
215
  /**/
216
  if ($allow_caching === false) /* Disallow caching? */
217
+ c_ws_plugin__s2member_no_cache::no_cache_constants (true); /* No caching. */
218
  /**/
219
  return apply_filters ("ws_plugin__s2member_file_download_key", $key, get_defined_vars ());
220
  }
includes/classes/menu-pages.inc.php CHANGED
@@ -265,7 +265,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
265
  do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
266
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
267
  /**/
268
- if ($plugin_file === plugin_basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($actions))
269
  {
270
  $settings = '<a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-gen-ops")) . '">Settings</a>';
271
  array_unshift ($actions, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
265
  do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
266
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
267
  /**/
268
+ if ($plugin_file === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"] && is_array ($actions))
269
  {
270
  $settings = '<a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-gen-ops")) . '">Settings</a>';
271
  array_unshift ($actions, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
includes/classes/no-cache.inc.php CHANGED
@@ -71,7 +71,7 @@ if (!class_exists ("c_ws_plugin__s2member_no_cache"))
71
  * @since 3.5
72
  *
73
  * @param bool $no_cache Optional. Defaults to false. If true, force no-cache headers if at all possible.
74
- * @return null
75
  *
76
  * @see s2Member\URIs\c_ws_plugin__s2member_ruris::check_ruri_level_access()
77
  * @see s2Member\Categories\c_ws_plugin__s2member_catgs::check_catg_level_access()
@@ -122,7 +122,7 @@ if (!class_exists ("c_ws_plugin__s2member_no_cache"))
122
  /**/
123
  do_action ("ws_plugin__s2member_after_no_cache_constants", get_defined_vars ());
124
  /**/
125
- return; /* Return for uniformity. */
126
  }
127
  /**
128
  * Sends Cache-Control ( no-cache ) headers.
@@ -134,7 +134,7 @@ if (!class_exists ("c_ws_plugin__s2member_no_cache"))
134
  * @package s2Member\No_Cache
135
  * @since 3.5
136
  *
137
- * @return null
138
  */
139
  public static function no_cache_headers ()
140
  {
@@ -145,26 +145,27 @@ if (!class_exists ("c_ws_plugin__s2member_no_cache"))
145
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
146
  /**/
147
  $using_selective_behavior = apply_filters ("ws_plugin__s2member_no_cache_headers_selective", false, get_defined_vars ());
148
- $selective = @$GLOBALS["ws_plugin__s2member_no_cache_headers_selective"]; /* Selective ( i.e. required ) ? */
149
  /**/
150
  if (!$once && empty ($_GET["qcABC"]) && (!$using_selective_behavior || $selective) && !apply_filters ("ws_plugin__s2member_disable_no_cache_headers", false, get_defined_vars ()))
151
  {
152
- if (is_array ($headers = headers_list ()))
153
- foreach ($headers as $header) /* Already? */
154
- if (stripos ($header, "no-cache") !== false)
155
- $no_cache_already_sent = true;
156
  /**/
157
- if (!$no_cache_already_sent)
158
- nocache_headers ();
 
159
  /**/
160
- $once = true; /* Only need to set these headers once. */
 
 
 
161
  /**/
162
  do_action ("ws_plugin__s2member_during_no_cache_headers", get_defined_vars ());
163
  }
164
  /**/
165
  do_action ("ws_plugin__s2member_after_no_cache_headers", get_defined_vars ());
166
  /**/
167
- return; /* Return for uniformity. */
168
  }
169
  }
170
  }
71
  * @since 3.5
72
  *
73
  * @param bool $no_cache Optional. Defaults to false. If true, force no-cache headers if at all possible.
74
+ * @return bool This function will always return `true`.
75
  *
76
  * @see s2Member\URIs\c_ws_plugin__s2member_ruris::check_ruri_level_access()
77
  * @see s2Member\Categories\c_ws_plugin__s2member_catgs::check_catg_level_access()
122
  /**/
123
  do_action ("ws_plugin__s2member_after_no_cache_constants", get_defined_vars ());
124
  /**/
125
+ return true; /* Always return true. */
126
  }
127
  /**
128
  * Sends Cache-Control ( no-cache ) headers.
134
  * @package s2Member\No_Cache
135
  * @since 3.5
136
  *
137
+ * @return bool This function will always return `true`.
138
  */
139
  public static function no_cache_headers ()
140
  {
145
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
146
  /**/
147
  $using_selective_behavior = apply_filters ("ws_plugin__s2member_no_cache_headers_selective", false, get_defined_vars ());
148
+ $selective = @$GLOBALS["ws_plugin__s2member_no_cache_headers_selective"]; /* Selective ( i.e. required )? */
149
  /**/
150
  if (!$once && empty ($_GET["qcABC"]) && (!$using_selective_behavior || $selective) && !apply_filters ("ws_plugin__s2member_disable_no_cache_headers", false, get_defined_vars ()))
151
  {
152
+ $no_cache_headers_already_sent = false; /* Only if NOT already sent. Initialize this to a false value. */
 
 
 
153
  /**/
154
+ foreach (headers_list () as $header) /* No-cache headers already sent? We need to check here. */
155
+ if (stripos ($header, "no-cache") !== false) /* No-cache headers already sent? */
156
+ eval('$no_cache_headers_already_sent = true; break;');
157
  /**/
158
+ if (!$no_cache_headers_already_sent) /* Now check it here. */
159
+ nocache_headers (); /* Only if NOT already sent. */
160
+ /**/
161
+ $once = true; /* Only set these headers once. */
162
  /**/
163
  do_action ("ws_plugin__s2member_during_no_cache_headers", get_defined_vars ());
164
  }
165
  /**/
166
  do_action ("ws_plugin__s2member_after_no_cache_headers", get_defined_vars ());
167
  /**/
168
+ return true; /* Always return true. */
169
  }
170
  }
171
  }
includes/classes/pages-sp.inc.php CHANGED
@@ -43,62 +43,68 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_page_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && $page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Check? */
47
  {
48
- $page_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_page_link ($page_id));
49
  /**/
50
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
51
- /**/
52
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (!$check_user || !$user || !current_user_can ("access_s2member_level0")) && $page_id != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
53
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
54
- /**/
55
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $page_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level0")) && $page_id != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
56
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
57
- /**/
58
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && (!$check_user || !$user || !current_user_can ("access_s2member_level0")) && $page_id != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
59
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
60
- /**/
61
- else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($page_id, $page_uri)) /* However, there are 3 exceptions ^. */
62
  {
63
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Page Level restrictions. Go through each Level. */
64
- {
65
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
66
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
67
- /**/
68
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
69
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
70
- }
71
  /**/
72
- if (has_tag ("", $page_id)) /* Here we take a look to see if this Page has any Tags. If so, we need to run the full set of routines against Tags also. */
 
 
 
 
 
 
 
 
 
73
  {
74
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions ( possibly through Page Tagger ). Go through each Level. */
75
  {
76
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
77
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
78
  /**/
79
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $page_id) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
80
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
81
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
  /**/
84
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
85
- {
86
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
87
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
88
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $page_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
89
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
90
- }
91
- /**/
92
- if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req))
93
- foreach ($ccaps_req as $ccap) /* The $user MUST satisfy ALL Custom Capabilities. Serialized array. */
94
- if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
95
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
96
- /**/
97
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access ($page_id, "read-only")))
98
- return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_sp_req" => $page_id), get_defined_vars ());
99
  }
100
- /**/
101
- do_action ("ws_plugin__s2member_during_check_specific_page_level_access", get_defined_vars ());
102
  }
103
  /**/
104
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", null, get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_page_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_numeric ($page_id) && ($page_id = (int)$page_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ $page_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_page_link ($page_id)); /* Get a full valid URI for this Page now. */
49
  /**/
50
+ if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($page_id, $page_uri)) /* Do NOT touch WordPress® Systematics. */
 
 
 
 
 
 
 
 
 
 
 
51
  {
52
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
 
 
 
 
 
 
 
53
  /**/
54
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
55
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
56
+ /**/
57
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $page_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
58
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
59
+ /**/
60
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
61
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
62
+ /**/
63
+ else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($page_id, $page_uri)) /* However, there are 3 exceptions above. */
64
  {
65
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Page Level restrictions. Go through each Level. */
66
  {
67
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
68
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
69
  /**/
70
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
71
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
72
  }
73
+ /**/
74
+ if (has_tag ("", $page_id)) /* Here we take a look to see if this Page has any Tags. If so, we need to run the full set of routines against Tags also. */
75
+ {
76
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions ( possibly through Page Tagger ). Go through each Level. */
77
+ {
78
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
79
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
80
+ /**/
81
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $page_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
82
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
83
+ }
84
+ }
85
+ /**/
86
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
87
+ {
88
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
89
+ /**/
90
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
91
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $page_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
92
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
93
+ }
94
+ /**/
95
+ if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req))
96
+ {
97
+ foreach ($ccaps_req as $ccap) /* The ``$user`` MUST satisfy ALL Custom Capabilities. */
98
+ if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
99
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
100
+ }
101
+ /**/
102
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access ($page_id, "read-only")))
103
+ return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_sp_req" => $page_id), get_defined_vars ());
104
  }
105
  /**/
106
+ do_action ("ws_plugin__s2member_during_check_specific_page_level_access", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
 
 
108
  }
109
  /**/
110
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", null, get_defined_vars ());
includes/classes/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_pages"))
21
  {
@@ -37,93 +37,72 @@ if (!class_exists ("c_ws_plugin__s2member_pages"))
37
  */
38
  public static function check_page_level_access ()
39
  {
40
- global $post; /* get_the_ID() unavailable outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_page_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_page_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && is_page () && is_object ($post) && ($page_id = $post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
49
- /**/
50
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")) && $page_id != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
51
  {
52
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
53
- exit ();
54
- }
55
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")) && $page_id != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
56
- {
57
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
58
- exit ();
59
- }
60
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")) && $page_id != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
61
- {
62
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
63
- exit ();
64
- }
65
- else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Never restrict Systematics. However, there are 3 exceptions ^. */
66
- {
67
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Page Level restrictions. Go through each Level. */
68
  {
69
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
70
  {
71
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
72
- exit ();
 
 
 
73
  }
74
  /**/
75
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
76
- {
77
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
78
- exit ();
79
- }
80
- }
81
- /**/
82
- if (has_tag ()) /* Here we take a look to see if this Page has any Tags. If so, we need to run the full set of routines against Tags also. */
83
- {
84
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions ( possibly through Page Tagger ). Go through each Level. */
85
  {
86
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
87
- {
88
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
89
- exit ();
90
- }
91
- /**/
92
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
93
  {
94
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
95
- exit ();
 
 
 
96
  }
97
  }
98
- }
99
- /**/
100
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
101
- {
102
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
103
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
104
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
105
- {
106
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
107
- exit ();
108
- }
109
- }
110
- /**/
111
- if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill")
112
- foreach ($ccaps_req as $ccap) /* The $user MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
113
- if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
114
  {
115
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_ccap_req" => $ccap)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
116
- exit ();
 
 
 
117
  }
118
- /**/
119
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && !c_ws_plugin__s2member_sp_access::sp_access ($page_id))
120
- {
121
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_sp_req" => $page_id)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
122
- exit ();
 
 
 
 
 
123
  }
 
 
124
  }
125
- /**/
126
- do_action ("ws_plugin__s2member_during_check_page_level_access", get_defined_vars ());
127
  }
128
  /**/
129
  do_action ("ws_plugin__s2member_after_check_page_level_access", 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_pages"))
21
  {
37
  */
38
  public static function check_page_level_access ()
39
  {
40
+ global $post; /* ``get_the_ID()`` unavailable outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_page_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_page_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_page () && is_object ($post) && ($page_id = (int)$post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */
 
 
49
  {
50
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
51
+ /**/
52
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
53
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
54
+ /**/
55
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
56
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
57
+ /**/
58
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
59
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
60
+ /**/
61
+ else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Never restrict Systematics. However, there are 3 exceptions above. */
 
 
 
 
62
  {
63
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Page Level restrictions. Go through each Level. */
64
  {
65
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
66
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
67
+ /**/
68
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
69
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
70
  }
71
  /**/
72
+ if (has_tag ()) /* Here we take a look to see if this Page has any Tags. If so, we need to run the full set of routines against Tags also. */
 
 
 
 
 
 
 
 
 
73
  {
74
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions ( possibly through Page Tagger ). Go through each Level. */
 
 
 
 
 
 
75
  {
76
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
77
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
78
+ /**/
79
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
80
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
81
  }
82
  }
83
+ /**/
84
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  {
86
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
87
+ /**/
88
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
89
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
90
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
91
  }
92
+ /**/
93
+ if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants (true))
94
+ {
95
+ foreach ($ccaps_req as $ccap) /* The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
96
+ if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
97
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_ccap_req" => $ccap)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
98
+ }
99
+ /**/
100
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && !c_ws_plugin__s2member_sp_access::sp_access ($page_id))
101
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "page-" . $page_id, "s2member_sp_req" => $page_id)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
102
  }
103
+ /**/
104
+ do_action ("ws_plugin__s2member_during_check_page_level_access", get_defined_vars ());
105
  }
 
 
106
  }
107
  /**/
108
  do_action ("ws_plugin__s2member_after_check_page_level_access", get_defined_vars ());
includes/classes/posts-sp.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
21
  {
@@ -43,65 +43,71 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_post_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && $post_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Check? */
47
  {
48
- $post_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_permalink ($post_id));
49
  /**/
50
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
51
- /**/
52
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $post_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level0")))
53
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
54
- /**/
55
- else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $post_uri)) /* Never restrict Systematics. However, there is 1 exception ^. */
56
  {
57
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Post Level restrictions ( including Custom Post Types ). Go through each Level. */
58
- {
59
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
60
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
61
- /**/
62
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
63
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
64
- }
65
  /**/
66
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level Access against this Post. Go through each Level. */
67
- {
68
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
69
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
70
- /**/
71
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (in_category (($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])), $post_id) || c_ws_plugin__s2member_utils_conds::in_descendant_category ($catgs, $post_id)) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
72
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
73
- }
74
  /**/
75
- if (has_tag ("", $post_id)) /* Here we take a look to see if this Post has any Tags. If so, we need to run the full set of routines against Tags also. */
76
  {
77
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions now. Go through each Level. */
78
  {
79
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
80
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
81
  /**/
82
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $post_id) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
83
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
84
  }
85
- }
86
- /**/
87
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
88
- {
89
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
90
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
91
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $post_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
92
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
  /**/
95
- if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req))
96
- foreach ($ccaps_req as $ccap) /* The $user MUST satisfy ALL Custom Capabilities. Serialized array. */
97
- if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
98
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
99
- /**/
100
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access ($post_id, "read-only")))
101
- return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_sp_req" => $post_id), get_defined_vars ());
102
  }
103
- /**/
104
- do_action ("ws_plugin__s2member_during_check_specific_post_level_access", get_defined_vars ());
105
  }
106
  /**/
107
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", null, 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_posts_sp"))
21
  {
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_post_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_numeric ($post_id) && ($post_id = (int)$post_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ $post_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_permalink ($post_id)); /* Get a full valid URI for this Post now. */
49
  /**/
50
+ if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($post_id, $post_uri)) /* Do NOT touch WordPress® Systematics. */
 
 
 
 
 
51
  {
52
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
 
 
 
 
 
 
 
53
  /**/
54
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $post_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
55
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
 
 
 
 
 
 
56
  /**/
57
+ else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($post_id, $post_uri)) /* Never restrict Systematics. However, there is 1 exception above. */
58
  {
59
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Post Level restrictions ( including Custom Post Types ). Go through each Level. */
60
  {
61
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
62
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
63
  /**/
64
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
65
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
66
  }
67
+ /**/
68
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level Access against this Post. Go through each Level. */
69
+ {
70
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
71
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
72
+ /**/
73
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (in_category (($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])), $post_id) || c_ws_plugin__s2member_utils_conds::in_descendant_category ($catgs, $post_id)) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
74
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
75
+ }
76
+ /**/
77
+ if (has_tag ("", $post_id)) /* Here we take a look to see if this Post has any Tags. If so, we need to run the full set of routines against Tags also. */
78
+ {
79
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions now. Go through each Level. */
80
+ {
81
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
82
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
83
+ /**/
84
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $post_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
85
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
86
+ }
87
+ }
88
+ /**/
89
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
90
+ {
91
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
92
+ /**/
93
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
94
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $post_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
95
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
96
+ }
97
+ /**/
98
+ if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req))
99
+ {
100
+ foreach ($ccaps_req as $ccap) /* The $user MUST satisfy ALL Custom Capabilities. Serialized array. */
101
+ if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
102
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
103
+ }
104
+ /**/
105
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access ($post_id, "read-only")))
106
+ return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_sp_req" => $post_id), get_defined_vars ());
107
  }
108
  /**/
109
+ do_action ("ws_plugin__s2member_during_check_specific_post_level_access", get_defined_vars ());
 
 
 
 
 
 
110
  }
 
 
111
  }
112
  /**/
113
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", null, get_defined_vars ());
includes/classes/posts.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_posts"))
21
  {
@@ -37,98 +37,75 @@ if (!class_exists ("c_ws_plugin__s2member_posts"))
37
  */
38
  public static function check_post_level_access ()
39
  {
40
- global $post; /* get_the_ID() unavailable outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_post_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_post_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && is_single () && is_object ($post) && ($post_id = $post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
49
- /**/
50
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")))
51
  {
52
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
53
- exit ();
54
- }
55
- else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception ^. */
56
- {
57
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Post Level restrictions ( including Custom Post Types ). Go through each Level. */
58
  {
59
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
60
  {
61
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
62
- exit ();
 
 
 
63
  }
64
  /**/
65
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
66
  {
67
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
68
- exit ();
 
 
 
69
  }
70
- }
71
- /**/
72
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level restrictions. Go through each Level. */
73
- {
74
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
75
  {
76
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
77
- exit ();
 
 
 
 
 
 
78
  }
79
  /**/
80
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (in_category (($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])), $post_id) || c_ws_plugin__s2member_utils_conds::in_descendant_category ($catgs, $post_id)) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
81
  {
82
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
83
- exit ();
 
 
 
84
  }
85
- }
86
- /**/
87
- if (has_tag ()) /* Here we take a look to see if this Post has any Tags. If so, we need to run the full set of routines against Tags also. */
88
- {
89
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions. Go through each Level. */
90
  {
91
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
92
- {
93
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
94
- exit ();
95
- }
96
- /**/
97
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
98
- {
99
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
100
- exit ();
101
- }
102
  }
 
 
 
103
  }
104
  /**/
105
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
106
- {
107
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
108
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
109
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
110
- {
111
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
112
- exit ();
113
- }
114
- }
115
- /**/
116
- if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill")
117
- foreach ($ccaps_req as $ccap) /* The $user MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
118
- if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
119
- {
120
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_ccap_req" => $ccap)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
121
- exit ();
122
- }
123
- /**/
124
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && !c_ws_plugin__s2member_sp_access::sp_access ($post_id))
125
- {
126
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_sp_req" => $post_id)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
127
- exit ();
128
- }
129
  }
130
- /**/
131
- do_action ("ws_plugin__s2member_during_check_post_level_access", get_defined_vars ());
132
  }
133
  /**/
134
  do_action ("ws_plugin__s2member_after_check_post_level_access", 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_posts"))
21
  {
37
  */
38
  public static function check_post_level_access ()
39
  {
40
+ global $post; /* ``get_the_ID()`` unavailable outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_post_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_post_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_single () && is_object ($post) && ($post_id = (int)$post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */
 
 
49
  {
50
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
51
+ /**/
52
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
53
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
54
+ /**/
55
+ else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above. */
56
  {
57
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Post Level restrictions ( including Custom Post Types ). Go through each Level. */
58
  {
59
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
60
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
61
+ /**/
62
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
63
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
64
  }
65
  /**/
66
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Category Level restrictions. Go through each Level. */
67
  {
68
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
69
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
70
+ /**/
71
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (in_category (($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])), $post_id) || c_ws_plugin__s2member_utils_conds::in_descendant_category ($catgs, $post_id)) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
72
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
73
  }
74
+ /**/
75
+ if (has_tag ()) /* Here we take a look to see if this Post has any Tags. If so, we need to run the full set of routines against Tags also. */
 
 
 
76
  {
77
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions. Go through each Level. */
78
+ {
79
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
80
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
81
+ /**/
82
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
83
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
84
+ }
85
  }
86
  /**/
87
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
88
  {
89
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
90
+ /**/
91
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
92
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
93
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
94
  }
95
+ /**/
96
+ if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants (true))
 
 
 
97
  {
98
+ foreach ($ccaps_req as $ccap) /* The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
99
+ if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
100
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_ccap_req" => $ccap)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
 
 
 
 
 
 
 
 
101
  }
102
+ /**/
103
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && !c_ws_plugin__s2member_sp_access::sp_access ($post_id))
104
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "post-" . $post_id, "s2member_sp_req" => $post_id)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
105
  }
106
  /**/
107
+ do_action ("ws_plugin__s2member_during_check_post_level_access", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
 
 
109
  }
110
  /**/
111
  do_action ("ws_plugin__s2member_after_check_post_level_access", get_defined_vars ());
includes/classes/profile-in.inc.php CHANGED
@@ -43,7 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_in"))
43
  /**/
44
  if (!empty ($_GET["s2member_profile"])) /* Requesting Profile? */
45
  {
46
- c_ws_plugin__s2member_no_cache::no_cache_constants (true);
47
  /**/
48
  $tabindex = apply_filters ("ws_plugin__s2member_sc_profile_tabindex", 0, get_defined_vars ());
49
  /**/
43
  /**/
44
  if (!empty ($_GET["s2member_profile"])) /* Requesting Profile? */
45
  {
46
+ c_ws_plugin__s2member_no_cache::no_cache_constants (true); /* No caching. */
47
  /**/
48
  $tabindex = apply_filters ("ws_plugin__s2member_sc_profile_tabindex", 0, get_defined_vars ());
49
  /**/
includes/classes/ptags-sp.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
21
  {
@@ -43,59 +43,59 @@ if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
43
  /**/
44
  if ($_tag && is_numeric ($_tag) && is_object ($term = get_term_by ("id", $_tag, "post_tag")))
45
  {
46
- $tag_id = $_tag; /* We need the $tag_id, $tag_slug, and also the $tag_name. */
47
  $tag_slug = $term->slug; /* Tag slug. */
48
  $tag_name = $term->name; /* Tag name. */
49
  }
50
- else if ($_tag && is_string ($_tag)) /* A string? Either a Tag name or a slug. */
51
  {
52
- /* Here, we give "name" priority, because it's likely to be a Tag name. */
53
- if (is_object ($term = get_term_by ("name", $_tag, "post_tag")))
54
- {
55
- $tag_name = $_tag; /* A name was passed in. */
56
- $tag_id = $term->term_id; /* Tag ID. */
57
- $tag_slug = $term->slug; /* Tag slug. */
58
- }
59
- else if (is_object ($term = get_term_by ("slug", $_tag, "post_tag")))
60
- {
61
- $tag_slug = $_tag; /* A slug was passed in. */
62
- $tag_id = $term->term_id; /* Tag ID. */
63
- $tag_name = $term->name; /* Tag name. */
64
- }
65
  }
66
  /**/
67
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access_excluded", false, get_defined_vars ());
68
  /**/
69
  if (!$excluded && !empty ($tag_id) && !empty ($tag_slug) && !empty ($tag_name) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
70
  {
71
- $tag_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_tag_link ($tag_id));
72
- /**/
73
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
74
  /**/
75
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $tag_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level0")))
76
- return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
77
- /**/
78
- else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $tag_uri)) /* Never restrict Systematics. However, there is 1 exception ^. */
79
  {
80
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions. Go through each Level. */
81
- {
82
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
83
- return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
84
- /**/
85
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (in_array ($tag_name, ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]))) || in_array ($tag_slug, $tags)) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
86
- return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
87
- }
88
  /**/
89
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
90
  {
91
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
92
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
93
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $tag_uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
94
  return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
 
 
96
  }
97
- /**/
98
- do_action ("ws_plugin__s2member_during_check_specific_ptag_level_access", get_defined_vars ());
99
  }
100
  /**/
101
  return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", null, 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_ptags_sp"))
21
  {
43
  /**/
44
  if ($_tag && is_numeric ($_tag) && is_object ($term = get_term_by ("id", $_tag, "post_tag")))
45
  {
46
+ $tag_id = (int)$_tag; /* Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``. */
47
  $tag_slug = $term->slug; /* Tag slug. */
48
  $tag_name = $term->name; /* Tag name. */
49
  }
50
+ else if ($_tag && is_string ($_tag) && is_object ($term = get_term_by ("name", $_tag, "post_tag")))
51
  {
52
+ $tag_name = $_tag; /* Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``. */
53
+ $tag_id = (int)$term->term_id; /* Tag ID. */
54
+ $tag_slug = $term->slug; /* Tag slug. */
55
+ }
56
+ else if ($_tag && is_string ($_tag) && is_object ($term = get_term_by ("slug", $_tag, "post_tag")))
57
+ {
58
+ $tag_slug = $_tag; /* Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``. */
59
+ $tag_id = (int)$term->term_id; /* Tag ID. */
60
+ $tag_name = $term->name; /* Tag name. */
 
 
 
 
61
  }
62
  /**/
63
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access_excluded", false, get_defined_vars ());
64
  /**/
65
  if (!$excluded && !empty ($tag_id) && !empty ($tag_slug) && !empty ($tag_name) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
66
  {
67
+ $tag_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_tag_link ($tag_id)); /* Get a full valid URI for this Tag. */
 
 
68
  /**/
69
+ if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $tag_uri)) /* Do NOT touch WordPress® Systematics. */
 
 
 
70
  {
71
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
72
+ /**/
73
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $tag_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
74
+ return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
 
 
 
 
75
  /**/
76
+ else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $tag_uri)) /* Never restrict Systematics. However, there is 1 exception above. */
77
  {
78
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions. Go through each Level. */
79
+ {
80
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
81
  return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
82
+ /**/
83
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (in_array ($tag_name, ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]))) || in_array ($tag_slug, $tags)) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
84
+ return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
85
+ }
86
+ /**/
87
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
88
+ {
89
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
90
+ /**/
91
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
92
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $tag_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
93
+ return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
94
+ }
95
  }
96
+ /**/
97
+ do_action ("ws_plugin__s2member_during_check_specific_ptag_level_access", get_defined_vars ());
98
  }
 
 
99
  }
100
  /**/
101
  return apply_filters ("ws_plugin__s2member_check_specific_ptag_level_access", null, get_defined_vars ());
includes/classes/ptags.inc.php CHANGED
@@ -37,51 +37,44 @@ if (!class_exists ("c_ws_plugin__s2member_ptags"))
37
  */
38
  public static function check_ptag_level_access ()
39
  {
40
- global $wp_query, $post; /* get_the_ID() is NOT available outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_ptag_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_ptag_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
- if (!$excluded && is_tag () && is_object ($tag = $wp_query->get_queried_object ()) && ($tag_id = $tag->term_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
49
- /**/
50
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")))
51
  {
52
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
53
- exit ();
54
- }
55
- else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above ^. */
56
- {
57
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions. Go through each Level. */
58
  {
59
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
60
  {
61
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
62
- exit ();
 
 
 
63
  }
64
  /**/
65
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (is_tag ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) || in_array ($tag_id, $tags)) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
66
  {
67
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
68
- exit ();
 
 
 
69
  }
70
  }
71
  /**/
72
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
73
- {
74
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
75
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
76
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
77
- {
78
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
79
- exit ();
80
- }
81
- }
82
  }
83
- /**/
84
- do_action ("ws_plugin__s2member_during_check_ptag_level_access", get_defined_vars ());
85
  }
86
  /**/
87
  do_action ("ws_plugin__s2member_after_check_ptag_level_access", get_defined_vars ());
37
  */
38
  public static function check_ptag_level_access ()
39
  {
40
+ global $wp_query, $post; /* ``get_the_ID()`` is NOT available outside The Loop. */
41
  /**/
42
  do_action ("ws_plugin__s2member_before_check_ptag_level_access", get_defined_vars ());
43
  /**/
44
  $excluded = apply_filters ("ws_plugin__s2member_check_ptag_level_access_excluded", false, get_defined_vars ());
45
  /**/
46
+ if (!$excluded && is_tag () && is_object ($tag = $wp_query->get_queried_object ()) && ($tag_id = (int)$tag->term_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
  {
48
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */
 
 
49
  {
50
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
51
+ /**/
52
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
53
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
54
+ /**/
55
+ else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above. */
56
  {
57
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* Tag Level restrictions. Go through each Level. */
58
  {
59
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
60
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
61
+ /**/
62
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (is_tag ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) || in_array ($tag_id, $tags)) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
63
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
64
  }
65
  /**/
66
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
67
  {
68
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
69
+ /**/
70
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
71
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
72
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ptag-" . $tag_id, "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
73
  }
74
  }
75
  /**/
76
+ do_action ("ws_plugin__s2member_during_check_ptag_level_access", get_defined_vars ());
 
 
 
 
 
 
 
 
 
77
  }
 
 
78
  }
79
  /**/
80
  do_action ("ws_plugin__s2member_after_check_ptag_level_access", get_defined_vars ());
includes/classes/querys.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_querys"))
21
  {
@@ -52,13 +52,13 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
52
  */
53
  public static function force_query_level_access (&$wp_query = FALSE)
54
  {
55
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
56
  do_action ("ws_plugin__s2member_before_force_query_level_access", get_defined_vars ());
57
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
58
  /**/
59
  c_ws_plugin__s2member_querys::query_level_access ($wp_query, true);
60
  /**/
61
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
62
  do_action ("ws_plugin__s2member_after_force_query_level_access", get_defined_vars ());
63
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
64
  /**/
@@ -86,14 +86,14 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
86
  static $initial_query = true; /* Tracks initial query. */
87
  c_ws_plugin__s2member_querys::$current_wp_query = &$wp_query;
88
  /**/
89
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
90
  do_action ("ws_plugin__s2member_before_query_level_access", get_defined_vars ());
91
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
  /**/
93
  c_ws_plugin__s2member_querys::_query_level_access_sys ($wp_query); /* Systematics. */
94
  /**/
95
- remove_filter ("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 20, 2);
96
- remove_filter ("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 20);
97
  /**/
98
  if (is_object ($wpdb) && is_object ($wp_query) && (($o = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]) || $force))
99
  {
@@ -108,11 +108,11 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
108
  || (($suppressing_filters !== "n/a") && (in_array ("all", $o) || in_array ("nav-menus", $o)) && in_array ("wp_get_nav_menu_items", ($callers = (isset ($callers) ? $callers : c_ws_plugin__s2member_utilities::callers ()))))/**/)
109
  {
110
  if (!$suppressing_filters && (in_array ("all", $o) || in_array ("comment-feeds", $o)) && $wp_query->is_feed () && $wp_query->is_comment_feed ())
111
- add_filter ("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 20, 2);
112
  /**/
113
  if ($suppressing_filters !== "n/a" && (in_array ("all", $o) || in_array ("nav-menus", $o))) /* Suppression irrelevant here. */
114
  if (in_array ("wp_get_nav_menu_items", ($callers = (isset ($callers) ? $callers : c_ws_plugin__s2member_utilities::callers ()))))
115
- add_filter ("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 20);
116
  /**/
117
  if ((is_user_logged_in () && is_object ($user = wp_get_current_user ()) && ($user_id = $user->ID)) || !($user = false))
118
  {
@@ -214,14 +214,14 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
214
  }
215
  }
216
  /**/
217
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
218
  do_action ("ws_plugin__s2member_during_query_level_access", get_defined_vars ());
219
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
  }
221
  }
222
  }
223
  /**/
224
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
225
  do_action ("ws_plugin__s2member_after_query_level_access", get_defined_vars ());
226
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
227
  /**/
@@ -245,7 +245,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
245
  {
246
  global $wpdb; /* Global database object reference. */
247
  /**/
248
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
249
  do_action ("_ws_plugin__s2member_before_query_level_access_sys", get_defined_vars ());
250
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
251
  /**/
@@ -257,12 +257,12 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
257
  $wp_query->set ("post__in", array_unique (array_diff ((array)$wp_query->get ("post__in"), $s)));
258
  $wp_query->set ("post__not_in", array_unique (array_merge ((array)$wp_query->get ("post__not_in"), $s)));
259
  /**/
260
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
261
  do_action ("_ws_plugin__s2member_during_query_level_access_sys", get_defined_vars ());
262
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
  }
264
  /**/
265
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
266
  do_action ("_ws_plugin__s2member_after_query_level_access_sys", get_defined_vars ());
267
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
268
  /**/
@@ -296,13 +296,13 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
296
  {
297
  foreach ($items as $child_item_key => $child_item)
298
  if (!empty ($child_item->menu_item_parent) && (int)$child_item->menu_item_parent === (int)$item->ID)
299
- unset($items[$child_item_key]);
300
  /**/
301
- unset($items[$item_key]);
302
  }
303
  }
304
  /**/
305
- remove_filter ("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 20);
306
  return apply_filters ("_ws_plugin__s2member_query_level_access_navs", $items, get_defined_vars ());
307
  }
308
  /**
@@ -329,7 +329,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
329
  $cwhere .= " AND `" . $wpdb->comments . "`.`comment_post_ID` NOT IN('" . implode ("','", c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms ($terms)) . "')";
330
  }
331
  /**/
332
- remove_filter ("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 20, 2);
333
  return apply_filters ("_ws_plugin__s2member_query_level_access_coms", $cwhere, get_defined_vars ());
334
  }
335
  /**
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
+ exit ("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_querys"))
21
  {
52
  */
53
  public static function force_query_level_access (&$wp_query = FALSE)
54
  {
55
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
56
  do_action ("ws_plugin__s2member_before_force_query_level_access", get_defined_vars ());
57
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
58
  /**/
59
  c_ws_plugin__s2member_querys::query_level_access ($wp_query, true);
60
  /**/
61
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
62
  do_action ("ws_plugin__s2member_after_force_query_level_access", get_defined_vars ());
63
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
64
  /**/
86
  static $initial_query = true; /* Tracks initial query. */
87
  c_ws_plugin__s2member_querys::$current_wp_query = &$wp_query;
88
  /**/
89
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
90
  do_action ("ws_plugin__s2member_before_query_level_access", get_defined_vars ());
91
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
  /**/
93
  c_ws_plugin__s2member_querys::_query_level_access_sys ($wp_query); /* Systematics. */
94
  /**/
95
+ remove_filter ("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 100, 2);
96
+ remove_filter ("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 100);
97
  /**/
98
  if (is_object ($wpdb) && is_object ($wp_query) && (($o = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]) || $force))
99
  {
108
  || (($suppressing_filters !== "n/a") && (in_array ("all", $o) || in_array ("nav-menus", $o)) && in_array ("wp_get_nav_menu_items", ($callers = (isset ($callers) ? $callers : c_ws_plugin__s2member_utilities::callers ()))))/**/)
109
  {
110
  if (!$suppressing_filters && (in_array ("all", $o) || in_array ("comment-feeds", $o)) && $wp_query->is_feed () && $wp_query->is_comment_feed ())
111
+ add_filter ("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 100, 2);
112
  /**/
113
  if ($suppressing_filters !== "n/a" && (in_array ("all", $o) || in_array ("nav-menus", $o))) /* Suppression irrelevant here. */
114
  if (in_array ("wp_get_nav_menu_items", ($callers = (isset ($callers) ? $callers : c_ws_plugin__s2member_utilities::callers ()))))
115
+ add_filter ("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 100);
116
  /**/
117
  if ((is_user_logged_in () && is_object ($user = wp_get_current_user ()) && ($user_id = $user->ID)) || !($user = false))
118
  {
214
  }
215
  }
216
  /**/
217
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
218
  do_action ("ws_plugin__s2member_during_query_level_access", get_defined_vars ());
219
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
  }
221
  }
222
  }
223
  /**/
224
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
225
  do_action ("ws_plugin__s2member_after_query_level_access", get_defined_vars ());
226
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
227
  /**/
245
  {
246
  global $wpdb; /* Global database object reference. */
247
  /**/
248
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
249
  do_action ("_ws_plugin__s2member_before_query_level_access_sys", get_defined_vars ());
250
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
251
  /**/
257
  $wp_query->set ("post__in", array_unique (array_diff ((array)$wp_query->get ("post__in"), $s)));
258
  $wp_query->set ("post__not_in", array_unique (array_merge ((array)$wp_query->get ("post__not_in"), $s)));
259
  /**/
260
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
261
  do_action ("_ws_plugin__s2member_during_query_level_access_sys", get_defined_vars ());
262
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
  }
264
  /**/
265
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
266
  do_action ("_ws_plugin__s2member_after_query_level_access_sys", get_defined_vars ());
267
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
268
  /**/
296
  {
297
  foreach ($items as $child_item_key => $child_item)
298
  if (!empty ($child_item->menu_item_parent) && (int)$child_item->menu_item_parent === (int)$item->ID)
299
+ unset ($items[$child_item_key]);
300
  /**/
301
+ unset ($items[$item_key]);
302
  }
303
  }
304
  /**/
305
+ remove_filter ("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 100);
306
  return apply_filters ("_ws_plugin__s2member_query_level_access_navs", $items, get_defined_vars ());
307
  }
308
  /**
329
  $cwhere .= " AND `" . $wpdb->comments . "`.`comment_post_ID` NOT IN('" . implode ("','", c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms ($terms)) . "')";
330
  }
331
  /**/
332
+ remove_filter ("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 100, 2);
333
  return apply_filters ("_ws_plugin__s2member_query_level_access_coms", $cwhere, get_defined_vars ());
334
  }
335
  /**
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
  /**/
@@ -51,13 +51,10 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
51
  $register = c_ws_plugin__s2member_utils_encryption::encrypt ("subscr_gateway_subscr_id_custom_item_number_time:.:|:.:" . $subscr_gateway . ":.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime ("now"));
52
  $register_link = site_url ("/?s2member_register=" . urlencode ($register));
53
  /**/
54
- if ($shrink && ($_alternative = apply_filters ("ws_plugin__s2member_register_link_gen_alternative", $register_link, get_defined_vars ())) && strlen ($_alternative) < strlen ($register_link))
55
- return apply_filters ("ws_plugin__s2member_register_link_gen", $_alternative, get_defined_vars ());
56
  /**/
57
- else if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
58
- return apply_filters ("ws_plugin__s2member_register_link_gen", $tinyurl . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
59
- /**/
60
- else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
61
  return apply_filters ("ws_plugin__s2member_register_link_gen", $register_link, get_defined_vars ());
62
  }
63
  /**/
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
  /**/
51
  $register = c_ws_plugin__s2member_utils_encryption::encrypt ("subscr_gateway_subscr_id_custom_item_number_time:.:|:.:" . $subscr_gateway . ":.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime ("now"));
52
  $register_link = site_url ("/?s2member_register=" . urlencode ($register));
53
  /**/
54
+ if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten ($register_link)))
55
+ return apply_filters ("ws_plugin__s2member_register_link_gen", $shorter_url . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
56
  /**/
57
+ else /* Else use the long one; shortening may fail when/if an API server is down periodically. */
 
 
 
58
  return apply_filters ("ws_plugin__s2member_register_link_gen", $register_link, get_defined_vars ());
59
  }
60
  /**/
includes/classes/ruris-sp.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
16
  */
17
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
  /**/
20
  if (!class_exists ("c_ws_plugin__s2member_ruris_sp"))
21
  {
@@ -46,25 +46,29 @@ if (!class_exists ("c_ws_plugin__s2member_ruris_sp"))
46
  /**/
47
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access_excluded", false, get_defined_vars ());
48
  /**/
49
- if (!$excluded && !empty ($uri) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
50
  {
51
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
52
- /**/
53
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level0")))
54
- return apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
55
- /**/
56
- else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $uri)) /* Never restrict Systematics. However, there is 1 exception ^. */
57
  {
58
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
 
 
 
 
 
59
  {
60
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
61
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
62
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $uri) && (!$check_user || !$user || !current_user_can ("access_s2member_level" . $n)))
63
- return apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
 
 
 
 
64
  }
 
 
65
  }
66
- /**/
67
- do_action ("ws_plugin__s2member_during_check_specific_ruri_level_access", get_defined_vars ());
68
  }
69
  /**/
70
  return apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access", null, 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_ruris_sp"))
21
  {
46
  /**/
47
  $excluded = apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access_excluded", false, get_defined_vars ());
48
  /**/
49
+ if (!$excluded && !empty ($uri) && is_string ($uri) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
50
  {
51
+ if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $uri)) /* Do NOT touch WordPress® Systematics. */
 
 
 
 
 
52
  {
53
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
54
+ /**/
55
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
56
+ return apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
57
+ /**/
58
+ else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $uri)) /* Never restrict Systematics. However, there is 1 exception above. */
59
  {
60
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
61
+ {
62
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
63
+ /**/
64
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
65
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
66
+ return apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
67
+ }
68
  }
69
+ /**/
70
+ do_action ("ws_plugin__s2member_during_check_specific_ruri_level_access", get_defined_vars ());
71
  }
 
 
72
  }
73
  /**/
74
  return apply_filters ("ws_plugin__s2member_check_specific_ruri_level_access", null, get_defined_vars ());
includes/classes/ruris.inc.php CHANGED
@@ -43,28 +43,27 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
43
  /**/
44
  if (!$excluded && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Has it been excluded? */
45
  {
46
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
47
- /**/
48
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level0")))
49
  {
50
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ruri-" . base64_encode ($_SERVER["REQUEST_URI"]), "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
51
- exit ();
52
- }
53
- else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above ^. */
54
- {
55
- for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
56
  {
57
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
58
- foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
59
- if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill" && (!$user || !current_user_can ("access_s2member_level" . $n)))
60
- {
61
- wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ruri-" . base64_encode ($_SERVER["REQUEST_URI"]), "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
62
- exit ();
63
- }
 
64
  }
 
 
65
  }
66
- /**/
67
- do_action ("ws_plugin__s2member_during_check_ruri_level_access", get_defined_vars ());
68
  }
69
  /**/
70
  do_action ("ws_plugin__s2member_after_check_ruri_level_access", get_defined_vars ());
43
  /**/
44
  if (!$excluded && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Has it been excluded? */
45
  {
46
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */
 
 
47
  {
48
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */
49
+ /**/
50
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
51
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ruri-" . base64_encode ($_SERVER["REQUEST_URI"]), "s2member_level_req" => "0")), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
52
+ /**/
53
+ else if (!c_ws_plugin__s2member_systematics::is_systematic_use_page ()) /* Do NOT protect Systematics. However, there is 1 exception above ^. */
54
  {
55
+ for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
56
+ {
57
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) /* URIs configured at this Level? */
58
+ /**/
59
+ foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
60
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
61
+ wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "ruri-" . base64_encode ($_SERVER["REQUEST_URI"]), "s2member_level_req" => $n)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) . exit ();
62
+ }
63
  }
64
+ /**/
65
+ do_action ("ws_plugin__s2member_during_check_ruri_level_access", get_defined_vars ());
66
  }
 
 
67
  }
68
  /**/
69
  do_action ("ws_plugin__s2member_after_check_ruri_level_access", get_defined_vars ());
includes/classes/security.inc.php CHANGED
@@ -28,72 +28,56 @@ if (!class_exists ("c_ws_plugin__s2member_security"))
28
  class c_ws_plugin__s2member_security
29
  {
30
  /**
31
- * s2Member's Security Gate ( protects WordPress® queries ).
32
  *
33
  * @package s2Member\Security
34
  * @since 3.5
35
  *
36
- * @attaches-to: ``add_action("pre_get_posts");``
37
  *
38
- * @param obj $wp_query Global instance of ``$wp_query``, by reference.
39
- * @return null
40
  */
41
- public static function security_gate_query (&$wp_query = FALSE)
42
  {
43
- do_action ("ws_plugin__s2member_before_security_gate_query", get_defined_vars ());
44
  /**/
45
- c_ws_plugin__s2member_querys::query_level_access ($wp_query); /* By reference. */
 
46
  /**/
47
- do_action ("ws_plugin__s2member_after_security_gate_query", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**/
49
  return; /* Return for uniformity. */
50
  }
51
  /**
52
- * s2Member's Security Gate ( protects WordPress® content ).
53
  *
54
  * @package s2Member\Security
55
  * @since 3.5
56
  *
57
- * @attaches-to: ``add_action("template_redirect");``
58
  *
59
- * @return null
 
60
  */
61
- public static function security_gate () /* s2Member's Security Gate. */
62
  {
63
- do_action ("ws_plugin__s2member_before_security_gate", get_defined_vars ());
64
- /*
65
- Category Level Restrictions ( inclusively ).
66
- - Including URI protections too.
67
- */
68
- if (is_category ()) /* Categories. */
69
- c_ws_plugin__s2member_catgs::check_catg_level_access ();
70
- /*
71
- Tag Level Restrictions ( inclusively ).
72
- - Including URI protections too.
73
- */
74
- else if (is_tag ()) /* Tags. */
75
- c_ws_plugin__s2member_ptags::check_ptag_level_access ();
76
- /*
77
- Post Level Restrictions ( inclusively, even Custom Post Types ).
78
- - Including Category, Tag, URI, Capability, and Specifics too.
79
- */
80
- else if (is_single ()) /* Posts & Custom Types. */
81
- c_ws_plugin__s2member_posts::check_post_level_access ();
82
- /*
83
- Page Level Restrictions ( inclusively ).
84
- - Including Category, Tag, URI, Capability, and Specifics too.
85
- */
86
- else if (is_page ()) /* Pages. */
87
- c_ws_plugin__s2member_pages::check_page_level_access ();
88
- /*
89
- Else just apply URI Level Restrictions ( only URIs ).
90
- */
91
- else /* This optimizes things nicely. */
92
- c_ws_plugin__s2member_ruris::check_ruri_level_access ();
93
- /*
94
- Hook after Security Gate.
95
- */
96
- do_action ("ws_plugin__s2member_after_security_gate", get_defined_vars ());
97
  /**/
98
  return; /* Return for uniformity. */
99
  }
28
  class c_ws_plugin__s2member_security
29
  {
30
  /**
31
+ * s2Member's Security Gate ( protects WordPress® content ).
32
  *
33
  * @package s2Member\Security
34
  * @since 3.5
35
  *
36
+ * @attaches-to: ``add_action("wp");``
37
  *
38
+ * @return null May redirect a browser *(exiting script execution)*, when/if content is NOT available to the current User/Member.
 
39
  */
40
+ public static function security_gate () /* s2Member's Security Gate. */
41
  {
42
+ do_action ("ws_plugin__s2member_before_security_gate", get_defined_vars ());
43
  /**/
44
+ if (is_category ()) /* Categories & other inclusives. */
45
+ c_ws_plugin__s2member_catgs::check_catg_level_access ();
46
  /**/
47
+ else if (is_tag ()) /* Post/Page Tags & other inclusives. */
48
+ c_ws_plugin__s2member_ptags::check_ptag_level_access ();
49
+ /**/
50
+ else if (is_single ()) /* All Posts & other inclusives. */
51
+ c_ws_plugin__s2member_posts::check_post_level_access ();
52
+ /**/
53
+ else if (is_page ()) /* All Pages & other inclusives. */
54
+ c_ws_plugin__s2member_pages::check_page_level_access ();
55
+ /**/
56
+ else /* Else, we simply look at URIs & other inclusives. */
57
+ c_ws_plugin__s2member_ruris::check_ruri_level_access ();
58
+ /**/
59
+ do_action ("ws_plugin__s2member_after_security_gate", get_defined_vars ());
60
  /**/
61
  return; /* Return for uniformity. */
62
  }
63
  /**
64
+ * s2Member's Security Gate ( protects WordPress® queries ).
65
  *
66
  * @package s2Member\Security
67
  * @since 3.5
68
  *
69
+ * @attaches-to: ``add_action("pre_get_posts");``
70
  *
71
+ * @param obj $wp_query Global ``$wp_query``, by reference.
72
+ * @return null May filter WordPress® queries, by hiding protected content which is NOT available to the current User/Member.
73
  */
74
+ public static function security_gate_query (&$wp_query = FALSE) /* s2Member's Security Gate. */
75
  {
76
+ do_action ("ws_plugin__s2member_before_security_gate_query", get_defined_vars ());
77
+ /**/
78
+ c_ws_plugin__s2member_querys::query_level_access ($wp_query); /* By reference. */
79
+ /**/
80
+ do_action ("ws_plugin__s2member_after_security_gate_query", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**/
82
  return; /* Return for uniformity. */
83
  }
includes/classes/sp-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_sp_access"))
21
  {
@@ -40,7 +40,7 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
40
  */
41
  public static function sp_access_link_gen ($sp_ids = FALSE, $hours = 72, $shrink = TRUE)
42
  {
43
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
  do_action ("ws_plugin__s2member_before_sp_access_link_gen", get_defined_vars ());
45
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
  /**/
@@ -49,13 +49,10 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
49
  $sp_access = c_ws_plugin__s2member_utils_encryption::encrypt ("sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime ("now") . ":.:|:.:" . $hours);
50
  $sp_access_link = add_query_arg ("s2member_sp_access", urlencode ($sp_access), get_permalink ($leading_id));
51
  /**/
52
- if ($shrink && ($_alternative = apply_filters ("ws_plugin__s2member_sp_access_link_gen_alternative", $sp_access_link, get_defined_vars ())) && strlen ($_alternative) < strlen ($sp_access_link))
53
- return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $_alternative, get_defined_vars ());
54
  /**/
55
- else if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
56
- return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $tinyurl . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
57
- /**/
58
- else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
59
  return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $sp_access_link, get_defined_vars ());
60
  }
61
  /**/
@@ -152,7 +149,7 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
152
  */
153
  public static function sp_access_session ($add_sp_access_value = FALSE)
154
  {
155
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
156
  do_action ("ws_plugin__s2member_before_sp_access_session", get_defined_vars ());
157
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
158
  /**/
@@ -168,7 +165,7 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
168
  /**/
169
  setcookie ("s2member_sp_access", $cookie, time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_sp_access", $cookie, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_sp_access"] = $cookie);
170
  /**/
171
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
172
  do_action ("ws_plugin__s2member_during_sp_access_session", get_defined_vars ());
173
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
174
  }
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_sp_access"))
21
  {
40
  */
41
  public static function sp_access_link_gen ($sp_ids = FALSE, $hours = 72, $shrink = TRUE)
42
  {
43
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
  do_action ("ws_plugin__s2member_before_sp_access_link_gen", get_defined_vars ());
45
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
  /**/
49
  $sp_access = c_ws_plugin__s2member_utils_encryption::encrypt ("sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime ("now") . ":.:|:.:" . $hours);
50
  $sp_access_link = add_query_arg ("s2member_sp_access", urlencode ($sp_access), get_permalink ($leading_id));
51
  /**/
52
+ if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten ($sp_access_link)))
53
+ return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $shorter_url . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
54
  /**/
55
+ else /* Else use the long one; shortening may fail when/if an API server is down periodically. */
 
 
 
56
  return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $sp_access_link, get_defined_vars ());
57
  }
58
  /**/
149
  */
150
  public static function sp_access_session ($add_sp_access_value = FALSE)
151
  {
152
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
153
  do_action ("ws_plugin__s2member_before_sp_access_session", get_defined_vars ());
154
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
155
  /**/
165
  /**/
166
  setcookie ("s2member_sp_access", $cookie, time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_sp_access", $cookie, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_sp_access"] = $cookie);
167
  /**/
168
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
169
  do_action ("ws_plugin__s2member_during_sp_access_session", get_defined_vars ());
170
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
171
  }
includes/classes/ssl-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_ssl_in"))
21
  {
@@ -38,30 +38,32 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
38
  * @since 3.5
39
  *
40
  * @attaches-to: ``add_action("init");``
41
- * @attaches-to: ``add_action("template_redirect");``
42
  *
43
  * @return null Possibly exiting script execution after redirection to SSL variation.
 
 
 
44
  */
45
  public static function force_ssl ($vars = array ()) /* Phase 2 of ``c_ws_plugin__s2member_ssl::check_force_ssl()``. */
46
  {
47
- extract ($vars); /* Extract all vars passed in from: ``c_ws_plugin__s2member_ssl::check_force_ssl()``. */
48
  /**/
49
  $force_ssl = (!is_string ($force_ssl)) ? (string)(int)$force_ssl : $force_ssl; /* Force string. */
50
  $force_ssl = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : "yes"; /* Use `yes`. */
51
  /**/
52
  $ssl_host = preg_replace ("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]); /* Remove port here. */
53
  $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false; /* Port? */
54
- $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : ""); /* Use port # ? */
55
  /**/
56
  if (!is_ssl () || !isset ($_GET[$s2_ssl_gv])) /* SSL must be enabled. */
57
  {
58
  $https = "https://" . $ssl_host_port . $_SERVER["REQUEST_URI"];
59
  $https_with_s2_ssl_gv = add_query_arg ($s2_ssl_gv, urlencode ($force_ssl), $https);
60
- /**/
61
- wp_redirect ($https_with_s2_ssl_gv) . exit ();
62
  }
63
- else /* Otherwise, we buffer all output, and switch all content over to https. */
64
- /* Also, we assume here that other links on the site should NOT be converted to https. */
65
  {
66
  add_filter ("redirect_canonical", "__return_false");
67
  /**/
@@ -69,7 +71,7 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
69
  define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
70
  define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
71
  /**/
72
- /* Filter these. We do NOT want to create a sitewide https conversion! */
73
  add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
74
  add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
75
  add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
@@ -82,48 +84,17 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
82
  These additional URLs are NOT Filtered by default; but can be if needed. Use these Filters. */
83
  if (apply_filters ("_ws_plugin__s2member_force_non_ssl_scheme_content_url", false, get_defined_vars ()))
84
  add_filter ("content_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 2);
85
- /**/
86
- if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer"))
87
- {
88
- function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
89
- {
90
- $o_pcre = @ini_get ("pcre.backtrack_limit"); /* Current configuration. */
91
- /**/
92
- @ini_set ("pcre.backtrack_limit", 10000000); /* Expands abilities for this routine. */
93
- /**/
94
- $ssl_tags = array ("script", "style", "link", "img", "input", "iframe", "object", "embed");
95
- $ssl_tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags_array", $ssl_tags, get_defined_vars ());
96
- $ssl_tags = array_unique (array_map ("strtolower", $ssl_tags)); /* This array should be lowercase / unique. */
97
- /**/
98
- $ssl_regex_tags = implode ("|", array_map ("preg_quote", $ssl_tags)); /* Prepare for regex. */
99
- /**/
100
- $buffer = ($ssl_regex_tags) ? preg_replace_callback ("/\<(" . $ssl_regex_tags . ")(?![a-z_0-9\-])[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
101
- $buffer = (in_array ("object", $ssl_tags)) ? preg_replace_callback ("/\<object(?![a-z_0-9\-])[^\>]*\>.*?\<\/object\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
102
- $buffer = (in_array ("script", $ssl_tags)) ? preg_replace_callback ("/\<script(?![a-z_0-9\-])[^\>]*\>.*?\<\/script\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
103
- $buffer = (in_array ("style", $ssl_tags)) ? preg_replace_callback ("/\<style(?![a-z_0-9\-])[^\>]*\>.*?\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
104
- /**/
105
- $non_ssl_tags = array ("a"); /* Tags that should NOT contain SSL-enabled links in them. Prevents site-wide conversions */
106
- $non_ssl_tags = apply_filters ("_ws_plugin__s2member_force_non_ssl_buffer_tags_array", $non_ssl_tags, get_defined_vars ());
107
- $non_ssl_tags = array_unique (array_map ("strtolower", $non_ssl_tags)); /* This array should be lowercase / unique. */
108
- /**/
109
- $non_ssl_regex_tags = implode ("|", array_map ("preg_quote", $non_ssl_tags)); /* Prepare for regex. */
110
- /**/
111
- $buffer = ($non_ssl_regex_tags) ? preg_replace_callback ("/\<(" . $non_ssl_regex_tags . ")(?![a-z_0-9\-])[^\>]+\>/i", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
112
- /**/
113
- @ini_set ("pcre.backtrack_limit", $o_pcre); /* Restores previous configuration value now. */
114
- /**/
115
- return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
116
- }
117
- }
118
- /**/
119
- if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer_callback"))
120
  {
121
- function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
122
  {
123
- $s = preg_replace ("/http\:\/\//i", "https://", $m[0]); /* Conversion. */
124
  /**/
125
- if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Need port conversions? */
126
- $s = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $s);
127
  /**/
128
  $s = (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $s; /* Alternates are fine to leave like they are. */
129
  /**/
@@ -131,44 +102,63 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
131
  }
132
  }
133
  /**/
134
- if (!function_exists ("_ws_plugin__s2member_force_non_ssl_buffer_callback"))
135
  {
136
- function _ws_plugin__s2member_force_non_ssl_buffer_callback ($m = FALSE)
137
  {
138
- $s = preg_replace ("/https\:\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host_port, "/") . "/i", "http://" . _ws_plugin__s2member_force_ssl_host, $m[0]);
 
 
139
  /**/
140
- $s = preg_replace ("/https\:\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "/i", "http://" . _ws_plugin__s2member_force_ssl_host, $s);
141
- /*
142
- Data gets converted to prevent a site-wide conversion over to SSL links.
143
- */
144
  return $s; /* Return string with conversions. */
145
  }
146
  }
147
  /**/
148
- if (!function_exists ("_ws_plugin__s2member_force_non_ssl_scheme"))
149
  {
150
  function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
151
  {
152
  if (!in_array ($scheme, array ("http", "https"))) /* If NOT explicitly passed through. */
153
  {
154
- /* Allows for special exceptions to the rule of always forcing a non-SSL scheme. */
155
  if (($scheme === "login_post" || $scheme === "rpc") && (force_ssl_login () || force_ssl_admin ()))
156
  $scheme = "https";
157
- else if ($scheme === "login" && force_ssl_admin ())
 
158
  $scheme = "https";
159
- else if ($scheme === "admin" && force_ssl_admin ())
160
- $scheme = "https";
161
- else /* Defaults to http. */
162
  $scheme = "http";
163
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  /**/
165
- $scheme = apply_filters ("_ws_plugin__s2member_force_non_ssl_scheme", $scheme, get_defined_vars ());
 
166
  /**/
167
- return preg_replace ("/^http(s)?\:\/\//i", $scheme . "://", $url);
 
 
 
 
 
168
  }
169
  }
170
  /**/
171
- ob_start ("_ws_plugin__s2member_force_ssl_buffer");
172
  }
173
  /**/
174
  return; /* Return for uniformity. */
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_ssl_in"))
21
  {
38
  * @since 3.5
39
  *
40
  * @attaches-to: ``add_action("init");``
41
+ * @also-attaches-to: ``add_action("wp");``
42
  *
43
  * @return null Possibly exiting script execution after redirection to SSL variation.
44
+ *
45
+ * @todo Add `form` to the array ``$non_ssl_attr_only_tags``?
46
+ * @todo Cleanup this routine and convert callback functions to static class methods?
47
  */
48
  public static function force_ssl ($vars = array ()) /* Phase 2 of ``c_ws_plugin__s2member_ssl::check_force_ssl()``. */
49
  {
50
+ extract($vars); /* Extract all vars passed in from: ``c_ws_plugin__s2member_ssl::check_force_ssl()``. */
51
  /**/
52
  $force_ssl = (!is_string ($force_ssl)) ? (string)(int)$force_ssl : $force_ssl; /* Force string. */
53
  $force_ssl = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : "yes"; /* Use `yes`. */
54
  /**/
55
  $ssl_host = preg_replace ("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]); /* Remove port here. */
56
  $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false; /* Port? */
57
+ $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : ""); /* Use port #? */
58
  /**/
59
  if (!is_ssl () || !isset ($_GET[$s2_ssl_gv])) /* SSL must be enabled. */
60
  {
61
  $https = "https://" . $ssl_host_port . $_SERVER["REQUEST_URI"];
62
  $https_with_s2_ssl_gv = add_query_arg ($s2_ssl_gv, urlencode ($force_ssl), $https);
63
+ wp_redirect($https_with_s2_ssl_gv) . exit ();
 
64
  }
65
+ else /* Otherwise, we buffer all output, and switch all content over to `https`. */
66
+ /* Assume here that other links on the site should NOT be converted to `https`. */
67
  {
68
  add_filter ("redirect_canonical", "__return_false");
69
  /**/
71
  define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
72
  define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
73
  /**/
74
+ /* Filter these. Do NOT create a sitewide conversion to `https`. */
75
  add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
76
  add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
77
  add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
84
  These additional URLs are NOT Filtered by default; but can be if needed. Use these Filters. */
85
  if (apply_filters ("_ws_plugin__s2member_force_non_ssl_scheme_content_url", false, get_defined_vars ()))
86
  add_filter ("content_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 2);
87
+ /*
88
+ Now we create various callback functions associated with SSL and non-SSL buffering.
89
+ */
90
+ if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer_callback")) /* Pluggable? */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  {
92
+ function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE) /* Callback function. */
93
  {
94
+ $s = preg_replace ("/http\:\/\//i", "https://", $m[0]); /* Conversion to SSL mode via `https`. */
95
  /**/
96
+ if (_ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host_port) /* Convert port? */
97
+ $s = preg_replace ("/(?:https?\:)?\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(?:\:[0-9]+)?/i", "https://" . _ws_plugin__s2member_force_ssl_host_port, $s);
98
  /**/
99
  $s = (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $s; /* Alternates are fine to leave like they are. */
100
  /**/
102
  }
103
  }
104
  /**/
105
+ if (!function_exists ("_ws_plugin__s2member_force_non_ssl_buffer_callback")) /* Pluggable? */
106
  {
107
+ function _ws_plugin__s2member_force_non_ssl_buffer_callback ($m = FALSE) /* Callback function. */
108
  {
109
+ $s = preg_replace ("/(?:https?\:)?\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host_port, "/") . "/i", "http://" . _ws_plugin__s2member_force_ssl_host, $m[0]);
110
+ /**/
111
+ $s = preg_replace ("/(?:https?\:)?\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "/i", "http://" . _ws_plugin__s2member_force_ssl_host, $s);
112
  /**/
 
 
 
 
113
  return $s; /* Return string with conversions. */
114
  }
115
  }
116
  /**/
117
+ if (!function_exists ("_ws_plugin__s2member_force_non_ssl_scheme")) /* Pluggable? */
118
  {
119
  function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
120
  {
121
  if (!in_array ($scheme, array ("http", "https"))) /* If NOT explicitly passed through. */
122
  {
 
123
  if (($scheme === "login_post" || $scheme === "rpc") && (force_ssl_login () || force_ssl_admin ()))
124
  $scheme = "https";
125
+ /**/
126
+ else if (($scheme === "login" || $scheme === "admin") && force_ssl_admin ())
127
  $scheme = "https";
128
+ /**/
129
+ else /* Default to non-SSL: `http`. */
 
130
  $scheme = "http";
131
  }
132
+ return preg_replace ("/^(?:https?\:)?\/\//i", $scheme . "://", $url);
133
+ }
134
+ }
135
+ /**/
136
+ if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer")) /* Pluggable? */
137
+ {
138
+ function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE) /* Output handler. */
139
+ {
140
+ $o_pcre = @ini_get ("pcre.backtrack_limit"); /* Record existing PCRE backtrack limit. */
141
+ @ini_set ("pcre.backtrack_limit", 10000000); /* Increase PCRE backtrack limit for this routine. */
142
+ /**/
143
+ $ssl_entire_tags = array_unique (array_map ("strtolower", apply_filters ("_ws_plugin__s2member_force_ssl_buffer_entire_tags", array ("script", "style", "iframe", "object", "embed", "video"), get_defined_vars ())));
144
+ $non_ssl_entire_tags = array_unique (array_map ("strtolower", apply_filters ("_ws_plugin__s2member_force_non_ssl_buffer_entire_tags", array (), get_defined_vars ())));
145
+ /**/
146
+ $ssl_attr_only_tags = array_unique ( /* Diff here. No need to re-run entire tags. */array_diff (array_map ("strtolower", apply_filters ("_ws_plugin__s2member_force_ssl_buffer_attr_only_tags", array ("link", "img", "input"), get_defined_vars ())), $ssl_entire_tags));
147
+ $non_ssl_attr_only_tags = array_unique ( /* No need to re-run entire tags. */array_diff (array_map ("strtolower", apply_filters ("_ws_plugin__s2member_force_non_ssl_buffer_attr_only_tags", array ("a"), get_defined_vars ())), $non_ssl_entire_tags));
148
  /**/
149
+ $buffer = ($ssl_entire_tags) ? preg_replace_callback ("/\<(" . implode ("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep ($ssl_entire_tags, "/")) . ")(?![a-z_0-9\-])[^\>]*?\>.*?\<\/\\1\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
150
+ $buffer = ($ssl_attr_only_tags) ? preg_replace_callback ("/\<(" . implode ("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep ($ssl_attr_only_tags, "/")) . ")(?![a-z_0-9\-])[^\>]+?\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
151
  /**/
152
+ $buffer = ($non_ssl_entire_tags) ? preg_replace_callback ("/\<(" . implode ("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep ($non_ssl_entire_tags, "/")) . ")(?![a-z_0-9\-])[^\>]*?\>.*?\<\/\\1\>/is", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
153
+ $buffer = ($non_ssl_attr_only_tags) ? preg_replace_callback ("/\<(" . implode ("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep ($non_ssl_attr_only_tags, "/")) . ")(?![a-z_0-9\-])[^\>]+?\>/i", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
154
+ /**/
155
+ @ini_set ("pcre.backtrack_limit", $o_pcre); /* Restore original PCRE backtrack limit. This just keeps things tidy; probably NOT necessary. */
156
+ /**/
157
+ return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
158
  }
159
  }
160
  /**/
161
+ ob_start("_ws_plugin__s2member_force_ssl_buffer");
162
  }
163
  /**/
164
  return; /* Return for uniformity. */
includes/classes/ssl.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_ssl"))
21
  {
@@ -38,30 +38,28 @@ if (!class_exists ("c_ws_plugin__s2member_ssl"))
38
  * @since 3.5
39
  *
40
  * @attaches-to: ``add_action("init");``
41
- * @attaches-to: ``add_action("template_redirect");``
42
  *
43
  * @return null Possibly exiting script execution after redirection to SSL variation.
44
  */
45
- public static function check_force_ssl () /* Forces SSL. */
46
  {
47
- global $post; /* We need the global ``$post`` variable here. */
48
  static $forced = false; /* Only force SSL once. */
 
49
  /**/
50
  do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
51
  /**/
52
- if (!$forced) /* Only once. This is required, because it's processed on multiple Hooks. */
53
- {
54
- $s2_ssl_gv = apply_filters ("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", get_defined_vars ());
55
- $_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|false)$/i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
56
- $force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", $_g_s2_ssl, get_defined_vars ());
57
- /**/
58
- if ($force_ssl || (function_exists ("is_singular") && is_singular () && is_object ($post) && $post->ID && ($force_ssl = get_post_meta ($post->ID, "s2member_force_ssl", true))))
59
  /**/
60
- if (!preg_match ("/^(0|no|false)$/i", $force_ssl) && ($forced = true)) /* Make sure it's not a negative variation. */
61
- {
62
  c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); /* Call inner routine now. */
63
- }
64
- }
65
  /**/
66
  do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
67
  /**/
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_ssl"))
21
  {
38
  * @since 3.5
39
  *
40
  * @attaches-to: ``add_action("init");``
41
+ * @also-attaches-to: ``add_action("wp");``
42
  *
43
  * @return null Possibly exiting script execution after redirection to SSL variation.
44
  */
45
+ public static function check_force_ssl ()
46
  {
 
47
  static $forced = false; /* Only force SSL once. */
48
+ global $post; /* We need this global reference to ``$post``. */
49
  /**/
50
  do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
51
  /**/
52
+ if (!$forced) /* Only force SSL here once. We definitely do NOT need to run this particular routine more than ONE time. */
53
+ if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* Exclude all WordPress® Systematics. */
54
+ {
55
+ $s2_ssl_gv = apply_filters ("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", get_defined_vars ());
56
+ $_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|off|false)$/i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
57
+ $force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", $_g_s2_ssl, get_defined_vars ());
 
58
  /**/
59
+ if ($force_ssl || ( /* Conditionals will work? */did_action ("wp") && is_singular () && is_object ($post) && ($force_ssl = get_post_meta ($post->ID, "s2member_force_ssl", true))))
60
+ if (!preg_match ("/^(0|no|off|false)$/i", (string)$force_ssl) && ($forced = true)) /* Make sure it's NOT a negative variation. */
61
  c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); /* Call inner routine now. */
62
+ }
 
63
  /**/
64
  do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
65
  /**/
includes/classes/systematics-sp.inc.php CHANGED
@@ -28,63 +28,85 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
28
  class c_ws_plugin__s2member_systematics_sp
29
  {
30
  /**
31
- * Determines if a specific Page ID, or URI, is Systematic.
32
  *
33
  * @package s2Member\Systematics
34
  * @since 3.5
35
  *
36
- * @param int|str $page_id Optional. A numeric Page ID in WordPress®.
37
  * @param str $uri Optional. A request URI to test against.
38
  * @return bool True if Systematic, else false.
39
  *
40
  * @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
41
  * Don't think this is required though; as it's already handled in other areas, correct?
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
  }
74
- else if ($uri && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $uri))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  }
82
- else if ($uri && ($query = @parse_url ($uri, PHP_URL_QUERY)) && strpos ($query, "s2member") === 0 && c_ws_plugin__s2member_utils_conds::is_site_root ($uri))
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
  }
90
  }
28
  class c_ws_plugin__s2member_systematics_sp
29
  {
30
  /**
31
+ * Determines if a specific Post/Page ID, or URI, is Systematic.
32
  *
33
  * @package s2Member\Systematics
34
  * @since 3.5
35
  *
36
+ * @param int|str $singular_id Optional. A numeric Post/Page ID in WordPress®.
37
  * @param str $uri Optional. A request URI to test against.
38
  * @return bool True if Systematic, else false.
39
  *
40
  * @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
41
  * Don't think this is required though; as it's already handled in other areas, correct?
42
  */
43
+ public static function is_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
44
  {
45
+ $singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
 
 
46
  $uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
47
  /**/
48
+ if (c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($singular_id, $uri)) /* A WordPress® Systematic? */
49
  {
50
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
51
  }
52
+ else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
53
  {
54
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
55
  }
56
+ else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
57
  {
58
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
59
  }
60
+ else if ($uri && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $uri))
61
  {
62
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
63
  }
64
+ else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
65
  {
66
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
67
  }
68
+ else if ($uri && ($query = parse_url ($uri, PHP_URL_QUERY)) && strpos ($query, "s2member") === 0 && c_ws_plugin__s2member_utils_conds::is_site_root ($uri))
69
  {
70
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
71
  }
72
+ else /* Otherwise, we return false ( i.e. it's NOT a Systematic area ). */
73
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
74
+ }
75
+ /**
76
+ * Determines if a specific Post/Page ID, or URI, is WordPress® Systematic.
77
+ *
78
+ * @package s2Member\Systematics
79
+ * @since 111002
80
+ *
81
+ * @param int|str $singular_id Optional. A numeric Post/Page ID in WordPress®.
82
+ * @param str $uri Optional. A request URI to test against.
83
+ * @return bool True if WordPress® Systematic, else false.
84
+ */
85
+ public static function is_wp_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
86
+ {
87
+ global $bp; /* If BuddyPress is installed, we'll need this global reference. */
88
+ /**/
89
+ $singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
90
+ $uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
91
+ /**/
92
+ if ($uri && preg_match ("/\/wp-admin(\/|$)/", $uri)) /* Inside a WordPress® administrative area? */
93
  {
94
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
95
  }
96
+ else if ($uri && preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", parse_url ($uri, PHP_URL_PATH))) /* A core WordPress® file? */
97
  {
98
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
99
  }
100
+ else if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(" . preg_quote (trim (((function_exists ("bp_get_signup_slug")) ? bp_get_signup_slug () : BP_REGISTER_SLUG), "/"), "/") . "|" . preg_quote (trim (((function_exists ("bp_get_activate_slug")) ? bp_get_activate_slug () : BP_ACTIVATION_SLUG), "/"), "/") . ")(\/|$)/", $uri))
101
  {
102
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
103
  }
104
+ else if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty ($bp->pages->register->id) && $singular_id === (int)$bp->pages->register->id) || (!empty ($bp->pages->activate->id) && $singular_id === (int)$bp->pages->activate->id)))
105
+ {
106
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
107
+ }
108
+ else /* Otherwise, we return false ( i.e. it's NOT a WordPress® Systematic area ). */
109
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", false, get_defined_vars ()));
110
  }
111
  }
112
  }
includes/classes/systematics.inc.php CHANGED
@@ -43,19 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
43
  {
44
  return $is_systematic; /* Filters will have already been applied. */
45
  }
46
- else if (is_admin ()) /* In the admin area? - All administrational pages are considered Systematic. */
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
- }
58
- else if (preg_match ("/\/(wp-app|wp-signup|wp-register|wp-activate|wp-login|xmlrpc)\.php/", $_SERVER["REQUEST_URI"]) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ())))
59
  {
60
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
61
  }
@@ -82,6 +70,53 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
82
  else /* Otherwise, we return false ( it's NOT Systematic ). */
83
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
  }
87
  ?>
43
  {
44
  return $is_systematic; /* Filters will have already been applied. */
45
  }
46
+ else if (c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* WordPress® Systematic? */
 
 
 
 
 
 
 
 
 
 
 
 
47
  {
48
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
49
  }
70
  else /* Otherwise, we return false ( it's NOT Systematic ). */
71
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
72
  }
73
+ /**
74
+ * Determines if the current page is WordPress® Systematic.
75
+ *
76
+ * @package s2Member\Systematics
77
+ * @since 111002
78
+ *
79
+ * @return bool True if WordPress® Systematic, else false.
80
+ */
81
+ public static function is_wp_systematic_use_page ()
82
+ {
83
+ static $is_wp_systematic; /* For optimization. */
84
+ /**/
85
+ if (isset ($is_wp_systematic)) /* Already cached? This saves time. */
86
+ {
87
+ return $is_wp_systematic; /* Filters will have already been applied. */
88
+ }
89
+ else if (is_admin ()) /* In the admin area? All administrational pages are considered Systematic. */
90
+ {
91
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
92
+ }
93
+ else if (defined ("WP_INSTALLING") && WP_INSTALLING) /* Installing? All WordPress® installs are considered Systematic. */
94
+ {
95
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
96
+ }
97
+ else if (defined ("APP_REQUEST") && APP_REQUEST) /* App request? All WordPress® app requests are considered Systematic. */
98
+ {
99
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
100
+ }
101
+ else if (defined ("XMLRPC_REQUEST") && XMLRPC_REQUEST) /* An XML-RPC request? All of these are considered Systematic too. */
102
+ {
103
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
104
+ }
105
+ else if ((defined ("DOING_CRON") && DOING_CRON) || strcasecmp (PHP_SAPI, "CLI") === 0) /* CLI, or WordPress® CRON job. */
106
+ {
107
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
108
+ }
109
+ else if (preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH)) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ())))
110
+ {
111
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
112
+ }
113
+ 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))
114
+ {
115
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
116
+ }
117
+ else /* Otherwise, we return false ( it's NOT WordPress® Systematic ). */
118
+ return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", false, get_defined_vars ()));
119
+ }
120
  }
121
  }
122
  ?>
includes/classes/utils-conds.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_conds"))
21
  {
@@ -45,22 +45,25 @@ if (!class_exists ("c_ws_plugin__s2member_utils_conds"))
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 && ($buddypress = "buddypress/bp-loader.php"))
 
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) /* BuddyPress? */
63
- return true; /* Yes, BuddyPress is one of the active plugins. */
64
  }
65
  /**/
66
  return false; /* Default return false. */
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_conds"))
21
  {
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 true if {@link s2Member\WS_PLUGIN__S2MEMBER_ONLY} is true, else false.
49
  * @return bool True if BuddyPress is installed, else false.
50
  */
51
+ public static function bp_is_installed ($query_active_plugins = NULL)
52
  {
53
  if (defined ("BP_VERSION")) /* Installed and active? */
54
+ return true; /* This is the quickest/easiest way to determine. */
55
  /**/
56
+ $s2o = (defined ("WS_PLUGIN__S2MEMBER_ONLY") && WS_PLUGIN__S2MEMBER_ONLY) ? true : false;
57
+ if (($query_active_plugins = (!isset ($query_active_plugins) && $s2o) ? true : $query_active_plugins))
58
  {
59
+ $buddypress = "buddypress/bp-loader.php"; /* BuddyPress loader. */
60
+ /**/
61
  $active_plugins = (is_multisite ()) ? wp_get_active_network_plugins () : array ();
62
  $active_plugins = array_unique (array_merge ($active_plugins, wp_get_active_and_valid_plugins ()));
63
  /**/
64
+ foreach ($active_plugins as $active_plugin) /* Search. */
65
+ if (plugin_basename ($active_plugin) === $buddypress)
66
+ return true; /* BuddyPress active. */
67
  }
68
  /**/
69
  return false; /* Default return false. */
includes/classes/utils-s2o.inc.php CHANGED
@@ -36,28 +36,19 @@ if (!class_exists ("c_ws_plugin__s2member_utils_s2o"))
36
  */
37
  public static function wp_dir ($starting_dir = FALSE, $alt_starting_dir = FALSE)
38
  {
39
- if ($starting_dir && is_dir ($starting_dir))
40
- for ($i = 0, $dir = $starting_dir; $i <= 20; $i++)
41
- {
42
- for ($one_dir_up = 0; $one_dir_up < $i; $one_dir_up++)
43
- $dir = dirname ($dir);
44
- /**/
45
- if (file_exists ($dir . "/wp-settings.php"))
46
- return ($wp_dir = $dir);
47
- }
 
48
  /**/
49
- if ($alt_starting_dir && is_dir ($alt_starting_dir))
50
- for ($i = 0, $dir = $alt_starting_dir; $i <= 20; $i++)
51
- {
52
- for ($one_dir_up = 0; $one_dir_up < $i; $one_dir_up++)
53
- $dir = dirname ($dir);
54
- /**/
55
- if (file_exists ($dir . "/wp-settings.php"))
56
- return ($wp_dir = $dir);
57
- }
58
- /**/
59
- header("Content-Type: text/plain; charset=utf-8") . eval ('while (@ob_end_clean ());');
60
- header("HTTP/1.0 500 Error") . exit ("ERROR: s2Member® unable to locate WordPress® directory.");
61
  }
62
  /*
63
  * WordPress® settings, after ``SHORTINIT`` section.
@@ -71,45 +62,75 @@ if (!class_exists ("c_ws_plugin__s2member_utils_s2o"))
71
  */
72
  public static function wp_settings_as ($wp_dir = FALSE, $o_file = FALSE)
73
  {
74
- if ($wp_dir && is_dir ($wp_dir) && file_exists ($wp_dir . "/wp-settings.php") && $o_file && file_exists ($o_file))
75
- if (($wp_settings = $_wp_settings = trim (file_get_contents ($wp_dir . "/wp-settings.php"))))
76
- {
77
- $wp_shortinit_section = "/if *\( *SHORTINIT *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*return false;[\r\n\t\s ]*\}?[\r\n\t\s ]*/";
78
- if (($_wp_settings_parts = preg_split ($wp_shortinit_section, $_wp_settings, 2)) && ($_wp_settings = trim ($_wp_settings_parts[1])) && ($_wp_settings = "<?php\n" . $_wp_settings))
79
- {
80
- if (($_wp_settings = str_replace ("__FILE__", "'" . str_replace ("'", "\'", $wp_dir) . "/wp-settings.php'", $_wp_settings))) /* Eval compatible. Hard-code `../wp-settings.php`. */
81
- {
82
- $mu_plugins_section = "/[\r\n\t\s ]+foreach *\( *wp_get_mu_plugins *\( *\) *as *\\\$mu_plugin *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include_once *\( *\\\$mu_plugin *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*unset *\( *\\\$mu_plugin *\);/";
83
- $mu_plugins_replace = "\nif (file_exists (WPMU_PLUGIN_DIR . \"/s2member-o.php\"))\n\tinclude_once WPMU_PLUGIN_DIR . \"/s2member-o.php\";"; /* Supports special file: `s2member-o.php`. */
84
- if (($_wp_settings = preg_replace ($mu_plugins_section, $mu_plugins_replace, $_wp_settings, 1, $mu_plugins_replaced)) && $mu_plugins_replaced)
85
- {
86
- $nw_plugins_section = "/[\r\n\t\s ]+foreach *\( *wp_get_active_network_plugins *\( *\) *as *\\\$network_plugin *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include_once *\( *\\\$network_plugin *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*unset *\( *\\\$network_plugin *\);/";
87
- $nw_plugins_replace = /* Not even in the plugins directory? » */ "\n\$ws_plugin__s2member_temp_s = preg_replace (\"/-o\\.php\$/\", \".php\", __FILE__);\n\nif (!file_exists (WP_PLUGIN_DIR . \"/\" . plugin_basename (\$ws_plugin__s2member_temp_s)) && file_exists (\$ws_plugin__s2member_temp_s))\n\tinclude_once \$ws_plugin__s2member_temp_s;\n";
88
- $nw_plugins_replace .= "\n\$ws_plugin__s2member_temp_s = plugin_basename (preg_replace (\"/-o\\.php\$/\", \".php\", __FILE__));\n\$ws_plugin__s2member_temp_a = is_multisite () ? wp_get_active_network_plugins () : array ();\n\nif (in_array (WP_PLUGIN_DIR . \"/\" . \$ws_plugin__s2member_temp_s, \$ws_plugin__s2member_temp_a))\n\tinclude_once WP_PLUGIN_DIR . \"/\" . \$ws_plugin__s2member_temp_s;\n\nunset (\$ws_plugin__s2member_temp_s, \$ws_plugin__s2member_temp_a);";
89
- if (($_wp_settings = preg_replace ($nw_plugins_section, $nw_plugins_replace, $_wp_settings, 1, $nw_plugins_replaced)) && $nw_plugins_replaced)
90
- {
91
- $st_plugins_section = "/[\r\n\t\s ]+foreach *\( *wp_get_active_and_valid_plugins *\( *\) *as *\\\$plugin *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include_once *\( *\\\$plugin *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*unset *\( *\\\$plugin *\);/";
92
- $st_plugins_replace = /* Not even in the plugins directory? » */ "\n\$ws_plugin__s2member_temp_s = preg_replace (\"/-o\\.php\$/\", \".php\", __FILE__);\n\nif (!file_exists (WP_PLUGIN_DIR . \"/\" . plugin_basename (\$ws_plugin__s2member_temp_s)) && file_exists (\$ws_plugin__s2member_temp_s))\n\tinclude_once \$ws_plugin__s2member_temp_s;\n";
93
- $st_plugins_replace .= "\n\$ws_plugin__s2member_temp_s = plugin_basename (preg_replace (\"/-o\\.php\$/\", \".php\", __FILE__));\n\$ws_plugin__s2member_temp_a = wp_get_active_and_valid_plugins ();\n\nif (in_array (WP_PLUGIN_DIR . \"/\" . \$ws_plugin__s2member_temp_s, \$ws_plugin__s2member_temp_a))\n\tinclude_once WP_PLUGIN_DIR . \"/\" . \$ws_plugin__s2member_temp_s;\n\nunset (\$ws_plugin__s2member_temp_s, \$ws_plugin__s2member_temp_a);";
94
- if (($_wp_settings = preg_replace ($st_plugins_section, $st_plugins_replace, $_wp_settings, 1, $st_plugins_replaced)) && $st_plugins_replaced)
95
- {
96
- $theme_funcs_section = "/(?:[\r\n\t\s ]+\/\/ Load the functions for the active theme, for both parent and child theme if applicable\.)?[\r\n\t\s ]+if *\( *\! *defined *\( *['\"]WP_INSTALLING['\"] *\) *\|\| *['\"]wp-activate.php['\"] *\=\=\= *\\\$pagenow *\)[\r\n\t\s ]*\{[\r\n\t\s ]*if *\( *TEMPLATEPATH *\!\=\= *STYLESHEETPATH *&& *file_exists *\( *STYLESHEETPATH *\. *['\"]\/functions\.php['\"] *\) *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include *\( *STYLESHEETPATH *\. *['\"]\/functions\.php['\"] *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*if *\( *file_exists *\( *TEMPLATEPATH *\. *['\"]\/functions\.php['\"] *\) *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include *\( *TEMPLATEPATH *\. *['\"]\/functions\.php['\"] *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*\}/";
97
- if (($_wp_settings = preg_replace ($theme_funcs_section, "", $_wp_settings, 1, $theme_funcs_replaced)) && $theme_funcs_replaced)
98
- {
99
- if (($_wp_settings = str_replace ("__FILE__", '"' . str_replace ('"', '\"', $o_file) . '"', $_wp_settings)))
100
- {
101
- if (($_wp_settings = trim ($_wp_settings))) /* WordPress®, with s2Member only. */
102
- return $_wp_settings;
103
- }
104
- }
105
- }
106
- }
107
- }
108
- }
109
- }
110
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  /**/
112
- return false; /* Default return. */
113
  }
114
  }
115
  }
36
  */
37
  public static function wp_dir ($starting_dir = FALSE, $alt_starting_dir = FALSE)
38
  {
39
+ foreach (array ($starting_dir, $alt_starting_dir) as $directory)
40
+ if ($directory && is_string ($directory) && is_dir ($directory))
41
+ for ($i = 0, $dir = $directory; $i <= 20; $i++)
42
+ {
43
+ for ($one_dir_up = 0; $one_dir_up < $i; $one_dir_up++)
44
+ $dir = dirname ($dir);
45
+ /**/
46
+ if (file_exists ($dir . "/wp-settings.php"))
47
+ return ($wp_dir = $dir);
48
+ }
49
  /**/
50
+ header ("Content-Type: text/plain; charset=utf-8") . eval ('while (@ob_end_clean ());');
51
+ header ("HTTP/1.0 500 Error") . exit ("ERROR: s2Member® unable to locate WordPress® directory.");
 
 
 
 
 
 
 
 
 
 
52
  }
53
  /*
54
  * WordPress® settings, after ``SHORTINIT`` section.
62
  */
63
  public static function wp_settings_as ($wp_dir = FALSE, $o_file = FALSE)
64
  {
65
+ if ($wp_dir && is_dir ($wp_dir) && is_readable (($wp_settings = $wp_dir . "/wp-settings.php")) && $o_file && file_exists ($o_file) && ($_wp_settings = trim (file_get_contents ($wp_settings))))
66
+ {
67
+ $wp_shortinit_section = "/if *\( *SHORTINIT *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*return false;[\r\n\t\s ]*\}?[\r\n\t\s ]*/";
68
+ if (($_wp_settings_parts = preg_split ($wp_shortinit_section, $_wp_settings, 2)) && ($_wp_settings = trim ($_wp_settings_parts[1])) && ($_wp_settings = "<?php\n" . $_wp_settings))
69
+ {
70
+ if (($_wp_settings = str_replace ("__FILE__", "'" . str_replace ("'", "\'", $wp_settings) . "'", $_wp_settings))) /* Eval compatible. Hard-code the ``__FILE__`` location here. */
71
+ {
72
+ $mu_plugins_section = "/[\r\n\t\s ]+foreach *\( *wp_get_mu_plugins *\( *\) *as *\\\$mu_plugin *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include_once *\( *\\\$mu_plugin *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*unset *\( *\\\$mu_plugin *\);/";
73
+ $mu_plugins_replace = "\n\n" . c_ws_plugin__s2member_utils_s2o::esc_ds (trim (c_ws_plugin__s2member_utils_s2o::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/cfg-files/s2o-mu-plugins.php")))) . "\n";
74
+ if (($_wp_settings = preg_replace ($mu_plugins_section, $mu_plugins_replace, $_wp_settings, 1, $mu_plugins_replaced)) && $mu_plugins_replaced)
75
+ {
76
+ $nw_plugins_section = "/[\r\n\t\s ]+foreach *\( *wp_get_active_network_plugins *\( *\) *as *\\\$network_plugin *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include_once *\( *\\\$network_plugin *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*unset *\( *\\\$network_plugin *\);/";
77
+ $nw_plugins_replace = "\n\n" . c_ws_plugin__s2member_utils_s2o::esc_ds (trim (c_ws_plugin__s2member_utils_s2o::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/cfg-files/s2o-nw-plugins.php")))) . "\n";
78
+ if (($_wp_settings = preg_replace ($nw_plugins_section, $nw_plugins_replace, $_wp_settings, 1, $nw_plugins_replaced)) && $nw_plugins_replaced)
79
+ {
80
+ $st_plugins_section = "/[\r\n\t\s ]+foreach *\( *wp_get_active_and_valid_plugins *\( *\) *as *\\\$plugin *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include_once *\( *\\\$plugin *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*unset *\( *\\\$plugin *\);/";
81
+ $st_plugins_replace = "\n\n" . c_ws_plugin__s2member_utils_s2o::esc_ds (trim (c_ws_plugin__s2member_utils_s2o::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/cfg-files/s2o-st-plugins.php")))) . "\n";
82
+ if (($_wp_settings = preg_replace ($st_plugins_section, $st_plugins_replace, $_wp_settings, 1, $st_plugins_replaced)) && $st_plugins_replaced)
83
+ {
84
+ $th_funcs_section = "/[\r\n\t\s ]+if *\( *\! *defined *\( *['\"]WP_INSTALLING['\"] *\) *\|\| *['\"]wp-activate.php['\"] *\=\=\= *\\\$pagenow *\)[\r\n\t\s ]*\{[\r\n\t\s ]*if *\( *TEMPLATEPATH *\!\=\= *STYLESHEETPATH *&& *file_exists *\( *STYLESHEETPATH *\. *['\"]\/functions\.php['\"] *\) *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include *\( *STYLESHEETPATH *\. *['\"]\/functions\.php['\"] *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*if *\( *file_exists *\( *TEMPLATEPATH *\. *['\"]\/functions\.php['\"] *\) *\)[\r\n\t\s ]*\{?[\r\n\t\s ]*include *\( *TEMPLATEPATH *\. *['\"]\/functions\.php['\"] *\);[\r\n\t\s ]*\}?[\r\n\t\s ]*\}/";
85
+ $th_funcs_replace = "\n\n" . c_ws_plugin__s2member_utils_s2o::esc_ds (trim (c_ws_plugin__s2member_utils_s2o::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/cfg-files/s2o-th-funcs.php")))) . "\n";
86
+ if (($_wp_settings = preg_replace ($th_funcs_section, $th_funcs_replace, $_wp_settings, 1, $th_funcs_replaced)) && $th_funcs_replaced)
87
+ {
88
+ if (($_wp_settings = str_replace ("__FILE__", '"' . str_replace ('"', '\"', $o_file) . '"', $_wp_settings))) /* Eval compatible. */
89
+ {
90
+ if (($_wp_settings = trim ($_wp_settings))) /* WordPress®, with s2Member only. */
91
+ return ($wp_settings_as = $_wp_settings); /* After ``SHORTINIT``. */
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ /**/
101
+ return false;
102
+ }
103
+ /**
104
+ * Escapes dollars signs ( for regex patterns ).
105
+ *
106
+ * @package s2Member\Utilities
107
+ * @since 110917
108
+ *
109
+ * @param str $string Input string.
110
+ * @param int $times Mumber of escapes. Defaults to 1.
111
+ * @return str Output string after dollar signs are escaped.
112
+ */
113
+ public static function esc_ds ($string = FALSE, $times = FALSE)
114
+ {
115
+ $times = (is_numeric ($times) && $times >= 0) ? (int)$times : 1;
116
+ return str_replace ('$', str_repeat ("\\", $times) . '$', (string)$string);
117
+ }
118
+ /**
119
+ * Evaluates PHP code, and "returns" output.
120
+ *
121
+ * @package s2Member\Utilities
122
+ * @since 110917
123
+ *
124
+ * @param str $code A string of data, possibly with embedded PHP code.
125
+ * @return str Output after PHP evaluation.
126
+ */
127
+ public static function evl ($code = FALSE)
128
+ {
129
+ ob_start (); /* Output buffer. */
130
+ /**/
131
+ eval ("?>" . trim ($code));
132
  /**/
133
+ return ob_get_clean ();
134
  }
135
  }
136
  }
includes/classes/utils-urls.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_urls"))
21
  {
@@ -54,6 +54,50 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
54
  add_query_arg ("action", urlencode ("register"), wp_login_url ($redirect_to)), get_defined_vars ());
55
  }
56
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  * Responsible for all remote communications processed by s2Member.
58
  *
59
  * Uses ``wp_remote_request()`` through the `WP_Http` class.
@@ -71,50 +115,47 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
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
- /**/
76
- $args = (!is_array ($args)) ? array (): $args; /* Disable SSL verifications. */
77
- $args["sslverify"] = (!isset ($args["sslverify"])) ? false : $args["sslverify"];
78
- /**/
79
- if (!$http_response_filtered && ($http_response_filtered = true))
80
- add_filter ("http_response", "c_ws_plugin__s2member_utils_urls::_remote_gz_variations");
81
- /**/
82
- if ($url) /* Obviously, we must have a valid URL before we do anything at all here. */
83
  {
84
- if (preg_match ("/^https/i", $url) && stripos (PHP_OS, "win") === 0)
85
- add_filter ("use_curl_transport", "__return_false", ($curl_disabled = 1352));
86
  /**/
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. */
115
  }
116
  /**/
117
- return false; /* Else return false. */
 
118
  }
119
  /**
120
  * Filters the `WP_Http` response for additional gzinflate variations.
@@ -140,48 +181,48 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
140
  return $response; /* Return response. */
141
  }
142
  /**
143
- * Filters content redirection status *( uses 302s for browsers )*.
144
  *
145
  * @package s2Member\Utilities
146
- * @since 3.5
147
  *
148
- * @attaches-to: ``add_filter("ws_plugin__s2member_content_redirect_status");``
149
- *
150
- * @param int|str $status A numeric redirection status code.
151
- * @return int|str A numeric status redirection code, possibly modified to a value of `302`.
152
- *
153
- * @see http://en.wikipedia.org/wiki/Web_browser_engine
154
  */
155
- public static function redirect_browsers_using_302_status ($status = 301)
156
  {
157
- $engines = "msie|trident|gecko|webkit|presto|konqueror|playstation";
 
158
  /**/
159
- if ((int)$status === 301 && !empty ($_SERVER["HTTP_USER_AGENT"]))
160
- if (($is_browser = preg_match ("/(" . $engines . ")[\/ ]([0-9\.]+)/i", $_SERVER["HTTP_USER_AGENT"])))
161
- return 302;
162
  /**/
163
- return $status; /* Else keep existing status code. */
164
- }
165
- /**
166
- * Parses out a full valid URI, from either a full URL, or a partial.
167
- *
168
- * @package s2Member\Utilities
169
- * @since 3.5
170
- *
171
- * @param str $url_or_uri Either a full URL, or a partial URI.
172
- * @return str|bool A valid URI, starting with `/` on success, else false.
173
- */
174
- public static function parse_uri ($url_or_uri = FALSE)
175
- {
176
- if (($parse = @parse_url ($url_or_uri))) /* See: http://php.net/manual/en/function.parse-url.php. */
177
  {
178
- $parse["path"] = (!empty ($parse["path"])) ? ((strpos ($parse["path"], "/") === 0) ? $parse["path"] : "/" . $parse["path"]) : "/";
179
- $parse["path"] = preg_replace ("/\/+/", "/", $parse["path"]); /* Removes multi slashes. */
180
  /**/
181
- return (!empty ($parse["query"])) ? $parse["path"] . "?" . $parse["query"] : $parse["path"];
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
183
  /**/
184
- return false;
185
  }
186
  }
187
  }
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_urls"))
21
  {
54
  add_query_arg ("action", urlencode ("register"), wp_login_url ($redirect_to)), get_defined_vars ());
55
  }
56
  /**
57
+ * Filters content redirection status *( uses 302s for browsers )*.
58
+ *
59
+ * @package s2Member\Utilities
60
+ * @since 3.5
61
+ *
62
+ * @attaches-to: ``add_filter("ws_plugin__s2member_content_redirect_status");``
63
+ *
64
+ * @param int|str $status A numeric redirection status code.
65
+ * @return int|str A numeric status redirection code, possibly modified to a value of `302`.
66
+ *
67
+ * @see http://en.wikipedia.org/wiki/Web_browser_engine
68
+ */
69
+ public static function redirect_browsers_using_302_status ($status = 301)
70
+ {
71
+ $engines = "msie|trident|gecko|webkit|presto|konqueror|playstation";
72
+ /**/
73
+ if ((int)$status === 301 && !empty ($_SERVER["HTTP_USER_AGENT"]))
74
+ if (($is_browser = preg_match ("/(" . $engines . ")[\/ ]([0-9\.]+)/i", $_SERVER["HTTP_USER_AGENT"])))
75
+ return 302;
76
+ /**/
77
+ return $status; /* Else keep existing status code. */
78
+ }
79
+ /**
80
+ * Parses out a full valid URI, from either a full URL, or a partial.
81
+ *
82
+ * @package s2Member\Utilities
83
+ * @since 3.5
84
+ *
85
+ * @param str $url_or_uri Either a full URL, or a partial URI.
86
+ * @return str|bool A valid URI, starting with `/` on success, else false.
87
+ */
88
+ public static function parse_uri ($url_or_uri = FALSE)
89
+ {
90
+ if (($parse = @parse_url ($url_or_uri))) /* See: http://php.net/manual/en/function.parse-url.php. */
91
+ {
92
+ $parse["path"] = (!empty ($parse["path"])) ? ((strpos ($parse["path"], "/") === 0) ? $parse["path"] : "/" . $parse["path"]) : "/";
93
+ $parse["path"] = preg_replace ("/\/+/", "/", $parse["path"]); /* Removes multi slashes. */
94
+ /**/
95
+ return (!empty ($parse["query"])) ? $parse["path"] . "?" . $parse["query"] : $parse["path"];
96
+ }
97
+ /**/
98
+ return false;
99
+ }
100
+ /**
101
  * Responsible for all remote communications processed by s2Member.
102
  *
103
  * Uses ``wp_remote_request()`` through the `WP_Http` class.
115
  */
116
  public static function remote ($url = FALSE, $post_vars = FALSE, $args = FALSE, $return = FALSE)
117
  {
118
+ if ($url && is_string ($url)) /* We MUST have a valid full URL (string) before we do anything in this routine. */
 
 
 
 
 
 
 
 
119
  {
120
+ $args = (!is_array ($args)) ? array (): $args; /* Force array & disable SSL verification. */
121
+ $args["sslverify"] = (!isset ($args["sslverify"])) ? /* Off. */ false : $args["sslverify"];
122
  /**/
123
  if ((is_array ($post_vars) || is_string ($post_vars)) && !empty ($post_vars))
124
  $args = array_merge ($args, array ("method" => "POST", "body" => $post_vars));
125
  /**/
126
+ if (preg_match ("/^https/i", $url) && stripos (PHP_OS, "win") === 0)
127
+ add_filter ("use_curl_transport", "__return_false", ($curl_disabled = 1352));
128
+ /**/
129
+ if (!has_filter ("http_response", "c_ws_plugin__s2member_utils_urls::_remote_gz_variations"))
130
+ add_filter ("http_response", "c_ws_plugin__s2member_utils_urls::_remote_gz_variations");
131
+ /**/
132
+ $response = wp_remote_request ($url, $args); /* Try to process the remote request now. */
133
  /**/
134
+ if ($return === "array" /* Return array? */ && !is_wp_error ($response) && is_array ($response))
135
  {
136
+ $r = array ("code" => (int)wp_remote_retrieve_response_code ($response), "message" => wp_remote_retrieve_response_message ($response));
 
137
  /**/
138
+ $r = array_merge ($r, array ("o_headers" => wp_remote_retrieve_headers ($response), "headers" => array ()));
139
+ foreach (array_keys ($r["o_headers"]) as $header) /* Array of lowercase headers makes things easier. */
140
  $r["headers"][strtolower ($header)] = $r["o_headers"][$header];
141
  /**/
142
+ $r = array_merge ($r, array ("body" => wp_remote_retrieve_body ($response), "response" => $response));
 
143
  }
144
  /**/
145
+ else if (!is_wp_error ($response) && is_array ($response)) /* Else returning ``$response`` body only. */
146
  $r = wp_remote_retrieve_body ($response);
147
  /**/
148
+ else /* Else this remote request has failed completely. We must return a `false` value. */
149
+ $r = false; /* Remote request failed, return false. */
150
  /**/
151
+ if (isset ($curl_disabled) && $curl_disabled === 1352) /* Remove this Filter now? */
152
  remove_filter ("use_curl_transport", "__return_false", 1352);
153
  /**/
154
+ return $r; /* The ``$r`` return value. */
155
  }
156
  /**/
157
+ else /* Else, return false. */
158
+ return false;
159
  }
160
  /**
161
  * Filters the `WP_Http` response for additional gzinflate variations.
181
  return $response; /* Return response. */
182
  }
183
  /**
184
+ * Shortens a long URL through tinyURL, or through another backup API used by this routine.
185
  *
186
  * @package s2Member\Utilities
187
+ * @since 111002
188
  *
189
+ * @param str $url A full/long URL to be shortened.
190
+ * @param str $api_sp Optional. A specific URL shortening API to use. Defaults to that which is configured in the s2Member Dashboard. Normally `tiny_url` by default.
191
+ * @param bool $try_backups Defaults to true. If a failure occurs with the first API, we'll try others until we have success.
192
+ * @return str|bool The shortened URL on success, else false on failure.
 
 
193
  */
194
+ public static function shorten ($url = FALSE, $api_sp = FALSE, $try_backups = TRUE)
195
  {
196
+ $url = ($url && is_string ($url)) ? $url : false; /* Only accept a string value here. */
197
+ $api_sp = ($api_sp && is_string ($api_sp)) ? $api_sp : false; /* Only accept a string value. */
198
  /**/
199
+ $default_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"];
200
+ $default_custom_str_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_custom_str_url_shortener"];
 
201
  /**/
202
+ $apis = array ("tiny_url", "goo_gl"); /* The shortening APIs integrated with this routine so far. More will come soon. */
203
+ /**/
204
+ if ($url && ($api = ($api_sp) ? strtolower ($api_sp) : $default_url_shortener)) /* If specific, use it. Otherwise, default shortener. */
 
 
 
 
 
 
 
 
 
 
 
205
  {
206
+ if (!$api_sp && ($custom_url = apply_filters ("ws_plugin__s2member_url_shorten", false, get_defined_vars ())) && stripos ($custom_url, "http") === 0)
207
+ return ($shorter_url = $custom_url); /* Using whatever other shortener API you prefer, over the ones available by default with s2Member. */
208
  /**/
209
+ else if (!$api_sp && stripos ($default_custom_str_url_shortener, "http") === 0 && ($custom_url = trim (c_ws_plugin__s2member_utils_urls::remote (str_ireplace (array ("%%s2_long_url%%", "%%s2_long_url_md5%%"), array (rawurlencode ($url), urlencode (md5 ($url))), $default_custom_str_url_shortener)))) && stripos ($custom_url, "http") === 0)
210
+ return ($shorter_url = $custom_url); /* Using whatever other shortener API that a site owner prefers, over the ones available by default with s2Member. */
211
+ /**/
212
+ else if ($api === "tiny_url" && ($tiny_url = trim (c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($url)))) && stripos ($tiny_url, "http") === 0)
213
+ return ($shorter_url = $tiny_url); /* The default tinyURL API: <http://tinyurl.com/api-create.php?url=http://www.example.com/>.
214
+ /**/
215
+ else if ($api === "goo_gl" && ($goo_gl = json_decode (trim (c_ws_plugin__s2member_utils_urls::remote ("https://www.googleapis.com/urlshortener/v1/url" . ((($goo_gl_key = apply_filters ("ws_plugin__s2member_url_shorten_api_goo_gl_key", false))) ? "?key=" . urlencode ($goo_gl_key) : ""), json_encode (array ("longUrl" => $url)), array ("headers" => array ("Content-Type" => "application/json")))), true)) && !empty ($goo_gl["id"]) && ($goo_gl_url = $goo_gl["id"]) && stripos ($goo_gl_url, "http") === 0)
216
+ return ($shorter_url = $goo_gl_url); /* Google® API: <http://code.google.com/apis/urlshortener/v1/getting_started.html>.
217
+ /**/
218
+ else if ($try_backups && count ($apis) > 1) /* Try backups? This way we can still try to shorten the URL. */
219
+ /**/
220
+ foreach (array_diff ($apis, array ($api)) as $backup)
221
+ if (($backup = c_ws_plugin__s2member_utils_urls::shorten ($url, $backup, false)))
222
+ return ($shorter_url = $backup);
223
  }
224
  /**/
225
+ return false; /* Default return value. */
226
  }
227
  }
228
  }
includes/functions/api-functions.inc.php CHANGED
@@ -1798,8 +1798,8 @@ if (!function_exists ("attach_s2member_query_filters"))
1798
  {
1799
  function attach_s2member_query_filters ()
1800
  {
1801
- remove_action ("pre_get_posts", "c_ws_plugin__s2member_security::security_gate_query", 20);
1802
- add_action ("pre_get_posts", "c_ws_plugin__s2member_querys::force_query_level_access", 20);
1803
  }
1804
  }
1805
  /**
@@ -1844,8 +1844,8 @@ if (!function_exists ("detach_s2member_query_filters"))
1844
  {
1845
  function detach_s2member_query_filters ()
1846
  {
1847
- remove_action ("pre_get_posts", "c_ws_plugin__s2member_querys::force_query_level_access", 20);
1848
- add_action ("pre_get_posts", "c_ws_plugin__s2member_security::security_gate_query", 20);
1849
  }
1850
  }
1851
  /**
1798
  {
1799
  function attach_s2member_query_filters ()
1800
  {
1801
+ remove_action ("pre_get_posts", "c_ws_plugin__s2member_security::security_gate_query", 100);
1802
+ add_action ("pre_get_posts", "c_ws_plugin__s2member_querys::force_query_level_access", 100);
1803
  }
1804
  }
1805
  /**
1844
  {
1845
  function detach_s2member_query_filters ()
1846
  {
1847
+ remove_action ("pre_get_posts", "c_ws_plugin__s2member_querys::force_query_level_access", 100);
1848
+ add_action ("pre_get_posts", "c_ws_plugin__s2member_security::security_gate_query", 100);
1849
  }
1850
  }
1851
  /**
includes/hooks.inc.php CHANGED
@@ -15,14 +15,10 @@
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
  */
22
- add_action ("pre_get_posts", /* WP Query. */
23
- "c_ws_plugin__s2member_security::security_gate_query", 20);
24
- /* Priority matches `/api-functions.inc.php`. */
25
- /**/
26
  add_action ("init", "c_ws_plugin__s2member_translations::load", 2);
27
  /**/
28
  add_action ("init", "c_ws_plugin__s2member_ssl::check_force_ssl", 3);
@@ -54,8 +50,11 @@ add_action ("init", "c_ws_plugin__s2member_labels::config_label_translations", 1
54
  /**/
55
  add_action ("init", "c_ws_plugin__s2member_login_redirects_r::remove_login_redirect_filters", 11);
56
  /**/
57
- add_action ("template_redirect", "c_ws_plugin__s2member_ssl::check_force_ssl", 1);
58
- add_action ("template_redirect", "c_ws_plugin__s2member_security::security_gate", 1);
 
 
 
59
  /**/
60
  add_filter ("wp_mail", "c_ws_plugin__s2member_email_configs::email_filter");
61
  /**/
@@ -168,7 +167,7 @@ add_action ("ws_plugin__s2member_during_collective_eots", "c_ws_plugin__s2member
168
  /**/
169
  add_filter ("ws_plugin__s2member_content_redirect_status", "c_ws_plugin__s2member_utils_urls::redirect_browsers_using_302_status");
170
  /**/
171
- add_action ("bbp_activation", "c_ws_plugin__s2member_roles_caps::config_roles", 11); /* For bbPress® integration. */
172
  /*
173
  Register the activation | de-activation routines.
174
  */
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
  */
 
 
 
 
22
  add_action ("init", "c_ws_plugin__s2member_translations::load", 2);
23
  /**/
24
  add_action ("init", "c_ws_plugin__s2member_ssl::check_force_ssl", 3);
50
  /**/
51
  add_action ("init", "c_ws_plugin__s2member_login_redirects_r::remove_login_redirect_filters", 11);
52
  /**/
53
+ add_action ("pre_get_posts", "c_ws_plugin__s2member_security::security_gate_query", 100);
54
+ /**/
55
+ add_action ("wp", "c_ws_plugin__s2member_ssl::check_force_ssl", 2);
56
+ add_action ("wp", "c_ws_plugin__s2member_security::security_gate", 2);
57
+ /* Stay ahead of BuddyPress® @ `3`, in `bp-core-hooks.php`. */
58
  /**/
59
  add_filter ("wp_mail", "c_ws_plugin__s2member_email_configs::email_filter");
60
  /**/
167
  /**/
168
  add_filter ("ws_plugin__s2member_content_redirect_status", "c_ws_plugin__s2member_utils_urls::redirect_browsers_using_302_status");
169
  /**/
170
+ add_action ("bbp_activation", "c_ws_plugin__s2member_roles_caps::config_roles", 11);
171
  /*
172
  Register the activation | de-activation routines.
173
  */
includes/jquery/.htaccess ADDED
@@ -0,0 +1 @@
 
1
+ allow from all
includes/menu-pages/code-samples/{api-mop-vars.php → api-mop-vars.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{ccap-file-downloads.php → ccap-file-downloads.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-access-label.php → current-user-access-label.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-access-level-conditional-upgrades.php → current-user-access-level-conditional-upgrades.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-access-level.php → current-user-access-level.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-can-ccaps-1.php → current-user-can-ccaps-1.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-can-ccaps-2.php → current-user-can-ccaps-2.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-can-constants-1.php → current-user-can-constants-1.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-can-constants-2.php → current-user-can-constants-2.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-can-full-access.php → current-user-can-full-access.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-custom.php → current-user-custom.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-display-name.php → current-user-display-name.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-downloads-allowed-days.php → current-user-downloads-allowed-days.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-downloads-allowed-is-unlimited.php → current-user-downloads-allowed-is-unlimited.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-downloads-allowed.php → current-user-downloads-allowed.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-downloads-currently.php → current-user-downloads-currently.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-email.php → current-user-email.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-fields.php → current-user-fields.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-first-name.php → current-user-first-name.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-id.php → current-user-id.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-ip.php → current-user-ip.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-is-logged-in-as-member.php → current-user-is-logged-in-as-member.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-is-logged-in.php → current-user-is-logged-in.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-is-specific-content.php → current-user-is-specific-content.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-last-name.php → current-user-last-name.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-login-counter.php → current-user-login-counter.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-login.php → current-user-login.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-paid-registration-days-dripping.php → current-user-paid-registration-days-dripping.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-paid-registration-days.php → current-user-paid-registration-days.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-paid-registration-time.php → current-user-paid-registration-time.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-profile-modification-page-url-1-ops.php → current-user-profile-modification-page-url-1-ops.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-profile-modification-page-url-1.php → current-user-profile-modification-page-url-1.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-profile-modification-page-url-2-ops.php → current-user-profile-modification-page-url-2-ops.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-profile-modification-page-url-2.php → current-user-profile-modification-page-url-2.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-profile-modification-page-url-3-ops.php → current-user-profile-modification-page-url-3-ops.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-profile-modification-page-url-3.php → current-user-profile-modification-page-url-3.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-registration-days.php → current-user-registration-days.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-registration-ip.php → current-user-registration-ip.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-registration-time.php → current-user-registration-time.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-subscr-gateway.php → current-user-subscr-gateway.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-subscr-id.php → current-user-subscr-id.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-subscr-or-wp-id.php → current-user-subscr-or-wp-id.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{current-user-value-for-pp-on0-os0-on1-os1.php → current-user-value-for-pp-on0-os0-on1-os1.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{custom-queries-loop.php → custom-queries-loop.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{custom-queries.php → custom-queries.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{file-download-inline-extensions.php → file-download-inline-extensions.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{file-download-limit-exceeded-page-url.php → file-download-limit-exceeded-page-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{idev-ccap-tracking-code.php → idev-ccap-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{idev-modification-tracking-code.php → idev-modification-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{idev-signup-tracking-code.php → idev-signup-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{idev-sp-tracking-code.php → idev-sp-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{is-user-logged-in.php → is-user-logged-in.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{jwplayer-standard-mp4.php → jwplayer-standard-mp4.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{jwplayer-streaming-mp4-sca.php → jwplayer-streaming-mp4-sca.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{jwplayer-streaming-mp4-webm.php → jwplayer-streaming-mp4-webm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{jwplayer-streaming-mp4.php → jwplayer-streaming-mp4.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{level-file-downloads.php → level-file-downloads.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{leveln-file-downloads-allowed-days.php → leveln-file-downloads-allowed-days.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{leveln-file-downloads-allowed.php → leveln-file-downloads-allowed.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{leveln-label.php → leveln-label.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{login-page-url.php → login-page-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{login-welcome-page-url.php → login-welcome-page-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{logout-page-url.php → logout-page-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{membership-options-page-url.php → membership-options-page-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{mms-patch-load.php → mms-patch-load.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{mms-patch-ms-functions.php → mms-patch-ms-functions.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{mms-patch-user-new.php → mms-patch-user-new.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{mms-patch-wp-login.php → mms-patch-wp-login.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-api-endpoint.php → paypal-api-endpoint.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-api-password.php → paypal-api-password.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-api-signature.php → paypal-api-signature.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-api-username.php → paypal-api-username.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-business.php → paypal-business.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-endpoint.php → paypal-endpoint.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-notify-url.php → paypal-notify-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-pdt-identity-token.php → paypal-pdt-identity-token.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{paypal-return-url.php → paypal-return-url.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{reg-email-from-email.php → reg-email-from-email.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{reg-email-from-name.php → reg-email-from-name.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{s2-conditional-supplements-1.php → s2-conditional-supplements-1.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{s2-conditional-supplements-2.php → s2-conditional-supplements-2.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{s2-conditional-supplements-3.php → s2-conditional-supplements-3.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{s2member-paid-registration-time-examples.php → s2member-paid-registration-time-examples.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{s2member-paid-registration-time.php → s2member-paid-registration-time.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sas-ccap-tracking-code.php → sas-ccap-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sas-modification-tracking-code.php → sas-modification-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sas-signup-tracking-code.php → sas-signup-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sas-sp-tracking-code.php → sas-sp-tracking-code.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-current-user-can-full-access-farm.php → sc-current-user-can-full-access-farm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-current-user-can-full-access.php → sc-current-user-can-full-access.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-current-user-is-specific-content-farm.php → sc-current-user-is-specific-content-farm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-current-user-is-specific-content.php → sc-current-user-is-specific-content.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-is-user-logged-in-farm.php → sc-is-user-logged-in-farm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-is-user-logged-in.php → sc-is-user-logged-in.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-nesting.php → sc-s2-conditional-nesting.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-supplements-1-farm.php → sc-s2-conditional-supplements-1-farm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-supplements-1.php → sc-s2-conditional-supplements-1.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-supplements-2-farm.php → sc-s2-conditional-supplements-2-farm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-supplements-2.php → sc-s2-conditional-supplements-2.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-supplements-3-farm.php → sc-s2-conditional-supplements-3-farm.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{sc-s2-conditional-supplements-3.php → sc-s2-conditional-supplements-3.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{specific-category-restrictions.php → specific-category-restrictions.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{specific-page-restrictions.php → specific-page-restrictions.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{specific-post-restrictions.php → specific-post-restrictions.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{specific-tag-restrictions.php → specific-tag-restrictions.x-php} RENAMED
File without changes
includes/menu-pages/code-samples/{version.php → version.x-php} RENAMED
File without changes
includes/menu-pages/down-ops.inc.php CHANGED
@@ -490,16 +490,16 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_down_ops"))
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
  /**/
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.x-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.x-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.x-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.x-php")) . '</p>' . "\n";
503
  /**/
504
  echo '</div>' . "\n";
505
  /**/
includes/menu-pages/gen-ops.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
  if (!class_exists ("c_ws_plugin__s2member_menu_page_gen_ops"))
21
  {
@@ -1232,7 +1232,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_gen_ops"))
1232
  echo '<p><input type="text" value="' . format_to_edit ('[s2Member-Profile /]') . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
1233
  /**/
1234
  echo '<p style="margin-top:20px;"><strong>Stand-Alone ( copy/paste )</strong>, for popup window:</p>' . "\n";
1235
- echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2-ops.php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
1236
  echo '</div>' . "\n";
1237
  /**/
1238
  echo '</div>' . "\n";
@@ -1240,21 +1240,62 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_gen_ops"))
1240
  do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_profile_modifications", get_defined_vars ());
1241
  }
1242
  /**/
1243
- if (apply_filters ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_display_restrictions", true, get_defined_vars ()))
1244
  {
1245
- do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_before_restrictions", get_defined_vars ());
1246
  /**/
1247
- echo '<div class="ws-menu-page-group" title="Restrictions ( Posts/Pages/Categories/Tags/URIs/etc. )">' . "\n";
1248
  /**/
1249
- echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
1250
- echo '<h3>Restrictions ( Posts/Pages/Categories/Tags/URIs/etc. )</h3>' . "\n";
1251
- echo '<p>All of these options have been moved into their own configuration panel.<br />Please go to: <code>s2Member -> Restriction Options</code></p>' . "\n";
1252
- do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_during_restrictions", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1253
  echo '</div>' . "\n";
1254
  /**/
1255
  echo '</div>' . "\n";
1256
  /**/
1257
- do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_restrictions", get_defined_vars ());
1258
  }
1259
  /**/
1260
  do_action ("ws_plugin__s2member_during_gen_ops_page_after_left_sections", get_defined_vars ());
15
  * @since 3.0
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_page_gen_ops"))
21
  {
1232
  echo '<p><input type="text" value="' . format_to_edit ('[s2Member-Profile /]') . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
1233
  /**/
1234
  echo '<p style="margin-top:20px;"><strong>Stand-Alone ( copy/paste )</strong>, for popup window:</p>' . "\n";
1235
+ echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2-ops.x-php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
1236
  echo '</div>' . "\n";
1237
  /**/
1238
  echo '</div>' . "\n";
1240
  do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_profile_modifications", get_defined_vars ());
1241
  }
1242
  /**/
1243
+ if (apply_filters ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_display_url_shortening", true, get_defined_vars ()))
1244
  {
1245
+ do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_before_url_shortening", get_defined_vars ());
1246
  /**/
1247
+ echo '<div class="ws-menu-page-group" title="URL Shortening API ( Preference )">' . "\n";
1248
  /**/
1249
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-url-shortening-section">' . "\n";
1250
+ echo '<h3>URL Shortening Service API ( Preference )</h3>' . "\n";
1251
+ echo '<p>In a few special cases, long URLs generated by s2Member, containing encrypted authentication details, will be shortened; using one of the URL Shortening APIs <em>( listed below )</em>. A shortened URL prevents issues with VERY long links becoming corrupted by a Customer\'s email application. For instance, the Signup Confirmation Email that s2Member sends out to a new paying Customer, may contain a link which is shortened to prevent corruption by email applications. By default, s2Member uses the tinyURL API, which has proven itself to be the most reliable. However, in cases where an API service call fails, s2Member will automatically use one or more of its other APIs as a backup. The option below, allows you to configure which URL Shortening API s2Member should try first <em>( i.e. the one you prefer )</em>.</p>' . "\n";
1252
+ do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_during_url_shortening", get_defined_vars ());
1253
+ /**/
1254
+ echo '<table class="form-table">' . "\n";
1255
+ echo '<tbody>' . "\n";
1256
+ echo '<tr>' . "\n";
1257
+ /**/
1258
+ echo '<th>' . "\n";
1259
+ echo '<label for="ws-plugin--s2member-default-url-shortener">' . "\n";
1260
+ echo 'URL Shortening Service API ( Preference ):' . "\n";
1261
+ echo '</label>' . "\n";
1262
+ echo '</th>' . "\n";
1263
+ /**/
1264
+ echo '</tr>' . "\n";
1265
+ echo '<tr>' . "\n";
1266
+ /**/
1267
+ echo '<td>' . "\n";
1268
+ echo '<select name="ws_plugin__s2member_default_url_shortener" id="ws-plugin--s2member-default-url-shortener">' . "\n";
1269
+ echo '<option value="tiny_url"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"] === "tiny_url") ? ' selected="selected"' : '') . '>tinyurl.com ( free tinyURL™ API service )</option>' . "\n";
1270
+ echo '<option value="goo_gl"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"] === "goo_gl") ? ' selected="selected"' : '') . '>goo.gl ( free Google® URL Shortening API service )</option>' . "\n";
1271
+ echo '</select>' . "\n";
1272
+ echo '</td>' . "\n";
1273
+ /**/
1274
+ echo '</tr>' . "\n";
1275
+ echo '<tr>' . "\n";
1276
+ /**/
1277
+ echo '<th>' . "\n";
1278
+ echo '<label for="ws-plugin--s2member-default-custom-str-url-shortener">' . "\n";
1279
+ echo 'Custom URL Shortening Service API ( Optional/Advanced ):' . "\n";
1280
+ echo '</label>' . "\n";
1281
+ echo '</th>' . "\n";
1282
+ /**/
1283
+ echo '</tr>' . "\n";
1284
+ echo '<tr>' . "\n";
1285
+ /**/
1286
+ echo '<td>' . "\n";
1287
+ echo '<input type="text" name="ws_plugin__s2member_default_custom_str_url_shortener" id="ws-plugin--s2member-default-custom-str-url-shortener" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_custom_str_url_shortener"]) . '" /><br />' . "\n";
1288
+ echo 'Your own custom URL <code>( i.e. GET request )</code>, with <code>%%s2_long_url%%</code> Replacement Code. [ <a href="#" onclick="alert(\'s2Member makes it possible for advanced site owners to use a custom URL shortening service they prefer, over the ones currently pre-integrated with s2Member. In order for this to work, your URL shortening service MUST support basic GET requests through its API ( sometimes referred to as a REST or NVP API ). In addition, your URL shortening service MUST be capable of returning a simple URL in the response that s2Member receives, as a result of s2Member processing the GET request you formulate. See example below.\\n\\nBitly example GET request with format=txt:\nhttp://api.bitly.com/v3/shorten?login=demo&apiKey=2d71bf07&format=txt&longUrl=%%s2_long_url%%\\n( s2Member expects a shortened URL in the response from Bitly )\\n\\n* If you configure s2Member to use your own custom URL shortening service, s2Member will try your configuration first, and if anything fails, it will fall back on its own pre-integrated backups. When configuring your URL for the GET request, s2Member makes two Replacement Codes available:\\n\\n%%s2_long_url%% = The full URL that needs to be shortened ( raw URL-encoded ).\\n%%s2_long_url_md5%% = An MD5 hash of the full URL ( might be useful in some APIs ).\\n\\n* If you have any trouble getting your URL shortening service integrated with s2Member in this way, you might take a look at this WordPress® Filter ( `ws_plugin__s2member_url_shorten` ), which s2Member makes available for advanced circumstances. Search s2Member\\\'s source code for `ws_plugin__s2member_url_shorten`.\'); return false;" tabindex="-1">click for details</a> ]<br />' . "\n";
1289
+ echo '</td>' . "\n";
1290
+ /**/
1291
+ echo '</tr>' . "\n";
1292
+ echo '</tbody>' . "\n";
1293
+ echo '</table>' . "\n";
1294
  echo '</div>' . "\n";
1295
  /**/
1296
  echo '</div>' . "\n";
1297
  /**/
1298
+ do_action ("ws_plugin__s2member_during_gen_ops_page_during_left_sections_after_url_shortening", get_defined_vars ());
1299
  }
1300
  /**/
1301
  do_action ("ws_plugin__s2member_during_gen_ops_page_after_left_sections", get_defined_vars ());
includes/menu-pages/mms-ops.inc.php CHANGED
@@ -102,13 +102,13 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_mms_ops"))
102
  echo '<h3>Rather Do It Yourself? ( <a href="#" onclick="jQuery(\'div#ws-plugin--s2member-mms-patches-details\').toggle(); return false;" class="ws-dotted-link">manual instructions</a> )</h3>' . "\n";
103
  echo '<div id="ws-plugin--s2member-mms-patches-details" style="display:none;">' . "\n";
104
  echo '<p><strong>Patch #1</strong> ( /wp-login.php )</p>' . "\n";
105
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-wp-login.php")) . '</p>' . "\n";
106
  echo '<p><strong>Patch #2</strong> ( /wp-includes/load.php )</p>' . "\n";
107
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-load.php")) . '</p>' . "\n";
108
  echo '<p><strong>Patch #3</strong> ( /wp-admin/user-new.php )</p>' . "\n";
109
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-user-new.php")) . '</p>' . "\n";
110
  echo '<p><strong>Patch #4</strong> ( /wp-includes/ms-functions.php )</p>' . "\n";
111
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-ms-functions.php")) . '</p>' . "\n";
112
  echo '<p><em class="ws-menu-page-hilite">Don\'t forget to patch these files again, each time you upgrade the WordPress® core.</em></p>' . "\n";
113
  echo '</div>' . "\n";
114
  echo '</div>' . "\n";
102
  echo '<h3>Rather Do It Yourself? ( <a href="#" onclick="jQuery(\'div#ws-plugin--s2member-mms-patches-details\').toggle(); return false;" class="ws-dotted-link">manual instructions</a> )</h3>' . "\n";
103
  echo '<div id="ws-plugin--s2member-mms-patches-details" style="display:none;">' . "\n";
104
  echo '<p><strong>Patch #1</strong> ( /wp-login.php )</p>' . "\n";
105
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-wp-login.x-php")) . '</p>' . "\n";
106
  echo '<p><strong>Patch #2</strong> ( /wp-includes/load.php )</p>' . "\n";
107
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-load.x-php")) . '</p>' . "\n";
108
  echo '<p><strong>Patch #3</strong> ( /wp-admin/user-new.php )</p>' . "\n";
109
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-user-new.x-php")) . '</p>' . "\n";
110
  echo '<p><strong>Patch #4</strong> ( /wp-includes/ms-functions.php )</p>' . "\n";
111
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/mms-patch-ms-functions.x-php")) . '</p>' . "\n";
112
  echo '<p><em class="ws-menu-page-hilite">Don\'t forget to patch these files again, each time you upgrade the WordPress® core.</em></p>' . "\n";
113
  echo '</div>' . "\n";
114
  echo '</div>' . "\n";
includes/menu-pages/paypal-ops.inc.php CHANGED
@@ -55,7 +55,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_paypal_ops"))
55
  echo '<a href="https://www.paypal.com/us/mrb/pal=KMEJ5UCMUQVAW" target="_blank"><img src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/paypal-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
56
  echo '<h3>PayPal® Account Details ( required, if using PayPal® )</h3>' . "\n";
57
  echo '<p>This plugin works in conjunction with <a href="https://www.paypal.com/us/mrb/pal=KMEJ5UCMUQVAW" target="_blank" rel="external">PayPal® Website Payments Standard</a>, for businesses. You do NOT need a PayPal® Pro account. You just need to upgrade your Personal PayPal® account to a Business status, which is free. A PayPal® account can be <a href="http://pages.ebay.com/help/buy/questions/upgrade-paypal-account.html" target="_blank" rel="external">upgraded</a> from a Personal account to a Business account, simply by going to the `Profile` button under the `My Account` tab, selecting the `Personal Business Information` button, and then clicking the `Upgrade Your Account` button.</p>' . "\n";
58
- echo '<p><em><strong>*PayPal® API Credentials*</strong> Once you have a PayPal® Business account, you\'ll need access to your <a href="https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_NVPAPIBasics#id084E30I30RO" target="_blank" rel="external">PayPal® API Credentials</a>. Log into your PayPal® account, and navigate to <code>Profile -> Request API Credentials</code>. You\'ll choose ( PayPal® API ), and then choose ( Create Your Own ). Once you\'ve got your API Credentials, come back and paste them into the fields below.</em></p>' . "\n";
59
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_account_details", get_defined_vars ());
60
  /**/
61
  echo '<table class="form-table">' . "\n";
@@ -90,7 +90,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_paypal_ops"))
90
  /**/
91
  echo '<td>' . "\n";
92
  echo '<input type="text" name="ws_plugin__s2member_paypal_api_username" id="ws-plugin--s2member-paypal-api-username" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]) . '" /><br />' . "\n";
93
- echo 'In your PayPal® account, go to: <code>Profile -> Request API Credentials</code>.' . "\n";
94
  echo '</td>' . "\n";
95
  /**/
96
  echo '</tr>' . "\n";
@@ -107,7 +107,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_paypal_ops"))
107
  /**/
108
  echo '<td>' . "\n";
109
  echo '<input type="password" name="ws_plugin__s2member_paypal_api_password" id="ws-plugin--s2member-paypal-api-password" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]) . '" /><br />' . "\n";
110
- echo 'In your PayPal® account, go to: <code>Profile -> Request API Credentials</code>.' . "\n";
111
  echo '</td>' . "\n";
112
  /**/
113
  echo '</tr>' . "\n";
@@ -124,7 +124,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_paypal_ops"))
124
  /**/
125
  echo '<td>' . "\n";
126
  echo '<input type="password" name="ws_plugin__s2member_paypal_api_signature" id="ws-plugin--s2member-paypal-api-signature" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]) . '" /><br />' . "\n";
127
- echo 'In your PayPal® account, go to: <code>Profile -> Request API Credentials</code>.' . "\n";
128
  echo '</td>' . "\n";
129
  /**/
130
  echo '</tr>' . "\n";
55
  echo '<a href="https://www.paypal.com/us/mrb/pal=KMEJ5UCMUQVAW" target="_blank"><img src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/paypal-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
56
  echo '<h3>PayPal® Account Details ( required, if using PayPal® )</h3>' . "\n";
57
  echo '<p>This plugin works in conjunction with <a href="https://www.paypal.com/us/mrb/pal=KMEJ5UCMUQVAW" target="_blank" rel="external">PayPal® Website Payments Standard</a>, for businesses. You do NOT need a PayPal® Pro account. You just need to upgrade your Personal PayPal® account to a Business status, which is free. A PayPal® account can be <a href="http://pages.ebay.com/help/buy/questions/upgrade-paypal-account.html" target="_blank" rel="external">upgraded</a> from a Personal account to a Business account, simply by going to the `Profile` button under the `My Account` tab, selecting the `Personal Business Information` button, and then clicking the `Upgrade Your Account` button.</p>' . "\n";
58
+ echo '<p><em><strong>*PayPal® API Credentials*</strong> Once you have a PayPal® Business account, you\'ll need access to your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_profile-api-access" target="_blank" rel="external">PayPal® API Credentials</a>. Log into your PayPal® account, and navigate to <code>Profile -> API Access (or Request API Credentials)</code>. You\'ll choose <code>( Request API Signature )</code>.</em></p>' . "\n";
59
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_account_details", get_defined_vars ());
60
  /**/
61
  echo '<table class="form-table">' . "\n";
90
  /**/
91
  echo '<td>' . "\n";
92
  echo '<input type="text" name="ws_plugin__s2member_paypal_api_username" id="ws-plugin--s2member-paypal-api-username" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]) . '" /><br />' . "\n";
93
+ echo 'At PayPal®, see: <code>Profile -> API Access (or Request API Credentials)</code>.' . "\n";
94
  echo '</td>' . "\n";
95
  /**/
96
  echo '</tr>' . "\n";
107
  /**/
108
  echo '<td>' . "\n";
109
  echo '<input type="password" name="ws_plugin__s2member_paypal_api_password" id="ws-plugin--s2member-paypal-api-password" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]) . '" /><br />' . "\n";
110
+ echo 'At PayPal®, see: <code>Profile -> API Access (or Request API Credentials)</code>.' . "\n";
111
  echo '</td>' . "\n";
112
  /**/
113
  echo '</tr>' . "\n";
124
  /**/
125
  echo '<td>' . "\n";
126
  echo '<input type="password" name="ws_plugin__s2member_paypal_api_signature" id="ws-plugin--s2member-paypal-api-signature" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]) . '" /><br />' . "\n";
127
+ echo 'At PayPal®, see: <code>Profile -> API Access (or Request API Credentials)</code>.' . "\n";
128
  echo '</td>' . "\n";
129
  /**/
130
  echo '</tr>' . "\n";
includes/menu-pages/scripting.inc.php CHANGED
@@ -75,32 +75,32 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
75
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
76
  /**/
77
  echo '<p><strong>Example #1:</strong> Full access for anyone that is logged in.</strong></p>' . "\n";
78
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-is-user-logged-in-farm.php")) . '</p>' . "\n";
79
  /**/
80
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
81
  /**/
82
  echo '<p><strong>Example #2:</strong> Full access for any Member with a Level >= 1.</strong></p>' . "\n";
83
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-can-full-access-farm.php")) . '</p>' . "\n";
84
  /**/
85
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
86
  /**/
87
  echo '<p><strong>Example #3:</strong> Specific content for each different Member Level.</strong></p>' . "\n";
88
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-is-specific-content-farm.php")) . '</p>' . "\n";
89
  /**/
90
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
91
  /**/
92
  echo '<p><strong>Example #4:</strong> Simple Conditionals w/ integrated use of [s2Get /].</strong></p>' . "\n";
93
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-1-farm.php")) . '</p>' . "\n";
94
  /**/
95
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
96
  /**/
97
  echo '<p><strong>Example #5:</strong> Using multiple Conditionals together, and even nesting other Shortcodes.</strong></p>' . "\n";
98
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-2-farm.php")) . '</p>' . "\n";
99
  /**/
100
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
101
  /**/
102
  echo '<p><strong>Example #6:</strong> Using multiple Conditionals together, and even nesting Conditionals.</strong></p>' . "\n";
103
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-3-farm.php")) . '</p>' . "\n";
104
  /**/
105
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
106
  /**/
@@ -119,7 +119,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
119
  echo '<p><em><strong>Implementing AND/OR Conditional expressions:</strong></em></p>' . "\n";
120
  echo '<p><em>*Tip: do NOT mix AND/OR expressions.<br /> <strong class="ws-menu-page-error-hilite">BAD</strong> <code>is_user_logged_in() AND is_page(1) OR is_page(2)</code><br />- use one or the other; do NOT mix AND/OR together.</em></p>' . "\n";
121
  echo '<p><em><strong class="ws-menu-page-hilite">If you need to have both types of logic, use nesting:</strong></em></p>' . "\n";
122
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-nesting.php")) . '</p>' . "\n";
123
  echo '</div>' . "\n";
124
  /**/
125
  echo '</div>' . "\n";
@@ -142,32 +142,32 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
142
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
143
  /**/
144
  echo '<p><strong>Example #1:</strong> Full access for anyone that is logged in.</strong></p>' . "\n";
145
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-is-user-logged-in.php")) . '</p>' . "\n";
146
  /**/
147
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
148
  /**/
149
  echo '<p><strong>Example #2:</strong> Full access for any Member with a Level >= 1.</strong></p>' . "\n";
150
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-can-full-access.php")) . '</p>' . "\n";
151
  /**/
152
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
153
  /**/
154
  echo '<p><strong>Example #3:</strong> Specific content for each different Member Level.</strong></p>' . "\n";
155
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-is-specific-content.php")) . '</p>' . "\n";
156
  /**/
157
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
158
  /**/
159
  echo '<p><strong>Example #4:</strong> Simple Conditionals w/ integrated use of [s2Get /].</strong></p>' . "\n";
160
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-1.php")) . '</p>' . "\n";
161
  /**/
162
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
163
  /**/
164
  echo '<p><strong>Example #5:</strong> Using multiple Conditionals together, and even nesting other Shortcodes.</strong></p>' . "\n";
165
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-2.php")) . '</p>' . "\n";
166
  /**/
167
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
168
  /**/
169
  echo '<p><strong>Example #6:</strong> Using multiple Conditionals together, and even nesting Conditionals.</strong></p>' . "\n";
170
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-3.php")) . '</p>' . "\n";
171
  /**/
172
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
173
  /**/
@@ -186,7 +186,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
186
  echo '<p><em><strong>Implementing AND/OR Conditional expressions:</strong></em></p>' . "\n";
187
  echo '<p><em>*Tip: do NOT mix AND/OR expressions.<br /> <strong class="ws-menu-page-error-hilite">BAD</strong> <code>is_user_logged_in() AND is_page(1) OR is_page(2)</code><br />- use one or the other; do NOT mix AND/OR together.</em></p>' . "\n";
188
  echo '<p><em><strong class="ws-menu-page-hilite">If you need to have both types of logic, use nesting:</strong></em></p>' . "\n";
189
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-nesting.php")) . '</p>' . "\n";
190
  echo '</div>' . "\n";
191
  /**/
192
  echo '</div>' . "\n";
@@ -214,42 +214,42 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
214
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
215
  /**/
216
  echo '<p><strong>Example #1:</strong> Full access for anyone that is logged in.</strong></p>' . "\n";
217
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/is-user-logged-in.php")) . '</p>' . "\n";
218
  /**/
219
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
220
  /**/
221
  echo '<p><strong>Example #2:</strong> Full access for any Member with a Level >= 1.</strong></p>' . "\n";
222
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-full-access.php")) . '</p>' . "\n";
223
  /**/
224
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
225
  /**/
226
  echo '<p><strong>Example #3:</strong> Specific content for each different Member Level.</strong></p>' . "\n";
227
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-is-specific-content.php")) . '</p>' . "\n";
228
  /**/
229
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
230
  /**/
231
  echo '<p><strong>Example #4:</strong> Using s2Member API Conditionals, supplementing WordPress® core functions.</strong></p>' . "\n";
232
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2-conditional-supplements-1.php")) . '</p>' . "\n";
233
  /**/
234
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
235
  /**/
236
  echo '<p><strong>Example #5:</strong> Using s2Member API Conditionals, supplementing WordPress® core functions.</strong></p>' . "\n";
237
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2-conditional-supplements-2.php")) . '</p>' . "\n";
238
  /**/
239
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
240
  /**/
241
  echo '<p><strong>Example #6:</strong> Using multiple Conditionals together, and even nesting Conditionals.</strong></p>' . "\n";
242
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2-conditional-supplements-3.php")) . '</p>' . "\n";
243
  /**/
244
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
245
  /**/
246
  echo '<p><strong>Example #7:</strong> Using s2Member API Constants, instead of conditional functions.</strong></p>' . "\n";
247
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-constants-1.php")) . '</p>' . "\n";
248
  /**/
249
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
250
  /**/
251
  echo '<p><strong>Example #8:</strong> Using s2Member API Constants, instead of conditional functions.</strong></p>' . "\n";
252
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-constants-2.php")) . '</p>' . "\n";
253
  /**/
254
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
255
  /**/
@@ -283,32 +283,32 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
283
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
284
  /**/
285
  echo '<p><strong>Example #1:</strong> Pre-filtering custom queries in WordPress®.</strong></p>' . "\n";
286
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/custom-queries.php")) . '</p>' . "\n";
287
  /**/
288
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
289
  /**/
290
  echo '<p><strong>Example #2:</strong> OR, instead of pre-filtering; check Access Restrictions in The Loop.</strong></p>' . "\n";
291
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/custom-queries-loop.php")) . '</p>' . "\n";
292
  /**/
293
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
294
  /**/
295
  echo '<p><strong>Example #3:</strong> Checking Tag Restrictions.</strong></p>' . "\n";
296
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-tag-restrictions.php")) . '</p>' . "\n";
297
  /**/
298
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
299
  /**/
300
  echo '<p><strong>Example #4:</strong> Checking Category Restrictions.</strong></p>' . "\n";
301
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-category-restrictions.php")) . '</p>' . "\n";
302
  /**/
303
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
304
  /**/
305
  echo '<p><strong>Example #5:</strong> Checking Page Restrictions.</strong></p>' . "\n";
306
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-page-restrictions.php")) . '</p>' . "\n";
307
  /**/
308
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
309
  /**/
310
  echo '<p><strong>Example #6:</strong> Checking Post Restrictions, including Custom Post Types.</strong></p>' . "\n";
311
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-post-restrictions.php")) . '</p>' . "\n";
312
  echo '</div>' . "\n";
313
  /**/
314
  echo '</div>' . "\n";
@@ -343,10 +343,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
343
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
344
  /**/
345
  echo '<p><strong>Custom Capabilities:</strong> ( music,videos ):</p>' . "\n";
346
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-ccaps-1.php")) . '</p>' . "\n";
347
  /**/
348
  echo '<p><strong>Custom Capabilities:</strong> ( ebooks,reports,tips ):</p>' . "\n";
349
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-ccaps-2.php")) . '</p>' . "\n";
350
  echo '</div>' . "\n";
351
  /**/
352
  echo '</div>' . "\n";
@@ -377,7 +377,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
377
  echo '<p>Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos</code></p>' . "\n";
378
  echo '<p>Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music/file.mp3</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos/file.avi</code></p>' . "\n";
379
  echo '<p>Now, here are some link examples, using Custom Capability Sub-directories:</p>' . "\n";
380
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/ccap-file-downloads.php")) . '</p>' . "\n";
381
  echo '<p><em>These links will ONLY work for Members who are logged-in, with the proper Capabilities.</em></p>' . "\n";
382
  /**/
383
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
@@ -386,7 +386,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
386
  echo '<p>Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4</code></p>' . "\n";
387
  echo '<p>Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0/tiger.doc</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1/zebra.pdf</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2/elephant.doc</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3/rhino.pdf</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4/lion.doc</code></p>' . "\n";
388
  echo '<p>Now, here are some link examples, using Member Level Sub-directories:</p>' . "\n";
389
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/level-file-downloads.php")) . '</p>' . "\n";
390
  echo '<p><em>These links will ONLY work for Members who are logged-in, with an adequate Membership Level.</em></p>' . "\n";
391
  echo '</div>' . "\n";
392
  /**/
@@ -414,7 +414,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
414
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
415
  /**/
416
  echo '<p><strong>To drip content using <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>:</strong></p>' . "\n";
417
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-paid-registration-days-dripping.php")) . '</p>' . "\n";
418
  /**/
419
  echo '<p><em>There are more examples on this page, under the sub-section "s2Member PHP/API Constants". You\'ll see that s2Member provides you with access to several PHP/API Constants, which will assist you in dripping content. Some of the most relevant API Constants include: <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</code>, <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>, <code>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</code>, <code>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</code>; and there are many others.</em></p>' . "\n";
420
  /**/
@@ -423,9 +423,9 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
423
  echo '<h3>Very Advanced Content Dripping ( some PHP required )</h3>' . "\n";
424
  echo '<p>If you plan on dripping content in VERY advanced ways, you can tap into s2Member\'s recorded history of all Paid Registration Times. ( i.e. <code>' . esc_html ('<?php $time = s2member_paid_registration_time("level1"); ?>') . '</code> ) will give you a timestamp at which a Member first paid for Level#1 access. If they\'ve never paid for Level#1 access, the function will return 0. s2Member keeps a recorded history of timestamps associated with each Level that a Member gains access to, throughout the lifetime of their account. * NOTE: This requires s2Member v3.3+. Previous versions of s2Member did NOT record this information. If you implement this functionality on an upgraded installation of s2Member, please remember that s2Member will have NO Paid Registration Time for any Member you acquired prior to installing s2Member v3.3+. <em>Check the forums for work-arounds.</em></p>' . "\n";
425
  echo '<p><strong>Here is the function documentation for PHP/WordPress® developers:</strong></p>' . "\n";
426
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2member-paid-registration-time.php")) . '</p>' . "\n";
427
  echo '<p><strong>Here are some actual examples that should give you some ideas:</strong></p>' . "\n";
428
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2member-paid-registration-time-examples.php")) . '</p>' . "\n";
429
  echo '</div>' . "\n";
430
  /**/
431
  echo '</div>' . "\n";
@@ -452,13 +452,13 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
452
  echo '<p><input type="text" value="' . format_to_edit ('[s2Member-Profile /]') . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
453
  /**/
454
  echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> ( standard link tag ):</p>' . "\n";
455
- echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-1-ops.php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
456
  /**/
457
  echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> ( open the link in a popup window ):</p>' . "\n";
458
- echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2-ops.php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
459
  /**/
460
  echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> ( embed the Form with an IFRAME tag ):</p>' . "\n";
461
- echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-3-ops.php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
462
  echo '</div>' . "\n";
463
  /**/
464
  echo '</div>' . "\n";
@@ -719,29 +719,29 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
719
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
720
  /**/
721
  echo '<p><strong>S2MEMBER_VERSION</strong><br />This will always be a (string) with the current s2Member version. Available since s2Member 3.0. Dated versions began with s2Member v110604.</p>' . "\n";
722
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/version.php")) . '</p>' . "\n";
723
  /**/
724
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
725
  /**/
726
  echo '<p><strong>S2MEMBER_CURRENT_USER_LOGIN_COUNTER</strong><br />This will always be (int) <code>-1</code> or higher <em>( representing the number of times a User/Member has logged into your site )</em>. <code>-1</code> if no User is logged in. <code>0</code> if the current User has NEVER logged in.</p>' . "\n";
727
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-login-counter.php")) . '</p>' . "\n";
728
  /**/
729
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
730
  /**/
731
  echo '<p><strong>S2MEMBER_CURRENT_USER_IS_LOGGED_IN</strong><br />This will always be (bool) true or false. True if a User/Member is currently logged in with an Access Level >= 0.</p>' . "\n";
732
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-is-logged-in.php")) . '</p>' . "\n";
733
  echo '<p><em>See: <code>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</code> below for a full explanation.</em></p>' . "\n";
734
  /**/
735
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
736
  /**/
737
  echo '<p><strong>S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER</strong><br />This will always be (bool) true or false. True if a Member is currently logged in with an Access Level >= 1.</p>' . "\n";
738
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-is-logged-in-as-member.php")) . '</p>' . "\n";
739
  echo '<p><em>See: <code>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</code> below for a full explanation.</em></p>' . "\n";
740
  /**/
741
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
742
  /**/
743
  echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</strong><br />This will always be (int) <code>-1</code> thru <code>4</code> <em>( or, up to the total number Membership Levels you\'ve configured )</em>. <code>-1</code> if not logged in. <code>0</code> if logged in as a Free Subscriber.</p>' . "\n";
744
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-access-level.php")) . '</p>' . "\n";
745
  echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
746
  echo '<p>* A Member with Level 4 access, will also be able to access Levels 0, 1, 2 &amp; 3.<br />* A Member with Level 3 access, will also be able to access Levels 0, 1 &amp; 2.<br />* A Member with Level 2 access, will also be able to access Levels 0 &amp; 1.<br />* A Member with Level 1 access, will also be able to access Level 0.<br />* A Subscriber with Level 0 access, will ONLY be able to access Level 0.<br />* A public Visitor will have NO access to protected content.</p>' . "\n";
747
  echo '<p><em>* WordPress® Subscribers are at Membership Level 0. If you\'re allowing Open Registration, Subscribers will be at Level 0 ( a Free Subscriber ). WordPress® Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
@@ -749,228 +749,228 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
749
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
750
  /**/
751
  echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LABEL</strong><br />This will always be a (string) containing the Membership Label associated with the current User\'s account. Empty if not logged in.</p>' . "\n";
752
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-access-label.php")) . '</p>' . "\n";
753
  /**/
754
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
755
  /**/
756
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be an empty string. Also empty if not logged in.</p>' . "\n";
757
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-id.php")) . '</p>' . "\n";
758
  /**/
759
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
760
  /**/
761
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be their WordPress® User ID#. Empty if not logged in.</p>' . "\n";
762
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-or-wp-id.php")) . '</p>' . "\n";
763
  /**/
764
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
765
  /**/
766
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. Gateway. If they\'ve NOT paid yet, this will be empty. Empty if not logged in.</p>' . "\n";
767
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-gateway.php")) . '</p>' . "\n";
768
  /**/
769
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
770
  /**/
771
  echo '<p><strong>S2MEMBER_CURRENT_USER_CUSTOM</strong><br />This will always be a (string) containing the current User\'s Custom String; associated with their s2Member Profile. Empty if not logged in.</p>' . "\n";
772
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-custom.php")) . '</p>' . "\n";
773
  /**/
774
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
775
  /**/
776
  echo '<p><strong>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</strong><br />This will always be an (int); in the form of a Unix timestamp. 0 if not logged in. This holds the recorded time at which the User originally registered their Username for access to your site; for free or otherwise. This is useful if you want to drip content over an extended period of time, based on how long someone has been registered (period); regardless of whether they are/were paying you. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
777
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-registration-time.php")) . '</p>' . "\n";
778
  /**/
779
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
780
  /**/
781
  echo '<p><strong>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</strong><br />This will always be an (int). 0 if not logged in. This is the number of days that have passed since the User originally registered their Username for access to your site; for free or otherwise. This is useful if you want to drip content over an extended period of time, based on how long someone has been registered (period); regardless of whether they are/were paying you. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
782
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-registration-days.php")) . '</p>' . "\n";
783
  /**/
784
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
785
  /**/
786
  echo '<p><strong>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</strong><br />This will always be an (int); in the form of a Unix timestamp. However, this will be 0 if they\'re not logged in; or if they\'ve never paid you at all <em>( i.e. if they\'re still a Free Subscriber )</em>. This holds the recorded time at which the Member originally registered their Username (or upgraded for) any type of "paid" access to your site. This value is preserved for the lifetime of their account, even if they upgrade, and even if they\'re demoted at some point. Once this value is recorded, it never changes under any circumstance. This is useful if you want to drip content over an extended period of time, based on how long someone has been a "paying" Member (period); regardless of their original or existing Membership Level. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
787
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-paid-registration-time.php")) . '</p>' . "\n";
788
  /**/
789
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
790
  /**/
791
  echo '<p><strong>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</strong><br />This will always be an (int); in the form of a Unix timestamp. However, this will be 0 if they\'re not logged in; or if they\'ve never paid you at all <em>( i.e. if they\'re still a Free Subscriber )</em>. This is the number of days that have passed since the Member originally registered their Username (or upgraded for) any type of "paid" access to your site. The underlying timestamp behind this value is preserved for the lifetime of their account, even if they upgrade, and even if they\'re demoted at some point. Once the underlying timestamp behind this value is recorded, it never changes under any circumstance. This is useful if you want to drip content over an extended period of time, based on how long someone has been a "paying" Member (period); regardless of their original or existing Membership Level. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
792
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-paid-registration-days.php")) . '</p>' . "\n";
793
  /**/
794
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
795
  /**/
796
  echo '<p><strong>S2MEMBER_CURRENT_USER_DISPLAY_NAME</strong><br />This will always be a (string) containing the current User\'s Display Name. Empty if not logged in.</p>' . "\n";
797
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-display-name.php")) . '</p>' . "\n";
798
  /**/
799
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
800
  /**/
801
  echo '<p><strong>S2MEMBER_CURRENT_USER_FIRST_NAME</strong><br />This will always be a (string) containing the current User\'s First Name. Empty if not logged in.</p>' . "\n";
802
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-first-name.php")) . '</p>' . "\n";
803
  /**/
804
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
805
  /**/
806
  echo '<p><strong>S2MEMBER_CURRENT_USER_LAST_NAME</strong><br />This will always be a (string) containing the current User\'s Last Name. Empty if not logged in.</p>' . "\n";
807
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-last-name.php")) . '</p>' . "\n";
808
  /**/
809
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
810
  /**/
811
  echo '<p><strong>S2MEMBER_CURRENT_USER_LOGIN</strong><br />This will always be a (string) containing the current User\'s Username. Empty if not logged in.</p>' . "\n";
812
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-login.php")) . '</p>' . "\n";
813
  /**/
814
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
815
  /**/
816
  echo '<p><strong>S2MEMBER_CURRENT_USER_EMAIL</strong><br />This will always be a (string) containing the current User\'s Email Address. Empty if not logged in.</p>' . "\n";
817
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-email.php")) . '</p>' . "\n";
818
  /**/
819
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
820
  /**/
821
  echo '<p><strong>S2MEMBER_CURRENT_USER_IP</strong><br />This will always be a (string) containing the current User\'s IP Address, even when/if NOT logged in. Taken from <code>$_SERVER["REMOTE_ADDR"]</code>. Empty if browsing anonymously.</p>' . "\n";
822
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-ip.php")) . '</p>' . "\n";
823
  /**/
824
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
825
  /**/
826
  echo '<p><strong>S2MEMBER_CURRENT_USER_REGISTRATION_IP</strong><br />This will always be a (string) containing the current User\'s original IP Address during registration. Taken from <code>$_SERVER["REMOTE_ADDR"]</code>. Empty if not logged in.</p>' . "\n";
827
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-registration-ip.php")) . '</p>' . "\n";
828
  /**/
829
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
830
  /**/
831
  echo '<p><strong>S2MEMBER_CURRENT_USER_ID</strong><br />This will always be an (int) containing the current User\'s ID# in WordPress®. However, it will be 0 if not logged in.</p>' . "\n";
832
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-id.php")) . '</p>' . "\n";
833
  /**/
834
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
835
  /**/
836
  echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, reg_ip, email, login, first_name, last_name, display_name, subscr_id, subscr_or_wp_id, subscr_gateway, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
837
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-fields.php")) . '</p>' . "\n";
838
  /**/
839
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
840
  /**/
841
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED</strong><br />This will always be an (int) value >= 0. This indicates how many unique files they\'re allowed to download. 0 means no access.</p>' . "\n";
842
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-allowed.php")) . '</p>' . "\n";
843
  /**/
844
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
845
  /**/
846
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED</strong><br />This will always be (bool) true or false. A value of true means their allowed downloads are >= 999999999, and false means it is not. This is useful if you are allowing unlimited ( 999999999 ) downloads on some Membership Levels. You can display `Unlimited` instead of a number.</p>' . "\n";
847
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-allowed-is-unlimited.php")) . '</p>' . "\n";
848
  /**/
849
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
850
  /**/
851
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY</strong><br />This will always be an (int) value >= 0. This indicates how many unique files they\'ve downloaded in the current period.</p>' . "\n";
852
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-currently.php")) . '</p>' . "\n";
853
  /**/
854
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
855
  /**/
856
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS</strong><br />This will always be an (int) value >= 0. This indicates how many total days make up the current period. 0 means no access.</p>' . "\n";
857
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-allowed-days.php")) . '</p>' . "\n";
858
  /**/
859
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
860
  /**/
861
  echo '<p><strong>S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL</strong><br />This is a Stand-Alone URL where a User can modify their Profile. In addition to this Stand-Alone version, s2Member also makes a Shortcode available which produces an Inline Profile Editing Form. Use <code>[s2Member-Profile /]</code> in any Post/Page, or even in a Text Widget if you like.</p>' . "\n";
862
  echo '<p><strong>Code Sample #1</strong> ( standard link ):</p>' . "\n";
863
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-1.php")) . '</p>' . "\n";
864
  echo '<p><strong>Code Sample #2</strong> ( open the link in a popup window ):</p>' . "\n";
865
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2.php")) . '</p>' . "\n";
866
  echo '<p><strong>Code Sample #3</strong> ( embed the form into a Post/Page using an IFRAME tag ):</p>' . "\n";
867
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-3.php")) . '</p>' . "\n";
868
  /**/
869
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
870
  /**/
871
  echo '<p><strong>S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL</strong><br />This is the full URL to the Limit Exceeded Page ( informational ).</p>' . "\n";
872
  echo '<p><strong>S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID</strong><br />This is the Page ID that was used to generate the full URL.</p>' . "\n";
873
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/file-download-limit-exceeded-page-url.php")) . '</p>' . "\n";
874
  /**/
875
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
876
  /**/
877
  echo '<p><strong>S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL</strong><br />This is the full URL to the Membership Options Page ( the signup page ).</p>' . "\n";
878
  echo '<p><strong>S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID</strong><br />This is the Page ID that was used to generate the full URL.</p>' . "\n";
879
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/membership-options-page-url.php")) . '</p>' . "\n";
880
  /**/
881
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
882
  /**/
883
  echo '<p><strong>S2MEMBER_LOGIN_WELCOME_PAGE_URL</strong><br />This is the full URL to the Login Welcome Page ( the User\'s account page ). * This could also be the full URL to a Special Redirection URL ( if you configured one ). See <code>s2Member -> General Options -> Login Welcome Page</code>.</p>' . "\n";
884
  echo '<p><strong>S2MEMBER_LOGIN_WELCOME_PAGE_ID</strong><br />This is the Page ID that was used to generate the full URL. * In the case of a Special Redirection URL, this ID is not really applicable.</p>' . "\n";
885
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/login-welcome-page-url.php")) . '</p>' . "\n";
886
  /**/
887
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
888
  /**/
889
  echo '<p><strong>S2MEMBER_LOGIN_PAGE_URL</strong><br />This is the full URL to the Membership Login Page ( the WordPress® login page ).</p>' . "\n";
890
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/login-page-url.php")) . '</p>' . "\n";
891
  /**/
892
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
893
  /**/
894
  echo '<p><strong>S2MEMBER_LOGOUT_PAGE_URL</strong><br />This is the full URL to the Membership Logout Page ( the WordPress® logout page ).</p>' . "\n";
895
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/logout-page-url.php")) . '</p>' . "\n";
896
  /**/
897
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
898
  /**/
899
  echo '<p><strong>S2MEMBER_LEVELn_LABEL</strong><br />This is the (string) Label that you created for a particular Membership Level #. Replace <code>n</code> with a numeric Membership Level #..</p>' . "\n";
900
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/leveln-label.php")) . '</p>' . "\n";
901
  /**/
902
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
903
  /**/
904
  echo '<p><strong>S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED</strong><br />This is the (int) allowed downloads for a particular Membership Level #. Replace <code>n</code> with a numeric Membership Level #.</p>' . "\n";
905
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/leveln-file-downloads-allowed.php")) . '</p>' . "\n";
906
  /**/
907
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
908
  /**/
909
  echo '<p><strong>S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS</strong><br />This is the (int) allowed download days for a particular Membership Level #. Replace <code>n</code> with a numeric Membership Level #.</p>' . "\n";
910
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/leveln-file-downloads-allowed-days.php")) . '</p>' . "\n";
911
  /**/
912
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
913
  /**/
914
  echo '<p><strong>S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS</strong><br />This is the (string) list of extensions to display inline.</p>' . "\n";
915
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/file-download-inline-extensions.php")) . '</p>' . "\n";
916
  /**/
917
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
918
  /**/
919
  echo '<p><strong>S2MEMBER_REG_EMAIL_FROM_NAME</strong><br />This is the Name that outgoing email messages are sent by.</p>' . "\n";
920
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/reg-email-from-name.php")) . '</p>' . "\n";
921
  /**/
922
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
923
  /**/
924
  echo '<p><strong>S2MEMBER_REG_EMAIL_FROM_EMAIL</strong><br />This is the Email Address that outgoing messages are sent by.</p>' . "\n";
925
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/reg-email-from-email.php")) . '</p>' . "\n";
926
  /**/
927
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
928
  /**/
929
  echo '<p><strong>S2MEMBER_PAYPAL_NOTIFY_URL</strong><br />This is the URL on your system that receives PayPal® IPN responses.</p>' . "\n";
930
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-notify-url.php")) . '</p>' . "\n";
931
  /**/
932
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
933
  /**/
934
  echo '<p><strong>S2MEMBER_PAYPAL_RETURN_URL</strong><br />This is the URL on your system that receives PayPal® return variables.</p>' . "\n";
935
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-return-url.php")) . '</p>' . "\n";
936
  /**/
937
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
938
  /**/
939
  echo '<p><strong>S2MEMBER_PAYPAL_ENDPOINT</strong><br />This is the Endpoint Domain to the PayPal® server <em>( changes when Sandbox Mode is enabled )</em>.</p>' . "\n";
940
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-endpoint.php")) . '</p>' . "\n";
941
  /**/
942
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
943
  /**/
944
  echo '<p><strong>S2MEMBER_PAYPAL_API_ENDPOINT</strong><br />This is the Endpoint Domain to the PayPal® API server <em>( changes when Sandbox Mode is enabled )</em>.</p>' . "\n";
945
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-endpoint.php")) . '</p>' . "\n";
946
  /**/
947
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
948
  /**/
949
  echo '<p><strong>S2MEMBER_PAYPAL_BUSINESS</strong><br />This is the Email Address that identifies your PayPal® Business.</p>' . "\n";
950
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-business.php")) . '</p>' . "\n";
951
  /**/
952
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
953
  /**/
954
  echo '<p><strong>S2MEMBER_PAYPAL_API_USERNAME</strong><br />This is the API Username associated with your PayPal® Business.</p>' . "\n";
955
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-username.php")) . '</p>' . "\n";
956
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
957
  /**/
958
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
959
  /**/
960
  echo '<p><strong>S2MEMBER_PAYPAL_API_PASSWORD</strong><br />This is the API Password associated with your PayPal® Business.</p>' . "\n";
961
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-password.php")) . '</p>' . "\n";
962
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
963
  /**/
964
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
965
  /**/
966
  echo '<p><strong>S2MEMBER_PAYPAL_API_SIGNATURE</strong><br />This is the API Signature associated with your PayPal® Business.</p>' . "\n";
967
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-signature.php")) . '</p>' . "\n";
968
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
969
  /**/
970
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
971
  /**/
972
  echo '<p><strong>S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN</strong><br />This is the PDT Identity Token associated with your PayPal® Business.</p>' . "\n";
973
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-pdt-identity-token.php")) . '</p>' . "\n";
974
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
975
  /**/
976
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
@@ -985,7 +985,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
985
  /**/
986
  echo '<p><em>These four Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. Specifically, these three Button Code parameters: <code>on0, os0, modify</code>, work together in harmony. If you\'re using the Shortcode Format for PayPal® Buttons, you won\'t even see these, because they\'re added internally by the Shortcode processor. Anyway, they\'re just documented here for clarity; you probably won\'t use these directly; the Button Generator pops them in.</em></p>' . "\n";
987
  /**/
988
- echo '<p><em>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-value-for-pp-on0-os0-on1-os1.php")) . '</em></p>' . "\n";
989
  /**/
990
  echo '</div>' . "\n";
991
  /**/
@@ -1031,7 +1031,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_scripting"))
1031
  /**/
1032
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
1033
  /**/
1034
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/api-mop-vars.php")) . '</p>' . "\n";
1035
  echo '</div>' . "\n";
1036
  /**/
1037
  echo '</div>' . "\n";
75
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
76
  /**/
77
  echo '<p><strong>Example #1:</strong> Full access for anyone that is logged in.</strong></p>' . "\n";
78
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-is-user-logged-in-farm.x-php")) . '</p>' . "\n";
79
  /**/
80
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
81
  /**/
82
  echo '<p><strong>Example #2:</strong> Full access for any Member with a Level >= 1.</strong></p>' . "\n";
83
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-can-full-access-farm.x-php")) . '</p>' . "\n";
84
  /**/
85
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
86
  /**/
87
  echo '<p><strong>Example #3:</strong> Specific content for each different Member Level.</strong></p>' . "\n";
88
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-is-specific-content-farm.x-php")) . '</p>' . "\n";
89
  /**/
90
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
91
  /**/
92
  echo '<p><strong>Example #4:</strong> Simple Conditionals w/ integrated use of [s2Get /].</strong></p>' . "\n";
93
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-1-farm.x-php")) . '</p>' . "\n";
94
  /**/
95
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
96
  /**/
97
  echo '<p><strong>Example #5:</strong> Using multiple Conditionals together, and even nesting other Shortcodes.</strong></p>' . "\n";
98
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-2-farm.x-php")) . '</p>' . "\n";
99
  /**/
100
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
101
  /**/
102
  echo '<p><strong>Example #6:</strong> Using multiple Conditionals together, and even nesting Conditionals.</strong></p>' . "\n";
103
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-3-farm.x-php")) . '</p>' . "\n";
104
  /**/
105
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
106
  /**/
119
  echo '<p><em><strong>Implementing AND/OR Conditional expressions:</strong></em></p>' . "\n";
120
  echo '<p><em>*Tip: do NOT mix AND/OR expressions.<br /> <strong class="ws-menu-page-error-hilite">BAD</strong> <code>is_user_logged_in() AND is_page(1) OR is_page(2)</code><br />- use one or the other; do NOT mix AND/OR together.</em></p>' . "\n";
121
  echo '<p><em><strong class="ws-menu-page-hilite">If you need to have both types of logic, use nesting:</strong></em></p>' . "\n";
122
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-nesting.x-php")) . '</p>' . "\n";
123
  echo '</div>' . "\n";
124
  /**/
125
  echo '</div>' . "\n";
142
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
143
  /**/
144
  echo '<p><strong>Example #1:</strong> Full access for anyone that is logged in.</strong></p>' . "\n";
145
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-is-user-logged-in.x-php")) . '</p>' . "\n";
146
  /**/
147
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
148
  /**/
149
  echo '<p><strong>Example #2:</strong> Full access for any Member with a Level >= 1.</strong></p>' . "\n";
150
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-can-full-access.x-php")) . '</p>' . "\n";
151
  /**/
152
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
153
  /**/
154
  echo '<p><strong>Example #3:</strong> Specific content for each different Member Level.</strong></p>' . "\n";
155
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-current-user-is-specific-content.x-php")) . '</p>' . "\n";
156
  /**/
157
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
158
  /**/
159
  echo '<p><strong>Example #4:</strong> Simple Conditionals w/ integrated use of [s2Get /].</strong></p>' . "\n";
160
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-1.x-php")) . '</p>' . "\n";
161
  /**/
162
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
163
  /**/
164
  echo '<p><strong>Example #5:</strong> Using multiple Conditionals together, and even nesting other Shortcodes.</strong></p>' . "\n";
165
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-2.x-php")) . '</p>' . "\n";
166
  /**/
167
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
168
  /**/
169
  echo '<p><strong>Example #6:</strong> Using multiple Conditionals together, and even nesting Conditionals.</strong></p>' . "\n";
170
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-supplements-3.x-php")) . '</p>' . "\n";
171
  /**/
172
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
173
  /**/
186
  echo '<p><em><strong>Implementing AND/OR Conditional expressions:</strong></em></p>' . "\n";
187
  echo '<p><em>*Tip: do NOT mix AND/OR expressions.<br /> <strong class="ws-menu-page-error-hilite">BAD</strong> <code>is_user_logged_in() AND is_page(1) OR is_page(2)</code><br />- use one or the other; do NOT mix AND/OR together.</em></p>' . "\n";
188
  echo '<p><em><strong class="ws-menu-page-hilite">If you need to have both types of logic, use nesting:</strong></em></p>' . "\n";
189
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sc-s2-conditional-nesting.x-php")) . '</p>' . "\n";
190
  echo '</div>' . "\n";
191
  /**/
192
  echo '</div>' . "\n";
214
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
215
  /**/
216
  echo '<p><strong>Example #1:</strong> Full access for anyone that is logged in.</strong></p>' . "\n";
217
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/is-user-logged-in.x-php")) . '</p>' . "\n";
218
  /**/
219
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
220
  /**/
221
  echo '<p><strong>Example #2:</strong> Full access for any Member with a Level >= 1.</strong></p>' . "\n";
222
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-full-access.x-php")) . '</p>' . "\n";
223
  /**/
224
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
225
  /**/
226
  echo '<p><strong>Example #3:</strong> Specific content for each different Member Level.</strong></p>' . "\n";
227
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-is-specific-content.x-php")) . '</p>' . "\n";
228
  /**/
229
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
230
  /**/
231
  echo '<p><strong>Example #4:</strong> Using s2Member API Conditionals, supplementing WordPress® core functions.</strong></p>' . "\n";
232
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2-conditional-supplements-1.x-php")) . '</p>' . "\n";
233
  /**/
234
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
235
  /**/
236
  echo '<p><strong>Example #5:</strong> Using s2Member API Conditionals, supplementing WordPress® core functions.</strong></p>' . "\n";
237
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2-conditional-supplements-2.x-php")) . '</p>' . "\n";
238
  /**/
239
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
240
  /**/
241
  echo '<p><strong>Example #6:</strong> Using multiple Conditionals together, and even nesting Conditionals.</strong></p>' . "\n";
242
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2-conditional-supplements-3.x-php")) . '</p>' . "\n";
243
  /**/
244
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
245
  /**/
246
  echo '<p><strong>Example #7:</strong> Using s2Member API Constants, instead of conditional functions.</strong></p>' . "\n";
247
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-constants-1.x-php")) . '</p>' . "\n";
248
  /**/
249
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
250
  /**/
251
  echo '<p><strong>Example #8:</strong> Using s2Member API Constants, instead of conditional functions.</strong></p>' . "\n";
252
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-constants-2.x-php")) . '</p>' . "\n";
253
  /**/
254
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
255
  /**/
283
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
284
  /**/
285
  echo '<p><strong>Example #1:</strong> Pre-filtering custom queries in WordPress®.</strong></p>' . "\n";
286
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/custom-queries.x-php")) . '</p>' . "\n";
287
  /**/
288
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
289
  /**/
290
  echo '<p><strong>Example #2:</strong> OR, instead of pre-filtering; check Access Restrictions in The Loop.</strong></p>' . "\n";
291
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/custom-queries-loop.x-php")) . '</p>' . "\n";
292
  /**/
293
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
294
  /**/
295
  echo '<p><strong>Example #3:</strong> Checking Tag Restrictions.</strong></p>' . "\n";
296
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-tag-restrictions.x-php")) . '</p>' . "\n";
297
  /**/
298
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
299
  /**/
300
  echo '<p><strong>Example #4:</strong> Checking Category Restrictions.</strong></p>' . "\n";
301
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-category-restrictions.x-php")) . '</p>' . "\n";
302
  /**/
303
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
304
  /**/
305
  echo '<p><strong>Example #5:</strong> Checking Page Restrictions.</strong></p>' . "\n";
306
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-page-restrictions.x-php")) . '</p>' . "\n";
307
  /**/
308
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
309
  /**/
310
  echo '<p><strong>Example #6:</strong> Checking Post Restrictions, including Custom Post Types.</strong></p>' . "\n";
311
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/specific-post-restrictions.x-php")) . '</p>' . "\n";
312
  echo '</div>' . "\n";
313
  /**/
314
  echo '</div>' . "\n";
343
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
344
  /**/
345
  echo '<p><strong>Custom Capabilities:</strong> ( music,videos ):</p>' . "\n";
346
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-ccaps-1.x-php")) . '</p>' . "\n";
347
  /**/
348
  echo '<p><strong>Custom Capabilities:</strong> ( ebooks,reports,tips ):</p>' . "\n";
349
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-ccaps-2.x-php")) . '</p>' . "\n";
350
  echo '</div>' . "\n";
351
  /**/
352
  echo '</div>' . "\n";
377
  echo '<p>Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos</code></p>' . "\n";
378
  echo '<p>Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music/file.mp3</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos/file.avi</code></p>' . "\n";
379
  echo '<p>Now, here are some link examples, using Custom Capability Sub-directories:</p>' . "\n";
380
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/ccap-file-downloads.x-php")) . '</p>' . "\n";
381
  echo '<p><em>These links will ONLY work for Members who are logged-in, with the proper Capabilities.</em></p>' . "\n";
382
  /**/
383
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
386
  echo '<p>Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3</code><br />Sub-Directory: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4</code></p>' . "\n";
387
  echo '<p>Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0/tiger.doc</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1/zebra.pdf</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2/elephant.doc</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3/rhino.pdf</code><br />Protected File: <code>/' . esc_html (c_ws_plugin__s2member_utils_dirs::basename_dir_app_data ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4/lion.doc</code></p>' . "\n";
388
  echo '<p>Now, here are some link examples, using Member Level Sub-directories:</p>' . "\n";
389
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/level-file-downloads.x-php")) . '</p>' . "\n";
390
  echo '<p><em>These links will ONLY work for Members who are logged-in, with an adequate Membership Level.</em></p>' . "\n";
391
  echo '</div>' . "\n";
392
  /**/
414
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
415
  /**/
416
  echo '<p><strong>To drip content using <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>:</strong></p>' . "\n";
417
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-paid-registration-days-dripping.x-php")) . '</p>' . "\n";
418
  /**/
419
  echo '<p><em>There are more examples on this page, under the sub-section "s2Member PHP/API Constants". You\'ll see that s2Member provides you with access to several PHP/API Constants, which will assist you in dripping content. Some of the most relevant API Constants include: <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</code>, <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>, <code>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</code>, <code>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</code>; and there are many others.</em></p>' . "\n";
420
  /**/
423
  echo '<h3>Very Advanced Content Dripping ( some PHP required )</h3>' . "\n";
424
  echo '<p>If you plan on dripping content in VERY advanced ways, you can tap into s2Member\'s recorded history of all Paid Registration Times. ( i.e. <code>' . esc_html ('<?php $time = s2member_paid_registration_time("level1"); ?>') . '</code> ) will give you a timestamp at which a Member first paid for Level#1 access. If they\'ve never paid for Level#1 access, the function will return 0. s2Member keeps a recorded history of timestamps associated with each Level that a Member gains access to, throughout the lifetime of their account. * NOTE: This requires s2Member v3.3+. Previous versions of s2Member did NOT record this information. If you implement this functionality on an upgraded installation of s2Member, please remember that s2Member will have NO Paid Registration Time for any Member you acquired prior to installing s2Member v3.3+. <em>Check the forums for work-arounds.</em></p>' . "\n";
425
  echo '<p><strong>Here is the function documentation for PHP/WordPress® developers:</strong></p>' . "\n";
426
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2member-paid-registration-time.x-php")) . '</p>' . "\n";
427
  echo '<p><strong>Here are some actual examples that should give you some ideas:</strong></p>' . "\n";
428
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/s2member-paid-registration-time-examples.x-php")) . '</p>' . "\n";
429
  echo '</div>' . "\n";
430
  /**/
431
  echo '</div>' . "\n";
452
  echo '<p><input type="text" value="' . format_to_edit ('[s2Member-Profile /]') . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
453
  /**/
454
  echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> ( standard link tag ):</p>' . "\n";
455
+ echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-1-ops.x-php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
456
  /**/
457
  echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> ( open the link in a popup window ):</p>' . "\n";
458
+ echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2-ops.x-php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
459
  /**/
460
  echo '<p style="margin-top:20px;"><strong>Stand-Alone / Code Sample</strong> ( embed the Form with an IFRAME tag ):</p>' . "\n";
461
+ echo '<p><input type="text" value="' . format_to_edit (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", c_ws_plugin__s2member_utils_strings::esc_ds (site_url ("/?s2member_profile=1")), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-3-ops.x-php"))) . '" style="font-size:90%; font-family:Consolas, monospace; width:99%;" onclick="this.select ();" /></p>' . "\n";
462
  echo '</div>' . "\n";
463
  /**/
464
  echo '</div>' . "\n";
719
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
720
  /**/
721
  echo '<p><strong>S2MEMBER_VERSION</strong><br />This will always be a (string) with the current s2Member version. Available since s2Member 3.0. Dated versions began with s2Member v110604.</p>' . "\n";
722
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/version.x-php")) . '</p>' . "\n";
723
  /**/
724
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
725
  /**/
726
  echo '<p><strong>S2MEMBER_CURRENT_USER_LOGIN_COUNTER</strong><br />This will always be (int) <code>-1</code> or higher <em>( representing the number of times a User/Member has logged into your site )</em>. <code>-1</code> if no User is logged in. <code>0</code> if the current User has NEVER logged in.</p>' . "\n";
727
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-login-counter.x-php")) . '</p>' . "\n";
728
  /**/
729
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
730
  /**/
731
  echo '<p><strong>S2MEMBER_CURRENT_USER_IS_LOGGED_IN</strong><br />This will always be (bool) true or false. True if a User/Member is currently logged in with an Access Level >= 0.</p>' . "\n";
732
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-is-logged-in.x-php")) . '</p>' . "\n";
733
  echo '<p><em>See: <code>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</code> below for a full explanation.</em></p>' . "\n";
734
  /**/
735
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
736
  /**/
737
  echo '<p><strong>S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER</strong><br />This will always be (bool) true or false. True if a Member is currently logged in with an Access Level >= 1.</p>' . "\n";
738
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-is-logged-in-as-member.x-php")) . '</p>' . "\n";
739
  echo '<p><em>See: <code>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</code> below for a full explanation.</em></p>' . "\n";
740
  /**/
741
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
742
  /**/
743
  echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</strong><br />This will always be (int) <code>-1</code> thru <code>4</code> <em>( or, up to the total number Membership Levels you\'ve configured )</em>. <code>-1</code> if not logged in. <code>0</code> if logged in as a Free Subscriber.</p>' . "\n";
744
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-access-level.x-php")) . '</p>' . "\n";
745
  echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
746
  echo '<p>* A Member with Level 4 access, will also be able to access Levels 0, 1, 2 &amp; 3.<br />* A Member with Level 3 access, will also be able to access Levels 0, 1 &amp; 2.<br />* A Member with Level 2 access, will also be able to access Levels 0 &amp; 1.<br />* A Member with Level 1 access, will also be able to access Level 0.<br />* A Subscriber with Level 0 access, will ONLY be able to access Level 0.<br />* A public Visitor will have NO access to protected content.</p>' . "\n";
747
  echo '<p><em>* WordPress® Subscribers are at Membership Level 0. If you\'re allowing Open Registration, Subscribers will be at Level 0 ( a Free Subscriber ). WordPress® Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
749
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
750
  /**/
751
  echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LABEL</strong><br />This will always be a (string) containing the Membership Label associated with the current User\'s account. Empty if not logged in.</p>' . "\n";
752
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-access-label.x-php")) . '</p>' . "\n";
753
  /**/
754
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
755
  /**/
756
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be an empty string. Also empty if not logged in.</p>' . "\n";
757
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-id.x-php")) . '</p>' . "\n";
758
  /**/
759
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
760
  /**/
761
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be their WordPress® User ID#. Empty if not logged in.</p>' . "\n";
762
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-or-wp-id.x-php")) . '</p>' . "\n";
763
  /**/
764
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
765
  /**/
766
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. Gateway. If they\'ve NOT paid yet, this will be empty. Empty if not logged in.</p>' . "\n";
767
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-gateway.x-php")) . '</p>' . "\n";
768
  /**/
769
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
770
  /**/
771
  echo '<p><strong>S2MEMBER_CURRENT_USER_CUSTOM</strong><br />This will always be a (string) containing the current User\'s Custom String; associated with their s2Member Profile. Empty if not logged in.</p>' . "\n";
772
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-custom.x-php")) . '</p>' . "\n";
773
  /**/
774
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
775
  /**/
776
  echo '<p><strong>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</strong><br />This will always be an (int); in the form of a Unix timestamp. 0 if not logged in. This holds the recorded time at which the User originally registered their Username for access to your site; for free or otherwise. This is useful if you want to drip content over an extended period of time, based on how long someone has been registered (period); regardless of whether they are/were paying you. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
777
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-registration-time.x-php")) . '</p>' . "\n";
778
  /**/
779
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
780
  /**/
781
  echo '<p><strong>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</strong><br />This will always be an (int). 0 if not logged in. This is the number of days that have passed since the User originally registered their Username for access to your site; for free or otherwise. This is useful if you want to drip content over an extended period of time, based on how long someone has been registered (period); regardless of whether they are/were paying you. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
782
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-registration-days.x-php")) . '</p>' . "\n";
783
  /**/
784
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
785
  /**/
786
  echo '<p><strong>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME</strong><br />This will always be an (int); in the form of a Unix timestamp. However, this will be 0 if they\'re not logged in; or if they\'ve never paid you at all <em>( i.e. if they\'re still a Free Subscriber )</em>. This holds the recorded time at which the Member originally registered their Username (or upgraded for) any type of "paid" access to your site. This value is preserved for the lifetime of their account, even if they upgrade, and even if they\'re demoted at some point. Once this value is recorded, it never changes under any circumstance. This is useful if you want to drip content over an extended period of time, based on how long someone has been a "paying" Member (period); regardless of their original or existing Membership Level. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_REGISTRATION_TIME</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
787
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-paid-registration-time.x-php")) . '</p>' . "\n";
788
  /**/
789
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
790
  /**/
791
  echo '<p><strong>S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS</strong><br />This will always be an (int); in the form of a Unix timestamp. However, this will be 0 if they\'re not logged in; or if they\'ve never paid you at all <em>( i.e. if they\'re still a Free Subscriber )</em>. This is the number of days that have passed since the Member originally registered their Username (or upgraded for) any type of "paid" access to your site. The underlying timestamp behind this value is preserved for the lifetime of their account, even if they upgrade, and even if they\'re demoted at some point. Once the underlying timestamp behind this value is recorded, it never changes under any circumstance. This is useful if you want to drip content over an extended period of time, based on how long someone has been a "paying" Member (period); regardless of their original or existing Membership Level. <strong>* Note:</strong> this is NOT the same as <code>S2MEMBER_CURRENT_USER_REGISTRATION_DAYS</code>, which could be used as an alternative, depending on your intended usage.</p>' . "\n";
792
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-paid-registration-days.x-php")) . '</p>' . "\n";
793
  /**/
794
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
795
  /**/
796
  echo '<p><strong>S2MEMBER_CURRENT_USER_DISPLAY_NAME</strong><br />This will always be a (string) containing the current User\'s Display Name. Empty if not logged in.</p>' . "\n";
797
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-display-name.x-php")) . '</p>' . "\n";
798
  /**/
799
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
800
  /**/
801
  echo '<p><strong>S2MEMBER_CURRENT_USER_FIRST_NAME</strong><br />This will always be a (string) containing the current User\'s First Name. Empty if not logged in.</p>' . "\n";
802
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-first-name.x-php")) . '</p>' . "\n";
803
  /**/
804
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
805
  /**/
806
  echo '<p><strong>S2MEMBER_CURRENT_USER_LAST_NAME</strong><br />This will always be a (string) containing the current User\'s Last Name. Empty if not logged in.</p>' . "\n";
807
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-last-name.x-php")) . '</p>' . "\n";
808
  /**/
809
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
810
  /**/
811
  echo '<p><strong>S2MEMBER_CURRENT_USER_LOGIN</strong><br />This will always be a (string) containing the current User\'s Username. Empty if not logged in.</p>' . "\n";
812
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-login.x-php")) . '</p>' . "\n";
813
  /**/
814
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
815
  /**/
816
  echo '<p><strong>S2MEMBER_CURRENT_USER_EMAIL</strong><br />This will always be a (string) containing the current User\'s Email Address. Empty if not logged in.</p>' . "\n";
817
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-email.x-php")) . '</p>' . "\n";
818
  /**/
819
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
820
  /**/
821
  echo '<p><strong>S2MEMBER_CURRENT_USER_IP</strong><br />This will always be a (string) containing the current User\'s IP Address, even when/if NOT logged in. Taken from <code>$_SERVER["REMOTE_ADDR"]</code>. Empty if browsing anonymously.</p>' . "\n";
822
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-ip.x-php")) . '</p>' . "\n";
823
  /**/
824
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
825
  /**/
826
  echo '<p><strong>S2MEMBER_CURRENT_USER_REGISTRATION_IP</strong><br />This will always be a (string) containing the current User\'s original IP Address during registration. Taken from <code>$_SERVER["REMOTE_ADDR"]</code>. Empty if not logged in.</p>' . "\n";
827
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-registration-ip.x-php")) . '</p>' . "\n";
828
  /**/
829
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
830
  /**/
831
  echo '<p><strong>S2MEMBER_CURRENT_USER_ID</strong><br />This will always be an (int) containing the current User\'s ID# in WordPress®. However, it will be 0 if not logged in.</p>' . "\n";
832
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-id.x-php")) . '</p>' . "\n";
833
  /**/
834
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
835
  /**/
836
  echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, reg_ip, email, login, first_name, last_name, display_name, subscr_id, subscr_or_wp_id, subscr_gateway, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
837
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-fields.x-php")) . '</p>' . "\n";
838
  /**/
839
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
840
  /**/
841
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED</strong><br />This will always be an (int) value >= 0. This indicates how many unique files they\'re allowed to download. 0 means no access.</p>' . "\n";
842
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-allowed.x-php")) . '</p>' . "\n";
843
  /**/
844
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
845
  /**/
846
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED</strong><br />This will always be (bool) true or false. A value of true means their allowed downloads are >= 999999999, and false means it is not. This is useful if you are allowing unlimited ( 999999999 ) downloads on some Membership Levels. You can display `Unlimited` instead of a number.</p>' . "\n";
847
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-allowed-is-unlimited.x-php")) . '</p>' . "\n";
848
  /**/
849
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
850
  /**/
851
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY</strong><br />This will always be an (int) value >= 0. This indicates how many unique files they\'ve downloaded in the current period.</p>' . "\n";
852
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-currently.x-php")) . '</p>' . "\n";
853
  /**/
854
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
855
  /**/
856
  echo '<p><strong>S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS</strong><br />This will always be an (int) value >= 0. This indicates how many total days make up the current period. 0 means no access.</p>' . "\n";
857
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-downloads-allowed-days.x-php")) . '</p>' . "\n";
858
  /**/
859
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
860
  /**/
861
  echo '<p><strong>S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL</strong><br />This is a Stand-Alone URL where a User can modify their Profile. In addition to this Stand-Alone version, s2Member also makes a Shortcode available which produces an Inline Profile Editing Form. Use <code>[s2Member-Profile /]</code> in any Post/Page, or even in a Text Widget if you like.</p>' . "\n";
862
  echo '<p><strong>Code Sample #1</strong> ( standard link ):</p>' . "\n";
863
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-1.x-php")) . '</p>' . "\n";
864
  echo '<p><strong>Code Sample #2</strong> ( open the link in a popup window ):</p>' . "\n";
865
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2.x-php")) . '</p>' . "\n";
866
  echo '<p><strong>Code Sample #3</strong> ( embed the form into a Post/Page using an IFRAME tag ):</p>' . "\n";
867
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-3.x-php")) . '</p>' . "\n";
868
  /**/
869
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
870
  /**/
871
  echo '<p><strong>S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL</strong><br />This is the full URL to the Limit Exceeded Page ( informational ).</p>' . "\n";
872
  echo '<p><strong>S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID</strong><br />This is the Page ID that was used to generate the full URL.</p>' . "\n";
873
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/file-download-limit-exceeded-page-url.x-php")) . '</p>' . "\n";
874
  /**/
875
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
876
  /**/
877
  echo '<p><strong>S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL</strong><br />This is the full URL to the Membership Options Page ( the signup page ).</p>' . "\n";
878
  echo '<p><strong>S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID</strong><br />This is the Page ID that was used to generate the full URL.</p>' . "\n";
879
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/membership-options-page-url.x-php")) . '</p>' . "\n";
880
  /**/
881
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
882
  /**/
883
  echo '<p><strong>S2MEMBER_LOGIN_WELCOME_PAGE_URL</strong><br />This is the full URL to the Login Welcome Page ( the User\'s account page ). * This could also be the full URL to a Special Redirection URL ( if you configured one ). See <code>s2Member -> General Options -> Login Welcome Page</code>.</p>' . "\n";
884
  echo '<p><strong>S2MEMBER_LOGIN_WELCOME_PAGE_ID</strong><br />This is the Page ID that was used to generate the full URL. * In the case of a Special Redirection URL, this ID is not really applicable.</p>' . "\n";
885
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/login-welcome-page-url.x-php")) . '</p>' . "\n";
886
  /**/
887
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
888
  /**/
889
  echo '<p><strong>S2MEMBER_LOGIN_PAGE_URL</strong><br />This is the full URL to the Membership Login Page ( the WordPress® login page ).</p>' . "\n";
890
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/login-page-url.x-php")) . '</p>' . "\n";
891
  /**/
892
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
893
  /**/
894
  echo '<p><strong>S2MEMBER_LOGOUT_PAGE_URL</strong><br />This is the full URL to the Membership Logout Page ( the WordPress® logout page ).</p>' . "\n";
895
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/logout-page-url.x-php")) . '</p>' . "\n";
896
  /**/
897
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
898
  /**/
899
  echo '<p><strong>S2MEMBER_LEVELn_LABEL</strong><br />This is the (string) Label that you created for a particular Membership Level #. Replace <code>n</code> with a numeric Membership Level #..</p>' . "\n";
900
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/leveln-label.x-php")) . '</p>' . "\n";
901
  /**/
902
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
903
  /**/
904
  echo '<p><strong>S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED</strong><br />This is the (int) allowed downloads for a particular Membership Level #. Replace <code>n</code> with a numeric Membership Level #.</p>' . "\n";
905
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/leveln-file-downloads-allowed.x-php")) . '</p>' . "\n";
906
  /**/
907
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
908
  /**/
909
  echo '<p><strong>S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS</strong><br />This is the (int) allowed download days for a particular Membership Level #. Replace <code>n</code> with a numeric Membership Level #.</p>' . "\n";
910
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/leveln-file-downloads-allowed-days.x-php")) . '</p>' . "\n";
911
  /**/
912
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
913
  /**/
914
  echo '<p><strong>S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS</strong><br />This is the (string) list of extensions to display inline.</p>' . "\n";
915
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/file-download-inline-extensions.x-php")) . '</p>' . "\n";
916
  /**/
917
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
918
  /**/
919
  echo '<p><strong>S2MEMBER_REG_EMAIL_FROM_NAME</strong><br />This is the Name that outgoing email messages are sent by.</p>' . "\n";
920
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/reg-email-from-name.x-php")) . '</p>' . "\n";
921
  /**/
922
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
923
  /**/
924
  echo '<p><strong>S2MEMBER_REG_EMAIL_FROM_EMAIL</strong><br />This is the Email Address that outgoing messages are sent by.</p>' . "\n";
925
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/reg-email-from-email.x-php")) . '</p>' . "\n";
926
  /**/
927
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
928
  /**/
929
  echo '<p><strong>S2MEMBER_PAYPAL_NOTIFY_URL</strong><br />This is the URL on your system that receives PayPal® IPN responses.</p>' . "\n";
930
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-notify-url.x-php")) . '</p>' . "\n";
931
  /**/
932
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
933
  /**/
934
  echo '<p><strong>S2MEMBER_PAYPAL_RETURN_URL</strong><br />This is the URL on your system that receives PayPal® return variables.</p>' . "\n";
935
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-return-url.x-php")) . '</p>' . "\n";
936
  /**/
937
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
938
  /**/
939
  echo '<p><strong>S2MEMBER_PAYPAL_ENDPOINT</strong><br />This is the Endpoint Domain to the PayPal® server <em>( changes when Sandbox Mode is enabled )</em>.</p>' . "\n";
940
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-endpoint.x-php")) . '</p>' . "\n";
941
  /**/
942
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
943
  /**/
944
  echo '<p><strong>S2MEMBER_PAYPAL_API_ENDPOINT</strong><br />This is the Endpoint Domain to the PayPal® API server <em>( changes when Sandbox Mode is enabled )</em>.</p>' . "\n";
945
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-endpoint.x-php")) . '</p>' . "\n";
946
  /**/
947
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
948
  /**/
949
  echo '<p><strong>S2MEMBER_PAYPAL_BUSINESS</strong><br />This is the Email Address that identifies your PayPal® Business.</p>' . "\n";
950
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-business.x-php")) . '</p>' . "\n";
951
  /**/
952
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
953
  /**/
954
  echo '<p><strong>S2MEMBER_PAYPAL_API_USERNAME</strong><br />This is the API Username associated with your PayPal® Business.</p>' . "\n";
955
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-username.x-php")) . '</p>' . "\n";
956
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
957
  /**/
958
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
959
  /**/
960
  echo '<p><strong>S2MEMBER_PAYPAL_API_PASSWORD</strong><br />This is the API Password associated with your PayPal® Business.</p>' . "\n";
961
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-password.x-php")) . '</p>' . "\n";
962
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
963
  /**/
964
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
965
  /**/
966
  echo '<p><strong>S2MEMBER_PAYPAL_API_SIGNATURE</strong><br />This is the API Signature associated with your PayPal® Business.</p>' . "\n";
967
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-api-signature.x-php")) . '</p>' . "\n";
968
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
969
  /**/
970
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
971
  /**/
972
  echo '<p><strong>S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN</strong><br />This is the PDT Identity Token associated with your PayPal® Business.</p>' . "\n";
973
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/paypal-pdt-identity-token.x-php")) . '</p>' . "\n";
974
  echo '<p><em>* For security purposes, this is NOT included in the JS/API (JavaSript API).</em></p>' . "\n";
975
  /**/
976
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
985
  /**/
986
  echo '<p><em>These four Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. Specifically, these three Button Code parameters: <code>on0, os0, modify</code>, work together in harmony. If you\'re using the Shortcode Format for PayPal® Buttons, you won\'t even see these, because they\'re added internally by the Shortcode processor. Anyway, they\'re just documented here for clarity; you probably won\'t use these directly; the Button Generator pops them in.</em></p>' . "\n";
987
  /**/
988
+ echo '<p><em>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-value-for-pp-on0-os0-on1-os1.x-php")) . '</em></p>' . "\n";
989
  /**/
990
  echo '</div>' . "\n";
991
  /**/
1031
  /**/
1032
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
1033
  /**/
1034
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/api-mop-vars.x-php")) . '</p>' . "\n";
1035
  echo '</div>' . "\n";
1036
  /**/
1037
  echo '</div>' . "\n";
includes/menu-pages/trk-ops.inc.php CHANGED
@@ -361,25 +361,25 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_trk_ops"))
361
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
362
  echo '<p><strong>Signup Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
363
  echo '<p>idev_saleamt=<strong>%%initial%%</strong><br />idev_ordernum=<strong>%%subscr_id%%</strong></p>' . "\n";
364
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-signup-tracking-code.php")) . '</p>' . "\n";
365
  /**/
366
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
367
  echo '<p><strong>Modification Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
368
  echo '<p>idev_saleamt=<strong>%%initial%%</strong><br />idev_ordernum=<strong>%%subscr_id%%</strong></p>' . "\n";
369
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-modification-tracking-code.php")) . '</p>' . "\n";
370
  /**/
371
  if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
372
  {
373
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
374
  echo '<p><strong>Capability Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
375
  echo '<p>idev_saleamt=<strong>%%amount%%</strong><br />idev_ordernum=<strong>%%txn_id%%</strong></p>' . "\n";
376
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-ccap-tracking-code.php")) . '</p>' . "\n";
377
  }
378
  /**/
379
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
380
  echo '<p><strong>Specific Post/Page Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
381
  echo '<p>idev_saleamt=<strong>%%amount%%</strong><br />idev_ordernum=<strong>%%txn_id%%</strong></p>' . "\n";
382
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-sp-tracking-code.php")) . '</p>' . "\n";
383
  /**/
384
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
385
  echo '<p>Your <code>profile</code> ID will be assigned by iDevAffiliate®. Be sure to replace <code>profile=123</code> with your own profile ID.</p>' . "\n";
@@ -407,25 +407,25 @@ if (!class_exists ("c_ws_plugin__s2member_menu_page_trk_ops"))
407
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
408
  echo '<p><strong>Signup Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
409
  echo '<p>amount=<strong>%%initial%%</strong><br />tracking=<strong>%%subscr_id%%</strong></p>' . "\n";
410
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-signup-tracking-code.php")) . '</p>' . "\n";
411
  /**/
412
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
413
  echo '<p><strong>Modification Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
414
  echo '<p>amount=<strong>%%initial%%</strong><br />tracking=<strong>%%subscr_id%%</strong></p>' . "\n";
415
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-modification-tracking-code.php")) . '</p>' . "\n";
416
  /**/
417
  if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
418
  {
419
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
420
  echo '<p><strong>Capability Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
421
  echo '<p>amount=<strong>%%amount%%</strong><br />tracking=<strong>%%txn_id%%</strong></p>' . "\n";
422
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-ccap-tracking-code.php")) . '</p>' . "\n";
423
  }
424
  /**/
425
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
426
  echo '<p><strong>Specific Post/Page Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
427
  echo '<p>amount=<strong>%%amount%%</strong><br />tracking=<strong>%%txn_id%%</strong></p>' . "\n";
428
- echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-sp-tracking-code.php")) . '</p>' . "\n";
429
  /**/
430
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
431
  echo '<p>Your <code>merchantID</code> will be assigned by ShareASale®. Be sure to replace <code>merchantID=123</code> with the one they assign you.</p>' . "\n";
361
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
362
  echo '<p><strong>Signup Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
363
  echo '<p>idev_saleamt=<strong>%%initial%%</strong><br />idev_ordernum=<strong>%%subscr_id%%</strong></p>' . "\n";
364
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-signup-tracking-code.x-php")) . '</p>' . "\n";
365
  /**/
366
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
367
  echo '<p><strong>Modification Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
368
  echo '<p>idev_saleamt=<strong>%%initial%%</strong><br />idev_ordernum=<strong>%%subscr_id%%</strong></p>' . "\n";
369
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-modification-tracking-code.x-php")) . '</p>' . "\n";
370
  /**/
371
  if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
372
  {
373
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
374
  echo '<p><strong>Capability Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
375
  echo '<p>idev_saleamt=<strong>%%amount%%</strong><br />idev_ordernum=<strong>%%txn_id%%</strong></p>' . "\n";
376
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-ccap-tracking-code.x-php")) . '</p>' . "\n";
377
  }
378
  /**/
379
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
380
  echo '<p><strong>Specific Post/Page Tracking Code, for iDevAffiliate® integration:</strong></p>' . "\n";
381
  echo '<p>idev_saleamt=<strong>%%amount%%</strong><br />idev_ordernum=<strong>%%txn_id%%</strong></p>' . "\n";
382
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/idev-sp-tracking-code.x-php")) . '</p>' . "\n";
383
  /**/
384
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
385
  echo '<p>Your <code>profile</code> ID will be assigned by iDevAffiliate®. Be sure to replace <code>profile=123</code> with your own profile ID.</p>' . "\n";
407
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
408
  echo '<p><strong>Signup Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
409
  echo '<p>amount=<strong>%%initial%%</strong><br />tracking=<strong>%%subscr_id%%</strong></p>' . "\n";
410
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-signup-tracking-code.x-php")) . '</p>' . "\n";
411
  /**/
412
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
413
  echo '<p><strong>Modification Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
414
  echo '<p>amount=<strong>%%initial%%</strong><br />tracking=<strong>%%subscr_id%%</strong></p>' . "\n";
415
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-modification-tracking-code.x-php")) . '</p>' . "\n";
416
  /**/
417
  if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
418
  {
419
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
420
  echo '<p><strong>Capability Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
421
  echo '<p>amount=<strong>%%amount%%</strong><br />tracking=<strong>%%txn_id%%</strong></p>' . "\n";
422
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-ccap-tracking-code.x-php")) . '</p>' . "\n";
423
  }
424
  /**/
425
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
426
  echo '<p><strong>Specific Post/Page Tracking Code, for ShareASale® integration:</strong></p>' . "\n";
427
  echo '<p>amount=<strong>%%amount%%</strong><br />tracking=<strong>%%txn_id%%</strong></p>' . "\n";
428
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/sas-sp-tracking-code.x-php")) . '</p>' . "\n";
429
  /**/
430
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
431
  echo '<p>Your <code>merchantID</code> will be assigned by ShareASale®. Be sure to replace <code>merchantID=123</code> with the one they assign you.</p>' . "\n";
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
  */
@@ -38,7 +38,11 @@ Determine full URL to the s2Member-only file that loads WordPress® with only s2
38
  */
39
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/" . preg_replace ("/\.php$/", "-o.php", basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"]));
40
  /*
41
- Configure the number of Membership Levels being used with s2Member. This is NOT ready ( yet ). Some areas of s2Member are still hard-coded at 4 Levels + Subscribers.
 
 
 
 
42
  */
43
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] = 4; /* Hard coded in at 4 Levels. This can only be extended when/if s2Member Pro is installed. */
44
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["min_levels"] = 1; /* A lower limit to protect the integrity of the s2Member software application. */
@@ -60,7 +64,7 @@ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["mb_detection_order"] = "UTF-8, ISO-885
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
  */
@@ -149,6 +153,9 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
149
  $default_options["force_admin_lockouts"] = "0";
150
  $default_options["filter_wp_query"] = array ();
151
  /**/
 
 
 
152
  $default_options["mms_auto_patch"] = "1";
153
  $default_options["mms_registration_file"] = "wp-login";
154
  $default_options["mms_registration_grants"] = "none";
@@ -333,7 +340,7 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
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];
@@ -368,10 +375,10 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
368
  else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
369
  $value = $default_options[$key];
370
  /**/
371
- else if (preg_match ("/^custom_reg_(names|password|opt_in|auto_opt_out_transitions)$/", $key) && (!is_string ($value) || !is_numeric ($value)))
372
  $value = $default_options[$key];
373
  /**/
374
- else if ($key === "custom_reg_display_name" && (!is_string ($value) || !preg_match ("/^(full|first|last|login|0)$/", $value)))
375
  $value = $default_options[$key];
376
  /**/
377
  else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
@@ -392,10 +399,10 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
392
  else if ($key === "mms_auto_patch" && (!is_string ($value) || !is_numeric ($value)))
393
  $value = $default_options[$key];
394
  /**/
395
- else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
396
  $value = $default_options[$key];
397
  /**/
398
- else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
399
  $value = $default_options[$key];
400
  /**/
401
  else if (preg_match ("/^mms_registration_blogs_level[0-9]+$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
@@ -404,7 +411,10 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
404
  else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
405
  $value = $default_options[$key];
406
  /**/
407
- else if ($key === "filter_wp_query" && !is_array ($value)) /* Array CAN be empty. */
 
 
 
408
  $value = $default_options[$key];
409
  /**/
410
  else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
@@ -419,40 +429,40 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
419
  else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
420
  $value = $default_options[$key];
421
  /**/
422
- else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
423
  $value = $default_options[$key];
424
  /**/
425
- else if (preg_match ("/^login_reg_(background|logo|font|footer)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
426
  $value = $default_options[$key];
427
  /**/
428
- else if (preg_match ("/^reg_email_(from_name|from_email|support_link)$/", $key) && (!is_string ($value) || !strlen ($value)))
429
  $value = $default_options[$key];
430
  /**/
431
  else if ($key === "new_user_emails_enabled" && (!is_string ($value) || !is_numeric ($value)))
432
  $value = $default_options[$key];
433
  /**/
434
- else if (preg_match ("/^new_user_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
435
  $value = $default_options[$key];
436
  /**/
437
- else if (preg_match ("/^new_user_admin_email_(recipients|subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
438
  $value = $default_options[$key];
439
  /**/
440
  else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
441
  $value = $default_options[$key];
442
  /**/
443
- else if (preg_match ("/^paypal_(business|api_username|api_password|api_signature|identity_token)$/", $key) && (!is_string ($value) || !strlen ($value)))
444
  $value = $default_options[$key];
445
  /**/
446
  else if ($key === "paypal_btn_encryption" && (!is_string ($value) || !is_numeric ($value)))
447
  $value = $default_options[$key];
448
  /**/
449
- else if (preg_match ("/^(signup|modification|ccap|sp)_tracking_codes$/", $key) && (!is_string ($value) || !strlen ($value)))
450
  $value = $default_options[$key];
451
  /**/
452
- else if (preg_match ("/^(signup|sp)_email_recipients$/", $key) && !is_string ($value)) /* Can be empty. */
453
  $value = $default_options[$key];
454
  /**/
455
- else if (preg_match ("/^(signup|sp)_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
456
  $value = $default_options[$key];
457
  /**/
458
  else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
@@ -464,10 +474,10 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
464
  else if (preg_match ("/^level[0-9]+_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
465
  $value = $default_options[$key];
466
  /**/
467
- else if (preg_match ("/^(signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
468
  $value = $default_options[$key];
469
  /**/
470
- else if (preg_match ("/^(signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
471
  $value = $default_options[$key];
472
  /**/
473
  else if (preg_match ("/^level[0-9]+_label$/", $key) && (!is_string ($value) || !strlen ($value)))
@@ -485,10 +495,10 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
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)))
@@ -497,7 +507,7 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
497
  else if (preg_match ("/^level[0-9]+_catgs$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
498
  $value = $default_options[$key];
499
  /**/
500
- else if (preg_match ("/^level[0-9]+_ptags$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
501
  $value = $default_options[$key];
502
  /**/
503
  else if (preg_match ("/^level[0-9]+_posts$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
@@ -509,13 +519,13 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
509
  else if ($key === "specific_ids" && (!is_string ($value) || !($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
510
  $value = $default_options[$key];
511
  /**/
512
- else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
513
  $value = $default_options[$key];
514
  /**/
515
- else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
516
  $value = $default_options[$key];
517
  /**/
518
- else if ($key === "eot_time_ext_behavior" && (!is_string ($value) || !preg_match ("/^(extend|reset)$/", $value)))
519
  $value = $default_options[$key];
520
  /**/
521
  else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($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
  */
38
  */
39
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/" . preg_replace ("/\.php$/", "-o.php", basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"]));
40
  /*
41
+ Determine correct ``plugin_basename()`` here. WordPress® has a few issues with its ``plugin_basename()`` function across different platforms.
42
+ */
43
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"] = basename (dirname ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"])) . "/" . basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"]);
44
+ /*
45
+ Configure the number of Membership Levels being used with s2Member. This is now possible. All areas of s2Member are now capable of adapting to this.
46
  */
47
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] = 4; /* Hard coded in at 4 Levels. This can only be extended when/if s2Member Pro is installed. */
48
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["min_levels"] = 1; /* A lower limit to protect the integrity of the s2Member software application. */
64
  /*
65
  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>
66
  */
67
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"] = array_unique (array ("avi", "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"));
68
  /*
69
  Configure directory and .htaccess for files protected by s2Member.
70
  */
153
  $default_options["force_admin_lockouts"] = "0";
154
  $default_options["filter_wp_query"] = array ();
155
  /**/
156
+ $default_options["default_url_shortener"] = "tiny_url";
157
+ $default_options["default_custom_str_url_shortener"] = "";
158
+ /**/
159
  $default_options["mms_auto_patch"] = "1";
160
  $default_options["mms_registration_file"] = "wp-login";
161
  $default_options["mms_registration_grants"] = "none";
340
  foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
341
  {
342
  if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
343
+ unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
344
  /**/
345
  else if ($key === "options_checksum" && (!is_string ($value) || !strlen ($value)))
346
  $value = $default_options[$key];
375
  else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
376
  $value = $default_options[$key];
377
  /**/
378
+ else if (preg_match ("/^custom_reg_(?:names|password|opt_in|auto_opt_out_transitions)$/", $key) && (!is_string ($value) || !is_numeric ($value)))
379
  $value = $default_options[$key];
380
  /**/
381
+ else if ($key === "custom_reg_display_name" && (!is_string ($value) || !preg_match ("/^(?:full|first|last|login|0)$/", $value)))
382
  $value = $default_options[$key];
383
  /**/
384
  else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
399
  else if ($key === "mms_auto_patch" && (!is_string ($value) || !is_numeric ($value)))
400
  $value = $default_options[$key];
401
  /**/
402
+ else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(?:wp-login|wp-signup)$/", $value)))
403
  $value = $default_options[$key];
404
  /**/
405
+ else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(?:none|user|all)$/", $value)))
406
  $value = $default_options[$key];
407
  /**/
408
  else if (preg_match ("/^mms_registration_blogs_level[0-9]+$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
411
  else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
412
  $value = $default_options[$key];
413
  /**/
414
+ else if ($key === "filter_wp_query" && !is_array ($value)) /* This array CAN be empty. */
415
+ $value = $default_options[$key];
416
+ /**/
417
+ else if (preg_match ("/^default_(?:custom_str_)?url_shortener$/", $key) && (!is_string ($value) || !strlen ($value)))
418
  $value = $default_options[$key];
419
  /**/
420
  else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
429
  else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
430
  $value = $default_options[$key];
431
  /**/
432
+ else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(?:repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
433
  $value = $default_options[$key];
434
  /**/
435
+ else if (preg_match ("/^login_reg_(?:background|logo|font|footer)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
436
  $value = $default_options[$key];
437
  /**/
438
+ else if (preg_match ("/^reg_email_(?:from_name|from_email|support_link)$/", $key) && (!is_string ($value) || !strlen ($value)))
439
  $value = $default_options[$key];
440
  /**/
441
  else if ($key === "new_user_emails_enabled" && (!is_string ($value) || !is_numeric ($value)))
442
  $value = $default_options[$key];
443
  /**/
444
+ else if (preg_match ("/^new_user_email_(?:subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
445
  $value = $default_options[$key];
446
  /**/
447
+ else if (preg_match ("/^new_user_admin_email_(?:recipients|subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
448
  $value = $default_options[$key];
449
  /**/
450
  else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
451
  $value = $default_options[$key];
452
  /**/
453
+ else if (preg_match ("/^paypal_(?:business|api_username|api_password|api_signature|identity_token)$/", $key) && (!is_string ($value) || !strlen ($value)))
454
  $value = $default_options[$key];
455
  /**/
456
  else if ($key === "paypal_btn_encryption" && (!is_string ($value) || !is_numeric ($value)))
457
  $value = $default_options[$key];
458
  /**/
459
+ else if (preg_match ("/^(?:signup|modification|ccap|sp)_tracking_codes$/", $key) && (!is_string ($value) || !strlen ($value)))
460
  $value = $default_options[$key];
461
  /**/
462
+ else if (preg_match ("/^(?:signup|sp)_email_recipients$/", $key) && !is_string ($value)) /* Can be empty. */
463
  $value = $default_options[$key];
464
  /**/
465
+ else if (preg_match ("/^(?:signup|sp)_email_(?:subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
466
  $value = $default_options[$key];
467
  /**/
468
  else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
474
  else if (preg_match ("/^level[0-9]+_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
475
  $value = $default_options[$key];
476
  /**/
477
+ else if (preg_match ("/^(?:signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
478
  $value = $default_options[$key];
479
  /**/
480
+ else if (preg_match ("/^(?:signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
481
  $value = $default_options[$key];
482
  /**/
483
  else if (preg_match ("/^level[0-9]+_label$/", $key) && (!is_string ($value) || !strlen ($value)))
495
  else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
496
  $value = $default_options[$key];
497
  /**/
498
+ else if (preg_match ("/^file_download_(?:inline|stream)_extensions$/", $key) && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
499
  $value = $default_options[$key];
500
  /**/
501
+ else if (preg_match ("/^amazon_(?:s3|cf)_files_/", $key) && (!is_string ($value) || !strlen ($value)))
502
  $value = $default_options[$key];
503
  /**/
504
  else if (preg_match ("/^level[0-9]+_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
507
  else if (preg_match ("/^level[0-9]+_catgs$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
508
  $value = $default_options[$key];
509
  /**/
510
+ else if (preg_match ("/^level[0-9]+_ptags$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/ +/", " ", trim (preg_replace ("/ *, */", ",", $value))), ",")))))
511
  $value = $default_options[$key];
512
  /**/
513
  else if (preg_match ("/^level[0-9]+_posts$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
519
  else if ($key === "specific_ids" && (!is_string ($value) || !($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
520
  $value = $default_options[$key];
521
  /**/
522
+ else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(?:none|refunds|reversals|refunds,reversals)$/", $value)))
523
  $value = $default_options[$key];
524
  /**/
525
+ else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(?:demote|delete)$/", $value)))
526
  $value = $default_options[$key];
527
  /**/
528
+ else if ($key === "eot_time_ext_behavior" && (!is_string ($value) || !preg_match ("/^(?:extend|reset)$/", $value)))
529
  $value = $default_options[$key];
530
  /**/
531
  else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
includes/templates/cfg-files/s2o-mu-plugins.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
3
+ exit("Do not access this file directly.");
4
+ ?>
5
+
6
+ /* s2Member-only mode. Only load special file `s2member-o.php`, exclude all others. */
7
+
8
+ if (file_exists (WPMU_PLUGIN_DIR . "/s2member-o.php"))
9
+ include_once WPMU_PLUGIN_DIR . "/s2member-o.php";
includes/templates/cfg-files/s2o-nw-plugins.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
3
+ exit("Do not access this file directly.");
4
+ ?>
5
+
6
+ /* s2Member-only mode. Only load the s2Member plugin, exclude all others. */
7
+
8
+ $o_ws_plugin__s2member = preg_replace ("/-o\.php$/", ".php", __FILE__);
9
+ $o_ws_plugin__s2member_is_loaded_already = (defined ("WS_PLUGIN__S2MEMBER_VERSION")) ? true : false;
10
+ $o_ws_plugin__plugins_s2member = WP_PLUGIN_DIR . "/" . basename (dirname ($o_ws_plugin__s2member)) ."/" . basename($o_ws_plugin__s2member);
11
+ /**/
12
+ if ((!file_exists ($o_ws_plugin__plugins_s2member) || @is_link ($o_ws_plugin__plugins_s2member)) && file_exists ($o_ws_plugin__s2member) && !$o_ws_plugin__s2member_is_loaded_already)
13
+ include_once $o_ws_plugin__s2member; /* s2Member in a strange location? */
14
+ /**/
15
+ else if (in_array ($o_ws_plugin__plugins_s2member, wp_get_active_network_plugins ()) && file_exists ($o_ws_plugin__plugins_s2member) && !$o_ws_plugin__s2member_is_loaded_already)
16
+ include_once $o_ws_plugin__plugins_s2member;
17
+ /**/
18
+ else if (apply_filters ("ws_plugin_s2member_o_force", false) && !$o_ws_plugin__s2member_is_loaded_already) /* Off by default. Force s2Member to load? */
19
+ include_once $o_ws_plugin__s2member;
20
+ /**/
21
+ unset ($o_ws_plugin__plugins_s2member, $o_ws_plugin__s2member_is_loaded_already, $o_ws_plugin__s2member);
includes/templates/cfg-files/s2o-st-plugins.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
3
+ exit("Do not access this file directly.");
4
+ ?>
5
+
6
+ /* s2Member-only mode. Only load the s2Member plugin, exclude all others. */
7
+
8
+ $o_ws_plugin__s2member = preg_replace ("/-o\.php$/", ".php", __FILE__);
9
+ $o_ws_plugin__s2member_is_loaded_already = (defined ("WS_PLUGIN__S2MEMBER_VERSION")) ? true : false;
10
+ $o_ws_plugin__plugins_s2member = WP_PLUGIN_DIR . "/" . basename (dirname ($o_ws_plugin__s2member)) ."/" . basename($o_ws_plugin__s2member);
11
+ /**/
12
+ if ((!file_exists ($o_ws_plugin__plugins_s2member) || @is_link ($o_ws_plugin__plugins_s2member)) && file_exists ($o_ws_plugin__s2member) && !$o_ws_plugin__s2member_is_loaded_already)
13
+ include_once $o_ws_plugin__s2member; /* s2Member in a strange location? */
14
+ /**/
15
+ else if (in_array ($o_ws_plugin__plugins_s2member, wp_get_active_and_valid_plugins ()) && file_exists ($o_ws_plugin__plugins_s2member) && !$o_ws_plugin__s2member_is_loaded_already)
16
+ include_once $o_ws_plugin__plugins_s2member;
17
+ /**/
18
+ else if (apply_filters ("ws_plugin_s2member_o_force", false) && !$o_ws_plugin__s2member_is_loaded_already) /* Off by default. Force s2Member to load? */
19
+ include_once $o_ws_plugin__s2member;
20
+ /**/
21
+ unset ($o_ws_plugin__plugins_s2member, $o_ws_plugin__s2member_is_loaded_already, $o_ws_plugin__s2member);
includes/templates/cfg-files/s2o-th-funcs.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
3
+ exit("Do not access this file directly.");
4
+ ?>
5
+
6
+ /* s2Member-only mode. Do NOT load theme functions, exclude all themes. */
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === s2Member® ( Membership w/ PayPal® ) ===
2
 
3
- Version: 110927
4
- Stable tag: 110927
5
  Framework: WS-P-110523
6
 
7
  SSL Compatible: yes
@@ -126,7 +126,7 @@ Yes, it can even generate your PayPal® Subscription Buttons for you. Everything
126
  s2Member supports Free Subscribers (at Level #0), and four primary Membership Levels [1-4] (unlimited with s2Member Pro). You can label your Membership Levels anything you like. The defaults are Free, Bronze, Silver, Gold, and Platinum. s2Member also supports an unlimited number of Custom Capability Packages. Custom Capabilities are an easy way to extend s2Member in creative ways. Custom Capabilities allow you to create an unlimited number of Membership Packages, all with different Capabilities and prices.
127
 
128
  = How can I extend s2Member beyond four Levels? =
129
- With s2Member "Pro" installed, you may configure an unlimited number of Membership Levels. You can set the number of Membership Levels by adding this line to your /wp-config.php file: `define("MEMBERSHIP_LEVELS", 4);`. Feel free to change the default value of 4 to whatever you need. The miniumum allowed value is `1`. The recommended maximum is `100`.
130
 
131
  = Does s2Member utilize the PayPal® IPN system? =
132
  Yes, s2Member supports automation of account activation, welcome emails, confirmations, renewals, deactivation, refunds, etc. The integration with PayPal® is seamless. s2Member even provides API Notifications, which are an added layer of functionality. These are not to be confused with the IPN service. s2Member API Notifications make it easier to integrate back-office routines, affiliate programs, list servers, or any other 3rd-party applications that should react to certain events.
@@ -178,6 +178,13 @@ Please visit s2Member.com for [video tutorials](http://www.s2member.com/videos/)
178
 
179
  == Changelog ==
180
 
 
 
 
 
 
 
 
181
  = v110927 =
182
  * (s2Member) **BuddyPress v1.5 compatibility**. Misc tweaks.
183
  * (s2Member) **Documentation improvements**. New documentation covering Shortcode Attributes and API Function parameters for the new `[s2File /]` Shortcode, and for the new API Function `s2member_file_download_url()`. Please check your Dashboard, under: `s2Member -> Download Options -> Shortcode Attributes / API Functions ( Explained )`.
@@ -285,7 +292,7 @@ Please visit s2Member.com for [video tutorials](http://www.s2member.com/videos/)
285
 
286
  = v110708 =
287
  * **(s2Member/s2Member Pro) Compatibility.** s2Member and s2Member Pro have both been updated to support WordPress® v3.2.
288
- * **(s2Member Pro) Unlimited Membership Levels.** With s2Member Pro installed, you may now configure an unlimited number of Membership Levels. You can set the number of Membership Levels by adding this line to your /wp-config.php file: `define("MEMBERSHIP_LEVELS", 4);`. Feel free to change the default value of 4 to whatever you need. The miniumum allowed value is 1. The recommended maximum is 100. For further details, please check your Dashboard, under: `s2Member -> General Options -> Membership Levels/Labels`.
289
  * **(s2Member/s2Member Pro) Email Configuration.** Some new options are now available that allow site owners to customize the email that contains the Username/Password for new Users/Members. For further details, please check your Dashboard, under: `s2Member -> General Options -> Email Configuration`.
290
  * **(s2Member/s2Member Pro) Bug fix.** A problem with certain email addresses routed through the `wp_mail()` function, containing special characters in the "Name" portion. The issue was related to the way in which `wp_mail()` handles recipient addresses in the format `"Name" <address>`. s2Member now strips double quotes dynamically ( i.e. internally ), so that `wp_mail()` and the PHPMailer class can deal with this format on their own. This bug fix should also prevent seemingly random `500 Internal Server Error` messages during checkout. One symptom of this bug was to find "Premature end of script headers" inside your Apache error log, followed by an error code of `500` reported in the browser. These issues have been corrected in this release of s2Member.
291
  * **(s2Member) Bug fix.** A bug first introduced in v110604 was preventing s2Member from setting a User's "Display Name" during Registration properly. This bug has been corrected in the latest release. In addition, a new configurable option for this behavior has been added to the s2Member General Options panel. For further details, please check your Dashboard under: `s2Member -> General Options -> Custom Registration Fields -> Display Name`.
1
  === s2Member® ( Membership w/ PayPal® ) ===
2
 
3
+ Version: 111002
4
+ Stable tag: 111002
5
  Framework: WS-P-110523
6
 
7
  SSL Compatible: yes
126
  s2Member supports Free Subscribers (at Level #0), and four primary Membership Levels [1-4] (unlimited with s2Member Pro). You can label your Membership Levels anything you like. The defaults are Free, Bronze, Silver, Gold, and Platinum. s2Member also supports an unlimited number of Custom Capability Packages. Custom Capabilities are an easy way to extend s2Member in creative ways. Custom Capabilities allow you to create an unlimited number of Membership Packages, all with different Capabilities and prices.
127
 
128
  = How can I extend s2Member beyond four Levels? =
129
+ With s2Member "Pro" installed, you may configure an unlimited number of Membership Levels. You can set the number of Membership Levels by adding this line to your /wp-config.php file: `define("MEMBERSHIP_LEVELS", 4);`. Feel free to change the default value of 4 to whatever you need. The minimum allowed value is `1`. The recommended maximum is `100`.
130
 
131
  = Does s2Member utilize the PayPal® IPN system? =
132
  Yes, s2Member supports automation of account activation, welcome emails, confirmations, renewals, deactivation, refunds, etc. The integration with PayPal® is seamless. s2Member even provides API Notifications, which are an added layer of functionality. These are not to be confused with the IPN service. s2Member API Notifications make it easier to integrate back-office routines, affiliate programs, list servers, or any other 3rd-party applications that should react to certain events.
178
 
179
  == Changelog ==
180
 
181
+ = v111002 =
182
+ * (s2Member) **BuddyPress v1.5 fix**. Issues with BuddyPress v1.5 and s2Member's URI Restrictions; corrected in this release. Hook priority updated, and `template_redirect` converted to `wp` at priority `2`, giving s2Member the ability to integrate with BuddyPress v1.5 properly in all scenarios.
183
+ * (s2Member) **tinyURL® bug fix**. s2Member's handling of potential failures in the output of tinyURLs, generated by the tinyURL® API; was NOT considering all failure possibilities. A symptom of this bug was to see URLs in your Signup Confirmation Email (occassionally, upon connection failure to the tinyURL® API, when it was down for whatever reason) starting with: `Error#`. Corrected in this release.
184
+ * (s2Member) **URL Shortening API (Preference)**. s2Member now includes a class method dedicated to URL shortening service APIs. Currently, s2Member will use the tinyURL® API first *(i.e. tinyurl.com )*, and then use the Google® URL Shortening API *(i.e. goo.gl )* as a backup when/if the tinyURL® API is down for whatever reason. In this release, a new configurable option is available, which allows advanced site owners to preference the Google® Shortening API over tinyURL®, if they desire. It is also possible to integrate your own custom GET request, for whichever service you prefer. For further details, please check your Dashboard, under: `s2Member -> General Options -> URL Shortening API (Preference)`.
185
+ * (s2Member) **Bug fix**. Bug first introduced in s2Member v110912. s2Member's new optimized method of loading its CSS/JS was causing some problems on a few Windows® server environments. In some cases, s2Member was unable to properly identify itself through the `/s2member-o.php` file, given limitations of the core WordPress® function `plugin_basename()`. A symptom of this bug was for s2Member to fail at loading its CSS/JS libraries. Fixed in this release.
186
+ * (s2Member) **Security fix**. It was possible for some of s2Member's code sample files to be executed directly. Not a proven vulnerability, but definitely NOT a good idea to allow this either. Fixed in this release, by renaming all `.php` files inside the `/includes/menu-pages/code-samples/` directory. These files now have a `.x-php` extension. As an additional line of defense, a new `.htaccess` file with `deny from all` is automatically placed inside the main `/s2member/includes/` directory. None of these files should be available pulicly anyway. s2Member's exsiting `realpath()` file scans remain in place too, which further prevents the direct execution of `.php` files.
187
+
188
  = v110927 =
189
  * (s2Member) **BuddyPress v1.5 compatibility**. Misc tweaks.
190
  * (s2Member) **Documentation improvements**. New documentation covering Shortcode Attributes and API Function parameters for the new `[s2File /]` Shortcode, and for the new API Function `s2member_file_download_url()`. Please check your Dashboard, under: `s2Member -> Download Options -> Shortcode Attributes / API Functions ( Explained )`.
292
 
293
  = v110708 =
294
  * **(s2Member/s2Member Pro) Compatibility.** s2Member and s2Member Pro have both been updated to support WordPress® v3.2.
295
+ * **(s2Member Pro) Unlimited Membership Levels.** With s2Member Pro installed, you may now configure an unlimited number of Membership Levels. You can set the number of Membership Levels by adding this line to your /wp-config.php file: `define("MEMBERSHIP_LEVELS", 4);`. Feel free to change the default value of 4 to whatever you need. The minimum allowed value is 1. The recommended maximum is 100. For further details, please check your Dashboard, under: `s2Member -> General Options -> Membership Levels/Labels`.
296
  * **(s2Member/s2Member Pro) Email Configuration.** Some new options are now available that allow site owners to customize the email that contains the Username/Password for new Users/Members. For further details, please check your Dashboard, under: `s2Member -> General Options -> Email Configuration`.
297
  * **(s2Member/s2Member Pro) Bug fix.** A problem with certain email addresses routed through the `wp_mail()` function, containing special characters in the "Name" portion. The issue was related to the way in which `wp_mail()` handles recipient addresses in the format `"Name" <address>`. s2Member now strips double quotes dynamically ( i.e. internally ), so that `wp_mail()` and the PHPMailer class can deal with this format on their own. This bug fix should also prevent seemingly random `500 Internal Server Error` messages during checkout. One symptom of this bug was to find "Premature end of script headers" inside your Apache error log, followed by an error code of `500` reported in the browser. These issues have been corrected in this release of s2Member.
298
  * **(s2Member) Bug fix.** A bug first introduced in v110604 was preventing s2Member from setting a User's "Display Name" during Registration properly. This bug has been corrected in the latest release. In addition, a new configurable option for this behavior has been added to the s2Member General Options panel. For further details, please check your Dashboard under: `s2Member -> General Options -> Custom Registration Fields -> Display Name`.
s2member-o.php CHANGED
@@ -16,9 +16,9 @@
16
  */
17
  include_once dirname (__FILE__) . "/includes/classes/utils-s2o.inc.php";
18
  /**/
19
- if (($ws_plugin__s2member_o_temp_a["wp_dir"] = c_ws_plugin__s2member_utils_s2o::wp_dir (dirname (__FILE__), dirname ($_SERVER["SCRIPT_FILENAME"]))))
20
  {
21
- if (($ws_plugin__s2member_o_temp_a["wp_settings_as"] = c_ws_plugin__s2member_utils_s2o::wp_settings_as ($ws_plugin__s2member_o_temp_a["wp_dir"], __FILE__)))
22
  {
23
  /**
24
  * Short initialization mode for WordPress®.
@@ -41,11 +41,11 @@ if (($ws_plugin__s2member_o_temp_a["wp_dir"] = c_ws_plugin__s2member_utils_s2o::
41
  /*
42
  Load WordPress®.
43
  */
44
- require($ws_plugin__s2member_o_temp_a["wp_dir"] . "/wp-load.php");
45
- eval ("?>" . /* Settings after ``SHORTINIT``. */ $ws_plugin__s2member_o_temp_a["wp_settings_as"]);
46
  }
47
  else /* Else fallback on full WordPress®. */
48
- require($ws_plugin__s2member_o_temp_a["wp_dir"] . "/wp-load.php");
49
  }
50
- unset ($ws_plugin__s2member_o_temp_a);
51
  ?>
16
  */
17
  include_once dirname (__FILE__) . "/includes/classes/utils-s2o.inc.php";
18
  /**/
19
+ if (($ws_plugin__s2member_o["wp_dir"] = c_ws_plugin__s2member_utils_s2o::wp_dir (dirname (__FILE__), dirname ($_SERVER["SCRIPT_FILENAME"]))))
20
  {
21
+ if (($ws_plugin__s2member_o["wp_settings_as"] = c_ws_plugin__s2member_utils_s2o::wp_settings_as ($ws_plugin__s2member_o["wp_dir"], __FILE__)))
22
  {
23
  /**
24
  * Short initialization mode for WordPress®.
41
  /*
42
  Load WordPress®.
43
  */
44
+ require($ws_plugin__s2member_o["wp_dir"] . "/wp-load.php");
45
+ eval ("?>" . /* Settings after ``SHORTINIT``. */ $ws_plugin__s2member_o["wp_settings_as"]);
46
  }
47
  else /* Else fallback on full WordPress®. */
48
+ require($ws_plugin__s2member_o["wp_dir"] . "/wp-load.php");
49
  }
50
+ unset ($ws_plugin__s2member_o);
51
  ?>
s2member.php CHANGED
@@ -19,8 +19,8 @@
19
  */
20
  /* -- This section for WordPress® parsing. ------------------------------------------------------------------------------
21
 
22
- Version: 110927
23
- Stable tag: 110927
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", "110927");
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", "110927");
109
  /*
110
  Several compatibility checks.
111
  If all pass, load the s2Member plugin.
19
  */
20
  /* -- This section for WordPress® parsing. ------------------------------------------------------------------------------
21
 
22
+ Version: 111002
23
+ Stable tag: 111002
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", "111002");
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", "111002");
109
  /*
110
  Several compatibility checks.
111
  If all pass, load the s2Member plugin.