Habari\Tag::rewrite_tag_exists PHP Метод

rewrite_tag_exists() публичный статический Метод

Check if a tag exists on a published post, to see if we should match this rewrite rule.
public static rewrite_tag_exists ( $rule, $slug, $parameters ) : boolean
Результат boolean Whether the tag exists on a published post.
    public static function rewrite_tag_exists($rule, $slug, $parameters)
    {
        $tags = explode(' ', $rule->named_arg_values['tag']);
        $tags = array_map('trim', $tags, array_fill(0, count($tags), '-'));
        $tags = array_map(Method::create('\\Habari\\Tags', 'get_one'), $tags);
        $initial_tag_count = count($tags);
        $tags = array_filter($tags);
        // Are all of the tags we asked for actual tags on this site?
        if (count($tags) != $initial_tag_count) {
            return false;
        }
        $tag_params = array();
        foreach ($tags as $tag) {
            $tag_params[] = $tag->term_display;
        }
        return $tag instanceof Term && Posts::count_by_tag($tag_params, Post::status('published')) > 0;
    }