本文整理汇总了PHP中c_ws_plugin__s2member_utilities::callers方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utilities::callers方法的具体用法?PHP c_ws_plugin__s2member_utilities::callers怎么用?PHP c_ws_plugin__s2member_utilities::callers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utilities
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utilities::callers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query_level_access
/**
* Filter all WordPress® queries.
*
* s2Member respects the query var: `suppress_filters`.
* If you need to make a query without it being Filtered, use ``$wp_query->set ("suppress_filters", true);``.
*
* @package s2Member\Queries
* @since 3.5
*
* @attaches-to ``add_action("pre_get_posts");``
*
* @param obj $wp_query Expects ``$wp_query`` by reference, from the Filter.
* @param bool $force Optional. Defaults to false. If true, we bypass all standard conditions.
* However, s2Member will NEVER bypass `supress_filters`.
* @return null
*
* @todo For improved reliability, modify other query vars associated with exclusions/inclusions. Like `tag_slug__in`?
* See: {@link http://codex.wordpress.org/Class_Reference/WP_Query#Parameters WP_Query#Parameters}
* @todo Make it possible to force filtering, even when used in combination with Query Conditionals and ``get_posts()``, which auto-supresses.
* Or, perhaps strengthen the existing ``$force`` parameter in this regard.
*/
public static function query_level_access(&$wp_query = FALSE, $force = FALSE)
{
global $wpdb;
/* Need this global DB object reference here. */
static $initial_query = true;
/* Tracks the initial query. */
c_ws_plugin__s2member_querys::$current_wp_query =& $wp_query;
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_query_level_access", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
c_ws_plugin__s2member_querys::_query_level_access_sys($wp_query);
/* Systematics. */
/**/
remove_filter("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 100, 2);
remove_filter("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 100);
/**/
if (is_object($wpdb) && is_object($wp_query) && (($o = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]) || $force)) {
if (!is_admin() || c_ws_plugin__s2member_querys::_is_admin_ajax_search($wp_query)) {
$suppressing_filters = $wp_query->get("suppress_filters");
/* Filter suppression on? */
if (!$suppressing_filters && $force || !$suppressing_filters && in_array("all", $o) && !($initial_query && $wp_query->is_singular()) || !$suppressing_filters && (in_array("all", $o) || in_array("searches", $o)) && $wp_query->is_search() || !$suppressing_filters && (in_array("all", $o) || in_array("feeds", $o)) && $wp_query->is_feed() && !$wp_query->is_comment_feed() || !$suppressing_filters && (in_array("all", $o) || in_array("comment-feeds", $o)) && $wp_query->is_feed() && $wp_query->is_comment_feed() || $suppressing_filters !== "n/a" && (in_array("all", $o) || in_array("nav-menus", $o)) && in_array("wp_get_nav_menu_items", $callers = isset($callers) ? $callers : c_ws_plugin__s2member_utilities::callers())) {
if (!$suppressing_filters && (in_array("all", $o) || in_array("comment-feeds", $o)) && $wp_query->is_feed() && $wp_query->is_comment_feed()) {
add_filter("comment_feed_where", "c_ws_plugin__s2member_querys::_query_level_access_coms", 100, 2);
}
/**/
if ($suppressing_filters !== "n/a" && (in_array("all", $o) || in_array("nav-menus", $o))) {
/* Suppression irrelevant here. */
if (in_array("wp_get_nav_menu_items", $callers = isset($callers) ? $callers : c_ws_plugin__s2member_utilities::callers())) {
add_filter("wp_get_nav_menu_items", "c_ws_plugin__s2member_querys::_query_level_access_navs", 100);
}
}
/**/
if (is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) && ($user_id = $user->ID) || !($user = false)) {
if (!$user && ($_lwp = (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) {
$wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__in")), array($_lwp))));
$wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), array($_lwp))));
}
/**/
if (!$user && ($_dep = (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])) {
$wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__in")), array($_dep))));
$wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), array($_dep))));
}
/**/
if (is_array($_ccaps = c_ws_plugin__s2member_utils_gets::get_unavailable_singular_ids_with_ccaps($user)) && !empty($_ccaps)) {
$wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_ccaps)));
$wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_ccaps)));
}
/**/
if (is_array($_sps = c_ws_plugin__s2member_utils_gets::get_unavailable_singular_ids_with_sp()) && !empty($_sps)) {
$wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_sps)));
$wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_sps)));
}
unset($_lwp, $_dep, $_ccaps, $_sps);
/**/
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$user || !current_user_can("access_s2member_level" . $n))) {
$wp_query->set("category__in", array());
/* Include no other Categories. */
$wp_query->set("category__not_in", $_catgs = c_ws_plugin__s2member_utils_gets::get_all_category_ids());
$wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_singulars = c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($_catgs))));
$wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_singulars)));
break;
/* All Categories will be locked down. */
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (!$user || !current_user_can("access_s2member_level" . $n))) {
foreach ($_catgs = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $_catg) {
$_catgs = array_merge($_catgs, c_ws_plugin__s2member_utils_gets::get_all_child_category_ids($_catg));
}
/**/
$wp_query->set("category__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("category__in")), $_catgs)));
$wp_query->set("category__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("category__not_in")), $_catgs)));
$wp_query->set("post__not_in", array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__not_in")), $_singulars = c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($_catgs))));
$wp_query->set("post__in", array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get("post__in")), $_singulars)));
}
}
}
//.........这里部分代码省略.........
示例2: query_level_access
/**
* Filter all WordPress queries.
*
* s2Member respects the query var: `suppress_filters`.
* If you need to make a query without it being Filtered, use ``$wp_query->set ('suppress_filters', true);``.
*
* @package s2Member\Queries
* @since 3.5
*
* @attaches-to ``add_action('pre_get_posts');``
*
* @param WP_Query $wp_query Expects ``$wp_query`` by reference, from the Filter.
* @param bool $force Optional. Defaults to false. If true, we bypass all standard conditions.
* However, s2Member will NEVER bypass `supress_filters`.
*
* @todo For improved reliability, modify other query vars associated with exclusions/inclusions. Like `tag_slug__in`?
* See: {@link http://codex.wordpress.org/Class_Reference/WP_Query#Parameters WP_Query#Parameters}
*
* @todo Make it possible to force filtering, even when used in combination with Query Conditionals and ``get_posts()``, which auto-supresses.
* Or, perhaps strengthen the existing ``$force`` parameter in this regard.
*/
public static function query_level_access(&$wp_query = NULL, $force = FALSE)
{
global $wpdb;
// Global DB object reference.
static $initial_query = TRUE;
// Tracks the initial query.
c_ws_plugin__s2member_querys::$current_wp_query =& $wp_query;
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_query_level_access', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
c_ws_plugin__s2member_querys::_query_level_access_sys($wp_query);
// Systematics.
remove_filter('comment_feed_where', 'c_ws_plugin__s2member_querys::_query_level_access_coms', 100, 2);
remove_filter('wp_get_nav_menu_items', 'c_ws_plugin__s2member_querys::_query_level_access_navs', 100);
if (is_object($wpdb) && is_object($wp_query) && (($o = $GLOBALS['WS_PLUGIN__']['s2member']['o']['filter_wp_query']) || $force)) {
if (!is_admin() || c_ws_plugin__s2member_querys::_is_admin_ajax_search($wp_query)) {
$suppressing_filters = $wp_query->get('suppress_filters');
// Filter suppression on?
if (!$suppressing_filters && $force || !$suppressing_filters && in_array('all', $o) && !($initial_query && $wp_query->is_singular()) || !$suppressing_filters && (in_array('all', $o) || in_array('searches', $o)) && $wp_query->is_search() || !$suppressing_filters && (in_array('all', $o) || in_array('feeds', $o)) && $wp_query->is_feed() && !$wp_query->is_comment_feed() || !$suppressing_filters && (in_array('all', $o) || in_array('comment-feeds', $o)) && $wp_query->is_feed() && $wp_query->is_comment_feed() || $suppressing_filters !== 'n/a' && (in_array('all', $o) || in_array('nav-menus', $o)) && in_array('wp_get_nav_menu_items', $callers = isset($callers) ? $callers : c_ws_plugin__s2member_utilities::callers())) {
if (!$suppressing_filters && (in_array('all', $o) || in_array('comment-feeds', $o)) && $wp_query->is_feed() && $wp_query->is_comment_feed()) {
add_filter('comment_feed_where', 'c_ws_plugin__s2member_querys::_query_level_access_coms', 100, 2);
}
if ($suppressing_filters !== 'n/a' && (in_array('all', $o) || in_array('nav-menus', $o))) {
// Suppression irrelevant here.
if (in_array('wp_get_nav_menu_items', $callers = isset($callers) ? $callers : c_ws_plugin__s2member_utilities::callers())) {
add_filter('wp_get_nav_menu_items', 'c_ws_plugin__s2member_querys::_query_level_access_navs', 100);
}
}
if ($suppressing_filters !== 'n/a' && (in_array('all', $o) || in_array('pages', $o))) {
add_filter('wp_list_pages_excludes', 'c_ws_plugin__s2member_querys::_query_level_access_list_pages', 100);
}
if (is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) && ($user_id = $user->ID) || !($user = FALSE)) {
$bbpress_restrictions_enable = apply_filters('ws_plugin__s2member_bbpress_restrictions_enable', TRUE);
$bbpress_installed = c_ws_plugin__s2member_utils_conds::bbp_is_installed();
// bbPress is installed?
$bbpress_forum_post_type = $bbpress_installed ? bbp_get_forum_post_type() : '';
// Acquire the current post type for forums.
$bbpress_topic_post_type = $bbpress_installed ? bbp_get_topic_post_type() : '';
// Acquire the current post type for topics.
if (!$user && ($_lwp = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'])) {
$wp_query->set('post__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__in')), array($_lwp))));
$wp_query->set('post__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__not_in')), array($_lwp))));
}
if (!$user && ($_dep = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page'])) {
$wp_query->set('post__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__in')), array($_dep))));
$wp_query->set('post__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__not_in')), array($_dep))));
}
if (is_array($_ccaps = c_ws_plugin__s2member_utils_gets::get_unavailable_singular_ids_with_ccaps($user)) && !empty($_ccaps)) {
$wp_query->set('post__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__in')), $_ccaps)));
$wp_query->set('post__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__not_in')), $_ccaps)));
}
if (is_array($_sps = c_ws_plugin__s2member_utils_gets::get_unavailable_singular_ids_with_sp()) && !empty($_sps)) {
$wp_query->set('post__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__in')), $_sps)));
$wp_query->set('post__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__not_in')), $_sps)));
}
unset($_lwp, $_dep, $_ccaps, $_sps);
// A little housekeeping here. Ditch these temporary variables.
for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] === 'all' && (!$user || !current_user_can('access_s2member_level' . $n))) {
$wp_query->set('category__in', array());
// Include no other Categories.
$wp_query->set('category__not_in', $_catgs = c_ws_plugin__s2member_utils_gets::get_all_category_ids());
$wp_query->set('post__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__not_in')), $_singulars = c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($_catgs))));
$wp_query->set('post__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__in')), $_singulars)));
break;
// All Categories will be locked down.
} else {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] && (!$user || !current_user_can('access_s2member_level' . $n))) {
foreach ($_catgs = preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs']) as $_catg) {
$_catgs = array_merge($_catgs, c_ws_plugin__s2member_utils_gets::get_all_child_category_ids($_catg));
}
$wp_query->set('category__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('category__in')), $_catgs)));
$wp_query->set('category__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('category__not_in')), $_catgs)));
$wp_query->set('post__not_in', array_unique(array_merge(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__not_in')), $_singulars = c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($_catgs))));
$wp_query->set('post__in', array_unique(array_diff(c_ws_plugin__s2member_utils_arrays::force_integers((array) $wp_query->get('post__in')), $_singulars)));
}
//.........这里部分代码省略.........