| 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® content ). |
| 32 |
* |
| 33 |
* @package s2Member\Security |
| 34 |
* @since 3.5 |
| 35 |
* |
| 36 |
* @attaches-to ``add_action("wp");`` |
| 37 |
* |
| 38 |
* @return null May redirect a browser *(exiting script execution)*, when/if content is NOT available to the current User/Member. |
| 39 |
*/ |
| 40 |
public static function security_gate () /* s2Member's Security Gate. */ |
| 41 |
{ |
| 42 |
do_action ("ws_plugin__s2member_before_security_gate", get_defined_vars ()); |
| 43 |
/**/ |
| 44 |
if (is_category ()) /* Categories & other inclusives. */ |
| 45 |
c_ws_plugin__s2member_catgs::check_catg_level_access (); |
| 46 |
/**/ |
| 47 |
else if (is_tag ()) /* Post/Page Tags & other inclusives. */ |
| 48 |
c_ws_plugin__s2member_ptags::check_ptag_level_access (); |
| 49 |
/**/ |
| 50 |
else if (is_single ()) /* All Posts & other inclusives. */ |
| 51 |
c_ws_plugin__s2member_posts::check_post_level_access (); |
| 52 |
/**/ |
| 53 |
else if (is_page ()) /* All Pages & other inclusives. */ |
| 54 |
c_ws_plugin__s2member_pages::check_page_level_access (); |
| 55 |
/**/ |
| 56 |
else /* Else, we simply look at URIs & other inclusives. */ |
| 57 |
c_ws_plugin__s2member_ruris::check_ruri_level_access (); |
| 58 |
/**/ |
| 59 |
do_action ("ws_plugin__s2member_after_security_gate", get_defined_vars ()); |
| 60 |
/**/ |
| 61 |
return; /* Return for uniformity. */ |
| 62 |
} |
| 63 |
/** |
| 64 |
* s2Member's Security Gate ( protects WordPress® queries ). |
| 65 |
* |
| 66 |
* @package s2Member\Security |
| 67 |
* @since 3.5 |
| 68 |
* |
| 69 |
* @attaches-to ``add_action("pre_get_posts");`` |
| 70 |
* |
| 71 |
* @param obj $wp_query Global ``$wp_query``, by reference. |
| 72 |
* @return null May filter WordPress® queries, by hiding protected content which is NOT available to the current User/Member. |
| 73 |
*/ |
| 74 |
public static function security_gate_query (&$wp_query = FALSE) /* s2Member's Security Gate. */ |
| 75 |
{ |
| 76 |
do_action ("ws_plugin__s2member_before_security_gate_query", get_defined_vars ()); |
| 77 |
/**/ |
| 78 |
c_ws_plugin__s2member_querys::query_level_access ($wp_query); /* By reference. */ |
| 79 |
/**/ |
| 80 |
do_action ("ws_plugin__s2member_after_security_gate_query", get_defined_vars ()); |
| 81 |
/**/ |
| 82 |
return; /* Return for uniformity. */ |
| 83 |
} |
| 84 |
} |
| 85 |
} |
| 86 |
?> |