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


PHP Tags::parse_url_tags方法代码示例

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


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

示例1: act_display_tag

	/**
	 * Helper function: Display the posts for a tag
	 * @param array $user_filters Additional arguments used to get the page content
	 */
	public function act_display_tag( $user_filters = array() )
	{
		$paramarray['fallback'] = array(
			'tag.{$tag}',
			'tag',
			'multiple',
		);

		// Makes sure home displays only entries
		$default_filters = array(
			'content_type' => Post::type( 'entry' ),
		);

		$this->assign( 'tag', Controller::get_var( 'tag' ) );

		// Assign tag objects to the theme
		$tags = Tags::parse_url_tags( Controller::get_var( 'tag' ), true );
		$this->assign( 'include_tag', $tags['include_tag'] );
		$this->assign( 'exclude_tag', $tags['exclude_tag'] );
		$paramarray['user_filters'] = array_merge( $default_filters, $user_filters );

		return $this->act_display( $paramarray );
	}
开发者ID:rynodivino,项目名称:system,代码行数:27,代码来源:theme.php

示例2: act_display_tag

 /**
  * Helper function: Display the posts for a tag
  * @param array $user_filters Additional arguments used to get the page content
  */
 public function act_display_tag($user_filters = array())
 {
     $paramarray['fallback'] = array('tag.{$tag}', 'tag', 'multiple');
     // Use the according preset defined in the Posts class
     $default_filters = array('preset' => 'tag');
     $this->assign('tag', Controller::get_var('tag'));
     // Assign tag objects to the theme
     $tags = Tags::parse_url_tags(Controller::get_var('tag'), true);
     $this->assign('include_tag', $tags['include_tag']);
     $this->assign('exclude_tag', $tags['exclude_tag']);
     $paramarray['user_filters'] = array_merge($default_filters, $user_filters);
     return $this->act_display($paramarray);
 }
开发者ID:habari,项目名称:system,代码行数:17,代码来源:theme.php

示例3: get_title

 /**
  * function get_title
  *
  * creates the html title for the page being displayed
  *
  * @return string the html title for the page
  */
 private function get_title()
 {
     $months = array(1 => _t('January', 'metaseo'), _t('February', 'metaseo'), _t('March', 'metaseo'), _t('April', 'metaseo'), _t('May', 'metaseo'), _t('June', 'metaseo'), _t('July', 'metaseo'), _t('August', 'metaseo'), _t('September', 'metaseo'), _t('October', 'metaseo'), _t('November', 'metaseo'), _t('December', 'metaseo'));
     $out = '';
     $matched_rule = URL::get_matched_rule();
     if (is_object($matched_rule)) {
         $rule = $matched_rule->name;
         switch ($rule) {
             case 'display_home':
             case 'display_entries':
                 $out = Options::get('title');
                 if (Options::get('tagline')) {
                     $out .= ' - ' . Options::get('tagline');
                 }
                 break;
             case 'display_entries_by_date':
                 $out = 'Archive for ';
                 if (isset($this->theme->day)) {
                     $out .= $this->theme->day . ' ';
                 }
                 if (isset($this->theme->month)) {
                     $out .= $months[$this->theme->month] . ' ';
                 }
                 if (isset($this->theme->year)) {
                     $out .= $this->theme->year . ' ';
                 }
                 $out .= ' - ' . Options::get('title');
                 break;
             case 'display_entries_by_tag':
                 // parse the tags out of the URL, just like the handler does
                 $tags = Tags::parse_url_tags(Controller::get_var('tag'));
                 // build the pieces we'll use for text
                 $include_tag_text = array();
                 $exclude_tag_text = array();
                 foreach ($tags['include_tag'] as $include_tag) {
                     $include_tag_text[] = Tags::vocabulary()->get_term($include_tag)->term_display;
                 }
                 foreach ($tags['exclude_tag'] as $exclude_tag) {
                     $exclude_tag_text[] = Tags::vocabulary()->get_term($exclude_tag)->term_display;
                 }
                 $out = Format::and_list($include_tag_text);
                 if (!empty($exclude_tag_text)) {
                     $out .= ' but not ' . Format::and_list($exclude_tag_text);
                 }
                 $out .= ' Archive - ' . Options::get('title');
                 break;
             case 'display_entry':
             case 'display_page':
                 if (strlen($this->theme->post->info->html_title)) {
                     $out = $this->theme->post->info->html_title;
                 } else {
                     $out = $this->theme->post->title;
                 }
                 $out .= ' - ' . Options::get('title');
                 break;
             case 'display_search':
                 if (isset($_GET['criteria'])) {
                     $out = 'Search Results for ' . $_GET['criteria'] . ' - ';
                 }
                 $out .= Options::get('title');
                 break;
             case 'display_404':
                 $out = 'Page Not Found';
                 $out .= ' - ' . Options::get('title');
                 break;
         }
         if (strlen($out)) {
             $out = Utils::htmlspecialchars(strip_tags($out));
             $out = stripslashes($out);
         }
     }
     return $out;
 }
开发者ID:habari-extras,项目名称:metaseo,代码行数:80,代码来源:metaseo.plugin.php


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