first commit
This commit is contained in:
34
plugins/quickicon/downloadkey/downloadkey.xml
Normal file
34
plugins/quickicon/downloadkey/downloadkey.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_downloadkey</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-10</creationDate>
|
||||
<copyright>(C) 2019 Open Source Matters, Inc.</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>4.0.0</version>
|
||||
<description>PLG_QUICKICON_DOWNLOADKEY_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\Downloadkey</namespace>
|
||||
<files>
|
||||
<folder plugin="downloadkey">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_downloadkey.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_downloadkey.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="context"
|
||||
type="text"
|
||||
label="PLG_QUICKICON_DOWNLOADKEY_GROUP_LABEL"
|
||||
description="PLG_QUICKICON_DOWNLOADKEY_GROUP_DESC"
|
||||
default="update_quickicon"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
46
plugins/quickicon/downloadkey/services/provider.php
Normal file
46
plugins/quickicon/downloadkey/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.downloadkey
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\Downloadkey\Extension\Downloadkey;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new Downloadkey(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('quickicon', 'downloadkey')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
150
plugins/quickicon/downloadkey/src/Extension/Downloadkey.php
Normal file
150
plugins/quickicon/downloadkey/src/Extension/Downloadkey.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.downloadkey
|
||||
*
|
||||
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\Downloadkey\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper as ComInstallerHelper;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Joomla! update notification plugin
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
final class Downloadkey extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'onGetIcons',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an icon definition for an icon which looks for extensions updates
|
||||
* via AJAX and displays a notification when such updates are found.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function onGetIcons(QuickIconsEvent $event): void
|
||||
{
|
||||
$context = $event->getContext();
|
||||
|
||||
if (
|
||||
$context !== $this->params->get('context', 'update_quickicon')
|
||||
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_installer')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$info = $this->getMissingDownloadKeyInfo();
|
||||
|
||||
// No extensions need a download key. The icon is not rendered.
|
||||
if (!$info['supported']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$iconDefinition = [
|
||||
'link' => 'index.php?option=com_installer&view=updatesites&filter[supported]=1',
|
||||
'image' => 'icon-key',
|
||||
'icon' => '',
|
||||
'text' => Text::_('PLG_QUICKICON_DOWNLOADKEY_OK'),
|
||||
'class' => 'success',
|
||||
'id' => 'plg_quickicon_downloadkey',
|
||||
'group' => 'MOD_QUICKICON_MAINTENANCE',
|
||||
];
|
||||
|
||||
if ($info['missing'] !== 0) {
|
||||
$iconDefinition = array_merge(
|
||||
$iconDefinition,
|
||||
[
|
||||
'link' => 'index.php?option=com_installer&view=updatesites&filter[supported]=-1',
|
||||
'text' => Text::plural('PLG_QUICKICON_DOWNLOADKEY_N_MISSING', $info['missing']),
|
||||
'class' => 'danger',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Add the icon to the result array
|
||||
$result = $event->getArgument('result', []);
|
||||
|
||||
$result[] = [
|
||||
$iconDefinition,
|
||||
];
|
||||
|
||||
$event->setArgument('result', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the information about update sites requiring but missing a download key.
|
||||
*
|
||||
* The return array has two keys:
|
||||
* - supported Number of update sites supporting Download Key
|
||||
* - missing Number of update sites missing a Download Key
|
||||
*
|
||||
* If 'supported' is zero you do not need to provide any download keys. All your extensions are free downloads.
|
||||
*
|
||||
* If 'supported' is non-zero and 'missing' is zero you have entered a download key for all paid extensions.
|
||||
*
|
||||
* If 'supported' is non-zero and 'missing' is also non-zero you need to enter one or more download keys.
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private function getMissingDownloadKeyInfo(): array
|
||||
{
|
||||
$ret = [
|
||||
'supported' => 0,
|
||||
'missing' => 0,
|
||||
];
|
||||
|
||||
if (!class_exists('Joomla\Component\Installer\Administrator\Helper\InstallerHelper')) {
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_installer/Helper/InstallerHelper.php';
|
||||
}
|
||||
|
||||
$supported = ComInstallerHelper::getDownloadKeySupportedSites(true);
|
||||
$ret['supported'] = \count($supported);
|
||||
|
||||
if ($ret['supported'] === 0) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$missing = ComInstallerHelper::getDownloadKeyExistsSites(false, true);
|
||||
$ret['missing'] = \count($missing);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
31
plugins/quickicon/eos/eos.xml
Normal file
31
plugins/quickicon/eos/eos.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_eos</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2023-05</creationDate>
|
||||
<copyright>(C) 2023 Open Source Matters, Inc.</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>4.4.0</version>
|
||||
<description>PLG_QUICKICON_EOS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\Eos</namespace>
|
||||
<files>
|
||||
<folder plugin="eos">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_eos.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_eos.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="last_snoozed_id"
|
||||
type="hidden"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
50
plugins/quickicon/eos/services/provider.php
Normal file
50
plugins/quickicon/eos/services/provider.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.eos
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\Eos\Extension\Eos;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new Eos(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('quickicon', 'eos')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
$plugin->setDatabase($container->get(DatabaseInterface::class));
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
305
plugins/quickicon/eos/src/Extension/Eos.php
Normal file
305
plugins/quickicon/eos/src/Extension/Eos.php
Normal file
@ -0,0 +1,305 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.eos
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\Eos\Extension;
|
||||
|
||||
use Joomla\CMS\Access\Exception\NotAllowed;
|
||||
use Joomla\CMS\Application\CMSWebApplicationInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Joomla! end of support notification plugin
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
final class Eos extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* The EOS date for the current major version.
|
||||
*
|
||||
* @var string
|
||||
* @since 4.4.0
|
||||
*/
|
||||
private const EOS_DATE = '2027-10-19';
|
||||
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var bool
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected $autoloadLanguage = false;
|
||||
|
||||
/**
|
||||
* Holding the current valid message to be shown.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.4.0
|
||||
*/
|
||||
private $currentMessage = [];
|
||||
|
||||
/**
|
||||
* Are the messages initialized.
|
||||
*
|
||||
* @var bool
|
||||
* @since 4.4.0
|
||||
*/
|
||||
|
||||
private $messagesInitialized = false;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'getEndOfServiceNotification',
|
||||
'onAjaxEos' => 'onAjaxEos',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and show the the alert.
|
||||
*
|
||||
* This method is called when the Quick Icons module is constructing its set
|
||||
* of icons.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEndOfServiceNotification(QuickIconsEvent $event): void
|
||||
{
|
||||
$app = $this->getApplication();
|
||||
|
||||
if (
|
||||
$event->getContext() !== $this->params->get('context', 'update_quickicon')
|
||||
|| !$this->shouldDisplayMessage()
|
||||
|| (!$this->messagesInitialized && $this->setMessage() == [])
|
||||
|| !$app instanceof CMSWebApplicationInterface
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->loadLanguage();
|
||||
|
||||
// Show this only when not snoozed
|
||||
if ($this->params->get('last_snoozed_id', 0) < $this->currentMessage['id']) {
|
||||
// Build the message to be displayed in the cpanel
|
||||
$messageText = sprintf(
|
||||
$app->getLanguage()->_($this->currentMessage['messageText']),
|
||||
HTMLHelper::_('date', Eos::EOS_DATE, $app->getLanguage()->_('DATE_FORMAT_LC3')),
|
||||
$this->currentMessage['messageLink']
|
||||
);
|
||||
if ($this->currentMessage['snoozable']) {
|
||||
$messageText .= '<p><button class="btn btn-warning eosnotify-snooze-btn" type="button" >';
|
||||
$messageText .= $app->getLanguage()->_('PLG_QUICKICON_EOS_SNOOZE_BUTTON') . '</button></p>';
|
||||
}
|
||||
$app->enqueueMessage($messageText, $this->currentMessage['messageType']);
|
||||
}
|
||||
|
||||
$app->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('plg_quickicon_eos.script', 'plg_quickicon_eos/snooze.js', [], ['type' => 'module']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the plugin parameters.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
private function saveParams(): bool
|
||||
{
|
||||
$params = $this->params->toString('JSON');
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('params') . ' = :params')
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||
->where($db->quoteName('folder') . ' = ' . $db->quote('quickicon'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('eos'))
|
||||
->bind(':params', $params);
|
||||
|
||||
return $db->setQuery($query)->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the message and quickicon should be displayed.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function shouldDisplayMessage(): bool
|
||||
{
|
||||
// Show only on administration part
|
||||
return $this->getApplication()->isClient('administrator')
|
||||
// Only show for HTML requests
|
||||
&& $this->getApplication()->getDocument()->getType() === 'html'
|
||||
// Don't show in modal
|
||||
&& $this->getApplication()->getInput()->getCmd('tmpl', 'index') !== 'component'
|
||||
// Only show in cpanel
|
||||
&& $this->getApplication()->getInput()->get('option') === 'com_cpanel';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the texts to be displayed based on the time until we reach EOS.
|
||||
*
|
||||
* @param int $monthsUntilEOS The months until we reach EOS
|
||||
* @param int $inverted Have we surpassed the EOS date
|
||||
*
|
||||
* @return array An array with the message to be displayed or false
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
private function getMessageInfo(int $monthsUntilEOS, int $inverted): array
|
||||
{
|
||||
// The EOS date has passed - Support has ended
|
||||
if ($inverted === 1) {
|
||||
return [
|
||||
'id' => 5,
|
||||
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_ERROR_SUPPORT_ENDED',
|
||||
'messageType' => 'error',
|
||||
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
|
||||
'snoozable' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// The security support is ending in 6 months
|
||||
if ($monthsUntilEOS < 6) {
|
||||
return [
|
||||
'id' => 4,
|
||||
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_WARNING_SUPPORT_ENDING',
|
||||
'messageType' => 'warning',
|
||||
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
|
||||
'snoozable' => true,
|
||||
];
|
||||
}
|
||||
|
||||
// We are in security only mode now, 12 month to go from now on
|
||||
if ($monthsUntilEOS < 12) {
|
||||
return [
|
||||
'id' => 3,
|
||||
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_WARNING_SECURITY_ONLY',
|
||||
'messageType' => 'warning',
|
||||
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
|
||||
'snoozable' => true,
|
||||
];
|
||||
}
|
||||
|
||||
// We still have 16 month to go, lets remind our users about the pre upgrade checker
|
||||
if ($monthsUntilEOS < 16) {
|
||||
return [
|
||||
'id' => 2,
|
||||
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_INFO_02',
|
||||
'messageType' => 'info',
|
||||
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Pre-Update_Check',
|
||||
'snoozable' => true,
|
||||
];
|
||||
}
|
||||
|
||||
// Lets start our messages 2 month after the initial release, still 22 month to go
|
||||
if ($monthsUntilEOS < 22) {
|
||||
return [
|
||||
'id' => 1,
|
||||
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_INFO_01',
|
||||
'messageType' => 'info',
|
||||
'messageLink' => 'https://joomla.org/5',
|
||||
'snoozable' => true,
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user is allowed to send the data.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function isAllowedUser(): bool
|
||||
{
|
||||
return $this->getApplication()->getIdentity()->authorise('core.login.admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* User hit the snooze button.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @throws Notallowed If user is not allowed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function onAjaxEos(): string
|
||||
{
|
||||
// No messages yet so nothing to snooze
|
||||
if (!$this->messagesInitialized && $this->setMessage() == []) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$this->isAllowedUser()) {
|
||||
throw new Notallowed($this->getApplication()->getLanguage()->_('JGLOBAL_AUTH_ACCESS_DENIED'), 403);
|
||||
}
|
||||
|
||||
// Make sure only snoozable messages can be snoozed
|
||||
if ($this->currentMessage['snoozable']) {
|
||||
$this->params->set('last_snoozed_id', $this->currentMessage['id']);
|
||||
$this->saveParams();
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates how many days and selects correct message.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
private function setMessage(): array
|
||||
{
|
||||
$diff = Factory::getDate()->diff(Factory::getDate(Eos::EOS_DATE));
|
||||
$message = $this->getMessageInfo(floor($diff->days / 30.417), $diff->invert);
|
||||
$this->currentMessage = $message;
|
||||
$this->messagesInitialized = true;
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
34
plugins/quickicon/extensionupdate/extensionupdate.xml
Normal file
34
plugins/quickicon/extensionupdate/extensionupdate.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_extensionupdate</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2011-08</creationDate>
|
||||
<copyright>(C) 2011 Open Source Matters, Inc.</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>PLG_QUICKICON_EXTENSIONUPDATE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\Extensionupdate</namespace>
|
||||
<files>
|
||||
<folder plugin="extensionupdate">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_extensionupdate.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_extensionupdate.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="context"
|
||||
type="text"
|
||||
label="PLG_QUICKICON_EXTENSIONUPDATE_GROUP_LABEL"
|
||||
description="PLG_QUICKICON_EXTENSIONUPDATE_GROUP_DESC"
|
||||
default="update_quickicon"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
46
plugins/quickicon/extensionupdate/services/provider.php
Normal file
46
plugins/quickicon/extensionupdate/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.extensionupdate
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\Extensionupdate\Extension\Extensionupdate;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new Extensionupdate(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('quickicon', 'extensionupdate')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.extensionupdate
|
||||
*
|
||||
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\Extensionupdate\Extension;
|
||||
|
||||
use Joomla\CMS\Extension\ExtensionHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Joomla! update notification plugin
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
final class Extensionupdate extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'onGetIcons',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an icon definition for an icon which looks for extensions updates
|
||||
* via AJAX and displays a notification when such updates are found.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function onGetIcons(QuickIconsEvent $event): void
|
||||
{
|
||||
$context = $event->getContext();
|
||||
|
||||
if (
|
||||
$context !== $this->params->get('context', 'update_quickicon')
|
||||
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_installer')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$token = Session::getFormToken() . '=1';
|
||||
$options = [
|
||||
'url' => Uri::base() . 'index.php?option=com_installer&view=update&task=update.find&' . $token,
|
||||
'ajaxUrl' => Uri::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . $token
|
||||
. '&cache_timeout=3600&eid=0&skip=' . ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id,
|
||||
];
|
||||
|
||||
$this->getApplication()->getDocument()->addScriptOptions('js-extensions-update', $options);
|
||||
|
||||
Text::script('PLG_QUICKICON_EXTENSIONUPDATE_UPTODATE');
|
||||
Text::script('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND');
|
||||
Text::script('PLG_QUICKICON_EXTENSIONUPDATE_ERROR');
|
||||
Text::script('MESSAGE');
|
||||
Text::script('ERROR');
|
||||
Text::script('INFO');
|
||||
Text::script('WARNING');
|
||||
|
||||
$this->getApplication()->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript(
|
||||
'plg_quickicon_extensionupdate',
|
||||
'plg_quickicon_extensionupdate/extensionupdatecheck.min.js',
|
||||
[],
|
||||
['defer' => true],
|
||||
['core']
|
||||
);
|
||||
|
||||
// Add the icon to the result array
|
||||
$result = $event->getArgument('result', []);
|
||||
|
||||
$result[] = [
|
||||
[
|
||||
'link' => 'index.php?option=com_installer&view=update&task=update.find&' . $token,
|
||||
'image' => 'icon-star',
|
||||
'icon' => '',
|
||||
'text' => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_EXTENSIONUPDATE_CHECKING'),
|
||||
'id' => 'plg_quickicon_extensionupdate',
|
||||
'group' => 'MOD_QUICKICON_MAINTENANCE',
|
||||
],
|
||||
];
|
||||
|
||||
$event->setArgument('result', $result);
|
||||
}
|
||||
}
|
||||
34
plugins/quickicon/joomlaupdate/joomlaupdate.xml
Normal file
34
plugins/quickicon/joomlaupdate/joomlaupdate.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_joomlaupdate</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2011-08</creationDate>
|
||||
<copyright>(C) 2011 Open Source Matters, Inc.</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>PLG_QUICKICON_JOOMLAUPDATE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\Joomlaupdate</namespace>
|
||||
<files>
|
||||
<folder plugin="joomlaupdate">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_joomlaupdate.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_joomlaupdate.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="context"
|
||||
type="text"
|
||||
label="PLG_QUICKICON_JOOMLAUPDATE_GROUP_LABEL"
|
||||
description="PLG_QUICKICON_JOOMLAUPDATE_GROUP_DESC"
|
||||
default="update_quickicon"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
49
plugins/quickicon/joomlaupdate/services/provider.php
Normal file
49
plugins/quickicon/joomlaupdate/services/provider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.Joomlaupdate
|
||||
*
|
||||
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\Joomlaupdate\Extension\Joomlaupdate;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
// @Todo This needs to be changed to a proper factory
|
||||
$plugin = \Joomla\CMS\Plugin\PluginHelper::getPlugin('quickicon', 'joomlaupdate');
|
||||
|
||||
$plugin = new Joomlaupdate(
|
||||
$container->get(DispatcherInterface::class),
|
||||
Factory::getApplication()->getDocument(),
|
||||
(array) $plugin
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
141
plugins/quickicon/joomlaupdate/src/Extension/Joomlaupdate.php
Normal file
141
plugins/quickicon/joomlaupdate/src/Extension/Joomlaupdate.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.Joomlaupdate
|
||||
*
|
||||
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\Joomlaupdate\Extension;
|
||||
|
||||
use Joomla\CMS\Document\Document;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Joomla! update notification plugin
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
class Joomlaupdate extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* The document.
|
||||
*
|
||||
* @var Document
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $document;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'getCoreUpdateNotification',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DispatcherInterface $dispatcher The object to observe
|
||||
* @param Document $document The document
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'group', 'params', 'language'
|
||||
* (this list is not meant to be comprehensive).
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function __construct($dispatcher, Document $document, array $config = [])
|
||||
{
|
||||
parent::__construct($dispatcher, $config);
|
||||
|
||||
$this->document = $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when the Quick Icons module is constructing its set
|
||||
* of icons. You can return an array which defines a single icon and it will
|
||||
* be rendered right after the stock Quick Icons.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function getCoreUpdateNotification(QuickIconsEvent $event)
|
||||
{
|
||||
$context = $event->getContext();
|
||||
|
||||
if (
|
||||
$context !== $this->params->get('context', 'update_quickicon')
|
||||
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_joomlaupdate')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
Text::script('PLG_QUICKICON_JOOMLAUPDATE_ERROR');
|
||||
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND');
|
||||
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPTODATE');
|
||||
Text::script('MESSAGE');
|
||||
Text::script('ERROR');
|
||||
Text::script('INFO');
|
||||
Text::script('WARNING');
|
||||
|
||||
$this->document->addScriptOptions(
|
||||
'js-joomla-update',
|
||||
[
|
||||
'url' => Uri::base() . 'index.php?option=com_joomlaupdate',
|
||||
'ajaxUrl' => Uri::base() . 'index.php?option=com_joomlaupdate&task=update.ajax&'
|
||||
. Session::getFormToken() . '=1',
|
||||
'version' => JVERSION,
|
||||
]
|
||||
);
|
||||
|
||||
$this->document->getWebAssetManager()
|
||||
->registerAndUseScript('plg_quickicon_joomlaupdate', 'plg_quickicon_joomlaupdate/jupdatecheck.min.js', [], ['defer' => true], ['core']);
|
||||
|
||||
// Add the icon to the result array
|
||||
$result = $event->getArgument('result', []);
|
||||
|
||||
$result[] = [
|
||||
[
|
||||
'link' => 'index.php?option=com_joomlaupdate',
|
||||
'image' => 'icon-joomla',
|
||||
'icon' => '',
|
||||
'text' => Text::_('PLG_QUICKICON_JOOMLAUPDATE_CHECKING'),
|
||||
'id' => 'plg_quickicon_joomlaupdate',
|
||||
'group' => 'MOD_QUICKICON_MAINTENANCE',
|
||||
],
|
||||
];
|
||||
|
||||
$event->setArgument('result', $result);
|
||||
}
|
||||
}
|
||||
34
plugins/quickicon/overridecheck/overridecheck.xml
Normal file
34
plugins/quickicon/overridecheck/overridecheck.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_overridecheck</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2018-06</creationDate>
|
||||
<copyright>(C) 2018 Open Source Matters, Inc.</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>4.0.0</version>
|
||||
<description>PLG_QUICKICON_OVERRIDECHECK_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\OverrideCheck</namespace>
|
||||
<files>
|
||||
<folder plugin="overridecheck">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_overridecheck.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_overridecheck.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="context"
|
||||
type="text"
|
||||
label="PLG_QUICKICON_OVERRIDECHECK_GROUP_LABEL"
|
||||
description="PLG_QUICKICON_OVERRIDECHECK_GROUP_DESC"
|
||||
default="update_quickicon"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
48
plugins/quickicon/overridecheck/services/provider.php
Normal file
48
plugins/quickicon/overridecheck/services/provider.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.overridecheck
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\OverrideCheck\Extension\OverrideCheck;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new OverrideCheck(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('quickicon', 'overridecheck')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
$plugin->setDatabase($container->get(DatabaseInterface::class));
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
137
plugins/quickicon/overridecheck/src/Extension/OverrideCheck.php
Normal file
137
plugins/quickicon/overridecheck/src/Extension/OverrideCheck.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.overridecheck
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\OverrideCheck\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Joomla! template override notification plugin
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
final class OverrideCheck extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'onGetIcons',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an icon definition for an icon which looks for overrides update
|
||||
* via AJAX and displays a notification when such overrides are updated.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function onGetIcons(QuickIconsEvent $event): void
|
||||
{
|
||||
$context = $event->getContext();
|
||||
|
||||
if (
|
||||
$context !== $this->params->get('context', 'update_quickicon')
|
||||
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_templates')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$token = Session::getFormToken() . '=1';
|
||||
$options = [
|
||||
'url' => Uri::base() . 'index.php?option=com_templates&view=templates',
|
||||
'ajaxUrl' => Uri::base() . 'index.php?option=com_templates&view=templates&task=template.ajax&' . $token,
|
||||
'pluginId' => $this->getOverridePluginId(),
|
||||
];
|
||||
|
||||
$this->getApplication()->getDocument()->addScriptOptions('js-override-check', $options);
|
||||
|
||||
Text::script('PLG_QUICKICON_OVERRIDECHECK_ERROR', true);
|
||||
Text::script('PLG_QUICKICON_OVERRIDECHECK_ERROR_ENABLE', true);
|
||||
Text::script('PLG_QUICKICON_OVERRIDECHECK_UPTODATE', true);
|
||||
Text::script('PLG_QUICKICON_OVERRIDECHECK_OVERRIDEFOUND', true);
|
||||
|
||||
$this->getApplication()->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('plg_quickicon_overridecheck', 'plg_quickicon_overridecheck/overridecheck.js', [], ['defer' => true], ['core']);
|
||||
|
||||
// Add the icon to the result array
|
||||
$result = $event->getArgument('result', []);
|
||||
|
||||
$result[] = [
|
||||
[
|
||||
'link' => 'index.php?option=com_templates&view=templates',
|
||||
'image' => 'icon-file',
|
||||
'icon' => '',
|
||||
'text' => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_OVERRIDECHECK_CHECKING'),
|
||||
'id' => 'plg_quickicon_overridecheck',
|
||||
'group' => 'MOD_QUICKICON_MAINTENANCE',
|
||||
],
|
||||
];
|
||||
|
||||
$event->setArgument('result', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the installer override plugin extension id.
|
||||
*
|
||||
* @return integer The installer override plugin extension id.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private function getOverridePluginId()
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('extension_id'))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('folder') . ' = ' . $db->quote('installer'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('override'));
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$result = (int) $db->loadResult();
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->getApplication()->enqueueMessage($e->getMessage(), 'error');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
21
plugins/quickicon/phpversioncheck/phpversioncheck.xml
Normal file
21
plugins/quickicon/phpversioncheck/phpversioncheck.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_phpversioncheck</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2016-08</creationDate>
|
||||
<copyright>(C) 2016 Open Source Matters, Inc.</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.7.0</version>
|
||||
<description>PLG_QUICKICON_PHPVERSIONCHECK_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\PhpVersionCheck</namespace>
|
||||
<files>
|
||||
<folder plugin="phpversioncheck">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_phpversioncheck.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_phpversioncheck.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
46
plugins/quickicon/phpversioncheck/services/provider.php
Normal file
46
plugins/quickicon/phpversioncheck/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.phpversioncheck
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\PhpVersionCheck\Extension\PhpVersionCheck;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new PhpVersionCheck(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('quickicon', 'phpversioncheck')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.phpversioncheck
|
||||
*
|
||||
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\PhpVersionCheck\Extension;
|
||||
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Plugin to check the PHP version and display a warning about its support status
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
final class PhpVersionCheck extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Constant representing the active PHP version being fully supported
|
||||
*
|
||||
* @var integer
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public const PHP_SUPPORTED = 0;
|
||||
|
||||
/**
|
||||
* Constant representing the active PHP version receiving security support only
|
||||
*
|
||||
* @var integer
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public const PHP_SECURITY_ONLY = 1;
|
||||
|
||||
/**
|
||||
* Constant representing the active PHP version being unsupported
|
||||
*
|
||||
* @var integer
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public const PHP_UNSUPPORTED = 2;
|
||||
|
||||
/**
|
||||
* Load plugin language files automatically
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.7.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'onGetIcons',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the PHP version after the admin component has been dispatched.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onGetIcons(QuickIconsEvent $event): void
|
||||
{
|
||||
if (!$this->shouldDisplayMessage()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$supportStatus = $this->getPhpSupport();
|
||||
|
||||
if ($supportStatus['status'] !== self::PHP_SUPPORTED) {
|
||||
// Enqueue the notification message; set a warning if receiving security support or "error" if unsupported
|
||||
switch ($supportStatus['status']) {
|
||||
case self::PHP_SECURITY_ONLY:
|
||||
$this->getApplication()->enqueueMessage($supportStatus['message'], 'warning');
|
||||
|
||||
break;
|
||||
|
||||
case self::PHP_UNSUPPORTED:
|
||||
$this->getApplication()->enqueueMessage($supportStatus['message'], 'danger');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets PHP support status.
|
||||
*
|
||||
* @return array Array of PHP support data
|
||||
*
|
||||
* @since 3.7.0
|
||||
* @note The dates used in this method should correspond to the dates given on PHP.net
|
||||
* @link https://www.php.net/supported-versions.php
|
||||
* @link https://www.php.net/eol.php
|
||||
*/
|
||||
private function getPhpSupport()
|
||||
{
|
||||
$phpSupportData = [
|
||||
'7.2' => [
|
||||
'security' => '2019-11-30',
|
||||
'eos' => '2020-11-30',
|
||||
],
|
||||
'7.3' => [
|
||||
'security' => '2020-12-06',
|
||||
'eos' => '2021-12-06',
|
||||
],
|
||||
'7.4' => [
|
||||
'security' => '2021-11-28',
|
||||
'eos' => '2022-11-28',
|
||||
],
|
||||
'8.0' => [
|
||||
'security' => '2022-11-26',
|
||||
'eos' => '2023-11-26',
|
||||
],
|
||||
'8.1' => [
|
||||
'security' => '2023-11-25',
|
||||
'eos' => '2024-11-25',
|
||||
],
|
||||
'8.2' => [
|
||||
'security' => '2024-12-08',
|
||||
'eos' => '2025-12-08',
|
||||
],
|
||||
];
|
||||
|
||||
// Fill our return array with default values
|
||||
$supportStatus = [
|
||||
'status' => self::PHP_SUPPORTED,
|
||||
'message' => null,
|
||||
];
|
||||
|
||||
// Check the PHP version's support status using the minor version
|
||||
$activePhpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
|
||||
|
||||
// Handle non standard strings like PHP 7.2.34-8+ubuntu18.04.1+deb.sury.org+1
|
||||
$phpVersion = preg_split('/-/', PHP_VERSION)[0];
|
||||
|
||||
// Do we have the PHP version's data?
|
||||
if (isset($phpSupportData[$activePhpVersion])) {
|
||||
// First check if the version has reached end of support
|
||||
$today = new Date();
|
||||
$phpEndOfSupport = new Date($phpSupportData[$activePhpVersion]['eos']);
|
||||
|
||||
if ($phpNotSupported = $today > $phpEndOfSupport) {
|
||||
/*
|
||||
* Find the oldest PHP version still supported that is newer than the current version,
|
||||
* this is our recommendation for users on unsupported platforms
|
||||
*/
|
||||
foreach ($phpSupportData as $version => $versionData) {
|
||||
$versionEndOfSupport = new Date($versionData['eos']);
|
||||
|
||||
if (version_compare($version, $activePhpVersion, 'ge') && ($today < $versionEndOfSupport)) {
|
||||
$supportStatus['status'] = self::PHP_UNSUPPORTED;
|
||||
$supportStatus['message'] = Text::sprintf(
|
||||
'PLG_QUICKICON_PHPVERSIONCHECK_UNSUPPORTED',
|
||||
$phpVersion,
|
||||
$version,
|
||||
$versionEndOfSupport->format(Text::_('DATE_FORMAT_LC4'))
|
||||
);
|
||||
|
||||
return $supportStatus;
|
||||
}
|
||||
}
|
||||
|
||||
// PHP version is not supported and we don't know of any supported versions.
|
||||
$supportStatus['status'] = self::PHP_UNSUPPORTED;
|
||||
$supportStatus['message'] = Text::sprintf(
|
||||
'PLG_QUICKICON_PHPVERSIONCHECK_UNSUPPORTED_JOOMLA_OUTDATED',
|
||||
$phpVersion
|
||||
);
|
||||
|
||||
return $supportStatus;
|
||||
}
|
||||
|
||||
// If the version is still supported, check if it has reached eol minus 3 month
|
||||
$securityWarningDate = clone $phpEndOfSupport;
|
||||
$securityWarningDate->sub(new \DateInterval('P3M'));
|
||||
|
||||
if (!$phpNotSupported && $today > $securityWarningDate) {
|
||||
$supportStatus['status'] = self::PHP_SECURITY_ONLY;
|
||||
$supportStatus['message'] = Text::sprintf(
|
||||
'PLG_QUICKICON_PHPVERSIONCHECK_SECURITY_ONLY',
|
||||
$phpVersion,
|
||||
$phpEndOfSupport->format(Text::_('DATE_FORMAT_LC4'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $supportStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the message should be displayed
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
private function shouldDisplayMessage()
|
||||
{
|
||||
// Only on admin app
|
||||
if (!$this->getApplication()->isClient('administrator')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only if authenticated
|
||||
if ($this->getApplication()->getIdentity()->guest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only on HTML documents
|
||||
if ($this->getApplication()->getDocument()->getType() !== 'html') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only on full page requests
|
||||
if ($this->getApplication()->getInput()->getCmd('tmpl', 'index') === 'component') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only to com_cpanel
|
||||
if ($this->getApplication()->getInput()->get('option') !== 'com_cpanel') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
34
plugins/quickicon/privacycheck/privacycheck.xml
Normal file
34
plugins/quickicon/privacycheck/privacycheck.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="quickicon" method="upgrade">
|
||||
<name>plg_quickicon_privacycheck</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2018-06</creationDate>
|
||||
<copyright>(C) 2018 Open Source Matters, Inc.</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.9.0</version>
|
||||
<description>PLG_QUICKICON_PRIVACYCHECK_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Quickicon\PrivacyCheck</namespace>
|
||||
<files>
|
||||
<folder plugin="privacycheck">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_privacycheck.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_quickicon_privacycheck.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="context"
|
||||
type="text"
|
||||
label="PLG_QUICKICON_PRIVACYCHECK_GROUP_LABEL"
|
||||
description="PLG_QUICKICON_PRIVACYCHECK_GROUP_DESC"
|
||||
default="update_quickicon"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
46
plugins/quickicon/privacycheck/services/provider.php
Normal file
46
plugins/quickicon/privacycheck/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.privacycheck
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\Quickicon\PrivacyCheck\Extension\PrivacyCheck;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new PrivacyCheck(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('quickicon', 'privacycheck')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
110
plugins/quickicon/privacycheck/src/Extension/PrivacyCheck.php
Normal file
110
plugins/quickicon/privacycheck/src/Extension/PrivacyCheck.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Quickicon.privacycheck
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Quickicon\PrivacyCheck\Extension;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Plugin to check privacy requests older than 14 days
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
final class PrivacyCheck extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Load plugin language files automatically
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onGetIcons' => 'onGetIcons',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check privacy requests older than 14 days.
|
||||
*
|
||||
* @param QuickIconsEvent $event The event object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function onGetIcons(QuickIconsEvent $event): void
|
||||
{
|
||||
$context = $event->getContext();
|
||||
|
||||
if (
|
||||
$context !== $this->params->get('context', 'update_quickicon')
|
||||
|| !$this->getApplication()->getIdentity()->authorise('core.admin', 'com_privacy')
|
||||
|| !ComponentHelper::isEnabled('com_privacy')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$token = Session::getFormToken() . '=' . 1;
|
||||
$privacy = 'index.php?option=com_privacy';
|
||||
|
||||
$options = [
|
||||
'plg_quickicon_privacycheck_url' => Uri::base() . $privacy . '&view=requests&filter[status]=1&list[fullordering]=a.requested_at ASC',
|
||||
'plg_quickicon_privacycheck_ajax_url' => Uri::base() . $privacy . '&task=getNumberUrgentRequests&format=json&' . $token,
|
||||
'plg_quickicon_privacycheck_text' => [
|
||||
"NOREQUEST" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_NOREQUEST'),
|
||||
"REQUESTFOUND" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_REQUESTFOUND'),
|
||||
"ERROR" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_ERROR'),
|
||||
"REQUESTFOUND_MESSAGE" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_REQUESTFOUND_MESSAGE'),
|
||||
"REQUESTFOUND_BUTTON" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_REQUESTFOUND_BUTTON'),
|
||||
],
|
||||
];
|
||||
|
||||
$this->getApplication()->getDocument()->addScriptOptions('js-privacy-check', $options);
|
||||
|
||||
$this->getApplication()->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('plg_quickicon_privacycheck', 'plg_quickicon_privacycheck/privacycheck.js', [], ['defer' => true], ['core']);
|
||||
|
||||
// Add the icon to the result array
|
||||
$result = $event->getArgument('result', []);
|
||||
|
||||
$result[] = [
|
||||
[
|
||||
'link' => $privacy . '&view=requests&filter[status]=1&list[fullordering]=a.requested_at ASC',
|
||||
'image' => 'icon-users',
|
||||
'icon' => '',
|
||||
'text' => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_CHECKING'),
|
||||
'id' => 'plg_quickicon_privacycheck',
|
||||
'group' => 'MOD_QUICKICON_USERS',
|
||||
],
|
||||
];
|
||||
|
||||
$event->setArgument('result', $result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user