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


PHP Controller::get_handler_vars方法代码示例

本文整理汇总了PHP中Controller::get_handler_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::get_handler_vars方法的具体用法?PHP Controller::get_handler_vars怎么用?PHP Controller::get_handler_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


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

示例1: action_admin_header

 /**
  * Add appropriate CSS to this plugin's configuration form
  */
 public function action_admin_header($theme)
 {
     $vars = Controller::get_handler_vars();
     if ($theme->admin_page == 'plugins' && isset($vars['configure']) && $vars['configure'] === $this->plugin_id) {
         Stack::add('admin_stylesheet', array($this->get_url() . '/metaseo.css', 'screen'));
     }
 }
开发者ID:habari-extras,项目名称:metaseo,代码行数:10,代码来源:metaseo.plugin.php

示例2: filter_theme_act_display_entries_by_author

 /**
  * function filter_theme_act_display_entries_by_author
  * Helper function: Display the posts for an author. Probably should be more generic eventually.
  */
 public function filter_theme_act_display_entries_by_author($handled, $theme)
 {
     $paramarray = array();
     $vars = Controller::get_handler_vars();
     $user = Users::get_by_info('slug', $vars['author']);
     if (count($user) > 0) {
         $author = $user[0];
     } elseif ($user = User::get($vars['author'])) {
         $author = $user;
     } else {
         $theme->request->{URL::get_matched_rule()->name} = false;
         $theme->request->{URL::set_404()->name} = true;
         $theme->matched_rule = URL::get_matched_rule();
         $theme->act_display_404();
         return;
     }
     if (isset($author)) {
         $paramarray['fallback'][] = 'author.{$author->id}';
     }
     $paramarray['fallback'][] = 'author';
     $paramarray['fallback'][] = 'multiple';
     $paramarray['fallback'][] = 'home';
     $default_filters = array('content_type' => Post::type('entry'));
     $paramarray['user_filters'] = $default_filters;
     $theme->assign('author', $author);
     $theme->act_display($paramarray);
     return true;
 }
开发者ID:habari-extras,项目名称:authorurls,代码行数:32,代码来源:authorurls.plugin.php

示例3: action_form_publish

 /**
  * Add additional controls to the publish page tab
  *
  * @param FormUI $form The form that is used on the publish page
  * @param Post $post The post being edited
  */
 public function action_form_publish($form, $post)
 {
     // If quote has been sent in the URL, insert the quote data in the post
     $this->handler_vars = Controller::get_handler_vars();
     if (array_key_exists('quote', $this->handler_vars)) {
         $form->title->value = $this->handler_vars['title'];
         // Get the user so that we can grab the saved templates and tags
         $user = User::identify();
         $title = $user->info->title__template;
         if (!$title) {
             $title = self::$default_title_template;
         }
         // Filter the quote title using the title template
         $form->title->value = preg_replace_callback('%\\{\\$(.+?)\\}%', array(&$this, 'replace_parts'), $title);
         // Only change the slug if the template is set. For example, you might have HTML in the title.
         $slug = $user->info->slug__template;
         if ($slug) {
             // Filter the quote title using the title template
             $form->newslug->value = preg_replace_callback('%\\{\\$(.+?)\\}%', array(&$this, 'replace_parts'), $slug);
         }
         $content = $user->info->content__template;
         if (!$content) {
             $content = self::$default_content_template;
         }
         // Filter the quote content using the content template
         $form->content->value = preg_replace_callback('%\\{\\$(.+?)\\}%', array(&$this, 'replace_parts'), $content);
         // Add tags for quotes
         $tags = $user->info->quote__tags;
         if ($tags) {
             $form->tags->value = $tags;
         }
     }
 }
开发者ID:habari-extras,项目名称:publish_quote,代码行数:39,代码来源:publish_quote.plugin.php

示例4: filter_theme_act_display_home

 public function filter_theme_act_display_home($handled, $theme)
 {
     $vars = Controller::get_handler_vars();
     if (empty($vars['page'])) {
         $page = Options::get('criticalhit__home');
         if ($page && $page != '--none--') {
             $post = Post::get(array('slug' => $page));
             $theme->act_display(array('posts' => $post));
             return true;
         }
     }
     return false;
 }
开发者ID:ringmaster,项目名称:criticalhit_theme,代码行数:13,代码来源:theme.php

示例5: action_admin_header

 public function action_admin_header($theme)
 {
     $vars = Controller::get_handler_vars();
     $js_xid2def = '';
     if ($theme->page == 'plugins' && isset($vars['configure']) && $this->plugin_id == $vars['configure']) {
         Stack::add('admin_stylesheet', array($this->get_url() . '/macros.css', 'screen'), 'macros', array('admin'));
         $macros = DB::get_results('SELECT * FROM ' . DB::table('macro') . ' ORDER BY name ASC');
         $js_xid2def .= "\n  \$(document).ready(function(){\n" . "    mDefs = [];\n" . "    mDefs[0] = ['', false, false, 0, '', ''];\n";
         foreach ($macros as $macro) {
             $xid = $macro->xid;
             $nargs = $macro->nargs;
             $enabled = $macro->enabled;
             $name = HTMLentities("'" . $macro->name . "'");
             $desc = HTMLentities("'" . $macro->description . "'");
             $def = HTMLentities("'" . $macro->definition . "'");
             $container = $macro->container ? 'true' : 'false';
             $eval = $macro->eval ? 'true' : 'false';
             $js_xid2def .= "    mDefs[{$xid}] = [" . $name . ', ' . $enabled . ', ' . $container . ', ' . $eval . ', ' . $nargs . ', ' . $desc . ', ' . $def . "];\n";
         }
         $js_xid2def .= "    \$('#mName select')" . ".change(function(){\n" . "      mNum = \$(this).val();\n" . "      \$('#mEnabled input[type=\"checkbox\"]')" . ".attr('checked', mDefs[mNum][1]);\n" . "      \$('#mDefinition input').val(\$('<input value=\"' + mDefs[mNum][6] + '\"/>').val());\n" . "      \$('#mContainer input[type=\"checkbox\"]')" . ".attr('checked', mDefs[mNum][2]);\n" . "      \$('#mEval input[type=\"checkbox\"]')" . ".attr('checked', mDefs[mNum][3]);\n" . "      \$('#mNargs input[type=\"text\"]')" . ".val(\$('<input value=\"' + mDefs[mNum][4] + '\"/>').val());\n" . "      \$('#mDescription input[type=\"text\"]')" . ".val(\$('<input value=\"' + mDefs[mNum][5] + '\"/>').val());\n" . "      \$('#mDefinition input[type=\"text\"]')" . ".val(\$('<input value=\"' + mDefs[mNum][6] + '\"/o>').val())});\n" . "  })\n";
         Stack::add('admin_header_javascript', $js_xid2def, 'macros', 'admin');
     }
 }
开发者ID:habari-extras,项目名称:macros,代码行数:23,代码来源:macros.plugin.php

示例6: action_admin_header

 public function action_admin_header($theme)
 {
     $vars = Controller::get_handler_vars();
     if ($theme->page == 'plugins' && isset($vars['configure']) && $this->plugin_id == $vars['configure']) {
         Stack::add('admin_stylesheet', array($this->get_url() . '/abbrev.css', 'screen'), 'abbrev', array('admin'));
         Stack::add('template_header_javascript', $this->get_url() . '/abbrev.js', 'abbrev');
         $abbrevs = $this->_getAbbrevs();
         if ($n = count($abbrevs)) {
             $js_xid2def .= "\n  \$(document).ready(function(){\n" . "    function aDef(abbrev_p, definition_p, caseful_p, prefix_p, postfix_p) {\n" . "        this.abbrev = abbrev_p;\n" . "        this.definition = definition_p;\n" . "        this.caseful = caseful_p;\n" . "        this.prefix = prefix_p;\n" . "        this.postfix = postfix_p;\n" . "    }\n" . "    aDefs = [];\n";
             foreach ($abbrevs as $abbrev) {
                 $prefix = "'" . $abbrev->prefix . "'";
                 $postfix = "'" . $abbrev->postfix . "'";
                 $prefix = str_replace('\\', '\\\\', $prefix);
                 $prefix = str_replace('"', '\\"', $prefix);
                 $postfix = str_replace('\\', '\\\\', $postfix);
                 $postfix = str_replace('"', '\\"', $postfix);
                 $js_xid2def .= '    aDefs[' . $abbrev->xid . '] = new aDef(' . $this->qsafe($abbrev->abbrev, true) . $this->qsafe($abbrev->definition, true) . ($abbrev->caseful ? 'true' : 'false') . ', ' . $this->qsafe($prefix, true) . $this->qsafe($postfix) . ");\n";
             }
             $js_xid2def .= "    \$('#mAbbrev select')" . ".change(function(){\n" . "      aNum = \$(this).val();\n" . "      \$('#mDefinition input').val(\$('<input value=\"' + aDefs[aNum].definition + '\"/>').val());\n" . "      \$('#mCaseful input[type=\"checkbox\"]')" . ".attr('checked', aDefs[aNum].caseful);\n" . "      \$('#mPreRegex input[type=\"text\"]')" . ".val(\$('<input value=\"' + aDefs[aNum].prefix + '\"/>').val());\n" . "      \$('#mPostRegex input[type=\"text\"]')" . ".val(\$('<input value=\"' + aDefs[aNum].postfix + '\"/>').val())});\n" . "  })\n";
             Stack::add('admin_header_javascript', $js_xid2def, 'abbrev', 'admin');
         }
     }
 }
开发者ID:habari-extras,项目名称:abbrev,代码行数:23,代码来源:abbrev.plugin.php

示例7: filter_template_where_filters

 /**
  * function filter_template_where_filters
  * Limit the Posts::get call to categories
  * (uses tag_slug because that's really term under the hood)
  **/
 public function filter_template_where_filters($filters)
 {
     $vars = Controller::get_handler_vars();
     if (isset($vars['category_slug'])) {
         $labels = explode('/', $vars['category_slug']);
         $level = count($labels) - 1;
         $term = $this->get_term($labels, $level);
         //			$term = $this->vocabulary->get_term( $vars['category_slug'] );
         if ($term instanceof Term) {
             $terms = (array) $term->descendants();
             array_push($terms, $term);
             $filters['vocabulary'] = array_merge($filters['vocabulary'], array('any' => $terms));
         }
     }
     return $filters;
 }
开发者ID:habari-extras,项目名称:simplecategories,代码行数:21,代码来源:simplecategories.plugin.php

示例8: get_collection

 /**
  *	Output a post collection based on the provided parameters.
  *
  * @param array $params An array of parameters as passed to Posts::get() to retrieve posts.
  */
 public function get_collection($params = array())
 {
     // Store handler vars since we'll be using them a lot.
     $handler_vars = Controller::get_handler_vars();
     // Retrieve the current matched rule and store its name and argument values.
     $rr = URL::get_matched_rule();
     $rr_name = $rr->name;
     $rr_args = $rr->named_arg_values;
     // Assign alternate links based on the matched rule.
     $alternate_rules = array('atom_feed_tag' => 'display_entries_by_tag', 'atom_feed' => 'display_home', 'atom_entry' => 'display_entry', 'atom_feed_entry_comments' => 'display_entry', 'atom_feed_page_comments' => 'display_entry', 'atom_feed_comments' => 'display_home');
     $alternate_rules = Plugins::filter('atom_get_collection_alternate_rules', $alternate_rules);
     $alternate = URL::get($alternate_rules[$rr_name], $handler_vars, false);
     // Assign self link based on the matched rule.
     $self = URL::get($rr_name, $rr_args, false);
     $id = isset($rr_args_values['tag']) ? $rr_args_values['tag'] : 'atom';
     $xml = $this->create_atom_wrapper($alternate, $self, $id);
     $xml = $this->add_pagination_links($xml, Posts::count_total(Post::status('published')));
     // Get posts to put in the feed
     $page = isset($rr_args['page']) ? $rr_args['page'] : 1;
     if ($page > 1) {
         $params['page'] = $page;
     }
     if (!isset($params['content_type'])) {
         $params['content_type'] = Post::type('entry');
     }
     $params['content_type'] = Plugins::filter('atom_get_collection_content_type', $params['content_type']);
     $params['status'] = Post::status('published');
     $params['orderby'] = 'updated DESC';
     $params['limit'] = Options::get('atom_entries');
     $params = array_merge($params, $rr_args);
     if (array_key_exists('tag', $params)) {
         $params['tag_slug'] = Utils::slugify($params['tag']);
         unset($params['tag']);
     }
     $posts = Posts::get($params);
     $xml = $this->add_posts($xml, $posts);
     Plugins::act('atom_get_collection', $xml, $params, $handler_vars);
     $xml = $xml->asXML();
     ob_clean();
     header('Content-Type: application/atom+xml');
     print $xml;
 }
开发者ID:anupom,项目名称:my-blog,代码行数:47,代码来源:atomhandler.php

示例9: action_admin_header

 public function action_admin_header($theme)
 {
     $vars = Controller::get_handler_vars();
     if ('plugins' == $theme->page && isset($vars['configure']) && $this->plugin_id == $vars['configure']) {
     }
 }
开发者ID:habari-extras,项目名称:photoslide,代码行数:6,代码来源:photoslide.plugin.php

示例10: 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) {
//.........这里部分代码省略.........
开发者ID:habari,项目名称:system,代码行数:101,代码来源:theme.php

示例11: filter_template_where_filters

 /**
  * function filter_template_where_filters
  * Limit the Posts::get call to shelves 
  * (uses tag_slug because that's really term under the hood)
  **/
 public function filter_template_where_filters($filters)
 {
     $vars = Controller::get_handler_vars();
     if (isset($vars['shelf_slug'])) {
         $term = $this->vocabulary->get_term($vars['shelf_slug']);
         if ($term instanceof Term) {
             $terms = (array) $term->descendants();
             $terms = array_map(create_function('$a', 'return $a->term;'), $terms);
             array_push($terms, $vars['shelf_slug']);
             $filters['vocabulary'] = array_merge($filters['vocabulary'], array(self::$vocabulary . ':term' => $terms));
         }
     }
     return $filters;
 }
开发者ID:habari-extras,项目名称:shelves,代码行数:19,代码来源:shelves.plugin.php

示例12: action_form_publish

 /**
  * Modify publish form
  */
 public function action_form_publish($form, $post)
 {
     if ($post->content_type == Post::type('link')) {
         $url = $form->append('text', 'url', 'null:null', _t('URL'), 'admincontrol_text');
         // CNS: If we're using this in conjunction with my modified version of the "Publish Quote" plugin, we might already have the URL in the handler_vars.
         $vars = Controller::get_handler_vars();
         $url->value = isset($vars['url']) ? $vars['url'] : $post->info->url;
         $form->move_after($url, $form->title);
     }
 }
开发者ID:habari-extras,项目名称:linkblog,代码行数:13,代码来源:linkblog.plugin.php

示例13: action_before_act_admin_ajax

 /**
  * action: ajax_amazon_search
  *
  * @access public
  * @return void
  */
 public function action_before_act_admin_ajax()
 {
     $handler_vars = Controller::get_handler_vars();
     switch ($handler_vars['context']) {
         case 'amazon_search':
             if (empty($handler_vars['keywords'])) {
                 echo json_encode(array('errorMessage' => _t('please specify keywords.')));
                 die;
             }
             if (empty($handler_vars['search_index'])) {
                 echo json_encode(array('errorMessage' => _t('please specify searchIndex.')));
                 die;
             }
             $keywords = InputFilter::filter($handler_vars['keywords']);
             $search_index = InputFilter::filter($handler_vars['search_index']);
             if (empty($handler_vars['page'])) {
                 $page = 1;
             } else {
                 $page = InputFilter::filter($handler_vars['page']);
             }
             $result = $this->item_search($keywords, $search_index, $page);
             $xml = simplexml_load_string($result);
             if ((string) $xml->Items->Request->IsValid != 'True') {
                 echo json_encode(array('errorMessage' => _t('following error reply existed from the server: ', 'amazon') . (string) $xml->Items->Request->Errors->Error->Message));
                 die;
             }
             if ((int) $xml->Items->TotalResults == 0) {
                 echo json_encode(array('errorMessage' => _t('did not match any items.', 'amazon')));
                 die;
             }
             $output = array();
             $output['TotalResults'] = (int) $xml->Items->TotalResults;
             $output['TotalPages'] = (int) $xml->Items->TotalPages;
             $output['CurrentPage'] = $page;
             $output['Start'] = ($page - 1) * 10 + 1;
             $output['End'] = $output['Start'] + 10;
             if ($output['End'] > $output['TotalResults']) {
                 $output['End'] = $output['TotalResults'];
             }
             $output['HasPrev'] = false;
             $output['HasNext'] = false;
             if ($page != 1) {
                 $output['HasPrev'] = true;
             }
             if ($page < $output['TotalPages']) {
                 $output['HasNext'] = true;
             }
             $output['Items'] = array();
             for ($i = 0; $i < count($xml->Items->Item); $i++) {
                 $item = array();
                 $item['ASIN'] = (string) $xml->Items->Item[$i]->ASIN;
                 $item['DetailPageURL'] = (string) $xml->Items->Item[$i]->DetailPageURL;
                 $item['SmallImageURL'] = (string) $xml->Items->Item[$i]->SmallImage->URL;
                 $item['SmallImageWidth'] = (int) $xml->Items->Item[$i]->SmallImage->Width;
                 $item['SmallImageHeight'] = (int) $xml->Items->Item[$i]->SmallImage->Height;
                 $item['Title'] = (string) $xml->Items->Item[$i]->ItemAttributes->Title;
                 $item['Price'] = (string) $xml->Items->Item[$i]->ItemAttributes->ListPrice->FormattedPrice;
                 $item['Binding'] = (string) $xml->Items->Item[$i]->ItemAttributes->Binding;
                 $output['Items'][] = $item;
             }
             echo json_encode($output);
             die;
         case 'amazon_insert':
             if (empty($handler_vars['asin'])) {
                 echo json_encode(array('errorMessage' => _t('please specify ASIN.', 'amazon')));
                 die;
             }
             $asin = InputFilter::filter($handler_vars['asin']);
             $result = $this->item_lookup($asin);
             $xml = simplexml_load_string($result);
             if ((string) $xml->Items->Request->IsValid != 'True') {
                 echo json_encode(array('errorMessage' => _t('following error reply existed from the server: ', 'amazon') . (string) $xml->Items->Request->Errors->Error->Message));
                 die;
             }
             $item =& $xml->Items->Item;
             ob_start();
             $template = preg_replace('/[^A-Za-z0-9\\-\\_]/', '', Options::get('amazon__template'));
             include dirname($this->get_file()) . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php';
             $output['html'] = ob_get_contents();
             ob_end_clean();
             echo json_encode($output);
             //echo $output['html'];
             die;
         default:
             break;
     }
 }
开发者ID:habari-extras,项目名称:amazon,代码行数:93,代码来源:amazon.plugin.php

示例14: get_collection

	/**
	 * Output a post collection based on the provided parameters.
	 *
	 * @param array $params An array of parameters as passed to Posts::get() to retrieve posts.
	 */
	public function get_collection( $params = array() )
	{
		// Store handler vars since we'll be using them a lot.
		$handler_vars = Controller::get_handler_vars();

		// Retrieve the current matched rule and store its name and argument values.
		$rr = URL::get_matched_rule();
		$rr_name = $rr->name;
		$rr_args = $rr->named_arg_values;

		// Assign alternate links based on the matched rule.
		$alternate_rules = array(
			'atom_feed_tag' => 'display_entries_by_tag',
			'atom_feed' => 'display_home',
			'atom_entry' => 'display_entry',
			'atom_feed_entry_comments' => 'display_entry',
			'atom_feed_page_comments' => 'display_entry',
			'atom_feed_comments' => 'display_home',
			);
		$alternate_rules = Plugins::filter( 'atom_get_collection_alternate_rules', $alternate_rules );
		$alternate = URL::get( $alternate_rules[$rr_name], $handler_vars, false );

		// Assign self link based on the matched rule.
		$self = URL::get( $rr_name, $rr_args, false );

		// Get posts to put in the feed
		$page = ( isset( $rr_args['page'] ) ) ? $rr_args['page'] : 1;
		if ( $page > 1 ) {
			$params['page'] = $page;
		}

		if ( !isset( $params['content_type'] ) ) {
			$params['content_type'] = Post::type( 'entry' );
		}
		$params['content_type'] = Plugins::filter( 'atom_get_collection_content_type', $params['content_type'] );

		$params['status'] = $this->is_auth() ? 'any' : Post::status( 'published' );
		$params['orderby'] = 'updated DESC';
		$params['limit'] = Options::get( 'atom_entries' );

		$params = array_merge( $params, $rr_args );

		if ( array_key_exists( 'tag', $params ) ) {
			$id = urlencode( $params['tag'] );
			$tags = explode( ' ', $params['tag'] );
			foreach ( $tags as $tag ) {
				if ( $tag[0] == '-' ) {
					$tag = substr( $tag, 1 );
					$params['vocabulary'][Tags::vocabulary()->name . ':not:term'][] = Utils::slugify( $tag );
				}
				else {
					$params['vocabulary'][Tags::vocabulary()->name . ':all:term'][] = Utils::slugify( $tag );
				}
			}
			unset( $params['tag'] );
		}
		else {
			$id = 'atom';
		}
		$posts = Posts::get( $params );

		if ( count( $posts ) ) {
			$updated = $posts[0]->updated;
		}
		else {
			$updated = null;
			header( 'HTTP/1.1 404 Not Found', true, 404 );
			die( 'Posts could not be found' );
		}

		$xml = $this->create_atom_wrapper( $alternate, $self, $id, $updated );

		$xml = $this->add_pagination_links( $xml, $posts->count_all() );

		$xml = $this->add_posts( $xml, $posts );

		Plugins::act( 'atom_get_collection', $xml, $params, $handler_vars );
		$xml = $xml->asXML();

		ob_clean();
		header( 'Content-Type: application/atom+xml' );

		print $this->tidy_xml( $xml );
	}
开发者ID:rynodivino,项目名称:system,代码行数:89,代码来源:atomhandler.php

示例15: action_admin_header

	/**
	* Adds the podcast stylesheet to the admin header,
	* Adds menu items to the Habari silo for mp3 files
	* for each feed so the mp3 can be added to multiple 
	* feeds.
	*
	* @param Theme $theme The current theme being used.
	*/
	public function action_admin_header( $theme )
	{
		$vars = Controller::get_handler_vars();
		if( 'dashboard' == $theme->page ) {
			Stack::add( 'admin_stylesheet', array( $this->get_url() . '/coredashmodules.css', 'screen' ), 'coredashmodules', array( 'admin' ) );
		}
	}
开发者ID:rynodivino,项目名称:system,代码行数:15,代码来源:coredashmodules.plugin.php


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