| 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 Page ID, or URI, is Systematic. |
| 32 |
* |
| 33 |
* @package s2Member\Systematics |
| 34 |
* @since 3.5 |
| 35 |
* |
| 36 |
* @param int|str $page_id Optional. A numeric Page ID in WordPress®. |
| 37 |
* @param str $uri Optional. A request URI to test against. |
| 38 |
* @return bool True if Systematic, else false. |
| 39 |
* |
| 40 |
* @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page? |
| 41 |
* Don't think this is required though; as it's already handled in other areas, correct? |
| 42 |
*/ |
| 43 |
public static function is_systematic_use_specific_page ($page_id = FALSE, $uri = FALSE) |
| 44 |
{ |
| 45 |
if ($uri && strpos ($uri, "/wp-admin/") !== false) /* In the admin area? - All admin pages are considered Systematic. */ |
| 46 |
{ |
| 47 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 48 |
} |
| 49 |
else if ($uri && (preg_match ("/\/(wp-app|wp-signup|wp-register|wp-activate|wp-login|xmlrpc)\.php/", $uri) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(" . preg_quote (BP_REGISTER_SLUG, "/") . "|" . preg_quote (BP_ACTIVATION_SLUG, "/") . ")/", $uri)))) |
| 50 |
{ |
| 51 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 52 |
} |
| 53 |
else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) |
| 54 |
{ |
| 55 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 56 |
} |
| 57 |
else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) |
| 58 |
{ |
| 59 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 60 |
} |
| 61 |
else if ($uri && $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, "/") . "$/", $uri)) |
| 62 |
{ |
| 63 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 64 |
} |
| 65 |
else if ($page_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]) |
| 66 |
{ |
| 67 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 68 |
} |
| 69 |
else if ($uri && ($query = @parse_url ($uri, PHP_URL_QUERY)) && strpos ($query, "s2member") === 0 && c_ws_plugin__s2member_utils_conds::is_site_root ($uri)) |
| 70 |
{ |
| 71 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ())); |
| 72 |
} |
| 73 |
else /* Otherwise, we return false ( it's NOT a Systematic ). */ |
| 74 |
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ())); |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
?> |