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

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

143 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * Systematics *(for current page)*.
5 *
6 * Copyright: © 2009-2011
7 * {@link http://websharks-inc.com/ WebSharks, Inc.}
8 * (coded in the USA)
9 *
10 * Released under the terms of the GNU General Public License.
11 * You should have received a copy of the GNU General Public License,
12 * along with this software. In the main directory, see: /licensing/
13 * If not, see: {@link http://www.gnu.org/licenses/}.
14 *
15 * @package s2Member\Systematics
16 * @since 3.5
17 */
18 if(!defined('WPINC')) // MUST have WordPress.
19 exit('Do not access this file directly.');
20
21 if(!class_exists('c_ws_plugin__s2member_systematics'))
22 {
23 /**
24 * Systematics *(for current page)*.
25 *
26 * @package s2Member\Systematics
27 * @since 3.5
28 */
29 class c_ws_plugin__s2member_systematics
30 {
31 /**
32 * Determines if the current page is s2Member Systematic.
33 *
34 * @package s2Member\Systematics
35 * @since 111115
36 *
37 * @return bool True if s2Member Systematic, else false.
38 *
39 * @note The results of this function are cached staticially.
40 * Do NOT call upon this until the `init` Hook is fired.
41 */
42 public static function is_s2_systematic_use_page()
43 {
44 static $is_s2_systematic; // For optimization.
45
46 if(isset($is_s2_systematic)) // Already cached statically? Saves time.
47 return $is_s2_systematic; // Filters will have already been applied here.
48
49 $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
50
51 if(!empty($_SERVER['QUERY_STRING']) && preg_match('/[\?&]s2member/'.$ci, $_SERVER['QUERY_STRING']) && c_ws_plugin__s2member_utils_conds::is_site_root($_SERVER['REQUEST_URI']))
52 return ($is_s2_systematic = apply_filters('ws_plugin__s2member_is_s2_systematic_use_page', TRUE, get_defined_vars()));
53
54 return ($is_s2_systematic = apply_filters('ws_plugin__s2member_is_s2_systematic_use_page', FALSE, get_defined_vars()));
55 }
56
57 /**
58 * Determines if the current page is WordPress Systematic.
59 *
60 * @package s2Member\Systematics
61 * @since 111002
62 *
63 * @return bool True if WordPress Systematic, else false.
64 *
65 * @note The results of this function are cached staticially.
66 * Do NOT call upon this until the `init` Hook is fired.
67 */
68 public static function is_wp_systematic_use_page()
69 {
70 static $is_wp_systematic; // For optimization.
71
72 if(isset($is_wp_systematic)) // Already cached statically? Saves time.
73 return $is_wp_systematic; // Filters will have already been applied here.
74
75 $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
76
77 if(is_admin()) // In the admin area? All administrational pages are considered Systematic.
78 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', TRUE, get_defined_vars()));
79
80 if(defined('WP_INSTALLING') && WP_INSTALLING) // Installing? All WordPress installs are considered Systematic.
81 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', TRUE, get_defined_vars()));
82
83 if(defined('APP_REQUEST') && APP_REQUEST) // App request? All WordPress app requests are considered Systematic.
84 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', TRUE, get_defined_vars()));
85
86 if(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) // An XML-RPC request? All of these are considered Systematic too.
87 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', TRUE, get_defined_vars()));
88
89 if((defined('DOING_CRON') && DOING_CRON) || strcasecmp(PHP_SAPI, 'CLI') === 0) // CLI or CRON job.
90 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', TRUE, get_defined_vars()));
91
92 if(preg_match('/^\/(?:wp-.+?|xmlrpc)\.php$/'.$ci, c_ws_plugin__s2member_utils_urls::parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)))
93 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', TRUE, get_defined_vars()));
94
95 return ($is_wp_systematic = apply_filters('ws_plugin__s2member_is_wp_systematic_use_page', FALSE, get_defined_vars()));
96 }
97
98 /**
99 * Determines if the current page is Systematic in any way.
100 *
101 * @package s2Member\Systematics
102 * @since 3.5
103 *
104 * @return bool True if Systematic, else false.
105 *
106 * @note The results of this function are cached staticially.
107 * Do NOT call upon this until the `wp` Hook is fired.
108 */
109 public static function is_systematic_use_page()
110 {
111 static $is_systematic; // For optimization.
112
113 if(isset($is_systematic)) // Already cached statically? Saves time.
114 return $is_systematic; // Filters will have already been applied here.
115
116 $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
117
118 if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()) // An s2Member Systematic Use Page?
119 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
120
121 if(c_ws_plugin__s2member_systematics::is_wp_systematic_use_page()) //* A WordPress Systematic Use Page?
122 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
123
124 if(c_ws_plugin__s2member_utils_conds::bp_is_installed() && (bp_is_register_page() || bp_is_activation_page()))
125 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
126
127 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'] && is_page($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']))
128 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
129
130 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page'] && is_page($GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']))
131 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
132
133 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page'] && is_page($GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page']))
134 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
135
136 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri(NULL, 'root-returns-false')) && preg_match('/^'.preg_quote($_lro, '/').'$/'.$ci, $_SERVER['REQUEST_URI']))
137 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', TRUE, get_defined_vars()));
138
139 return ($is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_page', FALSE, get_defined_vars()));
140 }
141 }
142 }
143