29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-07-02 01:53:42 +00:00

[4.0] Adapting privacycheck quickicon to 4.0 (#24534)

This commit is contained in:
infograf768 2019-04-14 21:38:04 +02:00 committed by George Wilson
parent be00b62977
commit 97d1a400d3

View File

@ -3,14 +3,15 @@
* @package Joomla.Plugin
* @subpackage Quickicon.privacycheck
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 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\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
@ -19,7 +20,7 @@ use Joomla\CMS\Uri\Uri;
*
* @since 3.9.0
*/
class PlgQuickiconPrivacyCheck extends JPlugin
class PlgQuickiconPrivacyCheck extends CMSPlugin
{
/**
* Load plugin language files automatically
@ -29,6 +30,14 @@ class PlgQuickiconPrivacyCheck extends JPlugin
*/
protected $autoloadLanguage = true;
/**
* Application object.
*
* @var \Joomla\CMS\Application\CMSApplication
* @since __DEPLOY_VERSION__
*/
protected $app;
/**
* Check privacy requests older than 14 days.
*
@ -40,13 +49,11 @@ class PlgQuickiconPrivacyCheck extends JPlugin
*/
public function onGetIcons($context)
{
if ($context !== $this->params->get('context', 'mod_quickicon') || !Factory::getUser()->authorise('core.admin'))
if ($context !== $this->params->get('context', 'mod_quickicon') || !$this->app->getIdentity()->authorise('core.admin', 'com_privacy'))
{
return;
return array();
}
JHtml::_('jquery.framework');
$token = Session::getFormToken() . '=' . 1;
$privacy = 'index.php?option=com_privacy';
@ -62,15 +69,16 @@ class PlgQuickiconPrivacyCheck extends JPlugin
)
);
Factory::getDocument()->addScriptOptions('js-privacy-check', $options);
$this->app->getDocument()->addScriptOptions('js-privacy-check', $options);
JHtml::_('script', 'plg_quickicon_privacycheck/privacycheck.js', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('behavior.core');
HTMLHelper::_('script', 'plg_quickicon_privacycheck/privacycheck.js', array('version' => 'auto', 'relative' => true));
return array(
array(
'link' => $privacy . '&view=requests&filter[status]=1&list[fullordering]=a.requested_at ASC',
'image' => 'users',
'icon' => 'header/icon-48-user.png',
'image' => 'fa fa-users',
'icon' => '',
'text' => Text::_('PLG_QUICKICON_PRIVACYCHECK_CHECKING'),
'id' => 'plg_quickicon_privacycheck',
'group' => 'MOD_QUICKICON_USERS'