PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 111029
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v111029
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.inc.php

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

132 lines 6.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Systematics *( for current 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"))
21 {
22 /**
23 * Systematics *( for current page )*.
24 *
25 * @package s2Member\Systematics
26 * @since 3.5
27 */
28 class c_ws_plugin__s2member_systematics
29 {
30 /**
31 * Determines if the current page is Systematic.
32 *
33 * @package s2Member\Systematics
34 * @since 3.5
35 *
36 * @return bool True if Systematic, else false.
37 *
38 * @note The results of this function are cached staticially.
39 * Do NOT call upon this until the `wp` Hook is fired.
40 */
41 public static function is_systematic_use_page ()
42 {
43 static $is_systematic; /* For optimization. */
44 /**/
45 if (isset ($is_systematic)) /* Already cached? This saves time. */
46 {
47 return $is_systematic; /* Filters will have already been applied. */
48 }
49 else if (c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) /* WordPress® Systematic? */
50 {
51 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
52 }
53 else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
54 {
55 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
56 }
57 else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
58 {
59 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
60 }
61 else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]))
62 {
63 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
64 }
65 else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
66 {
67 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
68 }
69 else if (!empty ($_SERVER["QUERY_STRING"]) && strpos ($_SERVER["QUERY_STRING"], "s2member") === 0 && c_ws_plugin__s2member_utils_conds::is_site_root ($_SERVER["REQUEST_URI"]))
70 {
71 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
72 }
73 else if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ()))
74 {
75 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
76 }
77 else /* Otherwise, we return false ( it's NOT Systematic ). */
78 return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
79 }
80 /**
81 * Determines if the current page is WordPress® Systematic.
82 *
83 * @package s2Member\Systematics
84 * @since 111002
85 *
86 * @return bool True if WordPress® Systematic, else false.
87 *
88 * @note The results of this function are cached staticially.
89 * Do NOT call upon this until the `wp` Hook is fired.
90 */
91 public static function is_wp_systematic_use_page ()
92 {
93 static $is_wp_systematic; /* For optimization. */
94 /**/
95 if (isset ($is_wp_systematic)) /* Already cached? This saves time. */
96 {
97 return $is_wp_systematic; /* Filters will have already been applied. */
98 }
99 else if (is_admin ()) /* In the admin area? All administrational pages are considered Systematic. */
100 {
101 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
102 }
103 else if (defined ("WP_INSTALLING") && WP_INSTALLING) /* Installing? All WordPress® installs are considered Systematic. */
104 {
105 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
106 }
107 else if (defined ("APP_REQUEST") && APP_REQUEST) /* App request? All WordPress® app requests are considered Systematic. */
108 {
109 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
110 }
111 else if (defined ("XMLRPC_REQUEST") && XMLRPC_REQUEST) /* An XML-RPC request? All of these are considered Systematic too. */
112 {
113 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
114 }
115 else if ((defined ("DOING_CRON") && DOING_CRON) || strcasecmp (PHP_SAPI, "CLI") === 0) /* CLI ( command line ) or CRON job. */
116 {
117 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
118 }
119 else if (preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH)))
120 {
121 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
122 }
123 else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && stripos ($_SERVER["HTTP_HOST"], "localhost") === false && strpos ($_SERVER["HTTP_HOST"], "127.0.0.1") === false && (!defined ("LOCALHOST") || !LOCALHOST))
124 {
125 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
126 }
127 else /* Otherwise, we return false ( it's NOT WordPress® Systematic ). */
128 return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", false, get_defined_vars ()));
129 }
130 }
131 }
132 ?>