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; }
/** * 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(); }
/** * 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(); }
</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>
/** * 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); }