Ejemplo n.º 1
0
        ?>
	<?php 
        if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) {
            if (!isset($this->items[$this->parent->id][$id + 1])) {
                $class = ' class="last"';
            }
            ?>
	<div<?php 
            echo $class;
            ?>
>
	<?php 
            $class = '';
            ?>
		<h3 class="page-header item-title"><a href="<?php 
            echo JRoute::_(TZ_PortfolioHelperRoute::getCategoryRoute($item->id));
            ?>
">
			<?php 
            echo $this->escape($item->title);
            ?>
</a>
			<?php 
            if ($this->params->get('show_cat_num_articles_cat') == 1) {
                ?>
				<span class="badge badge-info hasTooltip" title="<?php 
                echo JText::_('COM_CONTENT_NUM_ITEMS');
                ?>
">
					<?php 
                echo $item->numitems;
Ejemplo n.º 2
0
                    <?php 
        }
        ?>
                </span>
        <?php 
    }
    ?>

        <?php 
    if ($params->get('show_category', 1)) {
        ?>
                <span class="TzLine">|</span>
                <span class="TzBlogCategory">
                    <?php 
        $title = $this->escape($this->item->category_title);
        $url = '<a href="' . JRoute::_(TZ_PortfolioHelperRoute::getCategoryRoute($this->item->catid)) . '" itemprop="genre">' . $title . '</a>';
        ?>
                    <?php 
        if ($params->get('link_category', 1)) {
            ?>
                        <?php 
            echo JText::sprintf('COM_CONTENT_CATEGORY', $url);
            ?>
                        <?php 
        } else {
            ?>
                        <?php 
            echo JText::sprintf('COM_CONTENT_CATEGORY', '<span itemprop="genre">' . $title . '</span>');
            ?>
                    <?php 
        }
Ejemplo n.º 3
0
                            <div class="TzArticle-info">
    <!--                        <dt class="article-info-term">--><?php 
                //echo JText::_('COM_CONTENT_ARTICLE_INFO');
                ?>
<!--</dt>-->
                        <?php 
            }
            ?>

                        <?php 
            if ($params->get('show_category')) {
                ?>
                            <span class="TZcategory-name">
                                <?php 
                $title = $this->escape($row->category_title);
                $url = '<a href="' . JRoute::_(TZ_PortfolioHelperRoute::getCategoryRoute($row->catid)) . '">' . $title . '</a>';
                ?>
                                <?php 
                if ($params->get('link_category')) {
                    ?>
                                <?php 
                    echo JText::sprintf('COM_CONTENT_CATEGORY', $url);
                    ?>
                                <?php 
                } else {
                    ?>
                                <?php 
                    echo JText::sprintf('COM_CONTENT_CATEGORY', $title);
                    ?>
                                <?php 
                }
Ejemplo n.º 4
0
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
     }
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_tz_portfolio' || $menu->query['view'] == 'article' || $id != $this->category->id)) {
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_tz_portfolio' || $menu->query['view'] == 'article' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => TZ_PortfolioHelperRoute::getCategoryRoute($category->id));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $pathway->addItem($item['title'], $item['link']);
         }
     }
     $title = $this->params->get('page_title', '');
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($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 ($this->category->metadesc) {
         $this->document->setDescription($this->category->metadesc);
     } elseif (!$this->category->metadesc && $this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->category->metakey) {
         $this->document->setMetadata('keywords', $this->category->metakey);
     } elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     if ($app->getCfg('MetaAuthor') == '1') {
         $this->document->setMetaData('author', $this->category->getMetadata()->get('author'));
     }
     $mdata = $this->category->getMetadata()->toArray();
     foreach ($mdata as $k => $v) {
         if ($v) {
             $this->document->setMetadata($k, $v);
         }
     }
     // Add feed links
     if ($this->params->get('show_feed_link', 1)) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
 }
Ejemplo n.º 5
0
 public static function getList(&$params)
 {
     // Get an instance of the generic articles model
     $articles = JModelLegacy::getInstance('Articles', 'TZ_PortfolioModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $articles->setState('params', $appParams);
     // Set the filters based on the module params
     $articles->setState('list.start', 0);
     $articles->setState('list.limit', (int) $params->get('count', 0));
     $articles->setState('filter.published', 1);
     // Access filter
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $articles->setState('filter.access', $access);
     // Prep for Normal or Dynamic Modes
     $mode = $params->get('mode', 'normal');
     switch ($mode) {
         case 'dynamic':
             $option = JRequest::getCmd('option');
             $view = JRequest::getCmd('view');
             if ($option === 'com_tz_portfolio') {
                 switch ($view) {
                     case 'category':
                         $catids = array(JRequest::getInt('id'));
                         break;
                     case 'categories':
                         $catids = array(JRequest::getInt('id'));
                         break;
                     case 'article':
                         if ($params->get('show_on_article_page', 1)) {
                             $article_id = JRequest::getInt('id');
                             $catid = JRequest::getInt('catid');
                             if (!$catid) {
                                 // Get an instance of the generic article model
                                 $article = JModelLegacy::getInstance('Article', 'TZ_PortfolioModel', array('ignore_request' => true));
                                 $article->setState('params', $appParams);
                                 $article->setState('filter.published', 1);
                                 $article->setState('article.id', (int) $article_id);
                                 $item = $article->getItem();
                                 $catids = array($item->catid);
                             } else {
                                 $catids = array($catid);
                             }
                         } else {
                             // Return right away if show_on_article_page option is off
                             return;
                         }
                         break;
                     case 'featured':
                     default:
                         // Return right away if not on the category or article views
                         return;
                 }
             } else {
                 // Return right away if not on a com_content page
                 return;
             }
             break;
         case 'normal':
         default:
             $catids = $params->get('catid');
             $articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
             break;
     }
     // Category filter
     if ($catids) {
         if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
             // Get an instance of the generic categories model
             $categories = JModelLegacy::getInstance('Categories', 'TZ_PortfolioModel', array('ignore_request' => true));
             $categories->setState('params', $appParams);
             $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999;
             $categories->setState('filter.get_children', $levels);
             $categories->setState('filter.published', 1);
             $categories->setState('filter.access', $access);
             $additional_catids = array();
             foreach ($catids as $catid) {
                 $categories->setState('filter.parentId', $catid);
                 $recursive = true;
                 $items = $categories->getItems($recursive);
                 if ($items) {
                     foreach ($items as $category) {
                         $condition = $category->level - $categories->getParent()->level <= $levels;
                         if ($condition) {
                             $additional_catids[] = $category->id;
                         }
                     }
                 }
             }
             $catids = array_unique(array_merge($catids, $additional_catids));
         }
         $articles->setState('filter.category_id', $catids);
     }
     // Ordering
     $articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering'));
     $articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
     // New Parameters
     $articles->setState('filter.featured', $params->get('show_front', 'show'));
     $articles->setState('filter.author_id', $params->get('created_by', ""));
     $articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
     $articles->setState('filter.author_alias', $params->get('created_by_alias', ""));
     $articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
     $excluded_articles = $params->get('excluded_articles', '');
     if ($excluded_articles) {
         $excluded_articles = explode("\r\n", $excluded_articles);
         $articles->setState('filter.article_id', $excluded_articles);
         $articles->setState('filter.article_id.include', false);
         // Exclude
     }
     $date_filtering = $params->get('date_filtering', 'off');
     if ($date_filtering !== 'off') {
         $articles->setState('filter.date_filtering', $date_filtering);
         $articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
         $articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
         $articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
         $articles->setState('filter.relative_date', $params->get('relative_date', 30));
     }
     // Filter by language
     $articles->setState('filter.language', $app->getLanguageFilter());
     $items = $articles->getItems();
     // Display options
     $show_date = $params->get('show_date', 0);
     $show_date_field = $params->get('show_date_field', 'created');
     $show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
     $show_category = $params->get('show_category', 0);
     $show_hits = $params->get('show_hits', 0);
     $show_author = $params->get('show_author', 0);
     $show_introtext = $params->get('show_introtext', 0);
     $introtext_limit = $params->get('introtext_limit', 100);
     // Find current Article ID if on an article page
     $option = JRequest::getCmd('option');
     $view = JRequest::getCmd('view');
     if ($option === 'com_tz_portfolio' && $view === 'article') {
         $active_article_id = JRequest::getInt('id');
     } else {
         $active_article_id = 0;
     }
     // Prepare data for display using display options
     if ($items) {
         foreach ($items as &$item) {
             $item->slug = $item->id . ':' . $item->alias;
             $item->catslug = $item->catid ? $item->catid . ':' . $item->category_alias : $item->catid;
             if ($access || in_array($item->access, $authorised)) {
                 // We know that user has the privilege to view the article
                 $item->link = JRoute::_(TZ_PortfolioHelperRoute::getArticleRoute($item->slug, $item->catslug));
             } else {
                 // Angie Fixed Routing
                 $app = JFactory::getApplication();
                 $menu = $app->getMenu();
                 $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
                 if (isset($menuitems[0])) {
                     $Itemid = $menuitems[0]->id;
                 } elseif (JRequest::getInt('Itemid') > 0) {
                     //use Itemid from requesting page only if there is no existing menu
                     $Itemid = JRequest::getInt('Itemid');
                 }
                 $item->link = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $Itemid);
             }
             // Used for styling the active article
             $item->active = $item->id == $active_article_id ? 'active' : '';
             $item->displayDate = '';
             if ($show_date) {
                 $item->displayDate = JHTML::_('date', $item->{$show_date_field}, $show_date_format);
             }
             if ($item->catid) {
                 $item->displayCategoryLink = JRoute::_(TZ_PortfolioHelperRoute::getCategoryRoute($item->catid));
                 $item->displayCategoryTitle = $show_category ? '<a href="' . $item->displayCategoryLink . '">' . $item->category_title . '</a>' : '';
             } else {
                 $item->displayCategoryTitle = $show_category ? $item->category_title : '';
             }
             $item->displayHits = $show_hits ? $item->hits : '';
             $item->displayAuthorName = $show_author ? $item->author : '';
             if ($show_introtext) {
                 $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_tz_portfolio_articles_category.content');
                 $item->introtext = self::_cleanIntrotext($item->introtext);
             }
             $item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
             // added Angie show_unauthorizid
             $item->displayReadmore = $item->alternative_readmore;
         }
     }
     return $items;
 }
Ejemplo n.º 6
0
 /**
  * Prepares the document
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
     }
     $title = $this->params->get('page_title', '');
     $id = (int) @$menu->query['id'];
     // if the menu item does not concern this article
     if ($menu && ($menu->query['option'] != 'com_tz_portfolio' || $menu->query['view'] != 'article' || $id != $this->item->id)) {
         // If this is not a single article menu item, set the page title to the article title
         if ($this->item->title) {
             $title = $this->item->title;
         }
         $path = array(array('title' => $this->item->title, 'link' => ''));
         $category = JCategories::getInstance('Content')->get($this->item->catid);
         while ($category && ($menu->query['option'] != 'com_tz_portfolio' || $menu->query['view'] == 'article' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => TZ_PortfolioHelperRoute::getCategoryRoute($category->id));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $pathway->addItem($item['title'], $item['link']);
         }
     }
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($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'));
     }
     if (empty($title)) {
         $title = $this->item->title;
     }
     if (!empty($title)) {
         $title = htmlspecialchars($title);
     }
     $this->document->setTitle($title);
     $description = null;
     if ($this->item->metadesc) {
         $description = $this->item->metadesc;
     } elseif (!$this->item->metadesc && $this->params->get('menu-meta_description')) {
         $description = $this->params->get('menu-meta_description');
     } elseif (!empty($this->item->introtext)) {
         $description = strip_tags($this->item->introtext);
         $description = explode(' ', $description);
         $description = array_splice($description, 0, 25);
         $description = trim(implode(' ', $description));
         if (!strpos($description, '...')) {
             $description .= '...';
         }
     }
     if ($description) {
         $description = htmlspecialchars($description);
         $this->document->setDescription($description);
     }
     $tags = null;
     if ($this->item->metakey) {
         $tags = $this->item->metakey;
     } elseif (!$this->item->metakey && $this->params->get('menu-meta_keywords')) {
         $tags = $this->params->get('menu-meta_keywords');
     } elseif ($this->listTags) {
         foreach ($this->listTags as $tag) {
             $tags[] = $tag->name;
         }
         $tags = implode(',', $tags);
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     if ($app->getCfg('MetaAuthor') == '1') {
         $this->document->setMetaData('author', $this->item->author);
     }
     $metaImage = null;
     if ($metaMedia = $this->listMedia) {
         $metaImageSize = $this->params->get('detail_article_image_size', 'L');
         if ($metaMedia[0]->type == 'image' || $metaMedia[0]->type == 'imagegallery') {
             if (isset($metaMedia[0]->images) and !empty($metaMedia[0]->images)) {
                 $metaImage = $metaMedia[0]->images;
                 $metaImage = JUri::root() . str_replace('.' . JFile::getExt($metaImage), '_' . $metaImageSize . '.' . JFile::getExt($metaImage), $metaImage);
             }
         } elseif ($metaMedia[0]->type == 'video' || $metaMedia[0]->type == 'audio') {
             if (isset($metaMedia[0]->thumb) and !empty($metaMedia[0]->thumb)) {
                 $metaImage = $metaMedia[0]->thumb;
                 $metaImage = JUri::root() . str_replace('.' . JFile::getExt($metaImage), '_' . $metaImageSize . '.' . JFile::getExt($metaImage), $metaImage);
             }
         }
     }
     $socialInfo = new stdClass();
     $socialInfo->title = $title;
     $socialInfo->image = $metaImage;
     $socialInfo->description = $description;
     $this->assign('socialInfo', $socialInfo);
     //        $this -> document -> setMetaData('copyright','Copyright © '.date('Y',time()).' TemPlaza. All Rights Reserved.');
     // Set metadata tags with prefix property "og:"
     $this->document->addCustomTag('<meta property="og:title" content="' . $title . '"/>');
     $this->document->addCustomTag('<meta property="og:url" content="' . JRoute::_(TZ_PortfolioHelperRoute::getArticleRoute($this->item->slug, $this->item->catid), true, -1) . '"/>');
     $this->document->addCustomTag('<meta property="og:type" content="article"/>');
     if ($metaImage) {
         $this->document->addCustomTag('<meta property="og:image" content="' . $metaImage . '"/>');
     }
     if ($description) {
         $this->document->addCustomTag('<meta property="og:description" content="' . $description . '"/>');
     }
     //// End set meta tags with prefix property "og:" ////
     // Set meta tags with prefix property "article:"
     $this->document->addCustomTag('<meta property="article:author" content="' . $this->item->author . '"/>');
     $this->document->addCustomTag('<meta property="article:published_time" content="' . $this->item->created . '"/>');
     $this->document->addCustomTag('<meta property="article:modified_time" content="' . $this->item->modified . '"/>');
     $this->document->addCustomTag('<meta property="article:section" content="' . $this->escape($this->item->category_title) . '"/>');
     if ($tags) {
         $tags = htmlspecialchars($tags);
         $this->document->setMetaData('keywords', $tags);
         $this->document->addCustomTag('<meta property="article:tag" content="' . $tags . '"/>');
     }
     ///// End set meta tags with prefix property "article:" ////
     // Set meta tags with prefix name "twitter:"
     if ($author = $this->listAuthor) {
         if (isset($author->twitter) && !empty($author->twitter)) {
             $this->document->setMetaData('twitter:card', 'summary');
             if (preg_match('/(https)?(:\\/\\/www\\.)?twitter\\.com\\/(#!\\/)?@?([^\\/]*)/i', $author->twitter, $match)) {
                 if (count($match) > 1) {
                     $this->document->setMetaData('twitter:site', '@' . $match[count($match) - 1]);
                     $this->document->setMetaData('twitter:creator', '@' . $match[count($match) - 1]);
                 }
             }
             if ($metaImage) {
                 $this->document->setMetaData('twitter:image', $metaImage);
             }
             if ($description) {
                 $this->document->setMetaData('twitter:description', $description);
             }
         }
     }
     //// End set meta tags with prefix name "twitter:" ////
     $mdata = $this->item->metadata->toArray();
     foreach ($mdata as $k => $v) {
         if ($v) {
             $this->document->setMetadata($k, $v);
         }
     }
     // If there is a pagebreak heading or title, add it to the page title
     if (!empty($this->item->page_title)) {
         $this->item->title = $this->item->title . ' - ' . $this->item->page_title;
         $this->document->setTitle($this->item->page_title . ' - ' . JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $this->state->get('list.offset') + 1));
     }
     if ($this->print) {
         $this->document->setMetaData('robots', 'noindex, nofollow');
     }
 }
 /**
  * Categories Search method
  *
  * The sql must return the following fields that are
  * used in a common display routine: href, title, section, created, text,
  * browsernav
  * @param string Target search string
  * @param string mathcing option, exact|any|all
  * @param string ordering option, newest|oldest|popular|alpha|category
  * @param mixed An array if restricted to areas, null if search all
  */
 function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $searchText = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $sContent = $this->params->get('search_content', 1);
     $sArchived = $this->params->get('search_archived', 1);
     $limit = $this->params->def('search_limit', 50);
     $state = array();
     if ($sContent) {
         $state[] = 1;
     }
     if ($sArchived) {
         $state[] = 2;
     }
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . $db->escape($text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'a.title LIKE ' . $text;
             $wheres2[] = 'a.description LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'any':
         case 'all':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'a.title LIKE ' . $word;
                 $wheres2[] = 'a.description LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'a.title ASC';
             break;
         case 'category':
         case 'popular':
         case 'newest':
         case 'oldest':
         default:
             $order = 'a.title DESC';
     }
     $text = $db->Quote('%' . $db->escape($text, true) . '%', false);
     $query = $db->getQuery(true);
     $return = array();
     if (!empty($state)) {
         //sqlsrv changes
         $case_when = ' CASE WHEN ';
         $case_when .= $query->charLength('a.alias');
         $case_when .= ' THEN ';
         $a_id = $query->castAsChar('a.id');
         $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
         $case_when .= ' ELSE ';
         $case_when .= $a_id . ' END as slug';
         $query->select('a.title, a.description AS text, "" AS created, "2" AS browsernav, a.id AS catid, ' . $case_when);
         $query->from('#__categories AS a');
         $query->where('(a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ') AND a.published IN (' . implode(',', $state) . ') AND a.extension = \'com_content\'' . 'AND a.access IN (' . $groups . ')');
         $query->group('a.id');
         $query->order($order);
         if ($app->isSite() && $app->getLanguageFilter()) {
             $query->where('a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')');
         }
         $db->setQuery($query, 0, $limit);
         $rows = $db->loadObjectList();
         if ($rows) {
             $count = count($rows);
             for ($i = 0; $i < $count; $i++) {
                 $rows[$i]->href = TZ_PortfolioHelperRoute::getCategoryRoute($rows[$i]->slug);
                 $rows[$i]->section = JText::_('JCATEGORY');
             }
             foreach ($rows as $key => $category) {
                 if (searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
                     $return[] = $category;
                 }
             }
         }
     }
     return $return;
 }
Ejemplo n.º 8
0
 function display()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $params = $app->getParams();
     $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author';
     $siteEmail = $app->getCfg('mailfrom');
     // Get some data from the model
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     $category = $this->get('Category');
     $rows = $this->get('Items');
     $doc->link = JRoute::_(TZ_PortfolioHelperRoute::getCategoryRoute($category->id));
     if ($params->get('show_feed_image', 1) == 1) {
         $model = JModelLegacy::getInstance('Media', 'TZ_PortfolioModel');
     }
     $blogItemParams = $params;
     foreach ($rows as $row) {
         $media = $model->getMedia($row->id);
         // strip html from feed item title
         $title = $this->escape($row->title);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // Compute the article slug
         $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
         // url link to article
         $blogItemParams->merge($row->params);
         if ($blogItemParams->get('tz_portfolio_redirect') == 'p_article') {
             $link = JRoute::_(TZ_PortfolioHelperRoute::getPortfolioArticleRoute($row->slug, $row->catid));
         } else {
             $link = JRoute::_(TZ_PortfolioHelperRoute::getArticleRoute($row->slug, $row->catid));
         }
         // image to article
         $image = null;
         if ($params->get('show_feed_image', 1) == 1) {
             $size = $params->get('feed_image_size', 'S');
             if (strtolower($media[0]->type) == 'video' || strtolower($media[0]->type) == 'audio') {
                 $image = $media[0]->thumb;
             } else {
                 $image = $media[0]->images;
             }
             if ($image) {
                 $image = str_replace('.' . JFile::getExt($image), '_' . $size . '.' . JFile::getExt($image), $image);
                 $_link = $link;
                 if (!preg_match('/' . JURI::base() . '/', $link)) {
                     $_link = str_replace(JURI::base(true) . '/', JURI::base(), $link);
                 }
                 $image = '<a href="' . $_link . '"><img src="' . $image . '" alt="' . $title . '"/></a>';
             }
         }
         // strip html from feed item description text
         // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
         $description = $params->get('feed_summary', 0) ? $row->introtext : $row->introtext;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         @($date = $row->created ? date('r', strtotime($row->created)) : '');
         if (isset($media[0]->type) && strtolower($media[0]->type) == 'quote') {
             $author = $media[0]->quote_author;
         }
         if (isset($media[0]->type) && (strtolower($media[0]->type) == 'quote' || strtolower($media[0]->type) == 'link')) {
             if (strtolower($media[0]->type) == 'quote') {
                 $description = $media[0]->quote_text . '<span class="author">' . $author . '</span>';
             }
         }
         // load individual item creator class
         $item = new JFeedItem();
         if (isset($media[0]->type) && (strtolower($media[0]->type) != 'quote' && strtolower($media[0]->type) != 'link') || !isset($media[0]->type)) {
             $item->title = $title;
             $item->link = $link;
         } else {
             if (strtolower($media[0]->type) == 'link') {
                 $item->title = $media[0]->link_title;
                 $item->link = $media[0]->link_url;
             }
         }
         $item->description = $image . $description;
         $item->date = $date;
         $item->category = $row->category;
         $item->author = $author;
         if ($feedEmail == 'site') {
             $item->authorEmail = $siteEmail;
         } else {
             $item->authorEmail = $row->author_email;
         }
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
Ejemplo n.º 9
0
							<?php 
                    }
                    ?>
						</div>
					</dd>
				<?php 
                }
                ?>
				<?php 
                if ($params->get('show_category')) {
                    ?>
					<dd>
						<div class="category-name">
							<?php 
                    $title = $this->escape($item->category_title);
                    $url = '<a href="' . JRoute::_(TZ_PortfolioHelperRoute::getCategoryRoute($item->catslug)) . '">' . $title . '</a>';
                    ?>
							<?php 
                    if ($params->get('link_category') and $item->catslug) {
                        ?>
								<?php 
                        echo JText::sprintf('COM_CONTENT_CATEGORY', $url);
                        ?>
							<?php 
                    } else {
                        ?>
								<?php 
                        echo JText::sprintf('COM_CONTENT_CATEGORY', $title);
                        ?>
							<?php 
                    }