当前位置: 首页>>代码示例>>PHP>>正文


PHP cat_is_ancestor_of函数代码示例

本文整理汇总了PHP中cat_is_ancestor_of函数的典型用法代码示例。如果您正苦于以下问题:PHP cat_is_ancestor_of函数的具体用法?PHP cat_is_ancestor_of怎么用?PHP cat_is_ancestor_of使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cat_is_ancestor_of函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_catg_level_access

 /**
  * Handles Category Level Access *( for current page )*.
  *
  * @package s2Member\Categories
  * @since 3.5
  *
  * @return null Or exits script execution after redirection.
  */
 public static function check_catg_level_access()
 {
     global $post;
     /* ``get_the_ID()`` is NOT available outside The Loop. */
     /**/
     do_action("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars());
     /**/
     $excluded = apply_filters("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars());
     /**/
     if (!$excluded && is_category() && ($cat_id = get_query_var("cat")) && ($cat_id = (int) $cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
         if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page()) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
             /* Current User's object. */
             /**/
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level0"))) {
                 c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("catg", $cat_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit;
             } else {
                 if (!c_ws_plugin__s2member_systematics::is_systematic_use_page()) {
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) {
                             c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit;
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array($cat_id, $catgs = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) {
                                 c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit;
                             } else {
                                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) {
                                     /* Check Category ancestry. */
                                     foreach (preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg) {
                                         if ($catg && cat_is_ancestor_of($catg, $cat_id) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) {
                                             c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
                             /* URIs configured at this Level? */
                             /**/
                             foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
                                 if ($str && preg_match("/" . preg_quote($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) {
                                     c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit;
                                 }
                             }
                         }
                     }
                 }
             }
             /**/
             do_action("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars());
         }
     }
     /**/
     do_action("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars());
     /**/
     return;
     /* For uniformity. */
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:68,代码来源:catgs.inc.php

示例2: wp_insert_category

function wp_insert_category($catarr)
{
    global $wpdb;
    extract($catarr, EXTR_SKIP);
    if (trim($cat_name) == '') {
        return 0;
    }
    $cat_ID = (int) $cat_ID;
    // Are we updating or creating?
    if (!empty($cat_ID)) {
        $update = true;
    } else {
        $update = false;
    }
    $name = $cat_name;
    $description = $category_description;
    $slug = $category_nicename;
    $parent = $category_parent;
    $parent = (int) $parent;
    if (empty($parent) || !category_exists($parent) || $cat_ID && cat_is_ancestor_of($cat_ID, $parent)) {
        $parent = 0;
    }
    $args = compact('name', 'slug', 'parent', 'description');
    if ($update) {
        $cat_ID = wp_update_term($cat_ID, 'category', $args);
    } else {
        $cat_ID = wp_insert_term($cat_name, 'category', $args);
    }
    if (is_wp_error($cat_ID)) {
        return 0;
    }
    return $cat_ID['term_id'];
}
开发者ID:helmonaut,项目名称:owb-mirror,代码行数:33,代码来源:taxonomy.php

示例3: get_sports_list

/**
 * Returns sports posts without thumbnails as a block grid
**/
function get_sports_list()
{
    $exclude_ids = array($GLOBALS['excluded_sports_1'], $GLOBALS['excluded_sports_2']);
    $args = array('posts_per_page' => 6, 'category_name' => 'sports', 'post__not_in' => $exclude_ids);
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        echo '<div class="row medium-up-2 large-up-2">';
        while ($the_query->have_posts()) {
            $the_query->the_post();
            // List element
            echo '<div class="column"><h6>';
            // Subcategory
            $category = get_the_category();
            foreach (get_the_category() as $childcat) {
                if (cat_is_ancestor_of(13, $childcat)) {
                    echo '<a class="subcategory" href="' . get_category_link($childcat->cat_ID) . '">';
                    echo $childcat->cat_name . '</a>';
                    echo ' · ';
                }
            }
            // Link
            echo '<a href="' . get_permalink(get_post()->ID) . '" title="' . esc_attr(get_post()->post_title) . '">';
            // Title
            echo get_the_title(get_post()->ID);
            echo '</a></h6></div>';
        }
        echo '</div>';
    } else {
        // no posts found
    }
    wp_reset_postdata();
}
开发者ID:msuexponent,项目名称:frontend,代码行数:35,代码来源:sports.php

示例4: myTemplateSelect

function myTemplateSelect()
{
    if (is_category() && !is_feed()) {
        if (is_category(get_cat_id('projekt')) || cat_is_ancestor_of(get_cat_id('projekt'), get_query_var('cat'))) {
            load_template(STYLESHEETPATH . '/category-projekt.php');
            exit;
        }
    }
}
开发者ID:ayond,项目名称:accglas,代码行数:9,代码来源:functions.php

示例5: check_specific_catg_level_access

 /**
  * Handles Category Level Access *( for specific Categories )*.
  *
  * @package s2Member\Categories
  * @since 3.5
  *
  * @param int|str $cat_id Numeric Category ID.
  * @param bool $check_user Test permissions against the current User? Defaults to true.
  * @return null|array Non-empty array ( with details ) if access is denied, else null if access is allowed.
  */
 public static function check_specific_catg_level_access($cat_id = FALSE, $check_user = TRUE)
 {
     do_action("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars());
     /**/
     $excluded = apply_filters("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars());
     /**/
     if (!$excluded && is_numeric($cat_id) && ($cat_id = (int) $cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
         $cat_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_category_link($cat_id));
         /* Get a full valid URI for this Category. */
         /**/
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(null, $cat_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
             /* Current User's object. */
             /**/
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0"))) {
                 return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(null, $cat_uri)) {
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                             return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array($cat_id, $catgs = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                 return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                             } else {
                                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) {
                                     /* Check Category ancestry. */
                                     foreach (preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg) {
                                         if ($catg && cat_is_ancestor_of($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                             return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
                             /* URIs configured at this Level? */
                             /**/
                             foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
                                 if ($str && preg_match("/" . preg_quote($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                     return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             /**/
             do_action("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars());
         }
     }
     /**/
     return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars());
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:67,代码来源:catgs-sp.inc.php

示例6: web589_get_parrents

function web589_get_parrents($sep)
{
    if (is_category()) {
        $par = get_ancestors(get_query_var('cat'), 'category');
        $num = count($par);
        for ($i = $num; $i >= 1; $i--) {
            $j = $i - 1;
            $id = $par[$j];
            $array[get_category_link($id)] = get_cat_name($id);
        }
        $array[get_category_link(get_query_var('cat'))] = get_cat_name(get_query_var('cat'));
    }
    if (is_page()) {
        $par = get_ancestors(get_the_ID(), 'page');
        $num = count($par);
        for ($i = $num; $i >= 1; $i--) {
            $j = $i - 1;
            $id = $par[$j];
            $page = get_page($id);
            $array[get_page_link($id)] = $page->post_title;
        }
        $cur_page = get_page(get_the_ID());
        $array[get_page_link(get_the_ID())] = $cur_page->post_title;
    }
    if (is_single()) {
        $cats = get_the_category();
        foreach ($cats as $cat) {
            foreach ($cats as $child) {
                if (!cat_is_ancestor_of($cat, $child)) {
                    $id = $cat->cat_ID;
                }
            }
        }
        $par = get_ancestors($id, 'category');
        $num = count($par);
        for ($i = $num; $i >= 1; $i--) {
            $j = $i - 1;
            $p_id = $par[$j];
            $array[get_category_link($p_id)] = get_cat_name($p_id);
        }
        $array[get_category_link($id)] = get_cat_name($id);
        $array[get_permalink()] = get_the_title();
    }
    if (is_tag()) {
        $tag = get_tag(get_query_var('tag_id'));
        $array[] = $tag->name;
    }
    if (is_day() || is_month() || is_year()) {
        $array[] = wp_title('', false);
    }
    return $array;
}
开发者ID:robotzhang,项目名称:myblog,代码行数:52,代码来源:functions.php

示例7: return_child_cat

function return_child_cat($parentslug, $link = NULL)
{
    $catslug = get_category_by_slug($parentslug);
    foreach (get_the_category() as $childcat) {
        if (cat_is_ancestor_of($catslug->term_id, $childcat)) {
            if ($link == NULL) {
                return $childcat->cat_name;
            } else {
                return '<a href="' . get_category_link($childcat->term_id) . '">' . $childcat->cat_name . '</a>';
            }
        }
    }
}
开发者ID:acutedeveloper,项目名称:tapestry-development,代码行数:13,代码来源:functions.php

示例8: wp_insert_category

function wp_insert_category($catarr, $wp_error = false) {
	$cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
	$cat_arr = wp_parse_args($cat_arr, $cat_defaults);
	extract($catarr, EXTR_SKIP);

	if ( trim( $cat_name ) == '' ) {
		if ( ! $wp_error )
			return 0;
		else
			return new WP_Error( 'cat_name', __('You did not enter a category name.') );
	}

	$cat_ID = (int) $cat_ID;

	// Are we updating or creating?
	if ( !empty ($cat_ID) )
		$update = true;
	else
		$update = false;

	$name = $cat_name;
	$description = $category_description;
	$slug = $category_nicename;
	$parent = $category_parent;

	$parent = (int) $parent;
	if ( $parent < 0 )
		$parent = 0;

	if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
		$parent = 0;

	$args = compact('name', 'slug', 'parent', 'description');

	if ( $update )
		$cat_ID = wp_update_term($cat_ID, 'category', $args);
	else
		$cat_ID = wp_insert_term($cat_name, 'category', $args);

	if ( is_wp_error($cat_ID) ) {
		if ( $wp_error )
			return $cat_ID;
		else
			return 0;
	}

	return $cat_ID['term_id'];
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:48,代码来源:taxonomy.php

示例9: check_catg_level_access

 /**
  * Handles Category Level Access *(for current page)*.
  *
  * @package s2Member\Categories
  * @since 3.5
  *
  * @return null Or exits script execution after redirection.
  */
 public static function check_catg_level_access()
 {
     global $post;
     // ``get_the_ID()`` is NOT available outside The Loop.
     do_action('ws_plugin__s2member_before_check_catg_level_access', get_defined_vars());
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     $excluded = apply_filters('ws_plugin__s2member_check_catg_level_access_excluded', FALSE, get_defined_vars());
     if (!$excluded && is_category() && ($cat_id = get_query_var('cat')) && ($cat_id = (int) $cat_id) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page()) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/' . $ci, $_SERVER['REQUEST_URI']) && c_ws_plugin__s2member_no_cache::no_cache_constants('restricted') && (!$user || !$user->has_cap('access_s2member_level0'))) {
                 c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('catg', $cat_id, 'level', 0, $_SERVER['REQUEST_URI'], 'sys') . exit;
             } else {
                 if (!c_ws_plugin__s2member_systematics::is_systematic_use_page()) {
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] === 'all' && c_ws_plugin__s2member_no_cache::no_cache_constants('restricted') && (!$user || !$user->has_cap('access_s2member_level' . $n))) {
                             c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('catg', $cat_id, 'level', $n, $_SERVER['REQUEST_URI']) . exit;
                         } else {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] && in_array($cat_id, $catgs = preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'])) && c_ws_plugin__s2member_no_cache::no_cache_constants('restricted') && (!$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('catg', $cat_id, 'level', $n, $_SERVER['REQUEST_URI']) . exit;
                             } else {
                                 if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs']) {
                                     foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs']) as $catg) {
                                         if ($catg && cat_is_ancestor_of($catg, $cat_id) && c_ws_plugin__s2member_no_cache::no_cache_constants('restricted') && (!$user || !$user->has_cap('access_s2member_level' . $n))) {
                                             c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('catg', $cat_id, 'level', $n, $_SERVER['REQUEST_URI']) . exit;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
                             foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
                                 if ($str && preg_match('/' . preg_quote($str, '/') . '/' . $ci, $_SERVER['REQUEST_URI']) && c_ws_plugin__s2member_no_cache::no_cache_constants('restricted') && (!$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('catg', $cat_id, 'level', $n, $_SERVER['REQUEST_URI'], 'ruri') . exit;
                                 }
                             }
                         }
                     }
                 }
             }
             do_action('ws_plugin__s2member_during_check_catg_level_access', get_defined_vars());
         }
     }
     do_action('ws_plugin__s2member_after_check_catg_level_access', get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:55,代码来源:catgs.inc.php

示例10: check_specific_catg_level_access

 /**
  * Handles Category Level Access *(for specific Categories)*.
  *
  * @package s2Member\Categories
  * @since 3.5
  *
  * @param int|string $cat_id Numeric Category ID.
  * @param bool       $check_user Test permissions against the current User? Defaults to true.
  *
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_catg_level_access($cat_id = '', $check_user = TRUE)
 {
     do_action('ws_plugin__s2member_before_check_specific_catg_level_access', get_defined_vars());
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     $excluded = apply_filters('ws_plugin__s2member_check_specific_catg_level_access_excluded', FALSE, get_defined_vars());
     if (!$excluded && is_numeric($cat_id) && ($cat_id = (int) $cat_id) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         $cat_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_category_link($cat_id));
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(NULL, $cat_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/' . $ci, $cat_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level0'))) {
                 return apply_filters('ws_plugin__s2member_check_specific_catg_level_access', array('s2member_level_req' => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(NULL, $cat_uri)) {
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                             return apply_filters('ws_plugin__s2member_check_specific_catg_level_access', array('s2member_level_req' => $n), get_defined_vars());
                         } else {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] && in_array($cat_id, $catgs = preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'])) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_catg_level_access', array('s2member_level_req' => $n), get_defined_vars());
                             } else {
                                 if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs']) {
                                     foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs']) as $catg) {
                                         if ($catg && cat_is_ancestor_of($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                             return apply_filters('ws_plugin__s2member_check_specific_catg_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
                             foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
                                 if ($str && preg_match('/' . preg_quote($str, '/') . '/' . $ci, $cat_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_catg_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             do_action('ws_plugin__s2member_during_check_specific_catg_level_access', get_defined_vars());
         }
     }
     return apply_filters('ws_plugin__s2member_check_specific_catg_level_access', NULL, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:57,代码来源:catgs-sp.inc.php

示例11: date

        ?>
</p>
<footer>
<span class="date">(<?php 
        echo date("Y/m/d", strtotime($item->post_date));
        ?>
)</span>
<?php 
        $category = get_the_category($item->ID);
        $color = "";
        foreach ($category as $key => $cat) {
            if ($cosmeCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($cosmeCat->cat_ID, $cat->cat_ID)) {
                $color = "yellow";
            } elseif ($troubleCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($troubleCat->cat_ID, $cat->cat_ID)) {
                $color = "blue";
            } elseif ($componentCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($componentCat->cat_ID, $cat->cat_ID)) {
                $color = "purple";
            }
        }
        ?>
<div class="tagMark <?php 
        echo $color;
        ?>
"><div><span><?php 
        if (isset($category[0])) {
            echo $category[0]->cat_name;
        }
        ?>
</span></div></div>
</footer>
</a></li>
开发者ID:nil-vn,项目名称:beautysite,代码行数:31,代码来源:content.php

示例12: wpex_entry_thumbnail

wpex_entry_thumbnail();
?>
	<h2><a href="<?php 
the_permalink();
?>
" title="<?php 
the_title();
?>
"><?php 
the_title();
?>
</a></h2>
	<div class="entry-text">
		<p>Style: <?php 
foreach (get_the_category() as $childcat) {
    if (cat_is_ancestor_of(186, $childcat)) {
        echo '<a href="' . get_category_link($childcat->cat_ID) . '">';
        echo $childcat->cat_name . '</a>';
    }
}
?>
</p>
        
        
        <p><?php 
the_tags('Mood: ', ', ');
?>
</p>
	</div><!-- /entry-text -->
	<?php 
wpex_hook_entry_bottom();
开发者ID:peternem,项目名称:vlt-wp,代码行数:31,代码来源:entry-inspiration.php

示例13: is_category_or_sub

 function is_category_or_sub($cat_id = 0)
 {
     foreach (get_the_category() as $cat) {
         if ($cat_id == $cat->cat_ID || cat_is_ancestor_of($cat_id, $cat)) {
             return true;
         }
     }
     return false;
 }
开发者ID:JPBetley,项目名称:cirofordelaware,代码行数:9,代码来源:functions.php

示例14: events_get_listview_past_link

 function events_get_listview_past_link()
 {
     global $spEvents;
     $mainEventsCat = $spEvents->eventCategory();
     $currentCat = get_query_var('cat');
     $cat_id = cat_is_ancestor_of($mainEventsCat, $currentCat) ? $currentCat : $mainEventsCat;
     $link = get_category_link($cat_id);
     if ('' == get_option('permalink_structure') || 'off' == eventsGetOptionValue('useRewriteRules', 'on')) {
         return add_query_arg(array('eventDisplay' => 'past'), $link);
     } else {
         return trailingslashit($link) . 'past';
     }
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:13,代码来源:template-tags.php

示例15: pinboard_post_is_full_width

/**
 * Checks if a post is displayed on one column in full width
 *
 * @since Pinboard 1.0.6
 */
function pinboard_post_is_full_width() {
	global $pinboard_page_template;
	if( ( 'full-width' != pinboard_get_option( 'layout' ) && 'template-blog-full-width.php' != $pinboard_page_template && 'template-blog-four-col.php' != $pinboard_page_template && ! is_category( pinboard_get_option( 'portfolio_cat' ) ) && ! ( is_category() && cat_is_ancestor_of( pinboard_get_option( 'portfolio_cat' ), get_queried_object() ) ) ) || pinboard_is_teaser() )
		return false;
	return true;	
}
开发者ID:ramo01,项目名称:1kapp,代码行数:11,代码来源:functions.php


注:本文中的cat_is_ancestor_of函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。