| 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 s2Member® Systematic. |
| 32 |
* |
| 33 |
* @package s2Member\Systematics |
| 34 |
* @since 111115 |
| 35 |
* |
| 36 |
* @return bool True if s2Member® Systematic, else false. |
| 37 |
* |
| 38 |
* @note The results of this function are cached staticially. |
| 39 |
* Do NOT call upon this until the `init` Hook is fired. |
| 40 |
*/ |
| 41 |
public static function is_s2_systematic_use_page () |
| 42 |
{ |
| 43 |
static $is_s2_systematic; /* For optimization. */ |
| 44 |
/**/ |
| 45 |
if (isset ($is_s2_systematic)) /* Already cached statically? Saves time. */ |
| 46 |
{ |
| 47 |
return $is_s2_systematic; /* Filters will have already been applied here. */ |
| 48 |
} |
| 49 |
else if (!empty ($_SERVER["QUERY_STRING"]) && preg_match ("/[\?&]s2member/", $_SERVER["QUERY_STRING"]) && c_ws_plugin__s2member_utils_conds::is_site_root ($_SERVER["REQUEST_URI"])) |
| 50 |
{ |
| 51 |
return ($is_s2_systematic = apply_filters ("ws_plugin__s2member_is_s2_systematic_use_page", true, get_defined_vars ())); |
| 52 |
} |
| 53 |
else /* Otherwise, we return false ( it's NOT an s2Member® Systematic Use Page ). */ |
| 54 |
return ($is_s2_systematic = apply_filters ("ws_plugin__s2member_is_s2_systematic_use_page", false, get_defined_vars ())); |
| 55 |
} |
| 56 |
/** |
| 57 |
* Determines if the current page is WordPress® Systematic. |
| 58 |
* |
| 59 |
* @package s2Member\Systematics |
| 60 |
* @since 111002 |
| 61 |
* |
| 62 |
* @return bool True if WordPress® Systematic, else false. |
| 63 |
* |
| 64 |
* @note The results of this function are cached staticially. |
| 65 |
* Do NOT call upon this until the `init` Hook is fired. |
| 66 |
*/ |
| 67 |
public static function is_wp_systematic_use_page () |
| 68 |
{ |
| 69 |
static $is_wp_systematic; /* For optimization. */ |
| 70 |
/**/ |
| 71 |
if (isset ($is_wp_systematic)) /* Already cached statically? Saves time. */ |
| 72 |
{ |
| 73 |
return $is_wp_systematic; /* Filters will have already been applied here. */ |
| 74 |
} |
| 75 |
else if (is_admin ()) /* In the admin area? All administrational pages are considered Systematic. */ |
| 76 |
{ |
| 77 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 78 |
} |
| 79 |
else if (defined ("WP_INSTALLING") && WP_INSTALLING) /* Installing? All WordPress® installs are considered Systematic. */ |
| 80 |
{ |
| 81 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 82 |
} |
| 83 |
else if (defined ("APP_REQUEST") && APP_REQUEST) /* App request? All WordPress® app requests are considered Systematic. */ |
| 84 |
{ |
| 85 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 86 |
} |
| 87 |
else if (defined ("XMLRPC_REQUEST") && XMLRPC_REQUEST) /* An XML-RPC request? All of these are considered Systematic too. */ |
| 88 |
{ |
| 89 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 90 |
} |
| 91 |
else if ((defined ("DOING_CRON") && DOING_CRON) || strcasecmp (PHP_SAPI, "CLI") === 0) /* CLI ( command line ) or CRON job. */ |
| 92 |
{ |
| 93 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 94 |
} |
| 95 |
else if (preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH))) |
| 96 |
{ |
| 97 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 98 |
} |
| 99 |
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && !c_ws_plugin__s2member_utils_conds::is_localhost ()) |
| 100 |
{ |
| 101 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ())); |
| 102 |
} |
| 103 |
else /* Otherwise, we return false ( it's NOT a WordPress® Systematic Use Page ). */ |
| 104 |
return ($is_wp_systematic = apply_filters ("ws_plugin__s2member_is_wp_systematic_use_page", false, get_defined_vars ())); |
| 105 |
} |
| 106 |
/** |
| 107 |
* Determines if the current page is Systematic in any way. |
| 108 |
* |
| 109 |
* @package s2Member\Systematics |
| 110 |
* @since 3.5 |
| 111 |
* |
| 112 |
* @return bool True if Systematic, else false. |
| 113 |
* |
| 114 |
* @note The results of this function are cached staticially. |
| 115 |
* Do NOT call upon this until the `wp` Hook is fired. |
| 116 |
*/ |
| 117 |
public static function is_systematic_use_page () |
| 118 |
{ |
| 119 |
static $is_systematic; /* For optimization. */ |
| 120 |
/**/ |
| 121 |
if (isset ($is_systematic)) /* Already cached statically? Saves time. */ |
| 122 |
{ |
| 123 |
return $is_systematic; /* Filters will have already been applied here. */ |
| 124 |
} |
| 125 |
else if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page /* An s2Member® Systematic Use Page? */ ()) |
| 126 |
{ |
| 127 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 128 |
} |
| 129 |
else if (c_ws_plugin__s2member_systematics::is_wp_systematic_use_page /* A WordPress® Systematic Use Page? */ ()) |
| 130 |
{ |
| 131 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 132 |
} |
| 133 |
else if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ())) |
| 134 |
{ |
| 135 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 136 |
} |
| 137 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) |
| 138 |
{ |
| 139 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 140 |
} |
| 141 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) |
| 142 |
{ |
| 143 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 144 |
} |
| 145 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])) |
| 146 |
{ |
| 147 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 148 |
} |
| 149 |
else if ($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, "/") . "$/", $_SERVER["REQUEST_URI"])) |
| 150 |
{ |
| 151 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 152 |
} |
| 153 |
else /* Otherwise, we return false ( it's NOT a Systematic Use Page in any way ). */ |
| 154 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ())); |
| 155 |
} |
| 156 |
} |
| 157 |
} |
| 158 |
?> |