Skip to content

Commit

Permalink
[plg_system_logout] Load language files only when needed (joomla#11736)
Browse files Browse the repository at this point in the history
* Update logout.php

* cs and stuff

* Update logout.php
  • Loading branch information
andrepereiradasilva authored and laoneo committed Sep 20, 2016
1 parent 3a0472b commit 0bb9972
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions plugins/system/logout/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
*/
class PlgSystemLogout extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;

/**
* Constructor.
*
Expand Down Expand Up @@ -82,23 +74,26 @@ public function onUserLogout($user, $options = array())
/**
* Method to handle an error condition.
*
* @param Exception &$error The Exception object to be handled.
* @param Exception $error The Exception object to be handled.
*
* @return void
*
* @since 1.6
*/
public static function handleError(&$error)
public static function handleError($error)
{
// Get the application object.
$app = JFactory::getApplication();

// Make sure the error is a 403 and we are in the frontend.
if ($error->getCode() == 403 and $app->isSite())
if ($error->getCode() == 403 && $app->isSite())
{
// Load language file.
parent::loadLanguage();

// Redirect to the home page.
$app->enqueueMessage(JText::_('PLG_SYSTEM_LOGOUT_REDIRECT'));
$app->redirect('index.php');
$app->enqueueMessage(JText::_('PLG_SYSTEM_LOGOUT_REDIRECT'), 'message');
$app->redirect(JRoute::_('index.php'));
}
else
{
Expand Down

0 comments on commit 0bb9972

Please sign in to comment.