| 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 |
public static function is_systematic_use_page () |
| 39 |
{ |
| 40 |
static $is_systematic; /* For optimization. */ |
| 41 |
/**/ |
| 42 |
if (isset ($is_systematic)) /* Already cached? This saves time. */ |
| 43 |
{ |
| 44 |
return $is_systematic; /* Filters will have already been applied. */ |
| 45 |
} |
| 46 |
else if (is_admin ()) /* In the admin area? - All administrational pages are considered Systematic. */ |
| 47 |
{ |
| 48 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 49 |
} |
| 50 |
else if (preg_match ("/^CLI$/i", PHP_SAPI)) /* CLI = Command Line. Normally indicates a running cron job. */ |
| 51 |
{ |
| 52 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 53 |
} |
| 54 |
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && stripos ($_SERVER["HTTP_HOST"], "localhost") === false && (!defined ("LOCALHOST") || !LOCALHOST)) |
| 55 |
{ |
| 56 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 57 |
} |
| 58 |
else if (preg_match ("/\/(wp-app|wp-signup|wp-register|wp-activate|wp-login|xmlrpc)\.php/", $_SERVER["REQUEST_URI"]) || (defined ("BP_VERSION") && (bp_is_register_page () || bp_is_activation_page ()))) |
| 59 |
{ |
| 60 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 61 |
} |
| 62 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])) |
| 63 |
{ |
| 64 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 65 |
} |
| 66 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) |
| 67 |
{ |
| 68 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 69 |
} |
| 70 |
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"])) |
| 71 |
{ |
| 72 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 73 |
} |
| 74 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])) |
| 75 |
{ |
| 76 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 77 |
} |
| 78 |
else if (!empty ($_SERVER["QUERY_STRING"]) && strpos ($_SERVER["QUERY_STRING"], "s2member") === 0 && c_ws_plugin__s2member_utils_conds::is_site_root ($_SERVER["REQUEST_URI"])) |
| 79 |
{ |
| 80 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); |
| 81 |
} |
| 82 |
else /* Otherwise, we return false ( it's NOT Systematic ). */ |
| 83 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ())); |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
?> |