Exemplo n.º 1
0
 function display()
 {
     global $mainframe;
     $doc =& JFactory::getDocument();
     $params =& $mainframe->getParams();
     // Get some data from the model
     JRequest::setVar('limit', $mainframe->getCfg('feed_limit'));
     // Lets get our data from the model
     $rows =& $this->get('Data');
     $section =& $this->get('Section');
     $doc->link = JRoute::_(ContentHelperRoute::getSectionRoute($section->id));
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->title);
         $title = html_entity_decode($title);
         // url link to article
         // & used instead of & as this is converted by feed creator
         $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
         // strip html from feed item description text
         $description = $params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $row->created;
         $item->category = $row->category;
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
Exemplo n.º 2
0
/**
* Sections 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 plgSearchSections($text, $phrase = '', $ordering = '', $areas = null)
{
    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $searchText = $text;
    require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchSectionAreas()))) {
            return array();
        }
    }
    // load plugin params info
    $plugin =& JPluginHelper::getPlugin('search', 'sections');
    $pluginParams = new JParameter($plugin->params);
    $limit = $pluginParams->def('search_limit', 50);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    switch ($ordering) {
        case 'alpha':
            $order = 'a.name ASC';
            break;
        case 'category':
        case 'popular':
        case 'newest':
        case 'oldest':
        default:
            $order = 'a.name DESC';
    }
    $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
    $query = 'SELECT a.title AS title, a.description AS text, a.name, ' . ' "" AS created,' . ' "2" AS browsernav,' . ' a.id AS secid' . ' FROM #__sections AS a' . ' WHERE ( a.name LIKE ' . $text . ' OR a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ' )' . ' AND a.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
    $db->setQuery($query, 0, $limit);
    $rows = $db->loadObjectList();
    $count = count($rows);
    for ($i = 0; $i < $count; $i++) {
        $rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
        $rows[$i]->section = JText::_('Section');
    }
    $return = array();
    foreach ($rows as $key => $section) {
        if (searchHelper::checkNoHTML($section, $searchText, array('name', 'title', 'text'))) {
            $return[] = $section;
        }
    }
    return $return;
}
Exemplo n.º 3
0
/**
* Sections 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 plgSearchJFSections($text, $phrase = '', $ordering = '', $areas = null)
{
    $db = JFactory::getDBO();
    $user = JFactory::getUser();
    $registry = JFactory::getConfig();
    $lang = $registry->getValue("config.jflang");
    require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchSectionAreas()))) {
            return array();
        }
    }
    // load plugin params info
    $plugin = JPluginHelper::getPlugin('search', 'jfsections');
    $pluginParams = new JParameter($plugin->params);
    $limit = $pluginParams->def('search_limit', 50);
    $activeLang = $pluginParams->def('active_language_only', 0);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    switch ($ordering) {
        case 'alpha':
            $order = 'a.name ASC';
            break;
        case 'category':
        case 'popular':
        case 'newest':
        case 'oldest':
        default:
            $order = 'a.name DESC';
    }
    $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
    $query = 'SELECT a.title AS title, a.description AS text,' . ' "" AS created,' . ' "2" AS browsernav,' . ' a.id AS secid,' . ' jfl.code as jflang, jfl.title as jflname' . ' FROM #__sections AS a' . "\n LEFT JOIN #__jf_content as jfc ON reference_id = a.id" . "\n LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.lang_id" . ' WHERE jfc.value LIKE ' . $text . ' AND a.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . "\n AND jfc.reference_table = 'sections'" . ($activeLang ? "\n AND jfl.code = '{$lang}'" : '') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
    $db->setQuery($query, 0, $limit);
    $rows = $db->loadObjectList();
    $count = count($rows);
    for ($i = 0; $i < $count; $i++) {
        $rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
        $rows[$i]->section = JText::_('Section') . " - " . $rows[$i]->jflname;
    }
    return $rows;
}
Exemplo n.º 4
0
 function getItems($args)
 {
     global $mainframe;
     $advlink =& AdvLink::getInstance();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
     $sections = AdvlinkContent::_section();
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     switch ($view) {
         default:
             foreach ($sections as $section) {
                 $items[] = array('id' => ContentHelperRoute::getSectionRoute($section->id), 'name' => $section->title, 'class' => 'folder content');
             }
             // Check Static/Uncategorized permissions
             if ($advlink->checkAccess('advlink_static', '1')) {
                 $items[] = array('id' => 'option=com_content&amp;view=uncategorized', 'name' => JText::_('UNCATEGORIZED'), 'class' => 'folder content nolink');
             }
             break;
         case 'section':
             $categories = AdvLink::getCategory($args->id);
             foreach ($categories as $category) {
                 $items[] = array('id' => ContentHelperRoute::getCategoryRoute($category->slug, $args->id), 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder content');
             }
             break;
         case 'category':
             $articles = AdvlinkContent::_articles($args->id);
             foreach ($articles as $article) {
                 $items[] = array('id' => ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid), 'name' => $article->title . ' / ' . $article->alias, 'class' => 'file');
             }
             break;
         case 'uncategorized':
             $statics = AdvlinkContent::_statics();
             foreach ($statics as $static) {
                 $items[] = array('id' => ContentHelperRoute::getArticleRoute($static->id), 'name' => $static->title . ' / ' . $static->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
Exemplo n.º 5
0
    ?>
	<p class="meta">

		<?php 
    if ($this->item->params->get('show_author') && $this->item->author != "") {
        JText::printf('Written by', $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author);
    }
    if ($this->item->params->get('show_create_date')) {
        echo ' ' . JText::_('on') . ' ' . JHTML::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'));
    }
    echo '. ';
    if ($this->item->params->get('show_section') && $this->item->sectionid || $this->item->params->get('show_category') && $this->item->catid) {
        echo JText::_('Posted in ');
        if ($this->item->params->get('show_section') && $this->item->sectionid && isset($this->section->title)) {
            if ($this->item->params->get('link_section')) {
                echo '<a href="' . JRoute::_(ContentHelperRoute::getSectionRoute($this->item->sectionid)) . '">';
            }
            echo $this->section->title;
            if ($this->item->params->get('link_section')) {
                echo '</a>';
            }
            if ($this->item->params->get('show_category')) {
                echo ' - ';
            }
        }
        if ($this->item->params->get('show_category') && $this->item->catid) {
            if ($this->item->params->get('link_category')) {
                echo '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug, $this->item->sectionid)) . '">';
            }
            echo $this->item->category;
            if ($this->item->params->get('link_category')) {
Exemplo n.º 6
0
    public function getLinks($args) {
        $wf = WFEditorPlugin::getInstance();

        require_once(JPATH_SITE . '/components/com_content/helpers/route.php');

        $items = array();
        $view = isset($args->view) ? $args->view : '';

        switch ($view) {
            // get top-level sections / categories
            default:
                $sections = self::_getSection();

                foreach ($sections as $section) {
                    $url = '';

                    // Joomla! 1.5	
                    if (method_exists('ContentHelperRoute', 'getSectionRoute')) {
                        $id = ContentHelperRoute::getSectionRoute($section->id);
                        $view = 'section';
                    } else {
                        $id = ContentHelperRoute::getCategoryRoute($section->slug);
                        $view = 'category';
                    }

                    if (strpos($id, 'index.php?Itemid=') !== false) {
                        $url = self::_getMenuLink($id);
                        $id = 'index.php?option=com_content&view=' . $view . '&id=' . $section->id;
                    }

                    $items[] = array(
                        'url' => $url,
                        'id' => $id,
                        'name' => $section->title,
                        'class' => 'folder content'
                    );
                }
                // Check Static/Uncategorized permissions
                if (!defined('JPATH_PLATFORM') && $wf->checkAccess('static', 1)) {
                    $items[] = array(
                        'id' => 'option=com_content&amp;view=uncategorized',
                        'name' => WFText::_('WF_LINKS_JOOMLALINKS_UNCATEGORIZED'),
                        'class' => 'folder content nolink'
                    );
                }
                break;
            // get categories in section or sub-categories (Joomla! 1.6+)
            case 'section':
                $articles = array();

                // Joomla! 1.5
                if (method_exists('ContentHelperRoute', 'getSectionRoute')) {
                    $categories = WFLinkBrowser::getCategory($args->id, 'com_content');
                } else {
                    $categories = WFLinkBrowser::getCategory('com_content', $args->id);

                    // get any articles in this category (in Joomla! 1.6+ a category can contain sub-categories and articles)
                    $articles = self::_getArticles($args->id);
                }

                foreach ($categories as $category) {
                    $url = '';
                    $id = ContentHelperRoute::getCategoryRoute($category->id, $args->id);

                    if (strpos($id, 'index.php?Itemid=') !== false) {
                        $url = self::_getMenuLink($id);
                        $id = 'index.php?option=com_content&view=category&id=' . $category->id;
                    }

                    $items[] = array(
                        'url' => $url,
                        'id' => $id,
                        'name' => $category->title . ' / ' . $category->alias,
                        'class' => 'folder content'
                    );
                }

                if (!empty($articles)) {
                    // output article links
                    foreach ($articles as $article) {
                        // Joomla! 1.5
                        if (isset($article->sectionid)) {
                            $id = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid);
                        } else {
                            $id = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug);
                        }

                        $items[] = array(
                            'id' => $id,
                            'name' => $article->title . ' / ' . $article->alias,
                            'class' => 'file'
                        );

                        $anchors = self::getAnchors($article->content);

                        foreach ($anchors as $anchor) {
                            $items[] = array(
                                'id' => $id . '#' . $anchor,
                                'name' => '#' . $anchor,
                                'class' => 'file anchor'
                            );
                        }
                    }
                }

                break;
            // get articles and / or sub-categories
            case 'category':
                // get any articles in this category (in Joomla! 1.6+ a category can contain sub-categories and articles)
                $articles = self::_getArticles($args->id);

                if (defined('JPATH_PLATFORM')) {
                    // get sub-categories
                    $categories = WFLinkBrowser::getCategory('com_content', $args->id);

                    if (count($categories)) {
                        foreach ($categories as $category) {
                            // check for sub-categories					
                            $sub = WFLinkBrowser::getCategory('com_content', $category->id);

                            $url = '';
                            $id = ContentHelperRoute::getCategoryRoute($category->id, $args->id);

                            // get sub-categories
                            if (count($sub)) {
                                $url = $id;
                                $id = 'index.php?option=com_content&view=section&id=' . $category->id;
                                // no sub-categories, get articles for category
                            } else {
                                // no com_content, might be link like index.php?ItemId=1
                                if (strpos($id, 'index.php?Itemid=') !== false) {
                                    $url = $id; //$id;
                                    $id = 'index.php?option=com_content&view=category&id=' . $category->id;
                                }
                            }

                            if (strpos($url, 'index.php?Itemid=') !== false) {
                                $url = self::_getMenuLink($url);
                            }

                            $items[] = array(
                                'url' => $url,
                                'id' => $id,
                                'name' => $category->title . ' / ' . $category->alias,
                                'class' => 'folder content'
                            );
                        }
                    }
                }

                // output article links
                foreach ($articles as $article) {
                    // Joomla! 1.5
                    if (isset($article->sectionid)) {
                        $id = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid);
                    } else {
                        $id = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug);
                    }

                    $items[] = array(
                        'id' => $id,
                        'name' => $article->title . ' / ' . $article->alias,
                        'class' => 'file'
                    );

                    $anchors = self::getAnchors($article->content);

                    foreach ($anchors as $anchor) {
                        $items[] = array(
                            'id' => $id . '#' . $anchor,
                            'name' => '#' . $anchor,
                            'class' => 'file anchor'
                        );
                    }
                }

                break;
            case 'uncategorized':
                $statics = self::_getUncategorized();
                foreach ($statics as $static) {
                    $id = ContentHelperRoute::getArticleRoute($static->id);

                    $items[] = array(
                        'id' => $id,
                        'name' => $static->title . ' / ' . $static->alias,
                        'class' => 'file'
                    );

                    $anchors = self::getAnchors($statics->content);

                    foreach ($anchors as $anchor) {
                        $items[] = array(
                            'id' => $id . '#' . $anchor,
                            'name' => '#' . $anchor,
                            'class' => 'file anchor'
                        );
                    }
                }
                break;
        }
        return $items;
    }
Exemplo n.º 7
0
<?php

// no direct access
defined('_JEXEC') or die('Restricted access');
?>
<ul class="sections<?php 
echo $params->get('moduleclass_sfx');
?>
"><?php 
foreach ($list as $item) {
    ?>
<li>
	<a href="<?php 
    echo JRoute::_(ContentHelperRoute::getSectionRoute($item->id));
    ?>
">
		<?php 
    echo $item->title;
    ?>
</a>
</li>
<?php 
}
?>
</ul>
Exemplo n.º 8
0
		<?php echo $this->article->event->beforeDisplayContent; ?>

		<?php if (isset ($this->article->toc)) : ?>
			<?php echo $this->article->toc; ?>
		<?php endif; ?>

		<?php echo $this->article->text; ?>

		<?php echo $this->article->event->afterDisplayContent; ?>
		<?php /** Begin Article Sec/Cat **/ if (($this->params->get('show_section') && $this->article->sectionid) || ($this->params->get('show_category') && $this->article->catid)) : ?>
		<p class="rt-article-cat">
			<?php if ($this->params->get('show_section') && $this->article->sectionid && isset($this->article->section)) : ?>
			<span class="rt-section">
				<?php if ($this->params->get('link_section')) : ?>
					<?php echo '<a href="'.JRoute::_(ContentHelperRoute::getSectionRoute($this->article->sectionid)).'">'; ?>
				<?php endif; ?>
				<?php echo $this->escape($this->article->section); ?>
				<?php if ($this->params->get('link_section')) : ?>
					<?php echo '</a>'; ?>
				<?php endif; ?>
				<?php if ($this->params->get('show_category')) : ?>
					<?php echo ' - '; ?>
				<?php endif; ?>
			</span>
			<?php endif; ?>
			<?php if ($this->params->get('show_category') && $this->article->catid) : ?>
			<span class="rt-category">
				<?php if ($this->params->get('link_category')) : ?>
					<?php echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->article->catslug, $this->article->sectionid)).'">'; ?>
				<?php endif; ?>
 private function _getUrl15($node)
 {
     $url = '';
     switch ($node->type) {
         case 'article':
             $url = str_replace('&', '&amp;', ContentHelperRoute::getArticleRoute($node->id, $node->catid, $node->section));
             break;
         case 'category':
             $url = str_replace('&', '&amp;', ContentHelperRoute::getCategoryRoute($node->catid, $node->section));
             break;
         default:
             $url = str_replace('&', '&amp;', ContentHelperRoute::getSectionRoute($node->sectionid));
     }
     return $url;
 }
Exemplo n.º 10
0
 /**
  * Takes in a section id and returns the relative
  * blog URL for that section. 
  * 
  * @param integer $sectionid
  * @return string URL
  */
 function getSectionURL($sectionid)
 {
     return JRoute::_(ContentHelperRoute::getSectionRoute($sectionid) . '&layout=blog');
 }
Exemplo n.º 11
0
    }
    ?>
			
			<?php 
    if ($this->params->get('show_section') && $this->article->sectionid || $this->params->get('show_category') && $this->article->catid) {
        ?>
			
			<?php 
        if ($this->params->get('show_section') && $this->article->sectionid && isset($this->article->section)) {
            ?>
				<span class="article-section">			
					<?php 
            if ($this->params->get('link_section')) {
                ?>
						<a href="<?php 
                echo JRoute::_(ContentHelperRoute::getSectionRoute($this->article->sectionid));
                ?>
">
					<?php 
            }
            ?>
			
					<?php 
            echo $this->article->section;
            ?>
					<?php 
            if ($this->params->get('link_section')) {
                ?>
						</a>
					<?php 
            }
Exemplo n.º 12
0
    ?>
<div class="article-toolswrap">
	<div class="article-tools clearfix">
		<div class="article-meta">
		<?php 
    if ($this->item->params->get('show_section') && $this->item->sectionid || $this->item->params->get('show_category') && $this->item->catid) {
        ?>
			<?php 
        if ($this->item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) {
            ?>
			<span class="article-section">
				<?php 
            if ($this->item->params->get('link_section')) {
                ?>
					<a href="<?php 
                echo JRoute::_(ContentHelperRoute::getSectionRoute($this->item->sectionid));
                ?>
">
				<?php 
            }
            ?>
				<?php 
            echo $this->item->section;
            ?>
				<?php 
            if ($this->item->params->get('link_section')) {
                ?>
</a><?php 
            }
            ?>
					<?php 
Exemplo n.º 13
0
        echo $this->escape($item->title);
        ?>
</a></h4>
		<?php 
        if ($this->params->get('show_section') && $item->sectionid && isset($item->section) || $this->params->get('show_category') && $item->catid) {
            ?>
			<div>
			<?php 
            if ($this->params->get('show_section') && $item->sectionid && isset($item->section)) {
                ?>
				<span>
				<?php 
                if ($this->params->get('link_section')) {
                    ?>
					<?php 
                    echo '<a href="' . JRoute::_(ContentHelperRoute::getSectionRoute($item->sectionid)) . '">' . $item->section . '</a>';
                    ?>
				<?php 
                } else {
                    ?>
					<?php 
                    echo $item->section;
                    ?>
				<?php 
                }
                ?>
				<?php 
                if ($this->params->get('show_category') && $item->catid) {
                    ?>
 - <?php 
                }
Exemplo n.º 14
0
 function getDatas(&$helper, $params)
 {
     $catsid = $params->get('catsid');
     $type = $helper->get('type');
     if (!is_array($catsid)) {
         $arr_cats[] = $catsid;
     } else {
         $arr_cats = $catsid;
     }
     $moduleid = $helper->moduleid;
     foreach ($arr_cats as $cat) {
         $type_arr = explode('.', $cat);
         $type = $type_arr[0];
         $catid = isset($type_arr[1]) ? $type_arr[1] : 0;
         $params_cat = new JParameter('');
         $cooki_name = 'mod' . $moduleid . '_' . $type . $catid;
         if (isset($_COOKIE[$cooki_name]) && $_COOKIE[$cooki_name] != '') {
             $cookie_user_setting = $_COOKIE[$cooki_name];
             $arr_values = explode('&', $cookie_user_setting);
             if ($arr_values) {
                 foreach ($arr_values as $row) {
                     list($k, $value) = explode('=', $row);
                     if ($k != '') {
                         $params_cat->set($k, $value);
                     }
                 }
             }
         }
         //$catid = $helper->get('chooseCatid');
         $_categories = array();
         $_section = array();
         $articles = array();
         $cats = array();
         if (!$catid) {
             continue;
         }
         if ($type == 'sec') {
             $_section = $this->loadSection($catid, $helper);
             $_categories = $this->loadCategories($catid, 'section', $helper);
             $cat_link = JRoute::_(ContentHelperRoute::getSectionRoute($_section->id));
             $cat_title = $_section->title;
             $cat_desc = $_section->description;
         } elseif ($type == 'cat') {
             $cats = $this->loadCategories($catid, 'category', $helper);
             if ($cats) {
                 foreach ($cats as $cat) {
                     $cat_link = JRoute::_(ContentHelperRoute::getCategoryRoute($cat->id, $cat->section));
                     $cat_title = $cat->title;
                     $cat_desc = $cat->description;
                     $_section = $cat;
                     break;
                 }
             }
         }
         if (!count($_section) && !count($_categories)) {
             return;
         }
         $_categories_org = $_categories;
         $cookie_catsid = array();
         if ($params_cat->get('cookie_catsid', '') != '') {
             $cookie_catsid = explode(',', $params_cat->get('cookie_catsid', ''));
             if ($_categories) {
                 $temp = array();
                 foreach ($_categories as $k => $cat) {
                     if (in_array($cat->id, $cookie_catsid)) {
                         $temp[] = $_categories[$k];
                     }
                 }
                 $_categories = $temp;
             }
         }
         if ($helper->get('groupbysubcat', 0)) {
             $maxSubCats = $params_cat->get('maxSubCats', $helper->get('maxSubCats', -1));
             if ($maxSubCats == -1) {
                 $maxSubCats = count($_categories);
             }
             $temp = array();
             if ($_categories) {
                 $i = 0;
                 foreach ($_categories as $j => $cat) {
                     $rows = $this->getArticles($cat->id, $helper, $params_cat);
                     if ($rows) {
                         $temp[] = $cat;
                         $articles[$cat->id] = $rows;
                         $i++;
                         if ($i == $maxSubCats) {
                             break;
                         }
                     }
                 }
                 $_categories = $temp;
             }
         } else {
             $catids = array();
             if ($_categories) {
                 foreach ($_categories as $cat) {
                     $catids[] = $cat->id;
                 }
             } elseif ($cats) {
                 $catids[] = $_section->id;
             }
             $catids = implode(',', $catids);
             $articles = $this->getArticles($catids, $helper, $params_cat);
         }
         $helper->articles[$type . $catid] = $articles;
         $helper->_section[$type . $catid] = $_section;
         $helper->_categories[$type . $catid] = $_categories;
         $helper->_categories_org[$type . $catid] = $_categories_org;
         $helper->cat_link[$type . $catid] = $cat_link;
         $helper->cat_title[$type . $catid] = $cat_title;
         $helper->cat_desc[$type . $catid] = $cat_desc;
     }
 }