- md5
- b3a354f1e732ddaa3d6b95ab301c4aee
- sha1
- e274b58797425aac9201028e52db8acea27e635e
- sha256
- 10f560eee8061eeebcb0b61e01356ed1a056ee4a2bc2001f88345e6bb4cb82ef
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
<?php
/**
* @package Joomla.Plugin
* @subpackage System.logout
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
*/
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Plugin\CMSPlugin;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Plugin class for logout redirect handling.
*
* @since 1.6
*/
class PlgSystemLogout extends CMSPlugin
{
/**
* @var \Joomla\CMS\Application\CMSApplication
*
* @since 3.7.3
*/
protected $app;
/**
* Load the language file on instantiation.
*
* @var boolean
*
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* @param object &$subject The object to observe -- event dispatcher.
* @param object $config An optional associative array of configuration settings.
*
* @since 1.6
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// If we are on admin don't process.
if (!$this->app->isClient('site')) {
return;
}
$hash = ApplicationHelper::getHash('PlgSystemLogout');
if ($this->app->getInput()->cookie->getString($hash)) {
// Destroy the cookie.
$this->app->getInput()->cookie->set(
$hash,
'',
1,
$this->app->get('cookie_path', '/'),
$this->app->get('cookie_domain', '')
);
}
}
/**
* Method to handle any logout logic and report back to the subject.
*
* @param array $user Holds the user data.
* @param array $options Array holding options (client, ...).
*
* @return boolean Always returns true.
*
* @since 1.6
*/
public function onUserLogout($user, $options = [])
{
if ($this->app->isClient('site')) {
// Create the cookie.
$this->app->getInput()->cookie->set(
ApplicationHelper::getHash('PlgSystemLogout'),
true,
time() + 86400,
$this->app->get('cookie_path', '/'),
$this->app->get('cookie_domain', ''),
$this->app->isHttpsForced(),
true
);
}
return true;
}
}
The same content is in 19 releases, Joomla 4.3.0-alpha1 to 4.3.4. See them all, or every version of this file.