本文整理汇总了PHP中Tags::vocabulary方法的典型用法代码示例。如果您正苦于以下问题:PHP Tags::vocabulary方法的具体用法?PHP Tags::vocabulary怎么用?PHP Tags::vocabulary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::vocabulary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_ajax_auto_tags
/**
* Respond to Javascript callbacks
* The name of this method is action_ajax_ followed by what you passed to the context parameter above.
*/
public function action_ajax_auto_tags( $handler )
{
$selected = array();
if( isset( $handler->handler_vars['selected'] ) ) {
$selected = Utils::single_array( $handler->handler_vars['selected'] );
}
if( isset( $handler->handler_vars['term'] ) && MultiByte::strlen( $handler->handler_vars['term'] ) ) {
$search = $handler->handler_vars['term'] . '%';
$tags = new Terms( DB::get_results( "SELECT * FROM {terms} WHERE vocabulary_id = :vid and LOWER(term_display) LIKE LOWER(:crit) ORDER BY term_display ASC", array( 'vid' => Tags::vocabulary()->id, 'crit' => $search ), 'Term' ) );
}
else {
$tags = Tags::vocabulary()->get_tree( 'term_display ASC' );
}
$resp = array();
foreach ( $tags as $tag ) {
$resp[] = MultiByte::strpos( $tag->term_display, ',' ) === false ? $tag->term_display : $tag->tag_text_searchable;
}
if( count( $selected ) ) {
$resp = array_diff($resp, $selected );
}
// Send the response
// $ar = new AjaxResponse();
// $ar->data = $resp;
// $ar->out();
echo json_encode( $resp );
}
示例2: get_dashboard
/**
* Handles get requests for the dashboard
* @todo update check should probably be cron'd and cached, not re-checked every load
*/
public function get_dashboard()
{
// Not sure how best to determine this yet, maybe set an option on install, maybe do this:
$firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
if ($firstpostdate) {
$this->theme->active_time = DateTime::create($firstpostdate);
}
// check to see if we have updates to display
$this->theme->updates = Options::get('updates_available', array());
// collect all the stats we display on the dashboard
$user = User::identify();
$this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'post_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total('approved', false), 'tag_count' => Tags::vocabulary()->count_total(), 'user_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('draft'), 'user_id' => $user->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total('unapproved', false) : Comments::count_by_author(User::identify()->id, Comment::status('unapproved')), 'spam_comment_count' => $user->can('manage_all_comments') ? Comments::count_total('spam', false) : Comments::count_by_author($user->id, Comment::status('spam')), 'user_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => $user->id)));
// check for first run
$u = User::identify();
$uinfo = $u->info;
if (!isset($uinfo->experience_level)) {
$this->theme->first_run = true;
$u->info->experience_level = 'user';
$u->info->commit();
} else {
$this->theme->first_run = false;
}
$this->get_additem_form();
Stack::add('admin_header_javascript', 'dashboard-js');
$this->display('dashboard');
}
示例3: add_template_vars
/**
* Add additional template variables to the template output.
*
* This function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
parent::add_template_vars();
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get('page_list'));
}
if (!$this->template_engine->assigned('asides')) {
//For Asides loop in sidebar.php
$this->assign('asides', Posts::get('asides'));
}
if (!$this->template_engine->assigned('recent_comments')) {
//for recent comments loop in sidebar.php
$this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
}
if (!$this->template_engine->assigned('more_posts')) {
//Recent posts in sidebar.php
//visiting page/2 will offset to the next page of posts in the footer /3 etc
$pagination = Options::get('pagination');
$this->assign('more_posts', Posts::get(array('content_type' => 'entry', 'status' => 'published', 'vocabulary' => array('tags:not:tag' => 'asides'), 'offset' => $pagination * $this->page, 'limit' => 5)));
}
if (!$this->template_engine->assigned('all_tags')) {
// List of all the tags
$this->assign('all_tags', Tags::vocabulary()->get_tree());
}
if (!$this->template_engine->assigned('all_entries')) {
// List of all the entries
$this->assign('all_entries', Posts::get(array('content_type' => 'entry', 'status' => 'published', 'nolimit' => 1)));
}
}
示例4: test_create_post
public function test_create_post()
{
$tags = array('one', 'two', 'THREE');
$params = array(
'title' => 'A post title',
'content' => 'Some great content. Really.',
'user_id' => $this->user->id,
'status' => Post::status('published'),
'content_type' => Post::type('entry'),
'tags' => 'one, two, THREE',
'pubdate' => HabariDateTime::date_create( time() ),
);
$post = Post::create($params);
$this->assert_true( $post instanceof Post, 'Post should be created.' );
// Check the post's id is set.
$this->assert_true( (int)$post->id > 0, 'The Post id should be greater than zero' );
// Check the post's tags are usable.
$this->assert_equal(count($post->tags), count($tags), 'All tags should have been created.');
foreach ( $post->tags as $tag ) {
$this->assert_equal($tag->tag_slug, Utils::slugify($tag->tag_text), 'Tags key should be slugified tag.');
}
foreach( $post->tags as $tag ) {
Tags::vocabulary()->delete_term( $tag );
}
}
示例5: get_stat
public static function get_stat($type, $month = NULL)
{
$str = 'chicklet_stat_' . $type;
if ($month != NULL) {
$str .= '_' . $month;
}
if (Cache::has($str)) {
return Cache::get($str);
}
switch ($type) {
case 'entries':
case 'posts':
$params = array('content_type' => array(Post::type('entry'), Post::type('link')), 'nolimit' => TRUE);
$stat = count(Posts::get($params));
break;
case 'subscribers':
$stat = self::fetch();
break;
case 'comments':
$stat = Comments::count_total(Comment::STATUS_APPROVED);
break;
case 'tags':
$stat = count(Tags::vocabulary()->get_tree());
break;
default:
$stat = 0;
break;
}
Cache::set($str, $stat);
return $stat;
}
示例6: get_dashboard
/**
* Handles get requests for the dashboard
* @todo update check should probably be cron'd and cached, not re-checked every load
*/
public function get_dashboard()
{
// Not sure how best to determine this yet, maybe set an option on install, maybe do this:
$firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
$this->theme->active_time = HabariDateTime::date_create($firstpostdate);
// get the active theme, so we can check it
// @todo this should be worked into the main Update::check() code for registering beacons
$active_theme = Themes::get_active();
$active_theme = $active_theme->name . ':' . $active_theme->version;
// check to see if we have updates to display
$this->theme->updates = Options::get('updates_available', array());
// collect all the stats we display on the dashboard
$this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'page_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('published'))), 'entry_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total(Comment::STATUS_APPROVED, false), 'tag_count' => Tags::vocabulary()->count_total(), 'page_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'entry_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_UNAPPROVED, false) : Comments::count_by_author(User::identify()->id, Comment::STATUS_UNAPPROVED), 'spam_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_SPAM, false) : Comments::count_by_author(User::identify()->id, Comment::STATUS_SPAM), 'user_entry_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => User::identify()->id)));
$this->fetch_dashboard_modules();
// check for first run
$u = User::identify();
if (!isset($u->info->experience_level)) {
$this->theme->first_run = true;
$u->info->experience_level = 'user';
$u->info->commit();
} else {
$this->theme->first_run = false;
}
$this->display('dashboard');
}
示例7: get
/**
* Produce HTML output for all this fieldset and all contained controls
*
* @param boolean $forvalidation True if this control should render error information based on validation.
* @return string HTML that will render this control in the form
*/
function get($forvalidation = true)
{
$theme = $this->get_theme($forvalidation);
$max = Tags::vocabulary()->max_count();
$tag = $this->tag;
$theme->class = 'tag_' . $tag->term;
$theme->id = $tag->id;
$theme->weight = $max > 0 ? round($tag->count * 10 / $max) : 0;
$theme->caption = $tag->term_display;
$theme->count = $tag->count;
return $theme->fetch($this->get_template(), true);
}
示例8: ajax_tags
/**
* Handles AJAX from /admin/tags
* Used to delete and rename tags
*/
public function ajax_tags($handler_vars)
{
Utils::check_request_method(array('POST'));
$wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']);
if ($handler_vars['digest'] != $wsse['digest']) {
Session::error(_t('WSSE authentication failed.'));
echo Session::messages_get(true, array('Format', 'json_messages'));
return;
}
$tag_names = array();
$theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
$this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
$action = $this->handler_vars['action'];
switch ($action) {
case 'delete':
foreach ($_POST as $id => $delete) {
// skip POST elements which are not tag ids
if (preg_match('/^tag_\\d+/', $id) && $delete) {
$id = substr($id, 4);
$tag = Tags::get_by_id($id);
$tag_names[] = $tag->term_display;
Tags::vocabulary()->delete_term($tag);
}
}
$msg_status = _n(_t('Tag %s has been deleted.', array(implode('', $tag_names))), _t('%d tags have been deleted.', array(count($tag_names))), count($tag_names));
Session::notice($msg_status);
break;
case 'rename':
if (!isset($this->handler_vars['master'])) {
Session::error(_t('Error: New name not specified.'));
echo Session::messages_get(true, array('Format', 'json_messages'));
return;
}
$master = $this->handler_vars['master'];
$tag_names = array();
foreach ($_POST as $id => $rename) {
// skip POST elements which are not tag ids
if (preg_match('/^tag_\\d+/', $id) && $rename) {
$id = substr($id, 4);
$tag = Tags::get_by_id($id);
$tag_names[] = $tag->term_display;
}
}
Tags::vocabulary()->merge($master, $tag_names);
$msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master);
Session::notice($msg_status);
break;
}
$this->theme->tags = Tags::vocabulary()->get_tree();
$this->theme->max = Tags::vocabulary()->max_count();
echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection')));
}
示例9: action_block_content_tag_cloud
public function action_block_content_tag_cloud($block, $theme)
{
$minimum = isset($block->minimum) ? $block->minimum : 0;
$items = '';
$tags = Tags::vocabulary()->get_tree();
// does this need to specify published?
$max = intval(Tags::vocabulary()->max_count());
foreach ($tags as $tag) {
if ($tag->count > $minimum) {
$size = $tag->count * 15 / $max + 10;
$items .= '<a href="' . URL::get('display_entries_by_tag', array('tag' => $tag->term)) . '" title="' . $tag->count . "\" style=\"font-size:{$size}pt;\" >" . $tag->term_display . "</a>\n";
}
}
$block->cloud = $items;
}
示例10: add_template_vars
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*
* You could use this area to provide "recent comments" data to the template,
* for instance.
*
* Also, this function gets executed *after* regular data is assigned to the
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
public function add_template_vars()
{
// Add FormUI template placing the input before the label
$this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
$this->habari = Site::get_url('habari');
if (!$this->posts) {
$this->posts = Posts::get(array('content_type' => 'entry', 'status' => Post::status('published')));
}
$this->top_posts = array_slice((array) $this->posts, 0, 2);
$params = array('content_type' => 'entry', 'status' => Post::status('published'), 'limit' => 7);
$this->previous_posts = array_slice((array) Posts::get($params), 2, 5);
if (!$this->user) {
$this->user = User::identify();
}
if (!$this->page) {
$this->page = isset($page) ? $page : 1;
}
if (!$this->tags) {
$this->tags = Tags::vocabulary()->get_tree();
}
if (!$this->pages) {
$this->pages = Posts::get(array('content_type' => 'page', 'status' => Post::status('published')));
}
// Use the configured data format
$date_format = Options::get('blossom_date_format');
if ($date_format == 'american') {
// Apply Format::nice_date() to post date - US style
Format::apply('nice_date', 'post_pubdate_out', 'g:ia m/d/Y');
} else {
// Apply Format::nice_date() to post date - European style
Format::apply('nice_date', 'post_pubdate_out', 'g:ia d/m/Y');
}
// del.icio.us username.
$delicious_username = Options::get('blossom_delicious_username');
if ($delicious_username == '') {
$delicious_username = 'michael_c_harris';
}
$this->delicious = $delicious_username;
// Default to hidden
$this->show_interests = (bool) Options::get('show_interests');
$this->show_other_news = (bool) Options::get('show_other_news');
parent::add_template_vars();
}
示例11: action_form_publish
/**
* Add the tray to the publish form
* @params FormUI $form The publish form object instance
* @params Post $post The post that is being edited
**/
public function action_form_publish($form, $post)
{
// Create the tags selector
$tagselector = $form->publish_controls->append('fieldset', 'tagselector', _t('Tags'));
$tags_buttons = $tagselector->append('wrapper', 'tags_buttons');
$tags_buttons->class = 'container';
$tags_buttons->append('static', 'clearbutton', '<p class="span-5"><input type="button" value="' . _t('Clear') . '" id="clear"></p>');
$tags_list = $tagselector->append('wrapper', 'tags_list');
$tags_list->class = 'container';
$tags_list->append('static', 'tagsliststart', '<ul id="tag-list" class="span-19">');
$tags = Tags::vocabulary()->get_tree('term_display ASC');
$tag_html = "";
foreach ($tags as $tag) {
$tag_html .= "\n<li class=\" tag_" . $tag->term;
if (preg_match("/{$tag->term_display}/i", $post->content) || preg_match("/{$tag->term}/i", $post->content)) {
$tag_html .= ' appearance';
}
$tag_html .= '">' . $tag->term_display . "</li>\n";
}
$tags_list_content = $tags_list->append('static', 'tagslistcontent', $tag_html);
$tags_list->append('static', 'tagslistend', '</ul>');
}
示例12: theme_show_tags
/**
* Returns an unordered list of all used Tags
*/
public function theme_show_tags($theme)
{
$limit = Options::get(__CLASS__ . '__tags_count');
$sql = "\n\t\t\tSELECT t.term AS slug, t.term_display AS text, count(tp.object_id) as ttl\n\t\t\tFROM {terms} t\n\t\t\tINNER JOIN {object_terms} tp\n\t\t\tON t.id=tp.term_id\n\t\t\tINNER JOIN {posts} p\n\t\t\tON p.id=tp.object_id AND p.status = ?\n\t\t\tWHERE t.vocabulary_id = ? AND tp.object_type_id = ?\n\t\t\tGROUP BY t.term, t.term_display\n\t\t\tORDER BY t.term_display\n\t\t\tLIMIT {$limit}\n\t\t";
$tags = DB::get_results($sql, array(Post::status('published'), Tags::vocabulary()->id, Vocabulary::object_type_id('post')));
foreach ($tags as $index => $tag) {
$tags[$index]->url = URL::get('display_entries_by_tag', array('tag' => $tag->slug));
}
$theme->taglist = $tags;
return $theme->fetch('taglist');
}
示例13: search_to_get
/**
* Parses a search string for status, type, author, and tag keywords. Returns
* an associative array which can be passed to Posts::get(). If multiple
* authors, statuses, tags, or types are specified, we assume an implicit OR
* such that (e.g.) any author that matches would be returned.
*
* @param string $search_string The search string
* @return array An associative array which can be passed to Posts::get()
*/
public static function search_to_get($search_string)
{
// if adding to this array, make sure you update the consequences of a search on this below in the switch.
$keywords = array('author' => 1, 'status' => 1, 'type' => 1, 'tag' => 1, 'info' => 1);
$statuses = Post::list_post_statuses();
$types = Post::list_active_post_types();
$arguments = array('user_id' => array(), 'status' => array(), 'content_type' => array(), 'vocabulary' => array(), 'info' => array());
$criteria = '';
// this says, find stuff that has the keyword at the start, and then some term straight after.
// the terms should have no whitespace, or if it does, be ' delimited.
// ie tag:foo or tag:'foo bar'
$flag_regex = '/(?P<flag>\\w+):(?P<value>[^\'"][^\\s]*|(?P<quote>[\'"])[^\\3]+(?<!\\\\)\\3)/i';
// now do some matching.
preg_match_all($flag_regex, $search_string, $matches, PREG_SET_ORDER);
// now we remove those terms from the search string, otherwise the keyword search below has issues. It will pick up things like
// from tag:'pair of' -> matches of'
$criteria = trim(preg_replace($flag_regex, '', $search_string));
// Add special criteria based on the flag parameters.
foreach ($matches as $match) {
// trim out any quote marks that have been matched.
$quote = isset($match['quote']) ? $match['quote'] : ' ';
$value = trim(stripslashes($match['value']), $quote);
$flag = $match['flag'];
$arguments = Plugins::filter('posts_search_to_get', $arguments, $flag, $value, $match, $search_string);
switch ($flag) {
case 'author':
if ($u = User::get($value)) {
$arguments['user_id'][] = (int) $u->id;
}
break;
case 'tag':
$arguments['vocabulary'][Tags::vocabulary()->name . ':term_display'][] = $value;
break;
case 'status':
if (isset($statuses[$value])) {
$arguments['status'][] = (int) $statuses[$value];
}
break;
case 'type':
if (isset($types[$value])) {
$arguments['content_type'][] = (int) $types[$value];
}
break;
case 'info':
if (strpos($value, ':') !== false) {
list($infokey, $infovalue) = explode(':', $value, 2);
$arguments['info'][] = array($infokey => $infovalue);
}
break;
}
}
// flatten keys that have single-element or no-element arrays
foreach ($arguments as $key => $arg) {
switch (count($arg)) {
case 0:
unset($arguments[$key]);
break;
case 1:
if (is_array($arg)) {
$arguments[$key] = $arg;
} else {
$arguments[$key] = $arg[0];
}
break;
}
}
if ($criteria != '') {
$arguments['criteria'] = $criteria;
}
return $arguments;
}
示例14: save_associations
/**
* Save the tags associated to this object into the terms and object_terms tables
*
* @param Array $tags strings. The tag names to associate to the object
* @param Integer $object_id. The id of the object being tagged
* @param String $object_type. The name of the type of the object being tagged. Defaults to post
*
* @return boolean. Whether the associating succeeded or not. true
*/
public static function save_associations($terms, $object_id, $object_type = 'post')
{
if (!$terms instanceof Terms) {
$terms = Terms::parse($terms, 'Tag', Tags::vocabulary());
}
return self::vocabulary()->set_object_terms($object_type, $object_id, $terms);
}
示例15: act_display
/**
* Grabs post data and inserts that data into the internal
* handler_vars array, which eventually gets extracted into
* the theme's ( and thereby the template_engine's ) local
* symbol table for use in the theme's templates
*
* This is the default, generic function to grab posts. To
* "filter" the posts retrieved, simply pass any filters to
* the handler_vars variables associated with the post retrieval.
* For instance, to filter by tag, ensure that handler_vars['tag']
* contains the tag to filter by. Simple as that.
*/
public function act_display($paramarray = array('user_filters' => array()))
{
Utils::check_request_method(array('GET', 'HEAD', 'POST'));
// Get any full-query parameters
$possible = array('user_filters', 'fallback', 'posts', 'post', 'content_type');
foreach ($possible as $varname) {
if (isset($paramarray[$varname])) {
${$varname} = $paramarray[$varname];
}
}
/**
* Since handler_vars no longer contains $_GET and $_POST, we have broken out our valid filters into
* an array based upon where we should expect them to be. We then only merge those specific pieces together.
*
* These are ordered so that handler vars gets overwritten by POST, which gets overwritten by GET, should the
* same key exist multiple places. This seemed logical to me at the time, but needs further thought.
*/
$where_filters = array();
$where_filters_hv = Controller::get_handler_vars()->filter_keys($this->valid_filters['handler_vars']);
$where_filters_post = $_POST->filter_keys($this->valid_filters['POST']);
$where_filters_get = $_GET->filter_keys($this->valid_filters['GET']);
$where_filters = $where_filters_hv->merge($where_filters_post, $where_filters_get);
$where_filters['vocabulary'] = array();
if (array_key_exists('tag', $where_filters)) {
$tags = Tags::parse_url_tags($where_filters['tag']);
$not_tag = $tags['exclude_tag'];
$all_tag = $tags['include_tag'];
if (count($not_tag) > 0) {
$where_filters['vocabulary'] = array_merge($where_filters['vocabulary'], array(Tags::vocabulary()->name . ':not:term' => $not_tag));
}
if (count($all_tag) > 0) {
$where_filters['vocabulary'] = array_merge($where_filters['vocabulary'], array(Tags::vocabulary()->name . ':all:term' => $all_tag));
}
$where_filters['tag_slug'] = Utils::slugify($where_filters['tag']);
unset($where_filters['tag']);
}
if (!isset($_GET['preview'])) {
$where_filters['status'] = Post::status('published');
}
if (!isset($posts)) {
$user_filters = Plugins::filter('template_user_filters', $user_filters);
// Work around the tags parameters to Posts::get() being subsumed by the vocabulary parameter
if (isset($user_filters['not:tag'])) {
$user_filters['vocabulary'] = array(Tags::vocabulary()->name . ':not:term' => $user_filters['not:tag']);
unset($user_filters['not:tag']);
}
if (isset($user_filters['tag'])) {
$user_filters['vocabulary'] = array(Tags::vocabulary()->name . ':term_display' => $user_filters['tag']);
unset($user_filters['tag']);
}
$where_filters = $where_filters->merge($user_filters);
$where_filters = Plugins::filter('template_where_filters', $where_filters);
$posts = Posts::get($where_filters);
}
$this->assign('posts', $posts);
if ($posts !== false && count($posts) > 0) {
if (count($posts) == 1) {
$post = $posts instanceof Post ? $posts : reset($posts);
Stack::add('body_class', Post::type_name($post->content_type) . '-' . $post->id);
Stack::add('body_class', 'single');
} else {
$post = reset($posts);
Stack::add('body_class', 'multiple');
}
$this->assign('post', $post);
$type = Post::type_name($post->content_type);
} elseif ($posts === false || isset($where_filters['page']) && $where_filters['page'] > 1 && count($posts) == 0) {
if ($this->template_exists('404')) {
$fallback = array('404');
// Replace template variables with the 404 rewrite rule
$this->request->{URL::get_matched_rule()->name} = false;
$this->request->{URL::set_404()->name} = true;
$this->matched_rule = URL::get_matched_rule();
// 404 status header sent in act_display_404, but we're past
// that, so send it now.
header('HTTP/1.1 404 Not Found', true, 404);
} else {
$this->display('header');
echo '<h2>';
_e("Whoops! 404. The page you were trying to access is not really there. Please try again.");
echo '</h2>';
header('HTTP/1.1 404 Not Found', true, 404);
$this->display('footer');
die;
}
}
$extract = $where_filters->filter_keys('page', 'type', 'id', 'slug', 'posttag', 'year', 'month', 'day', 'tag', 'tag_slug');
foreach ($extract as $key => $value) {
//.........这里部分代码省略.........