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;
}