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, "/") . "#x2F;", $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, "/") . "#x2F;", $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, "/") . "#x2F;", $_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, "/") . "#x2F;", $_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, "/") . "#x2F;", $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, "/") . "#x2F;", $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, "/") . "#x2F;", $_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, "/") . "#x2F;", $_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, "/") . "#x2F;", $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, "/") . "#x2F;", $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, "/") . "#x2F;", $_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, "/") . "#x2F;", $_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, "/") . "#x2F;", $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, "/") . "#x2F;", $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, "/") . "#x2F;", $_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, "/") . "#x2F;", $_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, "/") . "#x2F;", $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, "/") . "#x2F;", $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, "/") . "#x2F;", $_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, "/") . "#x2F;", $_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]+#x2F;", "", $_SERVER["HTTP_HOST"]); /* Remove port here. */
53
$ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false; /* Port? */
54