2016-12-28 16:50:29 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Administrator
|
|
|
|
* @subpackage Weblinks
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
defined('JPATH_BASE') or die;
|
|
|
|
|
|
|
|
use Joomla\Registry\Registry;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* System plugin for Joomla Web Links.
|
|
|
|
*
|
2017-01-01 22:36:14 +00:00
|
|
|
* @since 3.6.0
|
2016-12-28 16:50:29 +00:00
|
|
|
*/
|
|
|
|
class PlgSystemWeblinks extends JPlugin
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Load the language file on instantiation.
|
|
|
|
*
|
|
|
|
* @var boolean
|
2017-01-01 22:36:14 +00:00
|
|
|
* @since 3.6.0
|
2016-12-28 16:50:29 +00:00
|
|
|
*/
|
|
|
|
protected $autoloadLanguage = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to add statistics information to Administrator control panel.
|
|
|
|
*
|
|
|
|
* @param string $extension The extension requesting information.
|
|
|
|
*
|
|
|
|
* @return array containing statistical information.
|
|
|
|
*
|
2017-01-01 22:36:14 +00:00
|
|
|
* @since 3.6.0
|
2016-12-28 16:50:29 +00:00
|
|
|
*/
|
|
|
|
public function onGetStats($extension)
|
|
|
|
{
|
|
|
|
if (!JComponentHelper::isEnabled('com_weblinks'))
|
|
|
|
{
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
$db = JFactory::getDbo();
|
|
|
|
$query = $db->getQuery(true)
|
|
|
|
->select('COUNT(id) AS count_links')
|
|
|
|
->from('#__weblinks')
|
|
|
|
->where('state = 1');
|
|
|
|
$links = $db->setQuery($query)->loadResult();
|
|
|
|
|
|
|
|
if (!$links)
|
|
|
|
{
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
return array(array(
|
2016-12-29 23:48:23 +00:00
|
|
|
'title' => JText::sprintf('PLG_SYSTEM_WEBLINKS_STATISTICS'),
|
2016-12-28 16:50:29 +00:00
|
|
|
'icon' => 'out-2',
|
|
|
|
'data' => $links,
|
2016-12-31 22:15:43 +00:00
|
|
|
'link' => JRoute::_('index.php?option=com_weblinks&view=weblinks&filter[published]=1'),
|
2016-12-28 16:50:29 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|