- md5
- db99d66cc410fc7f4434a732d3fc2301
- sha1
- 258086dd6dbf5b49f0b88540965add6959aa2387
- sha256
- fb512a9584d1fcbe18403a64b34fa69235f56b99109c910f15ffad0fa0ab6007
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
<?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\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;
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;
/**
* Application object.
*
* @var \Joomla\CMS\Application\CMSApplication
* @since 3.7.0
*/
protected $app;
/**
* 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') || !$this->app->getIdentity()->authorise('core.manage', 'com_installer'))
{
return;
}
Text::script('PLG_QUICKICON_JOOMLAUPDATE_ERROR');
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_BUTTON');
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_MESSAGE');
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->app->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.