-
Notifications
You must be signed in to change notification settings - Fork 1
/
pankybrowsertitle.php
48 lines (36 loc) · 1.19 KB
/
pankybrowsertitle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @package Joomla.Plugin
* @subpackage System.pankybrowsertitle
*
* @copyright (C) 2023 Panagiotis Kiriakopoulos. <https://github.com/pnkr>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Document\HtmlDocument;
use Joomla\CMS\Plugin\CMSPlugin;
class plgSystemPankybrowsertitle extends Joomla\CMS\Plugin\CMSPlugin
{
/**
* Load the language file on instantiation
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
public function onAfterDispatch()
{
if (!Joomla\CMS\Factory::getApplication()->isClient('site')) return;
$document = Joomla\CMS\Factory::getApplication()->getDocument();
$document->setMetaData('browserTabMsg', $this->params->get('browsermessage'));
if (!($document instanceof Joomla\CMS\Document\HtmlDocument))
{
return;
}
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->getRegistry()->addExtensionRegistryFile('plg_system_pankybrowsertitle');
$wa->useScript('pankybrowsertitle','script');
}
}