예제 #1
0
파일: theme.php 프로젝트: rynodivino/system
	/**
	 * 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 );
	}
예제 #2
0
파일: theme.php 프로젝트: habari/system
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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;
 }