-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro.php
More file actions
46 lines (37 loc) · 1.07 KB
/
intro.php
File metadata and controls
46 lines (37 loc) · 1.07 KB
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
<?php
// no direct access
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
class plgSystemIntro extends CMSPlugin
{
// constructor
public function __construct($subject, $params)
{
parent::__construct($subject, $params);
}
// OnAfterDispatch event to render the introsite.
public function onAfterDispatch()
{
$session = Factory::getSession();
// check for frontend
if (!Factory::getApplication()->isClient('site')) {
return;
}
// check for intro in the session
$intro = $session->get('intro');
if (empty($intro)) {
// get the parameter with the html
echo $this->params->get('intro');
// set intro to session
$session->set('intro', 1);
// stop rendering the site and show the html-output
exit;
}
// keep the session alive
if ($this->params->get('session')) {
echo \Joomla\CMS\HTML\HTMLHelper::_('behavior.keepalive');
}
}
}
?>