| 1 |
<?php |
| 2 |
/** |
| 3 |
* s2Member's Security Gate. |
| 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\Security |
| 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_security")) |
| 21 |
{ |
| 22 |
/** |
| 23 |
* s2Member's Security Gate. |
| 24 |
* |
| 25 |
* @package s2Member\Security |
| 26 |
* @since 3.5 |
| 27 |
*/ |
| 28 |
class c_ws_plugin__s2member_security |
| 29 |
{ |
| 30 |
/** |
| 31 |
* s2Member's Security Gate ( protects WordPress® queries ). |
| 32 |
* |
| 33 |
* @package s2Member\Security |
| 34 |
* @since 3.5 |
| 35 |
* |
| 36 |
* @attaches-to: ``add_action("pre_get_posts");`` |
| 37 |
* |
| 38 |
* @param obj $wp_query Global instance of ``$wp_query``, by reference. |
| 39 |
* @return null |
| 40 |
*/ |
| 41 |
public static function security_gate_query (&$wp_query = FALSE) |
| 42 |
{ |
| 43 |
do_action ("ws_plugin__s2member_before_security_gate_query", get_defined_vars ()); |
| 44 |
/**/ |
| 45 |
c_ws_plugin__s2member_querys::query_level_access ($wp_query); /* By reference. */ |
| 46 |
/**/ |
| 47 |
do_action ("ws_plugin__s2member_after_security_gate_query", get_defined_vars ()); |
| 48 |
/**/ |
| 49 |
return; /* Return for uniformity. */ |
| 50 |
} |
| 51 |
/** |
| 52 |
* s2Member's Security Gate ( protects WordPress® content ). |
| 53 |
* |
| 54 |
* @package s2Member\Security |
| 55 |
* @since 3.5 |
| 56 |
* |
| 57 |
* @attaches-to: ``add_action("template_redirect");`` |
| 58 |
* |
| 59 |
* @return null |
| 60 |
*/ |
| 61 |
public static function security_gate () /* s2Member's Security Gate. */ |
| 62 |
{ |
| 63 |
do_action ("ws_plugin__s2member_before_security_gate", get_defined_vars ()); |
| 64 |
/* |
| 65 |
Category Level Restrictions ( inclusively ). |
| 66 |
- Including URI protections too. |
| 67 |
*/ |
| 68 |
if (is_category ()) /* Categories. */ |
| 69 |
c_ws_plugin__s2member_catgs::check_catg_level_access (); |
| 70 |
/* |
| 71 |
Tag Level Restrictions ( inclusively ). |
| 72 |
- Including URI protections too. |
| 73 |
*/ |
| 74 |
else if (is_tag ()) /* Tags. */ |
| 75 |
c_ws_plugin__s2member_ptags::check_ptag_level_access (); |
| 76 |
/* |
| 77 |
Post Level Restrictions ( inclusively, even Custom Post Types ). |
| 78 |
- Including Category, Tag, URI, Capability, and Specifics too. |
| 79 |
*/ |
| 80 |
else if (is_single ()) /* Posts & Custom Types. */ |
| 81 |
c_ws_plugin__s2member_posts::check_post_level_access (); |
| 82 |
/* |
| 83 |
Page Level Restrictions ( inclusively ). |
| 84 |
- Including Category, Tag, URI, Capability, and Specifics too. |
| 85 |
*/ |
| 86 |
else if (is_page ()) /* Pages. */ |
| 87 |
c_ws_plugin__s2member_pages::check_page_level_access (); |
| 88 |
/* |
| 89 |
Else just apply URI Level Restrictions ( only URIs ). |
| 90 |
*/ |
| 91 |
else /* This optimizes things nicely. */ |
| 92 |
c_ws_plugin__s2member_ruris::check_ruri_level_access (); |
| 93 |
/* |
| 94 |
Hook after Security Gate. |
| 95 |
*/ |
| 96 |
do_action ("ws_plugin__s2member_after_security_gate", get_defined_vars ()); |
| 97 |
/**/ |
| 98 |
return; /* Return for uniformity. */ |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
?> |