- md5
- 5f12b768f39c758e8b534f8629c0c473
- sha1
- e41d0f88c869b5a05351df96335f4143f9b6526c
- sha256
- 5953709eac25b3cbd47a68f836088ea2b5a6cb05f564e2735cd9edf56012ecf3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.Joomlaupdate
*
* @copyright Copyright (C) 2005 - 2018 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\Uri\Uri;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
/**
* Joomla! update notification plugin
*
* @since 2.5
*/
class PlgQuickiconJoomlaupdate 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.0.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'getCoreUpdateNotification',
];
}
/**
* 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', 'mod_quickicon') || !Factory::getUser()->authorise('core.manage', 'com_installer'))
{
return;
}
Text::script('PLG_QUICKICON_JOOMLAUPDATE_ERROR', true);
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_BUTTON', true);
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_MESSAGE', true);
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND', true);
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPTODATE', true);
Factory::getDocument()->addScriptOptions(
'js-joomla-update',
[
'url' => Uri::base() . 'index.php?option=com_joomlaupdate',
'ajaxUrl' => Uri::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . Session::getFormToken() . '=1',
'version' => JVERSION,
]
);
HTMLHelper::_('behavior.core');
HTMLHelper::_('script', 'plg_quickicon_joomlaupdate/jupdatecheck.min.js', array('version' => 'auto', 'relative' => true));
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
[
'link' => 'index.php?option=com_joomlaupdate',
'image' => 'fa fa-joomla',
'icon' => '',
'text' => Text::_('PLG_QUICKICON_JOOMLAUPDATE_CHECKING'),
'id' => 'plg_quickicon_joomlaupdate',
'group' => 'MOD_QUICKICON_MAINTENANCE',
],
];
$event->setArgument('result', $result);
}
}
No other release has this exact content. See every version of this file.