Move weblinks stats to weblinks repo

This commit is contained in:
chrisdavenport 2016-12-28 16:50:29 +00:00
parent 3037c4007f
commit 5bbbf6904d
6 changed files with 102 additions and 0 deletions

View File

@ -19,6 +19,7 @@
<file type="module" id="mod_weblinks" client="site">mod_weblinks.zip</file>
<file type="plugin" id="weblinks" group="finder">plg_finder_weblinks.zip</file>
<file type="plugin" id="weblinks" group="search">plg_search_weblinks.zip</file>
<file type="plugin" id="weblinks" group="system">plg_system_weblinks.zip</file>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.pkg_weblinks.sys.ini</language>

View File

@ -19,6 +19,7 @@
<file type="module" id="mod_weblinks" client="site">mod_weblinks.zip</file>
<file type="plugin" id="weblinks" group="finder">plg_finder_weblinks.zip</file>
<file type="plugin" id="weblinks" group="search">plg_search_weblinks.zip</file>
<file type="plugin" id="weblinks" group="system">plg_system_weblinks.zip</file>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.pkg_weblinks.sys.ini</language>

View File

@ -0,0 +1,8 @@
; Joomla! Project
; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
PLG_SYSTEM_WEBLINKS="System - Web Links"
PLG_SYSTEM_WEBLINKS_STATISTICS="<a href="%s">Web Links</a>"
PLG_SYSTEM_WEBLINKS_XML_DESCRIPTION="This plugin returns statistical information about Joomla! Web Links."

View File

@ -0,0 +1,7 @@
; Joomla! Project
; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
PLG_SYSTEM_WEBLINKS="System - Web Links"
PLG_SYSTEM_WEBLINKS_XML_DESCRIPTION="This plugin returns statistical information about Joomla! Web Links."

View File

@ -0,0 +1,66 @@
<?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.
*
* @since __DEPLOY_VERSION__
*/
class PlgSystemWeblinks extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
protected $autoloadLanguage = true;
/**
* Method to add statistics information to Administrator control panel.
*
* @param string $extension The extension requesting information.
*
* @return array containing statistical information.
*
* @since __DEPLOY_VERSION__
*/
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();
}
// Link to web links component page.
$adminLink = JUri::root() . 'administrator/index.php?option=com_weblinks&view=weblinks&filter[published]=1';
return array(array(
'title' => JText::sprintf('PLG_SYSTEM_WEBLINKS_STATISTICS', $adminLink),
'icon' => 'out-2',
'data' => $links,
));
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.5" type="plugin" group="system" method="upgrade">
<name>plg_system_weblinks</name>
<author>Joomla! Project</author>
<creationDate>2016-12-19</creationDate>
<copyright>(C) 2005 - 2016 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.6.0-beta</version>
<description>PLG_SYSTEM_WEBLINKS_XML_DESCRIPTION</description>
<files>
<file>weblinks.xml</file>
<folder>language</folder>
<file plugin="weblinks">weblinks.php</file>
</files>
<languages folder="administrator/language">
</languages>
</extension>