PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 120213
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v120213
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
s2member / includes / classes / systematics-sp.inc.php

systematics-sp.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 120213, at includes/classes/systematics-sp.inc.php

135 lines 7.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Systematics *( for a specific page )*.
4 *
5 * Copyright: © 2009-2011
6 * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
7 * ( coded in the USA )
8 *
9 * Released under the terms of the GNU General Public License.
10 * You should have received a copy of the GNU General Public License,
11 * along with this software. In the main directory, see: /licensing/
12 * If not, see: {@link http://www.gnu.org/licenses/}.
13 *
14 * @package s2Member\Systematics
15 * @since 3.5
16 */
17 if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18 exit("Do not access this file directly.");
19 /**/
20 if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
21 {
22 /**
23 * Systematics *( for a specific page )*.
24 *
25 * @package s2Member\Systematics
26 * @since 3.5
27 */
28 class c_ws_plugin__s2member_systematics_sp
29 {
30 /**
31 * Determines if a specific Post/Page ID, or URI, is s2Member® Systematic.
32 *
33 * @package s2Member\Systematics
34 * @since 111115
35 *
36 * @param int|str $singular_id Optional. A numeric Post/Page ID in WordPress®.
37 * @param str $uri Optional. A request URI to test against.
38 * @return bool True if s2Member® Systematic, else false.
39 */
40 public static function is_s2_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
41 {
42 $singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
43 $uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
44 /**/
45 if ($uri && ($_q = c_ws_plugin__s2member_utils_urls::parse_url ($uri, PHP_URL_QUERY)) && preg_match ("/[\?&]s2member/", $_q) && c_ws_plugin__s2member_utils_conds::is_site_root ($uri))
46 {
47 return ($is_s2_systematic = apply_filters ("ws_plugin__s2member_is_s2_systematic_use_specific_page", true, get_defined_vars ()));
48 }
49 else /* Otherwise, we return false ( i.e. it's NOT an s2Member® Systematic Use Page ). */
50 return ($is_s2_systematic = apply_filters ("ws_plugin__s2member_is_s2_systematic_use_specific_page", false, get_defined_vars ()));
51 }
52 /**
53 * Determines if a specific Post/Page ID, or URI, is WordPress® Systematic.
54 *
55 * @package s2Member\Systematics
56 * @since 111002
57 *
58 * @param int|str $singular_id Optional. A numeric Post/Page ID in WordPress®.
59 * @param str $uri Optional. A request URI to test against.
60 * @return bool True if WordPress® Systematic, else false.
61 */
62 public static function is_wp_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
63 {
64 $singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
65 $uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
66 /**/
67 if ($uri && preg_match ("/\/wp-admin(?:\/|\?|$)/", $uri)) /* Inside a WordPress® administrative area? */
68 {
69 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
70 }
71 else if ($uri && preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($uri, PHP_URL_PATH)))
72 {
73 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
74 }
75 else /* Otherwise, we return false ( i.e. it's NOT a WordPress® Systematic Use Page ). */
76 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_specific_page", false, get_defined_vars ()));
77 }
78 /**
79 * Determines if a specific Post/Page ID, or URI, is Systematic in any way.
80 *
81 * @package s2Member\Systematics
82 * @since 3.5
83 *
84 * @param int|str $singular_id Optional. A numeric Post/Page ID in WordPress®.
85 * @param str $uri Optional. A request URI to test against.
86 * @return bool True if Systematic, else false.
87 *
88 * @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
89 * Don't think this is required though; as it's already handled in other areas, correct?
90 */
91 public static function is_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
92 {
93 global $bp; /* If BuddyPress is installed, we'll need this global reference. */
94 /**/
95 $singular_id = ($singular_id && is_numeric ($singular_id)) ? (int)$singular_id : false; /* Force types. */
96 $uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
97 /**/
98 if (c_ws_plugin__s2member_systematics_sp::is_s2_systematic_use_specific_page /* An s2Member® Systematic Use Page? */ ($singular_id, $uri))
99 {
100 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
101 }
102 else if (c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page /* A WordPress® Systematic Use Page? */ ($singular_id, $uri))
103 {
104 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
105 }
106 else if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(?:" . preg_quote (trim (((function_exists ("bp_get_signup_slug")) ? bp_get_signup_slug () : BP_REGISTER_SLUG), "/"), "/") . "|" . preg_quote (trim (((function_exists ("bp_get_activate_slug")) ? bp_get_activate_slug () : BP_ACTIVATION_SLUG), "/"), "/") . ")(?:\/|\?|$)/", $uri))
107 {
108 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
109 }
110 else if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty ($bp->pages->register->id) && $singular_id === (int)$bp->pages->register->id) || (!empty ($bp->pages->activate->id) && $singular_id === (int)$bp->pages->activate->id)))
111 {
112 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
113 }
114 else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
115 {
116 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
117 }
118 else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
119 {
120 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
121 }
122 else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
123 {
124 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
125 }
126 else if ($uri && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($_lro, "/") . "$/", $uri))
127 {
128 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
129 }
130 else /* Otherwise, we return false ( i.e. it's NOT a Systematic Use Page in any way ). */
131 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
132 }
133 }
134 }
135 ?>