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


PHP TagsHelperRoute::getTagRoute方法代码示例

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


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

示例1: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise an Error object.
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->link = JRoute::_(TagsHelperRoute::getTagRoute($app->input->getInt('id')));
     $app->input->set('limit', $app->get('feed_limit'));
     $siteEmail = $app->get('mailfrom');
     $fromName = $app->get('fromname');
     $feedEmail = $app->get('feed_email', 'none');
     $document->editor = $fromName;
     if ($feedEmail != "none") {
         $document->editorEmail = $siteEmail;
     }
     // Get some data from the model
     $items = $this->get('Items');
     if ($items !== false) {
         foreach ($items as $item) {
             // Strip HTML from feed item title
             $title = $this->escape($item->core_title);
             $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
             // URL link to tagged item
             // Change to new routing once it is merged
             $link = JRoute::_($item->link);
             // Strip HTML from feed item description text
             $description = $item->core_body;
             $author = $item->core_created_by_alias ? $item->core_created_by_alias : $item->author;
             $date = $item->displayDate ? date('r', strtotime($item->displayDate)) : '';
             // Load individual item creator class
             $feeditem = new JFeedItem();
             $feeditem->title = $title;
             $feeditem->link = $link;
             $feeditem->description = $description;
             $feeditem->date = $date;
             $feeditem->category = $title;
             $feeditem->author = $author;
             if ($feedEmail == 'site') {
                 $item->authorEmail = $siteEmail;
             } elseif ($feedEmail === 'author') {
                 $item->authorEmail = $item->author_email;
             }
             // Loads item info into RSS array
             $document->addItem($feeditem);
         }
     }
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:52,代码来源:view.feed.php

示例2:

        if ($n == 1 || $i == 0 || $bscolumns == 1 || $i % $bscolumns == 0) {
            ?>
				<ul class="thumbnails">
			<?php 
        }
        ?>
			<?php 
        if (!empty($item->access) && in_array($item->access, $this->user->getAuthorisedViewLevels())) {
            ?>
			<li class="cat-list-row<?php 
            echo $i % 2;
            ?>
" >
			<h3>
				<a href="<?php 
            echo JRoute::_(TagsHelperRoute::getTagRoute($item->id . '-' . $item->alias));
            ?>
">
					<?php 
            echo $this->escape($item->title);
            ?>
				</a>
			</h3>
		<?php 
        }
        ?>
			<?php 
        if ($this->params->get('all_tags_show_tag_image') && !empty($item->images)) {
            ?>
				<?php 
            $images = json_decode($item->images);
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:31,代码来源:default_items.php

示例3: foreach

        }
        ?>
			
			
			<?php 
        if ($params->get('show_tags', 1) && !empty($this->item->tags)) {
            ?>
				<dt class="category-name"><?php 
            echo JText::sprintf('TPL_GK_LANG_TAGGED_UNDER', '</dt>');
            ?>
				<dd>	
				<?php 
            foreach ($this->item->tags->itemTags as $tag) {
                ?>
					<a href="<?php 
                echo JRoute::_(TagsHelperRoute::getTagRoute($tag->tag_id . ':' . $tag->alias));
                ?>
"><?php 
                echo $tag->title;
                ?>
</a>
				<?php 
            }
            ?>
				</dd>
			<?php 
        }
        ?>
			
			<?php 
        if ($params->get('show_create_date')) {
开发者ID:MATsxm,项目名称:Meet-Gavern,代码行数:31,代码来源:default_item.php

示例4: index

 /**
  * Method to index an item. The item must be a FinderIndexerResult object.
  *
  * @param   FinderIndexerResult  $item    The item to index as an FinderIndexerResult object.
  * @param   string               $format  The item format
  *
  * @return  void
  *
  * @since   3.1
  * @throws  Exception on database error.
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $item->setLanguage();
     // Initialize the item parameters.
     $registry = new JRegistry();
     $registry->loadString($item->params);
     $item->params = JComponentHelper::getParams('com_tags', true);
     $item->params->merge($registry);
     $registry = new JRegistry();
     $registry->loadString($item->metadata);
     $item->metadata = $registry;
     // Build the necessary route and path information.
     $item->url = $this->getURL($item->id, $this->extension, $this->layout);
     $item->route = TagsHelperRoute::getTagRoute($item->slug);
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     // Get the menu title if it exists.
     $title = $this->getItemMenuTitle($item->url);
     // Adjust the title if necessary.
     if (!empty($title) && $this->params->get('use_menu_title', true)) {
         $item->title = $title;
     }
     // Add the meta-author.
     $item->metaauthor = $item->metadata->get('author');
     // Handle the link to the meta-data.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'Tag');
     // Add the author taxonomy data.
     if (!empty($item->author) || !empty($item->created_by_alias)) {
         $item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
     }
     // Add the language taxonomy data.
     $item->addTaxonomy('Language', $item->language);
     // Index the item.
     $this->indexer->index($item);
 }
开发者ID:Tommar,项目名称:vino2,代码行数:56,代码来源:tags.php

示例5: foreach

				<?php 
        if ($this->params->get('show_description') && $this->category->description) {
            echo JHtml::_('content.prepare', $this->category->description, '', 'com_content.category');
        }
        ?>

				<?php 
        if ($this->params->get('show_tags', 1) && !empty($this->category->tags->itemTags)) {
            JLoader::register('TagsHelperRoute', JPATH_BASE . '/components/com_tags/helpers/route.php');
            echo '<p>' . JText::_('TPL_WARP_TAGS') . ': ';
            foreach ($this->category->tags->itemTags as $i => $tag) {
                if (in_array($tag->access, JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')))) {
                    if ($i > 0) {
                        echo ', ';
                    }
                    echo '<a href="' . JRoute::_(TagsHelperRoute::getTagRoute($tag->tag_id . ':' . $tag->alias)) . '">' . $this->escape($tag->title) . '</a>';
                }
            }
            echo '</p>';
        }
        ?>
			</div>
			<?php 
    }
    ?>

		</div>
	</div>
</div>
<?php 
}
开发者ID:ejailesb,项目名称:repo,代码行数:31,代码来源:blog.php

示例6: onContentSearch

 /**
  * Search content (tags).
  *
  * The SQL must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav.
  *
  * @param   string  $text      Target search string.
  * @param   string  $phrase    Matching option (possible values: exact|any|all).  Default is "any".
  * @param   string  $ordering  Ordering option (possible values: newest|oldest|popular|alpha|category).  Default is "newest".
  * @param   string  $areas     An array if the search is to be restricted to areas or null to search all areas.
  *
  * @return  array  Search results.
  *
  * @since   3.3
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $lang = JFactory::getLanguage();
     $section = JText::_('PLG_SEARCH_TAGS_TAGS');
     $limit = $this->params->def('search_limit', 50);
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $text = $db->quote('%' . $db->escape($text, true) . '%', false);
     switch ($ordering) {
         case 'alpha':
             $order = 'a.title ASC';
             break;
         case 'newest':
             $order = 'a.created_time DESC';
             break;
         case 'oldest':
             $order = 'a.created_time ASC';
             break;
         case 'popular':
         default:
             $order = 'a.title DESC';
     }
     $query->select('a.id, a.title, a.alias, a.note, a.published, a.access' . ', a.checked_out, a.checked_out_time, a.created_user_id' . ', a.path, a.parent_id, a.level, a.lft, a.rgt' . ', a.language, a.created_time AS created, a.description');
     $case_when_item_alias = ' CASE WHEN ';
     $case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
     $case_when_item_alias .= ' THEN ';
     $a_id = $query->castAsChar('a.id');
     $case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
     $case_when_item_alias .= ' ELSE ';
     $case_when_item_alias .= $a_id . ' END as slug';
     $query->select($case_when_item_alias);
     $query->from('#__tags AS a');
     $query->where('a.alias <> ' . $db->quote('root'));
     $query->where('(a.title LIKE ' . $text . ' OR a.alias LIKE ' . $text . ')');
     $query->where($db->qn('a.published') . ' = 1');
     if (!$user->authorise('core.admin')) {
         $groups = implode(',', $user->getAuthorisedViewLevels());
         $query->where('a.access IN (' . $groups . ')');
     }
     if ($app->isSite() && JLanguageMultilang::isEnabled()) {
         $tag = JFactory::getLanguage()->getTag();
         $query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
     }
     $query->order($order);
     $db->setQuery($query, 0, $limit);
     try {
         $rows = $db->loadObjectList();
     } catch (RuntimeException $e) {
         $rows = array();
         JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
     }
     if ($rows) {
         require_once JPATH_ROOT . '/components/com_tags/helpers/route.php';
         foreach ($rows as $key => $row) {
             $rows[$key]->href = TagsHelperRoute::getTagRoute($row->id);
             $rows[$key]->text = $row->description != "" ? $row->description : $row->title;
             $rows[$key]->text .= $row->note;
             $rows[$key]->section = $section;
             $rows[$key]->created = $row->created;
             $rows[$key]->browsernav = 0;
         }
     }
     if (!$this->params->get('show_tagged_items')) {
         return $rows;
     } else {
         $final_items = $rows;
         JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_tags/models');
         $tag_model = JModelLegacy::getInstance('Tag', 'TagsModel');
         $tag_model->getState();
         foreach ($rows as $key => $row) {
             $tag_model->setState('tag.id', $row->id);
             $tagged_items = $tag_model->getItems();
             if ($tagged_items) {
                 foreach ($tagged_items as $k => $item) {
//.........这里部分代码省略.........
开发者ID:adjaika,项目名称:J3Base,代码行数:101,代码来源:tags.php

示例7: info

 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $info_category = $config['category_link'] == 1 ? '<a href="' . static::categoryLink($item) . '" target="' . $config['open_links_window'] . '">' . $item['catname'] . '</a>' : $item['catname'];
         //
         $author = trim(htmlspecialchars($item['author_alias'])) != '' ? htmlspecialchars($item['author_alias']) : htmlspecialchars($item['author_username']);
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . NSP_GK5_Utils::avatarURL($item['author_email'], $config['avatar_size']) . '" alt="' . $author . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $author . '</span>' : $author;
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         // case when there is no rates
         if ($item['rating_count'] == 0) {
             $item['rating_count'] = 1;
         }
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_stars = '<span class="nsp-stars">';
         $stars_count = floor($item['rating_sum'] / $item['rating_count']);
         for ($i = 0; $i < 5; $i++) {
             $info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
         }
         $info_stars .= '</span>';
         $info_comments = '';
         if ($config['com_content_comments_source'] != 'none') {
             $link = static::itemLink($item);
             $info_comments = JText::_('MOD_NEWS_PRO_GK5_NO_COMMENTS');
             //
             if (isset($item['comments'])) {
                 if ($item['comments'] == 1) {
                     $info_comments = JText::_('MOD_NEWS_PRO_GK5_1COMMENT');
                 } else {
                     if ($item['comments'] > 1 && $item['comments'] < 5) {
                         $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MORECOMMENTS');
                     } else {
                         if ($item['comments'] >= 5) {
                             $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MUCHMORECOMMENTS');
                         }
                     }
                 }
             }
             $info_comments = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $info_comments . '</a>';
         }
         //
         $info_comments_short = '';
         if ($config['com_content_comments_source'] != 'none') {
             $link = static::itemLink($item);
             $info_comments_short = 0;
             //
             if (isset($item['comments'])) {
                 $info_comments_short = $item['comments'];
             }
             $info_comments_short = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $info_comments_short . '</a>';
         }
         // Featured label
         $info_featured = '';
         if (stripos($news_info, '%FEATURED') !== FALSE && $item['frontpage'] == '1') {
             $info_featured = '<strong class="is-featured">' . JText::_('MOD_NEWS_PRO_GK5_FEATURED') . '</strong>';
         }
         // Tags
         $info_tags = '';
         if (isset($item['tags']) && count($item['tags']) > 0) {
             $i = 0;
             foreach ($item['tags'] as $tag_name => $tag_id) {
                 $link = urldecode(JRoute::_(TagsHelperRoute::getTagRoute($tag_id)));
                 if ($i == 0) {
                     $info_tags .= '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $tag_name . '</a>';
                 } else {
                     $info_tags .= ', <a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $tag_name . '</a>';
                 }
                 //
                 $i++;
             }
         }
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%STARS', $info_stars, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
         $news_info = str_replace('%TAGS', $info_tags, $news_info);
         $news_info = str_replace('%FEATURED', $info_featured, $news_info);
         // only if comments used
         if ($config['com_content_comments_source'] != 'none') {
             $news_info = str_replace('%COMMENTS_SHORT', $info_comments_short, $news_info);
             $news_info = str_replace('%COMMENTS', $info_comments, $news_info);
         }
//.........这里部分代码省略.........
开发者ID:grchis,项目名称:Site-Auto,代码行数:101,代码来源:view.php

示例8: display

 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $uri = JUri::getInstance();
     $error = null;
     $rows = null;
     $results = null;
     $total = 0;
     // Get some data from the POST
     /*        $searchTags = $this->input->getString('searchTags', null, 'post');
             $tagSearchOption =  $this->input->getString('tagSearchOption', null, 'post');
       */
     // Get some data from the model
     $state = $this->get('state');
     $params = $app->getParams();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     // Because the application sets a default page title, we need to get it right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new JRegistry();
         $menu_params->loadString($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', JText::_('COM_TAGSEARCH_TAGSEARCH'));
         }
     } else {
         $params->set('page_title', JText::_('COM_TAGSEARCH_TAGSEARCH'));
     }
     $title = $params->get('page_title');
     if ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     $this->document->setTitle($title);
     if ($params->get('menu-meta_description')) {
         $this->document->setDescription($params->get('menu-meta_description'));
     }
     if ($params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
     }
     if ($params->get('robots')) {
         $this->document->setMetadata('robots', $params->get('robots'));
     }
     // Built select lists
     $tagSearchOption = $this->get('tagSearchOption');
     $checked_all = "checked ";
     $active_all = " active";
     $checked_any = "";
     $active_any = "";
     if ($tagSearchOption == "any") {
         $checked_all = "";
         $active_all = "";
         $checked_any = "checked ";
         $active_any = " active";
     }
     $lists = array();
     $searchoptions = array();
     $searchoptions[] = '<label class="btn' . $active_all . '"><input id="TS-all" type="radio" value="all" name="tagSearchOption"' . $checked_all . '>' . JText::_('COM_TAGSEARCH_ALL_TAGS') . '</label>';
     $searchoptions[] = '<label class="btn' . $active_any . '"><input id="TS-any" type="radio" value="any" name="tagSearchOption"' . $checked_any . '>' . JText::_('COM_TAGSEARCH_ANY_TAGS') . '</label>';
     $lists['searchoptions'] = implode($searchoptions);
     $alltags = $this->get('AllTags');
     $searchTags = $this->get('searchTags');
     $tags = array();
     $i = 0;
     foreach ($alltags as $tag) {
         $checked = "";
         if (in_array($tag->id, $searchTags)) {
             $checked = " checked ";
         } else {
             $checked = "";
         }
         $tags[] = '<div class="span3"><input type="checkbox" name="searchTags[]" id="stag' . $tag->id . '" value="' . $tag->id . '" ' . $checked . '><label for="stag' . $tag->id . '">' . $tag->title . '</label></div>';
     }
     $lists['alltags'] = implode($tags);
     //Build the tag list
     $tagList = array();
     foreach ($alltags as $tag) {
         $tagList[] = '<h3><a href="' . JRoute::_(TagsHelperRoute::getTagRoute($tag->id)) . '">' . $tag->title . '</a></h3>';
     }
     $lists['tagList'] = implode($tagList);
     //Get articles from tag search----------------------------
     $results = $this->get('data');
     $total = $this->get('total');
     $pagination = $this->get('pagination');
     //$app->enqueueMessage(print_r($results, true), 'error');
     //require_once JPATH_SITE . '/components/com_content/helpers/route.php';
     for ($i = 0, $count = count($results); $i < $count; $i++) {
         $result =& $results[$i];
         if ($result->created) {
             $created = JHtml::_('date', $result->created, JText::_('DATE_FORMAT_LC3'));
         } else {
             $created = '';
         }
         $result->introtext = JHtml::_('content.prepare', $result->introtext, '', 'com_search.search');
         $result->created = $created;
         //$result->count = $i + 1;
         //$app->enqueueMessage($result->title.'<br />', 'warning');
     }
     // Check for layout override
     $active = JFactory::getApplication()->getMenu()->getActive();
//.........这里部分代码省略.........
开发者ID:ShogunWeb,项目名称:Tag-search,代码行数:101,代码来源:view.html.php

示例9: getFieldContents

 /**
  * Method to get the field input markup.
  *
  * @param   array   $fieldOptions  Options to be passed into the field
  *
  * @return  string  The field HTML
  */
 public function getFieldContents(array $fieldOptions = array())
 {
     $id = isset($fieldOptions['id']) ? 'id="' . $fieldOptions['id'] . '" ' : '';
     $class = $this->class . (isset($fieldOptions['class']) ? ' ' . $fieldOptions['class'] : '');
     $front_link = $this->element['front_link'] ? (string) $this->element['front_link'] : false;
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $tagIds = is_array($this->value) ? implode(',', $this->value) : $this->value;
     if (!$this->item instanceof DataModel) {
         $this->item = $this->form->getModel();
     }
     if ($tagIds && $this->item instanceof DataModel) {
         $db = $this->form->getContainer()->platform->getDbo();
         $query = $db->getQuery(true)->select(array($db->quoteName('id'), $db->quoteName('title')))->from($db->quoteName('#__tags'))->where($db->quoteName('id') . ' IN (' . $tagIds . ')');
         $query->order($db->quoteName('title'));
         $db->setQuery($query);
         $tags = $db->loadObjectList();
         $html = '';
         foreach ($tags as $tag) {
             $html .= '<span>';
             if ($front_link) {
                 \JLoader::register('TagsHelperRoute', \JPATH_SITE . '/components/com_tags/helpers/route.php');
                 $html .= '<a href="' . \JRoute::_(\TagsHelperRoute::getTagRoute($tag->id)) . '">';
             }
             if ($translate == true) {
                 $html .= \JText::_($tag->title);
             } else {
                 $html .= $tag->title;
             }
             if ($front_link) {
                 $html .= '</a>';
             }
             $html .= '</span>';
         }
     }
     return '<span ' . ($id ? $id : '') . 'class="' . $class . '">' . $html . '</span>';
 }
开发者ID:akeeba,项目名称:fof,代码行数:43,代码来源:Tag.php

示例10: getTagsTree

 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  * @param int $parent_id
  */
 private static function getTagsTree($xmap, stdClass $parent, array &$params, $parent_id)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select(array('t.id', 't.title', 't.alias', 't.parent_id'))->from('#__tags AS t')->where('t.parent_id = ' . $db->quote($parent_id))->where('t.published = 1')->order('t.title');
     if (!$params['show_unauth']) {
         $query->where('t.access IN(' . $params['groups'] . ')');
     }
     if ($params['language_filter']) {
         $query->where('t.language IN(' . $db->quote($params['language_filter']) . ', ' . $db->quote('*') . ')');
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (empty($rows)) {
         return;
     }
     $xmap->changeLevel(1);
     foreach ($rows as $row) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->name = $row->title;
         $node->uid = $parent->uid . '_tid_' . $row->id;
         $node->browserNav = $parent->browserNav;
         $node->priority = $params['tag_priority'];
         $node->changefreq = $params['tag_changefreq'];
         $node->pid = $row->parent_id;
         $node->link = TagsHelperRoute::getTagRoute($row->id . ':' . $row->alias);
         // workaround
         if (strpos($node->link, '&Itemid=') === false) {
             $node->link .= '&Itemid=' . $parent->id;
         }
         if ($xmap->printNode($node) !== false) {
             self::getTagsTree($xmap, $parent, $params, $row->id);
             if ($params['include_tags']) {
                 self::getTagTree($xmap, $parent, $params, array($row->id));
             }
         }
     }
     $xmap->changeLevel(-1);
 }
开发者ID:b2un0,项目名称:joomla-plugin-xmap-tags,代码行数:45,代码来源:com_tags.php

示例11: getList


//.........这里部分代码省略.........
                     }
                     break;
             }
         }
         // Show content intro
         if ($show_intro) {
             // Clean HTML tags
             if ($clean_intro) {
                 $item->introtext = strip_tags($item->introtext, $allowed_tags);
                 $item->introtext = str_replace('&nbsp;', ' ', $item->introtext);
                 $item->introtext = preg_replace('/\\s{2,}/u', ' ', trim($item->introtext));
             }
             $lists[$i]->intro = $limit_intro ? self::truncateText($item->introtext, $limit_intro) : $item->introtext;
         }
         // Show content title
         if ($show_title) {
             $lists[$i]->title_name = $item->title;
             $lists[$i]->title = $title_link ? '<a href="' . $lists[$i]->link . '">' . $lists[$i]->title_name . '</a>' : $lists[$i]->title_name;
         }
         // Show content category
         if ($show_category) {
             $lists[$i]->category_name = $item->category_name;
             $lists[$i]->category_link = JRoute::_(ContentHelperRoute::getCategoryRoute($item->category_id));
             $lists[$i]->category = $category_link ? '<a href="' . $lists[$i]->category_link . '">' . $lists[$i]->category_name . '</a>' : $lists[$i]->category_name;
         }
         // Show content comments
         if ($show_comments) {
             $lists[$i]->comments_count = $item->comments_count;
             $lists[$i]->comments_link = $lists[$i]->link . $comments_link;
             $lists[$i]->comments = '<a href="' . $lists[$i]->comments_link . '">' . $item->comments_count . '</a>';
         }
         // Show content author
         if ($show_author) {
             $lists[$i]->author_name = $item->user_alias ? $item->user_alias : $item->user_name;
             $lists[$i]->author = $show_profile ? '<a href="' . $profile_link . '">' . $lists[$i]->author_name . '</a>' : $lists[$i]->author_name;
         }
         // Show author avatar
         if ($show_avatar) {
             $avatar_src = 'modules/mod_giantcontent/assets/libraries/includes/timthumb.php?src=' . JURI::base(true) . '/';
             $avatar_attr = '&amp;w=' . $avatar_width . '&amp;h=' . $avatar_height;
             $avatar_default = '<img src="' . $avatar_src . '/modules/mod_giantcontent/assets/images/avatar.png' . $avatar_attr . '"  alt="' . $item->user_name . '" />';
             $lists[$i]->avatar_user = $item->avatar_user;
             if ($avatar_system == 'easysocial') {
                 $avatar_img = $avatar_path . $item->user_id . '/' . $item->avatar_user;
             } else {
                 $avatar_img = $avatar_path . $item->avatar_user;
             }
             if (JFile::exists($avatar_img)) {
                 $lists[$i]->avatar = '<img src="' . $avatar_src . $avatar_img . $avatar_attr . '" alt="' . $item->user_name . '" />';
                 $lists[$i]->avatar = $show_profile ? '<a href="' . $profile_link . '">' . $lists[$i]->avatar . '</a>' : $lists[$i]->avatar;
             } else {
                 $lists[$i]->avatar = $show_profile ? '<a href="' . $profile_link . '">' . $avatar_default . '</a>' : $avatar_default;
             }
         }
         // Show content rating
         if ($show_rating) {
             if ($item->rating_count > 0) {
                 $lists[$i]->rating_count = $item->rating_count;
                 $lists[$i]->rating_average = number_format(round($item->rating_average), 2);
             } else {
                 $lists[$i]->rating_count = 0;
                 $lists[$i]->rating_average = 0.0;
             }
             $rating_current = number_format($item->rating_average) * 20;
             $lists[$i]->rating = '<span class="gc-rating-list"><span style="width:' . $rating_current . '%;" class="gc-rating-current"></span></span>';
         }
         // Show content tags
         if ($show_tags) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select('t.id, t.title, t.alias');
             $query->from('#__tags AS t');
             $query->join('LEFT', '#__contentitem_tag_map AS tm ON tm.tag_id = t.id');
             $query->where('t.published = 1 AND tm.type_alias = "com_content.article" AND tm.content_item_id = ' . $item->id);
             $db->setQuery($query);
             $tags = $db->loadObjectList();
             $db->setQuery('SELECT id FROM #__menu WHERE link LIKE "%index.php?option=com_tags%" AND published = 1', 0, 1);
             $Itemid = $db->loadResult();
             $Itemid = $Itemid ? '&Itemid=' . $Itemid : '';
             $list_tags = '';
             if ($tags) {
                 foreach ($tags as $tag) {
                     $link_tags = JRoute::_(TagsHelperRoute::getTagRoute($tag->id . '-' . $tag->alias . $Itemid));
                     $list_tags .= '<a class="gc-tag" href="' . $link_tags . '">' . $tag->title . '</a>';
                 }
             }
             $lists[$i]->tags = $list_tags;
         }
         // Show featured label
         if ($featured_label) {
             $db = JFactory::getDbo();
             $db->setQuery('SELECT * FROM #__content WHERE id = ' . $item->id . ' AND featured = 1');
             $featured = $db->loadResult();
             if ($featured) {
                 $lists[$i]->featured = '<span class="gc-featured" style="background: ' . $featured_label_color . '">' . $featured_label_text . '</span>';
             }
         }
     }
     return $lists;
 }
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:101,代码来源:joomla.php


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