weblinks/src/plugins/system/weblinks/weblinks.php

78 lines
1.5 KiB
PHP
Raw Normal View History

2016-12-28 16:50:29 +00:00
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
*
2017-03-24 11:51:56 +00:00
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
2016-12-28 16:50:29 +00:00
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
2017-03-24 11:51:56 +00:00
defined('_JEXEC') or die;
2016-12-28 16:50:29 +00:00
/**
* System plugin for Joomla Web Links.
*
2017-03-24 11:51:56 +00:00
* @since __DEPLOY_VERSION__
2016-12-28 16:50:29 +00:00
*/
class PlgSystemWeblinks extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
2017-03-24 11:51:56 +00:00
* @since __DEPLOY_VERSION__
2016-12-28 16:50:29 +00:00
*/
protected $autoloadLanguage = true;
/**
* Supported Extensions
*
* @var array
* @since __DEPLOY_VERSION__
*/
private $supportedExtensions = array(
'mod_stats',
'mod_stats_admin',
);
2016-12-28 16:50:29 +00:00
/**
* Method to add statistics information to Administrator control panel.
*
2019-08-12 23:15:35 +00:00
* @param string $extension The extension requesting information.
2016-12-28 16:50:29 +00:00
*
* @return array containing statistical information.
*
2017-03-24 11:51:56 +00:00
* @since __DEPLOY_VERSION__
2016-12-28 16:50:29 +00:00
*/
public function onGetStats($extension)
{
if (!in_array($extension, $this->supportedExtensions))
{
return array();
}
2016-12-28 16:50:29 +00:00
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');
2017-03-24 11:51:56 +00:00
$webLinks = $db->setQuery($query)->loadResult();
2016-12-28 16:50:29 +00:00
2017-03-24 11:51:56 +00:00
if (!$webLinks)
2016-12-28 16:50:29 +00:00
{
return array();
}
return array(array(
2017-03-24 11:51:56 +00:00
'title' => JText::_('PLG_SYSTEM_WEBLINKS_STATISTICS'),
2016-12-28 16:50:29 +00:00
'icon' => 'out-2',
2017-03-24 11:51:56 +00:00
'data' => $webLinks
2016-12-28 16:50:29 +00:00
));
}
}