本文整理汇总了PHP中NewsfeedsHelperRoute类的典型用法代码示例。如果您正苦于以下问题:PHP NewsfeedsHelperRoute类的具体用法?PHP NewsfeedsHelperRoute怎么用?PHP NewsfeedsHelperRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NewsfeedsHelperRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onJSolrSearchURIGet
public function onJSolrSearchURIGet($document)
{
if ($this->get('context') == $document->context) {
require_once JPATH_ROOT . "/components/com_newsfeeds/helpers/route.php";
return NewsfeedsHelperRoute::getNewsfeedRoute($document->id, $document->parent_id);
}
return null;
}
示例2: getNewsfeedsRoute
function getNewsfeedsRoute($id, $catid)
{
$needles = array('category' => (int) $catid, 'categories' => null);
//Find the itemid
$itemid = NewsfeedsHelperRoute::_findItem($needles);
$itemid = $itemid ? '&Itemid=' . $itemid : '';
//Create the link
$link = 'index.php?option=com_newsfeeds&view=newsfeed&id=' . $id . '&catid=' . $catid . $itemid;
return $link;
}
示例3: prepareDocument
/**
* Prepares the document
*
* @return void
*/
protected function prepareDocument()
{
parent::prepareDocument();
$menu = $this->menu;
$id = (int) @$menu->query['id'];
if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $this->category->id)) {
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();
while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1) {
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item) {
$this->pathway->addItem($item['title'], $item['link']);
}
}
}
示例4: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
$jinput = JFactory::getApplication()->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'newsfeed') {
if ($id) {
$associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = NewsfeedsHelperRoute::getNewsfeedRoute($item->id, (int) $item->catid, $item->language);
}
return $return;
}
}
if ($view == 'category' || $view == 'categories') {
return self::getCategoryAssociations($id, 'com_newsfeeds');
}
return array();
}
示例5: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);
$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'newsfeed') {
if ($id) {
$associations = NewsfeedsHelper::getAssociations($id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = NewsfeedsHelperRoute::getNewsfeedRoute($item->id, $item->catid, $item->language);
}
return $return;
}
}
if ($view == 'category' || $view == 'categories') {
return self::getCategoryAssociations($id, 'com_newsfeeds');
}
return array();
}
示例6: defined
defined('_JEXEC') or die;
?>
<?php
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) {
?>
<ul>
<?php
foreach ($this->children[$this->category->id] as $id => $child) {
?>
<?php
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) {
?>
<li>
<a href="<?php
echo JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($child->id));
?>
"><?php
echo $this->escape($child->title);
?>
</a>
<?php
if ($this->params->get('show_cat_items') == 1) {
?>
<small>(<?php
echo $child->numitems;
?>
)</small>
<?php
}
示例7:
?>
<?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"';
}
?>
<li<?php
echo $class;
?>
>
<?php
$class = '';
?>
<span class="item-title"><a href="<?php
echo JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($item->id));
?>
">
<?php
echo $this->escape($item->title);
?>
</a>
</span>
<?php
if ($this->params->get('show_subcat_desc_cat') == 1) {
?>
<?php
if ($item->description) {
?>
<div class="category-desc">
<?php
示例8: _prepareDocument
/**
* Prepares the document
*
* @return void
*
* @since 1.6
*/
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::_('COM_NEWSFEEDS_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
$id = (int) @$menu->query['id'];
// If the menu item does not concern this newsfeed
if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] != 'newsfeed' || $id != $this->item->id)) {
// If this is not a single newsfeed menu item, set the page title to the newsfeed title
if ($this->item->name) {
$title = $this->item->name;
}
$path = array(array('title' => $this->item->name, 'link' => ''));
$category = JCategories::getInstance('Newsfeeds')->get($this->item->catid);
while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1) {
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item) {
$pathway->addItem($item['title'], $item['link']);
}
}
if (empty($title)) {
$title = $app->get('sitename');
} elseif ($app->get('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
} elseif ($app->get('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
if (empty($title)) {
$title = $this->item->name;
}
$this->document->setTitle($title);
if ($this->item->metadesc) {
$this->document->setDescription($this->item->metadesc);
} elseif ($this->params->get('menu-meta_description')) {
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->item->metakey) {
$this->document->setMetadata('keywords', $this->item->metakey);
} elseif ($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->get('MetaTitle') == '1') {
$this->document->setMetaData('title', $this->item->name);
}
if ($app->get('MetaAuthor') == '1') {
$this->document->setMetaData('author', $this->item->author);
}
$mdata = $this->item->metadata->toArray();
foreach ($mdata as $k => $v) {
if ($v) {
$this->document->setMetadata($k, $v);
}
}
}
示例9:
</td>
<td>
<a href="javascript:void(0)" onclick="if (window.parent) window.parent.<?php
echo $this->escape($function);
?>
('<?php
echo $item->id;
?>
', '<?php
echo $this->escape(addslashes($item->name));
?>
', '<?php
echo $this->escape($item->catid);
?>
', null, '<?php
echo $this->escape(NewsfeedsHelperRoute::getNewsfeedRoute($item->id, $item->catid, $item->language));
?>
', '<?php
echo $this->escape($lang);
?>
', null);">
<?php
echo $this->escape($item->name);
?>
</a>
<div class="small">
<?php
echo JText::_('JCATEGORY') . ": " . $this->escape($item->category_title);
?>
</div>
</td>
示例10: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @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 Registry();
$registry->loadString($item->params);
$item->params = $registry;
$registry = new Registry();
$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 = NewsfeedsHelperRoute::getNewsfeedRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// 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', 'News Feed');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
示例11:
?>
<?php
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) {
if (!isset($this->children[$this->category->id][$id + 1])) {
$class = ' class="last"';
}
?>
<li<?php
echo $class;
?>
>
<?php
$class = '';
?>
<span class="item-title"><a href="<?php
echo Route::url(NewsfeedsHelperRoute::getCategoryRoute($child->id));
?>
">
<?php
echo $this->escape($child->title);
?>
</a>
</span>
<?php
if ($this->params->get('show_subcat_desc') == 1) {
?>
<?php
if ($child->description) {
?>
<div class="category-desc">
示例12: defined
<?php
defined('_JEXEC') or die;
?>
<?php if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) : ?>
<ul>
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
<li>
<a href="<?php echo JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($item->id));?>"><?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_items_cat') == 1) : ?>
<small>(<?php echo $item->numitems; ?>)</small>
<?php endif; ?>
<?php if (($this->params->get('show_subcat_desc_cat') == 1) && $item->description) : ?>
<div><?php echo JHtml::_('content.prepare', $item->description, '', 'com_newsfeeds.categories'); ?></div>
<?php endif; ?>
<?php
if (count($item->getChildren()) > 0) {
$this->items[$item->id] = $item->getChildren();
$this->parent = $item;
$this->maxLevelcat--;
echo $this->loadTemplate('items');
$this->parent = $item->getParent();
$this->maxLevelcat++;
}
?>
</li>
示例13:
<?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::_(NewsfeedsHelperRoute::getCategoryRoute($item->id, $item->language));
?>
">
<?php
echo $this->escape($item->title);
?>
</a>
<?php
if ($this->params->get('show_cat_items_cat') == 1) {
?>
<span class="badge badge-info tip hasTooltip" title="<?php
echo JHtml::tooltipText('COM_NEWSFEEDS_NUM_ITEMS');
?>
">
<?php
echo JText::_('COM_NEWSFEEDS_NUM_ITEMS');
示例14: _prepareDocument
/**
* Prepares the document
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = \App::get('menu');
$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', Lang::txt('COM_NEWSFEEDS_DEFAULT_PAGE_TITLE'));
}
$id = (int) @$menu->query['id'];
if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $this->category->id)) {
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();
while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1) {
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item) {
Pathway::append($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 = Lang::txt('JPAGETITLE', $app->getCfg('sitename'), $title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$title = Lang::txt('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);
}
}
}
示例15:
?>
<?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"';
}
?>
<li<?php
echo $class;
?>
>
<?php
$class = '';
?>
<span class="item-title"><a href="<?php
echo Route::url(NewsfeedsHelperRoute::getCategoryRoute($item->id));
?>
">
<?php
echo $this->escape($item->title);
?>
</a>
</span>
<?php
if ($this->params->get('show_subcat_desc_cat') == 1) {
?>
<?php
if ($item->description) {
?>
<div class="category-desc">
<?php