diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 27b6d831e85ae..2e5cc541915e6 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -91,6 +91,12 @@ 'native_function_invocation' => ['include' => ['@compiler_optimized']], // Adds null to type declarations when parameter have a default null value 'nullable_type_declaration_for_default_null_value' => true, + // Removes unneeded parentheses around control statements + 'no_unneeded_control_parentheses' => true, + // Using isset($var) && multiple times should be done in one call. + 'combine_consecutive_issets' => true, + // Calling unset on multiple items should be done in one call + 'combine_consecutive_unsets' => true, ] ) ->setFinder($finder); diff --git a/administrator/components/com_associations/src/Helper/AssociationsHelper.php b/administrator/components/com_associations/src/Helper/AssociationsHelper.php index 098a7ac90fbec..6f591141a919e 100644 --- a/administrator/components/com_associations/src/Helper/AssociationsHelper.php +++ b/administrator/components/com_associations/src/Helper/AssociationsHelper.php @@ -193,7 +193,7 @@ private static function getExtensionHelperClassName($extensionName) */ private static function getExtensionRealName($extensionName) { - return !str_contains($extensionName, 'com_') ? $extensionName : substr($extensionName, 4); + return !str_starts_with($extensionName, 'com_') ? $extensionName : substr($extensionName, 4); } /** @@ -593,7 +593,7 @@ public static function canCheckinItem($extensionName, $typeName, $itemId) $userId = Factory::getUser()->id; - return ($item->{$checkedOutFieldName} == $userId || $item->{$checkedOutFieldName} == 0); + return $item->{$checkedOutFieldName} == $userId || $item->{$checkedOutFieldName} == 0; } /** diff --git a/administrator/components/com_associations/src/View/Associations/HtmlView.php b/administrator/components/com_associations/src/View/Associations/HtmlView.php index 24d4b40151928..591a852c9a35b 100644 --- a/administrator/components/com_associations/src/View/Associations/HtmlView.php +++ b/administrator/components/com_associations/src/View/Associations/HtmlView.php @@ -174,8 +174,7 @@ public function display($tpl = null) // Dynamic filter form. // This selectors doesn't have to activate the filter bar. - unset($this->activeFilters['itemtype']); - unset($this->activeFilters['language']); + unset($this->activeFilters['itemtype'], $this->activeFilters['language']); // Remove filters options depending on selected type. if (empty($support['state'])) { @@ -249,7 +248,7 @@ protected function addToolbar() { $user = $this->getCurrentUser(); - if (isset($this->typeName) && isset($this->extensionName)) { + if (isset($this->typeName, $this->extensionName)) { $helper = AssociationsHelper::getExtensionHelper($this->extensionName); $title = $helper->getTypeTitle($this->typeName); diff --git a/administrator/components/com_banners/src/Table/BannerTable.php b/administrator/components/com_banners/src/Table/BannerTable.php index bd3968945314b..6c6f1d71168e7 100644 --- a/administrator/components/com_banners/src/Table/BannerTable.php +++ b/administrator/components/com_banners/src/Table/BannerTable.php @@ -57,6 +57,7 @@ public function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher $this->created = Factory::getDate()->toSql(); $this->setColumnAlias('published', 'state'); + $this->setColumnAlias('title', 'name'); } /** diff --git a/administrator/components/com_categories/src/Controller/CategoryController.php b/administrator/components/com_categories/src/Controller/CategoryController.php index a3809aca8f77f..c10bc37a213b8 100644 --- a/administrator/components/com_categories/src/Controller/CategoryController.php +++ b/administrator/components/com_categories/src/Controller/CategoryController.php @@ -76,7 +76,7 @@ protected function allowAdd($data = []) { $user = $this->app->getIdentity(); - return ($user->authorise('core.create', $this->extension) || \count($user->getAuthorisedCategories($this->extension, 'core.create'))); + return $user->authorise('core.create', $this->extension) || \count($user->getAuthorisedCategories($this->extension, 'core.create')); } /** diff --git a/administrator/components/com_checkin/src/Model/CheckinModel.php b/administrator/components/com_checkin/src/Model/CheckinModel.php index 50e663de3accb..d468199f9c0e1 100644 --- a/administrator/components/com_checkin/src/Model/CheckinModel.php +++ b/administrator/components/com_checkin/src/Model/CheckinModel.php @@ -102,7 +102,7 @@ public function checkin($ids = []) $fields = $db->getTableColumns($tn, false); - if (!(isset($fields['checked_out']) && isset($fields['checked_out_time']))) { + if (!(isset($fields['checked_out'], $fields['checked_out_time']))) { continue; } @@ -183,7 +183,7 @@ public function getItems() $fields = $db->getTableColumns($tn, false); - if (!(isset($fields['checked_out']) && isset($fields['checked_out_time']))) { + if (!(isset($fields['checked_out'], $fields['checked_out_time']))) { continue; } diff --git a/administrator/components/com_config/src/Controller/ComponentController.php b/administrator/components/com_config/src/Controller/ComponentController.php index f7abd791c87c2..5de8a17b39c7b 100644 --- a/administrator/components/com_config/src/Controller/ComponentController.php +++ b/administrator/components/com_config/src/Controller/ComponentController.php @@ -86,7 +86,7 @@ public function save($key = null, $urlVar = null) } // Remove the permissions rules data if user isn't allowed to edit them. - if (!$user->authorise('core.admin', $option) && isset($data['params']) && isset($data['params']['rules'])) { + if (!$user->authorise('core.admin', $option) && isset($data['params']['rules'])) { unset($data['params']['rules']); } diff --git a/administrator/components/com_config/src/Model/ComponentModel.php b/administrator/components/com_config/src/Model/ComponentModel.php index 17554c5791631..0a80503e4e836 100644 --- a/administrator/components/com_config/src/Model/ComponentModel.php +++ b/administrator/components/com_config/src/Model/ComponentModel.php @@ -201,8 +201,7 @@ public function save($data) } // We don't need this anymore - unset($data['option']); - unset($data['params']['rules']); + unset($data['option'], $data['params']['rules']); } // Load the previous Data diff --git a/administrator/components/com_contact/src/Extension/ContactComponent.php b/administrator/components/com_contact/src/Extension/ContactComponent.php index 7016c7503687a..73d1ed69cde8e 100644 --- a/administrator/components/com_contact/src/Extension/ContactComponent.php +++ b/administrator/components/com_contact/src/Extension/ContactComponent.php @@ -142,7 +142,7 @@ public function getContexts(): array */ protected function getTableNameForSection(?string $section = null) { - return ($section === 'category' ? 'categories' : 'contact_details'); + return $section === 'category' ? 'categories' : 'contact_details'; } /** diff --git a/administrator/components/com_content/src/Model/ArticleModel.php b/administrator/components/com_content/src/Model/ArticleModel.php index aa438b6852164..46f4bca0be414 100644 --- a/administrator/components/com_content/src/Model/ArticleModel.php +++ b/administrator/components/com_content/src/Model/ArticleModel.php @@ -649,7 +649,7 @@ public function save($data) $input = $app->getInput(); $filter = InputFilter::getInstance(); - if (isset($data['metadata']) && isset($data['metadata']['author'])) { + if (isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); } diff --git a/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php b/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php index fa56bd3587465..aa501e65ce981 100644 --- a/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php +++ b/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php @@ -189,7 +189,7 @@ public static function getLookupValue($lookup, $value) { $result = false; - if (isset($lookup->sourceColumn) && isset($lookup->targetTable) && isset($lookup->targetColumn) && isset($lookup->displayColumn)) { + if (isset($lookup->sourceColumn, $lookup->targetTable, $lookup->targetColumn, $lookup->displayColumn)) { $db = Factory::getDbo(); $value = (int) $value; $query = $db->getQuery(true); diff --git a/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php b/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php index 3e8bc11296dd2..bc861c51637d0 100644 --- a/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php +++ b/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php @@ -69,7 +69,7 @@ public function display($tpl = null) $parts = explode('.', $dashboard); $component = $parts[0]; - if (!str_contains($component, 'com_')) { + if (!str_starts_with($component, 'com_')) { $component = 'com_' . $component; } diff --git a/administrator/components/com_fields/src/Model/FieldModel.php b/administrator/components/com_fields/src/Model/FieldModel.php index ec1a19ef7df59..db44abc384813 100644 --- a/administrator/components/com_fields/src/Model/FieldModel.php +++ b/administrator/components/com_fields/src/Model/FieldModel.php @@ -229,7 +229,7 @@ public function save($data) */ if ( $field && \in_array($field->type, ['list', 'checkboxes', 'radio'], true) - && isset($data['fieldparams']['options']) && isset($field->fieldparams['options']) + && isset($data['fieldparams']['options'], $field->fieldparams['options']) ) { $oldParams = $this->getParams($field->fieldparams['options']); $newParams = $this->getParams($data['fieldparams']['options']); @@ -1168,6 +1168,16 @@ protected function batchCopy($value, $pks, $contexts) foreach ($pks as $pk) { if ($user->authorise('core.create', $component . '.fieldgroup.' . $value)) { + // Find all assigned categories to this field + $db = $this->getDatabase(); + $query = $db->getQuery(true); + + $query->select($db->quoteName('category_id')) + ->from($db->quoteName('#__fields_categories')) + ->where($db->quoteName('field_id') . ' = ' . (int) $pk); + + $assignedCatIds = $db->setQuery($query)->loadColumn(); + $table->reset(); $table->load($pk); @@ -1194,6 +1204,17 @@ protected function batchCopy($value, $pks, $contexts) // Get the new item ID $newId = $table->id; + // Inset the assigned categories + if (!empty($assignedCatIds)) { + $tuple = new \stdClass(); + $tuple->field_id = $newId; + + foreach ($assignedCatIds as $catId) { + $tuple->category_id = $catId; + $db->insertObject('#__fields_categories', $tuple); + } + } + // Add the new ID to the array $newIds[$pk] = $newId; } else { diff --git a/administrator/components/com_fields/src/Model/GroupModel.php b/administrator/components/com_fields/src/Model/GroupModel.php index 69caf97134ff0..196b956b0d73d 100644 --- a/administrator/components/com_fields/src/Model/GroupModel.php +++ b/administrator/components/com_fields/src/Model/GroupModel.php @@ -120,14 +120,13 @@ public function getForm($data = [], $loadData = true) return false; } - // Modify the form based on Edit State access controls. - if (empty($data['context'])) { - $data['context'] = $context; - } + $record = new \stdClass(); + $record->context = $context; + $record->id = $jinput->get('id'); $user = $this->getCurrentUser(); - if (!$user->authorise('core.edit.state', $context . '.fieldgroup.' . $jinput->get('id'))) { + if (!$this->canEditState($record)) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('state', 'disabled', 'true'); @@ -160,7 +159,9 @@ protected function canDelete($record) return false; } - return $this->getCurrentUser()->authorise('core.delete', $record->context . '.fieldgroup.' . (int) $record->id); + $component = explode('.', $record->context)[0]; + + return $this->getCurrentUser()->authorise('core.delete', $component . '.fieldgroup.' . (int) $record->id); } /** @@ -177,13 +178,15 @@ protected function canEditState($record) { $user = $this->getCurrentUser(); + $component = explode('.', $record->context)[0]; + // Check for existing fieldgroup. if (!empty($record->id)) { - return $user->authorise('core.edit.state', $record->context . '.fieldgroup.' . (int) $record->id); + return $user->authorise('core.edit.state', $component . '.fieldgroup.' . (int) $record->id); } // Default to component settings. - return $user->authorise('core.edit.state', $record->context); + return $user->authorise('core.edit.state', $component); } /** diff --git a/administrator/components/com_installer/src/Controller/ManageController.php b/administrator/components/com_installer/src/Controller/ManageController.php index 27cb7b9cd4656..1cff966e77d0e 100644 --- a/administrator/components/com_installer/src/Controller/ManageController.php +++ b/administrator/components/com_installer/src/Controller/ManageController.php @@ -173,7 +173,7 @@ public function loadChangelog() $output = $model->loadChangelog($eid, $source); - echo (new JsonResponse($output)); + echo new JsonResponse($output); } /** diff --git a/administrator/components/com_joomlaupdate/extract.php b/administrator/components/com_joomlaupdate/extract.php index 0e50bbdeb71b5..bb9e73156ecdd 100644 --- a/administrator/components/com_joomlaupdate/extract.php +++ b/administrator/components/com_joomlaupdate/extract.php @@ -1956,7 +1956,7 @@ function setHugeMemoryLimit() @unlink($basePath . 'update.php'); // Import a custom finalisation file - $filename = \dirname(__FILE__) . '/finalisation.php'; + $filename = __DIR__ . '/finalisation.php'; if (file_exists($filename)) { clearFileInOPCache($filename); diff --git a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php index 029dd990cd613..f9e4bea9f7b3f 100644 --- a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php +++ b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php @@ -1415,9 +1415,7 @@ public function getNonCoreExtensions() $decode = json_decode($extension->manifest_cache); // Remove unused fields so they do not cause javascript errors during pre-update check - unset($decode->description); - unset($decode->copyright); - unset($decode->creationDate); + unset($decode->description, $decode->copyright, $decode->creationDate); $this->translateExtensionName($extension); $extension->version @@ -1476,9 +1474,7 @@ public function getNonCorePlugins($folderFilter = ['system', 'user', 'authentica $decode = json_decode($plugin->manifest_cache); // Remove unused fields so they do not cause javascript errors during pre-update check - unset($decode->description); - unset($decode->copyright); - unset($decode->creationDate); + unset($decode->description, $decode->copyright, $decode->creationDate); $this->translateExtensionName($plugin); $plugin->version = $decode->version ?? Text::_('COM_JOOMLAUPDATE_PREUPDATE_UNKNOWN_EXTENSION_MANIFESTCACHE_VERSION'); diff --git a/administrator/components/com_mails/src/Helper/MailsHelper.php b/administrator/components/com_mails/src/Helper/MailsHelper.php index 61405818dc953..542623d0c62a7 100644 --- a/administrator/components/com_mails/src/Helper/MailsHelper.php +++ b/administrator/components/com_mails/src/Helper/MailsHelper.php @@ -75,7 +75,7 @@ public static function loadTranslationFiles($extension, $language = 'en-GB') return; } - $lang = Factory::getLanguage(); + $lang = Factory::getApplication()->getLanguage(); $source = ''; switch (substr($extension, 0, 3)) { @@ -83,8 +83,8 @@ public static function loadTranslationFiles($extension, $language = 'en-GB') default: $source = JPATH_ADMINISTRATOR . '/components/' . $extension; - $lang->load($extension, JPATH_BASE, $language, true) - || $lang->load($extension, JPATH_BASE . '/components/' . $extension, $language, true); + $lang->load($extension, JPATH_SITE, $language, true) + || $lang->load($extension, JPATH_SITE . '/components/' . $extension, $language, true); break; diff --git a/administrator/components/com_menus/src/Model/ItemModel.php b/administrator/components/com_menus/src/Model/ItemModel.php index a012cc94b3269..3b4d4ba88d0d0 100644 --- a/administrator/components/com_menus/src/Model/ItemModel.php +++ b/administrator/components/com_menus/src/Model/ItemModel.php @@ -567,7 +567,7 @@ protected function loadFormData() // Only merge if there is a session and itemId or itemid is null. if ( - isset($sessionData['id']) && isset($itemData['id']) && $sessionData['id'] === $itemData['id'] + isset($sessionData['id'], $itemData['id']) && $sessionData['id'] === $itemData['id'] || \is_null($itemData['id']) ) { $data = array_merge($itemData, $sessionData); diff --git a/administrator/components/com_menus/src/Model/MenutypesModel.php b/administrator/components/com_menus/src/Model/MenutypesModel.php index 5fa7c17fbb8bd..2f9a826a0b0f5 100644 --- a/administrator/components/com_menus/src/Model/MenutypesModel.php +++ b/administrator/components/com_menus/src/Model/MenutypesModel.php @@ -537,8 +537,7 @@ protected function getTypeOptionsFromLayouts($component, $view) // If the view is hidden from the menu, discard it and move on to the next view. if (!empty($menu['hidden']) && $menu['hidden'] == 'true') { - unset($xml); - unset($o); + unset($xml, $o); continue; } diff --git a/administrator/components/com_modules/src/View/Modules/HtmlView.php b/administrator/components/com_modules/src/View/Modules/HtmlView.php index 87eb4cfa73fe7..f66002c263416 100644 --- a/administrator/components/com_modules/src/View/Modules/HtmlView.php +++ b/administrator/components/com_modules/src/View/Modules/HtmlView.php @@ -156,8 +156,7 @@ public function display($tpl = null) // If in the frontend state and language should not activate the search tools. if (Factory::getApplication()->isClient('site')) { - unset($this->activeFilters['state']); - unset($this->activeFilters['language']); + unset($this->activeFilters['state'], $this->activeFilters['language']); } } diff --git a/administrator/components/com_postinstall/src/Helper/PostinstallHelper.php b/administrator/components/com_postinstall/src/Helper/PostinstallHelper.php index 59838745fbb0f..b41667da25a2c 100644 --- a/administrator/components/com_postinstall/src/Helper/PostinstallHelper.php +++ b/administrator/components/com_postinstall/src/Helper/PostinstallHelper.php @@ -32,9 +32,9 @@ class PostinstallHelper */ public function parsePath($path) { - if (str_contains($path, 'site://')) { + if (str_starts_with($path, 'site://')) { $path = JPATH_ROOT . str_replace('site://', '/', $path); - } elseif (str_contains($path, 'admin://')) { + } elseif (str_starts_with($path, 'admin://')) { $path = JPATH_ADMINISTRATOR . str_replace('admin://', '/', $path); } diff --git a/administrator/components/com_templates/src/Model/TemplateModel.php b/administrator/components/com_templates/src/Model/TemplateModel.php index f62fe8495a0e5..52fafd50b8b27 100644 --- a/administrator/components/com_templates/src/Model/TemplateModel.php +++ b/administrator/components/com_templates/src/Model/TemplateModel.php @@ -701,7 +701,7 @@ public function checkNewName() ->bind(':name', $name); $db->setQuery($query); - return ($db->loadResult() == 0); + return $db->loadResult() == 0; } /** @@ -2002,15 +2002,17 @@ public function child() } $user = $this->getCurrentUser(); - unset($xml->languages); - unset($xml->media); - unset($xml->files); - unset($xml->parent); - unset($xml->inheritable); // Remove the update parts - unset($xml->update); - unset($xml->updateservers); + unset( + $xml->languages, + $xml->media, + $xml->files, + $xml->parent, + $xml->inheritable, + $xml->update, + $xml->updateservers + ); if (isset($xml->creationDate)) { $xml->creationDate = (new Date('now'))->format('F Y'); diff --git a/administrator/components/com_users/src/Controller/GroupController.php b/administrator/components/com_users/src/Controller/GroupController.php index f3e0d4cb0e5b2..e8a47efc2b232 100644 --- a/administrator/components/com_users/src/Controller/GroupController.php +++ b/administrator/components/com_users/src/Controller/GroupController.php @@ -44,7 +44,7 @@ class GroupController extends FormController */ protected function allowSave($data, $key = 'id') { - return ($this->app->getIdentity()->authorise('core.admin', $this->option) && parent::allowSave($data, $key)); + return $this->app->getIdentity()->authorise('core.admin', $this->option) && parent::allowSave($data, $key); } /** diff --git a/administrator/components/com_users/src/Controller/LevelController.php b/administrator/components/com_users/src/Controller/LevelController.php index f4d36c7a69fa7..a16fc20e4c7eb 100644 --- a/administrator/components/com_users/src/Controller/LevelController.php +++ b/administrator/components/com_users/src/Controller/LevelController.php @@ -47,7 +47,7 @@ class LevelController extends FormController */ protected function allowSave($data, $key = 'id') { - return ($this->app->getIdentity()->authorise('core.admin', $this->option) && parent::allowSave($data, $key)); + return $this->app->getIdentity()->authorise('core.admin', $this->option) && parent::allowSave($data, $key); } /** diff --git a/administrator/index.php b/administrator/index.php index c47e4bb494d0a..480d1fce34f93 100644 --- a/administrator/index.php +++ b/administrator/index.php @@ -29,4 +29,4 @@ \define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once \dirname(__FILE__) . '/includes/app.php'; +require_once __DIR__ . '/includes/app.php'; diff --git a/administrator/modules/mod_feed/src/Helper/FeedHelper.php b/administrator/modules/mod_feed/src/Helper/FeedHelper.php index 7a50805cd27f1..6aeb39f618417 100644 --- a/administrator/modules/mod_feed/src/Helper/FeedHelper.php +++ b/administrator/modules/mod_feed/src/Helper/FeedHelper.php @@ -43,7 +43,7 @@ public function getFeedData(Registry $params, FeedFactory $feed): \Joomla\CMS\Fe // Get RSS parsed object try { $rssDoc = $feed->getFeed($rssurl); - } catch (\Exception $e) { + } catch (\Exception) { return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED'); } diff --git a/administrator/modules/mod_menu/src/Menu/CssMenu.php b/administrator/modules/mod_menu/src/Menu/CssMenu.php index ab3459891e731..7fe5e1eb4b1f6 100644 --- a/administrator/modules/mod_menu/src/Menu/CssMenu.php +++ b/administrator/modules/mod_menu/src/Menu/CssMenu.php @@ -236,7 +236,7 @@ protected function check($node, Registry $params) $table->load(['menutype' => $menutype]); - $menutype = isset($table->title) ? $table->title : $menutype; + $menutype = $table->title ?? $menutype; $message = Text::sprintf('MOD_MENU_IMPORTANT_ITEMS_INACCESSIBLE_LIST_WARNING', $menutype, implode(', ', $missing), $uri); $this->application->enqueueMessage($message, 'warning'); @@ -284,8 +284,8 @@ protected function preprocess($parent) continue; } - $item->scope = $item->scope ?? 'default'; - $item->icon = $item->icon ?? ''; + $item->scope ??= 'default'; + $item->icon ??= ''; // Whether this scope can be displayed. Applies only to preset items. Db driven items should use un/published state. if (($item->scope === 'help' && $this->params->get('showhelp', 1) == 0) || ($item->scope === 'edit' && !$this->params->get('shownew', 1))) { @@ -353,7 +353,7 @@ protected function preprocess($parent) continue; } - list($assetName) = isset($query['context']) ? explode('.', $query['context'], 2) : ['com_fields']; + [$assetName] = isset($query['context']) ? explode('.', $query['context'], 2) : ['com_fields']; } elseif ($item->element === 'com_cpanel' && $item->link === 'index.php') { continue; } elseif ( @@ -382,7 +382,7 @@ protected function preprocess($parent) continue; } - list($assetName) = isset($query['extension']) ? explode('.', $query['extension'], 2) : ['com_workflow']; + [$assetName] = isset($query['extension']) ? explode('.', $query['extension'], 2) : ['com_workflow']; } elseif (\in_array($item->element, ['com_config', 'com_privacy', 'com_actionlogs'], true) && !$user->authorise('core.admin')) { // Special case for components which only allow super user access $parent->removeChild($item); diff --git a/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php b/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php index 7e61ff13bbc9d..e222594ae625e 100644 --- a/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php +++ b/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php @@ -50,7 +50,7 @@ public static function getData() try { return $db->loadObjectList(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return []; } } diff --git a/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php b/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php index 778e4cba0ad81..4ee2df3276851 100644 --- a/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php +++ b/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php @@ -96,7 +96,7 @@ public function getStatsData(Registry $params, CMSApplication $app, DatabaseInte try { $items = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $items = false; } @@ -131,7 +131,7 @@ public function getStatsData(Registry $params, CMSApplication $app, DatabaseInte foreach ($arrays as $response) { foreach ($response as $row) { // We only add a row if the title and data are given - if (isset($row['title']) && isset($row['data'])) { + if (isset($row['title'], $row['data'])) { $rows[$i] = new \stdClass(); $rows[$i]->title = $row['title']; $rows[$i]->icon = $row['icon'] ?? 'info'; diff --git a/api/components/com_languages/src/View/Overrides/JsonapiView.php b/api/components/com_languages/src/View/Overrides/JsonapiView.php index 8d5ab5ee72322..a60022fe40aef 100644 --- a/api/components/com_languages/src/View/Overrides/JsonapiView.php +++ b/api/components/com_languages/src/View/Overrides/JsonapiView.php @@ -97,8 +97,7 @@ protected function prepareItem($item) { $item->id = $item->key; $item->value = $item->override; - unset($item->key); - unset($item->override); + unset($item->key, $item->override); return parent::prepareItem($item); } diff --git a/api/components/com_media/src/Controller/MediaController.php b/api/components/com_media/src/Controller/MediaController.php index ed21098dc32bf..328e56819a283 100644 --- a/api/components/com_media/src/Controller/MediaController.php +++ b/api/components/com_media/src/Controller/MediaController.php @@ -212,7 +212,7 @@ public function add(): void } // Content is only required when it is a file - if (empty($content) && strpos($path, '.') !== false) { + if (empty($content) && str_contains($path, '.')) { $missingParameters[] = 'content'; } diff --git a/api/components/com_media/src/Model/AdapterModel.php b/api/components/com_media/src/Model/AdapterModel.php index 34e731578acfd..70b6d2b2837d0 100644 --- a/api/components/com_media/src/Model/AdapterModel.php +++ b/api/components/com_media/src/Model/AdapterModel.php @@ -35,7 +35,7 @@ class AdapterModel extends BaseModel */ public function getItem(): \stdClass { - list($provider, $account) = array_pad(explode('-', $this->getState('id'), 2), 2, null); + [$provider, $account] = array_pad(explode('-', $this->getState('id'), 2), 2, null); if ($account === null) { throw new \Exception('Account was not set'); diff --git a/api/components/com_media/src/Model/MediaModel.php b/api/components/com_media/src/Model/MediaModel.php index 6b9e00afca441..445478803d6b1 100644 --- a/api/components/com_media/src/Model/MediaModel.php +++ b/api/components/com_media/src/Model/MediaModel.php @@ -77,7 +77,7 @@ public function getItems(): array ['adapter' => $adapterName, 'path' => $path] = $this->resolveAdapterAndPath($this->getState('path', '')); try { $files = $this->mediaApiModel->getFiles($adapterName, $path, $options); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { throw new ResourceNotFound( Text::sprintf('WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', $path), 404 diff --git a/api/components/com_media/src/Model/MediumModel.php b/api/components/com_media/src/Model/MediumModel.php index dcf2df8fe96d6..0b0025ec8d2c5 100644 --- a/api/components/com_media/src/Model/MediumModel.php +++ b/api/components/com_media/src/Model/MediumModel.php @@ -69,7 +69,7 @@ public function getItem() try { return $this->mediaApiModel->getFile($adapterName, $path, $options); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { throw new ResourceNotFound( Text::sprintf('WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', $path), 404 @@ -121,7 +121,7 @@ public function save($path = null): string $this->mediaApiModel->move($adapterName, $oldPath, $path, $override), '/' ); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { throw new Save( Text::sprintf( 'WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', @@ -159,7 +159,7 @@ public function save($path = null): string ); $resultPath = $dirname . '/' . $name; - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { throw new Save( Text::sprintf( 'WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', @@ -167,7 +167,7 @@ public function save($path = null): string ), 404 ); - } catch (FileExistsException $e) { + } catch (FileExistsException) { throw new Save( Text::sprintf( 'WEBSERVICE_COM_MEDIA_FILE_EXISTS', @@ -175,7 +175,7 @@ public function save($path = null): string ), 400 ); - } catch (InvalidPathException $e) { + } catch (InvalidPathException) { throw new Save( Text::sprintf( 'WEBSERVICE_COM_MEDIA_BAD_FILE_TYPE', @@ -201,7 +201,7 @@ public function save($path = null): string $dirname, $content ); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { throw new Save( Text::sprintf( 'WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', @@ -209,7 +209,7 @@ public function save($path = null): string ), 404 ); - } catch (InvalidPathException $e) { + } catch (InvalidPathException) { throw new Save( Text::sprintf( 'WEBSERVICE_COM_MEDIA_BAD_FILE_TYPE', @@ -250,7 +250,7 @@ public function delete(): void try { $this->mediaApiModel->delete($adapterName, $path); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { throw new Save( Text::sprintf('WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', $path), 404 diff --git a/api/index.php b/api/index.php index 3785e00f2cf5c..39b7bd8adceda 100644 --- a/api/index.php +++ b/api/index.php @@ -28,4 +28,4 @@ \define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once \dirname(__FILE__) . '/includes/app.php'; +require_once __DIR__ . '/includes/app.php'; diff --git a/build/media_source/com_media/scss/components/_media-breadcrumb.scss b/build/media_source/com_media/scss/components/_media-breadcrumb.scss index cb2076fba6280..67bbb738feb51 100644 --- a/build/media_source/com_media/scss/components/_media-breadcrumb.scss +++ b/build/media_source/com_media/scss/components/_media-breadcrumb.scss @@ -34,9 +34,8 @@ a { color: var(--body-color); } - &::before, &::after { - border: none; + border-inline-start-color: $breadcrumbs-current-bg; } } &:hover { @@ -62,7 +61,7 @@ border-inline-start: 10px solid transparent; } &::before { - border-inline-start-color: $border-color; + border-inline-start-color: var(--gray-400); } &::after { border-inline-start-color: $breadcrumbs-bg; diff --git a/build/media_source/vendor/bootstrap/js/carousel.es6.js b/build/media_source/vendor/bootstrap/js/carousel.es6.js index b1b521cb1c6b5..53e7523ee3d48 100644 --- a/build/media_source/vendor/bootstrap/js/carousel.es6.js +++ b/build/media_source/vendor/bootstrap/js/carousel.es6.js @@ -4,21 +4,12 @@ window.bootstrap = window.bootstrap || {}; window.bootstrap.Carousel = Carousel; if (Joomla && Joomla.getOptions) { - // Get the elements/configurations from the PHP + // Get the elements configuration from PHP const carousels = Joomla.getOptions('bootstrap.carousel'); - // Initialise the elements + if (typeof carousels === 'object' && carousels !== null) { Object.keys(carousels).forEach((carousel) => { - const opt = carousels[carousel]; - const options = { - interval: opt.interval ? opt.interval : 5000, - keyboard: opt.keyboard ? opt.keyboard : true, - pause: opt.pause ? opt.pause : 'hover', - slide: opt.slide ? opt.slide : false, - wrap: opt.wrap ? opt.wrap : true, - touch: opt.touch ? opt.touch : true, - }; - + const options = carousels[carousel]; const elements = Array.from(document.querySelectorAll(carousel)); if (elements.length) { elements.map((el) => new window.bootstrap.Carousel(el, options)); diff --git a/components/com_contact/forms/contact.xml b/components/com_contact/forms/contact.xml index 98f2ee0d4806d..f97f6593ebcd0 100644 --- a/components/com_contact/forms/contact.xml +++ b/components/com_contact/forms/contact.xml @@ -58,7 +58,6 @@ type="checkbox" label="COM_CONTACT_CONTACT_EMAIL_A_COPY_LABEL" id="contact-email-copy" - default="0" /> diff --git a/components/com_contact/src/Controller/ContactController.php b/components/com_contact/src/Controller/ContactController.php index 3f7b94cc8e718..e651119c26e7a 100644 --- a/components/com_contact/src/Controller/ContactController.php +++ b/components/com_contact/src/Controller/ContactController.php @@ -364,7 +364,7 @@ protected function allowEdit($data = [], $key = 'id') // Fallback on edit.own. if ($user->authorise('core.edit.own', $this->option . '.category.' . $categoryId)) { - return ($record->created_by === $user->id); + return $record->created_by === $user->id; } return false; diff --git a/components/com_content/helpers/icon.php b/components/com_content/helpers/icon.php index 46d76acccbb77..9906ef941646a 100644 --- a/components/com_content/helpers/icon.php +++ b/components/com_content/helpers/icon.php @@ -125,6 +125,6 @@ public static function print_screen($article, $params, $attribs = [], $legacy = */ private static function getIcon() { - return (new \Joomla\Component\Content\Administrator\Service\HTML\Icon(Joomla\CMS\Factory::getApplication())); + return new \Joomla\Component\Content\Administrator\Service\HTML\Icon(Joomla\CMS\Factory::getApplication()); } } diff --git a/components/com_content/src/View/Category/HtmlView.php b/components/com_content/src/View/Category/HtmlView.php index 52bbecd7acfba..4bc55bd439c23 100644 --- a/components/com_content/src/View/Category/HtmlView.php +++ b/components/com_content/src/View/Category/HtmlView.php @@ -167,10 +167,6 @@ public function display($tpl = null) $this->category->metadata = new Registry($this->category->metadata); } - if (($app->get('MetaAuthor') == '1') && $this->category->get('author', '')) { - $this->getDocument()->setMetaData('author', $this->category->get('author', '')); - } - $mdata = $this->category->metadata->toArray(); foreach ($mdata as $k => $v) { diff --git a/components/com_finder/src/Model/SearchModel.php b/components/com_finder/src/Model/SearchModel.php index 746585e01c894..959de428f23cf 100644 --- a/components/com_finder/src/Model/SearchModel.php +++ b/components/com_finder/src/Model/SearchModel.php @@ -543,7 +543,7 @@ protected function populateState($ordering = null, $direction = null) $this->setState('list.ordering', 'l.sale_price'); break; - case ($order === 'relevance' && !empty($this->includedTerms)): + case $order === 'relevance' && !empty($this->includedTerms): $this->setState('list.ordering', 'm.weight'); break; diff --git a/components/com_finder/src/Service/Router.php b/components/com_finder/src/Service/Router.php index 108af7642a430..4baa969a22930 100644 --- a/components/com_finder/src/Service/Router.php +++ b/components/com_finder/src/Service/Router.php @@ -66,7 +66,7 @@ public function build(&$query) if (isset($query['Itemid'])) { $item = $this->menu->getItem($query['Itemid']); - if ($query['option'] == 'com_finder' && isset($query['f']) && isset($item->query['f']) && $query['f'] == $item->query['f']) { + if ($query['option'] == 'com_finder' && isset($query['f'], $item->query['f']) && $query['f'] == $item->query['f']) { unset($query['f']); } } diff --git a/components/com_finder/src/View/Search/HtmlView.php b/components/com_finder/src/View/Search/HtmlView.php index 9178f9deffa21..f9195cda974de 100644 --- a/components/com_finder/src/View/Search/HtmlView.php +++ b/components/com_finder/src/View/Search/HtmlView.php @@ -299,7 +299,7 @@ protected function getLayoutFile($layout = null) $filetofind = $this->_createFileName('template', ['name' => $file]); $exists = Path::find($this->_path['template'], $filetofind); - return ($exists ? $layout : 'result'); + return $exists ? $layout : 'result'; } /** diff --git a/components/com_privacy/src/Dispatcher/Dispatcher.php b/components/com_privacy/src/Dispatcher/Dispatcher.php index d1f2b84c48b5d..66d8e44008a3f 100644 --- a/components/com_privacy/src/Dispatcher/Dispatcher.php +++ b/components/com_privacy/src/Dispatcher/Dispatcher.php @@ -36,6 +36,16 @@ protected function checkAccess() parent::checkAccess(); $view = $this->input->get('view'); + $task = $this->input->get('task', 'display'); + + // Ignore any-non-"display" tasks + if (str_contains($task, '.')) { + $task = explode('.', $task)[1]; + } + + if ($task !== 'display') { + return; + } // Submitting information requests and confirmation through the frontend is restricted to authenticated users at this time if (\in_array($view, ['confirm', 'request']) && $this->app->getIdentity()->guest) { diff --git a/components/com_tags/src/Service/Router.php b/components/com_tags/src/Service/Router.php index 46723299c389c..3f49973737316 100644 --- a/components/com_tags/src/Service/Router.php +++ b/components/com_tags/src/Service/Router.php @@ -144,7 +144,7 @@ public function preprocess($query) foreach (array_unique([$lang, '*']) as $language) { if (isset($query['view']) && $query['view'] === 'tags') { - if (isset($query['parent_id']) && isset($this->lookup[$language]['tags'][$query['parent_id']])) { + if (isset($query['parent_id'], $this->lookup[$language]['tags'][$query['parent_id']])) { $query['Itemid'] = $this->lookup[$language]['tags'][$query['parent_id']]; break; } diff --git a/components/com_users/src/Dispatcher/Dispatcher.php b/components/com_users/src/Dispatcher/Dispatcher.php index e5d04442e9fbb..49f77c6da9f80 100644 --- a/components/com_users/src/Dispatcher/Dispatcher.php +++ b/components/com_users/src/Dispatcher/Dispatcher.php @@ -38,6 +38,16 @@ protected function checkAccess() $view = $this->input->get('view'); $user = $this->app->getIdentity(); + $task = $this->input->get('task', 'display'); + + // Ignore any-non-"display" tasks + if (str_contains($task, '.')) { + $task = explode('.', $task)[1]; + } + + if ($task !== 'display') { + return; + } // Do any specific processing by view. switch ($view) { diff --git a/components/com_users/src/View/Profile/HtmlView.php b/components/com_users/src/View/Profile/HtmlView.php index a07f3a9a0fcb5..651e27819105e 100644 --- a/components/com_users/src/View/Profile/HtmlView.php +++ b/components/com_users/src/View/Profile/HtmlView.php @@ -141,8 +141,8 @@ public function display($tpl = null) $active = Factory::getApplication()->getMenu()->getActive(); if ( - $active && isset($active->query['layout']) - && isset($active->query['option']) && $active->query['option'] === 'com_users' + $active && isset($active->query['layout'], $active->query['option']) + && $active->query['option'] === 'com_users' && isset($active->query['view']) && $active->query['view'] === 'profile' ) { $this->setLayout($active->query['layout']); diff --git a/index.php b/index.php index 85daa024dce05..0ce8bceb9aef4 100644 --- a/index.php +++ b/index.php @@ -29,4 +29,4 @@ define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once dirname(__FILE__) . '/includes/app.php'; +require_once __DIR__ . '/includes/app.php'; diff --git a/installation/index.php b/installation/index.php index 163297bc31829..099e5daf1d835 100644 --- a/installation/index.php +++ b/installation/index.php @@ -29,4 +29,4 @@ \define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once \dirname(__FILE__) . '/includes/app.php'; +require_once __DIR__ . '/includes/app.php'; diff --git a/installation/joomla.php b/installation/joomla.php index 137e042651c57..6a3e8db46c2a6 100644 --- a/installation/joomla.php +++ b/installation/joomla.php @@ -36,4 +36,4 @@ \define('_JCLI_INSTALLATION', 1); // Run the application - All executable code should be triggered through this file -require_once \dirname(__FILE__) . '/includes/cli.php'; +require_once __DIR__ . '/includes/cli.php'; diff --git a/installation/language/af-ZA/langmetadata.xml b/installation/language/af-ZA/langmetadata.xml index 87ea235288772..beb80ad75cddc 100644 --- a/installation/language/af-ZA/langmetadata.xml +++ b/installation/language/af-ZA/langmetadata.xml @@ -2,7 +2,7 @@ Afrikaans (Suid-Afrika) 5.2.4 - 2025-01 + 2025-02 Afrikaans Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ar-AA/langmetadata.xml b/installation/language/ar-AA/langmetadata.xml index 312bc933aec7e..11d062d4d2b72 100644 --- a/installation/language/ar-AA/langmetadata.xml +++ b/installation/language/ar-AA/langmetadata.xml @@ -2,7 +2,7 @@ Arabic (اللغة العربية) 5.2.4 - 2025-01 + 2025-02 Dr. Ashraf Damra (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/be-BY/langmetadata.xml b/installation/language/be-BY/langmetadata.xml index 0917c772619da..495598da19988 100644 --- a/installation/language/be-BY/langmetadata.xml +++ b/installation/language/be-BY/langmetadata.xml @@ -2,7 +2,7 @@ Belarusian (Belarus) 5.2.4 - 2025-01 + 2025-02 Joomla Belarus Community (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/bg-BG/langmetadata.xml b/installation/language/bg-BG/langmetadata.xml index b3230b1202f33..0b52632117fbe 100644 --- a/installation/language/bg-BG/langmetadata.xml +++ b/installation/language/bg-BG/langmetadata.xml @@ -2,7 +2,7 @@ Bulgarian (bg-BG) 5.2.4 - 2025-01 + 2025-02 Joomla! Bulgaria (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ca-ES/langmetadata.xml b/installation/language/ca-ES/langmetadata.xml index dcf1f1d5a683d..e2a6068885567 100644 --- a/installation/language/ca-ES/langmetadata.xml +++ b/installation/language/ca-ES/langmetadata.xml @@ -2,7 +2,7 @@ Catalan (ca-ES) 5.2.4 - 2025-01 + 2025-02 Catalan [ca-ES] Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/cs-CZ/langmetadata.xml b/installation/language/cs-CZ/langmetadata.xml index e8b6ee42b938b..ef96346fde824 100644 --- a/installation/language/cs-CZ/langmetadata.xml +++ b/installation/language/cs-CZ/langmetadata.xml @@ -2,7 +2,7 @@ Czech (Čeština) 5.2.4 - 2025-01 + 2025-02 Czech Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/cy-GB/langmetadata.xml b/installation/language/cy-GB/langmetadata.xml index 3d4a4b4412fdd..1ab4ec211a797 100644 --- a/installation/language/cy-GB/langmetadata.xml +++ b/installation/language/cy-GB/langmetadata.xml @@ -2,7 +2,7 @@ Welsh (United Kingdom) 5.2.4 - 2025-01 + 2025-02 Joomla! Project - Welsh Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/da-DK/langmetadata.xml b/installation/language/da-DK/langmetadata.xml index 198e0c60ba04f..0d282cc9d3fc0 100644 --- a/installation/language/da-DK/langmetadata.xml +++ b/installation/language/da-DK/langmetadata.xml @@ -2,7 +2,7 @@ Danish (Danmark) 5.2.4 - 2025-01 + 2025-02 Danish Translation Team (Transl.: Ronny Buelund) (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/el-GR/langmetadata.xml b/installation/language/el-GR/langmetadata.xml index f9e868ca7d905..e6aa8e09f54bc 100644 --- a/installation/language/el-GR/langmetadata.xml +++ b/installation/language/el-GR/langmetadata.xml @@ -2,7 +2,7 @@ Greek (el-GR) 5.2.4 - 2025-01 + 2025-02 Ομάδα Μετάφρασης: joomla. gr (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/en-AU/langmetadata.xml b/installation/language/en-AU/langmetadata.xml index cd1091db2ab13..716f4dcfcac76 100644 --- a/installation/language/en-AU/langmetadata.xml +++ b/installation/language/en-AU/langmetadata.xml @@ -2,7 +2,7 @@ English (Australia) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/en-CA/langmetadata.xml b/installation/language/en-CA/langmetadata.xml index e104fd54dfab1..1ddb49eb31e71 100644 --- a/installation/language/en-CA/langmetadata.xml +++ b/installation/language/en-CA/langmetadata.xml @@ -2,7 +2,7 @@ English (Canada) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/en-NZ/langmetadata.xml b/installation/language/en-NZ/langmetadata.xml index 1fdcbf32ba7e8..4cbd7eb7feefc 100644 --- a/installation/language/en-NZ/langmetadata.xml +++ b/installation/language/en-NZ/langmetadata.xml @@ -2,7 +2,7 @@ English (New Zealand) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/en-US/langmetadata.xml b/installation/language/en-US/langmetadata.xml index 2fb05b7faaae0..b4231e6549fa6 100644 --- a/installation/language/en-US/langmetadata.xml +++ b/installation/language/en-US/langmetadata.xml @@ -2,7 +2,7 @@ English (United States) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/es-ES/langmetadata.xml b/installation/language/es-ES/langmetadata.xml index 1f31853ec3c0f..f7548fa04a4ba 100644 --- a/installation/language/es-ES/langmetadata.xml +++ b/installation/language/es-ES/langmetadata.xml @@ -2,7 +2,7 @@ Spanish (es-ES) 5.2.4 - 2025-01 + 2025-02 Spanish [es-ES] Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/et-EE/langmetadata.xml b/installation/language/et-EE/langmetadata.xml index 658781aefdfa3..2d4839e452c7d 100644 --- a/installation/language/et-EE/langmetadata.xml +++ b/installation/language/et-EE/langmetadata.xml @@ -2,7 +2,7 @@ Estonian 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/eu-ES/langmetadata.xml b/installation/language/eu-ES/langmetadata.xml index f5da4765ef6b6..f7f102ce0a19a 100644 --- a/installation/language/eu-ES/langmetadata.xml +++ b/installation/language/eu-ES/langmetadata.xml @@ -2,7 +2,7 @@ Basque 5.2.4 - 2025-01 + 2025-02 Joomla! Basque Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/fa-AF/langmetadata.xml b/installation/language/fa-AF/langmetadata.xml index c955e625037bc..3e0407c782651 100644 --- a/installation/language/fa-AF/langmetadata.xml +++ b/installation/language/fa-AF/langmetadata.xml @@ -2,7 +2,7 @@ فارسی (دری) 5.2.4 - 2025-01 + 2025-02 JoomlaPersian Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/fa-IR/langmetadata.xml b/installation/language/fa-IR/langmetadata.xml index f9aa2669c5a3d..a5ffc7abf612e 100644 --- a/installation/language/fa-IR/langmetadata.xml +++ b/installation/language/fa-IR/langmetadata.xml @@ -2,7 +2,7 @@ Persian (fa-IR) 5.2.4 - 2025-01 + 2025-02 Persian Translation Team: joomlafarsi.com (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/fi-FI/langmetadata.xml b/installation/language/fi-FI/langmetadata.xml index 9b9a9e1c377e2..c11a0e658e9c2 100644 --- a/installation/language/fi-FI/langmetadata.xml +++ b/installation/language/fi-FI/langmetadata.xml @@ -2,7 +2,7 @@ Finnish (Finland) 5.2.4 - 2025-01 + 2025-02 Finnish translation team: Joomla.fi (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/fr-CA/langmetadata.xml b/installation/language/fr-CA/langmetadata.xml index 1d290743932e3..22a55dd00cce7 100644 --- a/installation/language/fr-CA/langmetadata.xml +++ b/installation/language/fr-CA/langmetadata.xml @@ -2,7 +2,7 @@ French (Canada) 5.2.4 - 2025-01 + 2025-02 Joomla! Project - French translation team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/fr-FR/langmetadata.xml b/installation/language/fr-FR/langmetadata.xml index cbf2462ceadce..959bed318efd0 100644 --- a/installation/language/fr-FR/langmetadata.xml +++ b/installation/language/fr-FR/langmetadata.xml @@ -2,7 +2,7 @@ French (fr-FR) 5.2.4 - 2025-01 + 2025-02 Joomla! Project - French translation team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/he-IL/langmetadata.xml b/installation/language/he-IL/langmetadata.xml index a4f1f9a5405eb..95be50e0f5a5f 100644 --- a/installation/language/he-IL/langmetadata.xml +++ b/installation/language/he-IL/langmetadata.xml @@ -2,7 +2,7 @@ Hebrew (Israel) 5.2.4 - 2025-01 + 2025-02 פרוייקט ג'ומלה (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/hr-HR/langmetadata.xml b/installation/language/hr-HR/langmetadata.xml index eefcba0465faf..f74e65d956c94 100644 --- a/installation/language/hr-HR/langmetadata.xml +++ b/installation/language/hr-HR/langmetadata.xml @@ -2,7 +2,7 @@ Hrvatski (Hrvatska) 5.2.4 - 2025-01 + 2025-02 Joomla! Hrvatska team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/hu-HU/langmetadata.xml b/installation/language/hu-HU/langmetadata.xml index 0494262eb0384..85195b0310eb2 100644 --- a/installation/language/hu-HU/langmetadata.xml +++ b/installation/language/hu-HU/langmetadata.xml @@ -2,7 +2,7 @@ Hungarian (Magyar) 5.2.4 - 2025-01 + 2025-02 Joomla! Magyarország (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/id-ID/langmetadata.xml b/installation/language/id-ID/langmetadata.xml index f3c904ac68c97..e49661c86af1d 100644 --- a/installation/language/id-ID/langmetadata.xml +++ b/installation/language/id-ID/langmetadata.xml @@ -2,7 +2,7 @@ Bahasa Indonesia (id-ID) 5.2.4 - 2025-01 + 2025-02 Joomla! Indonesia (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/it-IT/langmetadata.xml b/installation/language/it-IT/langmetadata.xml index 202c13a7d5b6f..38b6f0c53114e 100644 --- a/installation/language/it-IT/langmetadata.xml +++ b/installation/language/it-IT/langmetadata.xml @@ -2,7 +2,7 @@ Italiano (it-IT) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (Italian Translation Team) (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ja-JP/langmetadata.xml b/installation/language/ja-JP/langmetadata.xml index 7aab7436e7bdb..f64282e13e3c5 100644 --- a/installation/language/ja-JP/langmetadata.xml +++ b/installation/language/ja-JP/langmetadata.xml @@ -2,7 +2,7 @@ Japanese (Japan) 5.2.4 - 2025-01 + 2025-02 Joomla!じゃぱん (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ka-GE/langmetadata.xml b/installation/language/ka-GE/langmetadata.xml index a119bebe45acc..065f48a22cd78 100644 --- a/installation/language/ka-GE/langmetadata.xml +++ b/installation/language/ka-GE/langmetadata.xml @@ -2,7 +2,7 @@ Georgian (Georgia) 5.2.4 - 2025-01 + 2025-02 Georgian Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/kk-KZ/langmetadata.xml b/installation/language/kk-KZ/langmetadata.xml index 904d5553513d6..7a23a063d87ce 100644 --- a/installation/language/kk-KZ/langmetadata.xml +++ b/installation/language/kk-KZ/langmetadata.xml @@ -2,7 +2,7 @@ Kazakh (Kazakhstan) 5.2.4 - 2025-01 + 2025-02 Sarvarov Akylkerey (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ko-KR/langmetadata.xml b/installation/language/ko-KR/langmetadata.xml index f7072d555eb18..5bf40d8a41a8a 100644 --- a/installation/language/ko-KR/langmetadata.xml +++ b/installation/language/ko-KR/langmetadata.xml @@ -2,7 +2,7 @@ Korean (Republic of Korea) 5.2.4 - 2025-01 + 2025-02 Joomla! 프로젝트 (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/lt-LT/langmetadata.xml b/installation/language/lt-LT/langmetadata.xml index 1314923c510ab..1c9121ad8e982 100644 --- a/installation/language/lt-LT/langmetadata.xml +++ b/installation/language/lt-LT/langmetadata.xml @@ -2,7 +2,7 @@ Lietuvių (lt-LT) 5.2.4 - 2025-01 + 2025-02 Oskaras Jankauskas (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/lv-LV/langmetadata.xml b/installation/language/lv-LV/langmetadata.xml index 6cdb2665eda9f..78d16589d9429 100644 --- a/installation/language/lv-LV/langmetadata.xml +++ b/installation/language/lv-LV/langmetadata.xml @@ -2,7 +2,7 @@ Latvian (Latvia) 5.2.4 - 2025-01 + 2025-02 Joomla! Projekts (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/mk-MK/langmetadata.xml b/installation/language/mk-MK/langmetadata.xml index a8bb569fb327a..5ee53f09aeada 100644 --- a/installation/language/mk-MK/langmetadata.xml +++ b/installation/language/mk-MK/langmetadata.xml @@ -2,7 +2,7 @@ Macedonian (mk-MK) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/nl-BE/langmetadata.xml b/installation/language/nl-BE/langmetadata.xml index 63b3d5e083f61..f3b757e3616a2 100644 --- a/installation/language/nl-BE/langmetadata.xml +++ b/installation/language/nl-BE/langmetadata.xml @@ -2,7 +2,7 @@ Dutch (Belgium) 5.2.4 - 2025-01 + 2025-02 Dutch (BE) translation team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/nl-NL/langmetadata.xml b/installation/language/nl-NL/langmetadata.xml index 41fff0b928fdf..b5062fc71f9fc 100644 --- a/installation/language/nl-NL/langmetadata.xml +++ b/installation/language/nl-NL/langmetadata.xml @@ -2,7 +2,7 @@ Dutch (nl-NL) 5.2.4 - 2025-01 + 2025-02 Dutch Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/pl-PL/langmetadata.xml b/installation/language/pl-PL/langmetadata.xml index 6744c98f6937f..5de4ac0341066 100644 --- a/installation/language/pl-PL/langmetadata.xml +++ b/installation/language/pl-PL/langmetadata.xml @@ -2,7 +2,7 @@ Polski (PL) 5.2.4 - 2025-01 + 2025-02 Projekt Joomla! (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/pt-BR/langmetadata.xml b/installation/language/pt-BR/langmetadata.xml index 3836368fe26a8..ada9d2f1c2fbd 100644 --- a/installation/language/pt-BR/langmetadata.xml +++ b/installation/language/pt-BR/langmetadata.xml @@ -2,7 +2,7 @@ Portuguese (Brazil) 5.2.4 - 2025-01 + 2025-02 Projeto Joomla! (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/pt-PT/langmetadata.xml b/installation/language/pt-PT/langmetadata.xml index 72b1769ad66d0..5d091e190c11a 100644 --- a/installation/language/pt-PT/langmetadata.xml +++ b/installation/language/pt-PT/langmetadata.xml @@ -2,7 +2,7 @@ Português (Portugal) 5.2.4 - 2025-01 + 2025-02 Comunidade JoomlaPortugal (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ro-RO/langmetadata.xml b/installation/language/ro-RO/langmetadata.xml index 413ee32496d9b..bc4fccacef6f2 100644 --- a/installation/language/ro-RO/langmetadata.xml +++ b/installation/language/ro-RO/langmetadata.xml @@ -2,7 +2,7 @@ Română (România) 5.2.4 - 2025-01 + 2025-02 Horia Negura - Quanta (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/sk-SK/langmetadata.xml b/installation/language/sk-SK/langmetadata.xml index f96813342b69b..8c40cfcaefa50 100644 --- a/installation/language/sk-SK/langmetadata.xml +++ b/installation/language/sk-SK/langmetadata.xml @@ -2,7 +2,7 @@ Slovak (Slovakia) 5.2.4 - 2025-01 + 2025-02 Slovak translation team : Peter Michnica (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/sl-SI/langmetadata.xml b/installation/language/sl-SI/langmetadata.xml index ecd85b4595055..6caa94df67eb3 100644 --- a/installation/language/sl-SI/langmetadata.xml +++ b/installation/language/sl-SI/langmetadata.xml @@ -2,7 +2,7 @@ Slovenščina (Slovenija) 5.2.4 - 2025-01 + 2025-02 Slovenska prevajalska ekipa (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/sr-YU/langmetadata.xml b/installation/language/sr-YU/langmetadata.xml index 9f4489bfe8fc0..441508cf599a5 100644 --- a/installation/language/sr-YU/langmetadata.xml +++ b/installation/language/sr-YU/langmetadata.xml @@ -2,7 +2,7 @@ Srpski (Republika Srbija) 5.2.4 - 2025-01 + 2025-02 Goran Nešić - UIX Web Design & Saša Matić Bardak.RS (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/sv-SE/langmetadata.xml b/installation/language/sv-SE/langmetadata.xml index 297a4122cad81..583339d98db03 100644 --- a/installation/language/sv-SE/langmetadata.xml +++ b/installation/language/sv-SE/langmetadata.xml @@ -2,7 +2,7 @@ Swedish (Sweden) 5.2.4 - 2025-01 + 2025-02 Swedish Translation Team - SvenskJoomla (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ta-IN/langmetadata.xml b/installation/language/ta-IN/langmetadata.xml index 64974c95bef05..eece4907f86d7 100644 --- a/installation/language/ta-IN/langmetadata.xml +++ b/installation/language/ta-IN/langmetadata.xml @@ -2,7 +2,7 @@ Tamil (India) 5.2.4 - 2025-01 + 2025-02 Ilagnayeru 'MIG' Manickam, Elango Samy Manim (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/th-TH/langmetadata.xml b/installation/language/th-TH/langmetadata.xml index 1f58afb8de579..c452a82ac1c75 100644 --- a/installation/language/th-TH/langmetadata.xml +++ b/installation/language/th-TH/langmetadata.xml @@ -2,7 +2,7 @@ Thai (ภาษาไทย) 5.2.4 - 2025-01 + 2025-02 Thai Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/tr-TR/langmetadata.xml b/installation/language/tr-TR/langmetadata.xml index 80dd66ec87c96..05f2db6e10c61 100644 --- a/installation/language/tr-TR/langmetadata.xml +++ b/installation/language/tr-TR/langmetadata.xml @@ -2,7 +2,7 @@ Turkish (Turkey) 5.2.4 - 2025-01 + 2025-02 Joomla! Türkiye (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/uk-UA/langmetadata.xml b/installation/language/uk-UA/langmetadata.xml index fb95ffd4f3eb8..c4c68aa4bc5d9 100644 --- a/installation/language/uk-UA/langmetadata.xml +++ b/installation/language/uk-UA/langmetadata.xml @@ -2,7 +2,7 @@ Ukrainian (uk-UA) 5.2.4 - 2025-01 + 2025-02 Denys Nosov (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ur-PK/langmetadata.xml b/installation/language/ur-PK/langmetadata.xml index 749e40926d2da..ee3a09e372b49 100644 --- a/installation/language/ur-PK/langmetadata.xml +++ b/installation/language/ur-PK/langmetadata.xml @@ -2,7 +2,7 @@ Urdu (ur-PK) 5.2.4 - 2025-01 + 2025-02 Urdu Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/vi-VN/langmetadata.xml b/installation/language/vi-VN/langmetadata.xml index eccfbd5299e88..8ee50bf657dec 100644 --- a/installation/language/vi-VN/langmetadata.xml +++ b/installation/language/vi-VN/langmetadata.xml @@ -2,7 +2,7 @@ Vietnamese (Vietnam) 5.2.4 - 2025-01 + 2025-02 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/zh-CN/langmetadata.xml b/installation/language/zh-CN/langmetadata.xml index ce725e6d441e6..78356baec906c 100644 --- a/installation/language/zh-CN/langmetadata.xml +++ b/installation/language/zh-CN/langmetadata.xml @@ -2,7 +2,7 @@ Chinese Simplified (China) 5.2.4 - 2025-01 + 2025-02 Joomla中文网 (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/zh-TW/langmetadata.xml b/installation/language/zh-TW/langmetadata.xml index 39cae5e1b4e28..2672e46255b4b 100644 --- a/installation/language/zh-TW/langmetadata.xml +++ b/installation/language/zh-TW/langmetadata.xml @@ -2,7 +2,7 @@ 正體中文 5.2.4 - 2025-01 + 2025-02 正體中文 Translation Team (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/src/Model/ConfigurationModel.php b/installation/src/Model/ConfigurationModel.php index e92ea8708d532..fae7afc5a3613 100644 --- a/installation/src/Model/ConfigurationModel.php +++ b/installation/src/Model/ConfigurationModel.php @@ -371,6 +371,7 @@ public function createConfiguration($options) $registry->set('captcha', '0'); $registry->set('list_limit', 20); $registry->set('access', 1); + $registry->set('frontediting', 1); // Debug settings. $registry->set('debug', false); diff --git a/language/en-GB/mod_articles_category.ini b/language/en-GB/mod_articles_category.ini index a734bfe12bbff..f615cfa75bc4f 100644 --- a/language/en-GB/mod_articles_category.ini +++ b/language/en-GB/mod_articles_category.ini @@ -3,7 +3,7 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_CATEGORY="Articles - Category" +MOD_ARTICLES_CATEGORY="Articles - Category (Legacy)" MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPING_LABEL="Article Grouping" MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPINGDIR_LABEL="Grouping Direction" MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERING_LABEL="Article Field to Order By" @@ -72,4 +72,4 @@ MOD_ARTICLES_CATEGORY_READ_MORE="Read more: " MOD_ARTICLES_CATEGORY_READ_MORE_TITLE="Read More …" MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE="Register to read more" MOD_ARTICLES_CATEGORY_UNTAGGED="Untagged" -MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories." +MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_category.sys.ini b/language/en-GB/mod_articles_category.sys.ini index dbeffc1a2ae8f..be43ccf788737 100644 --- a/language/en-GB/mod_articles_category.sys.ini +++ b/language/en-GB/mod_articles_category.sys.ini @@ -3,6 +3,6 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_CATEGORY="Articles - Category" +MOD_ARTICLES_CATEGORY="Articles - Category (Legacy)" MOD_ARTICLES_CATEGORY_LAYOUT_DEFAULT="Default" -MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories." +MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_latest.ini b/language/en-GB/mod_articles_latest.ini index 861d4216d2ee9..6e3ad0305bbb6 100644 --- a/language/en-GB/mod_articles_latest.ini +++ b/language/en-GB/mod_articles_latest.ini @@ -3,7 +3,7 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_LATEST="Articles - Latest" +MOD_ARTICLES_LATEST="Articles - Latest (Legacy)" MOD_LATEST_NEWS_FIELD_AUTHOR_LABEL="Created by Author(s)" MOD_LATEST_NEWS_FIELD_COUNT_LABEL="Articles to Display" MOD_LATEST_NEWS_FIELD_FEATURED_LABEL="Featured Articles" @@ -19,4 +19,4 @@ MOD_LATEST_NEWS_VALUE_RECENT_MODIFIED="Recently Modified First" MOD_LATEST_NEWS_VALUE_RECENT_PUBLISHED="Recently Published First" MOD_LATEST_NEWS_VALUE_RECENT_RAND="Random Articles" MOD_LATEST_NEWS_VALUE_RECENT_TOUCHED="Recently Touched First" -MOD_LATEST_NEWS_XML_DESCRIPTION="This module shows a list of the most recently published and current Articles." +MOD_LATEST_NEWS_XML_DESCRIPTION="This module shows a list of the most recently published and current Articles. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_latest.sys.ini b/language/en-GB/mod_articles_latest.sys.ini index 29499eaacd389..ac2987d17e4b7 100644 --- a/language/en-GB/mod_articles_latest.sys.ini +++ b/language/en-GB/mod_articles_latest.sys.ini @@ -3,6 +3,6 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_LATEST="Articles - Latest" +MOD_ARTICLES_LATEST="Articles - Latest (Legacy)" MOD_ARTICLES_LATEST_LAYOUT_DEFAULT="Default" -MOD_LATEST_NEWS_XML_DESCRIPTION="This module shows a list of the most recently published and current Articles." +MOD_LATEST_NEWS_XML_DESCRIPTION="This module shows a list of the most recently published and current Articles. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_news.ini b/language/en-GB/mod_articles_news.ini index bb442222fa205..dffaafc7028f1 100644 --- a/language/en-GB/mod_articles_news.ini +++ b/language/en-GB/mod_articles_news.ini @@ -3,7 +3,7 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_NEWS="Articles - Newsflash" +MOD_ARTICLES_NEWS="Articles - Newsflash (Legacy)" MOD_ARTICLES_NEWS_FIELD_EXCLUDE_CURRENT_LABEL="Exclude Current Article" MOD_ARTICLES_NEWS_FIELD_FEATURED_LABEL="Featured Articles" MOD_ARTICLES_NEWS_FIELD_IMAGES_ARTICLE_LABEL="Show Intro/Full Image" @@ -28,4 +28,4 @@ MOD_ARTICLES_NEWS_READMORE="Read more …" MOD_ARTICLES_NEWS_READMORE_REGISTER="Register to Read More" MOD_ARTICLES_NEWS_TITLE_HEADING="Header Level" MOD_ARTICLES_NEWS_VALUE_ONLY_SHOW_FEATURED="Only show Featured Articles" -MOD_ARTICLES_NEWS_XML_DESCRIPTION="The Article Newsflash Module will display a fixed number of Articles from a specific Category or a set of Categories." +MOD_ARTICLES_NEWS_XML_DESCRIPTION="The Article Newsflash Module will display a fixed number of Articles from a specific Category or a set of Categories. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_news.sys.ini b/language/en-GB/mod_articles_news.sys.ini index 1cd060b4f36b8..9eb6479b1b133 100644 --- a/language/en-GB/mod_articles_news.sys.ini +++ b/language/en-GB/mod_articles_news.sys.ini @@ -3,8 +3,8 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_NEWS="Articles - Newsflash" +MOD_ARTICLES_NEWS="Articles - Newsflash (Legacy)" MOD_ARTICLES_NEWS_LAYOUT_DEFAULT="Default" -MOD_ARTICLES_NEWS_LAYOUT_HORIZONTAL="Horizontal" +MOD_ARTICLES_NEWS_LAYOUT_HORIZONTAL="Horizontal" MOD_ARTICLES_NEWS_LAYOUT_VERTICAL="Vertical" -MOD_ARTICLES_NEWS_XML_DESCRIPTION="The Newsflash Module will display a fixed number of articles from a specific category." +MOD_ARTICLES_NEWS_XML_DESCRIPTION="The Newsflash Module will display a fixed number of articles from a specific category. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_popular.ini b/language/en-GB/mod_articles_popular.ini index 45e17aec04419..c354b043be063 100644 --- a/language/en-GB/mod_articles_popular.ini +++ b/language/en-GB/mod_articles_popular.ini @@ -3,7 +3,7 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_POPULAR="Articles - Most Read" +MOD_ARTICLES_POPULAR="Articles - Most Read (Legacy)" MOD_POPULAR_FIELD_COUNT_LABEL="Articles to Display" MOD_POPULAR_FIELD_DATEFIELD_LABEL="Date Field" MOD_POPULAR_FIELD_DATEFILTERING_LABEL="Date Filtering" @@ -17,4 +17,4 @@ MOD_POPULAR_OPTION_MODIFIED_VALUE="Modified Date" MOD_POPULAR_OPTION_OFF_VALUE="Off" MOD_POPULAR_OPTION_RELATIVEDAY_VALUE="Relative Date" MOD_POPULAR_OPTION_STARTPUBLISHING_VALUE="Start Publishing Date" -MOD_POPULAR_XML_DESCRIPTION="This module shows a list of the published Articles which have the highest number of page views." +MOD_POPULAR_XML_DESCRIPTION="This module shows a list of the published Articles which have the highest number of page views. This module is superseded by the \"Articles\" module." diff --git a/language/en-GB/mod_articles_popular.sys.ini b/language/en-GB/mod_articles_popular.sys.ini index d57521510e7af..422ff3526349f 100644 --- a/language/en-GB/mod_articles_popular.sys.ini +++ b/language/en-GB/mod_articles_popular.sys.ini @@ -3,6 +3,6 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -MOD_ARTICLES_POPULAR="Articles - Most Read" +MOD_ARTICLES_POPULAR="Articles - Most Read (Legacy)" MOD_ARTICLES_POPULAR_LAYOUT_DEFAULT="Default" -MOD_POPULAR_XML_DESCRIPTION="This module shows a list of the published Articles which have the highest number of page views." +MOD_POPULAR_XML_DESCRIPTION="This module shows a list of the published Articles which have the highest number of page views. This module is superseded by the \"Articles\" module." diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index b429655708aa1..2d6a730c72add 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -249,10 +249,8 @@ public function enqueueMessage($msg, $type = self::MSG_INFO) 'type' => $inputFilter->clean(strtolower($type), 'cmd'), ]; - // For empty queue, if messages exists in the session, enqueue them first. - $messages = $this->getMessageQueue(); - - if (!\in_array($message, $this->messageQueue)) { + // Get the messages of the session and add the new message if it is not already in the queue. + if (!\in_array($message, $this->getMessageQueue())) { // Enqueue the message. $this->messageQueue[] = $message; } diff --git a/libraries/src/Changelog/Changelog.php b/libraries/src/Changelog/Changelog.php index dbe0561a9766e..75941aeaebb95 100644 --- a/libraries/src/Changelog/Changelog.php +++ b/libraries/src/Changelog/Changelog.php @@ -288,8 +288,7 @@ public function endElement($parser, $name) $this->$key = $val; } - unset($this->latest); - unset($this->currentChangelog); + unset($this->latest, $this->currentChangelog); } elseif (isset($this->currentChangelog)) { // The update might be for an older version of j! unset($this->currentChangelog); diff --git a/libraries/src/Client/FtpClient.php b/libraries/src/Client/FtpClient.php index fb94d9b95f269..28be94171e137 100644 --- a/libraries/src/Client/FtpClient.php +++ b/libraries/src/Client/FtpClient.php @@ -344,7 +344,7 @@ public function connect($host = '127.0.0.1', $port = 21) */ public function isConnected() { - return ($this->_conn); + return $this->_conn; } /** diff --git a/libraries/src/Component/Router/RouterView.php b/libraries/src/Component/Router/RouterView.php index 471224f74564a..259e7577c45a9 100644 --- a/libraries/src/Component/Router/RouterView.php +++ b/libraries/src/Component/Router/RouterView.php @@ -89,7 +89,7 @@ public function getPath($query) $result = []; // Get the right view object - if (isset($query['view']) && isset($views[$query['view']])) { + if (isset($query['view'], $views[$query['view']])) { $viewobj = $views[$query['view']]; } diff --git a/libraries/src/Component/Router/Rules/NomenuRules.php b/libraries/src/Component/Router/Rules/NomenuRules.php index 61cf23054283b..b102d362f555d 100644 --- a/libraries/src/Component/Router/Rules/NomenuRules.php +++ b/libraries/src/Component/Router/Rules/NomenuRules.php @@ -77,7 +77,7 @@ public function parse(&$segments, &$vars) $vars['view'] = array_shift($segments); $view = $views[$vars['view']]; - if (isset($view->key) && isset($segments[0])) { + if (isset($view->key, $segments[0])) { if (\is_callable([$this->router, 'get' . ucfirst($view->name) . 'Id'])) { $input = $this->router->app->getInput(); if ($view->parent_key && $input->get($view->parent_key)) { diff --git a/libraries/src/Console/SetConfigurationCommand.php b/libraries/src/Console/SetConfigurationCommand.php index b0651581f24f9..7db330f30e2b3 100644 --- a/libraries/src/Console/SetConfigurationCommand.php +++ b/libraries/src/Console/SetConfigurationCommand.php @@ -133,7 +133,7 @@ private function retrieveOptionsFromInput(array $options): bool return false; } - list($option, $value) = explode('=', $option); + [$option, $value] = explode('=', $option); $collected[$option] = $value; } @@ -205,7 +205,7 @@ public function getOptions() */ public function getInitialConfigurationOptions(): Registry { - return (new Registry(new \JConfig())); + return new Registry(new \JConfig()); } diff --git a/libraries/src/Dispatcher/ComponentDispatcher.php b/libraries/src/Dispatcher/ComponentDispatcher.php index d36849d7a6f87..794e606334485 100644 --- a/libraries/src/Dispatcher/ComponentDispatcher.php +++ b/libraries/src/Dispatcher/ComponentDispatcher.php @@ -120,7 +120,7 @@ public function dispatch() // Check for a controller.task command. if (str_contains($command, '.')) { // Explode the controller.task command. - list($controller, $task) = explode('.', $command); + [$controller, $task] = explode('.', $command); $this->input->set('controller', $controller); $this->input->set('task', $task); diff --git a/libraries/src/Document/Renderer/Html/MessageRenderer.php b/libraries/src/Document/Renderer/Html/MessageRenderer.php index 29891ed6e155e..2a72553462bbc 100644 --- a/libraries/src/Document/Renderer/Html/MessageRenderer.php +++ b/libraries/src/Document/Renderer/Html/MessageRenderer.php @@ -82,7 +82,7 @@ private function getData() // Build the sorted message list if (\is_array($messages) && !empty($messages)) { foreach ($messages as $msg) { - if (isset($msg['type']) && isset($msg['message'])) { + if (isset($msg['type'], $msg['message'])) { $lists[$msg['type']][] = $msg['message']; } } diff --git a/libraries/src/Environment/Browser.php b/libraries/src/Environment/Browser.php index 29133799bbf84..cfc8c787b5366 100644 --- a/libraries/src/Environment/Browser.php +++ b/libraries/src/Environment/Browser.php @@ -562,7 +562,7 @@ public function match($userAgent = null, $accept = null) $this->setBrowser('edge'); if (str_contains($version[1], '.')) { - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } else { $this->majorVersion = $version[1]; $this->minorVersion = 0; @@ -574,11 +574,11 @@ public function match($userAgent = null, $accept = null) */ $this->setBrowser('edg'); - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } elseif (preg_match('|Opera[\/ ]([0-9.]+)|', $this->agent, $version)) { $this->setBrowser('opera'); - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); /* * Due to changes in Opera UA, we need to check Version/xx.yy, @@ -591,7 +591,7 @@ public function match($userAgent = null, $accept = null) // Opera 15+ $this->setBrowser('opera'); - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } elseif ( preg_match('/Chrome[\/ ]([0-9.]+)/i', $this->agent, $version) || preg_match('/CrMo[\/ ]([0-9.]+)/i', $this->agent, $version) @@ -599,7 +599,7 @@ public function match($userAgent = null, $accept = null) ) { $this->setBrowser('chrome'); - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } elseif ( str_contains($this->lowerAgent, 'elaine/') || str_contains($this->lowerAgent, 'palmsource') @@ -620,7 +620,7 @@ public function match($userAgent = null, $accept = null) } if (str_contains($version[1], '.')) { - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } else { $this->majorVersion = $version[1]; $this->minorVersion = 0; @@ -653,7 +653,7 @@ public function match($userAgent = null, $accept = null) } elseif (preg_match('|Firefox\/([0-9.]+)|', $this->agent, $version)) { $this->setBrowser('firefox'); - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } elseif (preg_match('|Lynx\/([0-9]+)|', $this->agent, $version)) { $this->setBrowser('lynx'); } elseif (preg_match('|Links \(([0-9]+)|', $this->agent, $version)) { @@ -683,7 +683,7 @@ public function match($userAgent = null, $accept = null) } elseif (preg_match('|Mozilla\/([0-9.]+)|', $this->agent, $version)) { $this->setBrowser('mozilla'); - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); } } } @@ -733,7 +733,7 @@ public function getPlatform() protected function identifyBrowserVersion() { if (preg_match('|Version[/ ]([0-9.]+)|', $this->agent, $version)) { - list($this->majorVersion, $this->minorVersion) = explode('.', $version[1]); + [$this->majorVersion, $this->minorVersion] = explode('.', $version[1]); return; } @@ -848,8 +848,8 @@ public function getHTTPProtocol() */ public function isViewable($mimetype) { - $mimetype = strtolower($mimetype); - list($type, $subtype) = explode('/', $mimetype); + $mimetype = strtolower($mimetype); + [$type, $subtype] = explode('/', $mimetype); if (!empty($this->accept)) { $wildcard_match = false; diff --git a/libraries/src/Extension/ExtensionManagerTrait.php b/libraries/src/Extension/ExtensionManagerTrait.php index fe2acdcdd20e0..d2ab3f2815335 100644 --- a/libraries/src/Extension/ExtensionManagerTrait.php +++ b/libraries/src/Extension/ExtensionManagerTrait.php @@ -156,7 +156,7 @@ private function loadExtension($type, $extensionName, $extensionPath) $container->set($type, new Module(new ModuleDispatcherFactory(''), new HelperFactory(''))); break; case PluginInterface::class: - list($pluginName, $pluginType) = explode(':', $extensionName); + [$pluginName, $pluginType] = explode(':', $extensionName); $container->set($type, $this->loadPluginFromFilesystem($pluginName, $pluginType)); } } diff --git a/libraries/src/Filter/InputFilter.php b/libraries/src/Filter/InputFilter.php index 14ad681b0cf3f..28449fc60edd9 100644 --- a/libraries/src/Filter/InputFilter.php +++ b/libraries/src/Filter/InputFilter.php @@ -218,7 +218,7 @@ public static function isSafeFile($file, $options = []) // Make sure we can scan nested file descriptors $descriptors = $file; - if (isset($file['name']) && isset($file['tmp_name'])) { + if (isset($file['name'], $file['tmp_name'])) { $descriptors = static::decodeFileData( [ $file['name'], diff --git a/libraries/src/Form/Field/ChromestyleField.php b/libraries/src/Form/Field/ChromestyleField.php index ad945d5e7ced0..0d446326f76c2 100644 --- a/libraries/src/Form/Field/ChromestyleField.php +++ b/libraries/src/Form/Field/ChromestyleField.php @@ -155,8 +155,6 @@ protected function getGroups() } } - reset($groups); - return $groups; } diff --git a/libraries/src/Form/Field/GroupedlistField.php b/libraries/src/Form/Field/GroupedlistField.php index 9cf88ba6e76f8..2b39a99f2d6ae 100644 --- a/libraries/src/Form/Field/GroupedlistField.php +++ b/libraries/src/Form/Field/GroupedlistField.php @@ -142,8 +142,6 @@ protected function getGroups() } } - reset($groups); - return $groups; } diff --git a/libraries/src/Form/Field/HeadertagField.php b/libraries/src/Form/Field/HeadertagField.php index ec3107cd6db3b..951e0ac513429 100644 --- a/libraries/src/Form/Field/HeadertagField.php +++ b/libraries/src/Form/Field/HeadertagField.php @@ -48,8 +48,6 @@ protected function getOptions() $options[] = $tmp; } - reset($options); - return $options; } } diff --git a/libraries/src/Form/Field/ListField.php b/libraries/src/Form/Field/ListField.php index 4372a9b9f6296..138d89f4005bb 100644 --- a/libraries/src/Form/Field/ListField.php +++ b/libraries/src/Form/Field/ListField.php @@ -208,8 +208,6 @@ protected function getOptions() array_unshift($options, $tmp); } - reset($options); - return $options; } diff --git a/libraries/src/Form/Field/ModuletagField.php b/libraries/src/Form/Field/ModuletagField.php index 9257d6a620d4c..a5431ae34d3bf 100644 --- a/libraries/src/Form/Field/ModuletagField.php +++ b/libraries/src/Form/Field/ModuletagField.php @@ -48,8 +48,6 @@ protected function getOptions() $options[] = $tmp; } - reset($options); - return $options; } } diff --git a/libraries/src/Form/Field/TimezoneField.php b/libraries/src/Form/Field/TimezoneField.php index 1bddb7d57ef68..e99279a4ca2a7 100644 --- a/libraries/src/Form/Field/TimezoneField.php +++ b/libraries/src/Form/Field/TimezoneField.php @@ -133,7 +133,7 @@ protected function getGroups() } // Get the group/locale from the timezone. - list($group, $locale) = explode('/', $zone, 2); + [$group, $locale] = explode('/', $zone, 2); // Only use known groups. if (\in_array($group, self::$zones)) { diff --git a/libraries/src/Form/FormHelper.php b/libraries/src/Form/FormHelper.php index 749899d8c782d..a860ffddc3074 100644 --- a/libraries/src/Form/FormHelper.php +++ b/libraries/src/Form/FormHelper.php @@ -213,8 +213,8 @@ protected static function loadClass($entity, $type) $subPrefix = ''; if (strpos($name, '.')) { - list($subPrefix, $name) = explode('.', $name); - $subPrefix = ucfirst($subPrefix) . '\\'; + [$subPrefix, $name] = explode('.', $name); + $subPrefix = ucfirst($subPrefix) . '\\'; } // Compile the classname @@ -229,7 +229,7 @@ protected static function loadClass($entity, $type) $prefix = 'J'; if (strpos($type, '.')) { - list($prefix, $type) = explode('.', $type); + [$prefix, $type] = explode('.', $type); } $class = StringHelper::ucfirst($prefix, '_') . 'Form' . StringHelper::ucfirst($entity, '_') . StringHelper::ucfirst($type, '_'); diff --git a/libraries/src/Form/Rule/TimeRule.php b/libraries/src/Form/Rule/TimeRule.php index 69b3be2871ac9..e09293065a518 100644 --- a/libraries/src/Form/Rule/TimeRule.php +++ b/libraries/src/Form/Rule/TimeRule.php @@ -86,7 +86,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr } // If min and max is set - if (isset($element['min']) && isset($element['max'])) { + if (isset($element['min'], $element['max'])) { $min = $element['min'][0] . $element['min'][1]; $max = $element['max'][0] . $element['max'][1]; diff --git a/libraries/src/HTML/HTMLHelper.php b/libraries/src/HTML/HTMLHelper.php index 5d02e65bbf4fa..dbcf82efbec7d 100644 --- a/libraries/src/HTML/HTMLHelper.php +++ b/libraries/src/HTML/HTMLHelper.php @@ -124,7 +124,7 @@ protected static function extract($key) */ final public static function _(string $key, ...$methodArgs) { - list($key, $prefix, $file, $func) = static::extract($key); + [$key, $prefix, $file, $func] = static::extract($key); if (\array_key_exists($key, static::$registry)) { $function = static::$registry[$key]; @@ -215,7 +215,7 @@ public static function register($key, callable $function) E_USER_DEPRECATED ); - list($key) = static::extract($key); + [$key] = static::extract($key); static::$registry[$key] = $function; @@ -240,7 +240,7 @@ public static function unregister($key) E_USER_DEPRECATED ); - list($key) = static::extract($key); + [$key] = static::extract($key); if (isset(static::$registry[$key])) { unset(static::$registry[$key]); @@ -262,7 +262,7 @@ public static function unregister($key) */ public static function isRegistered($key) { - list($key) = static::extract($key); + [$key] = static::extract($key); return isset(static::$registry[$key]); } @@ -480,12 +480,12 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec // If the file contains any /: it can be in a media extension subfolder if (strpos($file, '/')) { // Divide the file extracting the extension as the first part before / - list($extension, $file) = explode('/', $file, 2); + [$extension, $file] = explode('/', $file, 2); // If the file yet contains any /: it can be a plugin if (strpos($file, '/')) { // Divide the file extracting the element as the first part before / - list($element, $file) = explode('/', $file, 2); + [$element, $file] = explode('/', $file, 2); // Try to deal with plugins group in the media folder $found = static::addFileToBuffer(JPATH_PUBLIC . "/media/$extension/$element/$folder/$file", $ext, $debugMode); @@ -761,8 +761,8 @@ public static function image($file, $alt, $attribs = null, $relative = false, $r } // Set the attribute - list($key, $value) = explode('=', $attribute); - $attributes[$key] = trim($value, '"'); + [$key, $value] = explode('=', $attribute); + $attributes[$key] = trim($value, '"'); } // Add the attributes from the string to the original attributes @@ -1038,7 +1038,7 @@ public static function tooltipText($title = '', $content = '', $translate = true if ($content !== '' || $title !== '') { // Split title into title and content if the title contains '::' (old Mootools format). if ($content === '' && !(!str_contains($title, '::'))) { - list($title, $content) = explode('::', $title, 2); + [$title, $content] = explode('::', $title, 2); } // Pass texts through Text if required. diff --git a/libraries/src/HTML/Helpers/Bootstrap.php b/libraries/src/HTML/Helpers/Bootstrap.php index 2a603cdc6ec74..b9bc8c07d1e76 100644 --- a/libraries/src/HTML/Helpers/Bootstrap.php +++ b/libraries/src/HTML/Helpers/Bootstrap.php @@ -125,35 +125,66 @@ public static function button($selector = ''): void * * Options for the carousel can be: * - interval number 5000 The amount of time to delay between automatically cycling an item. - * If false, carousel will not automatically cycle. * - keyboard boolean true Whether the carousel should react to keyboard events. - * - pause string| hover Pauses the cycling of the carousel on mouseenter and resumes the cycling - * boolean of the carousel on mouseleave. - * - slide string| false Autoplays the carousel after the user manually cycles the first item. - * boolean If "carousel", autoplays the carousel on load. + * - pause string| hover If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the + * boolean cycling of the carousel on mouseleave. If set to false, hovering over the carousel won’t + * pause it. On touch-enabled devices, when set to "hover", cycling will pause on touchend + * (once the user finished interacting with the carousel) for two intervals, before + * automatically resuming. This is in addition to the mouse behavior. + * - ride string| false If set to true, autoplays the carousel after the user manually cycles the first item. If set + * boolean to "carousel", autoplays the carousel on load. + * - touch boolean true Whether the carousel should support left/right swipe interactions on touchscreen devices. + * - wrap boolean true Whether the carousel should cycle continuously or have hard stops. */ public static function carousel($selector = '', $params = []): void { - // Only load once if (!empty(static::$loaded[__METHOD__][$selector])) { return; } if ($selector !== '') { - // Setup options object - $opt = [ - 'interval' => (int) ($params['interval'] ?? 5000), - 'keyboard' => (bool) ($params['keyboard'] ?? true), - 'pause' => $params['pause'] ?? 'hover', - 'slide' => (bool) ($params['slide'] ?? false), - 'wrap' => (bool) ($params['wrap'] ?? true), - 'touch' => (bool) ($params['touch'] ?? true), - ]; + $opt['interval'] = 5000; + + if (isset($params['interval']) && is_numeric($params['interval'])) { + $opt['interval'] = (int) $params['interval']; + } + + $opt['keyboard'] = true; + + if (isset($params['keyboard']) && \is_bool($params['keyboard'])) { + $opt['keyboard'] = $params['keyboard']; + } + + $opt['pause'] = 'hover'; + + if (isset($params['pause']) && \in_array($params['pause'], ['hover', false], true)) { + $opt['pause'] = $params['pause']; + } + + $opt['ride'] = false; + + if (isset($params['ride']) && \in_array($params['ride'], ['carousel', true, false], true)) { + $opt['ride'] = $params['ride']; + } + + $opt['touch'] = true; - Factory::getDocument()->addScriptOptions('bootstrap.carousel', [$selector => (object) array_filter($opt)]); + if (isset($params['touch']) && \is_bool($params['touch'])) { + $opt['touch'] = $params['touch']; + } + + $opt['wrap'] = true; + + if (isset($params['wrap']) && \is_bool($params['wrap'])) { + $opt['wrap'] = $params['wrap']; + } + + Factory::getApplication()->getDocument()->addScriptOptions( + 'bootstrap.carousel', + [$selector => (object) $opt] + ); } - // Include the Bootstrap component Factory::getApplication() ->getDocument() ->getWebAssetManager() diff --git a/libraries/src/HTML/Helpers/Number.php b/libraries/src/HTML/Helpers/Number.php index 0814e47eba685..edc1ffdf2ea5c 100644 --- a/libraries/src/HTML/Helpers/Number.php +++ b/libraries/src/HTML/Helpers/Number.php @@ -55,7 +55,7 @@ public static function bytes($bytes, $unit = 'auto', $precision = 2, $iec = fals $oBytes = $bytes; } else { preg_match('/(.*?)\s?((?:[KMGTPEZY]i?)?B?)$/i', trim($bytes), $matches); - list(, $oBytes, $oUnit) = $matches; + [, $oBytes, $oUnit] = $matches; if ($oUnit && is_numeric($oBytes)) { $oBase = $iec && !str_contains($oUnit, 'i') ? 1000 : 1024; diff --git a/libraries/src/HTML/Helpers/Select.php b/libraries/src/HTML/Helpers/Select.php index 0a6993e01be2d..dc51a186385f3 100644 --- a/libraries/src/HTML/Helpers/Select.php +++ b/libraries/src/HTML/Helpers/Select.php @@ -244,7 +244,7 @@ public static function groupedlist($data, $name, $options = []) $noGroup = false; } - if (isset($options['group.id']) && isset($group[$options['group.id']])) { + if (isset($options['group.id'], $group[$options['group.id']])) { $id = $group[$options['group.id']]; $noGroup = false; } @@ -257,7 +257,7 @@ public static function groupedlist($data, $name, $options = []) $noGroup = false; } - if (isset($options['group.id']) && isset($group->{$options['group.id']})) { + if (isset($options['group.id'], $group->{$options['group.id']})) { $id = $group->{$options['group.id']}; $noGroup = false; } diff --git a/libraries/src/Helper/UserGroupsHelper.php b/libraries/src/Helper/UserGroupsHelper.php index 40a7cc98554df..13693231dc7f1 100644 --- a/libraries/src/Helper/UserGroupsHelper.php +++ b/libraries/src/Helper/UserGroupsHelper.php @@ -171,7 +171,7 @@ public function getAll() */ public function has($id) { - return (\array_key_exists($id, $this->groups) && $this->groups[$id] !== false); + return \array_key_exists($id, $this->groups) && $this->groups[$id] !== false; } /** diff --git a/libraries/src/Image/Image.php b/libraries/src/Image/Image.php index ae75155449c30..a00cf57bfe0dd 100644 --- a/libraries/src/Image/Image.php +++ b/libraries/src/Image/Image.php @@ -225,10 +225,10 @@ public function getOrientation() private static function getOrientationString(int $width, int $height): string { switch (true) { - case ($width > $height): + case $width > $height: return self::ORIENTATION_LANDSCAPE; - case ($width < $height): + case $width < $height: return self::ORIENTATION_PORTRAIT; default: diff --git a/libraries/src/Input/Cli.php b/libraries/src/Input/Cli.php index fed26dc34dda8..445ba54d2e4e7 100644 --- a/libraries/src/Input/Cli.php +++ b/libraries/src/Input/Cli.php @@ -91,8 +91,7 @@ public function serialize() // Remove $_ENV and $_SERVER from the inputs. $inputs = $this->inputs; - unset($inputs['env']); - unset($inputs['server']); + unset($inputs['env'], $inputs['server']); // Serialize the executable, args, options, data, and inputs. return serialize([$this->executable, $this->args, $this->options, $this->data, $inputs]); @@ -113,7 +112,7 @@ public function serialize() public function unserialize($input) { // Unserialize the executable, args, options, data, and inputs. - list($this->executable, $this->args, $this->options, $this->data, $this->inputs) = unserialize($input); + [$this->executable, $this->args, $this->options, $this->data, $this->inputs] = unserialize($input); // Load the filter. if (isset($this->options['filter'])) { diff --git a/libraries/src/Input/Input.php b/libraries/src/Input/Input.php index e3f5544d32ae5..edead02752de0 100644 --- a/libraries/src/Input/Input.php +++ b/libraries/src/Input/Input.php @@ -210,7 +210,7 @@ protected function getArrayRecursive(array $vars = [], $datasource = null, $defa public function unserialize($input) { // Unserialize the options, data, and inputs. - list($this->options, $this->data, $this->inputs) = unserialize($input); + [$this->options, $this->data, $this->inputs] = unserialize($input); // Load the filter. if (isset($this->options['filter'])) { diff --git a/libraries/src/Installer/Manifest/LibraryManifest.php b/libraries/src/Installer/Manifest/LibraryManifest.php index 8851de89cf55e..e28847bbd799a 100644 --- a/libraries/src/Installer/Manifest/LibraryManifest.php +++ b/libraries/src/Installer/Manifest/LibraryManifest.php @@ -109,7 +109,7 @@ protected function loadManifestFromData(\SimpleXMLElement $xml) $this->packagerurl = (string) $xml->packagerurl; $this->update = (string) $xml->update; - if (isset($xml->files) && isset($xml->files->file) && \count($xml->files->file)) { + if (isset($xml->files, $xml->files->file) && \count($xml->files->file)) { foreach ($xml->files->file as $file) { $this->filelist[] = (string) $file; } diff --git a/libraries/src/MVC/Controller/AdminController.php b/libraries/src/MVC/Controller/AdminController.php index 30ec59d7c0b96..a831e46600fad 100644 --- a/libraries/src/MVC/Controller/AdminController.php +++ b/libraries/src/MVC/Controller/AdminController.php @@ -307,8 +307,7 @@ public function saveorder() // Remove zero PKs and corresponding order values resulting from input filter for PK foreach ($pks as $i => $pk) { if ($pk === 0) { - unset($pks[$i]); - unset($order[$i]); + unset($pks[$i], $order[$i]); } } @@ -402,8 +401,7 @@ public function saveOrderAjax() // Remove zero PKs and corresponding order values resulting from input filter for PK foreach ($pks as $i => $pk) { if ($pk === 0) { - unset($pks[$i]); - unset($order[$i]); + unset($pks[$i], $order[$i]); } } diff --git a/libraries/src/MVC/Controller/BaseController.php b/libraries/src/MVC/Controller/BaseController.php index 00117553d08f1..2ad02cc2eb192 100644 --- a/libraries/src/MVC/Controller/BaseController.php +++ b/libraries/src/MVC/Controller/BaseController.php @@ -302,7 +302,7 @@ public static function getInstance($prefix, $config = []) // Check for a controller.task command. if (str_contains($command, '.')) { // Explode the controller.task command. - list($type, $task) = explode('.', $command); + [$type, $task] = explode('.', $command); // Define the controller filename and path. $file = self::createFileName('controller', ['name' => $type, 'format' => $format]); diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index c718d1daac197..2961eb222d590 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -333,6 +333,7 @@ public function send() $this->addLayoutTemplateData([ 'siteName' => $app->get('sitename'), 'lang' => substr($this->language, 0, 2), + 'mail' => $mail, ]); $layout = $config->get('mail_htmllayout', 'mailtemplate'); diff --git a/libraries/src/Response/JsonResponse.php b/libraries/src/Response/JsonResponse.php index 2b7d470361daf..975df65b441f7 100644 --- a/libraries/src/Response/JsonResponse.php +++ b/libraries/src/Response/JsonResponse.php @@ -85,7 +85,7 @@ public function __construct($response = null, $message = null, $error = false, $ // Build the sorted messages list if (\is_array($messages) && \count($messages)) { foreach ($messages as $message) { - if (isset($message['type']) && isset($message['message'])) { + if (isset($message['type'], $message['message'])) { $lists[$message['type']][] = $message['message']; } } diff --git a/libraries/src/Table/Category.php b/libraries/src/Table/Category.php index bb23fd1b76f85..6ec3e365319f9 100644 --- a/libraries/src/Table/Category.php +++ b/libraries/src/Table/Category.php @@ -172,7 +172,7 @@ public function check() return false; } - $this->alias = trim($this->alias); + $this->alias = trim($this->alias ?? ''); if (empty($this->alias)) { $this->alias = $this->title; diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index 0b7d15808c63e..ab457b3657b70 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -156,7 +156,7 @@ public function bind($array, $ignore = '') $this->introtext = $array['articletext']; $this->fulltext = ''; } else { - list($this->introtext, $this->fulltext) = preg_split($pattern, $array['articletext'], 2); + [$this->introtext, $this->fulltext] = preg_split($pattern, $array['articletext'], 2); } } diff --git a/libraries/src/Table/ContentType.php b/libraries/src/Table/ContentType.php index d72de3dd52380..aedc87f793bbe 100644 --- a/libraries/src/Table/ContentType.php +++ b/libraries/src/Table/ContentType.php @@ -143,7 +143,7 @@ public function getContentTable() $tableInfo = json_decode($this->table); if (\is_object($tableInfo) && isset($tableInfo->special)) { - if (\is_object($tableInfo->special) && isset($tableInfo->special->type) && isset($tableInfo->special->prefix)) { + if (\is_object($tableInfo->special) && isset($tableInfo->special->type, $tableInfo->special->prefix)) { $class = $tableInfo->special->class ?? 'Joomla\\CMS\\Table\\Table'; if (!class_implements($class, 'Joomla\\CMS\\Table\\TableInterface')) { diff --git a/libraries/src/Table/Nested.php b/libraries/src/Table/Nested.php index 156f5265357a2..858a9cb5858e2 100644 --- a/libraries/src/Table/Nested.php +++ b/libraries/src/Table/Nested.php @@ -1556,7 +1556,7 @@ protected function _getNode($id, $key = null) protected function _getTreeRepositionData($referenceNode, $nodeWidth, $position = 'before') { // Make sure the reference an object with a left and right id. - if (!\is_object($referenceNode) || !(isset($referenceNode->lft) && isset($referenceNode->rgt))) { + if (!\is_object($referenceNode) || !(isset($referenceNode->lft, $referenceNode->rgt))) { return false; } diff --git a/libraries/src/Updater/Update.php b/libraries/src/Updater/Update.php index 1780fa1a4f364..1cf54f713eace 100644 --- a/libraries/src/Updater/Update.php +++ b/libraries/src/Updater/Update.php @@ -487,8 +487,7 @@ public function _endElement($parser, $name) $this->$key = $val; } - unset($this->latest); - unset($this->currentUpdate); + unset($this->latest, $this->currentUpdate); } elseif (isset($this->currentUpdate)) { // The update might be for an older version of j! unset($this->currentUpdate); diff --git a/libraries/src/User/User.php b/libraries/src/User/User.php index 92bd676677938..be5c35c5890e9 100644 --- a/libraries/src/User/User.php +++ b/libraries/src/User/User.php @@ -658,10 +658,12 @@ public function bind(&$array) } // Prevent updating internal fields - unset($array['registerDate']); - unset($array['lastvisitDate']); - unset($array['lastResetTime']); - unset($array['resetCount']); + unset( + $array['registerDate'], + $array['lastvisitDate'], + $array['lastResetTime'], + $array['resetCount'] + ); } if (\array_key_exists('params', $array)) { diff --git a/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php b/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php index 690b62407cc46..a8fd6be30f6b4 100644 --- a/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php +++ b/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php @@ -67,7 +67,7 @@ public function getArticlesByMonths(Registry $moduleParams, SiteApplication $app try { $rows = (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; diff --git a/modules/mod_feed/src/Helper/FeedHelper.php b/modules/mod_feed/src/Helper/FeedHelper.php index d450085993714..a716ab862962a 100644 --- a/modules/mod_feed/src/Helper/FeedHelper.php +++ b/modules/mod_feed/src/Helper/FeedHelper.php @@ -42,7 +42,7 @@ public function getFeedInformation($params) try { $feed = new FeedFactory(); $rssDoc = $feed->getFeed($rssurl); - } catch (\Exception $e) { + } catch (\Exception) { return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED'); } diff --git a/modules/mod_related_items/src/Helper/RelatedItemsHelper.php b/modules/mod_related_items/src/Helper/RelatedItemsHelper.php index 1bbb6cac033ae..1cb33963268c9 100644 --- a/modules/mod_related_items/src/Helper/RelatedItemsHelper.php +++ b/modules/mod_related_items/src/Helper/RelatedItemsHelper.php @@ -86,7 +86,7 @@ public function getRelatedArticles(Registry $params, SiteApplication $app): arra try { $metakey = trim($db->loadResult()); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; @@ -150,7 +150,7 @@ public function getRelatedArticles(Registry $params, SiteApplication $app): arra try { $articleIds = $db->loadColumn(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; diff --git a/modules/mod_stats/src/Helper/StatsHelper.php b/modules/mod_stats/src/Helper/StatsHelper.php index 47d5d2479daf4..2abf2eb9261e7 100644 --- a/modules/mod_stats/src/Helper/StatsHelper.php +++ b/modules/mod_stats/src/Helper/StatsHelper.php @@ -106,7 +106,7 @@ public function getStats(Registry &$params, CMSApplicationInterface $app) try { $items = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $items = false; } @@ -134,7 +134,7 @@ public function getStats(Registry &$params, CMSApplicationInterface $app) try { $hits = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $hits = false; } @@ -154,7 +154,7 @@ public function getStats(Registry &$params, CMSApplicationInterface $app) foreach ($arrays as $response) { foreach ($response as $row) { // We only add a row if the title and data are given - if (isset($row['title']) && isset($row['data'])) { + if (isset($row['title'], $row['data'])) { $rows[$i] = new \stdClass(); $rows[$i]->title = $row['title']; $rows[$i]->icon = $row['icon'] ?? 'info'; diff --git a/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php b/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php index 954b0ed3dd6e2..e5bde10ae20c6 100644 --- a/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php +++ b/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php @@ -204,7 +204,7 @@ public function getItems(&$params) try { $results = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $results = []; $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); } diff --git a/modules/mod_users_latest/src/Helper/UsersLatestHelper.php b/modules/mod_users_latest/src/Helper/UsersLatestHelper.php index 84eb29738056a..c32614d7a9598 100644 --- a/modules/mod_users_latest/src/Helper/UsersLatestHelper.php +++ b/modules/mod_users_latest/src/Helper/UsersLatestHelper.php @@ -69,7 +69,7 @@ public function getLatestUsers(Registry $params, SiteApplication $app): array try { return (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; diff --git a/modules/mod_whosonline/src/Helper/WhosonlineHelper.php b/modules/mod_whosonline/src/Helper/WhosonlineHelper.php index caa1e642cb322..84ad110af5f23 100644 --- a/modules/mod_whosonline/src/Helper/WhosonlineHelper.php +++ b/modules/mod_whosonline/src/Helper/WhosonlineHelper.php @@ -49,7 +49,7 @@ public static function getOnlineCount() try { $sessions = (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $sessions = []; } @@ -113,7 +113,7 @@ public static function getOnlineUserNames($params) try { return (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return []; } } diff --git a/modules/mod_wrapper/src/Helper/WrapperHelper.php b/modules/mod_wrapper/src/Helper/WrapperHelper.php index e30aeb56c6ce8..ef57b64d7567b 100644 --- a/modules/mod_wrapper/src/Helper/WrapperHelper.php +++ b/modules/mod_wrapper/src/Helper/WrapperHelper.php @@ -52,7 +52,7 @@ public function getParamsWrapper(Registry $params, SiteApplication $app) if (str_starts_with($url, '/')) { // Relative URL in component. use server http_host. $url = 'http://' . $app->getInput()->server->get('HTTP_HOST') . $url; - } elseif (!str_contains($url, 'http') && !str_contains($url, 'https')) { + } elseif (!str_starts_with($url, 'http://') && !str_starts_with($url, 'https://')) { $url = 'http://' . $url; } } diff --git a/plugins/actionlog/joomla/src/Extension/Joomla.php b/plugins/actionlog/joomla/src/Extension/Joomla.php index 64d56acf74223..cfa96b7b70679 100644 --- a/plugins/actionlog/joomla/src/Extension/Joomla.php +++ b/plugins/actionlog/joomla/src/Extension/Joomla.php @@ -164,7 +164,7 @@ public function onContentAfterSave(Model\AfterSaveEvent $event): void return; } - list($option, $contentType) = explode('.', $params->type_alias); + [$option, $contentType] = explode('.', $params->type_alias); if (!$this->checkLoggable($option)) { return; @@ -272,7 +272,7 @@ public function onContentChangeState(Model\AfterChangeStateEvent $event): void return; } - list(, $contentType) = explode('.', $params->type_alias); + [, $contentType] = explode('.', $params->type_alias); switch ($value) { case 0: @@ -316,7 +316,7 @@ public function onContentChangeState(Model\AfterChangeStateEvent $event): void try { $items = $db->loadObjectList($params->id_holder); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $items = []; } @@ -544,7 +544,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void return; } - list(, $contentType) = explode('.', $params->type_alias); + [, $contentType] = explode('.', $params->type_alias); if ($isNew) { $messageLanguageKey = $params->text_prefix . '_' . $params->type_title . '_ADDED'; @@ -875,7 +875,7 @@ public function onUserLoginFailure(User\LoginFailureEvent $event): void try { $loggedInUser = $db->loadObject(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return; } diff --git a/plugins/api-authentication/token/src/Extension/Token.php b/plugins/api-authentication/token/src/Extension/Token.php index b6e21814ba70b..2e82cacf35d9c 100644 --- a/plugins/api-authentication/token/src/Extension/Token.php +++ b/plugins/api-authentication/token/src/Extension/Token.php @@ -163,7 +163,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void return; } - list($algo, $userId, $tokenHMAC) = $parts; + [$algo, $userId, $tokenHMAC] = $parts; /** * Verify the HMAC algorithm requested in the token string is allowed @@ -180,7 +180,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void */ try { $siteSecret = $this->getApplication()->get('secret'); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -282,7 +282,7 @@ private function getTokenSeedForUser(int $userId): ?string $query->bind(':userId', $userId, ParameterType::INTEGER); return $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } } @@ -313,7 +313,7 @@ private function isTokenEnabledForUser(int $userId): bool $value = $db->setQuery($query)->loadResult(); return $value == 1; - } catch (\Exception $e) { + } catch (\Exception) { return false; } } diff --git a/plugins/authentication/cookie/src/Extension/Cookie.php b/plugins/authentication/cookie/src/Extension/Cookie.php index 20b33d8623160..7a1b157ac7654 100644 --- a/plugins/authentication/cookie/src/Extension/Cookie.php +++ b/plugins/authentication/cookie/src/Extension/Cookie.php @@ -208,7 +208,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void try { $result = $db->setQuery($query)->loadObject(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $response->status = Authentication::STATUS_FAILURE; return; @@ -303,7 +303,7 @@ public function onUserAfterLogin(AfterLoginEvent $event): void if ($results === null) { $unique = true; } - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $errorCount++; // We'll let this query fail up to 5 times before giving up, there's probably a bigger issue at this point @@ -370,7 +370,7 @@ public function onUserAfterLogin(AfterLoginEvent $event): void try { $db->setQuery($query)->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // We aren't concerned with errors from this query, carry on } } @@ -416,7 +416,7 @@ public function onUserAfterLogout(AfterLogoutEvent $event): void try { $db->setQuery($query)->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // We aren't concerned with errors from this query, carry on } diff --git a/plugins/authentication/ldap/src/Extension/Ldap.php b/plugins/authentication/ldap/src/Extension/Ldap.php index 326171b6f9f88..5d11a818df7a4 100644 --- a/plugins/authentication/ldap/src/Extension/Ldap.php +++ b/plugins/authentication/ldap/src/Extension/Ldap.php @@ -143,7 +143,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void ], ]; // if these are not set, the system defaults are used - if (isset($cacertdir) && isset($cacertfile)) { + if (isset($cacertdir, $cacertfile)) { $options['options']['x_tls_cacertdir'] = $cacertdir; $options['options']['x_tls_cacertfile'] = $cacertfile; } diff --git a/plugins/content/confirmconsent/src/Field/ConsentBoxField.php b/plugins/content/confirmconsent/src/Field/ConsentBoxField.php index 8357cac139e50..01e322e7667a6 100644 --- a/plugins/content/confirmconsent/src/Field/ConsentBoxField.php +++ b/plugins/content/confirmconsent/src/Field/ConsentBoxField.php @@ -250,7 +250,7 @@ private function getAssignedArticleUrl() try { $article = $db->loadObject(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Something at the database layer went wrong return Route::_( 'index.php?option=com_content&view=article&id=' diff --git a/plugins/content/emailcloak/src/Extension/EmailCloak.php b/plugins/content/emailcloak/src/Extension/EmailCloak.php index 1c4e543d93110..ef6ac1fbe4d6e 100644 --- a/plugins/content/emailcloak/src/Extension/EmailCloak.php +++ b/plugins/content/emailcloak/src/Extension/EmailCloak.php @@ -11,6 +11,7 @@ namespace Joomla\Plugin\Content\EmailCloak\Extension; use Joomla\CMS\Event\Content\ContentPrepareEvent; +use Joomla\CMS\Event\CustomFields\AfterPrepareFieldEvent; use Joomla\CMS\Event\Finder\ResultEvent; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Plugin\CMSPlugin; @@ -38,8 +39,9 @@ final class EmailCloak extends CMSPlugin implements SubscriberInterface public static function getSubscribedEvents(): array { return [ - 'onContentPrepare' => 'onContentPrepare', - 'onFinderResult' => 'onFinderResult', + 'onContentPrepare' => 'onContentPrepare', + 'onFinderResult' => 'onFinderResult', + 'onCustomFieldsAfterPrepareField' => 'onCustomFieldsAfterPrepareField', ]; } @@ -96,6 +98,27 @@ public function onContentPrepare(ContentPrepareEvent $event) } } + /** + * Plugin that cloaks all emails in a custom field. + * + * @param AfterPrepareFieldEvent $event Event instance + * + * @return void + */ + public function onCustomFieldsAfterPrepareField(AfterPrepareFieldEvent $event) + { + // If the value is empty then there is nothing to do + if (empty($event->getValue())) { + return; + } + + $text = $this->cloak($event->getValue()); + + if ($text) { + $event->updateValue($text); + } + } + /** * Generate a search pattern based on link and text. * diff --git a/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php b/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php index 2b0d6b0b28a2d..64f19c61a275c 100644 --- a/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php +++ b/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php @@ -47,7 +47,7 @@ protected function getActiveSiteTemplate() try { return $db->loadObject(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $this->getApplication()->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return new \stdClass(); diff --git a/plugins/editors/tinymce/src/PluginTraits/XTDButtons.php b/plugins/editors/tinymce/src/PluginTraits/XTDButtons.php index efc432cf5da4e..b42dcf9b04754 100644 --- a/plugins/editors/tinymce/src/PluginTraits/XTDButtons.php +++ b/plugins/editors/tinymce/src/PluginTraits/XTDButtons.php @@ -74,7 +74,7 @@ private function tinyButtons($buttons, array $options = []): array if ($link && $link[0] !== '#') { $link = str_contains($link, '&') ? htmlspecialchars_decode($link) : $link; $link = Uri::base(true) . '/' . $link; - $options['src'] = $options['src'] ?? $link; + $options['src'] ??= $link; } // Set action to "modal" for legacy buttons, when possible @@ -85,9 +85,9 @@ private function tinyButtons($buttons, array $options = []): array $wa->useScript('joomla.dialog'); $legacyModal = false; - $options['popupType'] = $options['popupType'] ?? 'iframe'; - $options['textHeader'] = $options['textHeader'] ?? $title; - $options['iconHeader'] = $options['iconHeader'] ?? 'icon-' . $icon; + $options['popupType'] ??= 'iframe'; + $options['textHeader'] ??= $title; + $options['iconHeader'] ??= 'icon-' . $icon; } $coreButton = []; diff --git a/plugins/extension/finder/src/Extension/Finder.php b/plugins/extension/finder/src/Extension/Finder.php index 05acb5071e935..2b5332f6ffd86 100644 --- a/plugins/extension/finder/src/Extension/Finder.php +++ b/plugins/extension/finder/src/Extension/Finder.php @@ -177,7 +177,7 @@ function ($word) { try { $db->setQuery($query); $db->execute(); - } catch (\Exception $ex) { + } catch (\Exception) { // It would be nice if the common word is stored to the DB, but it isn't super important } } diff --git a/plugins/filesystem/local/src/Adapter/LocalAdapter.php b/plugins/filesystem/local/src/Adapter/LocalAdapter.php index 1e2f58d7b4dbf..2bc9619a60933 100644 --- a/plugins/filesystem/local/src/Adapter/LocalAdapter.php +++ b/plugins/filesystem/local/src/Adapter/LocalAdapter.php @@ -262,7 +262,7 @@ public function createFile(string $name, string $path, $data): string try { File::write($localPath, $data); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } if ($this->thumbnails && MediaHelper::isImage(pathinfo($localPath)['basename'])) { @@ -303,7 +303,7 @@ public function updateFile(string $name, string $path, $data) try { File::write($localPath, $data); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } if ($this->thumbnails && MediaHelper::isImage(pathinfo($localPath)['basename'])) { @@ -426,7 +426,7 @@ private function getPathInformation(string $path): \stdClass $obj->height = $props->height; $obj->thumb_path = $this->thumbnails ? $this->getThumbnail($path) : $this->getUrl($obj->path); - } catch (UnparsableImageException $e) { + } catch (UnparsableImageException) { // Ignore the exception - it's an image that we don't know how to parse right now } } @@ -537,7 +537,7 @@ private function copyFile(string $sourcePath, string $destinationPath, bool $for try { File::copy($sourcePath, $destinationPath); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_COPY_FILE_NOT_POSSIBLE')); } } @@ -564,7 +564,7 @@ private function copyFolder(string $sourcePath, string $destinationPath, bool $f if (is_file($destinationPath)) { File::delete($destinationPath); } - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE')); } @@ -652,7 +652,7 @@ private function moveFile(string $sourcePath, string $destinationPath, bool $for try { File::move($sourcePath, $destinationPath); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_NOT_POSSIBLE')); } } @@ -679,7 +679,7 @@ private function moveFolder(string $sourcePath, string $destinationPath, bool $f if (is_file($destinationPath)) { File::delete($destinationPath); } - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE')); } @@ -860,7 +860,7 @@ private function checkContent(string $localPath, string $mediaContent) try { File::delete($tmpFile); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } if (!$can) { @@ -986,7 +986,7 @@ private function createThumbnail(string $path, string $thumbnailPath): bool { try { (new Image($path))->createThumbnails([$this->thumbnailSize[0] . 'x' . $this->thumbnailSize[1]], Image::SCALE_INSIDE, \dirname($thumbnailPath), true); - } catch (\Exception $e) { + } catch (\Exception) { return false; } diff --git a/plugins/installer/override/src/Extension/Override.php b/plugins/installer/override/src/Extension/Override.php index 6cf60631e1d96..a1ea7e6782d32 100644 --- a/plugins/installer/override/src/Extension/Override.php +++ b/plugins/installer/override/src/Extension/Override.php @@ -175,7 +175,7 @@ public function getOverrideCoreList() try { /** @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $templateModel */ $templateModel = $this->getModel(); - } catch (\Exception $e) { + } catch (\Exception) { return []; } diff --git a/plugins/multifactorauth/email/src/Extension/Email.php b/plugins/multifactorauth/email/src/Extension/Email.php index 0924b6c83740f..2bd4d1edc0aa4 100644 --- a/plugins/multifactorauth/email/src/Extension/Email.php +++ b/plugins/multifactorauth/email/src/Extension/Email.php @@ -173,7 +173,7 @@ public function onUserMultifactorCaptive(Captive $event): void try { $this->sendCode($key, $user); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -476,7 +476,7 @@ function (MfaTable $record) { 'user_id' => $user->id, ] ); - } catch (\Exception $event) { + } catch (\Exception) { // Fail gracefully } } diff --git a/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php b/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php index d1df17ead70f9..e1604ae8dcbcd 100644 --- a/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php +++ b/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php @@ -344,7 +344,7 @@ public function onUserMultifactorCaptive(Captive $event): void ob_start(); include $layoutPath; $html = ob_get_clean(); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -422,7 +422,7 @@ public function onUserMultifactorValidate(Validate $event): void } catch (\Exception $e) { try { $this->getApplication()->enqueueMessage($e->getMessage(), 'error'); - } catch (\Exception $e) { + } catch (\Exception) { } $event->addResult(false); diff --git a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php index c9a8026199859..94444a801cd99 100644 --- a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php +++ b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php @@ -105,7 +105,7 @@ public static function verifyAttestation(string $data): ?PublicKeyCredentialSour try { $publicKeyCredentialCreationOptions = unserialize(base64_decode($encodedOptions)); - } catch (\Exception $e) { + } catch (\Exception) { $publicKeyCredentialCreationOptions = null; } @@ -274,7 +274,7 @@ private static function getWebauthnServer(?int $userId): Server try { $app = Factory::getApplication(); $siteName = $app->get('sitename'); - } catch (\Exception $e) { + } catch (\Exception) { $siteName = 'Joomla! Site'; } diff --git a/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php b/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php index 61f26ff9f1d54..ed10669dedf0c 100644 --- a/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php +++ b/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php @@ -319,7 +319,7 @@ function ($rec) use ($record) { return $rec->method === $record->method; } ); - } catch (\Exception $e) { + } catch (\Exception) { $records = []; } @@ -409,7 +409,7 @@ private function validateYubikeyOtp(string $otp): bool } else { continue; } - } catch (\Exception $exc) { + } catch (\Exception) { // No response, continue with the next server continue; } diff --git a/plugins/sampledata/multilang/src/Extension/MultiLanguage.php b/plugins/sampledata/multilang/src/Extension/MultiLanguage.php index 377c4a02f91a4..1974b8ed34e58 100644 --- a/plugins/sampledata/multilang/src/Extension/MultiLanguage.php +++ b/plugins/sampledata/multilang/src/Extension/MultiLanguage.php @@ -527,7 +527,7 @@ private function enablePlugin($pluginName) try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } @@ -553,7 +553,7 @@ private function enablePlugin($pluginName) try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } } @@ -590,7 +590,7 @@ private function disableModuleMainMenu() try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } @@ -922,7 +922,7 @@ private function addAssociations($groupedAssociations) try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } } @@ -956,7 +956,7 @@ private function addModuleInModuleMenu($moduleId) try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } @@ -1132,7 +1132,7 @@ private function addArticle($itemLanguage, $categoryId) if ($stage_id) { $workflow->createAssociation($newId, $stage_id); } - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } diff --git a/plugins/schemaorg/custom/src/Extension/Custom.php b/plugins/schemaorg/custom/src/Extension/Custom.php index 0024c560cbb73..b08065724c1b2 100644 --- a/plugins/schemaorg/custom/src/Extension/Custom.php +++ b/plugins/schemaorg/custom/src/Extension/Custom.php @@ -76,7 +76,7 @@ public function onSchemaPrepareSave(PrepareSaveEvent $event): void $schema = new Registry($subject->schema); $json = (new Registry($schema->get('json')))->toArray(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $this->getApplication()->enqueueMessage(Text::_('PLG_SCHEMAORG_CUSTOM_JSON_ERROR'), 'error'); return; } diff --git a/plugins/system/actionlogs/src/Extension/ActionLogs.php b/plugins/system/actionlogs/src/Extension/ActionLogs.php index 7c4de3bfb9870..0ed4effdde34d 100644 --- a/plugins/system/actionlogs/src/Extension/ActionLogs.php +++ b/plugins/system/actionlogs/src/Extension/ActionLogs.php @@ -182,7 +182,7 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void try { $values = $db->setQuery($query)->loadObject(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return; } @@ -292,7 +292,7 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Do nothing. } } @@ -325,7 +325,7 @@ public function onUserAfterDelete(User\AfterDeleteEvent $event): void try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Do nothing. } } @@ -399,7 +399,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void try { $values = $db->setQuery($query)->loadObjectList(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return; } @@ -420,7 +420,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Do nothing. } } diff --git a/plugins/system/debug/src/DataCollector/ProfileCollector.php b/plugins/system/debug/src/DataCollector/ProfileCollector.php index 11bd3d6853d39..328f931f2c944 100644 --- a/plugins/system/debug/src/DataCollector/ProfileCollector.php +++ b/plugins/system/debug/src/DataCollector/ProfileCollector.php @@ -263,7 +263,7 @@ public function setRequestEndTime($time): self */ public function collect(): array { - $this->requestEndTime = $this->requestEndTime ?? microtime(true); + $this->requestEndTime ??= microtime(true); $start = $this->requestStartTime; diff --git a/plugins/system/debug/src/JavascriptRenderer.php b/plugins/system/debug/src/JavascriptRenderer.php index d2daeea496bd9..eaf1ec39c0b4a 100644 --- a/plugins/system/debug/src/JavascriptRenderer.php +++ b/plugins/system/debug/src/JavascriptRenderer.php @@ -55,9 +55,9 @@ public function __construct(DebugBar $debugBar, $baseUrl = null, $basePath = nul */ public function renderHead() { - list($cssFiles, $jsFiles, $inlineCss, $inlineJs, $inlineHead) = $this->getAssets(null, self::RELATIVE_URL); - $html = ''; - $doc = Factory::getApplication()->getDocument(); + [$cssFiles, $jsFiles, $inlineCss, $inlineJs, $inlineHead] = $this->getAssets(null, self::RELATIVE_URL); + $html = ''; + $doc = Factory::getApplication()->getDocument(); foreach ($cssFiles as $file) { $html .= \sprintf('' . "\n", $file); diff --git a/plugins/system/guidedtours/src/Extension/GuidedTours.php b/plugins/system/guidedtours/src/Extension/GuidedTours.php index 15c9e81e9f18f..6598411423d2f 100644 --- a/plugins/system/guidedtours/src/Extension/GuidedTours.php +++ b/plugins/system/guidedtours/src/Extension/GuidedTours.php @@ -214,7 +214,7 @@ public function onBeforeCompileHead() try { $result = $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { // Do not start the tour. continue; } diff --git a/plugins/system/languagefilter/src/Extension/LanguageFilter.php b/plugins/system/languagefilter/src/Extension/LanguageFilter.php index eec4e7fb45706..7b085bf49decd 100644 --- a/plugins/system/languagefilter/src/Extension/LanguageFilter.php +++ b/plugins/system/languagefilter/src/Extension/LanguageFilter.php @@ -160,8 +160,7 @@ public function __construct( foreach ($this->sefs as $sef => $language) { if (!\array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) { - unset($this->lang_codes[$language->lang_code]); - unset($this->sefs[$language->sef]); + unset($this->lang_codes[$language->lang_code], $this->sefs[$language->sef]); } } } @@ -514,7 +513,7 @@ public function parseRule(&$router, &$uri) $language_new = $this->languageFactory->createLanguage($lang_code, (bool) $app->get('debug_lang')); foreach ($language->getPaths() as $extension => $files) { - if (str_contains($extension, 'plg_system')) { + if (str_starts_with($extension, 'plg_system')) { $extension_name = substr($extension, 11); $language_new->load($extension, JPATH_ADMINISTRATOR) diff --git a/plugins/system/log/src/Extension/Log.php b/plugins/system/log/src/Extension/Log.php index 96601d0569042..bf52c7c1abd76 100644 --- a/plugins/system/log/src/Extension/Log.php +++ b/plugins/system/log/src/Extension/Log.php @@ -81,7 +81,7 @@ public function onUserLoginFailure(LoginFailureEvent $event): void try { Logger::add($errorlog['comment'], Logger::INFO, $errorlog['status']); - } catch (\Exception $e) { + } catch (\Exception) { // If the log file is unwriteable during login then we should not go to the error page return; } diff --git a/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php b/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php index 17abfcce198c8..be7a3a344562a 100644 --- a/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php +++ b/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php @@ -200,7 +200,7 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void try { $this->getDatabase()->insertObject('#__privacy_consents', $userNote); - } catch (\Exception $e) { + } catch (\Exception) { // Do nothing if the save fails } diff --git a/plugins/system/redirect/src/Extension/Redirect.php b/plugins/system/redirect/src/Extension/Redirect.php index b74325bc5b77e..8bdb1b71c102d 100644 --- a/plugins/system/redirect/src/Extension/Redirect.php +++ b/plugins/system/redirect/src/Extension/Redirect.php @@ -214,7 +214,7 @@ public function handleError(ErrorEvent $event) try { $this->getDatabase()->updateObject('#__redirect_links', $redirect, 'id'); - } catch (\Exception $e) { + } catch (\Exception) { // We don't log issues for now } diff --git a/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php b/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php index a4ea9742b2dd3..b285b7e844795 100644 --- a/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php +++ b/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php @@ -163,7 +163,7 @@ public function runLazyCron(EventInterface $e) // Suppress all errors to avoid any output try { $this->runScheduler(); - } catch (\Exception $e) { + } catch (\Exception) { } ob_end_clean(); diff --git a/plugins/system/stats/src/Extension/Stats.php b/plugins/system/stats/src/Extension/Stats.php index 5e385cfd641db..208e451788440 100644 --- a/plugins/system/stats/src/Extension/Stats.php +++ b/plugins/system/stats/src/Extension/Stats.php @@ -498,7 +498,7 @@ private function saveParams() $result = $db->setQuery($query)->execute(); $this->clearCacheGroups(['com_plugins']); - } catch (\Exception $exc) { + } catch (\Exception) { // If we failed to execute $db->unlockTables(); $result = false; @@ -507,7 +507,7 @@ private function saveParams() try { // Unlock the tables after writing $db->unlockTables(); - } catch (\Exception $e) { + } catch (\Exception) { // If we can't lock the tables assume we have somehow failed $result = false; } @@ -585,7 +585,7 @@ private function clearCacheGroups(array $clearGroups) $cache = Cache::getInstance('callback', $options); $cache->clean(); - } catch (\Exception $e) { + } catch (\Exception) { // Ignore it } } @@ -623,7 +623,7 @@ private function disablePlugin() $result = $db->setQuery($query)->execute(); $this->clearCacheGroups(['com_plugins']); - } catch (\Exception $exc) { + } catch (\Exception) { // If we failed to execute $db->unlockTables(); $result = false; @@ -632,7 +632,7 @@ private function disablePlugin() try { // Unlock the tables after writing $db->unlockTables(); - } catch (\Exception $e) { + } catch (\Exception) { // If we can't lock the tables assume we have somehow failed $result = false; } diff --git a/plugins/system/tasknotification/src/Extension/TaskNotification.php b/plugins/system/tasknotification/src/Extension/TaskNotification.php index 31d3cb32b8e25..9097b6ab6a5a6 100644 --- a/plugins/system/tasknotification/src/Extension/TaskNotification.php +++ b/plugins/system/tasknotification/src/Extension/TaskNotification.php @@ -97,7 +97,7 @@ public function injectTaskNotificationFieldset(Model\PrepareFormEvent $event): b try { $formFile = Path::check($formFile); - } catch (\Exception $e) { + } catch (\Exception) { // Log? return false; } @@ -290,7 +290,7 @@ private function sendMail(string $template, array $data, string $attachment = '' try { $users = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return; } @@ -323,7 +323,7 @@ private function sendMail(string $template, array $data, string $attachment = '' $mailer->send(); $mailSent = true; - } catch (MailerException $exception) { + } catch (MailerException) { Log::add($this->getApplication()->getLanguage()->_('PLG_SYSTEM_TASK_NOTIFICATION_NOTIFY_SEND_EMAIL_FAIL'), Log::ERROR); } } diff --git a/plugins/system/webauthn/src/Authentication.php b/plugins/system/webauthn/src/Authentication.php index c8b12f620ad5a..3c7ab9e2c6208 100644 --- a/plugins/system/webauthn/src/Authentication.php +++ b/plugins/system/webauthn/src/Authentication.php @@ -308,7 +308,7 @@ public function validateAttestationResponse(string $data): PublicKeyCredentialSo /** @var PublicKeyCredentialCreationOptions|null $publicKeyCredentialCreationOptions */ try { $publicKeyCredentialCreationOptions = unserialize(base64_decode($encodedOptions)); - } catch (\Exception $e) { + } catch (\Exception) { Log::add('The plg_system_webauthn.publicKeyCredentialCreationOptions in the session is invalid', Log::NOTICE, 'webauthn.system'); $publicKeyCredentialCreationOptions = null; } @@ -392,7 +392,7 @@ private function getSiteIcon(): ?string '/templates/', '/templates/' . $this->app->getTemplate(), ]; - } catch (\Exception $e) { + } catch (\Exception) { return null; } @@ -502,7 +502,7 @@ private function getPKCredentialRequestOptions(): PublicKeyCredentialRequestOpti try { $publicKeyCredentialRequestOptions = unserialize(base64_decode($encodedOptions)); - } catch (\Exception $e) { + } catch (\Exception) { Log::add('Invalid plg_system_webauthn.publicKeyCredentialRequestOptions in the session', Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); diff --git a/plugins/system/webauthn/src/CredentialRepository.php b/plugins/system/webauthn/src/CredentialRepository.php index fc3c22877e08f..cfb5a03fc466a 100644 --- a/plugins/system/webauthn/src/CredentialRepository.php +++ b/plugins/system/webauthn/src/CredentialRepository.php @@ -79,7 +79,7 @@ public function findOneByCredentialId(string $publicKeyCredentialId): ?PublicKey try { return PublicKeyCredentialSource::createFromArray(json_decode($json, true)); - } catch (\Throwable $e) { + } catch (\Throwable) { return null; } } @@ -136,7 +136,7 @@ public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCre try { return PublicKeyCredentialSource::createFromArray($data); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { return null; } }; @@ -222,7 +222,7 @@ public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredent $o->user_id = $oldRecord->user_id; $o->label = $oldRecord->label; $update = true; - } catch (\Exception $e) { + } catch (\Exception) { } $o->credential = $this->encryptCredential($o->credential); @@ -304,7 +304,7 @@ public function getAll(int $userId): array $record['credential'] = PublicKeyCredentialSource::createFromArray($data); return $record; - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { $record['credential'] = null; return $record; @@ -338,7 +338,7 @@ public function has(string $credentialId): bool $count = $db->setQuery($query)->loadResult(); return $count > 0; - } catch (\Exception $e) { + } catch (\Exception) { return false; } } @@ -473,7 +473,7 @@ public function getUserIdFromHandle(?string $userHandle): ?int try { $numRecords = $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } @@ -501,7 +501,7 @@ public function getUserIdFromHandle(?string $userHandle): ?int while (true) { try { $ids = $db->setQuery($query, $start, $limit)->loadColumn(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } @@ -585,7 +585,7 @@ private function getEncryptionKey(): string /** @var Registry $config */ $config = $app->getConfig(); $secret = $config->get('secret', ''); - } catch (\Exception $e) { + } catch (\Exception) { $secret = ''; } @@ -621,7 +621,7 @@ private function formatDate($date, ?string $format = null, bool $tzAware = true) try { $tzDefault = Factory::getApplication()->get('offset'); - } catch (\Exception $e) { + } catch (\Exception) { $tzDefault = 'GMT'; } @@ -634,7 +634,7 @@ private function formatDate($date, ?string $format = null, bool $tzAware = true) $userTimeZone = new \DateTimeZone($tz); $jDate->setTimezone($userTimeZone); - } catch (\Exception $e) { + } catch (\Exception) { // Nothing. Fall back to UTC. } } diff --git a/plugins/system/webauthn/src/Extension/Webauthn.php b/plugins/system/webauthn/src/Extension/Webauthn.php index 876e04cd48971..4f468bdaae40d 100644 --- a/plugins/system/webauthn/src/Extension/Webauthn.php +++ b/plugins/system/webauthn/src/Extension/Webauthn.php @@ -155,7 +155,7 @@ public static function getSubscribedEvents(): array { try { $app = Factory::getApplication(); - } catch (\Exception $e) { + } catch (\Exception) { return []; } diff --git a/plugins/system/webauthn/src/MetadataRepository.php b/plugins/system/webauthn/src/MetadataRepository.php index 4d61056780c13..e157860ae4957 100644 --- a/plugins/system/webauthn/src/MetadataRepository.php +++ b/plugins/system/webauthn/src/MetadataRepository.php @@ -128,7 +128,7 @@ private function load(): void try { $jwtConfig = Configuration::forUnsecuredSigner(); $token = $jwtConfig->parser()->parse($rawJwt); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -153,7 +153,7 @@ private function load(): void } return MetadataStatement::createFromArray($array); - } catch (\Exception $e) { + } catch (\Exception) { return null; } }; diff --git a/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php b/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php index cbf17cd67bfde..573b962185711 100644 --- a/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php +++ b/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php @@ -138,7 +138,7 @@ private function mustDisplayButton(): bool */ try { $document = $this->getApplication()->getDocument(); - } catch (\Exception $e) { + } catch (\Exception) { $document = null; } diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php index 6de8ad4c124f3..d3c93729eca56 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php @@ -89,7 +89,7 @@ public function onAjaxWebauthnChallenge(AjaxChallenge $event): void try { $myUser = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById($userId); - } catch (\Exception $e) { + } catch (\Exception) { $myUser = new User(); } diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php index 1a7d0febe33a4..d064d2dc5784d 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php @@ -81,7 +81,7 @@ public function onAjaxWebauthnDelete(AjaxDelete $event): void // Delete the record try { $repository->remove($credentialId); - } catch (\Exception $e) { + } catch (\Exception) { $event->addResult(false); return; diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php index aa188019d20db..f1647f1057e03 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php @@ -90,7 +90,7 @@ public function onAjaxWebauthnSavelabel(AjaxSaveLabel $event): void // Save the new label try { $repository->setLabel($credentialId, $newLabel); - } catch (\Exception $e) { + } catch (\Exception) { $event->addResult(false); return; diff --git a/plugins/system/webauthn/src/PluginTraits/UserDeletion.php b/plugins/system/webauthn/src/PluginTraits/UserDeletion.php index 5dd83d6016c69..9a883f5157a80 100644 --- a/plugins/system/webauthn/src/PluginTraits/UserDeletion.php +++ b/plugins/system/webauthn/src/PluginTraits/UserDeletion.php @@ -66,7 +66,7 @@ public function onUserAfterDelete(Event $event): void try { $db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { // Don't worry if this fails } diff --git a/plugins/task/checkfiles/src/Extension/Checkfiles.php b/plugins/task/checkfiles/src/Extension/Checkfiles.php index 7c1ab16a9cbe0..a85f4c73b183c 100644 --- a/plugins/task/checkfiles/src/Extension/Checkfiles.php +++ b/plugins/task/checkfiles/src/Extension/Checkfiles.php @@ -143,7 +143,7 @@ protected function checkImages(ExecuteTaskEvent $event): int try { $image->resize($newWidth, $newHeight, false); - } catch (\LogicException $e) { + } catch (\LogicException) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_RESIZE_FAIL'), 'error'); return TaskStatus::KNOCKOUT; diff --git a/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php b/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php index 1b756739ca27c..0015106b2dfe6 100644 --- a/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php +++ b/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php @@ -94,7 +94,7 @@ private function deleteLogs(ExecuteTaskEvent $event): int try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Ignore it return Status::KNOCKOUT; } diff --git a/plugins/task/globalcheckin/src/Extension/Globalcheckin.php b/plugins/task/globalcheckin/src/Extension/Globalcheckin.php index 8f63a9aa035be..213c274f9ee18 100644 --- a/plugins/task/globalcheckin/src/Extension/Globalcheckin.php +++ b/plugins/task/globalcheckin/src/Extension/Globalcheckin.php @@ -88,7 +88,7 @@ protected function makeCheckin(ExecuteTaskEvent $event): int $fields = $db->getTableColumns($tn, false); - if (!(isset($fields['checked_out']) && isset($fields['checked_out_time']))) { + if (!(isset($fields['checked_out'], $fields['checked_out_time']))) { continue; } @@ -114,7 +114,7 @@ protected function makeCheckin(ExecuteTaskEvent $event): int try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // This failure isn't critical, don't care too much $failed = true; } diff --git a/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php b/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php index 2114be4957825..4ff194dd5d8e5 100644 --- a/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php +++ b/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php @@ -133,7 +133,7 @@ private function remindExpiringConsents($expire, $remind): int try { $users = $db->setQuery($query)->loadObjectList(); - } catch (\RuntimeException $exception) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } @@ -183,10 +183,10 @@ private function remindExpiringConsents($expire, $remind): int try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } - } catch (MailDisabledException | phpmailerException $exception) { + } catch (MailDisabledException | phpmailerException) { return Status::KNOCKOUT; } } @@ -222,7 +222,7 @@ private function invalidateExpiredConsents($expire): int try { $users = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } @@ -246,7 +246,7 @@ private function invalidateExpiredConsents($expire): int try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } diff --git a/plugins/task/requests/src/Extension/Requests.php b/plugins/task/requests/src/Extension/Requests.php index 606d1d9a00b9a..eb595d0ac3b18 100644 --- a/plugins/task/requests/src/Extension/Requests.php +++ b/plugins/task/requests/src/Extension/Requests.php @@ -146,7 +146,7 @@ protected function makeGetRequest(ExecuteTaskEvent $event): int File::write($responseFilename, $responseBody); $this->snapshot['output_file'] = $responseFilename; $responseStatus = 'SAVED'; - } catch (\Exception $e) { + } catch (\Exception) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_UNWRITEABLE_OUTPUT'), 'error'); $responseStatus = 'NOT_SAVED'; } diff --git a/plugins/task/rotatelogs/src/Extension/RotateLogs.php b/plugins/task/rotatelogs/src/Extension/RotateLogs.php index 542de9e9746a9..65237a2abd97b 100644 --- a/plugins/task/rotatelogs/src/Extension/RotateLogs.php +++ b/plugins/task/rotatelogs/src/Extension/RotateLogs.php @@ -103,7 +103,7 @@ private function rotateLogs(ExecuteTaskEvent $event): int foreach ($files as $file) { try { File::delete($logPath . '/' . $file); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } } } else { @@ -146,7 +146,7 @@ private function rotate($path, $filename, $currentVersion) try { File::move($path . '/' . $filename, $rotatedFile); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } } diff --git a/plugins/task/sitestatus/src/Extension/SiteStatus.php b/plugins/task/sitestatus/src/Extension/SiteStatus.php index da446799f2282..6bf6064da0806 100644 --- a/plugins/task/sitestatus/src/Extension/SiteStatus.php +++ b/plugins/task/sitestatus/src/Extension/SiteStatus.php @@ -171,7 +171,7 @@ private function writeConfigFile(Registry $config): int // Attempt to write the configuration file as a PHP class named JConfig. $configuration = $config->toString('PHP', ['class' => 'JConfig', 'closingtag' => false]); File::write($file, $configuration); - } catch (\Exception $e) { + } catch (\Exception) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_ERROR_WRITE_FAILED'), 'error'); return Status::KNOCKOUT; diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 7ad5464b0c54e..c685edb9413ac 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -203,7 +203,7 @@ private function sendNotification(ExecuteTaskEvent $event): int } catch (MailDisabledException | phpMailerException $exception) { try { $this->logTask($jLanguage->_($exception->getMessage())); - } catch (\RuntimeException $exception) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } } @@ -300,7 +300,7 @@ private function getSuperUsers($email = null) $db->setQuery($query); $ret = $db->loadObjectList(); - } catch (\Exception $exc) { + } catch (\Exception) { return $ret; } diff --git a/plugins/user/contactcreator/src/Extension/ContactCreator.php b/plugins/user/contactcreator/src/Extension/ContactCreator.php index f9070ab324804..fe4c35c3782c1 100644 --- a/plugins/user/contactcreator/src/Extension/ContactCreator.php +++ b/plugins/user/contactcreator/src/Extension/ContactCreator.php @@ -108,7 +108,7 @@ public function onUserAfterSave(AfterSaveEvent $event): void // Check if the contact already exists to generate new name & alias if required if ($contact->id == 0) { - list($name, $alias) = $this->generateAliasAndName($contact->alias, $contact->name, $categoryId); + [$name, $alias] = $this->generateAliasAndName($contact->alias, $contact->name, $categoryId); $contact->name = $name; $contact->alias = $alias; diff --git a/plugins/user/joomla/src/Extension/Joomla.php b/plugins/user/joomla/src/Extension/Joomla.php index 2e57b02b22b2a..09148bab8d66c 100644 --- a/plugins/user/joomla/src/Extension/Joomla.php +++ b/plugins/user/joomla/src/Extension/Joomla.php @@ -164,7 +164,7 @@ public function onUserAfterDelete(AfterDeleteEvent $event): void try { $db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { // Do nothing } } @@ -349,7 +349,7 @@ public function onUserLogin(LoginEvent $event) try { $db->setQuery($query)->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // The old session is already invalidated, don't let this block logging in } diff --git a/plugins/user/profile/src/Extension/Profile.php b/plugins/user/profile/src/Extension/Profile.php index 37961248c2310..0f42e8c13a186 100644 --- a/plugins/user/profile/src/Extension/Profile.php +++ b/plugins/user/profile/src/Extension/Profile.php @@ -328,7 +328,7 @@ public function onUserBeforeSave(BeforeSaveEvent $event) try { $date = new Date($data['profile']['dob']); $this->date = $date->format('Y-m-d H:i:s'); - } catch (\Exception $e) { + } catch (\Exception) { // Throw an exception if date is not valid. throw new \InvalidArgumentException($this->getApplication()->getLanguage()->_('PLG_USER_PROFILE_ERROR_INVALID_DOB')); } diff --git a/plugins/user/token/src/Extension/Token.php b/plugins/user/token/src/Extension/Token.php index a523718476323..96591be720708 100644 --- a/plugins/user/token/src/Extension/Token.php +++ b/plugins/user/token/src/Extension/Token.php @@ -158,7 +158,7 @@ public function onContentPrepareData(PrepareDataEvent $event): void $data->{$this->profileKeyPrefix}[$k] = $v[1]; } - } catch (\Exception $e) { + } catch (\Exception) { // We suppress any database error. It means we get no token saved by default. } @@ -428,7 +428,7 @@ public function onUserAfterDelete(AfterDeleteEvent $event): void $query->bind(':profileKey', $profileKey, ParameterType::STRING); $db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { // Do nothing. } } @@ -473,7 +473,7 @@ private function getTokenSeedForUser(int $userId): ?string $query->bind(':userId', $userId, ParameterType::INTEGER); return $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } } @@ -553,7 +553,7 @@ private function getTokenForDisplay( try { $siteSecret = $this->getApplication()->get('secret'); - } catch (\Exception $e) { + } catch (\Exception) { $siteSecret = ''; } @@ -620,7 +620,7 @@ private function hasTokenProfileFields(?int $userId): bool try { $numRows = $db->setQuery($q)->loadResult() ?? 0; - } catch (\Exception $e) { + } catch (\Exception) { return false; } diff --git a/plugins/user/token/src/Field/JoomlatokenField.php b/plugins/user/token/src/Field/JoomlatokenField.php index 7de4cbc7751ae..5aa1570344b9b 100644 --- a/plugins/user/token/src/Field/JoomlatokenField.php +++ b/plugins/user/token/src/Field/JoomlatokenField.php @@ -104,7 +104,7 @@ private function getTokenForDisplay(string $tokenSeed): string try { $siteSecret = Factory::getApplication()->get('secret'); - } catch (\Exception $e) { + } catch (\Exception) { $siteSecret = ''; } diff --git a/tests/System/README.md b/tests/System/README.md index d9f5e1050bdbf..e4237413c95f7 100644 --- a/tests/System/README.md +++ b/tests/System/README.md @@ -290,7 +290,7 @@ sudo npm run cypress:run If the `root` user does not have a Cypress installation, you can use the Cypress installation cache of the current user: ``` -CYPRESS_CACHE_FOLDER=$HOME/.cache/Cypress sudo npm run cypress:run +sudo CYPRESS_CACHE_FOLDER=$HOME/.cache/Cypress npm run cypress:run ``` diff --git a/tests/System/data/com_media/test-image-1.jpg b/tests/System/data/com_media/test-image-1.jpg deleted file mode 100644 index edf94915fd28e..0000000000000 Binary files a/tests/System/data/com_media/test-image-1.jpg and /dev/null differ diff --git a/tests/System/data/com_media/test-image-1.png b/tests/System/data/com_media/test-image-1.png deleted file mode 100644 index 8a1daa0121d52..0000000000000 Binary files a/tests/System/data/com_media/test-image-1.png and /dev/null differ diff --git a/tests/System/data/com_media/test-image-2.png b/tests/System/data/com_media/test-image-2.png deleted file mode 100644 index 8a1daa0121d52..0000000000000 Binary files a/tests/System/data/com_media/test-image-2.png and /dev/null differ diff --git a/tests/System/fixtures/com_media/test-image-1.jpg b/tests/System/fixtures/com_media/test-image-1.jpg new file mode 100644 index 0000000000000..04ed6209f02c0 Binary files /dev/null and b/tests/System/fixtures/com_media/test-image-1.jpg differ diff --git a/tests/System/fixtures/com_media/test-image-2.jpg b/tests/System/fixtures/com_media/test-image-2.jpg new file mode 100644 index 0000000000000..d780f8931c364 Binary files /dev/null and b/tests/System/fixtures/com_media/test-image-2.jpg differ diff --git a/tests/System/fixtures/com_media/test-image-3.jpg b/tests/System/fixtures/com_media/test-image-3.jpg new file mode 100644 index 0000000000000..231009b941419 Binary files /dev/null and b/tests/System/fixtures/com_media/test-image-3.jpg differ diff --git a/tests/System/integration/administrator/components/com_menu/Menu.cy.js b/tests/System/integration/administrator/components/com_menu/Menu.cy.js index f775ca49edd43..1b44800c02245 100644 --- a/tests/System/integration/administrator/components/com_menu/Menu.cy.js +++ b/tests/System/integration/administrator/components/com_menu/Menu.cy.js @@ -1,4 +1,4 @@ -describe('Test in backend that the user form', () => { +describe('Test in backend that the menu form', () => { beforeEach(() => cy.doAdministratorLogin()); afterEach(() => cy.task('queryDB', "DELETE FROM #__menu_types WHERE menutype = 'test'")); diff --git a/tests/System/integration/api/com_media/Files.cy.js b/tests/System/integration/api/com_media/Files.cy.js index 5260022a981e4..37507085491b0 100644 --- a/tests/System/integration/api/com_media/Files.cy.js +++ b/tests/System/integration/api/com_media/Files.cy.js @@ -1,15 +1,27 @@ describe('Test that media files API endpoint', () => { - // Ensure 'test-dir' (relative to cmsPath) is available and has correct permissions + // Create relative path to the fixtures images directory, from Cypress config and platform independent + const fixturesFolder = Cypress.config('fixturesFolder').replace(/\\/g, '/'); + // projectRoot is e.g. 'C:\laragon\www\joomla53\tests\System\fixtures' + const projectRoot = Cypress.config('projectRoot').replace(/\\/g, '/'); + // Result is e.g. 'tests/System/fixtures/com_media' + const mediaFixturesFolder = `${fixturesFolder + .replace(projectRoot, '') + .replace(/^\//, '')}/com_media`; + + // Create directories and test images before running each test beforeEach(() => { - cy.task('writeRelativeFile', { path: 'images/test-dir/dummy.txt', content: '1' }); - cy.task('writeRelativeFile', { path: 'files/test-image-1.jpg', content: '1' }); + // Ensure 'files/test-dir' exists (relative to cmsPath) and has the correct permissions cy.task('writeRelativeFile', { path: 'files/test-dir/dummy.txt', content: '1' }); - cy.task('writeRelativeFile', { path: 'files/test-dir/test-image-1-subfolder.jpg', content: '1' }); - }); - // If it exists, delete the 'test-dir' (relative to cmsPath) and its contents - afterEach(() => { - cy.task('deleteRelativePath', 'images/test-dir'); + // Ensure 'images/test-dir2' exists (relative to cmsPath) and has the correct permissions + cy.task('writeRelativeFile', { path: 'images/test-dir2/dummy.txt', content: '1' }); + cy.task('copyRelativeFile', { source: `${mediaFixturesFolder}/test-image-1.jpg`, destination: 'files/test-image-1.jpg' }); + cy.task('copyRelativeFile', { source: `${mediaFixturesFolder}/test-image-2.jpg`, destination: 'files/test-dir/test-image-2.jpg' }); + cy.task('copyRelativeFile', { source: `${mediaFixturesFolder}/test-image-3.jpg`, destination: 'images/test-dir2/test-image-3.jpg' }); + }); + // Delete all files and directories created during the test, only for clean-up and only if they exist + after(() => { cy.task('deleteRelativePath', 'files/test-dir'); + cy.task('deleteRelativePath', 'images/test-dir2'); cy.task('deleteRelativePath', 'files/test-image-1.jpg'); }); @@ -23,7 +35,7 @@ describe('Test that media files API endpoint', () => { it('can deliver a list of files in a subfolder', () => { cy.api_get('/media/files/test-dir/') - .then((response) => cy.api_responseContains(response, 'name', 'test-image-1-subfolder.jpg')); + .then((response) => cy.api_responseContains(response, 'name', 'test-image-2.jpg')); }); it('can deliver a list of files with an adapter', () => { @@ -61,7 +73,7 @@ describe('Test that media files API endpoint', () => { }); it('can create a file without adapter', () => { - cy.readFile('tests/System/data/com_media/test-image-1.jpg', 'binary') + cy.readFile('tests/System/fixtures/com_media/test-image-1.jpg', 'binary') .then((data) => cy.api_post('/media/files', { path: 'test-dir/test.jpg', content: Buffer.from(data, 'binary').toString('base64') })) .then((response) => { cy.wrap(response).its('body').its('data').its('attributes') @@ -86,33 +98,33 @@ describe('Test that media files API endpoint', () => { }); it('can create a file with adapter', () => { - cy.readFile('tests/System/data/com_media/test-image-1.jpg', 'binary') - .then((data) => cy.api_post('/media/files', { path: 'local-images:/test-dir/test.jpg', content: Buffer.from(data, 'binary').toString('base64') })) + cy.readFile('tests/System/fixtures/com_media/test-image-2.jpg', 'binary') + .then((data) => cy.api_post('/media/files', { path: 'local-images:/test-dir2/test.jpg', content: Buffer.from(data, 'binary').toString('base64') })) .then((response) => { cy.wrap(response).its('body').its('data').its('attributes') .its('name') .should('include', 'test.jpg'); cy.wrap(response).its('body').its('data').its('attributes') .its('path') - .should('include', 'local-images:/test-dir/test.jpg'); + .should('include', 'local-images:/test-dir2/test.jpg'); }); }); it('can create a folder with adapter', () => { - cy.api_post('/media/files', { path: 'local-images:/test-dir/test-from-create' }) + cy.api_post('/media/files', { path: 'local-images:/test-dir2/test-from-create' }) .then((response) => { cy.wrap(response).its('body').its('data').its('attributes') .its('name') .should('include', 'test-from-create'); cy.wrap(response).its('body').its('data').its('attributes') .its('path') - .should('include', 'local-images:/test-dir/test-from-create'); + .should('include', 'local-images:/test-dir2/test-from-create'); }); }); it('can update a file without adapter', () => { - cy.task('writeRelativeFile', { path: 'files/test-dir/override.jpg', content: '1' }) - .then(() => cy.readFile('tests/System/data/com_media/test-image-1.jpg', 'binary')) + cy.task('writeRelativeFile', { path: 'files/test-dir/override.jpg', content: '1', mode: 0o666 }) + .then(() => cy.readFile('tests/System/fixtures/com_media/test-image-1.jpg', 'binary')) .then((data) => cy.api_patch( '/media/files/test-dir/override.jpg', { path: 'test-dir/override.jpg', content: Buffer.from(data, 'binary').toString('base64') }, @@ -127,7 +139,7 @@ describe('Test that media files API endpoint', () => { }); it('can update a folder without adapter', () => { - cy.task('writeRelativeFile', { path: 'files/test-dir/override/test.jpg', content: '1' }) + cy.task('writeRelativeFile', { path: 'files/test-dir/override/test.jpg', content: '1', mode: 0o666 }) .then(() => cy.api_patch('/media/files/test-dir/override', { path: 'test-dir/override-new' })) .then((response) => { cy.wrap(response).its('body').its('data').its('attributes') @@ -140,51 +152,47 @@ describe('Test that media files API endpoint', () => { }); it('can update a file with adapter', () => { - cy.task('writeRelativeFile', { path: 'images/test-dir/override.jpg', content: '1' }) - .then(() => cy.readFile('tests/System/data/com_media/test-image-1.jpg', 'binary')) + cy.task('writeRelativeFile', { path: 'images/test-dir2/override.jpg', content: '1', mode: 0o666 }) + .then(() => cy.readFile('tests/System/fixtures/com_media/test-image-2.jpg', 'binary')) .then((data) => cy.api_patch( - '/media/files/local-images:/test-dir/override.jpg', - { path: 'local-images:/test-dir/override.jpg', content: Buffer.from(data, 'binary').toString('base64') }, + '/media/files/local-images:/test-dir2/override.jpg', + { path: 'local-images:/test-dir2/override.jpg', content: Buffer.from(data, 'binary').toString('base64') }, )).then((response) => { cy.wrap(response).its('body').its('data').its('attributes') .its('name') .should('include', 'override.jpg'); cy.wrap(response).its('body').its('data').its('attributes') .its('path') - .should('include', 'local-images:/test-dir/override.jpg'); + .should('include', 'local-images:/test-dir2/override.jpg'); }); }); it('can update a folder with adapter', () => { - cy.task('writeRelativeFile', { path: 'images/test-dir/override/test.jpg', content: '1' }) - .then(() => cy.api_patch('/media/files/local-images:/test-dir/override', { path: 'local-images:/test-dir/override-new' })) + cy.task('writeRelativeFile', { path: 'images/test-dir2/override/test.jpg', content: '1', mode: 0o666 }) + .then(() => cy.api_patch('/media/files/local-images:/test-dir2/override', { path: 'local-images:/test-dir2/override-new' })) .then((response) => { cy.wrap(response).its('body').its('data').its('attributes') .its('name') .should('include', 'override-new'); cy.wrap(response).its('body').its('data').its('attributes') .its('path') - .should('include', 'local-images:/test-dir/override-new'); + .should('include', 'local-images:/test-dir2/override-new'); }); }); - it('can delete a file without adapter', () => { - cy.task('writeRelativeFile', { path: 'files/test-dir/todelete.jpg', content: '1' }) - .then(() => cy.api_delete('/media/files/test-dir/todelete.jpg')); + it("can delete an image in 'files' without adapter", () => { + cy.api_delete('/media/files/test-dir/test-image-2.jpg'); }); - it('can delete a folder without adapter', () => { - cy.task('writeRelativeFile', { path: 'files/test-dir/todelete/dummy.txt', content: '1' }) - .then(() => cy.api_delete('/media/files/test-dir/todelete')); + it("can delete a folder in 'files' without adapter", () => { + cy.api_delete('/media/files/test-dir'); }); - it('can delete a file with adapter', () => { - cy.task('writeRelativeFile', { path: 'images/test-dir/todelete.jpg', content: '1' }) - .then(() => cy.api_delete('/media/files/local-images:/test-dir/todelete.jpg')); + it("can delete an image in 'images' with adapter", () => { + cy.api_delete('/media/files/local-images:/test-dir2/test-image-3.jpg'); }); - it('can delete a folder with adapter', () => { - cy.task('writeRelativeFile', { path: 'images/test-dir/todelete/dummy.txt', content: '1' }) - .then(() => cy.api_delete('/media/files/local-images:/test-dir/todelete')); + it("can delete a folder in 'images' with adapter", () => { + cy.api_delete('/media/files/local-images:/test-dir2'); }); }); diff --git a/tests/System/integration/install/Installation.cy.js b/tests/System/integration/install/Installation.cy.js index e2e04997da1c8..81b40090ef5ae 100644 --- a/tests/System/integration/install/Installation.cy.js +++ b/tests/System/integration/install/Installation.cy.js @@ -19,6 +19,9 @@ describe('Install Joomla', () => { cy.task('deleteRelativePath', 'configuration.php'); cy.installJoomla(config); + // Disable compat plugin + cy.db_enableExtension(0, 'plg_behaviour_compat'); + cy.doAdministratorLogin(config.username, config.password, false); cy.cancelTour(); cy.disableStatistics(); diff --git a/tests/System/support/commands/db.mjs b/tests/System/support/commands/db.mjs index 733b0c455f29f..939372c80126a 100644 --- a/tests/System/support/commands/db.mjs +++ b/tests/System/support/commands/db.mjs @@ -631,38 +631,16 @@ Cypress.Commands.add('db_getUserId', () => { * @returns integer */ Cypress.Commands.add('db_setInvalidTufRoot', () => { - cy.task('queryDB', 'DELETE FROM #__tuf_metadata WHERE id = 1'); cy.task('queryDB', 'DELETE FROM #__updates WHERE update_site_id = 1'); - cy.task('queryDB', createInsertQuery( - 'tuf_metadata', - { - id: 1, - update_site_id: 1, - root: JSON.stringify(invalidTufMetadata.root), - targets: '', - snapshot: '', - timestamp: '', - }, - )); + cy.task('queryDB', `UPDATE #__tuf_metadata SET root = '${JSON.stringify(invalidTufMetadata.root)}', targets = '', snapshot = '', timestamp = '' WHERE id = 1`); }); /** - * Inserts an invalid tuf metadata set + * Inserts a valid tuf metadata set * * @returns integer */ Cypress.Commands.add('db_setValidTufRoot', () => { - cy.task('queryDB', 'DELETE FROM #__tuf_metadata WHERE id = 1'); cy.task('queryDB', 'DELETE FROM #__updates WHERE update_site_id = 1'); - cy.task('queryDB', createInsertQuery( - 'tuf_metadata', - { - id: 1, - update_site_id: 1, - root: JSON.stringify(validTufMetadata.root), - targets: '', - snapshot: '', - timestamp: '', - }, - )); + cy.task('queryDB', `UPDATE #__tuf_metadata SET root = '${JSON.stringify(validTufMetadata.root)}', targets = '', snapshot = '', timestamp = '' WHERE id = 1`); });