Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/com_newsfeeds.tar

controller.php000064400000002506151165720360007451 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Newsfeeds Component Controller
 *
 * @since  1.5
 */
class NewsfeedsController extends JControllerLegacy
{
	/**
	 * Method to show a newsfeeds view
	 *
	 * @param   boolean  $cachable   If true, the view output will be cached
	 * @param   array    $urlparams  An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
	 *
	 * @return  JControllerLegacy		This object to support chaining.
	 *
	 * @since   1.5
	 */
	public function display($cachable = false, $urlparams = false)
	{
		$cachable = true;

		// Set the default view name and format from the Request.
		$vName = $this->input->get('view',
'categories');
		$this->input->set('view', $vName);

		$user = JFactory::getUser();

		if ($user->get('id') || ($this->input->getMethod() ===
'POST' && $vName === 'category'))
		{
			$cachable = false;
		}

		$safeurlparams = array('id' => 'INT',
'limit' => 'UINT', 'limitstart' =>
'UINT',
								'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD', 'lang' =>
'CMD');

		parent::display($cachable, $safeurlparams);
	}
}
helpers/association.php000064400000003337151165720360011247
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR .
'/components/com_newsfeeds/helpers/newsfeeds.php');
JLoader::register('NewsfeedsHelperRoute', JPATH_SITE .
'/components/com_newsfeeds/helpers/route.php');
JLoader::register('CategoryHelperAssociation',
JPATH_ADMINISTRATOR .
'/components/com_categories/helpers/association.php');

/**
 * Newsfeeds Component Association Helper
 *
 * @since  3.0
 */
abstract class NewsfeedsHelperAssociation extends CategoryHelperAssociation
{
	/**
	 * 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   = $view === null ? $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();
	}
}
helpers/category.php000064400000001223151165720360010540 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Content Component Category Tree
 *
 * @since  1.6
 */
class NewsfeedsCategories extends JCategories
{
	/**
	 * Constructor
	 *
	 * @param   array  $options  options
	 */
	public function __construct($options = array())
	{
		$options['table'] = '#__newsfeeds';
		$options['extension'] = 'com_newsfeeds';
		$options['statefield'] = 'published';
		parent::__construct($options);
	}
}
helpers/legacyrouter.php000064400000013341151165720360011434
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Legacy routing rules class from com_newsfeeds
 *
 * @since       3.6
 * @deprecated  4.0
 */
class NewsfeedsRouterRulesLegacy implements JComponentRouterRulesInterface
{
	/**
	 * Constructor for this legacy router
	 *
	 * @param   JComponentRouterAdvanced  $router  The router this rule
belongs to
	 *
	 * @since       3.6
	 * @deprecated  4.0
	 */
	public function __construct($router)
	{
		$this->router = $router;
	}

	/**
	 * Preprocess the route for the com_newsfeeds component
	 *
	 * @param   array  &$query  An array of URL arguments
	 *
	 * @return  void
	 *
	 * @since       3.6
	 * @deprecated  4.0
	 */
	public function preprocess(&$query)
	{
	}

	/**
	 * Build the route for the com_newsfeeds component
	 *
	 * @param   array  &$query     An array of URL arguments
	 * @param   array  &$segments  The URL arguments to use to assemble
the subsequent URL.
	 *
	 * @return  void
	 *
	 * @since       3.6
	 * @deprecated  4.0
	 */
	public function build(&$query, &$segments)
	{
		// Get a menu item based on Itemid or currently active
		$params = JComponentHelper::getParams('com_newsfeeds');
		$advanced = $params->get('sef_advanced_link', 0);

		if (empty($query['Itemid']))
		{
			$menuItem = $this->router->menu->getActive();
		}
		else
		{
			$menuItem =
$this->router->menu->getItem($query['Itemid']);
		}

		$mView = empty($menuItem->query['view']) ? null :
$menuItem->query['view'];
		$mId   = empty($menuItem->query['id']) ? null :
$menuItem->query['id'];

		if (isset($query['view']))
		{
			$view = $query['view'];

			if (empty($menuItem) || $menuItem->component !==
'com_newsfeeds' || empty($query['Itemid']))
			{
				$segments[] = $query['view'];
			}

			unset($query['view']);
		}

		// Are we dealing with a newsfeed that is attached to a menu item?
		if (isset($query['view'], $query['id']) &&
$mView == $query['view'] && $mId == (int)
$query['id'])
		{
			unset($query['view'], $query['catid'],
$query['id']);

			return;
		}

		if (isset($view) && ($view === 'category' || $view ===
'newsfeed'))
		{
			if ($mId != (int) $query['id'] || $mView != $view)
			{
				if ($view === 'newsfeed' &&
isset($query['catid']))
				{
					$catid = $query['catid'];
				}
				elseif (isset($query['id']))
				{
					$catid = $query['id'];
				}

				$menuCatid = $mId;
				$categories = JCategories::getInstance('Newsfeeds');
				$category = $categories->get($catid);

				if ($category)
				{
					$path = $category->getPath();
					$path = array_reverse($path);

					$array = array();

					foreach ($path as $id)
					{
						if ((int) $id === (int) $menuCatid)
						{
							break;
						}

						if ($advanced)
						{
							list($tmp, $id) = explode(':', $id, 2);
						}

						$array[] = $id;
					}

					$segments = array_merge($segments, array_reverse($array));
				}

				if ($view === 'newsfeed')
				{
					if ($advanced)
					{
						list($tmp, $id) = explode(':', $query['id'], 2);
					}
					else
					{
						$id = $query['id'];
					}

					$segments[] = $id;
				}
			}

			unset($query['id'], $query['catid']);
		}

		if (isset($query['layout']))
		{
			if (!empty($query['Itemid']) &&
isset($menuItem->query['layout']))
			{
				if ($query['layout'] ==
$menuItem->query['layout'])
				{
					unset($query['layout']);
				}
			}
			else
			{
				if ($query['layout'] === 'default')
				{
					unset($query['layout']);
				}
			}
		}

		$total = count($segments);

		for ($i = 0; $i < $total; $i++)
		{
			$segments[$i] = str_replace(':', '-',
$segments[$i]);
		}
	}

	/**
	 * Parse the segments of a URL.
	 *
	 * @param   array  &$segments  The segments of the URL to parse.
	 * @param   array  &$vars      The URL attributes to be used by the
application.
	 *
	 * @return  void
	 *
	 * @since       3.6
	 * @deprecated  4.0
	 */
	public function parse(&$segments, &$vars)
	{
		$total = count($segments);

		for ($i = 0; $i < $total; $i++)
		{
			$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
		}

		// Get the active menu item.
		$item	= $this->router->menu->getActive();
		$params = JComponentHelper::getParams('com_newsfeeds');
		$advanced = $params->get('sef_advanced_link', 0);

		// Count route segments
		$count = count($segments);

		// Standard routing for newsfeeds.
		if (!isset($item))
		{
			$vars['view'] = $segments[0];
			$vars['id']   = $segments[$count - 1];

			return;
		}

		// From the categories view, we can only jump to a category.
		$id = (isset($item->query['id']) &&
$item->query['id'] > 1) ? $item->query['id'] :
'root';
		$categories =
JCategories::getInstance('Newsfeeds')->get($id)->getChildren();
		$vars['catid'] = $id;
		$vars['id'] = $id;
		$found = 0;

		foreach ($segments as $segment)
		{
			$segment = $advanced ? str_replace(':', '-',
$segment) : $segment;

			foreach ($categories as $category)
			{
				if ($category->slug == $segment || $category->alias == $segment)
				{
					$vars['id'] = $category->id;
					$vars['catid'] = $category->id;
					$vars['view'] = 'category';
					$categories = $category->getChildren();
					$found = 1;
					break;
				}
			}

			if ($found == 0)
			{
				if ($advanced)
				{
					$db = JFactory::getDbo();
					$query = $db->getQuery(true)
						->select($db->quoteName('id'))
						->from('#__newsfeeds')
						->where($db->quoteName('catid') . ' = ' .
(int) $vars['catid'])
						->where($db->quoteName('alias') . ' = ' .
$db->quote($segment));
					$db->setQuery($query);
					$nid = $db->loadResult();
				}
				else
				{
					$nid = $segment;
				}

				$vars['id'] = $nid;
				$vars['view'] = 'newsfeed';
			}

			$found = 0;
		}
	}
}
helpers/route.php000064400000002745151165720360010073 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Newsfeeds Component Route Helper
 *
 * @since  1.5
 */
abstract class NewsfeedsHelperRoute
{
	/**
	 * getNewsfeedRoute
	 *
	 * @param   int  $id        menu itemid
	 * @param   int  $catid     category id
	 * @param   int  $language  language
	 *
	 * @return string
	 */
	public static function getNewsfeedRoute($id, $catid, $language = 0)
	{
		// Create the link
		$link =
'index.php?option=com_newsfeeds&view=newsfeed&id=' . $id;

		if ((int) $catid > 1)
		{
			$link .= '&catid=' . $catid;
		}

		if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
		{
			$link .= '&lang=' . $language;
		}

		return $link;
	}

	/**
	 * getCategoryRoute
	 *
	 * @param   int  $catid     category id
	 * @param   int  $language  language
	 *
	 * @return string
	 */
	public static function getCategoryRoute($catid, $language = 0)
	{
		if ($catid instanceof JCategoryNode)
		{
			$id = $catid->id;
		}
		else
		{
			$id = (int) $catid;
		}

		if ($id < 1)
		{
			$link = '';
		}
		else
		{
			// Create the link
			$link =
'index.php?option=com_newsfeeds&view=category&id=' . $id;

			if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
			{
				$link .= '&lang=' . $language;
			}
		}

		return $link;
	}
}
models/categories.php000064400000006270151165720360010700 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * This models supports retrieving lists of newsfeed categories.
 *
 * @since  1.6
 */
class NewsfeedsModelCategories extends JModelList
{
	/**
	 * Model context string.
	 *
	 * @var		string
	 */
	public $_context = 'com_newsfeeds.categories';

	/**
	 * The category context (allows other extensions to derived from this
model).
	 *
	 * @var		string
	 */
	protected $_extension = 'com_newsfeeds';

	private $_parent = null;

	private $_items = null;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field
	 * @param   string  $direction  An optional direction [asc|desc]
	 *
	 * @return void
	 *
	 * @throws Exception
	 *
	 * @since   1.6
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();
		$this->setState('filter.extension', $this->_extension);

		// Get the parent id if defined.
		$parentId = $app->input->getInt('id');
		$this->setState('filter.parentId', $parentId);

		$params = $app->getParams();
		$this->setState('params', $params);

		$this->setState('filter.published',	1);
		$this->setState('filter.access',	true);
	}

	/**
	 * 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  $id  A prefix for the store id.
	 *
	 * @return  string  A store id.
	 */
	protected function getStoreId($id = '')
	{
		// Compile the store id.
		$id .= ':' . $this->getState('filter.extension');
		$id .= ':' . $this->getState('filter.published');
		$id .= ':' . $this->getState('filter.access');
		$id .= ':' . $this->getState('filter.parentId');

		return parent::getStoreId($id);
	}

	/**
	 * redefine the function an add some properties to make the styling more
easy
	 *
	 * @return mixed An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		if ($this->_items === null)
		{
			$app = JFactory::getApplication();
			$menu = $app->getMenu();
			$active = $menu->getActive();
			$params = new Registry;

			if ($active)
			{
				$params->loadString($active->params);
			}

			$options = array();
			$options['countItems'] =
$params->get('show_cat_items_cat', 1) ||
!$params->get('show_empty_categories_cat', 0);
			$categories = JCategories::getInstance('Newsfeeds', $options);
			$this->_parent =
$categories->get($this->getState('filter.parentId',
'root'));

			if (is_object($this->_parent))
			{
				$this->_items = $this->_parent->getChildren();
			}
			else
			{
				$this->_items = false;
			}
		}

		return $this->_items;
	}

	/**
	 * get the Parent
	 *
	 * @return null
	 */
	public function getParent()
	{
		if (!is_object($this->_parent))
		{
			$this->getItems();
		}

		return $this->_parent;
	}
}
models/category.php000064400000020731151165720360010366 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * Newsfeeds Component Category Model
 *
 * @since  1.5
 */
class NewsfeedsModelCategory extends JModelList
{
	/**
	 * Category items data
	 *
	 * @var array
	 */
	protected $_item = null;

	protected $_articles = null;

	protected $_siblings = null;

	protected $_children = null;

	protected $_parent = null;

	/**
	 * The category that applies.
	 *
	 * @access    protected
	 * @var        object
	 */
	protected $_category = null;

	/**
	 * The list of other newfeed categories.
	 *
	 * @access    protected
	 * @var        array
	 */
	protected $_categories = null;

	/**
	 * Constructor.
	 *
	 * @param   array  $config  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',
				'numarticles', 'a.numarticles',
				'link', 'a.link',
				'ordering', 'a.ordering',
			);
		}

		parent::__construct($config);
	}

	/**
	 * Method to get a list of items.
	 *
	 * @return  mixed  An array of objects on success, false on failure.
	 */
	public function getItems()
	{
		// Invoke the parent getItems method to get the main list
		$items = parent::getItems();

		// Convert the params field into an object, saving original in _params
		foreach ($items as $item)
		{
			if (!isset($this->_params))
			{
				$params = new Registry;
				$item->params = $params;
				$params->loadString($item->params);
			}

			// Some contexts may not use tags data at all, so we allow callers to
disable loading tag data
			if ($this->getState('load_tags', true))
			{
				$item->tags = new JHelperTags;
				$item->tags->getItemTags('com_newsfeeds.newsfeed',
$item->id);
			}
		}

		return $items;
	}

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return  string    An SQL query
	 *
	 * @since   1.6
	 */
	protected function getListQuery()
	{
		$user = JFactory::getUser();
		$groups = implode(',', $user->getAuthorisedViewLevels());

		// Create a new query object.
		$db = $this->getDbo();
		$query = $db->getQuery(true);

		// Select required fields from the categories.
		$query->select($this->getState('list.select',
'a.*'))
			->from($db->quoteName('#__newsfeeds') . ' AS
a')
			->where('a.access IN (' . $groups . ')');

		// Filter by category.
		if ($categoryId = $this->getState('category.id'))
		{
			$query->where('a.catid = ' . (int) $categoryId)
				->join('LEFT', '#__categories AS c ON c.id =
a.catid')
				->where('c.access IN (' . $groups . ')');
		}

		// Filter by state
		$state = $this->getState('filter.published');

		if (is_numeric($state))
		{
			$query->where('a.published = ' . (int) $state);
		}
		else
		{
			$query->where('(a.published IN (0,1,2))');
		}

		// Filter by start and end dates.
		$nullDate = $db->quote($db->getNullDate());
		$date = JFactory::getDate();
		$nowDate = $db->quote($date->format($db->getDateFormat()));

		if ($this->getState('filter.publish_date'))
		{
			$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
				->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
		}

		// Filter by search in title
		$search = $this->getState('list.filter');

		if (!empty($search))
		{
			$search = $db->quote('%' . $db->escape($search, true) .
'%');
			$query->where('(a.name LIKE ' . $search . ')');
		}

		// Filter by language
		if ($this->getState('filter.language'))
		{
			$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
		}

		// Add the list ordering clause.
		$query->order($db->escape($this->getState('list.ordering',
'a.ordering')) . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));

		return $query;
	}

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field
	 * @param   string  $direction  An optional direction [asc|desc]
	 *
	 * @return void
	 *
	 * @since   1.6
	 *
	 * @throws Exception
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();
		$params = JComponentHelper::getParams('com_newsfeeds');

		// List state information
		$limit = $app->getUserStateFromRequest('global.list.limit',
'limit', $app->get('list_limit'), 'uint');
		$this->setState('list.limit', $limit);

		$limitstart = $app->input->get('limitstart', 0,
'uint');
		$this->setState('list.start', $limitstart);

		// Optional filter text
		$this->setState('list.filter',
$app->input->getString('filter-search'));

		$orderCol = $app->input->get('filter_order',
'ordering');

		if (!in_array($orderCol, $this->filter_fields))
		{
			$orderCol = 'ordering';
		}

		$this->setState('list.ordering', $orderCol);

		$listOrder = $app->input->get('filter_order_Dir',
'ASC');

		if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
		{
			$listOrder = 'ASC';
		}

		$this->setState('list.direction', $listOrder);

		$id = $app->input->get('id', 0, 'int');
		$this->setState('category.id', $id);

		$user = JFactory::getUser();

		if ((!$user->authorise('core.edit.state',
'com_newsfeeds')) &&
(!$user->authorise('core.edit', 'com_newsfeeds')))
		{
			// Limit to published for people who can't edit or edit.state.
			$this->setState('filter.published', 1);

			// Filter by start and end dates.
			$this->setState('filter.publish_date', true);
		}

		$this->setState('filter.language',
JLanguageMultilang::isEnabled());

		// Load the parameters.
		$this->setState('params', $params);
	}

	/**
	 * Method to get category data for the current category
	 *
	 * @return  object
	 *
	 * @since   1.5
	 */
	public function getCategory()
	{
		if (!is_object($this->_item))
		{
			$app = JFactory::getApplication();
			$menu = $app->getMenu();
			$active = $menu->getActive();
			$params = new Registry;

			if ($active)
			{
				$params->loadString($active->params);
			}

			$options = array();
			$options['countItems'] =
$params->get('show_cat_items', 1) ||
$params->get('show_empty_categories', 0);
			$categories = JCategories::getInstance('Newsfeeds', $options);
			$this->_item =
$categories->get($this->getState('category.id',
'root'));

			if (is_object($this->_item))
			{
				$this->_children = $this->_item->getChildren();
				$this->_parent = false;

				if ($this->_item->getParent())
				{
					$this->_parent = $this->_item->getParent();
				}

				$this->_rightsibling = $this->_item->getSibling();
				$this->_leftsibling = $this->_item->getSibling(false);
			}
			else
			{
				$this->_children = false;
				$this->_parent = false;
			}
		}

		return $this->_item;
	}

	/**
	 * Get the parent category.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function getParent()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_parent;
	}

	/**
	 * Get the sibling (adjacent) categories.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function &getLeftSibling()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_leftsibling;
	}

	/**
	 * Get the sibling (adjacent) categories.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function &getRightSibling()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_rightsibling;
	}

	/**
	 * Get the child categories.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function &getChildren()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_children;
	}

	/**
	 * Increment the hit counter for the category.
	 *
	 * @param   int  $pk  Optional primary key of the category to increment.
	 *
	 * @return  boolean True if successful; false otherwise and internal error
set.
	 */
	public function hit($pk = 0)
	{
		$input    = JFactory::getApplication()->input;
		$hitcount = $input->getInt('hitcount', 1);

		if ($hitcount)
		{
			$pk    = (!empty($pk)) ? $pk : (int)
$this->getState('category.id');
			$table = JTable::getInstance('Category', 'JTable');
			$table->hit($pk);
		}

		return true;
	}
}
models/newsfeed.php000064400000012137151165720360010352 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * Newsfeeds Component Newsfeed Model
 *
 * @since  1.5
 */
class NewsfeedsModelNewsfeed extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var		string
	 * @since   1.6
	 */
	protected $_context = 'com_newsfeeds.newsfeed';

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function populateState()
	{
		$app = JFactory::getApplication('site');

		// Load state from the request.
		$pk = $app->input->getInt('id');
		$this->setState('newsfeed.id', $pk);

		$offset = $app->input->get('limitstart', 0,
'uint');
		$this->setState('list.offset', $offset);

		// Load the parameters.
		$params = $app->getParams();
		$this->setState('params', $params);

		$user = JFactory::getUser();

		if ((!$user->authorise('core.edit.state',
'com_newsfeeds')) &&
(!$user->authorise('core.edit', 'com_newsfeeds')))
		{
			$this->setState('filter.published', 1);
			$this->setState('filter.archived', 2);
		}
	}

	/**
	 * Method to get newsfeed data.
	 *
	 * @param   integer  $pk  The id of the newsfeed.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 *
	 * @since   1.6
	 */
	public function &getItem($pk = null)
	{
		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('newsfeed.id');

		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				$db = $this->getDbo();
				$query = $db->getQuery(true)
					->select($this->getState('item.select',
'a.*'))
					->from('#__newsfeeds AS a');

				// Join on category table.
				$query->select('c.title AS category_title, c.alias AS
category_alias, c.access AS category_access')
					->join('LEFT', '#__categories AS c on c.id =
a.catid');

				// Join on user table.
				$query->select('u.name AS author')
					->join('LEFT', '#__users AS u on u.id =
a.created_by');

				// Join over the categories to get parent category titles
				$query->select('parent.title as parent_title, parent.id as
parent_id, parent.path as parent_route, parent.alias as parent_alias')
					->join('LEFT', '#__categories as parent ON parent.id
= c.parent_id')

					->where('a.id = ' . (int) $pk);

				// Filter by start and end dates.
				$nullDate = $db->quote($db->getNullDate());
				$nowDate = $db->quote(JFactory::getDate()->toSql());

				// Filter by published state.
				$published = $this->getState('filter.published');
				$archived = $this->getState('filter.archived');

				if (is_numeric($published))
				{
					$query->where('(a.published = ' . (int) $published .
' OR a.published =' . (int) $archived . ')')
						->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
						->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')')
						->where('(c.published = ' . (int) $published . ' OR
c.published =' . (int) $archived . ')');
				}

				$db->setQuery($query);

				$data = $db->loadObject();

				if (empty($data))
				{
					JError::raiseError(404,
JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
				}

				// Check for published state if filter set.

				if ((is_numeric($published) || is_numeric($archived)) &&
$data->published != $published && $data->published !=
$archived)
				{
					JError::raiseError(404,
JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
				}

				// Convert parameter fields to objects.
				$registry = new Registry($data->params);
				$data->params = clone $this->getState('params');
				$data->params->merge($registry);

				$data->metadata = new Registry($data->metadata);

				// Compute access permissions.

				if ($access = $this->getState('filter.access'))
				{
					// If the access filter has been set, we already know this user can
view.
					$data->params->set('access-view', true);
				}
				else
				{
					// If no access filter is set, the layout takes some responsibility
for display of limited information.
					$user   = JFactory::getUser();
					$groups = $user->getAuthorisedViewLevels();
					$data->params->set('access-view',
in_array($data->access, $groups) &&
in_array($data->category_access, $groups));
				}

				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				$this->setError($e);
				$this->_item[$pk] = false;
			}
		}

		return $this->_item[$pk];
	}

	/**
	 * Increment the hit counter for the newsfeed.
	 *
	 * @param   int  $pk  Optional primary key of the item to increment.
	 *
	 * @return  boolean  True if successful; false otherwise and internal
error set.
	 *
	 * @since   3.0
	 */
	public function hit($pk = 0)
	{
		$input = JFactory::getApplication()->input;
		$hitcount = $input->getInt('hitcount', 1);

		if ($hitcount)
		{
			$pk = (!empty($pk)) ? $pk : (int)
$this->getState('newsfeed.id');

			$table = JTable::getInstance('Newsfeed',
'NewsfeedsTable');
			$table->hit($pk);
		}

		return true;
	}
}
newsfeeds.php000064400000001100151165720360007236 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('NewsfeedsHelperRoute', JPATH_COMPONENT .
'/helpers/route.php');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR .
'/tables');

$controller = JControllerLegacy::getInstance('Newsfeeds');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
router.php000064400000013613151165720360006607 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Routing class from com_newsfeeds
 *
 * @since  3.3
 */
class NewsfeedsRouter extends JComponentRouterView
{
	protected $noIDs = false;

	/**
	 * Newsfeeds Component router constructor
	 *
	 * @param   JApplicationCms  $app   The application object
	 * @param   JMenu            $menu  The menu object to work with
	 */
	public function __construct($app = null, $menu = null)
	{
		$params = JComponentHelper::getParams('com_newsfeeds');
		$this->noIDs = (bool) $params->get('sef_ids');
		$categories = new
JComponentRouterViewconfiguration('categories');
		$categories->setKey('id');
		$this->registerView($categories);
		$category = new JComponentRouterViewconfiguration('category');
		$category->setKey('id')->setParent($categories,
'catid')->setNestable();
		$this->registerView($category);
		$newsfeed = new JComponentRouterViewconfiguration('newsfeed');
		$newsfeed->setKey('id')->setParent($category,
'catid');
		$this->registerView($newsfeed);

		parent::__construct($app, $menu);

		$this->attachRule(new JComponentRouterRulesMenu($this));

		if ($params->get('sef_advanced', 0))
		{
			$this->attachRule(new JComponentRouterRulesStandard($this));
			$this->attachRule(new JComponentRouterRulesNomenu($this));
		}
		else
		{
			JLoader::register('NewsfeedsRouterRulesLegacy', __DIR__ .
'/helpers/legacyrouter.php');
			$this->attachRule(new NewsfeedsRouterRulesLegacy($this));
		}
	}

	/**
	 * Method to get the segment(s) for a category
	 *
	 * @param   string  $id     ID of the category to retrieve the segments
for
	 * @param   array   $query  The request that is built right now
	 *
	 * @return  array|string  The segments of this item
	 */
	public function getCategorySegment($id, $query)
	{
		$category = JCategories::getInstance($this->getName())->get($id);

		if ($category)
		{
			$path = array_reverse($category->getPath(), true);
			$path[0] = '1:root';

			if ($this->noIDs)
			{
				foreach ($path as &$segment)
				{
					list($id, $segment) = explode(':', $segment, 2);
				}
			}

			return $path;
		}

		return array();
	}

	/**
	 * Method to get the segment(s) for a category
	 *
	 * @param   string  $id     ID of the category to retrieve the segments
for
	 * @param   array   $query  The request that is built right now
	 *
	 * @return  array|string  The segments of this item
	 */
	public function getCategoriesSegment($id, $query)
	{
		return $this->getCategorySegment($id, $query);
	}

	/**
	 * Method to get the segment(s) for a newsfeed
	 *
	 * @param   string  $id     ID of the newsfeed to retrieve the segments
for
	 * @param   array   $query  The request that is built right now
	 *
	 * @return  array|string  The segments of this item
	 */
	public function getNewsfeedSegment($id, $query)
	{
		if (!strpos($id, ':'))
		{
			$db = JFactory::getDbo();
			$dbquery = $db->getQuery(true);
			$dbquery->select($dbquery->qn('alias'))
				->from($dbquery->qn('#__newsfeeds'))
				->where('id = ' . $dbquery->q((int) $id));
			$db->setQuery($dbquery);

			$id .= ':' . $db->loadResult();
		}

		if ($this->noIDs)
		{
			list($void, $segment) = explode(':', $id, 2);

			return array($void => $segment);
		}

		return array((int) $id => $id);
	}

	/**
	 * Method to get the id for a category
	 *
	 * @param   string  $segment  Segment to retrieve the ID for
	 * @param   array   $query    The request that is parsed right now
	 *
	 * @return  mixed   The id of this item or false
	 */
	public function getCategoryId($segment, $query)
	{
		if (isset($query['id']))
		{
			$category = JCategories::getInstance($this->getName(),
array('access' => false))->get($query['id']);

			if ($category)
			{
				foreach ($category->getChildren() as $child)
				{
					if ($this->noIDs)
					{
						if ($child->alias === $segment)
						{
							return $child->id;
						}
					}
					else
					{
						if ($child->id == (int) $segment)
						{
							return $child->id;
						}
					}
				}
			}
		}

		return false;
	}

	/**
	 * Method to get the segment(s) for a category
	 *
	 * @param   string  $segment  Segment to retrieve the ID for
	 * @param   array   $query    The request that is parsed right now
	 *
	 * @return  mixed   The id of this item or false
	 */
	public function getCategoriesId($segment, $query)
	{
		return $this->getCategoryId($segment, $query);
	}

	/**
	 * Method to get the segment(s) for a newsfeed
	 *
	 * @param   string  $segment  Segment of the newsfeed to retrieve the ID
for
	 * @param   array   $query    The request that is parsed right now
	 *
	 * @return  mixed   The id of this item or false
	 */
	public function getNewsfeedId($segment, $query)
	{
		if ($this->noIDs)
		{
			$db = JFactory::getDbo();
			$dbquery = $db->getQuery(true);
			$dbquery->select($dbquery->qn('id'))
				->from($dbquery->qn('#__newsfeeds'))
				->where('alias = ' . $dbquery->q($segment))
				->where('catid = ' .
$dbquery->q($query['id']));
			$db->setQuery($dbquery);

			return (int) $db->loadResult();
		}

		return (int) $segment;
	}
}

/**
 * newsfeedsBuildRoute
 *
 * These functions are proxys for the new router interface
 * for old SEF extensions.
 *
 * @param   array  &$query  The segments of the URL to parse.
 *
 * @return array
 *
 * @deprecated  4.0  Use Class based routers instead
 */
function newsfeedsBuildRoute(&$query)
{
	$app = JFactory::getApplication();
	$router = new NewsfeedsRouter($app, $app->getMenu());

	return $router->build($query);
}

/**
 * newsfeedsParseRoute
 *
 * @param   array  $segments  The segments of the URL to parse.
 *
 * @return array
 *
 * @deprecated  4.0  Use Class based routers instead
 */
function newsfeedsParseRoute($segments)
{
	$app = JFactory::getApplication();
	$router = new NewsfeedsRouter($app, $app->getMenu());

	return $router->parse($segments);
}
views/categories/tmpl/default.php000064400000002405151165720360013146
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('behavior.caption');
JHtml::_('behavior.core');

// Add strings for translations in Javascript.
JText::script('JGLOBAL_EXPAND_CATEGORIES');
JText::script('JGLOBAL_COLLAPSE_CATEGORIES');

JFactory::getDocument()->addScriptDeclaration("
jQuery(function($) {
	$('.categories-list').find('[id^=category-btn-]').each(function(index,
btn) {
		var btn = $(btn);
		btn.on('click', function() {
			btn.find('span').toggleClass('icon-plus');
			btn.find('span').toggleClass('icon-minus');
			if (btn.attr('aria-label') ===
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'))
			{
				btn.attr('aria-label',
Joomla.JText._('JGLOBAL_COLLAPSE_CATEGORIES'));
			} else {
				btn.attr('aria-label',
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'));
			}			
		});
	});
});");

?>
<div class="categories-list<?php echo $this->pageclass_sfx;
?>">
	<?php echo
JLayoutHelper::render('joomla.content.categories_default',
$this); ?>
	<?php echo $this->loadTemplate('items'); ?>
</div>
views/categories/tmpl/default.xml000064400000021133151165720360013156
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_TITLE"
option="COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_OPTION">
		<help
			key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_CATEGORIES"
		/>
		<message>
			<![CDATA[COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>

	<!-- Add fields to the request variables for the layout. -->
	<fields name="request">
		<fieldset name="request"
		>
			<field 
				name="id" 
				type="category"
				label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
				description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
				extension="com_newsfeeds"
				show_root="true"
				required="true"
			/>
		</fieldset>
	</fields>

	<!-- Add fields to the parameters object for the layout. -->
	<fields name="params">
		<fieldset name="basic"
label="JGLOBAL_CATEGORIES_OPTIONS">
			<field 
				name="show_base_description" 
				type="list"
				label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
				description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="categories_description" 
				type="textarea"
				label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
				description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
				cols="25"
				rows="5"
			/>

			<field 
				name="maxLevelcat" 
				type="list"
				label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
				description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
				useglobal="true"
				>
				<option value="-1">JALL</option>
				<option value="1">J1</option>
				<option value="2">J2</option>
				<option value="3">J3</option>
				<option value="4">J4</option>
				<option value="5">J5</option>
			</field>

			<field 
				name="show_empty_categories_cat" 
				type="list"
				label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
				description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_subcat_desc_cat" 
				type="list"
				label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
				description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_cat_items_cat" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>
		</fieldset>

		<fieldset name="category"
label="JGLOBAL_CATEGORY_OPTIONS">
			<field 
				name="spacer2" 
				type="spacer" 
				label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
				class="text"
			/>

			<field 
				name="show_category_title" 
				type="list"
				label="JGLOBAL_SHOW_CATEGORY_TITLE"
				description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_description" 
				type="list"
				label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
				description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_description_image" 
				type="list"
				label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
				description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="maxLevel" 
				type="list"
				description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
				label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
				useglobal="true"
				>
				<option value="-1">JALL</option>
				<option value="0">JNONE</option>
				<option value="1">J1</option>
				<option value="2">J2</option>
				<option value="3">J3</option>
				<option value="4">J4</option>
				<option value="5">J5</option>
			</field>

			<field 
				name="show_empty_categories" 
				type="list"
				label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
				description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_subcat_desc" 
				type="list"
				label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
				description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_cat_items"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
				id="show_cat_items"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

		</fieldset>

		<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
			<field 
				name="spacer1" 
				type="spacer" 
				label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
				class="text"
			/>

			<field
				name="filter_field"
				type="list"
				label="JGLOBAL_FILTER_FIELD_LABEL"
				description="JGLOBAL_FILTER_FIELD_DESC"
				default=""
				useglobal="true"
				class="chzn-color"
				>
				<option value="hide">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_pagination_limit"
				type="list"
				label="JGLOBAL_DISPLAY_SELECT_LABEL"
				description="JGLOBAL_DISPLAY_SELECT_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_headings"
				type="list"
				label="JGLOBAL_SHOW_HEADINGS_LABEL"
				description="JGLOBAL_SHOW_HEADINGS_DESC"
				id="show_headings"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_articles"
				type="list"
				label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
				description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"
				id="show_articles"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_link"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"
				id="show_link"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_pagination"
				type="list"
				label="JGLOBAL_PAGINATION_LABEL"
				description="JGLOBAL_PAGINATION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
				<option value="2">JGLOBAL_AUTO</option>
			</field>

			<field
				name="show_pagination_results"
				type="list"
				label="JGLOBAL_PAGINATION_RESULTS_LABEL"
				description="JGLOBAL_PAGINATION_RESULTS_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

		</fieldset>
		<fieldset name="newsfeed"
label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">

			<field 
				name="show_feed_image" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_feed_description" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_item_description" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="feed_character_count" 
				type="number"
				label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
				description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
				size="6"
				useglobal="true"
			/>
		</fieldset>

	</fields>
</metadata>
views/categories/tmpl/default_items.php000064400000005024151165720360014347
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');

?>
<?php $class = ' class="first"'; ?>
<?php if ($this->maxLevelcat != 0 &&
count($this->items[$this->parent->id]) > 0) : ?>
	<?php foreach ($this->items[$this->parent->id] as $id =>
$item) : ?>
		<?php if
($this->params->get('show_empty_categories_cat') ||
$item->numitems || count($item->getChildren())) : ?>
			<?php if (!isset($this->items[$this->parent->id][$id + 1]))
: ?>
				<?php $class = ' class="last"'; ?>
			<?php endif; ?>
			<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');
?>&nbsp;
							<?php echo $item->numitems; ?>
						</span>
					<?php endif; ?>
					<?php if (count($item->getChildren()) > 0 &&
$this->maxLevelcat > 1) : ?>
						<a id="category-btn-<?php echo $item->id; ?>"
href="#category-<?php echo $item->id; ?>"
							data-toggle="collapse" data-toggle="button"
class="btn btn-mini pull-right" aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>">
							<span class="icon-plus"
aria-hidden="true"></span>
						</a>
					<?php endif; ?>
				</h3>
				<?php if ($this->params->get('show_subcat_desc_cat')
== 1) : ?>
					<?php if ($item->description) : ?>
						<div class="category-desc">
							<?php echo JHtml::_('content.prepare',
$item->description, '', 'com_newsfeeds.categories');
?>
						</div>
					<?php endif; ?>
				<?php endif; ?>
				<?php if (count($item->getChildren()) > 0 &&
$this->maxLevelcat > 1) : ?>
					<div class="collapse fade" id="category-<?php
echo $item->id; ?>">
						<?php $this->items[$item->id] = $item->getChildren();
?>
						<?php $this->parent = $item; ?>
						<?php $this->maxLevelcat--; ?>
						<?php echo $this->loadTemplate('items'); ?>
						<?php $this->parent = $item->getParent(); ?>
						<?php $this->maxLevelcat++; ?>
					</div>
				<?php endif; ?>
			</div>
		<?php endif; ?>
	<?php endforeach; ?>
<?php endif; ?>
views/categories/view.html.php000064400000001233151165720370012462
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Content categories view.
 *
 * @since  1.5
 */
class NewsfeedsViewCategories extends JViewCategories
{
	/**
	 * Language key for default page heading
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $pageHeading = 'COM_NEWSFEEDS_DEFAULT_PAGE_TITLE';

	/**
	 * @var    string  The name of the extension for the category
	 * @since  3.2
	 */
	protected $extension = 'com_newsfeeds';
}
views/category/tmpl/default.php000064400000004040151165720370012634
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

JHtml::_('behavior.caption');
JHtml::_('formbehavior.chosen', 'select');

$pageClass = $this->params->get('pageclass_sfx');

?>
<div class="newsfeed-category<?php echo $this->pageclass_sfx;
?>">
	<?php if ($this->params->get('show_page_heading')) :
?>
		<h1>
			<?php echo
$this->escape($this->params->get('page_heading')); ?>
		</h1>
	<?php endif; ?>
	<?php if ($this->params->get('show_category_title', 1))
: ?>
		<h2>
			<?php echo JHtml::_('content.prepare',
$this->category->title, '',
'com_newsfeeds.category.title'); ?>
		</h2>
	<?php endif; ?>
	<?php if ($this->params->get('show_tags', 1) &&
!empty($this->category->tags->itemTags)) : ?>
		<?php $this->category->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
		<?php echo
$this->category->tagLayout->render($this->category->tags->itemTags);
?>
	<?php endif; ?>
	<?php if ($this->params->get('show_description', 1) ||
$this->params->def('show_description_image', 1)) : ?>
		<div class="category-desc">
			<?php if
($this->params->get('show_description_image') &&
$this->category->getParams()->get('image')) : ?>
				<img src="<?php echo
$this->category->getParams()->get('image'); ?>"
/>
			<?php endif; ?>
			<?php if ($this->params->get('show_description')
&& $this->category->description) : ?>
				<?php echo JHtml::_('content.prepare',
$this->category->description, '',
'com_newsfeeds.category'); ?>
			<?php endif; ?>
			<div class="clr"></div>
		</div>
	<?php endif; ?>
	<?php echo $this->loadTemplate('items'); ?>
	<?php if ($this->maxLevel != 0 &&
!empty($this->children[$this->category->id])) : ?>
		<div class="cat-children">
			<h3>
				<?php echo JText::_('JGLOBAL_SUBCATEGORIES'); ?>
			</h3>
			<?php echo $this->loadTemplate('children'); ?>
		</div>
	<?php endif; ?>
</div>
views/category/tmpl/default.xml000064400000016260151165720370012654
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_TITLE"
option="COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_OPTION">
		<help
			key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_CATEGORY"
		/>
		<message>
			<![CDATA[COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>

	<!-- Add fields to the request variables for the layout. -->
	<fields name="request"
		addfieldpath="/administrator/components/com_categories/models/fields"
	>
		<fieldset name="request"
			addfieldpath="/administrator/components/com_newsfeeds/models/fields"
		 >
			<field
				name="id"
				type="modal_category"
				label="JCATEGORY"
				description="COM_NEWSFEEDS_FIELD_SELECT_CATEGORY_DESC"
				extension="com_newsfeeds"
				required="true"
				select="true"
				new="true"
				edit="true"
				clear="true"
			/>
		</fieldset>
	</fields>

	<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
	<fieldset name="basic"
label="JGLOBAL_CATEGORY_OPTIONS">
		<field 
			name="spacer1" 
			type="spacer" 
			label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
			class="text"
			/>

			<field 
				name="show_category_title" 
				type="list"
				label="JGLOBAL_SHOW_CATEGORY_TITLE"
				description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_description" 
				type="list"
				label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
				description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_description_image" 
				type="list"
				label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
				description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="maxLevel" 
				type="list"
				label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
				description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
				useglobal="true"
				>
				<option value="-1">JALL</option>
				<option value="0">JNONE</option>
				<option value="1">J1</option>
				<option value="2">J2</option>
				<option value="3">J3</option>
				<option value="4">J4</option>
				<option value="5">J5</option>
			</field>

			<field 
				name="show_empty_categories" 
				type="list"
				label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
				description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_subcat_desc" 
				type="list"
				label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
				description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_cat_items"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
				id="show_cat_items"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>
		</fieldset>
		<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
			<field 
				name="spacer2" 
				type="spacer" 
				label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
				class="text"
			/>

			<field
				name="filter_field"
				type="list"
				label="JGLOBAL_FILTER_FIELD_LABEL"
				description="JGLOBAL_FILTER_FIELD_DESC"
				default=""
				useglobal="true"
				class="chzn-color"				
				>
				<option value="hide">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_pagination_limit"
				type="list"
				label="JGLOBAL_DISPLAY_SELECT_LABEL"
				description="JGLOBAL_DISPLAY_SELECT_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_headings"
				type="list"
				label="JGLOBAL_SHOW_HEADINGS_LABEL"
				description="JGLOBAL_SHOW_HEADINGS_DESC"
				id="show_headings"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_articles"
				type="list"
				label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
				description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"
				id="show_articles"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_link"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"
				id="show_link"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_pagination"
				type="list"
				label="JGLOBAL_PAGINATION_LABEL"
				description="JGLOBAL_PAGINATION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
				<option value="2">JGLOBAL_AUTO</option>
			</field>

			<field
				name="show_pagination_results"
				type="list"
				label="JGLOBAL_PAGINATION_RESULTS_LABEL"
				description="JGLOBAL_PAGINATION_RESULTS_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>
		</fieldset>

		<fieldset name="newsfeed"
label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">

			<field 
				name="show_feed_image" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_feed_description" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_item_description" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="feed_character_count" 
				type="number"
				description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
				label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
				size="6"
				useglobal="true"
			/>
			
			<field 
				name="feed_display_order" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
				description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
				useglobal="true"
				>
				<option
value="des">JGLOBAL_MOST_RECENT_FIRST</option>
				<option value="asc">JGLOBAL_OLDEST_FIRST</option>
			</field>
		</fieldset>
	</fields>
</metadata>
views/category/tmpl/default_children.php000064400000003714151165720370014513
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

?>
<?php $class = ' class="first"'; ?>
<?php if ($this->maxLevel != 0 &&
count($this->children[$this->category->id]) > 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())) : ?>
				<?php if (!isset($this->children[$this->category->id][$id +
1])) : ?>
					<?php $class = ' class="last"'; ?>
				<?php endif; ?>
				<li<?php echo $class; ?>>
					<?php $class = ''; ?>
					<span class="item-title">
						<a href="<?php echo
JRoute::_(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">
								<?php echo JHtml::_('content.prepare',
$child->description, '', 'com_newsfeeds.category');
?>
							</div>
						<?php endif; ?>
					<?php endif; ?>
					<?php if ($this->params->get('show_cat_items') ==
1) : ?>
						<dl class="newsfeed-count">
							<dt>
								<?php echo JText::_('COM_NEWSFEEDS_CAT_NUM'); ?>
							</dt>
							<dd>
								<?php echo $child->numitems; ?>
							</dd>
						</dl>
					<?php endif; ?>
					<?php if (count($child->getChildren()) > 0) : ?>
						<?php $this->children[$child->id] =
$child->getChildren(); ?>
						<?php $this->category = $child; ?>
						<?php $this->maxLevel--; ?>
						<?php echo $this->loadTemplate('children'); ?>
						<?php $this->category = $child->getParent(); ?>
						<?php $this->maxLevel++; ?>
					<?php endif; ?>
				</li>
			<?php endif; ?>
		<?php endforeach; ?>
	</ul>
<?php endif;
views/category/tmpl/default_items.php000064400000007430151165720370014043
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$n         = count($this->items);
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn  =
$this->escape($this->state->get('list.direction'));

?>
<?php if (empty($this->items)) : ?>
	<p><?php echo JText::_('COM_NEWSFEEDS_NO_ARTICLES');
?></p>
<?php else : ?>
	<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString(), ENT_COMPAT,
'UTF-8'); ?>" method="post"
name="adminForm" id="adminForm">
		<?php if ($this->params->get('filter_field') !==
'hide' ||
$this->params->get('show_pagination_limit')) : ?>
			<fieldset class="filters btn-toolbar">
				<?php if ($this->params->get('filter_field') !==
'hide' &&
$this->params->get('filter_field') == '1') :
?>
					<div class="btn-group">
						<label class="filter-search-lbl element-invisible"
for="filter-search">
							<span class="label label-warning">
								<?php echo JText::_('JUNPUBLISHED'); ?>
							</span>
							<?php echo JText::_('COM_NEWSFEEDS_FILTER_LABEL') .
'&#160;'; ?>
						</label>
						<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->state->get('list.filter'));
?>" class="inputbox"
onchange="document.adminForm.submit();" title="<?php echo
JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo
JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" />
					</div>
				<?php endif; ?>
				<?php if
($this->params->get('show_pagination_limit')) : ?>
					<div class="btn-group pull-right">
						<label for="limit"
class="element-invisible">
							<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
						</label>
						<?php echo $this->pagination->getLimitBox(); ?>
					</div>
				<?php endif; ?>
			</fieldset>
		<?php endif; ?>
		<ul class="category list-striped list-condensed">
			<?php foreach ($this->items as $i => $item) : ?>
				<?php if ($this->items[$i]->published == 0) : ?>
					<li class="system-unpublished cat-list-row<?php echo $i %
2; ?>">
				<?php else : ?>
					<li class="cat-list-row<?php echo $i % 2; ?>">
				<?php endif; ?>
				<?php if ($this->params->get('show_articles')) :
?>
					<span class="list-hits badge badge-info pull-right">
						<?php echo
JText::sprintf('COM_NEWSFEEDS_NUM_ARTICLES_COUNT',
$item->numarticles); ?>
					</span>
				<?php endif; ?>
				<span class="list pull-left">
					<div class="list-title">
						<a href="<?php echo
JRoute::_(NewsFeedsHelperRoute::getNewsfeedRoute($item->slug,
$item->catid)); ?>">
							<?php echo $item->name; ?>
						</a>
					</div>
				</span>
				<?php if ($this->items[$i]->published == 0) : ?>
					<span class="label label-warning">
						<?php echo JText::_('JUNPUBLISHED'); ?>
					</span>
				<?php endif; ?>
				<br />
				<?php if ($this->params->get('show_link')) : ?>
					<?php $link = JStringPunycode::urlToUTF8($item->link); ?>
					<span class="list pull-left">
						<a href="<?php echo $item->link; ?>">
							<?php echo $link; ?>
						</a>
					</span>
					<br />
				<?php endif; ?>
				</li>
			<?php endforeach; ?>
		</ul>
		<?php // Add pagination links ?>
		<?php if (!empty($this->items)) : ?>
			<?php if (($this->params->def('show_pagination', 2)
== 1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->pagesTotal > 1)) : ?>
				<div class="pagination">
					<?php if
($this->params->def('show_pagination_results', 1)) : ?>
						<p class="counter pull-right">
							<?php echo $this->pagination->getPagesCounter(); ?>
						</p>
					<?php endif; ?>
					<?php echo $this->pagination->getPagesLinks(); ?>
				</div>
			<?php endif; ?>
		<?php endif; ?>
	</form>
<?php endif; ?>
views/category/view.html.php000064400000004762151165720370012164
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * HTML View class for the Newsfeeds component
 *
 * @since  1.0
 */
class NewsfeedsViewCategory extends JViewCategory
{
	/**
	 * @var    string  Default title to use for page title
	 * @since  3.2
	 */
	protected $defaultPageTitle =
'COM_NEWSFEEDS_DEFAULT_PAGE_TITLE';

	/**
	 * @var    string  The name of the extension for the category
	 * @since  3.2
	 */
	protected $extension = 'com_newsfeeds';

	/**
	 * @var    string  The name of the view to link individual items to
	 * @since  3.2
	 */
	protected $viewName = 'newsfeed';

	/**
	 * Execute and display a template script.
	 *
	 * @param   string  $tpl  The name of the template file to parse;
automatically searches through the template paths.
	 *
	 * @return  mixed  A string if successful, otherwise an Error object.
	 */
	public function display($tpl = null)
	{
		$this->commonCategoryDisplay();

		// Flag indicates to not add limitstart=0 to URL
		$this->pagination->hideEmptyLimitstart = true;

		// Prepare the data.
		// Compute the newsfeed slug.
		foreach ($this->items as $item)
		{
			$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
			$temp       = $item->params;
			$item->params = clone $this->params;
			$item->params->merge($temp);
		}

		return parent::display($tpl);
	}

	/**
	 * Prepares the document
	 *
	 * @return  void
	 */
	protected function prepareDocument()
	{
		parent::prepareDocument();

		$menu = $this->menu;
		$id = (int) @$menu->query['id'];

		if ($menu && (!isset($menu->query['option']) ||
$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 ((!isset($menu->query['option']) ||
$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']);
			}
		}
	}
}
views/newsfeed/tmpl/default.php000064400000012321151165720370012620
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

?>
<?php if (!empty($this->msg)) : ?>
	<?php echo $this->msg; ?>
<?php else : ?>
	<?php $lang      = JFactory::getLanguage(); ?>
	<?php $myrtl     = $this->newsfeed->rtl; ?>
	<?php $direction = ' '; ?>
	<?php $isRtl     = $lang->isRtl(); ?>
	<?php if ($isRtl && $myrtl == 0) : ?>
		<?php $direction = ' redirect-rtl'; ?>
	<?php elseif ($isRtl && $myrtl == 1) : ?>
		<?php $direction = ' redirect-ltr'; ?>
	<?php elseif ($isRtl && $myrtl == 2) : ?>
		<?php $direction = ' redirect-rtl'; ?>
	<?php elseif ($myrtl == 0) : ?>
		<?php $direction = ' redirect-ltr'; ?>
	<?php elseif ($myrtl == 1) : ?>
		<?php $direction = ' redirect-ltr'; ?>
	<?php elseif ($myrtl == 2) : ?>
		<?php $direction = ' redirect-rtl'; ?>
	<?php endif; ?>
	<?php $images = json_decode($this->item->images); ?>
	<div class="newsfeed<?php echo $this->pageclass_sfx;
?><?php echo $direction; ?>">
		<?php if ($this->params->get('display_num')) : ?>
			<h1 class="<?php echo $direction; ?>">
				<?php echo
$this->escape($this->params->get('page_heading')); ?>
			</h1>
		<?php endif; ?>
		<h2 class="<?php echo $direction; ?>">
			<?php if ($this->item->published == 0) : ?>
				<span class="label label-warning"><?php echo
JText::_('JUNPUBLISHED'); ?></span>
			<?php endif; ?>
			<a href="<?php echo $this->item->link; ?>"
target="_blank">
				<?php echo str_replace('&apos;', "'",
$this->item->name); ?>
			</a>
		</h2>
		<?php if ($this->params->get('show_tags', 1)) : ?>
			<?php $this->item->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
			<?php echo
$this->item->tagLayout->render($this->item->tags->itemTags);
?>
		<?php endif; ?>
		<!-- Show Images from Component -->
		<?php if (isset($images->image_first) &&
!empty($images->image_first)) : ?>
			<?php $imgfloat = empty($images->float_first) ?
$this->params->get('float_first') :
$images->float_first; ?>
			<div class="img-intro-<?php echo htmlspecialchars($imgfloat,
ENT_COMPAT, 'UTF-8'); ?>">
				<img
				<?php if ($images->image_first_caption) : ?>
					<?php echo 'class="caption"' . '
title="' . htmlspecialchars($images->image_first_caption,
ENT_COMPAT, 'UTF-8') . '"'; ?>
				<?php endif; ?>
				src="<?php echo htmlspecialchars($images->image_first,
ENT_COMPAT, 'UTF-8'); ?>" alt="<?php echo
htmlspecialchars($images->image_first_alt, ENT_COMPAT,
'UTF-8'); ?>" />
			</div>
		<?php endif; ?>
		<?php if (isset($images->image_second) &&
!empty($images->image_second)) : ?>
			<?php $imgfloat = empty($images->float_second) ?
$this->params->get('float_second') :
$images->float_second; ?>
			<div class="pull-<?php echo htmlspecialchars($imgfloat,
ENT_COMPAT, 'UTF-8'); ?> item-image">
				<img
				<?php if ($images->image_second_caption) : ?>
					<?php echo 'class="caption"' . '
title="' . htmlspecialchars($images->image_second_caption) .
'"'; ?>
				<?php endif; ?>
				src="<?php echo htmlspecialchars($images->image_second,
ENT_COMPAT, 'UTF-8'); ?>" alt="<?php echo
htmlspecialchars($images->image_second_alt, ENT_COMPAT,
'UTF-8'); ?>" />
			</div>
		<?php endif; ?>
		<!-- Show Description from Component -->
		<?php echo $this->item->description; ?>
		<!-- Show Feed's Description -->
		<?php if ($this->params->get('show_feed_description'))
: ?>
			<div class="feed-description">
				<?php echo str_replace('&apos;', "'",
$this->rssDoc->description); ?>
			</div>
		<?php endif; ?>
		<!-- Show Image -->
		<?php if ($this->rssDoc->image &&
$this->params->get('show_feed_image')) : ?>
			<div>
				<img src="<?php echo $this->rssDoc->image->uri;
?>" alt="<?php echo $this->rssDoc->image->title;
?>" />
			</div>
		<?php endif; ?>
		<!-- Show items -->
		<?php if (!empty($this->rssDoc[0])) : ?>
			<ol>
				<?php for ($i = 0; $i < $this->item->numarticles; $i++) :
?>
					<?php if (empty($this->rssDoc[$i])) : ?>
						<?php break; ?>
					<?php endif; ?>
					<?php $uri  = $this->rssDoc[$i]->uri ||
!$this->rssDoc[$i]->isPermaLink ? trim($this->rssDoc[$i]->uri)
: trim($this->rssDoc[$i]->guid); ?>
					<?php $uri  = !$uri || stripos($uri, 'http') !== 0 ?
$this->item->link : $uri; ?>
					<?php $text = $this->rssDoc[$i]->content !== '' ?
trim($this->rssDoc[$i]->content) : ''; ?>
					<li>
						<?php if (!empty($uri)) : ?>
							<h3 class="feed-link">
								<a href="<?php echo htmlspecialchars($uri); ?>"
target="_blank">
									<?php echo trim($this->rssDoc[$i]->title); ?>
								</a>
							</h3>
						<?php else : ?>
							<h3 class="feed-link"><?php echo
trim($this->rssDoc[$i]->title); ?></h3>
						<?php endif; ?>
						<?php if
($this->params->get('show_item_description') &&
$text !== '') : ?>
							<div class="feed-item-description">
								<?php if ($this->params->get('show_feed_image',
0) == 0) : ?>
									<?php $text = JFilterOutput::stripImages($text); ?>
								<?php endif; ?>
								<?php $text = JHtml::_('string.truncate', $text,
$this->params->get('feed_character_count')); ?>
								<?php echo str_replace('&apos;',
"'", $text); ?>
							</div>
						<?php endif; ?>
					</li>
				<?php endfor; ?>
			</ol>
		<?php endif; ?>
	</div>
<?php endif; ?>
views/newsfeed/tmpl/default.xml000064400000005365151165720370012643
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_TITLE"
option="COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_OPTION">
		<help
			key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_SINGLE_NEWSFEED"
		/>
		<message>
			<![CDATA[COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>

	<!-- Add fields to the request variables for the layout. -->
	<fields name="request">
		<fieldset name="request"
			addfieldpath="/administrator/components/com_newsfeeds/models/fields"
		 >

			<field 
				name="id" 
				type="modal_newsfeed"
				label="COM_NEWSFEEDS_FIELD_SELECT_FEED_LABEL"
				description="COM_NEWSFEEDS_FIELD_SELECT_FEED_DESC"
				required="true"
				select="true"
				new="true"
				edit="true"
				clear="true"
			/>
		</fieldset>
	</fields>

	<!-- Add fields to the parameters object for the layout. -->
	<fields name="params">

		<!-- Basic options. -->
		<fieldset name="basic"
label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
			<field 
				name="show_feed_image" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_feed_description" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_item_description" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="show_tags" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_TAGS_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_TAGS_DESC"
				useglobal="true"
				class="chzn-color"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field 
				name="feed_character_count" 
				type="number"
				label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
				description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
				size="6"
				useglobal="true"
			/>

			<field 
				name="feed_display_order" 
				type="list"
				label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
				description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
				useglobal="true"
				>
				<option
value="des">JGLOBAL_MOST_RECENT_FIRST</option>
				<option value="asc">JGLOBAL_OLDEST_FIRST</option>
			</field>
		
		</fieldset>
	</fields>
</metadata>
views/newsfeed/view.html.php000064400000020065151165720370012141
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * HTML View class for the Newsfeeds component
 *
 * @since  1.0
 */
class NewsfeedsViewNewsfeed extends JViewLegacy
{
	/**
	 * @var     object
	 * @since   1.6
	 */
	protected $state;

	/**
	 * @var     object
	 * @since   1.6
	 */
	protected $item;

	/**
	 * @var     boolean
	 * @since   1.6
	 */
	protected $print;

	/**
	 * Execute and display a template script.
	 *
	 * @param   string  $tpl  The name of the template file to parse;
automatically searches through the template paths.
	 *
	 * @return  mixed  A string if successful, otherwise an Error object.
	 *
	 * @since   1.6
	 */
	public function display($tpl = null)
	{
		$app  = JFactory::getApplication();
		$user = JFactory::getUser();

		// Get view related request variables.
		$print = $app->input->getBool('print');

		// Get model data.
		$state = $this->get('State');
		$item  = $this->get('Item');

		// Check for errors.
		// @TODO: Maybe this could go into
JComponentHelper::raiseErrors($this->get('Errors'))
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseWarning(500, implode("\n", $errors));

			return false;
		}

		// Add router helpers.
		$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
		$item->catslug = $item->category_alias ? ($item->catid .
':' . $item->category_alias) : $item->catid;
		$item->parent_slug = $item->category_alias ? ($item->parent_id .
':' . $item->parent_alias) : $item->parent_id;

		// Merge newsfeed params. If this is single-newsfeed view, menu params
override newsfeed params
		// Otherwise, newsfeed params override menu item params
		$params = $state->get('params');
		$newsfeed_params = clone $item->params;
		$active = $app->getMenu()->getActive();
		$temp = clone $params;

		// Check to see which parameters should take priority
		if ($active)
		{
			$currentLink = $active->link;

			// If the current view is the active item and a newsfeed view for this
feed, then the menu item params take priority
			if (strpos($currentLink, 'view=newsfeed') &&
strpos($currentLink, '&id=' . (string) $item->id))
			{
				// $item->params are the newsfeed params, $temp are the menu item
params
				// Merge so that the menu item params take priority
				$newsfeed_params->merge($temp);
				$item->params = $newsfeed_params;

				// Load layout from active query (in case it is an alternative menu
item)
				if (isset($active->query['layout']))
				{
					$this->setLayout($active->query['layout']);
				}
			}
			else
			{
				// Current view is not a single newsfeed, so the newsfeed params take
priority here
				// Merge the menu item params with the newsfeed params so that the
newsfeed params take priority
				$temp->merge($newsfeed_params);
				$item->params = $temp;

				// Check for alternative layouts (since we are not in a single-newsfeed
menu item)
				if ($layout = $item->params->get('newsfeed_layout'))
				{
					$this->setLayout($layout);
				}
			}
		}
		else
		{
			// Merge so that newsfeed params take priority
			$temp->merge($newsfeed_params);
			$item->params = $temp;

			// Check for alternative layouts (since we are not in a single-newsfeed
menu item)
			if ($layout = $item->params->get('newsfeed_layout'))
			{
				$this->setLayout($layout);
			}
		}

		// Check the access to the newsfeed
		$levels = $user->getAuthorisedViewLevels();

		if (!in_array($item->access, $levels) || (in_array($item->access,
$levels) && (!in_array($item->category_access, $levels))))
		{
			$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$app->setHeader('status', 403, true);

			return;
		}

		// Get the current menu item
		$params = $app->getParams();

		// Get the newsfeed
		$newsfeed = $item;

		$params->merge($item->params);

		try
		{
			$feed = new JFeedFactory;
			$this->rssDoc = $feed->getFeed($newsfeed->link);
		}
		catch (InvalidArgumentException $e)
		{
			$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
		}
		catch (RunTimeException $e)
		{
			$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
		}

		if (empty($this->rssDoc))
		{
			$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
		}

		$feed_display_order = $params->get('feed_display_order',
'des');

		if ($feed_display_order === 'asc')
		{
			$this->rssDoc->reverseItems();
		}

		// Escape strings for HTML output
		$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx'));

		$this->params = $params;
		$this->newsfeed = $newsfeed;
		$this->state = $state;
		$this->item = $item;
		$this->user = $user;

		if (!empty($msg))
		{
			$this->msg = $msg;
		}

		$this->print = $print;

		$item->tags = new JHelperTags;
		$item->tags->getItemTags('com_newsfeeds.newsfeed',
$item->id);

		// Increment the hit counter of the newsfeed.
		$model = $this->getModel();
		$model->hit();

		$this->_prepareDocument();

		return parent::display($tpl);
	}

	/**
	 * 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 && (!isset($menu->query['option']) ||
$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 ((!isset($menu->query['option']) ||
$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);
			}
		}
	}
}
access.xml000064400000002715151165734760006553 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<access component="com_newsfeeds">
	<section name="component">
		<action name="core.admin" title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC" />
		<action name="core.options"
title="JACTION_OPTIONS"
description="JACTION_OPTIONS_COMPONENT_DESC" />
		<action name="core.manage" title="JACTION_MANAGE"
description="JACTION_MANAGE_COMPONENT_DESC" />
		<action name="core.create" title="JACTION_CREATE"
description="JACTION_CREATE_COMPONENT_DESC" />
		<action name="core.delete" title="JACTION_DELETE"
description="JACTION_DELETE_COMPONENT_DESC" />
		<action name="core.edit" title="JACTION_EDIT"
description="JACTION_EDIT_COMPONENT_DESC" />
		<action name="core.edit.state"
title="JACTION_EDITSTATE"
description="JACTION_EDITSTATE_COMPONENT_DESC" />
		<action name="core.edit.own"
title="JACTION_EDITOWN"
description="JACTION_EDITOWN_COMPONENT_DESC" />
	</section>
	<section name="category">
		<action name="core.create" title="JACTION_CREATE"
description="COM_CATEGORIES_ACCESS_CREATE_DESC" />
		<action name="core.delete" title="JACTION_DELETE"
description="COM_CATEGORIES_ACCESS_DELETE_DESC" />
		<action name="core.edit" title="JACTION_EDIT"
description="COM_CATEGORIES_ACCESS_EDIT_DESC" />
		<action name="core.edit.state"
title="JACTION_EDITSTATE"
description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />
		<action name="core.edit.own"
title="JACTION_EDITOWN"
description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" />
	</section>
</access>config.xml000064400000026647151165734760006571
0ustar00<?xml version="1.0" encoding="utf-8"?>
<config>

	<fieldset
		name="newsfeed"
		label="COM_NEWSFEEDS_FIELD_CONFIG_NEWSFEED_SETTINGS_LABEL"
		description="COM_NEWSFEEDS_FIELD_CONFIG_NEWSFEED_SETTINGS_DESC"
		>

		<field
			name="newsfeed_layout"
			type="componentlayout"
			label="JGLOBAL_FIELD_LAYOUT_LABEL"
			description="JGLOBAL_FIELD_LAYOUT_DESC"
			menuitems="true"
			extension="com_newsfeeds"
			view="newsfeed"
		/>
		
		<field
			name="save_history"
			type="radio"
			label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL"
			description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC"
			default="0"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>
		
		<field
			name="history_limit"
			type="number"
			label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"
			description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"
			default="5"
			filter="integer"
			showon="save_history:1"
		/>

		<field
			name="show_feed_image"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
			id="show_feed_image"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_feed_description"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
			id="show_feed_description"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_item_description"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
			id="show_item_description"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="feed_character_count"
			type="number"
			label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
			description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
			id="feed_character_count"
			default="0"
			size="6"
		/>

		<field 
			name="feed_display_order" 
			type="list"
			label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
			description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
			id="feed_display_order"
			>
			<option
value="des">JGLOBAL_MOST_RECENT_FIRST</option>
			<option value="asc">JGLOBAL_OLDEST_FIRST</option>
		</field>
		
		<field
			name="float_first"
			type="list"
			label="COM_NEWSFEEDS_FLOAT_FIRST_LABEL"
			description="COM_NEWSFEEDS_FLOAT_DESC"
			>
			<option value="right">COM_NEWSFEEDS_RIGHT</option>
			<option value="left">COM_NEWSFEEDS_LEFT</option>
			<option value="none">COM_NEWSFEEDS_NONE</option>
		</field>

		<field
			name="float_second"
			type="list"
			label="COM_NEWSFEEDS_FLOAT_SECOND_LABEL"
			description="COM_NEWSFEEDS_FLOAT_DESC"
			>
			<option value="right">COM_NEWSFEEDS_RIGHT</option>
			<option value="left">COM_NEWSFEEDS_LEFT</option>
			<option value="none">COM_NEWSFEEDS_NONE</option>
		</field>

		<field
			name="show_tags"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_TAGS_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_TAGS_DESC"
			id="show_tags"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>
	</fieldset>

	<fieldset
		name="category"
		label="JCATEGORY"
		description="COM_NEWSFEEDS_FIELD_CONFIG_CATEGORY_SETTINGS_DESC"
		>

		<field
			name="category_layout"
			type="componentlayout"
			label="JGLOBAL_FIELD_LAYOUT_LABEL"
			description="JGLOBAL_FIELD_LAYOUT_DESC"
			menuitems="true"
			extension="com_newsfeeds"
			view="category"
		/>

		<field
			name="show_category_title"
			type="radio"
			label="JGLOBAL_SHOW_CATEGORY_TITLE"
			description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_description"
			type="radio"
			label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
			description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
			id="show_description"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_description_image"
			type="radio"
			label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
			description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="maxLevel"
			type="list"
			label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
			description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
			default="-1"
			>
			<option value="0">JNONE</option>
			<option value="-1">JALL</option>
			<option value="1">J1</option>
			<option value="2">J2</option>
			<option value="3">J3</option>
			<option value="4">J4</option>
			<option value="5">J5</option>
		</field>

		<field
			name="show_empty_categories"
			type="radio"
			label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
			description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
			default="0"
			class="btn-group btn-group-yesno"
			showon="maxLevel:-1,1,2,3,4,5"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_subcat_desc"
			type="radio"
			label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
			description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			showon="maxLevel:-1,1,2,3,4,5"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_cat_items"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
			id="show_cat_items"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_cat_tags"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_CAT_TAGS_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_CAT_TAGS_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>
	</fieldset>

	<fieldset
		name="categories"
		label="JCATEGORIES"
		description="COM_NEWSFEEDS_CATEGORIES_DESC"
		>

		<field
			name="show_base_description"
			type="radio"
			label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
			description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="maxLevelcat"
			type="list"
			label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
			description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
			default="-1"
			>
			<option value="-1">JALL</option>
			<option value="0">JNONE</option>
			<option value="1">J1</option>
			<option value="2">J2</option>
			<option value="3">J3</option>
			<option value="4">J4</option>
			<option value="5">J5</option>
		</field>

		<field
			name="show_empty_categories_cat"
			type="radio"
			label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
			description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
			default="0"
			class="btn-group btn-group-yesno"
			showon="maxLevelcat:-1,1,2,3,4,5"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_subcat_desc_cat"
			type="radio"
			label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
			description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			showon="maxLevelcat:-1,1,2,3,4,5"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_cat_items_cat"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>
	</fieldset>

	<fieldset
		name="listlayout"
		label="JGLOBAL_LIST_LAYOUT_OPTIONS"
		description="COM_NEWSFEEDS_FIELD_CONFIG_LIST_SETTINGS_DESC"
		>

		<field
			name="filter_field"
			type="radio"
			label="JGLOBAL_FILTER_FIELD_LABEL"
			description="JGLOBAL_FILTER_FIELD_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_pagination_limit"
			type="radio"
			label="JGLOBAL_DISPLAY_SELECT_LABEL"
			description="JGLOBAL_DISPLAY_SELECT_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_headings"
			type="radio"
			label="JGLOBAL_SHOW_HEADINGS_LABEL"
			description="JGLOBAL_SHOW_HEADINGS_DESC"
			id="show_headings"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_articles"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
			description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"
			id="show_articles"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_link"
			type="radio"
			label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
			description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"
			id="show_link"
			default="1"
			class="btn-group btn-group-yesno"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field
			name="show_pagination"
			type="list"
			label="JGLOBAL_PAGINATION_LABEL"
			description="JGLOBAL_PAGINATION_DESC"
			default="2"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
			<option value="2">JGLOBAL_AUTO</option>
		</field>

		<field
			name="show_pagination_results"
			type="radio"
			label="JGLOBAL_PAGINATION_RESULTS_LABEL"
			description="JGLOBAL_PAGINATION_RESULTS_DESC"
			default="1"
			class="btn-group btn-group-yesno"
			showon="show_pagination:1,2"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>
	</fieldset>

	<fieldset name="integration"
		label="JGLOBAL_INTEGRATION_LABEL"
		description="COM_NEWSFEEDS_CONFIG_INTEGRATION_SETTINGS_DESC"
	>

		<field
			name="integration_sef"
			type="note"
			label="JGLOBAL_SEF_TITLE"
		/>

		<field
			name="sef_advanced"
			type="radio"
			class="btn-group btn-group-yesno btn-group-reversed"
			default="0"
			label="JGLOBAL_SEF_ADVANCED_LABEL"
			description="JGLOBAL_SEF_ADVANCED_DESC"
			filter="integer"
		>
			<option
value="0">JGLOBAL_SEF_ADVANCED_LEGACY</option>
			<option
value="1">JGLOBAL_SEF_ADVANCED_MODERN</option>
		</field>

		<field
			name="sef_ids"
			type="radio"
			class="btn-group btn-group-yesno"
			default="0"
			label="JGLOBAL_SEF_NOIDS_LABEL"
			description="JGLOBAL_SEF_NOIDS_DESC"
			showon="sef_advanced:1"
			filter="integer">
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

	</fieldset>

	<fieldset
		name="permissions"
		label="JCONFIG_PERMISSIONS_LABEL"
		description="JCONFIG_PERMISSIONS_DESC"
		>

		<field
			name="rules"
			type="rules"
			label="JCONFIG_PERMISSIONS_LABEL"
			filter="rules"
			validate="rules"
			component="com_newsfeeds"
			section="component"
		/>
	</fieldset>
</config>
controllers/ajax.json.php000064400000004537151165734760011546
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\LanguageHelper;

/**
 * The newsfeed controller for ajax requests
 *
 * @since  3.9.0
 */
class NewsfeedsControllerAjax extends JControllerLegacy
{
	/**
	 * Method to fetch associations of a newsfeed
	 *
	 * The method assumes that the following http parameters are passed in an
Ajax Get request:
	 * token: the form token
	 * assocId: the id of the newsfeed whose associations are to be returned
	 * excludeLang: the association for this language is to be excluded
	 *
	 * @return  null
	 *
	 * @since  3.9.0
	 */
	public function fetchAssociations()
	{
		if (!JSession::checkToken('get'))
		{
			echo new JResponseJson(null, JText::_('JINVALID_TOKEN'),
true);
		}
		else
		{
			$input = JFactory::getApplication()->input;

			$assocId = $input->getInt('assocId', 0);

			if ($assocId == 0)
			{
				echo new JResponseJson(null,
JText::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID',
'assocId'), true);

				return;
			}

			$excludeLang = $input->get('excludeLang', '',
'STRING');

			$associations =
JLanguageAssociations::getAssociations('com_newsfeeds',
'#__newsfeeds', 'com_newsfeeds.item', (int) $assocId);

			unset($associations[$excludeLang]);

			// Add the title to each of the associated records
			JTable::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_newsfeeds/tables');
			$newsfeedsTable = JTable::getInstance('Newsfeed',
'NewsfeedsTable');

			foreach ($associations as $lang => $association)
			{
				$newsfeedsTable->load($association->id);
				$associations[$lang]->title = $newsfeedsTable->name;
			}

			$countContentLanguages =
count(LanguageHelper::getContentLanguages(array(0, 1)));

			if (count($associations) == 0)
			{
				$message =
JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE');
			}
			elseif ($countContentLanguages > count($associations) + 2)
			{
				$tags    = implode(', ', array_keys($associations));
				$message =
JText::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME',
$tags);
			}
			else
			{
				$message =
JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_ALL');
			}

			echo new JResponseJson($associations, $message);
		}
	}
}
controllers/newsfeed.php000064400000005753151165734760011454
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
 * Newsfeed controller class.
 *
 * @since  1.6
 */
class NewsfeedsControllerNewsfeed extends JControllerForm
{
	/**
	 * Method override to check if you can add a new record.
	 *
	 * @param   array  $data  An array of input data.
	 *
	 * @return  boolean
	 *
	 * @since   1.6
	 */
	protected function allowAdd($data = array())
	{
		$categoryId = ArrayHelper::getValue($data, 'catid',
$this->input->getInt('filter_category_id'),
'int');
		$allow = null;

		if ($categoryId)
		{
			// If the category has been passed in the URL check it.
			$allow = JFactory::getUser()->authorise('core.create',
$this->option . '.category.' . $categoryId);
		}

		if ($allow === null)
		{
			// In the absence of better information, revert to the component
permissions.
			return parent::allowAdd($data);
		}
		else
		{
			return $allow;
		}
	}

	/**
	 * Method to check if you can edit a record.
	 *
	 * @param   array   $data  An array of input data.
	 * @param   string  $key   The name of the key for the primary key.
	 *
	 * @return  boolean
	 *
	 * @since   1.6
	 */
	protected function allowEdit($data = array(), $key = 'id')
	{
		$recordId = (int) isset($data[$key]) ? $data[$key] : 0;

		// Since there is no asset tracking, fallback to the component
permissions.
		if (!$recordId)
		{
			return parent::allowEdit($data, $key);
		}

		// Get the item.
		$item = $this->getModel()->getItem($recordId);

		// Since there is no item, return false.
		if (empty($item))
		{
			return false;
		}

		$user = JFactory::getUser();

		// Check if can edit own core.edit.own.
		$canEditOwn = $user->authorise('core.edit.own',
$this->option . '.category.' . (int) $item->catid)
&& $item->created_by == $user->id;

		// Check the category core.edit permissions.
		return $canEditOwn || $user->authorise('core.edit',
$this->option . '.category.' . (int) $item->catid);
	}

	/**
	 * Method to run batch operations.
	 *
	 * @param   object  $model  The model.
	 *
	 * @return  boolean   True if successful, false otherwise and internal
error is set.
	 *
	 * @since   2.5
	 */
	public function batch($model = null)
	{
		$this->checkToken();

		// Set the model
		$model = $this->getModel('Newsfeed', '', array());

		// Preset the redirect
		$this->setRedirect(JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds'
. $this->getRedirectToListAppend(), false));

		return parent::batch($model);
	}

	/**
	 * Function that allows child controller access to model data after the
data has been saved.
	 *
	 * @param   JModelLegacy  $model      The data model object.
	 * @param   array         $validData  The validated data.
	 *
	 * @return  void
	 *
	 * @since   3.1
	 */
	protected function postSaveHook(JModelLegacy $model, $validData = array())
	{

	}
}
controllers/newsfeeds.php000064400000002331151165734760011624
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Newsfeeds list controller class.
 *
 * @since  1.6
 */
class NewsfeedsControllerNewsfeeds extends JControllerAdmin
{
	/**
	 * Method to get a model object, loading it if required.
	 *
	 * @param   string  $name    The model name. Optional.
	 * @param   string  $prefix  The class prefix. Optional.
	 * @param   array   $config  Configuration array for model. Optional.
	 *
	 * @return  object  The model.
	 *
	 * @since   1.6
	 */
	public function getModel($name = 'Newsfeed', $prefix =
'NewsfeedsModel', $config = array('ignore_request'
=> true))
	{
		return parent::getModel($name, $prefix, $config);
	}

	/**
	 * Function that allows child controller access to model data
	 * after the item has been deleted.
	 *
	 * @param   JModelLegacy  $model  The data model object.
	 * @param   integer       $ids    The validated data.
	 *
	 * @return  void
	 *
	 * @since   3.1
	 */
	protected function postDeleteHook(JModelLegacy $model, $ids = null)
	{
	}
}
helpers/associations.php000064400000007152151165734760011442
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Association\AssociationExtensionHelper;

JTable::addIncludePath(__DIR__ . '/../tables');

/**
 * Content associations helper.
 *
 * @since  3.7.0
 */
class NewsfeedsAssociationsHelper extends AssociationExtensionHelper
{
	/**
	 * The extension name
	 *
	 * @var       array   $extension
	 *
	 * @since    3.7.0
	 */
	protected $extension = 'com_newsfeeds';

	/**
	 * Array of item types
	 *
	 * @var       array   $itemTypes
	 *
	 * @since    3.7.0
	 */
	protected $itemTypes = array('newsfeed', 'category');

	/**
	 * Has the extension association support
	 *
	 * @var       boolean   $associationsSupport
	 *
	 * @since    3.7.0
	 */
	protected $associationsSupport = true;

	/**
	 * Get the associated items for an item
	 *
	 * @param   string  $typeName  The item type
	 * @param   int     $id        The id of item for which we need the
associated items
	 *
	 * @return  array
	 *
	 * @since   3.7.0
	 */
	public function getAssociations($typeName, $id)
	{
		$type = $this->getType($typeName);

		$context    = $this->extension . '.item';
		$catidField = 'catid';

		if ($typeName === 'category')
		{
			$context    = 'com_categories.item';
			$catidField = '';
		}

		// Get the associations.
		$associations = JLanguageAssociations::getAssociations(
			$this->extension,
			$type['tables']['a'],
			$context,
			$id,
			'id',
			'alias',
			$catidField
		);

		return $associations;
	}

	/**
	 * Get item information
	 *
	 * @param   string  $typeName  The item type
	 * @param   int     $id        The id of item for which we need the
associated items
	 *
	 * @return  JTable|null
	 *
	 * @since   3.7.0
	 */
	public function getItem($typeName, $id)
	{
		if (empty($id))
		{
			return null;
		}

		$table = null;

		switch ($typeName)
		{
			case 'newsfeed':
				$table = JTable::getInstance('Newsfeed',
'NewsfeedsTable');
				break;

			case 'category':
				$table = JTable::getInstance('Category');
				break;
		}

		if (empty($table))
		{
			return null;
		}

		$table->load($id);

		return $table;
	}

	/**
	 * Get information about the type
	 *
	 * @param   string  $typeName  The item type
	 *
	 * @return  array  Array of item types
	 *
	 * @since   3.7.0
	 */
	public function getType($typeName = '')
	{
		$fields  = $this->getFieldsTemplate();
		$tables  = array();
		$joins   = array();
		$support = $this->getSupportTemplate();
		$title   = '';

		if (in_array($typeName, $this->itemTypes))
		{
			switch ($typeName)
			{
				case 'newsfeed':
					$fields['title'] = 'a.name';
					$fields['state'] = 'a.published';

					$support['state'] = true;
					$support['acl'] = true;
					$support['checkout'] = true;
					$support['category'] = true;
					$support['save2copy'] = true;

					$tables = array(
						'a' => '#__newsfeeds'
					);
					$title = 'newsfeed';
					break;

				case 'category':
					$fields['created_user_id'] = 'a.created_user_id';
					$fields['ordering'] = 'a.lft';
					$fields['level'] = 'a.level';
					$fields['catid'] = '';
					$fields['state'] = 'a.published';

					$support['state'] = true;
					$support['acl'] = true;
					$support['checkout'] = true;
					$support['level'] = true;

					$tables = array(
						'a' => '#__categories'
					);

					$title = 'category';
					break;
			}
		}

		return array(
			'fields'  => $fields,
			'support' => $support,
			'tables'  => $tables,
			'joins'   => $joins,
			'title'   => $title
		);
	}
}
helpers/html/newsfeed.php000064400000005001151165734760011476
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR .
'/components/com_newsfeeds/helpers/newsfeeds.php');

/**
 * Utility class for creating HTML Grids.
 *
 * @since  1.5
 */
class JHtmlNewsfeed
{
	/**
	 * Get the associated language flags
	 *
	 * @param   int  $newsfeedid  The item id to search associations
	 *
	 * @return  string  The language HTML
	 *
	 * @throws  Exception  Throws a 500 Exception on Database failure
	 */
	public static function association($newsfeedid)
	{
		// Defaults
		$html = '';

		// Get the associations
		if ($associations =
JLanguageAssociations::getAssociations('com_newsfeeds',
'#__newsfeeds', 'com_newsfeeds.item', $newsfeedid))
		{
			foreach ($associations as $tag => $associated)
			{
				$associations[$tag] = (int) $associated->id;
			}

			// Get the associated newsfeed items
			$db = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select('c.id, c.name as title')
				->select('l.sef as lang_sef, lang_code')
				->from('#__newsfeeds as c')
				->select('cat.title as category_title')
				->join('LEFT', '#__categories as cat ON
cat.id=c.catid')
				->where('c.id IN (' . implode(',',
array_values($associations)) . ')')
				->where('c.id != ' . $newsfeedid)
				->join('LEFT', '#__languages as l ON
c.language=l.lang_code')
				->select('l.image')
				->select('l.title as language_title');
			$db->setQuery($query);

			try
			{
				$items = $db->loadObjectList('id');
			}
			catch (RuntimeException $e)
			{
				throw new Exception($e->getMessage(), 500);
			}

			if ($items)
			{
				foreach ($items as &$item)
				{
					$text = strtoupper($item->lang_sef);
					$url =
JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id='
. (int) $item->id);
					$tooltip = htmlspecialchars($item->title, ENT_QUOTES,
'UTF-8') . '<br />' .
JText::sprintf('JCATEGORY_SPRINTF', $item->category_title);
					$classes = 'hasPopover label label-association label-' .
$item->lang_sef;

					$item->link = '<a href="' . $url . '"
title="' . $item->language_title . '"
class="' . $classes
						. '" data-content="' . $tooltip . '"
data-placement="top">'
						. $text . '</a>';
				}
			}

			JHtml::_('bootstrap.popover');

			$html = JLayoutHelper::render('joomla.content.associations',
$items);
		}

		return $html;
	}
}
helpers/newsfeeds.php000064400000003777151165734760010737 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Newsfeeds component helper.
 *
 * @since  1.6
 */
class NewsfeedsHelper extends JHelperContent
{
	public static $extension = 'com_newsfeeds';

	/**
	 * Configure the Linkbar.
	 *
	 * @param   string  $vName  The name of the active view.
	 *
	 * @return  void
	 */
	public static function addSubmenu($vName)
	{
		JHtmlSidebar::addEntry(
			JText::_('COM_NEWSFEEDS_SUBMENU_NEWSFEEDS'),
			'index.php?option=com_newsfeeds&view=newsfeeds',
			$vName == 'newsfeeds'
		);

		JHtmlSidebar::addEntry(
			JText::_('COM_NEWSFEEDS_SUBMENU_CATEGORIES'),
			'index.php?option=com_categories&extension=com_newsfeeds',
			$vName == 'categories'
		);
	}

	/**
	 * Adds Count Items for Category Manager.
	 *
	 * @param   stdClass[]  &$items  The category objects
	 *
	 * @return  stdClass[]
	 *
	 * @since   3.5
	 */
	public static function countItems(&$items)
	{
		$config = (object) array(
			'related_tbl'   => 'newsfeeds',
			'state_col'     => 'published',
			'group_col'     => 'catid',
			'relation_type' => 'category_or_group',
		);

		return parent::countRelations($items, $config);
	}

	/**
	 * Adds Count Items for Tag Manager.
	 *
	 * @param   stdClass[]  &$items     The tag objects
	 * @param   string      $extension  The name of the active view.
	 *
	 * @return  stdClass[]
	 *
	 * @since   3.6
	 */
	public static function countTagItems(&$items, $extension)
	{
		$parts   = explode('.', $extension);
		$section = count($parts) > 1 ? $parts[1] : null;

		$config = (object) array(
			'related_tbl'   => ($section === 'category' ?
'categories' : 'newsfeeds'),
			'state_col'     => 'published',
			'group_col'     => 'tag_id',
			'extension'     => $extension,
			'relation_type' => 'tag_assigments',
		);

		return parent::countRelations($items, $config);
	}
}
models/fields/modal/newsfeed.php000064400000023470151165734760012727
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\LanguageHelper;

/**
 * Supports a modal newsfeeds picker.
 *
 * @since  1.6
 */
class JFormFieldModal_Newsfeed extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   1.6
	 */
	protected $type = 'Modal_Newsfeed';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$allowNew       = ((string) $this->element['new'] ==
'true');
		$allowEdit      = ((string) $this->element['edit'] ==
'true');
		$allowClear     = ((string) $this->element['clear'] !=
'false');
		$allowSelect    = ((string) $this->element['select'] !=
'false');
		$allowPropagate = ((string) $this->element['propagate'] ==
'true');

		$languages = LanguageHelper::getContentLanguages(array(0, 1));

		// Load language
		JFactory::getLanguage()->load('com_newsfeeds',
JPATH_ADMINISTRATOR);

		// The active newsfeed id field.
		$value = (int) $this->value > 0 ? (int) $this->value :
'';

		// Create the modal id.
		$modalId = 'Newsfeed_' . $this->id;

		// Add the modal field script to the document head.
		JHtml::_('jquery.framework');
		JHtml::_('script', 'system/modal-fields.js',
array('version' => 'auto', 'relative'
=> true));

		// Script to proxy the select modal function to the modal-fields.js file.
		if ($allowSelect)
		{
			static $scriptSelect = null;

			if (is_null($scriptSelect))
			{
				$scriptSelect = array();
			}

			if (!isset($scriptSelect[$this->id]))
			{
				JFactory::getDocument()->addScriptDeclaration("
				function jSelectNewsfeed_" . $this->id . "(id, title,
object) {
					window.processModalSelect('Newsfeed', '" .
$this->id . "', id, title, '', object);
				}
				"
				);

				JText::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');

				$scriptSelect[$this->id] = true;
			}
		}

		// Setup variables for display.
		$linkNewsfeeds =
'index.php?option=com_newsfeeds&amp;view=newsfeeds&amp;layout=modal&amp;tmpl=component&amp;'
. JSession::getFormToken() . '=1';
		$linkNewsfeed  =
'index.php?option=com_newsfeeds&amp;view=newsfeed&amp;layout=modal&amp;tmpl=component&amp;'
. JSession::getFormToken() . '=1';
		$modalTitle    = JText::_('COM_NEWSFEEDS_CHANGE_FEED');

		if (isset($this->element['language']))
		{
			$linkNewsfeeds .= '&amp;forcedLanguage=' .
$this->element['language'];
			$linkNewsfeed  .= '&amp;forcedLanguage=' .
$this->element['language'];
			$modalTitle    .= ' &#8212; ' .
$this->element['label'];
		}

		$urlSelect = $linkNewsfeeds .
'&amp;function=jSelectNewsfeed_' . $this->id;
		$urlEdit   = $linkNewsfeed .
'&amp;task=newsfeed.edit&amp;id=\' +
document.getElementById("' . $this->id .
'_id").value + \'';
		$urlNew    = $linkNewsfeed . '&amp;task=newsfeed.add';

		if ($value)
		{
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('name'))
				->from($db->quoteName('#__newsfeeds'))
				->where($db->quoteName('id') . ' = ' . (int)
$value);
			$db->setQuery($query);

			try
			{
				$title = $db->loadResult();
			}
			catch (RuntimeException $e)
			{
				JError::raiseWarning(500, $e->getMessage());
			}
		}

		$title = empty($title) ?
JText::_('COM_NEWSFEEDS_SELECT_A_FEED') :
htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The current newsfeed display field.
		$html  = '<span class="input-append">';
		$html .= '<input class="input-medium" id="' .
$this->id . '_name" type="text" value="' .
$title . '" disabled="disabled" size="35"
/>';

		// Select newsfeed button
		if ($allowSelect)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '
hidden' : '') . '"'
				. ' id="' . $this->id . '_select"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalSelect' . $modalId .
'"'
				. ' title="' .
JHtml::tooltipText('COM_NEWSFEEDS_CHANGE_FEED') .
'">'
				. '<span class="icon-file"
aria-hidden="true"></span> ' .
JText::_('JSELECT')
				. '</button>';
		}

		// New newsfeed button
		if ($allowNew)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '
hidden' : '') . '"'
				. ' id="' . $this->id . '_new"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalNew' . $modalId .
'"'
				. ' title="' .
JHtml::tooltipText('COM_NEWSFEEDS_NEW_NEWSFEED') .
'">'
				. '<span class="icon-new"
aria-hidden="true"></span> ' .
JText::_('JACTION_CREATE')
				. '</button>';
		}

		// Edit newsfeed button
		if ($allowEdit)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '' :
' hidden') . '"'
				. ' id="' . $this->id . '_edit"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalEdit' . $modalId .
'"'
				. ' title="' .
JHtml::tooltipText('COM_NEWSFEEDS_EDIT_NEWSFEED') .
'">'
				. '<span class="icon-edit"
aria-hidden="true"></span> ' .
JText::_('JACTION_EDIT')
				. '</button>';
		}

		// Clear newsfeed button
		if ($allowClear)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn' . ($value ? '' : '
hidden') . '"'
				. ' id="' . $this->id . '_clear"'
				. ' onclick="window.processModalParent(\'' .
$this->id . '\'); return false;">'
				. '<span class="icon-remove"
aria-hidden="true"></span>' .
JText::_('JCLEAR')
				. '</button>';
		}

		// Propagate newsfeed button
		if ($allowPropagate && count($languages) > 2)
		{
			// Strip off language tag at the end
			$tagLength = (int) strlen($this->element['language']);
			$callbackFunctionStem = substr("jSelectNewsfeed_" .
$this->id, 0, -$tagLength);

			$html .= '<a'
			. ' class="btn hasTooltip' . ($value ? '' :
' hidden') . '"'
			. ' id="' . $this->id . '_propagate"'
			. ' href="#"'
			. ' title="' .
JHtml::tooltipText('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP') .
'"'
			. ' onclick="Joomla.propagateAssociation(\'' .
$this->id . '\', \'' . $callbackFunctionStem .
'\');">'
			. '<span class="icon-refresh"
aria-hidden="true"></span>' .
JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON')
			. '</a>';
		}

		$html .= '</span>';

		// Select newsfeed modal
		if ($allowSelect)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalSelect' . $modalId,
				array(
					'title'       => $modalTitle,
					'url'         => $urlSelect,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button"
class="btn" data-dismiss="modal">' .
JText::_('JLIB_HTML_BEHAVIOR_CLOSE') .
'</button>',
				)
			);
		}

		// New newsfeed modal
		if ($allowNew)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalNew' . $modalId,
				array(
					'title'       =>
JText::_('COM_NEWSFEEDS_NEW_NEWSFEED'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlNew,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button"
class="btn"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'add\',
\'newsfeed\', \'cancel\', \'newsfeed-form\',
\'jform_id\', \'jform_name\'); return
false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') .
'</button>'
							. '<button type="button" class="btn
btn-primary"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'add\',
\'newsfeed\', \'save\', \'newsfeed-form\',
\'jform_id\', \'jform_name\'); return
false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn
btn-success"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'add\',
\'newsfeed\', \'apply\', \'newsfeed-form\',
\'jform_id\', \'jform_name\'); return
false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Edit newsfeed modal.
		if ($allowEdit)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalEdit' . $modalId,
				array(
					'title'       =>
JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlEdit,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button"
class="btn"'
							. ' onclick="window.processModalEdit(this, \'' .
$this->id
							. '\', \'edit\', \'newsfeed\',
\'cancel\', \'newsfeed-form\', \'jform_id\',
\'jform_name\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') .
'</button>'
							. '<button type="button" class="btn
btn-primary"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'edit\',
\'newsfeed\', \'save\', \'newsfeed-form\',
\'jform_id\', \'jform_name\'); return
false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn
btn-success"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'edit\',
\'newsfeed\', \'apply\', \'newsfeed-form\',
\'jform_id\', \'jform_name\'); return
false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Add class='required' for client side validation
		$class = $this->required ? ' class="required
modal-value"' : '';

		$html .= '<input type="hidden" id="' .
$this->id . '_id"' . $class . '
data-required="' . (int) $this->required . '"
name="' . $this->name
			. '" data-text="' .
htmlspecialchars(JText::_('COM_NEWSFEEDS_SELECT_A_FEED', true),
ENT_COMPAT, 'UTF-8') . '" value="' . $value .
'" />';

		return $html;
	}

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   3.4
	 */
	protected function getLabel()
	{
		return str_replace($this->id, $this->id . '_id',
parent::getLabel());
	}
}
models/fields/newsfeeds.php000064400000002243151165734760012011
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * News Feed List field.
 *
 * @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()
	{
		$options = array();

		$db    = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('id As value, name As text')
			->from('#__newsfeeds AS a')
			->order('a.name');

		// Get the options.
		$db->setQuery($query);

		try
		{
			$options = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $db->getMessage());
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
models/forms/filter_newsfeeds.xml000064400000007302151165734760013250
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>

	<fields name="filter">

		<field
			name="search"
			type="text"
			inputmode="search"
			label="COM_NEWSFEEDS_FILTER_SEARCH_LABEL"
			description="COM_NEWSFEEDS_FILTER_SEARCH_DESC"
			hint="JSEARCH_FILTER"
		/>

		<field
			name="published"
			type="status"
			label="COM_NEWSFEEDS_FILTER_PUBLISHED"
			description="COM_NEWSFEEDS_FILTER_PUBLISHED_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_PUBLISHED</option>
		</field>

		<field
			name="category_id"
			type="category"
			label="JOPTION_FILTER_CATEGORY"
			description="JOPTION_FILTER_CATEGORY_DESC"
			extension="com_newsfeeds"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_CATEGORY</option>
		</field>

		<field
			name="access"
			type="accesslevel"
			label="JOPTION_FILTER_ACCESS"
			description="JOPTION_FILTER_ACCESS_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_ACCESS</option>
		</field>

		<field
			name="language"
			type="contentlanguage"
			label="JOPTION_FILTER_LANGUAGE"
			description="JOPTION_FILTER_LANGUAGE_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_LANGUAGE</option>
			<option value="*">JALL</option>
		</field>

		<field
			name="tag"
			type="tag"
			label="JOPTION_FILTER_TAG"
			description="JOPTION_FILTER_TAG_DESC"
			mode="nested"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_TAG</option>
		</field>

		<field
			name="level"
			type="integer"
			label="JOPTION_FILTER_LEVEL"
			description="JOPTION_FILTER_LEVEL_DESC"
			first="1"
			last="10"
			step="1"
			languages="*"
			onchange="this.form.submit();"
			>
			<option
value="">JOPTION_SELECT_MAX_LEVELS</option>
		</field>
	</fields>

	<fields name="list">

		<field
			name="fullordering"
			type="list"
			label="COM_NEWSFEEDS_LIST_FULL_ORDERING"
			description="COM_NEWSFEEDS_LIST_FULL_ORDERING_DESC"
			onchange="this.form.submit();"
			default="a.name ASC"
			validate="options"
			>
			<option value="">JGLOBAL_SORT_BY</option>
			<option value="a.ordering
ASC">JGRID_HEADING_ORDERING_ASC</option>
			<option value="a.ordering
DESC">JGRID_HEADING_ORDERING_DESC</option>
			<option value="a.published
ASC">JSTATUS_ASC</option>
			<option value="a.published
DESC">JSTATUS_DESC</option>
			<option value="a.name
ASC">JGLOBAL_TITLE_ASC</option>
			<option value="a.name
DESC">JGLOBAL_TITLE_DESC</option>
			<option value="category_title
ASC">JCATEGORY_ASC</option>
			<option value="category_title
DESC">JCATEGORY_DESC</option>
			<option value="access_level
ASC">JGRID_HEADING_ACCESS_ASC</option>
			<option value="access_level
DESC">JGRID_HEADING_ACCESS_DESC</option>
			<option value="numarticles
ASC">COM_NEWSFEEDS_NUM_ARTICLES_HEADING_ASC</option>
			<option value="numarticles
DESC">COM_NEWSFEEDS_NUM_ARTICLES_HEADING_DESC</option>
			<option value="a.cache_time
ASC">COM_NEWSFEEDS_CACHE_TIME_HEADING_ASC</option>
			<option value="a.cache_time
DESC">COM_NEWSFEEDS_CACHE_TIME_HEADING_DESC</option>
			<option
				value="association ASC"
				requires="associations"
				>
				JASSOCIATIONS_ASC
			</option>
			<option
				value="association DESC"
				requires="associations"
				>
				JASSOCIATIONS_DESC
			</option>
			<option value="language_title
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
			<option value="language_title
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
			<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
			<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
		</field>

		<field
			name="limit"
			type="limitbox"
			label="COM_NEWSFEEDS_LIST_LIMIT"
			description="COM_NEWSFEEDS_LIST_LIMIT_DESC"
			default="25"
			class="input-mini"
			onchange="this.form.submit();"
		/>
	</fields>
</form>
models/forms/newsfeed.xml000064400000024754151165734760011532
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>

	<fieldset
addfieldpath="/administrator/components/com_categories/models/fields"
>

		<field
			name="id"
			type="number"
			label="JGLOBAL_FIELD_ID_LABEL"
			description="JGLOBAL_FIELD_ID_DESC"
			default="0"
			class="readonly"
			readonly="true"
		/>

		<field
			name="name"
			type="text"
			label="JGLOBAL_TITLE"
			description="JFIELD_TITLE_DESC"
			class="input-xxlarge input-large-text"
			size="40"
			required="true"
		/>

		<field
			name="alias"
			type="text"
			label="JFIELD_ALIAS_LABEL"
			description="JFIELD_ALIAS_DESC"
			size="45"
			hint="JFIELD_ALIAS_PLACEHOLDER"
		/>

		<field
			name="published"
			type="list"
			label="JSTATUS"
			description="JFIELD_PUBLISHED_DESC"
			default="1"
			class="chzn-color-state"
			size="1"
			>
			<option value="1">JPUBLISHED</option>
			<option value="0">JUNPUBLISHED</option>
			<option value="2">JARCHIVED</option>
			<option value="-2">JTRASHED</option>
		</field>

		<field
			name="catid"
			type="categoryedit"
			label="JCATEGORY"
			description="COM_NEWSFEEDS_FIELD_CATEGORY_DESC"
			extension="com_newsfeeds"
			required="true"
			default=""
		/>

		<field
			name="language"
			type="contentlanguage"
			label="JFIELD_LANGUAGE_LABEL"
			description="COM_NEWSFEEDS_FIELD_LANGUAGE_DESC"
			>
			<option value="*">JALL</option>
		</field>

		<field
			name="tags"
			type="tag"
			label="JTAG"
			description="JTAG_DESC"
			class="span12"
			multiple="true"
		/>

		<field
			name="version_note"
			type="text"
			label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
			description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
			labelclass="control-label"
			class="span12"
			size="45"
			maxlength="255"
		/>

		<field
			name="description"
			type="editor"
			label="JGLOBAL_DESCRIPTION"
			description="COM_NEWSFEEDS_FIELD_DESCRIPTION_DESC"
			buttons="true"
			hide="pagebreak,readmore"
			filter="JComponentHelper::filterText"
		/>

		<field
			name="link"
			type="url"
			label="COM_NEWSFEEDS_FIELD_LINK_LABEL"
			description="COM_NEWSFEEDS_FIELD_LINK_DESC"
			class="span12"
			size="60"
			required="true"
			filter="url"
			validate="url"
		/>

		<field
			name="numarticles"
			type="number"
			label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_LABEL"
			description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_DESC"
			default="5"
			size="2"
		/>

		<field
			name="cache_time"
			type="number"
			label="COM_NEWSFEEDS_FIELD_CACHETIME_LABEL"
			description="JGLOBAL_FIELD_FIELD_CACHETIME_DESC"
			default="3600"
			size="4"
		/>

		<field
			name="ordering"
			type="ordering"
			label="JFIELD_ORDERING_LABEL"
			description="JFIELD_ORDERING_DESC"
			content_type="com_newsfeeds.newsfeed"
		/>

		<field
			name="created"
			type="calendar"
			label="JGLOBAL_FIELD_CREATED_LABEL"
			description="JGLOBAL_FIELD_CREATED_DESC"
			translateformat="true"
			showtime="true"
			size="22"
			filter="user_utc"
		/>

		<field
			name="created_by"
			type="user"
			label="JGLOBAL_FIELD_Created_by_Label"
			description="JGLOBAL_FIELD_CREATED_BY_DESC"
		/>

		<field
			name="created_by_alias"
			type="text"
			label="JGLOBAL_FIELD_Created_by_alias_Label"
			description="JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC"
			size="20"
		/>

		<field
			name="modified"
			type="calendar"
			label="JGLOBAL_FIELD_Modified_Label"
			description="COM_NEWSFEEDS_FIELD_MODIFIED_DESC"
			class="readonly"
			translateformat="true"
			showtime="true"
			size="22"
			readonly="true"
			filter="user_utc"
		/>

		<field
			name="modified_by"
			type="user"
			label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
			description="COM_NEWSFEEDS_FIELD_MODIFIED_BY_DESC"
			class="readonly"
			readonly="true"
			filter="unset"
		/>

		<field
			name="version"
			type="text"
			label="COM_NEWSFEEDS_FIELD_VERSION_LABEL"
			description="COM_NEWSFEEDS_FIELD_VERSION_DESC"
			class="readonly"
			size="6"
			readonly="true"
			filter="unset"
		/>

		<field
			name="checked_out"
			type="Text"
			label="JGLOBAL_FIELD_CHECKEDOUT_LABEL"
			description="JGLOBAL_FIELD_CHECKEDOUT_DESC"
			size="6"
			readonly="true"
			filter="unset"
		/>

		<field
			name="checked_out_time"
			type="Text"
			label="JGLOBAL_FIELD_CHECKEDOUT_TIME_LABEL"
			description="JGLOBAL_FIELD_CHECKEDOUT_TIME_DESC"
			size="6"
			readonly="true"
			filter="unset"
		/>

		<field
			name="publish_up"
			type="calendar"
			label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
			description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
			translateformat="true"
			showtime="true"
			size="22"
			filter="user_utc"
		/>

		<field
			name="publish_down"
			type="calendar"
			label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
			description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
			translateformat="true"
			showtime="true"
			size="22"
			filter="user_utc"
		/>

		<field
			name="access"
			type="accesslevel"
			label="JFIELD_ACCESS_LABEL"
			description="JFIELD_ACCESS_DESC"
			size="1"
		/>

		<field
			name="metakey"
			type="textarea"
			label="JFIELD_META_KEYWORDS_LABEL"
			description="JFIELD_META_KEYWORDS_DESC"
			rows="3"
			cols="30"
		/>

		<field
			name="metadesc"
			type="textarea"
			label="JFIELD_META_DESCRIPTION_LABEL"
			description="JFIELD_META_DESCRIPTION_DESC"
			rows="3"
			cols="30"
		/>

		<field
			name="xreference"
			type="text"
			label="JFIELD_XREFERENCE_LABEL"
			description="JFIELD_XREFERENCE_DESC"
			size="20"
		/>

		<fields name="images">

			<fieldset name="images"
label="JGLOBAL_FIELDSET_IMAGE_OPTIONS">

				<field
					name="image_first"
					type="media"
					label="COM_NEWSFEEDS_FIELD_FIRST_LABEL"
					description="COM_NEWSFEEDS_FIELD_FIRST_DESC"
				/>

				<field
					name="float_first"
					type="list"
					label="COM_NEWSFEEDS_FLOAT_LABEL"
					description="COM_NEWSFEEDS_FLOAT_DESC"
					useglobal="true"
					>
					<option
value="right">COM_NEWSFEEDS_RIGHT</option>
					<option value="left">COM_NEWSFEEDS_LEFT</option>
					<option value="none">COM_NEWSFEEDS_NONE</option>
				</field>

				<field
					name="image_first_alt"
					type="text"
					label="COM_NEWSFEEDS_FIELD_IMAGE_ALT_LABEL"
					description="COM_NEWSFEEDS_FIELD_IMAGE_ALT_DESC"
					size="20"
				/>

				<field
					name="image_first_caption"
					type="text"
					label="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_LABEL"
					description="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_DESC"
					size="20"
				/>

				<field
					name="spacer1"
					type="spacer"
					hr="true"
				/>

				<field
					name="image_second"
					type="media"
					label="COM_NEWSFEEDS_FIELD_SECOND_LABEL"
					description="COM_NEWSFEEDS_FIELD_SECOND_DESC"
				/>

				<field
					name="float_second"
					type="list"
					label="COM_NEWSFEEDS_FLOAT_LABEL"
					description="COM_NEWSFEEDS_FLOAT_DESC"
					useglobal="true"
					>
					<option
value="right">COM_NEWSFEEDS_RIGHT</option>
					<option value="left">COM_NEWSFEEDS_LEFT</option>
					<option value="none">COM_NEWSFEEDS_NONE</option>
				</field>

				<field
					name="image_second_alt"
					type="text"
					label="COM_NEWSFEEDS_FIELD_IMAGE_ALT_LABEL"
					description="COM_NEWSFEEDS_FIELD_IMAGE_ALT_DESC"
					size="20"
				/>

				<field
					name="image_second_caption"
					type="text"
					label="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_LABEL"
					description="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_DESC"
					size="20"
				/>
			</fieldset>
		</fields>
	</fieldset>

	<fieldset name="jbasic"
label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS">

		<field
			name="numarticles"
			type="number"
			label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_LABEL"
			description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_DESC"
			default="5"
			size="2"
		/>

		<field
			name="cache_time"
			type="number"
			label="COM_NEWSFEEDS_FIELD_CACHETIME_LABEL"
			description="JGLOBAL_FIELD_FIELD_CACHETIME_DESC"
			default="3600"
			size="4"
		/>

		<field
			name="rtl"
			type="list"
			label="COM_NEWSFEEDS_FIELD_RTL_LABEL"
			description="COM_NEWSFEEDS_FIELD_RTL_DESC"
			default="0"
			>
			<option
value="0">COM_NEWSFEEDS_FIELD_VALUE_SITE</option>
			<option
value="1">COM_NEWSFEEDS_FIELD_VALUE_LTR</option>
			<option
value="2">COM_NEWSFEEDS_FIELD_VALUE_RTL</option>
		</field>

		<fields name="params"
label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS">

			<field
				name="show_feed_image"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
				useglobal="true"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_feed_description"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
				useglobal="true"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="show_item_description"
				type="list"
				label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
				description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
				useglobal="true"
				>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>

			<field
				name="feed_character_count"
				type="number"
				label="COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_LABEL"
				description="COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_DESC"
				size="6"
				useglobal="true"
			/>

			<field
				name="newsfeed_layout"
				type="componentlayout"
				label="JFIELD_ALT_LAYOUT_LABEL"
				description="JFIELD_ALT_COMPONENT_LAYOUT_DESC"
				extension="com_newsfeeds"
				view="newsfeed"
				useglobal="true"
			/>

			<field
				name="feed_display_order"
				type="list"
				label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
				description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
				useglobal="true"
				>
				<option
value="des">JGLOBAL_MOST_RECENT_FIRST</option>
				<option value="asc">JGLOBAL_OLDEST_FIRST</option>
			</field>
		</fields>
	</fieldset>

	<fields name="metadata"
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">

		<fieldset name="jmetadata"
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">

			<field
				name="robots"
				type="list"
				label="JFIELD_METADATA_ROBOTS_LABEL"
				description="JFIELD_METADATA_ROBOTS_DESC"
				>
				<option value="">JGLOBAL_USE_GLOBAL</option>
				<option value="index, follow"></option>
				<option value="noindex, follow"></option>
				<option value="index, nofollow"></option>
				<option value="noindex, nofollow"></option>
			</field>

			<field
				name="rights"
				type="text"
				label="JFIELD_META_RIGHTS_LABEL"
				description="JFIELD_META_RIGHTS_DESC"
				rows="2"
				cols="30"
				filter="string"
			/>

			<field
				name="hits"
				type="number"
				label="JGLOBAL_HITS"
				description="COM_NEWSFEEDS_HITS_DESC"
				class="readonly"
				size="6"
				readonly="true"
				filter="unset"
			/>
		</fieldset>
	</fields>
</form>
models/newsfeeds.php000064400000023050151165734770010543 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
 * Methods supporting a list of newsfeed records.
 *
 * @since  1.6
 */
class NewsfeedsModelNewsfeeds extends JModelList
{
	/**
	 * Constructor.
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @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_id',
'category_title',
				'published', 'a.published',
				'access', 'a.access', 'access_level',
				'created', 'a.created',
				'created_by', 'a.created_by',
				'ordering', 'a.ordering',
				'language', 'a.language',
'language_title',
				'publish_up', 'a.publish_up',
				'publish_down', 'a.publish_down',
				'cache_time', 'a.cache_time',
				'numarticles',
				'tag',
				'level', 'c.level',
				'tag',
			);

			$assoc = JLanguageAssociations::isEnabled();

			if ($assoc)
			{
				$config['filter_fields'][] = 'association';
			}
		}

		parent::__construct($config);
	}

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field.
	 * @param   string  $direction  An optional direction (asc|desc).
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function populateState($ordering = 'a.name',
$direction = 'asc')
	{
		$app = JFactory::getApplication();

		$forcedLanguage = $app->input->get('forcedLanguage',
'', 'cmd');

		// Adjust the context to support modal layouts.
		if ($layout = $app->input->get('layout'))
		{
			$this->context .= '.' . $layout;
		}

		// Adjust the context to support forced languages.
		if ($forcedLanguage)
		{
			$this->context .= '.' . $forcedLanguage;
		}

		// Load the filter state.
		$this->setState('filter.search',
$this->getUserStateFromRequest($this->context .
'.filter.search', 'filter_search', '',
'string'));
		$this->setState('filter.published',
$this->getUserStateFromRequest($this->context .
'.filter.published', 'filter_published', '',
'string'));
		$this->setState('filter.category_id',
$this->getUserStateFromRequest($this->context .
'.filter.category_id', 'filter_category_id',
'', 'cmd'));
		$this->setState('filter.access',
$this->getUserStateFromRequest($this->context .
'.filter.access', 'filter_access', '',
'cmd'));
		$this->setState('filter.language',
$this->getUserStateFromRequest($this->context .
'.filter.language', 'filter_language', '',
'string'));
		$this->setState('filter.tag',
$this->getUserStateFromRequest($this->context .
'.filter.tag', 'filter_tag', '',
'string'));
		$this->setState('filter.level',
$this->getUserStateFromRequest($this->context .
'.filter.level', 'filter_level', null,
'int'));

		// Load the parameters.
		$params = JComponentHelper::getParams('com_newsfeeds');
		$this->setState('params', $params);

		// List state information.
		parent::populateState($ordering, $direction);

		// Force a language.
		if (!empty($forcedLanguage))
		{
			$this->setState('filter.language', $forcedLanguage);
		}
	}

	/**
	 * 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  $id  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.published');
		$id .= ':' .
$this->getState('filter.category_id');
		$id .= ':' . $this->getState('filter.access');
		$id .= ':' . $this->getState('filter.language');
		$id .= ':' . $this->getState('filter.level');
		$id .= ':' .
serialize($this->getState('filter.tag'));

		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();
		$app   = JFactory::getApplication();

		// 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.created_by,' .
				' a.published, a.access, a.ordering, a.language, a.publish_up,
a.publish_down'
			)
		);
		$query->from($db->quoteName('#__newsfeeds',
'a'));

		// Join over the language
		$query->select($db->quoteName('l.title',
'language_title'))
			->select($db->quoteName('l.image',
'language_image'))
			->join('LEFT', $db->quoteName('#__languages',
'l') . ' ON ' . $db->qn('l.lang_code') .
' = ' . $db->qn('a.language'));

		// Join over the users for the checked out user.
		$query->select($db->quoteName('uc.name',
'editor'))
			->join('LEFT', $db->quoteName('#__users',
'uc') . ' ON ' . $db->qn('uc.id') . '
= ' . $db->qn('a.checked_out'));

		// Join over the asset groups.
		$query->select($db->quoteName('ag.title',
'access_level'))
			->join('LEFT', $db->quoteName('#__viewlevels',
'ag') . ' ON ' . $db->qn('ag.id') . '
= ' . $db->qn('a.access'));

		// Join over the categories.
		$query->select($db->quoteName('c.title',
'category_title'))
			->join('LEFT', $db->quoteName('#__categories',
'c') . ' ON ' . $db->qn('c.id') . ' =
' . $db->qn('a.catid'));

		// Join over the associations.
		$assoc = JLanguageAssociations::isEnabled();

		if ($assoc)
		{
			$subQuery = $db->getQuery(true)
				->select('COUNT(' .
$db->quoteName('asso1.id') . ') > 1')
				->from($db->quoteName('#__associations',
'asso1'))
				->join('INNER',
$db->quoteName('#__associations', 'asso2') . '
ON ' . $db->quoteName('asso1.key') . ' = ' .
$db->quoteName('asso2.key'))
				->where(
					array(
						$db->quoteName('asso1.id') . ' = ' .
$db->quoteName('a.id'),
						$db->quoteName('asso1.context') . ' = ' .
$db->quote('com_newsfeeds.item'),
					)
				);

			$query->select('(' . $subQuery . ') AS ' .
$db->quoteName('association'));
		}

		// Filter by access level.
		if ($access = $this->getState('filter.access'))
		{
			$query->where($db->quoteName('a.access') . ' =
' . (int) $access);
		}

		// Implement View Level Access
		if (!$user->authorise('core.admin'))
		{
			$query->where($db->quoteName('a.access') . ' IN
(' . implode(',', $user->getAuthorisedViewLevels()) .
')');
		}

		// Filter by published state.
		$published = $this->getState('filter.published');

		if (is_numeric($published))
		{
			$query->where($db->quoteName('a.published') . ' =
' . (int) $published);
		}
		elseif ($published === '')
		{
			$query->where($db->quoteName('a.published') . ' IN
(0, 1)');
		}

		// Filter by category.
		$categoryId = $this->getState('filter.category_id');

		if (is_numeric($categoryId))
		{
			$query->where($db->quoteName('a.catid') . ' =
' . (int) $categoryId);
		}

		// Filter on the level.
		if ($level = $this->getState('filter.level'))
		{
			$query->where($db->quoteName('c.level') . ' <=
' . (int) $level);
		}

		// Filter by search in title
		$search = $this->getState('filter.search');

		if (!empty($search))
		{
			if (stripos($search, 'id:') === 0)
			{
				$query->where($db->quoteName('a.id') . ' = '
. (int) substr($search, 3));
			}
			else
			{
				$search = $db->quote('%' . str_replace(' ',
'%', $db->escape(trim($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($db->quoteName('a.language') . ' =
' . $db->quote($language));
		}

		// Filter by a single or group of tags.
		$tag = $this->getState('filter.tag');

		// Run simplified query when filtering by one tag.
		if (\is_array($tag) && \count($tag) === 1)
		{
			$tag = $tag[0];
		}

		if ($tag && \is_array($tag))
		{
			$tag = ArrayHelper::toInteger($tag);

			$subQuery = $db->getQuery(true)
				->select('DISTINCT ' .
$db->quoteName('content_item_id'))
				->from($db->quoteName('#__contentitem_tag_map'))
				->where(
					array(
						$db->quoteName('tag_id') . ' IN (' .
implode(',', $tag) . ')',
						$db->quoteName('type_alias') . ' = ' .
$db->quote('com_newsfeeds.newsfeed'),
					)
				);

			$query->join(
				'INNER',
				'(' . $subQuery . ') AS ' .
$db->quoteName('tagmap')
					. ' ON ' .
$db->quoteName('tagmap.content_item_id') . ' = ' .
$db->quoteName('a.id')
			);
		}
		elseif ($tag = (int) $tag)
		{
			$query->join(
				'INNER',
				$db->quoteName('#__contentitem_tag_map',
'tagmap')
				. ' ON ' .
$db->quoteName('tagmap.content_item_id') . ' = ' .
$db->quoteName('a.id')
			)
				->where(
					array(
						$db->quoteName('tagmap.tag_id') . ' = ' .
$tag,
						$db->quoteName('tagmap.type_alias') . ' = ' .
$db->quote('com_newsfeeds.newsfeed'),
					)
				);
		}

		// Add the list ordering clause.
		$orderCol  = $this->state->get('list.ordering',
'a.name');
		$orderDirn = $this->state->get('list.direction',
'ASC');

		if ($orderCol == 'a.ordering' || $orderCol ==
'category_title')
		{
			$orderCol = 'c.title ' . $orderDirn . ',
a.ordering';
		}

		$query->order($db->escape($orderCol . ' ' . $orderDirn));

		return $query;
	}
}
newsfeeds.xml000064400000004337151165734770007300 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1"
method="upgrade">
	<name>com_newsfeeds</name>
	<author>Joomla! Project</author>
	<creationDate>April 2006</creationDate>
	<copyright>(C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
	<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
	<authorEmail>admin@joomla.org</authorEmail>
	<authorUrl>www.joomla.org</authorUrl>
	<version>3.0.0</version>
	<description>COM_NEWSFEEDS_XML_DESCRIPTION</description>
	<install> <!-- Runs on install -->
		<sql>
			<file driver="mysql"
charset="utf8">sql/install.mysql.utf8.sql</file>
		</sql>
	</install>
	<uninstall> <!-- Runs on uninstall -->
		<sql>
			<file driver="mysql"
charset="utf8">sql/uninstall.mysql.utf8.sql</file>
		</sql>
	</uninstall>

	<files folder="site">
		<filename>controller.php</filename>
		<filename>metadata.xml</filename>
		<filename>newsfeeds.php</filename>
		<filename>router.php</filename>
		<folder>helpers</folder>
		<folder>models</folder>
		<folder>views</folder>
	</files>
	<languages folder="site">
		<language
tag="en-GB">language/en-GB.com_newsfeeds.ini</language>
	</languages>
	<administration>
		<menu img="class:newsfeeds">com_newsfeeds</menu>
		<submenu>
			<!--
				Note that all & must be escaped to &amp; for the file to be
valid
				XML and be parsed by the installer
			-->
			<menu link="option=com_newsfeeds" view="feeds"
img="class:newsfeeds"
				alt="Newsfeeds/Feeds">com_newsfeeds_feeds</menu>
			<menu
link="option=com_categories&amp;extension=com_newsfeeds"
				view="categories" img="class:newsfeeds-cat"
alt="Newsfeeds/Categories">com_newsfeeds_categories</menu>
		</submenu>
		<files folder="admin">
			<filename>access.xml</filename>
			<filename>config.xml</filename>
			<filename>controller.php</filename>
			<filename>newsfeeds.php</filename>
			<folder>controllers</folder>
			<folder>elements</folder>
			<folder>helpers</folder>
			<folder>models</folder>
			<folder>tables</folder>
			<folder>views</folder>
		</files>
		<languages folder="admin">
			<language
tag="en-GB">language/en-GB.com_newsfeeds.ini</language>
			<language
tag="en-GB">language/en-GB.com_newsfeeds.sys.ini</language>
		</languages>
	</administration>
</extension>
sql/install.mysql.utf8.sql000064400000003574151165734770011614 0ustar00--
-- Table structure for table `#__newsfeeds`
--

CREATE TABLE IF NOT EXISTS `#__newsfeeds` (
  `catid` int(11) NOT NULL DEFAULT 0,
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '',
  `alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
DEFAULT '',
  `link` varchar(2048) NOT NULL DEFAULT '',
  `published` tinyint(1) NOT NULL DEFAULT 0,
  `numarticles` int(10) unsigned NOT NULL DEFAULT 1,
  `cache_time` int(10) unsigned NOT NULL DEFAULT 3600,
  `checked_out` int(10) unsigned NOT NULL DEFAULT 0,
  `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00
00:00:00',
  `ordering` int(11) NOT NULL DEFAULT 0,
  `rtl` tinyint(4) NOT NULL DEFAULT 0,
  `access` int(10) unsigned NOT NULL DEFAULT 0,
  `language` char(7) NOT NULL DEFAULT '',
  `params` text NOT NULL,
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created_by` int(10) unsigned NOT NULL DEFAULT 0,
  `created_by_alias` varchar(255) NOT NULL DEFAULT '',
  `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified_by` int(10) unsigned NOT NULL DEFAULT 0,
  `metakey` text NOT NULL,
  `metadesc` text NOT NULL,
  `metadata` text NOT NULL,
  `xreference` varchar(50) NOT NULL COMMENT 'A reference to enable
linkages to external data sets.',
  `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `description` text NOT NULL,
  `version` int(10) unsigned NOT NULL DEFAULT 1,
  `hits` int(10) unsigned NOT NULL DEFAULT 0,
  `images` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_access` (`access`),
  KEY `idx_checkout` (`checked_out`),
  KEY `idx_state` (`published`),
  KEY `idx_catid` (`catid`),
  KEY `idx_createdby` (`created_by`),
  KEY `idx_language` (`language`),
  KEY `idx_xreference` (`xreference`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
sql/uninstall.mysql.utf8.sql000064400000000046151165734770012146
0ustar00DROP TABLE IF EXISTS `#__newsfeeds`;

tables/newsfeed.php000064400000007754151165734770010364 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\String\StringHelper;

/**
 * Newsfeed Table class.
 *
 * @since  1.6
 */
class NewsfeedsTableNewsfeed extends JTable
{
	/**
	 * Ensure the params, metadata and images are json encoded in the bind
method
	 *
	 * @var    array
	 * @since  3.3
	 */
	protected $_jsonEncode = array('params', 'metadata',
'images');

	/**
	 * Constructor
	 *
	 * @param   JDatabaseDriver  &$db  A database connector object
	 */
	public function __construct(&$db)
	{
		parent::__construct('#__newsfeeds', 'id', $db);

		$this->setColumnAlias('title', 'name');

		JTableObserverTags::createObserver($this, array('typeAlias'
=> 'com_newsfeeds.newsfeed'));
		JTableObserverContenthistory::createObserver($this,
array('typeAlias' => 'com_newsfeeds.newsfeed'));
	}

	/**
	 * Overloaded check method to ensure data integrity.
	 *
	 * @return  boolean  True on success.
	 */
	public function check()
	{
		// Check for valid name.
		if (trim($this->name) == '')
		{
			$this->setError(JText::_('COM_NEWSFEEDS_WARNING_PROVIDE_VALID_NAME'));

			return false;
		}

		if (empty($this->alias))
		{
			$this->alias = $this->name;
		}

		$this->alias = JApplicationHelper::stringURLSafe($this->alias,
$this->language);

		if (trim(str_replace('-', '', $this->alias)) ==
'')
		{
			$this->alias =
JFactory::getDate()->format('Y-m-d-H-i-s');
		}

		// Check the publish down date is not earlier than publish up.
		if ((int) $this->publish_down > 0 && $this->publish_down
< $this->publish_up)
		{
			$this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));

			return false;
		}

		// Clean up keywords -- eliminate extra spaces between phrases
		// and cr (\r) and lf (\n) characters from string if not empty
		if (!empty($this->metakey))
		{
			// Array of characters to remove
			$bad_characters = array("\n", "\r",
"\"", '<', '>');

			// Remove bad characters
			$after_clean = StringHelper::str_ireplace($bad_characters, '',
$this->metakey);

			// Create array using commas as delimiter
			$keys = explode(',', $after_clean);
			$clean_keys = array();

			foreach ($keys as $key)
			{
				if (trim($key))
				{
					// Ignore blank keywords
					$clean_keys[] = trim($key);
				}
			}

			// Put array back together delimited by ", "
			$this->metakey = implode(', ', $clean_keys);
		}

		// Clean up description -- eliminate quotes and <> brackets
		if (!empty($this->metadesc))
		{
			// Only process if not empty
			$bad_characters = array("\"", '<',
'>');
			$this->metadesc = StringHelper::str_ireplace($bad_characters,
'', $this->metadesc);
		}

		return true;
	}

	/**
	 * Overriden JTable::store to set modified data.
	 *
	 * @param   boolean  $updateNulls  True to update fields even if they are
null.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   1.6
	 */
	public function store($updateNulls = false)
	{
		$date = JFactory::getDate();
		$user = JFactory::getUser();

		$this->modified = $date->toSql();

		if ($this->id)
		{
			// Existing item
			$this->modified_by = $user->get('id');
		}
		else
		{
			// New newsfeed. A feed created and created_by field can be set by the
user,
			// so we don't touch either of these if they are set.
			if (!(int) $this->created)
			{
				$this->created = $date->toSql();
			}

			if (empty($this->created_by))
			{
				$this->created_by = $user->get('id');
			}
		}

		// Verify that the alias is unique
		$table = JTable::getInstance('Newsfeed',
'NewsfeedsTable', array('dbo' => $this->_db));

		if ($table->load(array('alias' => $this->alias,
'catid' => $this->catid)) && ($table->id !=
$this->id || $this->id == 0))
		{
			$this->setError(JText::_('COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS'));

			return false;
		}

		// Save links as punycode.
		$this->link = JStringPunycode::urlToPunycode($this->link);

		return parent::store($updateNulls);
	}
}
views/newsfeed/tmpl/edit.php000064400000010520151165734770012131
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', '#jform_catid', null,
array('disable_search_threshold' => 0 ));
JHtml::_('formbehavior.chosen', '#jform_tags', null,
array('placeholder_text_multiple' =>
JText::_('JGLOBAL_TYPE_OR_SELECT_SOME_TAGS')));
JHtml::_('formbehavior.chosen', 'select');

$app   = JFactory::getApplication();
$input = $app->input;

$assoc = JLanguageAssociations::isEnabled();

JFactory::getDocument()->addScriptDeclaration('
	Joomla.submitbutton = function(task)
	{
		if (task == "newsfeed.cancel" ||
document.formvalidator.isValid(document.getElementById("newsfeed-form")))
{
			Joomla.submitform(task,
document.getElementById("newsfeed-form"));

			// @deprecated 4.0  The following js is not needed since 3.7.0.
			if (task !== "newsfeed.apply")
			{
				window.parent.jQuery("#newsfeedEdit' . $this->item->id
. 'Modal").modal("hide");
			}
		}
	};
');

// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
$this->ignore_fieldsets = array('images', 'jbasic',
'jmetadata', 'item_associations');

// In case of modal
$isModal = $input->get('layout') == 'modal' ? true :
false;
$layout  = $isModal ? 'modal' : 'edit';
$tmpl    = $isModal || $input->get('tmpl', '',
'cmd') === 'component' ?
'&tmpl=component' : '';
?>

<form action="<?php echo
JRoute::_('index.php?option=com_newsfeeds&layout=' . $layout
. $tmpl . '&id=' . (int) $this->item->id); ?>"
method="post" name="adminForm"
id="newsfeed-form" class="form-validate">

	<?php echo JLayoutHelper::render('joomla.edit.title_alias',
$this); ?>

	<div class="form-horizontal">
		<?php echo JHtml::_('bootstrap.startTabSet',
'myTab', array('active' => 'details'));
?>

		<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'details', empty($this->item->id) ?
JText::_('COM_NEWSFEEDS_NEW_NEWSFEED') :
JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED')); ?>
		<div class="row-fluid">
			<div class="span9">
				<div class="form-vertical">
					<?php echo $this->form->renderField('link'); ?>
					<?php echo $this->form->renderField('description');
?>
				</div>
			</div>
			<div class="span3">
				<?php echo JLayoutHelper::render('joomla.edit.global',
$this); ?>
			</div>
		</div>
		<?php echo JHtml::_('bootstrap.endTab'); ?>

		<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'images', JText::_('JGLOBAL_FIELDSET_IMAGE_OPTIONS'));
?>
		<div class="row-fluid">
			<div class="span6">
					<?php echo $this->form->renderField('images');
?>
					<?php foreach ($this->form->getGroup('images') as
$field) : ?>
						<?php echo $field->renderField(); ?>
					<?php endforeach; ?>
				</div>
			</div>
		<?php echo JHtml::_('bootstrap.endTab'); ?>

		<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'attrib-jbasic',
JText::_('JGLOBAL_FIELDSET_DISPLAY_OPTIONS')); ?>
		<?php echo $this->loadTemplate('display'); ?>
		<?php echo JHtml::_('bootstrap.endTab'); ?>

		<?php echo JLayoutHelper::render('joomla.edit.params',
$this); ?>

		<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING'));
?>
		<div class="row-fluid form-horizontal-desktop">
			<div class="span6">
				<?php echo
JLayoutHelper::render('joomla.edit.publishingdata', $this); ?>
			</div>
			<div class="span6">
				<?php echo JLayoutHelper::render('joomla.edit.metadata',
$this); ?>
			</div>
		</div>
		<?php echo JHtml::_('bootstrap.endTab'); ?>

		<?php if ( ! $isModal && $assoc) : ?>
			<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'associations',
JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?>
			<?php echo $this->loadTemplate('associations'); ?>
			<?php echo JHtml::_('bootstrap.endTab'); ?>
		<?php elseif ($isModal && $assoc) : ?>
			<div class="hidden"><?php echo
$this->loadTemplate('associations'); ?></div>
		<?php endif; ?>

		<?php echo JHtml::_('bootstrap.endTabSet'); ?>
	</div>
	<input type="hidden" name="task" value=""
/>
	<input type="hidden" name="forcedLanguage"
value="<?php echo $input->get('forcedLanguage',
'', 'cmd'); ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>
views/newsfeed/tmpl/edit_associations.php000064400000000527151165734770014716
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

echo JLayoutHelper::render('joomla.edit.associations', $this);
views/newsfeed/tmpl/edit_display.php000064400000000557151165734770013667
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->fieldset = 'jbasic';
echo JLayoutHelper::render('joomla.edit.fieldset', $this);
views/newsfeed/tmpl/edit_metadata.php000064400000000523151165734770013773
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

echo JLayoutHelper::render('joomla.edit.metadata', $this);
views/newsfeed/tmpl/edit_params.php000064400000001630151165734770013476
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
	?>
	<div class="tab-pane" id="params-<?php echo $name;
?>">
	<?php if (isset($fieldSet->description) &&
trim($fieldSet->description)) : ?>
		<p class="alert alert-info"><?php echo
$this->escape(JText::_($fieldSet->description)); ?></p>
	<?php endif; ?>
			<?php foreach ($this->form->getFieldset($name) as $field) :
?>
				<div class="control-group">
					<div class="control-label"><?php echo
$field->label; ?></div>
					<div class="controls"><?php echo $field->input;
?></div>
				</div>
			<?php endforeach; ?>
	</div>
<?php endforeach; ?>
views/newsfeed/tmpl/modal.php000064400000002570151165734770012306
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'bottom'));

// @deprecated 4.0 the function parameter, the inline js and the buttons
are not needed since 3.7.0.
$function  =
JFactory::getApplication()->input->getCmd('function',
'jEditNewsfeed_' . (int) $this->item->id);

// Function to update input title when changed
JFactory::getDocument()->addScriptDeclaration('
	function jEditNewsfeedModal() {
		if (window.parent &&
document.formvalidator.isValid(document.getElementById("newsfeed-form")))
{
			return window.parent.' . $this->escape($function) .
'(document.getElementById("jform_name").value);
		}
	}
');
?>
<button id="applyBtn" type="button"
class="hidden"
onclick="Joomla.submitbutton('newsfeed.apply');
jEditNewsfeedModal();"></button>
<button id="saveBtn" type="button"
class="hidden"
onclick="Joomla.submitbutton('newsfeed.save');
jEditNewsfeedModal();"></button>
<button id="closeBtn" type="button"
class="hidden"
onclick="Joomla.submitbutton('newsfeed.cancel');"></button>

<div class="container-popup">
	<?php $this->setLayout('edit'); ?>
	<?php echo $this->loadTemplate(); ?>
</div>
views/newsfeed/tmpl/modal_associations.php000064400000000527151165734770015065
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

echo JLayoutHelper::render('joomla.edit.associations', $this);
views/newsfeed/tmpl/modal_display.php000064400000000557151165734770014036
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->fieldset = 'jbasic';
echo JLayoutHelper::render('joomla.edit.fieldset', $this);
views/newsfeed/tmpl/modal_metadata.php000064400000000523151165734770014142
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

echo JLayoutHelper::render('joomla.edit.metadata', $this);
views/newsfeed/tmpl/modal_params.php000064400000001630151165734770013645
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
	?>
	<div class="tab-pane" id="params-<?php echo $name;
?>">
	<?php if (isset($fieldSet->description) &&
trim($fieldSet->description)) : ?>
		<p class="alert alert-info"><?php echo
$this->escape(JText::_($fieldSet->description)); ?></p>
	<?php endif; ?>
			<?php foreach ($this->form->getFieldset($name) as $field) :
?>
				<div class="control-group">
					<div class="control-label"><?php echo
$field->label; ?></div>
					<div class="controls"><?php echo $field->input;
?></div>
				</div>
			<?php endforeach; ?>
	</div>
<?php endforeach; ?>
views/newsfeeds/tmpl/default.php000064400000020120151165734770013010
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$user      = JFactory::getUser();
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn  =
$this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
$assoc     = JLanguageAssociations::isEnabled();

if ($saveOrder)
{
	$saveOrderingUrl =
'index.php?option=com_newsfeeds&task=newsfeeds.saveOrderAjax&tmpl=component';
	JHtml::_('sortablelist.sortable', 'newsfeedList',
'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
?>
<form action="<?php echo
JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds');
?>" method="post" name="adminForm"
id="adminForm">
	<?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
	<?php else : ?>
	<div id="j-main-container">
	<?php endif; ?>
		<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>
		<div class="clearfix"></div>
		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="table table-striped"
id="newsfeedList">
				<thead>
					<tr>
						<th width="1%" class="nowrap center
hidden-phone">
							<?php echo JHtml::_('searchtools.sort', '',
'a.ordering', $listDirn, $listOrder, null, 'asc',
'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
						</th>
						<th width="1%">
							<?php echo JHtml::_('grid.checkall'); ?>
						</th>
						<th width="5%" class="nowrap center">
							<?php echo JHtml::_('searchtools.sort',
'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
						</th>
						<th class="title">
							<?php echo JHtml::_('searchtools.sort',
'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder);
?>
						</th>
						<th width="5%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ACCESS', 'access_level', $listDirn,
$listOrder); ?>
						</th>
						<th width="10%" class="nowrap
hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'COM_NEWSFEEDS_NUM_ARTICLES_HEADING', 'numarticles',
$listDirn, $listOrder); ?>
						</th>
						<th width="5%" class="nowrap hidden-phone
hidden-tablet">
							<?php echo JHtml::_('searchtools.sort',
'COM_NEWSFEEDS_CACHE_TIME_HEADING', 'a.cache_time',
$listDirn, $listOrder); ?>
						</th>
						<?php if ($assoc) : ?>
						<th width="5%" class="nowrap hidden-phone
hidden-tablet">
							<?php echo JHtml::_('searchtools.sort',
'COM_NEWSFEEDS_HEADING_ASSOCIATION', 'association',
$listDirn, $listOrder); ?>
						</th>
						<?php endif; ?>
						<th width="10%" class="nowrap
hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn,
$listOrder); ?>
						</th>
						<th width="1%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder);
?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="11">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
				<?php foreach ($this->items as $i => $item) :
					$ordering   = ($listOrder == 'a.ordering');
					$canCreate  = $user->authorise('core.create',    
'com_newsfeeds.category.' . $item->catid);
					$canEdit    = $user->authorise('core.edit',      
'com_newsfeeds.category.' . $item->catid);
					$canCheckin = $user->authorise('core.manage',    
'com_checkin') || $item->checked_out ==
$user->get('id') || $item->checked_out == 0;
					$canEditOwn = $user->authorise('core.edit.own',  
'com_newsfeeds.category.' . $item->catid) &&
$item->created_by == $user->id;
					$canChange  = $user->authorise('core.edit.state',
'com_newsfeeds.category.' . $item->catid) &&
$canCheckin;
					?>
					<tr class="row<?php echo $i % 2; ?>"
sortable-group-id="<?php echo $item->catid; ?>">
						<td class="order nowrap center hidden-phone">
							<?php
							$iconClass = '';
							if (!$canChange)
							{
								$iconClass = ' inactive';
							}
							elseif (!$saveOrder)
							{
								$iconClass = ' inactive tip-top hasTooltip"
title="' . JHtml::_('tooltipText',
'JORDERINGDISABLED');
							}
							?>
							<span class="sortable-handler<?php echo $iconClass
?>">
								<span class="icon-menu"
aria-hidden="true"></span>
							</span>
							<?php if ($canChange && $saveOrder) : ?>
								<input type="text" style="display:none"
name="order[]" size="5" value="<?php echo
$item->ordering; ?>" class="width-20 text-area-order"
/>
							<?php endif; ?>
						</td>
						<td class="center">
							<?php echo JHtml::_('grid.id', $i, $item->id); ?>
						</td>
						<td class="center">
							<div class="btn-group">
								<?php echo JHtml::_('jgrid.published',
$item->published, $i, 'newsfeeds.', $canChange,
'cb', $item->publish_up, $item->publish_down); ?>
								<?php // Create dropdown items and render the dropdown list.
								if ($canChange)
								{
									JHtml::_('actionsdropdown.' . ((int) $item->published
=== 2 ? 'un' : '') . 'archive',
'cb' . $i, 'newsfeeds');
									JHtml::_('actionsdropdown.' . ((int) $item->published
=== -2 ? 'un' : '') . 'trash', 'cb'
. $i, 'newsfeeds');
									echo JHtml::_('actionsdropdown.render',
$this->escape($item->name));
								}
								?>
							</div>
						</td>
						<td class="nowrap has-context">
							<div class="pull-left">
								<?php if ($item->checked_out) : ?>
									<?php echo JHtml::_('jgrid.checkedout', $i,
$item->editor, $item->checked_out_time, 'newsfeeds.',
$canCheckin); ?>
								<?php endif; ?>
								<?php if ($canEdit || $canEditOwn) : ?>
									<a href="<?php echo
JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id='
. (int) $item->id); ?>">
										<?php echo $this->escape($item->name); ?></a>
								<?php else : ?>
										<?php echo $this->escape($item->name); ?>
								<?php endif; ?>
								<span class="small">
									<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS',
$this->escape($item->alias)); ?>
								</span>
								<div class="small">
									<?php echo JText::_('JCATEGORY') . ': ' .
$this->escape($item->category_title); ?>
								</div>
							</div>
						</td>
						<td class="small hidden-phone">
							<?php echo $this->escape($item->access_level); ?>
						</td>
						<td class="hidden-phone">
							<?php echo (int) $item->numarticles; ?>
						</td>
						<td class="hidden-phone hidden-tablet">
							<?php echo (int) $item->cache_time; ?>
						</td>
						<?php if ($assoc) : ?>
						<td class="hidden-phone hidden-tablet">
							<?php if ($item->association) : ?>
								<?php echo JHtml::_('newsfeed.association',
$item->id); ?>
							<?php endif; ?>
						</td>
						<?php endif; ?>
						<td class="small hidden-phone">
							<?php echo
JLayoutHelper::render('joomla.content.language', $item); ?>
						</td>
						<td class="hidden-phone">
							<?php echo (int) $item->id; ?>
						</td>
					</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
			<?php // Load the batch processing form if user is allowed ?>
			<?php if ($user->authorise('core.create',
'com_newsfeeds')
				&& $user->authorise('core.edit',
'com_newsfeeds')
				&& $user->authorise('core.edit.state',
'com_newsfeeds')) : ?>
				<?php echo JHtml::_(
					'bootstrap.renderModal',
					'collapseModal',
					array(
						'title'  =>
JText::_('COM_NEWSFEEDS_BATCH_OPTIONS'),
						'footer' =>
$this->loadTemplate('batch_footer'),
					),
					$this->loadTemplate('batch_body')
				); ?>
			<?php endif; ?>
		<?php endif; ?>
		<input type="hidden" name="task"
value="" />
		<input type="hidden" name="boxchecked"
value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
views/newsfeeds/tmpl/default_batch_body.php000064400000001766151165734770015205
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */
defined('_JEXEC') or die;
$published = (int) $this->state->get('filter.published');
?>

<div class="container-fluid">
	<div class="row-fluid">
		<div class="control-group span6">
			<div class="controls">
				<?php echo JHtml::_('batch.language'); ?>
			</div>
		</div>
		<div class="control-group span6">
			<div class="controls">
				<?php echo JHtml::_('batch.access'); ?>
			</div>
		</div>
	</div>
	<div class="row-fluid">
		<?php if ($published >= 0) : ?>
			<div class="control-group span6">
				<div class="controls">
					<?php echo JHtml::_('batch.item',
'com_newsfeeds'); ?>
				</div>
			</div>
		<?php endif; ?>
		<div class="control-group span6">
			<div class="controls">
				<?php echo JHtml::_('batch.tag'); ?>
			</div>
		</div>
	</div>
</div>
views/newsfeeds/tmpl/default_batch_footer.php000064400000001401151165734770015530
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */
defined('_JEXEC') or die;

?>
<button type="button" class="btn"
onclick="document.getElementById('batch-category-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value='';document.getElementById('batch-tag-id').value=''"
data-dismiss="modal">
	<?php echo JText::_('JCANCEL'); ?>
</button>
<button type="submit" class="btn btn-success"
onclick="Joomla.submitbutton('newsfeed.batch');return
false;">
	<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
views/newsfeeds/tmpl/modal.php000064400000011364151165734770012472
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('NewsfeedsHelperRoute', JPATH_ROOT .
'/components/com_newsfeeds/helpers/route.php');

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

JHtml::_('behavior.core');
JHtml::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'bottom'));
JHtml::_('bootstrap.popover', '.hasPopover',
array('placement' => 'bottom'));
JHtml::_('formbehavior.chosen', 'select');

// Special case for the search field tooltip.
$searchFilterDesc =
$this->filterForm->getFieldAttribute('search',
'description', null, 'filter');
JHtml::_('bootstrap.tooltip', '#filter_search',
array('title' => JText::_($searchFilterDesc),
'placement' => 'bottom'));

$app = JFactory::getApplication();

$function  = $app->input->getCmd('function',
'jSelectNewsfeed');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn  =
$this->escape($this->state->get('list.direction'));
?>
<div class="container-popup">

	<form action="<?php echo
JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds&layout=modal&tmpl=component&function='
. $function); ?>" method="post"
name="adminForm" id="adminForm"
class="form-inline">

		<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>

		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="table table-striped table-condensed">
				<thead>
					<tr>
						<th width="1%" class="nowrap center">
							<?php echo JHtml::_('searchtools.sort',
'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
						</th>
						<th class="nowrap title">
							<?php echo JHtml::_('searchtools.sort',
'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder);
?>
						</th>
						<th width="15%" class="nowrap
hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ACCESS', 'access_level', $listDirn,
$listOrder); ?>
						</th>
						<th width="15%" class="nowrap
hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn,
$listOrder); ?>
						</th>
						<th width="1%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder);
?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="5">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
				<?php
				$iconStates = array(
					-2 => 'icon-trash',
					0  => 'icon-unpublish',
					1  => 'icon-publish',
					2  => 'icon-archive',
				);
				?>
				<?php foreach ($this->items as $i => $item) : ?>
					<?php if ($item->language &&
JLanguageMultilang::isEnabled())
					{
						$tag = strlen($item->language);
						if ($tag == 5)
						{
							$lang = substr($item->language, 0, 2);
						}
						elseif ($tag == 6)
						{
							$lang = substr($item->language, 0, 3);
						}
						else {
							$lang = '';
						}
					}
					elseif (!JLanguageMultilang::isEnabled())
					{
						$lang = '';
					}
					?>
					<tr class="row<?php echo $i % 2; ?>">
						<td class="center">
							<span class="<?php echo
$iconStates[$this->escape($item->published)]; ?>"
aria-hidden="true"></span>
						</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>
						<td class="small hidden-phone">
							<?php echo $this->escape($item->access_level); ?>
						</td>
						<td class="small hidden-phone">
							<?php echo
JLayoutHelper::render('joomla.content.language', $item); ?>
						</td>
						<td class="hidden-phone">
							<?php echo (int) $item->id; ?>
						</td>
					</tr>
				<?php endforeach; ?>
				</tbody>
			</table>
		<?php endif; ?>

		<input type="hidden" name="task"
value="" />
		<input type="hidden" name="boxchecked"
value="0" />
		<input type="hidden" name="forcedLanguage"
value="<?php echo
$app->input->get('forcedLanguage', '',
'CMD'); ?>" />
		<?php echo JHtml::_('form.token'); ?>

	</form>
</div>
views/newsfeeds/view.html.php000064400000012670151165734770012340
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View class for a list of newsfeeds.
 *
 * @since  1.6
 */
class NewsfeedsViewNewsfeeds extends JViewLegacy
{
	/**
	 * The list of newsfeeds
	 *
	 * @var    JObject
	 * @since  1.6
	 */
	protected $items;

	/**
	 * The pagination object
	 *
	 * @var    JPagination
	 * @since  1.6
	 */
	protected $pagination;

	/**
	 * The model state
	 *
	 * @var    JObject
	 * @since  1.6
	 */
	protected $state;

	/**
	 * Execute and display a template script.
	 *
	 * @param   string  $tpl  The name of the template file to parse;
automatically searches through the template paths.
	 *
	 * @return  mixed  A string if successful, otherwise an Error object.
	 *
	 * @since   1.6
	 */
	public function display($tpl = null)
	{
		$this->items         = $this->get('Items');
		$this->pagination    = $this->get('Pagination');
		$this->state         = $this->get('State');
		$this->filterForm    = $this->get('FilterForm');
		$this->activeFilters = $this->get('ActiveFilters');

		// Modal layout doesn't need the submenu.
		if ($this->getLayout() !== 'modal')
		{
			NewsfeedsHelper::addSubmenu('newsfeeds');
		}

		// Check for errors.
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		// We don't need toolbar in the modal layout.
		if ($this->getLayout() !== 'modal')
		{
			$this->addToolbar();
			$this->sidebar = JHtmlSidebar::render();
		}
		else
		{
			// In article associations modal we need to remove language filter if
forcing a language.
			// We also need to change the category filter to show show categories
with All or the forced language.
			if ($forcedLanguage =
JFactory::getApplication()->input->get('forcedLanguage',
'', 'CMD'))
			{
				// If the language is forced we can't allow to select the
language, so transform the language selector filter into a hidden field.
				$languageXml = new SimpleXMLElement('<field
name="language" type="hidden" default="' .
$forcedLanguage . '" />');
				$this->filterForm->setField($languageXml, 'filter',
true);

				// Also, unset the active language filter so the search tools is not
open by default with this filter.
				unset($this->activeFilters['language']);

				// One last changes needed is to change the category filter to just
show categories with All language or with the forced language.
				$this->filterForm->setFieldAttribute('category_id',
'language', '*,' . $forcedLanguage,
'filter');
			}
		}

		parent::display($tpl);
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function addToolbar()
	{
		$state = $this->get('State');
		$canDo = JHelperContent::getActions('com_newsfeeds',
'category', $state->get('filter.category_id'));
		$user  = JFactory::getUser();

		// Get the toolbar object instance
		$bar = JToolbar::getInstance('toolbar');
		JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'),
'feed newsfeeds');

		if (count($user->getAuthorisedCategories('com_newsfeeds',
'core.create')) > 0)
		{
			JToolbarHelper::addNew('newsfeed.add');
		}

		if ($canDo->get('core.edit') ||
$canDo->get('core.edit.own'))
		{
			JToolbarHelper::editList('newsfeed.edit');
		}

		if ($canDo->get('core.edit.state'))
		{
			JToolbarHelper::publish('newsfeeds.publish',
'JTOOLBAR_PUBLISH', true);
			JToolbarHelper::unpublish('newsfeeds.unpublish',
'JTOOLBAR_UNPUBLISH', true);
			JToolbarHelper::archiveList('newsfeeds.archive');
		}

		if ($canDo->get('core.admin'))
		{
			JToolbarHelper::checkin('newsfeeds.checkin');
		}

		// Add a batch button
		if ($user->authorise('core.create',
'com_newsfeeds')
			&& $user->authorise('core.edit',
'com_newsfeeds')
			&& $user->authorise('core.edit.state',
'com_newsfeeds'))
		{
			$title = JText::_('JTOOLBAR_BATCH');

			// Instantiate a new JLayoutFile instance and render the batch button
			$layout = new JLayoutFile('joomla.toolbar.batch');

			$dhtml = $layout->render(array('title' => $title));
			$bar->appendButton('Custom', $dhtml, 'batch');
		}

		if ($state->get('filter.published') == -2 &&
$canDo->get('core.delete'))
		{
			JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE',
'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
		}
		elseif ($canDo->get('core.edit.state'))
		{
			JToolbarHelper::trash('newsfeeds.trash');
		}

		if ($user->authorise('core.admin',
'com_newsfeeds') || $user->authorise('core.options',
'com_newsfeeds'))
		{
			JToolbarHelper::preferences('com_newsfeeds');
		}

		JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
	}

	/**
	 * Returns an array of fields the table can be sorted by
	 *
	 * @return  array  Array containing the field name to sort by as the key
and display text as value
	 *
	 * @since   3.0
	 */
	protected function getSortFields()
	{
		return array(
			'a.ordering'     =>
JText::_('JGRID_HEADING_ORDERING'),
			'a.published'    => JText::_('JSTATUS'),
			'a.name'         => JText::_('JGLOBAL_TITLE'),
			'category_title' => JText::_('JCATEGORY'),
			'a.access'       =>
JText::_('JGRID_HEADING_ACCESS'),
			'numarticles'    =>
JText::_('COM_NEWSFEEDS_NUM_ARTICLES_HEADING'),
			'a.cache_time'   =>
JText::_('COM_NEWSFEEDS_CACHE_TIME_HEADING'),
			'a.language'     =>
JText::_('JGRID_HEADING_LANGUAGE'),
			'a.id'           => JText::_('JGRID_HEADING_ID')
		);
	}
}