Example #1
0
 /**
  * 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);
         }
     }
 }
Example #2
0
                ?>
						<img class="img-responsive" src="<?php 
                echo htmlspecialchars($images->image_intro);
                ?>
" alt="<?php 
                echo htmlspecialchars($images->image_intro_alt);
                ?>
">
					<?php 
            }
            ?>
				</div>
				<div class="col-sm-6 item-desc">
						<h3>
							<a href="<?php 
            echo JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router));
            ?>
">
								<?php 
            echo $this->escape($item->core_title);
            ?>
							</a>
						</h3>
					<?php 
        }
        ?>
					<?php 
        echo $item->event->afterDisplayTitle;
        ?>
					
					<?php 
        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);
Example #4
0
        }
        ?>
			
			
			<?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')) {
Example #5
0
 /**
  * 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);
 }
Example #6
0
 /**
  * Find Item static function
  *
  * @param   array  $needles  Array used to get the language value
  *
  * @return null
  *
  * @throws Exception
  */
 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $language = isset($needles['language']) ? $needles['language'] : '*';
     // Prepare the reverse lookup array.
     if (self::$lookup === null) {
         self::$lookup = array();
         $component = JComponentHelper::getComponent('com_tags');
         $items = $menus->getItems('component_id', $component->id);
         if ($items) {
             foreach ($items as $item) {
                 if (isset($item->query) && isset($item->query['view'])) {
                     $lang = $item->language != '' ? $item->language : '*';
                     if (!isset(self::$lookup[$lang])) {
                         self::$lookup[$lang] = array();
                     }
                     $view = $item->query['view'];
                     if (!isset(self::$lookup[$lang][$view])) {
                         self::$lookup[$lang][$view] = array();
                     }
                     // Only match menu items that list one tag
                     if (isset($item->query['id']) && is_array($item->query['id'])) {
                         foreach ($item->query['id'] as $position => $tagId) {
                             if (!isset(self::$lookup[$lang][$view][$item->query['id'][$position]]) || count($item->query['id']) == 1) {
                                 self::$lookup[$lang][$view][$item->query['id'][$position]] = $item->id;
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$language][$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$language][$view][(int) $id])) {
                         return self::$lookup[$language][$view][(int) $id];
                     }
                 }
             }
         }
     } else {
         $active = $menus->getActive();
         if ($active) {
             return $active->id;
         }
     }
     return null;
 }
Example #7
0
				<?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 
}
Example #8
0
 /**
  * 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) {
                     // For 3rd party extensions we need to load the component strings from its sys.ini file
                     $parts = explode('.', $item->type_alias);
                     $comp = array_shift($parts);
                     $lang->load($comp, JPATH_SITE, null, false, true) || $lang->load($comp, JPATH_SITE . '/components/' . $comp, null, false, true);
                     // Making up the type string
                     $type = implode('_', $parts);
                     $type = $comp . '_CONTENT_TYPE_' . $type;
                     $new_item = new stdClass();
                     $new_item->href = $item->link;
                     $new_item->title = $item->core_title;
                     $new_item->text = $item->core_body;
                     if ($lang->hasKey($type)) {
                         $new_item->section = JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH', JText::_($type), $row->title);
                     } else {
                         $new_item->section = JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH', $item->content_type_title, $row->title);
                     }
                     $new_item->created = $item->displayDate;
                     $new_item->browsernav = 0;
                     $final_items[] = $new_item;
                 }
             }
         }
         return $final_items;
     }
 }
Example #9
0
 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $language = isset($needles['language']) ? $needles['language'] : '*';
     // Prepare the reverse lookup array.
     if (self::$lookup === null) {
         self::$lookup = array();
         $component = JComponentHelper::getComponent('com_tags');
         $items = $menus->getItems('component_id', $component->id);
         if ($items) {
             foreach ($items as $item) {
                 if (isset($item->query) && isset($item->query['view'])) {
                     $view = $item->query['view'];
                     if (!isset(self::$lookup[$view])) {
                         self::$lookup[$view] = array();
                     }
                     // Only match menu items that list one tag
                     if (isset($item->query['id'][0]) && count($item->query['id']) == 1) {
                         // Here it will become a bit tricky
                         // language != * can override existing entries
                         // language == * cannot override existing entries
                         if (!isset(self::$lookup[$language][$view][$item->query['id'][0]]) || $item->language != '*') {
                             self::$lookup[$language][$view][$item->query['id'][0]] = $item->id;
                         }
                         self::$lookup[$view][$item->query['id'][0]] = $item->id;
                     }
                     if (isset($item->query["tag_list_language_filter"]) && $item->query["tag_list_language_filter"] != '') {
                         $language = $item->query["tag_list_language_filter"];
                     }
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$view][(int) $id])) {
                         return self::$lookup[$view][(int) $id];
                     }
                 }
             }
         }
     } else {
         $active = $menus->getActive();
         if ($active) {
             return $active->id;
         }
     }
     return null;
 }
Example #10
0
        ?>
		</div>
	<?php 
    }
    ?>

	<input type="hidden" name="filter_order" value="" />
	<input type="hidden" name="filter_order_Dir" value="" />
	<input type="hidden" name="limitstart" value="" />
	<input type="hidden" name="task" value="" />

</form>

<?php 
}
?>

<?php 
if (!$this->items) {
    echo '<div class="uk-panel uk-panel-box"><p>' . JText::_('COM_TAGS_NO_ITEMS') . '</p></div>';
} else {
    foreach ($this->items as $item) {
        $images = json_decode($item->core_images);
        $args = array('permalink' => '', 'image' => $this->params->get('tag_list_show_item_image', 1) == 1 && isset($images->image_intro) ? htmlspecialchars($images->image_intro) : '', 'image_alignment' => isset($images->float_intro) ? htmlspecialchars($images->float_intro) : '', 'image_alt' => isset($images->image_intro_alt) ? htmlspecialchars($images->image_intro_alt) : '', 'image_caption' => isset($images->image_intro_caption) ? htmlspecialchars($images->image_intro_caption) : '', 'title' => $this->escape($item->core_title), 'title_link' => '1', 'author' => $item->author, 'author_url' => '', 'date' => $item->core_created_time, 'datetime' => substr($item->core_created_time, 0, 10), 'category' => '', 'category_url' => '', 'hook_aftertitle' => '', 'hook_beforearticle' => '', 'hook_afterarticle' => '', 'article' => $this->params->get('tag_list_show_item_description', 1) ? JHtml::_('string.truncate', $item->core_body, $this->params->get('tag_list_item_maximum_characters')) : '', 'tags' => '', 'edit' => '', 'url' => $item->core_state != 0 ? JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router)) : '', 'more' => '', 'previous' => '', 'next' => '');
        // Render template
        echo $warp['template']->render('article', $args);
    }
    if ($this->params->get('show_pagination')) {
        echo $this->pagination->getPagesLinks();
    }
}
Example #11
0
 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);
         }
     } else {
         return '';
     }
     //
     return $news_info;
 }
Example #12
0
 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();
     if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
     }
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->pagination =& $pagination;
     $this->lists =& $lists;
     $this->params =& $params;
     /*
             $this->ordering      = $state->get('ordering');
             $this->searchword    = $searchword;
             $this->origkeyword   = $state->get('origkeyword');
             $this->searchphrase  = $state->get('match');
             $this->searchareas   = $areas;
             $this->action        = $uri;
     */
     // Assign data to the view
     $this->item = $this->get('Item');
     $this->state =& $state;
     $this->total = $total;
     $this->error = NULL;
     $this->results =& $results;
     //$this->results       = NULL;
     parent::display($tpl);
 }
Example #13
0
File: Tag.php Project: akeeba/fof
 /**
  * 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>';
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  * @param array $tagIds
  * @param array $typesr
  */
 private static function getTagTree($xmap, stdClass $parent, array &$params, array $tagIds, array $typesr = null)
 {
     $db = JFactory::getDbo();
     $rows = array();
     foreach ($tagIds as $tagId) {
         $listQuery = new JHelperTags();
         $query = $listQuery->getTagItemsQuery($tagId, $typesr, false, 'c.core_title', 'ASC', true, $params['language_filter']);
         $db->setQuery($query);
         $result = $db->loadObjectList();
         if (is_array($result)) {
             $rows += $result;
         }
     }
     if (empty($rows)) {
         return;
     }
     $xmap->changeLevel(1);
     foreach ($rows as $row) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->name = $row->core_title;
         $node->uid = $parent->uid . '_' . $row->content_item_id;
         $node->browserNav = $parent->browserNav;
         $node->priority = $params['tag_priority'];
         $node->changefreq = $params['tag_changefreq'];
         $node->link = TagsHelperRoute::getItemRoute($row->content_item_id, $row->core_alias, $row->core_catid, $row->core_language, $row->type_alias, $row->router);
         $xmap->printNode($node);
     }
     $xmap->changeLevel(-1);
 }
Example #15
0
 public static function getList($params)
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     // Source
     $source = $params->get('source', 'categories');
     $exclude = $params->get('exclude', array());
     $articles = $params->get('articles', array());
     $categories = $params->get('categories', array());
     // General
     $readmore = $params->get('readmore', '');
     $ordering = $params->get('ordering', 'random');
     $item_counts = $params->get('item_counts', 5);
     $skip_counts = $params->get('skip_counts', 0);
     $limit_intro = $params->get('limit_intro', 200);
     // Display
     $show_date = $params->get('show_date', 1);
     $show_hits = $params->get('show_hits', 1);
     $show_tags = $params->get('show_tags', 1);
     $show_image = $params->get('show_image', 1);
     $show_intro = $params->get('show_intro', 1);
     $show_title = $params->get('show_title', 1);
     $show_author = $params->get('show_author', 1);
     $show_avatar = $params->get('show_avatar', 1);
     $show_rating = $params->get('show_rating', 1);
     $show_profile = $params->get('show_profile', 1);
     $show_category = $params->get('show_category', 1);
     $show_comments = $params->get('show_comments', 1);
     // Date
     $date_type = $params->get('date_type', 'created');
     $date_format = $params->get('date_format', 'd F Y');
     // Image
     $image_width = $params->get('image_width', 200);
     $image_height = $params->get('image_height', 100);
     $image_quality = $params->get('image_quality', 100);
     $image_link = $params->get('image_link', 'none');
     $image_title = $params->get('image_title', 1);
     $image_resize = $params->get('image_resize', 1);
     $image_source = $params->get('image_source', 'auto');
     // 3rd-party
     $avatar_width = $params->get('avatar_width', 60);
     $avatar_height = $params->get('avatar_height', 60);
     $avatar_system = $params->get('avatar_system', 'kunena');
     $profile_system = $params->get('profile_system', 'kunena');
     $comments_system = $params->get('comments_system', 'komento');
     // User access
     $authorised = implode(',', $user->getAuthorisedViewLevels());
     // Clean HTML tags
     $clean_intro = $params->get('clean_intro', 1);
     $allowed_tags = str_replace(' ', '', $params->get('allowed_tags'));
     $allowed_tags = "<" . str_replace(',', '><', $allowed_tags) . ">";
     // Content filtering
     $tags = $params->get('tags', array());
     $author = $params->get('author', array());
     $featured = $params->get('featured', 0);
     // Featured label/ribbon
     $featured_label = $params->get('featured_label', 0);
     $featured_label_text = $params->get('featured_label_text', 'Featured');
     $featured_label_color = $params->get('featured_label_color', '#e52626');
     // Link
     $title_link = $params->get('title_link', 1);
     $category_link = $params->get('category_link', 1);
     if ($source == 'categories' && $categories) {
         if ($categories[0] != '') {
             $categories = count($categories) == 1 ? ' = ' . $categories[0] . '' : 'IN (' . implode(',', $categories) . ')';
             $query->where('a.catid ' . $categories);
         }
         $exclude ? $query->where('a.id NOT IN (' . $exclude . ')') : '';
     } else {
         if ($source == 'articles' && $articles) {
             $query->where('a.id IN (' . implode(',', $articles) . ')');
         } else {
             echo JText::_('MOD_GIANTCONTENT_ERROR_SOURCE');
             return;
         }
     }
     // Ordering
     switch ($ordering) {
         case 'random':
             $orderBy = 'RAND()';
             break;
         case 'id_asc':
             $orderBy = 'a.id ASC';
             break;
         case 'id_desc':
             $orderBy = 'a.id DESC';
             break;
         case 'title_asc':
             $orderBy = 'a.title ASC';
             break;
         case 'title_desc':
             $orderBy = 'a.title DESC';
             break;
         case 'popular_last':
             $orderBy = 'a.hits ASC';
             break;
         case 'popular_first':
             $orderBy = 'a.hits DESC';
             break;
         case 'created_oldest':
             $orderBy = 'date ASC';
             break;
         case 'created_newest':
             $orderBy = 'date DESC';
             break;
         case 'most_rated':
             $orderBy = 'rating_total DESC, r.rating_count DESC';
             break;
         case 'least_rated':
             $orderBy = 'rating_total ASC, r.rating_count ASC';
             break;
         case 'most_commented':
             $orderBy = 'comments_count DESC, comments_date DESC';
             break;
         case 'latest_commented':
             $orderBy = 'comments_date DESC, date DESC';
             break;
     }
     // Content
     $query->select('a.id, a.title, a.alias, a.introtext, a.fulltext, a.images, a.hits');
     $query->from('#__content AS a');
     // Category
     $query->select('a.catid AS category_id, c.title AS category_name, c.alias AS category_alias');
     $query->join('LEFT', '#__categories AS c ON c.id = a.catid');
     // Join user
     $query->select('u.id AS user_id, u.name AS user_name, a.created_by_alias AS user_alias');
     $query->join('LEFT', '#__users AS u ON u.id = a.created_by');
     // Join rating
     $query->select('ROUND(AVG(r.rating_sum / r.rating_count), 2) AS rating_average, r.rating_count');
     $query->join('LEFT', '#__content_rating AS r ON r.content_id = a.id');
     // Select date
     if ($date_type !== 'created') {
         $query->select('CASE WHEN a.' . $date_type . ' = "0000-00-00 00:00:00" THEN a.created ELSE a.' . $date_type . ' END AS date');
     } else {
         $query->select('a.created AS date');
     }
     // Join avatar for author
     if ($show_avatar) {
         switch ($avatar_system) {
             // K2 avatar integration - http://getk2.org
             case 'k2':
                 if (JFile::exists(JPATH_SITE . '/components/com_k2/k2.php')) {
                     $query->select('ua.image AS avatar_user');
                     $query->join('LEFT', '#__k2_users AS ua ON ua.userID = u.id');
                     $avatar_path = 'media/k2/users/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_K2');
                     return;
                 }
                 break;
                 // Kunena avatar integration - http://kunena.org
             // Kunena avatar integration - http://kunena.org
             case 'kunena':
                 if (JFile::exists(JPATH_SITE . '/components/com_kunena/kunena.php')) {
                     $query->select('ua.avatar AS avatar_user');
                     $query->join('LEFT', '#__kunena_users AS ua ON ua.userid = u.id');
                     $avatar_path = 'media/kunena/avatars/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_KUNENA');
                     return;
                 }
                 break;
                 // JomSocial avatar integration - http://jomsocial.com
             // JomSocial avatar integration - http://jomsocial.com
             case 'jomsocial':
                 if (JFile::exists(JPATH_SITE . '/components/com_community/community.php')) {
                     $query->select("ua.avatar AS avatar_user");
                     $query->join('LEFT', '#__community_users AS ua ON ua.userid = u.id');
                     $avatar_path = '';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_JOMSOCIAL');
                     return;
                 }
                 break;
                 // Comprofiler avatar integration - http://joomlapolis.com
             // Comprofiler avatar integration - http://joomlapolis.com
             case 'comprofiler':
                 if (JFile::exists(JPATH_SITE . '/components/com_comprofiler/comprofiler.php')) {
                     $query->select('ua.avatar AS avatar_user');
                     $query->join('LEFT', '#__comprofiler AS ua ON ua.user_id = u.id');
                     $avatar_path = 'images/comprofiler/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_COMPROFILER');
                     return;
                 }
                 break;
                 // EasyBlog avatar integration - http://stackideas.com
             // EasyBlog avatar integration - http://stackideas.com
             case 'easyblog':
                 if (JFile::exists(JPATH_SITE . '/components/com_easyblog/easyblog.php')) {
                     $query->select("ua.avatar AS avatar_user");
                     $query->join('LEFT', '#__easyblog_users AS ua ON ua.id = u.id');
                     $avatar_path = 'images/easyblog_avatar/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_EASYBLOG');
                     return;
                 }
                 break;
                 // EasySocial avatar integration - http://stackideas.com
             // EasySocial avatar integration - http://stackideas.com
             case 'easysocial':
                 if (JFile::exists(JPATH_SITE . '/components/com_easysocial/easysocial.php')) {
                     $query->select("ua.large AS avatar_user");
                     $query->join('LEFT', '#__social_avatars AS ua ON ua.uid = u.id');
                     $avatar_path = 'media/com_easysocial/avatars/users/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_EASYSOCIAL');
                     return;
                 }
                 break;
                 // EasyDiscuss avatar integration - http://stackideas.com
             // EasyDiscuss avatar integration - http://stackideas.com
             case 'easydiscuss':
                 if (JFile::exists(JPATH_SITE . '/components/com_easydiscuss/easydiscuss.php')) {
                     $query->select("ua.avatar AS avatar_user");
                     $query->join('LEFT', '#__discuss_users AS ua ON ua.id = u.id');
                     $avatar_path = 'images/discuss_avatar/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_EASYDISCUSS');
                     return;
                 }
                 break;
         }
     }
     // Join comments for content
     if ($show_comments || $ordering == 'most_commented' || $ordering == 'latest_commented') {
         switch ($comments_system) {
             // Default comment system
             case 'default':
                 echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_JOOMLA');
                 return;
                 break;
                 // Komento comment integration - http://stackideas.com
             // Komento comment integration - http://stackideas.com
             case 'komento':
                 if (JFile::exists(JPATH_SITE . '/components/com_komento/komento.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.created) AS comments_date');
                     $query->join('LEFT', '#__komento_comments AS cm ON cm.cid = a.id AND cm.component = "com_content" AND cm.published = 1');
                     $comments_link = '#section-kmt';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_KOMENTO');
                     return;
                 }
                 break;
                 // CComment comment integration - http://compojoom.com
             // CComment comment integration - http://compojoom.com
             case 'ccomment':
                 if (JFile::exists(JPATH_SITE . '/components/com_comment/comment.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.date) AS comments_date');
                     $query->join('LEFT', '#__comment AS cm ON cm.contentid = a.id AND cm.component = "com_content" AND cm.published = 1');
                     $comments_link = '#!/ccomment';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_CCOMMENT');
                     return;
                 }
                 break;
                 // JComments comment integration - http://joomlatune.com
             // JComments comment integration - http://joomlatune.com
             case 'jcomments':
                 if (JFile::exists(JPATH_SITE . '/components/com_jcomments/jcomments.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.date) AS comments_date');
                     $query->join('LEFT', '#__jcomments AS cm ON cm.object_id = a.id AND cm.object_group = "com_content" AND cm.published = 1');
                     $comments_link = '#comments';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_JCOMMENTS');
                     return;
                 }
                 break;
                 // JA Comment comment integration - http://joomlart.com
             // JA Comment comment integration - http://joomlart.com
             case 'jacomment':
                 if (JFile::exists(JPATH_SITE . '/components/com_jacomment/jacomment.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.date) AS comments_date');
                     $query->join('LEFT', '#__jacomment_items AS cm ON cm.contentid = a.id AND cm.option = "com_content" AND cm.published = 1');
                     $comments_link = '#jac-wrapper';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_JACOMMENT');
                     return;
                 }
                 break;
         }
     }
     // Filter tags
     if ($tags) {
         $query->join('INNER', '#__contentitem_tag_map AS t ON t.content_item_id = a.id AND t.type_alias = "com_content.article"');
         $query->where('t.tag_id IN (' . implode(',', $tags) . ')');
     }
     // Filter author
     if ($author) {
         $query->where('a.created_by IN (' . implode(',', $author) . ')');
     }
     // Filter featured
     if ($featured) {
         $query->where('a.featured = 1');
     }
     // Access or published
     $query->where('a.state = 1 AND c.published = 1 AND a.access IN (' . $authorised . ') AND c.access IN (' . $authorised . ') AND a.publish_up <= "' . JFactory::getDate() . '"');
     $query->group('a.id');
     $query->order($orderBy);
     $db->setQuery($query, $skip_counts, $item_counts);
     $items = $db->loadObjectList();
     $lists = array();
     foreach ($items as $i => &$item) {
         $lists[$i] = new stdClass();
         $lists[$i]->id = $item->id;
         $lists[$i]->date = '';
         $lists[$i]->hits = '';
         $lists[$i]->link = '';
         $lists[$i]->tags = '';
         $lists[$i]->intro = '';
         $lists[$i]->image = '';
         $lists[$i]->title = '';
         $lists[$i]->author = '';
         $lists[$i]->avatar = '';
         $lists[$i]->rating = '';
         $lists[$i]->featured = '';
         $lists[$i]->category = '';
         $lists[$i]->comments = '';
         $lists[$i]->readmore = '';
         $lists[$i]->fulltext = $item->fulltext;
         $lists[$i]->introtext = $item->introtext;
         $lists[$i]->category_id = $item->category_id;
         $lists[$i]->category_alias = $item->category_alias;
         // Content link
         $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->id . ':' . $item->alias, $item->category_id));
         // Readmore link
         $lists[$i]->readmore = $readmore ? '<a href="' . $lists[$i]->link . '"><span>' . $readmore . '</span></a>' : '';
         // Show content date
         $lists[$i]->date = $show_date ? JHtml::_('date', $item->date, $date_format) : '';
         // Show content hits
         $lists[$i]->hits = $show_hits ? '<span>' . $item->hits . '</span>' : '';
         // Show content image
         if ($show_image) {
             $img = array();
             $image = @$item->images ? json_decode($item->images) : '';
             if ($image_source == 'auto') {
                 if (@$image->image_intro || @$image->image_fulltext) {
                     $img_source = 'media';
                 } else {
                     $img_source = 'content';
                 }
             } else {
                 $img_source = $image_source;
             }
             if ($img_source == 'media') {
                 if (@$image->image_intro || @$image->image_fulltext) {
                     if (JFile::exists($img['src'] = $image->image_intro)) {
                         $img['src'] = $image->image_intro;
                     } else {
                         $img['src'] = $image->image_fulltext;
                     }
                     $img['alt'] = $item->title;
                     $img['ttl'] = $item->title;
                 }
             } else {
                 $pattern = '/<img[^>]+>/i';
                 preg_match($pattern, $item->introtext, $img_tag);
                 if (!count($img_tag)) {
                     preg_match($pattern, $item->fulltext, $img_tag);
                 }
                 if (count($img_tag)) {
                     preg_match_all('/(src|alt|title)\\s*=\\s*(["\'])(.*?)\\2/i', $img_tag[0], $img_elem);
                     $img_elem = array_combine($img_elem[1], $img_elem[3]);
                     if (@$img_elem['src']) {
                         $img['src'] = trim(@$img_elem['src']);
                         $img['alt'] = trim(@$img_elem['alt']);
                         $img['ttl'] = trim(@$img_elem['title']);
                         $item->introtext = preg_replace($pattern, '', $item->introtext, 1);
                     }
                 }
             }
             if (!@$img['src']) {
                 // Default image
                 $img['src'] = 'modules/mod_giantcontent/assets/images/default.png';
                 $img['alt'] = $item->title;
             }
             if ($img['src']) {
                 $img_src = $img_attr = $img_title = '';
                 // Use timthumb to resize image
                 if ($image_resize) {
                     $img_src = JURI::base(true) . '/modules/mod_giantcontent/assets/libraries/includes/timthumb.php?src=';
                     $img_attr = '&amp;w=' . $image_width . '&amp;h=' . $image_height . '&amp;q=' . $image_quality . '';
                 }
                 $img_src = $img_src && strncasecmp($img['src'], "http", 4) !== 0 ? $img_src . JURI::base(true) . '/' : $img_src;
                 $img['ttl'] = $image_title ? $item->title : @$img['ttl'];
                 $img_title = $img['ttl'] ? 'title="' . $img['ttl'] . '"' : '';
                 $lists[$i]->image = '<img src="' . @$img_src . @$img['src'] . @$img_attr . '" alt="' . @$img['alt'] . '" ' . @$img_title . ' />';
                 switch ($image_link) {
                     case 'none':
                         $lists[$i]->image = $lists[$i]->image;
                         break;
                     case 'content':
                         $lists[$i]->image = '<a href="' . $lists[$i]->link . '">' . $lists[$i]->image . '</a>';
                         break;
                     case 'shadowbox':
                         $lists[$i]->image = '<a href="' . @$img['src'] . '" rel="shadowbox" ' . @$img_title . '>' . $lists[$i]->image . '</a>';
                         break;
                 }
                 $lists[$i]->image_src = @$img['src'];
                 $lists[$i]->image_alt = @$img['alt'];
                 $lists[$i]->image_title = @$img['ttl'];
             }
         }
         // Show author profile
         if ($show_profile) {
             switch ($profile_system) {
                 // K2 profile integration - http://getk2.org
                 case 'k2':
                     if (JFile::exists(JPATH_SITE . '/components/com_k2/k2.php')) {
                         require_once JPATH_SITE . '/components/com_k2/helpers/route.php';
                         $profile_link = JRoute::_(K2HelperRoute::getUserRoute($item->user_id));
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_K2');
                         return;
                     }
                     break;
                     // Kunena profile integration - http://kunena.org
                 // Kunena profile integration - http://kunena.org
                 case 'kunena':
                     if (JFile::exists(JPATH_SITE . '/components/com_kunena/kunena.php')) {
                         $profile_link = KunenaRoute::_('index.php?option=com_kunena&view=profile&userid=' . $item->user_id);
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_KUNENA');
                         return;
                     }
                     break;
                     // JomSocial profile integration - http://jomsocial.com
                 // JomSocial profile integration - http://jomsocial.com
                 case 'jomsocial':
                     if (JFile::exists(JPATH_SITE . '/components/com_community/community.php')) {
                         require_once JPATH_SITE . '/components/com_community/libraries/core.php';
                         $profile_link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $item->user_id);
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_JOMSOCIAL');
                         return;
                     }
                     break;
                     // Comprofiler profile integration - http://joomlapolis.com
                 // Comprofiler profile integration - http://joomlapolis.com
                 case 'comprofiler':
                     if (JFile::exists(JPATH_SITE . '/components/com_comprofiler/comprofiler.php')) {
                         $profile_link = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******'MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_COMPROFILER');
                         return;
                     }
                     break;
                     // EasyBlog profile integration - http://stackideas.com
                 // EasyBlog profile integration - http://stackideas.com
                 case 'easyblog':
                     if (JFile::exists(JPATH_SITE . '/components/com_easyblog/easyblog.php')) {
                         require_once JPATH_SITE . '/components/com_easyblog/helpers/router.php';
                         $profile_link = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $item->user_id);
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_EASYBLOG');
                         return;
                     }
                     break;
                     // EasySocial profile integration - http://stackideas.com
                 // EasySocial profile integration - http://stackideas.com
                 case 'easysocial':
                     if (JFile::exists(JPATH_SITE . '/components/com_easysocial/easysocial.php')) {
                         $profile_link = Foundry::user($item->user_id)->getPermalink();
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_EASYSOCIAL');
                         return;
                     }
                     break;
                     // EasyDiscuss profile integration - http://stackideas.com
                 // EasyDiscuss profile integration - http://stackideas.com
                 case 'easydiscuss':
                     if (JFile::exists(JPATH_SITE . '/components/com_easydiscuss/easydiscuss.php')) {
                         require_once JPATH_SITE . '/components/com_easydiscuss/helpers/router.php';
                         $profile_link = DiscussHelper::getTable('Profile')->load($item->user_id)->getLink();
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_EASYDISCUSS');
                         return;
                     }
                     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;
 }