Skip to content
Merged
19 changes: 6 additions & 13 deletions plugins/system/actionlogs/src/Extension/ActionLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ public function __construct(DispatcherInterface $dispatcher, array $config)
PluginHelper::importPlugin('actionlog');
}

/**
* Listener for the `onAfterInitialise` event
*
* @return void
*
* @since 4.0.0
*/
public function onAfterInitialise()
{
// Load plugin language files.
$this->loadLanguage();
}

/**
* Adds additional fields to the user editing form for logs e-mail notifications
*
Expand Down Expand Up @@ -100,6 +87,9 @@ public function onContentPrepareForm(Form $form, $data)
return true;
}

// Load plugin language files.
$this->loadLanguage();

// If we are on the save command, no data is passed to $data variable, we need to get it directly from request
$jformData = $this->getApplication()->getInput()->get('jform', [], 'array');

Expand Down Expand Up @@ -175,6 +165,9 @@ public function onContentPrepareData($context, $data)
return true;
}

// Load plugin language files.
$this->loadLanguage();

$data->actionlogs = new \stdClass();
$data->actionlogs->actionlogsNotify = $values->notify;
$data->actionlogs->actionlogsExtensions = $values->extensions;
Expand Down
8 changes: 0 additions & 8 deletions plugins/system/fields/src/Extension/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ final class Fields extends CMSPlugin
{
use UserFactoryAwareTrait;

/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.7.0
*/
protected $autoloadLanguage = true;

/**
* Normalizes the request data.
*
Expand Down
9 changes: 7 additions & 2 deletions plugins/system/guidedtours/src/Extension/GuidedTours.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ final class GuidedTours extends CMSPlugin implements SubscriberInterface
*/
public function __construct(DispatcherInterface $dispatcher, array $config = [], bool $enabled = false)
{
$this->autoloadLanguage = $enabled;
self::$enabled = $enabled;
self::$enabled = $enabled;

parent::__construct($dispatcher, $config);
}
Expand Down Expand Up @@ -110,6 +109,9 @@ public function startTour(Event $event)

$tour = null;

// Load plugin language files
$this->loadLanguage();

if ($tourId > 0) {
$tour = $this->getTour($tourId);
} elseif ($tourUid !== '') {
Expand All @@ -135,6 +137,9 @@ public function onBeforeCompileHead()
$user = $app->getIdentity();

if ($user != null && $user->id > 0) {
// Load plugin language files
$this->loadLanguage();

Text::script('JCANCEL');
Text::script('PLG_SYSTEM_GUIDEDTOURS_BACK');
Text::script('PLG_SYSTEM_GUIDEDTOURS_COMPLETE');
Expand Down
11 changes: 3 additions & 8 deletions plugins/system/jooa11y/src/Extension/Jooa11y.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@
*/
final class Jooa11y extends CMSPlugin implements SubscriberInterface
{
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
* @since 4.1.0
*/
protected $autoloadLanguage = true;

/**
* Subscribe to certain events
*
Expand Down Expand Up @@ -101,6 +93,9 @@ public function initJooa11y()
return;
}

// Load translations
$this->loadLanguage();

// Get the document object.
$document = $this->getApplication()->getDocument();

Expand Down
9 changes: 0 additions & 9 deletions plugins/system/logout/src/Extension/Logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@
*/
final class Logout extends CMSPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
*
* @since 3.1
*/
protected $autoloadLanguage = true;

/**
* @param DispatcherInterface $dispatcher The object to observe -- event dispatcher.
* @param array $config An optional associative array of configuration settings.
Expand Down
17 changes: 9 additions & 8 deletions plugins/system/privacyconsent/src/Extension/PrivacyConsent.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ final class PrivacyConsent extends CMSPlugin
{
use DatabaseAwareTrait;

/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.9.0
*/
protected $autoloadLanguage = true;

/**
* Adds additional fields to the user editing form
*
Expand All @@ -63,6 +55,9 @@ public function onContentPrepareForm(Form $form, $data)
return true;
}

// Load plugin language files
$this->loadLanguage();

// We only display this if user has not consented before
if (is_object($data)) {
$userId = $data->id ?? 0;
Expand Down Expand Up @@ -107,6 +102,9 @@ public function onUserBeforeSave($user, $isNew, $data)

$userId = ArrayHelper::getValue($user, 'id', 0, 'int');

// Load plugin language files
$this->loadLanguage();

// User already consented before, no need to check it further
if ($userId > 0 && $this->isUserConsented($userId)) {
return true;
Expand Down Expand Up @@ -256,6 +254,9 @@ public function onAfterRoute()

// Check to see whether user already consented, if not, redirect to user profile page
if ($userId > 0) {
// Load plugin language files
$this->loadLanguage();

// If user consented before, no need to check it further
if ($this->isUserConsented($userId)) {
return;
Expand Down
11 changes: 3 additions & 8 deletions plugins/system/redirect/src/Extension/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ final class Redirect extends CMSPlugin implements SubscriberInterface
{
use DatabaseAwareTrait;

/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
* @since 3.4
*/
protected $autoloadLanguage = false;

/**
* Returns an array of events this subscriber will listen to.
*
Expand Down Expand Up @@ -72,6 +64,9 @@ public function handleError(ErrorEvent $event)
return;
}

// Load translations
$this->loadLanguage();

$uri = Uri::getInstance();

// These are the original URLs
Expand Down
11 changes: 3 additions & 8 deletions plugins/system/schemaorg/src/Extension/Schemaorg.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ final class Schemaorg extends CMSPlugin implements SubscriberInterface
use SchemaorgPrepareDateTrait;
use UserFactoryAwareTrait;

/**
* Load the language file on instantiation.
*
* @var boolean
* @since 5.0.0
*/
protected $autoloadLanguage = true;

/**
* Returns an array of events this subscriber will listen to.
*
Expand Down Expand Up @@ -148,6 +140,9 @@ public function onContentPrepareForm(Model\PrepareFormEvent $event)
return;
}

// Load plugin language files.
$this->loadLanguage();

// Load the form fields
$form->loadFile(JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name . '/forms/schemaorg.xml');

Expand Down
11 changes: 3 additions & 8 deletions plugins/system/shortcut/src/Extension/Shortcut.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@
*/
final class Shortcut extends CMSPlugin implements SubscriberInterface
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 4.2.0
*/
protected $autoloadLanguage = true;

/**
* Returns an array of events this subscriber will listen to.
*
Expand Down Expand Up @@ -75,6 +67,9 @@ public function initialize()
return;
}

// Load translations
$this->loadLanguage();

$context = $this->getApplication()->getInput()->get('option') . '.' . $this->getApplication()->getInput()->get('view');

$shortcuts = [];
Expand Down
21 changes: 15 additions & 6 deletions plugins/system/tasknotification/src/Extension/TaskNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ final class TaskNotification extends CMSPlugin implements SubscriberInterface
*/
private const TASK_NOTIFICATION_FORM = 'task_notification';

/**
* @var boolean
* @since 4.1.0
*/
protected $autoloadLanguage = true;

/**
* @inheritDoc
*
Expand Down Expand Up @@ -94,6 +88,9 @@ public function injectTaskNotificationFieldset(Model\PrepareFormEvent $event): b
return true;
}

// Load translations
$this->loadLanguage();

$formFile = JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name . '/forms/' . self::TASK_NOTIFICATION_FORM . '.xml';

try {
Expand Down Expand Up @@ -131,6 +128,9 @@ public function notifyFailure(Event $event): void
return;
}

// Load translations
$this->loadLanguage();

// @todo safety checks, multiple files [?]
$outFile = $event->getArgument('subject')->snapshot['output_file'] ?? '';
$data = $this->getDataFromTask($event->getArgument('subject'));
Expand Down Expand Up @@ -158,6 +158,9 @@ public function notifyOrphan(Event $event): void
return;
}

// Load translations
$this->loadLanguage();

$data = $this->getDataFromTask($event->getArgument('subject'));
$this->sendMail('plg_system_tasknotification.orphan_mail', $data);
}
Expand All @@ -181,6 +184,9 @@ public function notifySuccess(Event $event): void
return;
}

// Load translations
$this->loadLanguage();

// @todo safety checks, multiple files [?]
$outFile = $event->getArgument('subject')->snapshot['output_file'] ?? '';
$data = $this->getDataFromTask($event->getArgument('subject'));
Expand Down Expand Up @@ -211,6 +217,9 @@ public function notifyFatalRecovery(Event $event): void
return;
}

// Load translations
$this->loadLanguage();

$data = $this->getDataFromTask($event->getArgument('subject'));
$this->sendMail('plg_system_tasknotification.fatal_recovery_mail', $data);
}
Expand Down
8 changes: 0 additions & 8 deletions plugins/system/webauthn/src/Extension/Webauthn.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ final class Webauthn extends CMSPlugin implements SubscriberInterface
// Handle user profile deletion
use UserDeletion;

/**
* Autoload the language files
*
* @var boolean
* @since 4.2.0
*/
protected $autoloadLanguage = true;

/**
* Should I try to detect and register legacy event listeners, i.e. methods which accept unwrapped arguments? While
* this maintains a great degree of backwards compatibility to Joomla! 3.x-style plugins it is much slower. You are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public function onUserLoginButtons(Event $event): void
return;
}

// Load plugin language files
$this->loadLanguage();

// Load necessary CSS and Javascript files
$this->addLoginCSSAndJavascript();

Expand Down
3 changes: 3 additions & 0 deletions plugins/system/webauthn/src/PluginTraits/AjaxHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public function onAjaxWebauthn(AjaxEvent $event): void
$returnURL = $this->getApplication()->getSession()->get('plg_system_webauthn.returnUrl', Uri::base());
$result = null;

// Load plugin language files
$this->loadLanguage();

try {
Log::add("Received AJAX callback.", Log::DEBUG, 'webauthn.system');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public function onAjaxWebauthnChallenge(AjaxChallenge $event): void
$session = $this->getApplication()->getSession();
$input = $this->getApplication()->getInput();

// Load plugin language files
$this->loadLanguage();

// Retrieve data from the request
$username = $input->getUsername('username', '');
$returnUrl = base64_encode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ trait AjaxHandlerCreate
*/
public function onAjaxWebauthnCreate(AjaxCreate $event): void
{
// Load plugin language files
$this->loadLanguage();

/**
* Fundamental sanity check: this callback is only allowed after a Public Key has been created server-side and
* the user it was created for matches the current user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ trait AjaxHandlerDelete
*/
public function onAjaxWebauthnDelete(AjaxDelete $event): void
{
// Load plugin language files
$this->loadLanguage();

// Initialize objects
$input = $this->getApplication()->getInput();
$repository = $this->authenticationHelper->getCredentialsRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ trait AjaxHandlerInitCreate
*/
public function onAjaxWebauthnInitcreate(AjaxInitCreate $event): void
{
// Load plugin language files
$this->loadLanguage();

// Make sure I have a valid user
$user = Factory::getApplication()->getIdentity();

Expand Down
3 changes: 3 additions & 0 deletions plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ trait AjaxHandlerLogin
*/
public function onAjaxWebauthnLogin(AjaxLogin $event): void
{
// Load plugin language files
$this->loadLanguage();

$session = $this->getApplication()->getSession();
$returnUrl = $session->get('plg_system_webauthn.returnUrl', Uri::base());
$userId = $session->get('plg_system_webauthn.userId', 0);
Expand Down
Loading