0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: newsfeeds.php.tar
home/academiac/www/administrator/components/com_newsfeeds/newsfeeds.php 0000644 00000001060 15137207503 0022571 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_newsfeeds * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Access check. if (!JFactory::getUser()->authorise('core.manage', 'com_newsfeeds')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $controller = JControllerLegacy::getInstance('Newsfeeds'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); home/academiac/www/administrator/components/com_newsfeeds/models/newsfeeds.php 0000644 00000014015 15137210654 0024061 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; jimport('joomla.application.component.modellist'); /** * Methods supporting a list of newsfeed records. * * @package Joomla.Administrator * @subpackage com_newsfeeds * @since 1.6 */ class NewsfeedsModelNewsfeeds extends JModelList { /** * Constructor. * * @param array An optional associative array of configuration settings. * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'name', 'a.name', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'published', 'a.published', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'ordering', 'a.ordering', 'language', 'a.language', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'cache_time', 'a.cache_time', 'numarticles', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication('administrator'); // Load the filter state. $search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); $this->setState('filter.search', $search); $accessId = $this->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int'); $this->setState('filter.access', $accessId); $state = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_published', '', 'string'); $this->setState('filter.state', $state); $categoryId = $this->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null); $this->setState('filter.category_id', $categoryId); $language = $this->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); // Load the parameters. $params = JComponentHelper::getParams('com_newsfeeds'); $this->setState('params', $params); // List state information. parent::populateState('a.name', 'asc'); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':'.$this->getState('filter.search'); $id .= ':'.$this->getState('filter.access'); $id .= ':'.$this->getState('filter.state'); $id .= ':'.$this->getState('filter.category_id'); $id .= ':'.$this->getState('filter.language'); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); $user = JFactory::getUser(); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.id, a.name, a.alias, a.checked_out, a.checked_out_time, a.catid,' . 'a.numarticles, a.cache_time, ' . ' a.published, a.access, a.ordering, a.language, a.publish_up, a.publish_down' ) ); $query->from($db->quoteName('#__newsfeeds').' AS a'); // Join over the language $query->select('l.title AS language_title'); $query->join('LEFT', $db->quoteName('#__languages').' AS l ON l.lang_code = a.language'); // Join over the users for the checked out user. $query->select('uc.name AS editor'); $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Join over the asset groups. $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Join over the categories. $query->select('c.title AS category_title'); $query->join('LEFT', '#__categories AS c ON c.id = a.catid'); // Filter by access level. if ($access = $this->getState('filter.access')) { $query->where('a.access = '.(int) $access); } // Implement View Level Access if (!$user->authorise('core.admin')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN ('.$groups.')'); } // Filter by published state. $published = $this->getState('filter.state'); if (is_numeric($published)) { $query->where('a.published = '.(int) $published); } elseif ($published === '') { $query->where('(a.published IN (0, 1))'); } // Filter by category. $categoryId = $this->getState('filter.category_id'); if (is_numeric($categoryId)) { $query->where('a.catid = ' . (int) $categoryId); } // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = '.(int) substr($search, 3)); } else { $search = $db->Quote('%'.$db->escape($search, true).'%'); $query->where('(a.name LIKE '.$search.' OR a.alias LIKE '.$search.')'); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where('a.language = ' . $db->quote($language)); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering'); $orderDirn = $this->state->get('list.direction'); if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { $orderCol = 'c.title '.$orderDirn.', a.ordering'; } $query->order($db->escape($orderCol.' '.$orderDirn)); //echo nl2br(str_replace('#__','jos_',$query)); return $query; } } home/academiac/www/administrator/components/com_newsfeeds/controllers/newsfeeds.php 0000644 00000001275 15137211603 0025143 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; jimport('joomla.application.component.controlleradmin'); /** * Newsfeeds list controller class. * * @package Joomla.Administrator * @subpackage com_newsfeeds * @since 1.6 */ class NewsfeedsControllerNewsfeeds extends JControllerAdmin { /** * Proxy for getModel. */ public function getModel($name = 'Newsfeed', $prefix = 'NewsfeedsModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); return $model; } } home/academiac/www/administrator/components/com_newsfeeds/helpers/newsfeeds.php 0000644 00000003237 15137443224 0024245 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; /** * Newsfeeds component helper. * * @package Joomla.Administrator * @subpackage com_newsfeeds * @since 1.6 */ class NewsfeedsHelper { public static $extension = 'com_newsfeeds'; /** * Configure the Linkbar. * * @param string The name of the active view. */ public static function addSubmenu($vName) { JSubMenuHelper::addEntry( JText::_('COM_NEWSFEEDS_SUBMENU_NEWSFEEDS'), 'index.php?option=com_newsfeeds&view=newsfeeds', $vName == 'newsfeeds' ); JSubMenuHelper::addEntry( JText::_('COM_NEWSFEEDS_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&extension=com_newsfeeds', $vName == 'categories' ); if ($vName=='categories') { JToolBarHelper::title( JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_newsfeeds')), 'newsfeeds-categories'); } } /** * Gets a list of the actions that can be performed. * * @param int The category ID. * * @return JObject */ public static function getActions($categoryId = 0, $newsfeedId = 0) { $user = JFactory::getUser(); $result = new JObject; if (empty($categoryId)) { $assetName = 'com_newsfeeds'; $level = 'component'; } else { $assetName = 'com_newsfeeds.category.'.(int) $categoryId; $level = 'category'; } $actions = JAccess::getActions('com_newsfeeds', $level); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; } } home/academiac/www/components/com_newsfeeds/newsfeeds.php 0000644 00000001050 15137443462 0017716 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_newsfeeds * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Require the com_content helper library require_once JPATH_COMPONENT.'/helpers/route.php'; JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables'); $controller = JControllerLegacy::getInstance('Newsfeeds'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); home/academiac/www/plugins/search/newsfeeds/newsfeeds.php 0000644 00000011361 15137445457 0017635 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; /** * Newsfeeds Search plugin * * @package Joomla.Plugin * @subpackage Search.content * @since 1.6 */ class plgSearchNewsfeeds extends JPlugin { /** * Constructor * * @access protected * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.5 */ public function __construct(& $subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); } /** * @return array An array of search areas */ function onContentSearchAreas() { static $areas = array( 'newsfeeds' => 'PLG_SEARCH_NEWSFEEDS_NEWSFEEDS' ); return $areas; } /** * Newsfeeds 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 the search it to be restricted to areas, null if search all */ function onContentSearch($text, $phrase='', $ordering='', $areas=null) { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); 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.name LIKE '.$text; $wheres2[] = 'a.link LIKE '.$text; $where = '(' . implode(') OR (', $wheres2) . ')'; break; case 'all': case 'any': default: $words = explode(' ', $text); $wheres = array(); foreach ($words as $word) { $word = $db->Quote('%'.$db->escape($word, true).'%', false); $wheres2 = array(); $wheres2[] = 'a.name LIKE '.$word; $wheres2[] = 'a.link LIKE '.$word; $wheres[] = implode(' OR ', $wheres2); } $where = '(' . implode(($phrase == 'all' ? ') AND (' : ') OR ('), $wheres) . ')'; break; } switch ($ordering) { case 'alpha': $order = 'a.name ASC'; break; case 'category': $order = 'c.title ASC, a.name ASC'; break; case 'oldest': case 'popular': case 'newest': default: $order = 'a.name ASC'; } $searchNewsfeeds = JText::_('PLG_SEARCH_NEWSFEEDS_NEWSFEEDS'); $rows = array(); if (!empty($state)) { $query = $db->getQuery(true); //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'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id.' END as catslug'; $query->select('a.name AS title, "" AS created, a.link AS text, ' . $case_when."," . $case_when1); $query->select($query->concatenate(array($db->Quote($searchNewsfeeds), 'c.title'), " / ").' AS section'); $query->select('"1" AS browsernav'); $query->from('#__newsfeeds AS a'); $query->innerJoin('#__categories as c ON c.id = a.catid'); $query->where('('. $where .')' . 'AND a.published IN ('.implode(',', $state).') AND c.published = 1 AND c.access IN ('. $groups .')'); $query->order($order); // Filter by language if ($app->isSite() && $app->getLanguageFilter()) { $tag = JFactory::getLanguage()->getTag(); $query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); $query->where('c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); } $db->setQuery($query, 0, $limit); $rows = $db->loadObjectList(); if ($rows) { foreach($rows as $key => $row) { $rows[$key]->href = 'index.php?option=com_newsfeeds&view=newsfeed&catid='.$row->catslug.'&id='.$row->slug; } } } return $rows; } } home/academiac/www/administrator/components/com_newsfeeds/models/fields/modal/newsfeeds.php 0000644 00000005661 15137453140 0026431 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_BASE') or die; /** * Supports a modal newsfeeds picker. * * @package Joomla.Administrator * @subpackage com_newsfeeds * @since 1.6 */ class JFormFieldModal_Newsfeeds extends JFormField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'Modal_Newsfeeds'; /** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the javascript JHtml::_('behavior.framework'); JHtml::_('behavior.modal', 'input.modal'); // Build the script. $script = array(); $script[] = ' function jSelectChart_'.$this->id.'(id, name, object) {'; $script[] = ' document.id("'.$this->id.'_id").value = id;'; $script[] = ' document.id("'.$this->id.'_name").value = name;'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Build the script. $script = array(); $script[] = ' window.addEvent("domready", function() {'; $script[] = ' var div = new Element("div").setStyle("display", "none").inject(document.id("menu-types"), "before");'; $script[] = ' document.id("menu-types").inject(div, "bottom");'; $script[] = ' });'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Get the title of the linked chart $db = JFactory::getDBO(); $db->setQuery( 'SELECT name' . ' FROM #__newsfeeds' . ' WHERE id = '.(int) $this->value ); $title = $db->loadResult(); if ($error = $db->getErrorMsg()) { JError::raiseWarning(500, $error); } if (empty($title)) { $title = JText::_('COM_NEWSFEEDS_SELECT_A_FEED'); } $link = 'index.php?option=com_newsfeeds&view=newsfeeds&layout=modal&tmpl=component&function=jSelectChart_'.$this->id; JHtml::_('behavior.modal', 'a.modal'); $html = "\n".'<div class="fltlft"><input type="text" id="'.$this->id.'_name" value="'.htmlspecialchars($title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" /></div>'; $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="'.JText::_('COM_NEWSFEEDS_CHANGE_FEED_BUTTON').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('COM_NEWSFEEDS_CHANGE_FEED_BUTTON').'</a></div></div>'."\n"; // The active newsfeed id field. if (0 == (int)$this->value) { $value = ''; } else { $value = (int)$this->value; } // class='required' for client side validation $class = ''; if ($this->required) { $class = ' class="required modal-value"'; } $html .= '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />'; return $html; } } home/academiac/www/administrator/components/com_newsfeeds/models/fields/newsfeeds.php 0000644 00000002341 15137466023 0025331 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_BASE') or die; JFormHelper::loadFieldClass('list'); /** * Form Field class for the Joomla Framework. * * @package Joomla.Administrator * @subpackage com_newsfeeds * @since 1.6 */ class JFormFieldNewsfeeds extends JFormFieldList { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'Newsfeeds'; /** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { // Initialize variables. $options = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id As value, name As text'); $query->from('#__newsfeeds AS a'); $query->order('a.name'); // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } } home/academiac/www/plugins/finder/newsfeeds/newsfeeds.php 0000644 00000024130 15137551756 0017635 0 ustar 00 <?php /** * @package Joomla.Plugin * @subpackage Finder.Newsfeeds * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_BASE') or die; jimport('joomla.application.component.helper'); // Load the base adapter. require_once JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php'; /** * Finder adapter for Joomla Newsfeeds. * * @package Joomla.Plugin * @subpackage Finder.Newsfeeds * @since 2.5 */ class plgFinderNewsfeeds extends FinderIndexerAdapter { /** * The plugin identifier. * * @var string * @since 2.5 */ protected $context = 'Newsfeeds'; /** * The extension name. * * @var string * @since 2.5 */ protected $extension = 'com_newsfeeds'; /** * The sublayout to use when rendering the results. * * @var string * @since 2.5 */ protected $layout = 'newsfeed'; /** * The type of content that the adapter indexes. * * @var string * @since 2.5 */ protected $type_title = 'News Feed'; /** * The table name. * * @var string * @since 2.5 */ protected $table = '#__newsfeeds'; /** * The field the published state is stored in. * * @var string * @since 2.5 */ protected $state_field = 'published'; /** * Constructor * * @param object &$subject The object to observe * @param array $config An array that holds the plugin configuration * * @since 2.5 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); } /** * Method to update the item link information when the item category is * changed. This is fired when the item category is published or unpublished * from the list view. * * @param string $extension The extension whose category has been updated. * @param array $pks A list of primary key ids of the content that has changed state. * @param integer $value The value of the state that the content has been changed to. * * @return void * * @since 2.5 */ public function onFinderCategoryChangeState($extension, $pks, $value) { // Make sure we're handling com_newsfeeds categories if ($extension == 'com_newsfeeds') { $this->categoryStateChange($pks, $value); } } /** * Method to remove the link information for items that have been deleted. * * @param string $context The context of the action being performed. * @param JTable $table A JTable object containing the record to be deleted * * @return boolean True on success. * * @since 2.5 * @throws Exception on database error. */ public function onFinderAfterDelete($context, $table) { if ($context == 'com_newsfeeds.newsfeed') { $id = $table->id; } elseif ($context == 'com_finder.index') { $id = $table->link_id; } else { return true; } // Remove the items. return $this->remove($id); } /** * Method to determine if the access level of an item changed. * * @param string $context The context of the content passed to the plugin. * @param JTable $row A JTable object * @param boolean $isNew If the content has just been created * * @return boolean True on success. * * @since 2.5 * @throws Exception on database error. */ public function onFinderAfterSave($context, $row, $isNew) { // We only want to handle news feeds here if ($context == 'com_newsfeeds.newsfeed') { // Check if the access levels are different if (!$isNew && $this->old_access != $row->access) { // Process the change. $this->itemAccessChange($row); } // Reindex the item $this->reindex($row->id); } // Check for access changes in the category if ($context == 'com_categories.category') { // Check if the access levels are different if (!$isNew && $this->old_cataccess != $row->access) { $this->categoryAccessChange($row); } } return true; } /** * Method to reindex the link information for an item that has been saved. * This event is fired before the data is actually saved so we are going * to queue the item to be indexed later. * * @param string $context The context of the content passed to the plugin. * @param JTable $row A JTable object * @param boolean $isNew If the content is just about to be created * * @return boolean True on success. * * @since 2.5 * @throws Exception on database error. */ public function onFinderBeforeSave($context, $row, $isNew) { // We only want to handle news feeds here if ($context == 'com_newsfeeds.newsfeed') { // Query the database for the old access level if the item isn't new if (!$isNew) { $this->checkItemAccess($row); } } // Check for access levels from the category if ($context == 'com_categories.category') { // Query the database for the old access level if the item isn't new if (!$isNew) { $this->checkCategoryAccess($row); } } return true; } /** * Method to update the link information for items that have been changed * from outside the edit screen. This is fired when the item is published, * unpublished, archived, or unarchived from the list view. * * @param string $context The context for the content passed to the plugin. * @param array $pks A list of primary key ids of the content that has changed state. * @param integer $value The value of the state that the content has been changed to. * * @return void * * @since 2.5 */ public function onFinderChangeState($context, $pks, $value) { // We only want to handle news feeds here if ($context == 'com_newsfeeds.newsfeed') { $this->itemStateChange($pks, $value); } // Handle when the plugin is disabled if ($context == 'com_plugins.plugin' && $value === 0) { $this->pluginDisable($pks); } } /** * 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 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; } // Initialize the item parameters. $registry = new JRegistry; $registry->loadString($item->params); $item->params = $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 = NewsfeedsHelperRoute::getNewsfeedRoute($item->slug, $item->catslug); $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. FinderIndexer::index($item); } /** * Method to setup the indexer to be run. * * @return boolean True on success. * * @since 2.5 */ protected function setup() { // Load dependent classes. require_once JPATH_SITE . '/includes/application.php'; require_once JPATH_SITE . '/components/com_newsfeeds/helpers/route.php'; return true; } /** * Method to get the SQL query used to retrieve the list of content items. * * @param mixed $sql A JDatabaseQuery object or null. * * @return JDatabaseQuery A database object. * * @since 2.5 */ protected function getListQuery($sql = null) { $db = JFactory::getDbo(); // Check if we can use the supplied SQL query. $sql = $sql instanceof JDatabaseQuery ? $sql : $db->getQuery(true); $sql->select('a.id, a.catid, a.name AS title, a.alias, a.link AS link'); $sql->select('a.published AS state, a.ordering, a.created AS start_date, a.params, a.access'); $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date'); $sql->select('a.metakey, a.metadesc, a.metadata, a.language'); $sql->select('a.created_by, a.created_by_alias, a.modified, a.modified_by'); $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access'); // Handle the alias CASE WHEN portion of the query $case_when_item_alias = ' CASE WHEN '; $case_when_item_alias .= $sql->charLength('a.alias'); $case_when_item_alias .= ' THEN '; $a_id = $sql->castAsChar('a.id'); $case_when_item_alias .= $sql->concatenate(array($a_id, 'a.alias'), ':'); $case_when_item_alias .= ' ELSE '; $case_when_item_alias .= $a_id.' END as slug'; $sql->select($case_when_item_alias); $case_when_category_alias = ' CASE WHEN '; $case_when_category_alias .= $sql->charLength('c.alias'); $case_when_category_alias .= ' THEN '; $c_id = $sql->castAsChar('c.id'); $case_when_category_alias .= $sql->concatenate(array($c_id, 'c.alias'), ':'); $case_when_category_alias .= ' ELSE '; $case_when_category_alias .= $c_id.' END as catslug'; $sql->select($case_when_category_alias); $sql->from('#__newsfeeds AS a'); $sql->join('LEFT', '#__categories AS c ON c.id = a.catid'); return $sql; } }
©
2018.