From 6a587ced0894af8568c96974ebee55479ae6851d Mon Sep 17 00:00:00 2001 From: Martina Scholz Date: Mon, 8 Jul 2024 12:29:07 +0200 Subject: [PATCH 01/12] Joomla! 5.1.2 Stable --- administrator/components/com_fields/forms/field.xml | 2 +- administrator/manifests/files/joomla.xml | 2 +- .../system/js/fields/joomla-field-fancy-select.w-c.es6.js | 4 ++-- components/com_wrapper/tmpl/wrapper/default.xml | 2 ++ libraries/src/Form/Field/AccessiblemediaField.php | 3 +++ libraries/src/HTML/Helpers/StringHelper.php | 6 ++++-- libraries/src/Version.php | 8 ++++---- modules/mod_wrapper/mod_wrapper.xml | 4 +++- package-lock.json | 4 ++-- 9 files changed, 22 insertions(+), 13 deletions(-) diff --git a/administrator/components/com_fields/forms/field.xml b/administrator/components/com_fields/forms/field.xml index 88157e4abbf3e..06a3c51ff6534 100644 --- a/administrator/components/com_fields/forms/field.xml +++ b/administrator/components/com_fields/forms/field.xml @@ -90,7 +90,7 @@ name="default_value" type="textarea" label="COM_FIELDS_FIELD_DEFAULT_VALUE_LABEL" - filter="raw" + filter="safehtml" /> www.joomla.org (C) 2019 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt - 5.1.2-rc3-dev + 5.1.2 2024-07 FILES_JOOMLA_XML_DESCRIPTION diff --git a/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js index 1618bd00af6d6..b8b4f08fef222 100644 --- a/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-fancy-select.w-c.es6.js @@ -239,8 +239,8 @@ window.customElements.define('joomla-field-fancy-select', class extends HTMLElem // Create and add new this.choicesInstance.setChoices([{ - value: this.newItemPrefix + event.target.value, - label: event.target.value, + value: new DOMParser().parseFromString(this.newItemPrefix + event.target.value, 'text/html').body.textContent, + label: new DOMParser().parseFromString(event.target.value, 'text/html').body.textContent, selected: true, customProperties: { value: event.target.value, // Store real value, just in case diff --git a/components/com_wrapper/tmpl/wrapper/default.xml b/components/com_wrapper/tmpl/wrapper/default.xml index 7c04e6653ac44..7f8f5a304bcfa 100644 --- a/components/com_wrapper/tmpl/wrapper/default.xml +++ b/components/com_wrapper/tmpl/wrapper/default.xml @@ -16,6 +16,8 @@ diff --git a/libraries/src/Form/Field/AccessiblemediaField.php b/libraries/src/Form/Field/AccessiblemediaField.php index b8ff8feb03388..2c379d6908e48 100644 --- a/libraries/src/Form/Field/AccessiblemediaField.php +++ b/libraries/src/Form/Field/AccessiblemediaField.php @@ -195,6 +195,9 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) preview="$this->preview" preview_width="$this->previewWidth" preview_height="$this->previewHeight" + schemes="http,https,ftp,ftps,data,file" + validate="url" + relative="true" /> ', '> ', $text); $text = str_replace([' ', ' '], ' ', $text); $text = FrameworkStringHelper::trim(preg_replace('#\s+#mui', ' ', $text)); - // Strip the tags from the input and decode entities. + // Strip tags from the input. $text = strip_tags($text); - $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); // Remove remaining extra spaces. $text = str_replace(' ', ' ', $text); diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 02113d8bd9afe..32ed17d54d1ca 100644 --- a/libraries/src/Version.php +++ b/libraries/src/Version.php @@ -66,7 +66,7 @@ final class Version * @var string * @since 3.8.0 */ - public const EXTRA_VERSION = 'rc3-dev'; + public const EXTRA_VERSION = ''; /** * Development status. @@ -74,7 +74,7 @@ final class Version * @var string * @since 3.5 */ - public const DEV_STATUS = 'Development'; + public const DEV_STATUS = 'Stable'; /** * Code name. @@ -90,7 +90,7 @@ final class Version * @var string * @since 3.5 */ - public const RELDATE = '8-July-2024'; + public const RELDATE = '9-July-2024'; /** * Release time. @@ -98,7 +98,7 @@ final class Version * @var string * @since 3.5 */ - public const RELTIME = '09:45'; + public const RELTIME = '16:00'; /** * Release timezone. diff --git a/modules/mod_wrapper/mod_wrapper.xml b/modules/mod_wrapper/mod_wrapper.xml index c98c7e2c04af7..b44cd4c9ea3e4 100644 --- a/modules/mod_wrapper/mod_wrapper.xml +++ b/modules/mod_wrapper/mod_wrapper.xml @@ -25,7 +25,9 @@
diff --git a/package-lock.json b/package-lock.json index b1dffa9508ab8..5b319b5865b97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "joomla", - "version": "5.1.1", + "version": "5.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "joomla", - "version": "5.1.1", + "version": "5.1.2", "hasInstallScript": true, "license": "GPL-2.0-or-later", "dependencies": { From 2b28735195558a397b239cb45f6518fdd3f2b9c3 Mon Sep 17 00:00:00 2001 From: Martina Scholz Date: Tue, 9 Jul 2024 18:04:43 +0200 Subject: [PATCH 02/12] reset to dev --- administrator/language/en-GB/install.xml | 2 +- administrator/language/en-GB/langmetadata.xml | 2 +- administrator/manifests/files/joomla.xml | 2 +- administrator/manifests/packages/pkg_en-GB.xml | 2 +- api/language/en-GB/install.xml | 2 +- api/language/en-GB/langmetadata.xml | 2 +- installation/language/en-GB/langmetadata.xml | 2 +- language/en-GB/install.xml | 2 +- language/en-GB/langmetadata.xml | 2 +- libraries/src/Version.php | 8 ++++---- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index 03e4f85383704..8939026e5e55d 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (en-GB) en-GB - 5.1.2 + 5.1.3 2024-07 Joomla! Project admin@joomla.org diff --git a/administrator/language/en-GB/langmetadata.xml b/administrator/language/en-GB/langmetadata.xml index 42f5616bf028d..ac71361117e9e 100644 --- a/administrator/language/en-GB/langmetadata.xml +++ b/administrator/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (en-GB) - 5.1.2 + 5.1.3 2024-07 Joomla! Project admin@joomla.org diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index a7cd5462d0560..500b63cb946d8 100644 --- a/administrator/manifests/files/joomla.xml +++ b/administrator/manifests/files/joomla.xml @@ -6,7 +6,7 @@ www.joomla.org (C) 2019 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt - 5.1.2 + 5.1.3-dev 2024-07 FILES_JOOMLA_XML_DESCRIPTION diff --git a/administrator/manifests/packages/pkg_en-GB.xml b/administrator/manifests/packages/pkg_en-GB.xml index 362e73bd40352..6c0781b147e54 100644 --- a/administrator/manifests/packages/pkg_en-GB.xml +++ b/administrator/manifests/packages/pkg_en-GB.xml @@ -2,7 +2,7 @@ English (en-GB) Language Pack en-GB - 5.1.2.1 + 5.1.3.1 2024-07 Joomla! Project admin@joomla.org diff --git a/api/language/en-GB/install.xml b/api/language/en-GB/install.xml index 2559980607bed..497ef6e424fa4 100644 --- a/api/language/en-GB/install.xml +++ b/api/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (en-GB) en-GB - 5.1.2 + 5.1.3 2024-07 Joomla! Project admin@joomla.org diff --git a/api/language/en-GB/langmetadata.xml b/api/language/en-GB/langmetadata.xml index 63822cd83ef87..15331554a48a3 100644 --- a/api/language/en-GB/langmetadata.xml +++ b/api/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (en-GB) - 5.1.2 + 5.1.3 2024-07 Joomla! Project admin@joomla.org diff --git a/installation/language/en-GB/langmetadata.xml b/installation/language/en-GB/langmetadata.xml index da4b795fd084e..a72c4899637db 100644 --- a/installation/language/en-GB/langmetadata.xml +++ b/installation/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (United Kingdom) - 5.1.2 + 5.1.3 2024-07 Joomla! Project (C) 2005 Open Source Matters, Inc. diff --git a/language/en-GB/install.xml b/language/en-GB/install.xml index 144e6e93f0003..530bd44c68a57 100644 --- a/language/en-GB/install.xml +++ b/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (en-GB) en-GB - 5.1.2 + 5.1.3 2024-07 Joomla! Project admin@joomla.org diff --git a/language/en-GB/langmetadata.xml b/language/en-GB/langmetadata.xml index d8b32157402ce..3fde9130743c8 100644 --- a/language/en-GB/langmetadata.xml +++ b/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (en-GB) - 5.1.2 + 5.1.3 2024-07 Joomla! Project admin@joomla.org diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 32ed17d54d1ca..0a70e18f85ac2 100644 --- a/libraries/src/Version.php +++ b/libraries/src/Version.php @@ -55,7 +55,7 @@ final class Version * @var integer * @since 3.8.0 */ - public const PATCH_VERSION = 2; + public const PATCH_VERSION = 3; /** * Extra release version info. @@ -66,7 +66,7 @@ final class Version * @var string * @since 3.8.0 */ - public const EXTRA_VERSION = ''; + public const EXTRA_VERSION = 'dev'; /** * Development status. @@ -74,7 +74,7 @@ final class Version * @var string * @since 3.5 */ - public const DEV_STATUS = 'Stable'; + public const DEV_STATUS = 'Development'; /** * Code name. @@ -98,7 +98,7 @@ final class Version * @var string * @since 3.5 */ - public const RELTIME = '16:00'; + public const RELTIME = '16:01'; /** * Release timezone. From a682c8b2e73f9aae4326589498a0392026b967f6 Mon Sep 17 00:00:00 2001 From: Tobias Zulauf Date: Tue, 16 Jul 2024 17:44:56 +0200 Subject: [PATCH 03/12] [5.2] Mail Templates language file loading not using the MailsHelper::loadTranslationFiles (#43475) * load the language files via MailsHelper * Update HtmlView.php * Fix the language load for the templates * Dont fix things outside of the scope of this PR --- .../components/com_mails/src/Helper/MailsHelper.php | 11 ++++++----- .../com_mails/src/View/Template/HtmlView.php | 10 ++++------ .../com_mails/src/View/Templates/HtmlView.php | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/administrator/components/com_mails/src/Helper/MailsHelper.php b/administrator/components/com_mails/src/Helper/MailsHelper.php index 08d5bc777df78..870e67781281e 100644 --- a/administrator/components/com_mails/src/Helper/MailsHelper.php +++ b/administrator/components/com_mails/src/Helper/MailsHelper.php @@ -59,12 +59,13 @@ public static function mailtags($mail, $fieldname) * Load the translation files for an extension * * @param string $extension Extension name + * @param string $language Language to load * * @return void * * @since 4.0.0 */ - public static function loadTranslationFiles($extension) + public static function loadTranslationFiles($extension, $language = 'en-GB') { static $cache = []; @@ -96,12 +97,12 @@ public static function loadTranslationFiles($extension) break; } - $lang->load($extension, JPATH_ADMINISTRATOR) - || $lang->load($extension, $source); + $lang->load($extension, JPATH_ADMINISTRATOR, $language, true) + || $lang->load($extension, $source, $language, true); if (!$lang->hasKey(strtoupper($extension))) { - $lang->load($extension . '.sys', JPATH_ADMINISTRATOR) - || $lang->load($extension . '.sys', $source); + $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $language, true) + || $lang->load($extension . '.sys', $source, $language, true); } $cache[$extension] = true; diff --git a/administrator/components/com_mails/src/View/Template/HtmlView.php b/administrator/components/com_mails/src/View/Template/HtmlView.php index 5614c12cf12e5..b609a4ba563ad 100644 --- a/administrator/components/com_mails/src/View/Template/HtmlView.php +++ b/administrator/components/com_mails/src/View/Template/HtmlView.php @@ -17,6 +17,7 @@ use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\Component\Mails\Administrator\Helper\MailsHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -85,14 +86,11 @@ public function display($tpl = null) throw new GenericDataException(implode("\n", $errors), 500); } - list($component, $template_id) = explode('.', $this->item->template_id, 2); + list($extension, $template_id) = explode('.', $this->item->template_id, 2); $fields = ['subject', 'body', 'htmlbody']; $this->templateData = []; - $language = $this->getLanguage(); - $language->load($component, JPATH_SITE, $this->item->language, true); - $language->load($component, JPATH_SITE . '/components/' . $component, $this->item->language, true); - $language->load($component, JPATH_ADMINISTRATOR, $this->item->language, true); - $language->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, $this->item->language, true); + + MailsHelper::loadTranslationFiles($extension, $this->item->language); $this->master->subject = Text::_($this->master->subject); $this->master->body = Text::_($this->master->body); diff --git a/administrator/components/com_mails/src/View/Templates/HtmlView.php b/administrator/components/com_mails/src/View/Templates/HtmlView.php index a71f214a1d529..fa1b7d7411675 100644 --- a/administrator/components/com_mails/src/View/Templates/HtmlView.php +++ b/administrator/components/com_mails/src/View/Templates/HtmlView.php @@ -115,7 +115,7 @@ public function display($tpl = null) } foreach ($extensions as $extension) { - MailsHelper::loadTranslationFiles($extension); + MailsHelper::loadTranslationFiles($extension, $defaultLanguageTag); } $this->addToolbar(); From 896c091ed8067dea379179f381f083054c425e79 Mon Sep 17 00:00:00 2001 From: Harald Leithner Date: Thu, 18 Jul 2024 12:05:58 +0200 Subject: [PATCH 04/12] [5.1] Update bump script also to update package-lock.json (#43801) * Update bump script also to update package-lock.json --------- Co-authored-by: Richard Fath Co-authored-by: Quy Co-authored-by: Dimitris Grammatikogiannis --- build/bump.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/build/bump.php b/build/bump.php index dec1c78643505..5f266acc00c02 100644 --- a/build/bump.php +++ b/build/bump.php @@ -59,7 +59,10 @@ function usage($command) $antJobFile = '/build.xml'; -$packageJsonFile = '/package.json'; +$packageJsonFiles = [ + '/package.json', + '/package-lock.json', +]; $readMeFiles = [ '/README.md', @@ -248,12 +251,14 @@ function usage($command) } // Updates the version in the package.json file. -if (file_exists($rootPath . $packageJsonFile)) { - $package = json_decode(file_get_contents($rootPath . $packageJsonFile)); - $package->version = $version['release']; +foreach ($packageJsonFiles as $packageJsonFile) { + if (file_exists($rootPath . $packageJsonFile)) { + $package = json_decode(file_get_contents($rootPath . $packageJsonFile)); + $package->version = $version['release']; - // @todo use a native formatter whenever https://github.com/php/php-src/issues/8864 is resolved - file_put_contents($rootPath . $packageJsonFile, str_replace(' ', ' ', json_encode($package, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES))); + // @todo use a native formatter whenever https://github.com/php/php-src/issues/8864 is resolved + file_put_contents($rootPath . $packageJsonFile, str_replace(' ', ' ', json_encode($package, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) . "\n"); + } } // Updates the version in readme files. From c4f212253e9e483d818e9f3489d45b9b241699e8 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 20 Jul 2024 09:40:52 +0200 Subject: [PATCH 05/12] Add deleted files and folders from debugbar dependency update (#43704) --- administrator/components/com_admin/script.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index cc6fc488affa0..e5b46e12a9a47 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -2333,6 +2333,13 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) '/libraries/vendor/cweagans/composer-patches/src/Patches.php', '/libraries/vendor/cweagans/composer-patches/tests/PatchEventTest.php', '/libraries/vendor/laminas/laminas-diactoros/PATCHES.txt', + // From 5.2.0-alpha2 to 5.2.0-alpha3 + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/FontAwesome.otf', + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.eot', + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.svg', + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.ttf', + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.woff', + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.woff2', ]; $folders = [ @@ -2597,6 +2604,8 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) '/libraries/vendor/cweagans/composer-patches/src', '/libraries/vendor/cweagans/composer-patches', '/libraries/vendor/cweagans', + // From 5.2.0-alpha2 to 5.2.0-alpha3 + '/libraries/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts', ]; $status['files_checked'] = $files; From f893b2e6c7442705d1e18bbc2d10d0494851f455 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Sat, 20 Jul 2024 09:44:39 +0200 Subject: [PATCH 06/12] Release Joomla! 5.2.0 Alpha 3 --- administrator/manifests/files/joomla.xml | 2 +- libraries/src/Version.php | 4 ++-- package-lock.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index 6354e746c2b45..4bfa99e99b9dc 100644 --- a/administrator/manifests/files/joomla.xml +++ b/administrator/manifests/files/joomla.xml @@ -6,7 +6,7 @@ www.joomla.org (C) 2019 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt - 5.2.0-alpha3-dev + 5.2.0-alpha3 2024-07 FILES_JOOMLA_XML_DESCRIPTION diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 203bf50bd376f..9f8e3e05b3912 100644 --- a/libraries/src/Version.php +++ b/libraries/src/Version.php @@ -66,7 +66,7 @@ final class Version * @var string * @since 3.8.0 */ - public const EXTRA_VERSION = 'alpha3-dev'; + public const EXTRA_VERSION = 'alpha3'; /** * Development status. @@ -74,7 +74,7 @@ final class Version * @var string * @since 3.5 */ - public const DEV_STATUS = 'Development'; + public const DEV_STATUS = 'Alpha'; /** * Code name. diff --git a/package-lock.json b/package-lock.json index 5b319b5865b97..6b32a35a89a3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "joomla", - "version": "5.1.2", + "version": "5.2.0", "lockfileVersion": 3, "requires": true, "packages": { From b91c2f12673faac3a72b955558e24ee279ff0925 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Sat, 20 Jul 2024 11:27:36 +0200 Subject: [PATCH 07/12] Reverting to dev --- administrator/manifests/files/joomla.xml | 2 +- libraries/src/Version.php | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index 4bfa99e99b9dc..cd4c83053a375 100644 --- a/administrator/manifests/files/joomla.xml +++ b/administrator/manifests/files/joomla.xml @@ -6,7 +6,7 @@ www.joomla.org (C) 2019 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt - 5.2.0-alpha3 + 5.2.0-alpha4-dev 2024-07 FILES_JOOMLA_XML_DESCRIPTION diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 9f8e3e05b3912..ca57e2add0dbc 100644 --- a/libraries/src/Version.php +++ b/libraries/src/Version.php @@ -66,7 +66,7 @@ final class Version * @var string * @since 3.8.0 */ - public const EXTRA_VERSION = 'alpha3'; + public const EXTRA_VERSION = 'alpha4-dev'; /** * Development status. @@ -74,7 +74,7 @@ final class Version * @var string * @since 3.5 */ - public const DEV_STATUS = 'Alpha'; + public const DEV_STATUS = 'Development'; /** * Code name. @@ -98,7 +98,7 @@ final class Version * @var string * @since 3.5 */ - public const RELTIME = '16:00'; + public const RELTIME = '16:01'; /** * Release timezone. diff --git a/package.json b/package.json index b9c7167a8603e..89ef2173984a8 100644 --- a/package.json +++ b/package.json @@ -126,4 +126,4 @@ "stylelint-order": "^5.0.0", "stylelint-scss": "^4.7.0" } -} \ No newline at end of file +} From 183985b4a7b9adf8d20b29964e11994cef5a226f Mon Sep 17 00:00:00 2001 From: David Jardin Date: Sun, 21 Jul 2024 21:29:09 +0200 Subject: [PATCH 08/12] [5.1] Update TinyMCE to 6.8.4 (#43808) * update tinymce and braces js * xml version ++ --- package-lock.json | 22 +++++++++++----------- package.json | 2 +- plugins/editors/tinymce/tinymce.xml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5b319b5865b97..035faaacc7f77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "shepherd.js": "^11.2.0", "short-and-sweet": "^1.0.4", "skipto": "^4.1.7", - "tinymce": "^6.8.3", + "tinymce": "^6.8.4", "vue": "^3.2.45", "vue-focus-lock": "^2.0.6", "vuex": "^4.1.0", @@ -3662,12 +3662,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -5534,9 +5534,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -10011,9 +10011,9 @@ "integrity": "sha512-RX35iq/D+lrsqhcPWIazM9ELkjOe30MSeoBHQHSsRwd1YuhJO5ui1K1/R0r7N3mFvbLBs33idw+eR6j+w6i/DA==" }, "node_modules/tinymce": { - "version": "6.8.3", - "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.3.tgz", - "integrity": "sha512-3fCHKAeqT+xNwBVESf6iDbDV0VNwZNmfrkx9c/6Gz5iB8piMfaO6s7FvoiTrj1hf1gVbfyLTnz1DooI6DhgINQ==" + "version": "6.8.4", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.4.tgz", + "integrity": "sha512-okoJyxuPv1gzASxQDNgQbnUXOdAIyoOSXcXcZZu7tiW0PSKEdf3SdASxPBupRj+64/E3elHwVRnzSdo82Emqbg==" }, "node_modules/tippy.js": { "version": "6.3.7", diff --git a/package.json b/package.json index 9aa86dee5b15a..84832969e5f26 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "shepherd.js": "^11.2.0", "short-and-sweet": "^1.0.4", "skipto": "^4.1.7", - "tinymce": "^6.8.3", + "tinymce": "^6.8.4", "vue": "^3.2.45", "vue-focus-lock": "^2.0.6", "vuex": "^4.1.0", diff --git a/plugins/editors/tinymce/tinymce.xml b/plugins/editors/tinymce/tinymce.xml index 25a39df0726a8..b0c80b090313c 100644 --- a/plugins/editors/tinymce/tinymce.xml +++ b/plugins/editors/tinymce/tinymce.xml @@ -1,7 +1,7 @@ plg_editors_tinymce - 6.8.3 + 6.8.4 2005-08 Tiny Technologies, Inc N/A From dabf3fe1380c761e615cdc0b993d8c9966ee2aca Mon Sep 17 00:00:00 2001 From: Martina Scholz <64533137+LadySolveig@users.noreply.github.com> Date: Tue, 23 Jul 2024 19:10:56 +0200 Subject: [PATCH 09/12] [5.1] Fix attachment handling in libraries Mail class (#43828) --- libraries/src/Mail/Mail.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libraries/src/Mail/Mail.php b/libraries/src/Mail/Mail.php index 09f06c531bfbe..0c33af51780c2 100644 --- a/libraries/src/Mail/Mail.php +++ b/libraries/src/Mail/Mail.php @@ -401,20 +401,12 @@ public function addAttachment($path, $name = '', $encoding = 'base64', $type = ' $result = true; if (\is_array($path)) { - if (!empty($name) && \count($path) != \count($name)) { + if (!empty($name) && \is_array($name) && \count($path) != \count($name)) { throw new \InvalidArgumentException('The number of attachments must be equal with the number of name'); } foreach ($path as $key => $file) { - if (!empty($name)) { - $result = parent::addAttachment($file, $name[$key], $encoding, $type); - } else { - if (!empty($name)) { - $result = parent::addAttachment($file, $name[$key], $encoding, $type, $disposition); - } else { - $result = parent::addAttachment($file, $name, $encoding, $type, $disposition); - } - } + $result = parent::addAttachment($file, isset($name[$key]) ? $name[$key] : '', $encoding, $type, $disposition); } // Check for boolean false return if exception handling is disabled @@ -422,7 +414,7 @@ public function addAttachment($path, $name = '', $encoding = 'base64', $type = ' return false; } } else { - $result = parent::addAttachment($path, $name, $encoding, $type); + $result = parent::addAttachment($path, $name, $encoding, $type, $disposition); } // Check for boolean false return if exception handling is disabled From 3cbf8f607461c56bb4f4d3f9d55712869e375153 Mon Sep 17 00:00:00 2001 From: Fedir Zinchuk Date: Tue, 23 Jul 2024 23:32:46 +0300 Subject: [PATCH 10/12] [5.2] Media field: selectable folders (#43579) --- .../components/breadcrumb/breadcrumb.vue | 5 +++- .../components/browser/items/directory.vue | 11 ++++++++ .../components/browser/items/item.es6.js | 6 ++++- .../scripts/components/browser/table/row.vue | 27 +++++++++---------- .../scripts/components/tree/drive.vue | 11 ++++++++ .../scripts/components/tree/tree.vue | 5 +++- .../language/en-GB/plg_editors_tinymce.ini | 1 + .../js/plugins/dragdrop/plugin.es6.js | 22 ++++++++------- .../js/fields/joomla-field-media.w-c.es6.js | 14 +++++++--- .../js/fields/joomla-media-select.w-c.es6.js | 2 +- layouts/joomla/form/field/media.php | 6 +++-- libraries/src/Form/Field/MediaField.php | 4 +++ plugins/editors/tinymce/forms/setoptions.xml | 4 ++- .../tinymce/src/Field/UploaddirsField.php | 8 ++++++ .../tinymce/src/PluginTraits/DisplayTrait.php | 25 ++++++++++++----- plugins/fields/media/media.xml | 7 +++-- plugins/fields/media/params/media.xml | 8 +++--- 17 files changed, 116 insertions(+), 50 deletions(-) diff --git a/administrator/components/com_media/resources/scripts/components/breadcrumb/breadcrumb.vue b/administrator/components/com_media/resources/scripts/components/breadcrumb/breadcrumb.vue index 25cddeca8c4e6..87e7945939b69 100644 --- a/administrator/components/com_media/resources/scripts/components/breadcrumb/breadcrumb.vue +++ b/administrator/components/com_media/resources/scripts/components/breadcrumb/breadcrumb.vue @@ -78,7 +78,10 @@ export default { { bubbles: true, cancelable: false, - detail: {}, + detail: { + type: 'dir', + path: destination.path, + }, }, ), ); diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/directory.vue b/administrator/components/com_media/resources/scripts/components/browser/items/directory.vue index f78a9b6b47ed6..82f02863690ef 100644 --- a/administrator/components/com_media/resources/scripts/components/browser/items/directory.vue +++ b/administrator/components/com_media/resources/scripts/components/browser/items/directory.vue @@ -51,6 +51,17 @@ export default { /* Handle the on preview double click event */ onPreviewDblClick() { this.navigateTo(this.item.path); + + window.parent.document.dispatchEvent( + new CustomEvent('onMediaFileSelected', { + bubbles: true, + cancelable: false, + detail: { + type: this.item.type, + path: this.item.path, + }, + }), + ); }, /* Hide actions dropdown */ hideActions() { diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js index 9ca4be5a3b7ad..0c8d1f20c27d5 100644 --- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js +++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js @@ -126,6 +126,7 @@ export default { bubbles: true, cancelable: false, detail: { + type: this.item.type, path: this.item.path, thumb: this.item.thumb, fileType: this.item.mime_type ? this.item.mime_type : false, @@ -142,7 +143,10 @@ export default { new CustomEvent('onMediaFileSelected', { bubbles: true, cancelable: false, - detail: {}, + detail: { + type: this.item.type, + path: this.item.path, + }, }), ); } diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue index 32d1c68157f0c..aff5df71ff2b8 100644 --- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue +++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue @@ -136,32 +136,31 @@ export default { * @param event */ onClick(event) { - const path = false; const data = { - path, + path: this.item.path, + type: this.item.type, thumb: false, fileType: this.item.mime_type ? this.item.mime_type : false, extension: this.item.extension ? this.item.extension : false, }; if (this.item.type === 'file') { - data.path = this.item.path; data.thumb = this.item.thumb ? this.item.thumb : false; data.width = this.item.width ? this.item.width : 0; data.height = this.item.height ? this.item.height : 0; - - window.parent.document.dispatchEvent( - new CustomEvent( - 'onMediaFileSelected', - { - bubbles: true, - cancelable: false, - detail: data, - }, - ), - ); } + window.parent.document.dispatchEvent( + new CustomEvent( + 'onMediaFileSelected', + { + bubbles: true, + cancelable: false, + detail: data, + }, + ), + ); + // Handle clicks when the item was not selected if (!this.isSelected()) { // Unselect all other selected items, diff --git a/administrator/components/com_media/resources/scripts/components/tree/drive.vue b/administrator/components/com_media/resources/scripts/components/tree/drive.vue index e330d003acaee..d025e4fdbcc63 100644 --- a/administrator/components/com_media/resources/scripts/components/tree/drive.vue +++ b/administrator/components/com_media/resources/scripts/components/tree/drive.vue @@ -77,6 +77,17 @@ export default { /* Handle the on drive click event */ onDriveClick() { this.navigateTo(this.drive.root); + + window.parent.document.dispatchEvent( + new CustomEvent('onMediaFileSelected', { + bubbles: true, + cancelable: false, + detail: { + type: 'dir', + path: this.drive.root, + }, + }), + ); }, moveFocusToChildElement(nextRoot) { this.$refs[nextRoot].setFocusToFirstChild(); diff --git a/administrator/components/com_media/resources/scripts/components/tree/tree.vue b/administrator/components/com_media/resources/scripts/components/tree/tree.vue index 1f14eddff439c..21ae3df7104b7 100644 --- a/administrator/components/com_media/resources/scripts/components/tree/tree.vue +++ b/administrator/components/com_media/resources/scripts/components/tree/tree.vue @@ -88,7 +88,10 @@ export default { { bubbles: true, cancelable: false, - detail: {}, + detail: { + type: item.type, + path: item.path, + }, }, ), ); diff --git a/administrator/language/en-GB/plg_editors_tinymce.ini b/administrator/language/en-GB/plg_editors_tinymce.ini index 88033c39615ca..b48d32e3326df 100644 --- a/administrator/language/en-GB/plg_editors_tinymce.ini +++ b/administrator/language/en-GB/plg_editors_tinymce.ini @@ -11,6 +11,7 @@ PLG_TINY_CORE_BUTTONS="CMS Content" PLG_TINY_DND_ADDITIONALDATA="Additional Data" PLG_TINY_DND_ALTTEXT="Image Description (Alt Text)" PLG_TINY_DND_EMPTY_ALT="No Description" +PLG_TINY_DND_FILE_EXISTS_ERROR="File \"%s\" already exists." PLG_TINY_DND_LAZYLOADED="Image will be lazyloaded" PLG_TINY_ERR_CUSTOMCSSFILENOTPRESENT="The file name %s was entered in the TinyMCE Custom CSS field. This file could not be found in the default template folder. No styles are available." PLG_TINY_ERR_EDITORCSSFILENOTPRESENT="Could not find the file 'editor.css' in the template or templates/system folder. No styles are available." diff --git a/build/media_source/plg_editors_tinymce/js/plugins/dragdrop/plugin.es6.js b/build/media_source/plg_editors_tinymce/js/plugins/dragdrop/plugin.es6.js index 0c866a890ae66..0929f0ef19dcb 100644 --- a/build/media_source/plg_editors_tinymce/js/plugins/dragdrop/plugin.es6.js +++ b/build/media_source/plg_editors_tinymce/js/plugins/dragdrop/plugin.es6.js @@ -26,9 +26,7 @@ function readFile(file, callback) { window.tinymce.PluginManager.add('jdragndrop', (editor) => { const registerOption = editor.options.register; registerOption('uploadUri', { processor: 'string' }); - registerOption('comMediaAdapter', { processor: 'string' }); registerOption('parentUploadFolder', { processor: 'string' }); - registerOption('csrfToken', { processor: 'string' }); // Reset the drop area border const dragleaveCallback = (e) => { @@ -61,10 +59,9 @@ window.tinymce.PluginManager.add('jdragndrop', (editor) => { const settings = editor.options.get; Joomla.request({ - url: `${settings('uploadUri')}&path=${settings('comMediaAdapter')}${settings('parentUploadFolder')}`, + url: `${settings('uploadUri')}&path=${settings('parentUploadFolder')}`, method: 'POST', data: JSON.stringify({ - [settings('csrfToken')]: 1, name, content, parent: settings('parentUploadFolder'), @@ -72,11 +69,13 @@ window.tinymce.PluginManager.add('jdragndrop', (editor) => { headers: { 'Content-Type': 'application/json', }, - onSuccess: (resp) => { + promise: true, + }) + .then((resp) => { let response; try { - response = JSON.parse(resp); + response = JSON.parse(resp.responseText); } catch (e) { editor.windowManager.alert(`${Joomla.Text._('ERROR')}: {${e}}`); } @@ -145,9 +144,14 @@ window.tinymce.PluginManager.add('jdragndrop', (editor) => { onCancel: (api) => dialogClose(api), }); } - }, - onError: (xhr) => editor.windowManager.alert(`Error: ${xhr.statusText}`), - }); + }) + .catch((xhr) => { + let message = `Error: ${xhr.statusText}`; + if (xhr.status === 409) { + message = Joomla.Text._('PLG_TINY_DND_FILE_EXISTS_ERROR').replace('%s', `${settings('parentUploadFolder')}/${name}`); + } + editor.windowManager.alert(message); + }); } // Logic for the dropped file diff --git a/build/media_source/system/js/fields/joomla-field-media.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-media.w-c.es6.js index ec499cef94a97..e004ec2075db5 100644 --- a/build/media_source/system/js/fields/joomla-field-media.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-media.w-c.es6.js @@ -39,12 +39,12 @@ class JoomlaFieldMedia extends HTMLElement { } static get observedAttributes() { - return ['type', 'base-path', 'root-folder', 'url', 'modal-title', 'modal-width', 'modal-height', 'input', 'button-select', 'button-clear', 'preview', 'preview-width', 'preview-height']; + return ['base-path', 'root-folder', 'url', 'modal-title', 'modal-width', 'modal-height', 'input', 'button-select', 'button-clear', 'preview', 'preview-width', 'preview-height']; } - get type() { return this.getAttribute('type'); } + get types() { return this.getAttribute('types') || ''; } - set type(value) { this.setAttribute('type', value); } + set types(value) { this.setAttribute('types', value); } get basePath() { return this.getAttribute('base-path'); } @@ -175,7 +175,13 @@ class JoomlaFieldMedia extends HTMLElement { async modalClose() { try { - await Joomla.getMedia(Joomla.selectedMediaFile, this.inputElement, this); + const item = Joomla.selectedMediaFile; + if (item && item.type === 'dir') { + // Set directory path as value only when the field is configured to support of directories + this.setValue(this.types.includes('directories') ? item.path : ''); + } else { + await Joomla.getMedia(item, this.inputElement, this); + } } catch (err) { Joomla.renderMessages({ error: [Joomla.Text._('JLIB_APPLICATION_ERROR_SERVER')], diff --git a/build/media_source/system/js/fields/joomla-media-select.w-c.es6.js b/build/media_source/system/js/fields/joomla-media-select.w-c.es6.js index 8e8864d80f811..70facf109fb16 100644 --- a/build/media_source/system/js/fields/joomla-media-select.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-media-select.w-c.es6.js @@ -48,7 +48,7 @@ document.addEventListener('onMediaFileSelected', async (e) => { images, audios, videos, documents, } = supportedExtensions; - if (Joomla.selectedMediaFile.path) { + if (Joomla.selectedMediaFile.path && Joomla.selectedMediaFile.type === 'file') { let type; if (images.includes(Joomla.selectedMediaFile.extension.toLowerCase())) { type = 'images'; diff --git a/layouts/joomla/form/field/media.php b/layouts/joomla/form/field/media.php index 6e10e2e4dd5ea..c5a5dc4a170d4 100644 --- a/layouts/joomla/form/field/media.php +++ b/layouts/joomla/form/field/media.php @@ -40,7 +40,8 @@ * @var integer $size The size text * @var string $value The value text * @var string $src The path and filename of the image - * @var array $mediaTypes The supported media types for the Media Manager + * @var string $mediaTypes The ids of supported media types for the Media Manager + * @var array $mediaTypeNames The names of supported media types for the Media Manager * @var array $imagesExt The supported extensions for images * @var array $audiosExt The supported extensions for audios * @var array $videosExt The supported extensions for videos @@ -155,7 +156,8 @@ } ?> - + $this->previewHeight, 'previewWidth' => $this->previewWidth, 'mediaTypes' => implode(',', $types), + 'mediaTypeNames' => $mediaTypes, 'imagesExt' => $imagesExt, 'audiosExt' => $audiosExt, 'videosExt' => $videosExt, diff --git a/plugins/editors/tinymce/forms/setoptions.xml b/plugins/editors/tinymce/forms/setoptions.xml index 8830ace3f7723..6a3533d2d3e84 100644 --- a/plugins/editors/tinymce/forms/setoptions.xml +++ b/plugins/editors/tinymce/forms/setoptions.xml @@ -85,9 +85,11 @@ recursive = true; $this->hideDefault = true; + @trigger_error( + __CLASS__ . ' is deprecated, use Joomla\CMS\Form\Field\FolderlistField instead. Will be removed in 7.0.', + \E_USER_DEPRECATED + ); + return $return; } diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index 07e5ba327e46a..f3063e6c8c6ad 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -15,6 +15,7 @@ use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; +use Joomla\Component\Media\Administrator\Provider\ProviderManagerHelperTrait; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects @@ -324,8 +325,21 @@ public function display(string $name, string $content = '', array $attributes = if ($dragdrop && $user->authorise('core.create', 'com_media')) { $wa->useScript('plg_editors_tinymce.jdragndrop'); - $plugins[] = 'jdragndrop'; - $uploadUrl = Uri::base(true) . '/index.php?option=com_media&format=json&url=1&task=api.files'; + $plugins[] = 'jdragndrop'; + $uploadUrl = Uri::base(true) . '/index.php?option=com_media&format=json&url=1&task=api.files'; + $uploadPath = $levelParams->get('path', ''); + + // Make sure the path is full, and contain the media adapter in it. + $mediaHelper = new class () { + use ProviderManagerHelperTrait; + + public function prepareTinyMCEUploadPath(string $path): string + { + $result = $this->resolveAdapterAndPath($path); + + return implode(':', $result); + } + }; Text::script('PLG_TINY_ERR_UNSUPPORTEDBROWSER'); Text::script('ERROR'); @@ -333,13 +347,10 @@ public function display(string $name, string $content = '', array $attributes = Text::script('PLG_TINY_DND_ALTTEXT'); Text::script('PLG_TINY_DND_LAZYLOADED'); Text::script('PLG_TINY_DND_EMPTY_ALT'); + Text::script('PLG_TINY_DND_FILE_EXISTS_ERROR'); - $scriptOptions['parentUploadFolder'] = $levelParams->get('path', ''); - $scriptOptions['csrfToken'] = $csrf; + $scriptOptions['parentUploadFolder'] = $mediaHelper->prepareTinyMCEUploadPath($uploadPath); $scriptOptions['uploadUri'] = $uploadUrl; - - // @TODO have a way to select the adapter, similar to $levelParams->get('path', ''); - $scriptOptions['comMediaAdapter'] = 'local-images:'; } // Convert pt to px in dropdown diff --git a/plugins/fields/media/media.xml b/plugins/fields/media/media.xml index d6fd173941ac9..9102996c0e5f0 100644 --- a/plugins/fields/media/media.xml +++ b/plugins/fields/media/media.xml @@ -25,11 +25,10 @@
Date: Wed, 24 Jul 2024 03:00:33 -0400 Subject: [PATCH 11/12] [5.2] [Guided tours] Add missing auto start parameter in the user interface of tours (#43690) Co-authored-by: Brian Teeman --- .../components/com_guidedtours/forms/tour.xml | 12 ++++++++++++ .../components/com_guidedtours/tmpl/tour/edit.php | 1 + administrator/language/en-GB/com_guidedtours.ini | 2 ++ 3 files changed, 15 insertions(+) diff --git a/administrator/components/com_guidedtours/forms/tour.xml b/administrator/components/com_guidedtours/forms/tour.xml index dcb10e4aa949c..5ace45df4fad2 100644 --- a/administrator/components/com_guidedtours/forms/tour.xml +++ b/administrator/components/com_guidedtours/forms/tour.xml @@ -160,4 +160,16 @@ > + + + + + diff --git a/administrator/components/com_guidedtours/tmpl/tour/edit.php b/administrator/components/com_guidedtours/tmpl/tour/edit.php index e115cab0af1ee..5bef1f3549f89 100644 --- a/administrator/components/com_guidedtours/tmpl/tour/edit.php +++ b/administrator/components/com_guidedtours/tmpl/tour/edit.php @@ -73,6 +73,7 @@ 'access', 'language', 'extensions', + 'autostart', 'note', ]; diff --git a/administrator/language/en-GB/com_guidedtours.ini b/administrator/language/en-GB/com_guidedtours.ini index f7e1789ed2171..e45fbb95000c9 100644 --- a/administrator/language/en-GB/com_guidedtours.ini +++ b/administrator/language/en-GB/com_guidedtours.ini @@ -4,6 +4,8 @@ ; Note : All ini files need to be saved as UTF-8 COM_GUIDEDTOURS="Guided Tours" +COM_GUIDEDTOURS_AUTOSTART_DESC="Start the tour automatically when a user reaches the context in which the tour should be displayed." +COM_GUIDEDTOURS_AUTOSTART_LABEL="Auto Start" COM_GUIDEDTOURS_CONFIGURATION="Guided Tours: Options" COM_GUIDEDTOURS_DESCRIPTION="Description" COM_GUIDEDTOURS_DESCRIPTION_TRANSLATION="Description (%s)" From b2f2e7724c045d9dfa1d717e00b58cf8342a5b48 Mon Sep 17 00:00:00 2001 From: Denitz <197527+Denitz@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:09:42 +0300 Subject: [PATCH 12/12] [5.2] useless array access (#41644) --- .../src/Controller/AjaxController.php | 4 ++-- .../src/Controller/AjaxController.php | 4 ++-- .../src/Controller/AjaxController.php | 4 ++-- .../com_finder/src/Indexer/Query.php | 4 ++-- .../com_finder/src/Service/HTML/Filter.php | 20 +++++++++---------- .../src/Controller/AjaxController.php | 4 ++-- .../com_modules/src/Helper/ModulesHelper.php | 4 ++-- .../src/Controller/AjaxController.php | 4 ++-- .../mod_logged/src/Helper/LoggedHelper.php | 10 +++++----- libraries/src/Cache/Cache.php | 4 ++-- libraries/src/Cache/CacheController.php | 4 ++-- libraries/src/Form/Field/AliastagField.php | 4 ++-- libraries/src/Language/LanguageHelper.php | 4 ++-- libraries/src/Language/Text.php | 4 ++-- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/administrator/components/com_categories/src/Controller/AjaxController.php b/administrator/components/com_categories/src/Controller/AjaxController.php index ecad1f22377ca..bc6433e1d3996 100644 --- a/administrator/components/com_categories/src/Controller/AjaxController.php +++ b/administrator/components/com_categories/src/Controller/AjaxController.php @@ -66,9 +66,9 @@ public function fetchAssociations() Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables'); $categoryTable = Table::getInstance('Category', '\\Joomla\\CMS\\Table\\'); - foreach ($associations as $lang => $association) { + foreach ($associations as $association) { $categoryTable->load($association->id); - $associations[$lang]->title = $categoryTable->title; + $association->title = $categoryTable->title; } $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false)); diff --git a/administrator/components/com_contact/src/Controller/AjaxController.php b/administrator/components/com_contact/src/Controller/AjaxController.php index 18d84fdbb7728..84d1f0997afde 100644 --- a/administrator/components/com_contact/src/Controller/AjaxController.php +++ b/administrator/components/com_contact/src/Controller/AjaxController.php @@ -62,9 +62,9 @@ public function fetchAssociations() // Add the title to each of the associated records $contactTable = $this->factory->createTable('Contact', 'Administrator'); - foreach ($associations as $lang => $association) { + foreach ($associations as $association) { $contactTable->load($association->id); - $associations[$lang]->title = $contactTable->name; + $association->title = $contactTable->name; } $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false)); diff --git a/administrator/components/com_content/src/Controller/AjaxController.php b/administrator/components/com_content/src/Controller/AjaxController.php index ba4e05c0f0920..9b8047b685320 100644 --- a/administrator/components/com_content/src/Controller/AjaxController.php +++ b/administrator/components/com_content/src/Controller/AjaxController.php @@ -63,9 +63,9 @@ public function fetchAssociations() // Add the title to each of the associated records $contentTable = Table::getInstance('Content', '\\Joomla\\CMS\\Table\\'); - foreach ($associations as $lang => $association) { + foreach ($associations as $association) { $contentTable->load($association->id); - $associations[$lang]->title = $contentTable->title; + $association->title = $contentTable->title; } $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false)); diff --git a/administrator/components/com_finder/src/Indexer/Query.php b/administrator/components/com_finder/src/Indexer/Query.php index 7a92521c3a1a6..8a6673657d299 100644 --- a/administrator/components/com_finder/src/Indexer/Query.php +++ b/administrator/components/com_finder/src/Indexer/Query.php @@ -437,7 +437,7 @@ public function getIncludedTermIds() // Sanitize the terms. foreach ($results as $key => $value) { - $results[$key] = array_unique($results[$key]); + $results[$key] = array_unique($value); $results[$key] = ArrayHelper::toInteger($results[$key]); } @@ -476,7 +476,7 @@ public function getRequiredTermIds() // Sanitize the terms. foreach ($results as $key => $value) { - $results[$key] = array_unique($results[$key]); + $results[$key] = array_unique($value); $results[$key] = ArrayHelper::toInteger($results[$key]); } diff --git a/administrator/components/com_finder/src/Service/HTML/Filter.php b/administrator/components/com_finder/src/Service/HTML/Filter.php index 92d660e4515d5..7e511918dd9c1 100644 --- a/administrator/components/com_finder/src/Service/HTML/Filter.php +++ b/administrator/components/com_finder/src/Service/HTML/Filter.php @@ -148,7 +148,7 @@ public function slider($options = []) // Translate node titles if possible. $lang = Factory::getLanguage(); - foreach ($nodes as $nk => $nv) { + foreach ($nodes as $nv) { if (trim($nv->parent_title, '*') === 'Language') { $title = LanguageHelper::branchLanguageTitle($nv->title); } else { @@ -156,7 +156,7 @@ public function slider($options = []) $title = $lang->hasKey($key) ? Text::_($key) : $nv->title; } - $nodes[$nk]->title = $title; + $nv->title = $title; } // Adding slides @@ -320,7 +320,7 @@ public function select($idxQuery, $options) $db->setQuery($query); try { - $branches[$bk]->nodes = $db->loadObjectList('id'); + $bv->nodes = $db->loadObjectList('id'); } catch (\RuntimeException $e) { return null; } @@ -329,7 +329,7 @@ public function select($idxQuery, $options) $language = Factory::getLanguage(); $root = []; - foreach ($branches[$bk]->nodes as $node_id => $node) { + foreach ($bv->nodes as $node_id => $node) { if (trim($node->parent_title, '*') === 'Language') { $title = LanguageHelper::branchLanguageTitle($node->title); } else { @@ -338,10 +338,10 @@ public function select($idxQuery, $options) } if ($node->level > 2) { - $branches[$bk]->nodes[$node_id]->title = str_repeat('-', $node->level - 2) . $title; + $node->title = str_repeat('-', $node->level - 2) . $title; } else { - $branches[$bk]->nodes[$node_id]->title = $title; - $root[] = $branches[$bk]->nodes[$node_id]; + $node->title = $title; + $root[] = $branches[$bk]->nodes[$node_id]; } if ($node->parent_id && isset($branches[$bk]->nodes[$node->parent_id])) { @@ -355,7 +355,7 @@ public function select($idxQuery, $options) $branches[$bk]->nodes = $this->reduce($root); // Add the Search All option to the branch. - array_unshift($branches[$bk]->nodes, ['id' => null, 'title' => Text::_('COM_FINDER_FILTER_SELECT_ALL_LABEL')]); + array_unshift($bv->nodes, ['id' => null, 'title' => Text::_('COM_FINDER_FILTER_SELECT_ALL_LABEL')]); } // Store the data in cache. @@ -372,7 +372,7 @@ public function select($idxQuery, $options) $html .= '
'; // Iterate through all branches and build code. - foreach ($branches as $bk => $bv) { + foreach ($branches as $bv) { // If the multi-lang plugin is enabled then drop the language branch. if ($bv->title === 'Language' && Multilanguage::isEnabled()) { continue; @@ -400,7 +400,7 @@ public function select($idxQuery, $options) $html .= '
'; $html .= HTMLHelper::_( 'select.genericlist', - $branches[$bk]->nodes, + $bv->nodes, 't[]', 'class="form-select advancedSelect"', 'id', diff --git a/administrator/components/com_menus/src/Controller/AjaxController.php b/administrator/components/com_menus/src/Controller/AjaxController.php index 8f3725679fcd3..abad401c45737 100644 --- a/administrator/components/com_menus/src/Controller/AjaxController.php +++ b/administrator/components/com_menus/src/Controller/AjaxController.php @@ -64,9 +64,9 @@ public function fetchAssociations() Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables'); $menuTable = Table::getInstance('Menu', '\\Joomla\\CMS\\Table\\', []); - foreach ($associations as $lang => $association) { + foreach ($associations as $association) { $menuTable->load($association->id); - $associations[$lang]->title = $menuTable->title; + $association->title = $menuTable->title; } $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false)); diff --git a/administrator/components/com_modules/src/Helper/ModulesHelper.php b/administrator/components/com_modules/src/Helper/ModulesHelper.php index 5a68b64c3ef8b..fac753b736857 100644 --- a/administrator/components/com_modules/src/Helper/ModulesHelper.php +++ b/administrator/components/com_modules/src/Helper/ModulesHelper.php @@ -170,13 +170,13 @@ public static function getModules($clientId) $modules = $db->loadObjectList(); $lang = Factory::getLanguage(); - foreach ($modules as $i => $module) { + foreach ($modules as $module) { $extension = $module->value; $path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE; $source = $path . "/modules/$extension"; $lang->load("$extension.sys", $path) || $lang->load("$extension.sys", $source); - $modules[$i]->text = Text::_($module->text); + $module->text = Text::_($module->text); } $modules = ArrayHelper::sortObjects($modules, 'text', 1, true, true); diff --git a/administrator/components/com_newsfeeds/src/Controller/AjaxController.php b/administrator/components/com_newsfeeds/src/Controller/AjaxController.php index 6364ae87b4714..4254d1db3e899 100644 --- a/administrator/components/com_newsfeeds/src/Controller/AjaxController.php +++ b/administrator/components/com_newsfeeds/src/Controller/AjaxController.php @@ -62,9 +62,9 @@ public function fetchAssociations() // Add the title to each of the associated records $newsfeedsTable = $this->factory->createTable('Newsfeed', 'Administrator'); - foreach ($associations as $lang => $association) { + foreach ($associations as $association) { $newsfeedsTable->load($association->id); - $associations[$lang]->title = $newsfeedsTable->name; + $association->title = $newsfeedsTable->name; } $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false)); diff --git a/administrator/modules/mod_logged/src/Helper/LoggedHelper.php b/administrator/modules/mod_logged/src/Helper/LoggedHelper.php index 34f612c0092cc..322a6c9fd0b4f 100644 --- a/administrator/modules/mod_logged/src/Helper/LoggedHelper.php +++ b/administrator/modules/mod_logged/src/Helper/LoggedHelper.php @@ -57,18 +57,18 @@ public static function getList(Registry $params, CMSApplication $app, DatabaseIn throw $e; } - foreach ($results as $k => $result) { - $results[$k]->logoutLink = ''; + foreach ($results as $result) { + $result->logoutLink = ''; if ($user->authorise('core.manage', 'com_users')) { - $results[$k]->editLink = Route::_('index.php?option=com_users&task=user.edit&id=' . $result->id); - $results[$k]->logoutLink = Route::_( + $result->editLink = Route::_('index.php?option=com_users&task=user.edit&id=' . $result->id); + $result->logoutLink = Route::_( 'index.php?option=com_login&task=logout&uid=' . $result->id . '&' . Session::getFormToken() . '=1' ); } if ($params->get('name', 1) == 0) { - $results[$k]->name = $results[$k]->username; + $result->name = $result->username; } } diff --git a/libraries/src/Cache/Cache.php b/libraries/src/Cache/Cache.php index 6bcea93c8c1f9..74b68c072eeae 100644 --- a/libraries/src/Cache/Cache.php +++ b/libraries/src/Cache/Cache.php @@ -67,8 +67,8 @@ public function __construct($options) // Overwrite default options with given options foreach ($options as $option => $value) { - if (isset($options[$option]) && $options[$option] !== '') { - $this->_options[$option] = $options[$option]; + if ($value !== null && $value !== '') { + $this->_options[$option] = $value; } } diff --git a/libraries/src/Cache/CacheController.php b/libraries/src/Cache/CacheController.php index 93c0558c5ea15..d574b7481dce0 100644 --- a/libraries/src/Cache/CacheController.php +++ b/libraries/src/Cache/CacheController.php @@ -55,8 +55,8 @@ public function __construct($options) // Overwrite default options with given options foreach ($options as $option => $value) { - if (isset($options[$option])) { - $this->options[$option] = $options[$option]; + if ($value !== null) { + $this->options[$option] = $value; } } } diff --git a/libraries/src/Form/Field/AliastagField.php b/libraries/src/Form/Field/AliastagField.php index 83b39d18f2eec..33893f4d2909c 100644 --- a/libraries/src/Form/Field/AliastagField.php +++ b/libraries/src/Form/Field/AliastagField.php @@ -57,12 +57,12 @@ protected function getOptions() $lang = Factory::getLanguage(); - foreach ($options as $i => $item) { + foreach ($options as $item) { $parts = explode('.', $item->value); $extension = $parts[0]; $lang->load($extension . '.sys', JPATH_ADMINISTRATOR) || $lang->load($extension, Path::clean(JPATH_ADMINISTRATOR . '/components/' . $extension)); - $options[$i]->text = Text::_(strtoupper($extension) . '_TAGS_' . strtoupper($parts[1])); + $item->text = Text::_(strtoupper($extension) . '_TAGS_' . strtoupper($parts[1])); } // Merge any additional options in the XML definition. diff --git a/libraries/src/Language/LanguageHelper.php b/libraries/src/Language/LanguageHelper.php index 80e3f440ff265..38b190ad2b191 100644 --- a/libraries/src/Language/LanguageHelper.php +++ b/libraries/src/Language/LanguageHelper.php @@ -327,7 +327,7 @@ public static function getInstalledLanguages( continue; } - $languages[$cId] = ArrayHelper::sortObjects($languages[$cId], $orderField, $orderDirection, true, true); + $languages[$cId] = ArrayHelper::sortObjects($language, $orderField, $orderDirection, true, true); } } @@ -339,7 +339,7 @@ public static function getInstalledLanguages( continue; } - $languages[$cId] = ArrayHelper::pivot($languages[$cId], $pivot); + $languages[$cId] = ArrayHelper::pivot($language, $pivot); } } diff --git a/libraries/src/Language/Text.php b/libraries/src/Language/Text.php index e54d1f0c33116..da5c56568875a 100644 --- a/libraries/src/Language/Text.php +++ b/libraries/src/Language/Text.php @@ -124,8 +124,8 @@ private static function passSprintf(&$string, $jsSafe = false, $interpretBackSla $string = $final_string; if ($script) { - foreach ($string_parts as $i => $str) { - static::$strings[$str] = $string_parts[$i]; + foreach ($string_parts as $str) { + static::$strings[$str] = $str; } }