Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plg_system_logout] Load language files only when needed #11736

Merged
merged 4 commits into from
Sep 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -80,23 +72,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