- md5
- ebf543b71d6ee2bd4200ede6c4cb1098
- sha1
- ac410a29d4f1b9016259126b5fadbc7e6d2b4ec2
- sha256
- 787c43964bf401b3adc56431967f095ecdd0be06ba35755aa292f3e77efed186
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.Joomlaupdate
*
* @copyright Copyright (C) 2005 - 2017 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\Plugin\CMSPlugin;
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 __DEPLOY_VERSION__
*/
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 __DEPLOY_VERSION__
*/
public function getCoreUpdateNotification(QuickIconsEvent $event)
{
$context = $event->getContext();
if ($context !== $this->params->get('context', 'mod_quickicon') || !JFactory::getUser()->authorise('core.manage', 'com_installer'))
{
return;
}
JText::script('PLG_QUICKICON_JOOMLAUPDATE_ERROR', true);
JText::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_BUTTON', true);
JText::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND_MESSAGE', true);
JText::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND', true);
JText::script('PLG_QUICKICON_JOOMLAUPDATE_UPTODATE', true);
JFactory::getDocument()->addScriptOptions(
'js-joomla-update',
[
'url' => JUri::base() . 'index.php?option=com_joomlaupdate',
'ajaxUrl' => JUri::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . JSession::getFormToken() . '=1',
'version' => JVERSION,
]
);
JHtml::_('behavior.core');
JHtml::_('script', 'plg_quickicon_joomlaupdate/jupdatecheck.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' => JText::_('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.