From ed9e9e1b17f34a79c13428dc788278dcfd770c31 Mon Sep 17 00:00:00 2001 From: Benjamin Trenkle Date: Thu, 4 Jul 2024 18:42:51 +0200 Subject: [PATCH 001/240] Joomla! 4.4.6 Release Candidate 1 --- administrator/language/en-GB/install.xml | 2 +- administrator/language/en-GB/langmetadata.xml | 2 +- administrator/manifests/files/joomla.xml | 4 ++-- 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, 14 insertions(+), 14 deletions(-) diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index dd1543e075915..6189242ecc04b 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -3,7 +3,7 @@ English (en-GB) en-GB 4.4.6 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/language/en-GB/langmetadata.xml b/administrator/language/en-GB/langmetadata.xml index 7ef4a9c58cdd0..f5709bcc0fbbc 100644 --- a/administrator/language/en-GB/langmetadata.xml +++ b/administrator/language/en-GB/langmetadata.xml @@ -2,7 +2,7 @@ English (en-GB) 4.4.6 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index 58f4a04950fc3..cf5211c31efec 100644 --- a/administrator/manifests/files/joomla.xml +++ b/administrator/manifests/files/joomla.xml @@ -6,8 +6,8 @@ www.joomla.org (C) 2019 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt - 4.4.6-dev - 2024-05 + 4.4.6-rc1 + 2024-07 FILES_JOOMLA_XML_DESCRIPTION administrator/components/com_admin/script.php diff --git a/administrator/manifests/packages/pkg_en-GB.xml b/administrator/manifests/packages/pkg_en-GB.xml index 2ffd5eb68868a..35274e3bd127d 100644 --- a/administrator/manifests/packages/pkg_en-GB.xml +++ b/administrator/manifests/packages/pkg_en-GB.xml @@ -3,7 +3,7 @@ English (en-GB) Language Pack en-GB 4.4.6.1 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/api/language/en-GB/install.xml b/api/language/en-GB/install.xml index d1e09d59766ee..d3fb2d29c8053 100644 --- a/api/language/en-GB/install.xml +++ b/api/language/en-GB/install.xml @@ -3,7 +3,7 @@ English (en-GB) en-GB 4.4.6 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/api/language/en-GB/langmetadata.xml b/api/language/en-GB/langmetadata.xml index 7d5540fa96aa0..cd200124b38f5 100644 --- a/api/language/en-GB/langmetadata.xml +++ b/api/language/en-GB/langmetadata.xml @@ -2,7 +2,7 @@ English (en-GB) 4.4.6 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/installation/language/en-GB/langmetadata.xml b/installation/language/en-GB/langmetadata.xml index 3f26aa1cddfc2..daf99be4bc626 100644 --- a/installation/language/en-GB/langmetadata.xml +++ b/installation/language/en-GB/langmetadata.xml @@ -2,7 +2,7 @@ English (United Kingdom) 4.4.6 - 2024-05 + 2024-07 Joomla! Project (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/language/en-GB/install.xml b/language/en-GB/install.xml index 86ad046a7c12e..265f20d3ba98b 100644 --- a/language/en-GB/install.xml +++ b/language/en-GB/install.xml @@ -3,7 +3,7 @@ English (en-GB) en-GB 4.4.6 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/language/en-GB/langmetadata.xml b/language/en-GB/langmetadata.xml index 4bbbeb1801468..c0381b7c51615 100644 --- a/language/en-GB/langmetadata.xml +++ b/language/en-GB/langmetadata.xml @@ -2,7 +2,7 @@ English (en-GB) 4.4.6 - 2024-05 + 2024-07 Joomla! Project admin@joomla.org www.joomla.org diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 2f67331fbb893..7d74e34a04a66 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 = 'dev'; + public const EXTRA_VERSION = 'rc1'; /** * Development status. @@ -74,7 +74,7 @@ final class Version * @var string * @since 3.5 */ - public const DEV_STATUS = 'Development'; + public const DEV_STATUS = 'Release Candidate'; /** * Code name. @@ -90,7 +90,7 @@ final class Version * @var string * @since 3.5 */ - public const RELDATE = '28-May-2024'; + public const RELDATE = '4-July-2024'; /** * Release time. @@ -98,7 +98,7 @@ final class Version * @var string * @since 3.5 */ - public const RELTIME = '16:01'; + public const RELTIME = '18:00'; /** * Release timezone. From 0434d7bd925429b49ab82561d59aaaf56faa553c Mon Sep 17 00:00:00 2001 From: Benjamin Trenkle Date: Thu, 4 Jul 2024 18:46:48 +0200 Subject: [PATCH 002/240] Revert to dev --- administrator/manifests/files/joomla.xml | 2 +- libraries/src/Version.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index cf5211c31efec..b00c3299a15f8 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 - 4.4.6-rc1 + 4.4.6-rc2-dev 2024-07 FILES_JOOMLA_XML_DESCRIPTION diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 7d74e34a04a66..5d06cafb518e3 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 = 'rc1'; + public const EXTRA_VERSION = 'rc2-dev'; /** * Development status. @@ -74,7 +74,7 @@ final class Version * @var string * @since 3.5 */ - public const DEV_STATUS = 'Release Candidate'; + public const DEV_STATUS = 'Development'; /** * Code name. @@ -98,7 +98,7 @@ final class Version * @var string * @since 3.5 */ - public const RELTIME = '18:00'; + public const RELTIME = '18:01'; /** * Release timezone. From e1c51ee2fde47075aebd39fe0fd4dc71fd26c6b2 Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Mon, 8 Jul 2024 16:02:11 +0200 Subject: [PATCH 003/240] Prepare Joomla! 4.4.6 581 --- libraries/src/Form/Field/AccessiblemediaField.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/src/Form/Field/AccessiblemediaField.php b/libraries/src/Form/Field/AccessiblemediaField.php index 2ab1b18d489a4..033f77b445d12 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" /> Date: Mon, 8 Jul 2024 16:02:13 +0200 Subject: [PATCH 004/240] Prepare Joomla! 4.4.6 585 --- .../system/js/fields/joomla-field-fancy-select.w-c.es6.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From e1eac609c57ceb84a5d9b8cde241a987ef76468f Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Mon, 8 Jul 2024 16:02:15 +0200 Subject: [PATCH 005/240] Prepare Joomla! 4.4.6 589 --- libraries/src/HTML/Helpers/StringHelper.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/src/HTML/Helpers/StringHelper.php b/libraries/src/HTML/Helpers/StringHelper.php index 1c05e89d9912e..113a7e55c6656 100644 --- a/libraries/src/HTML/Helpers/StringHelper.php +++ b/libraries/src/HTML/Helpers/StringHelper.php @@ -47,14 +47,16 @@ public static function truncate($text, $length = 0, $noSplit = true, $allowHtml // Check if HTML tags are allowed. if (!$allowHtml) { + // Decode entities + $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); + // Deal with spacing issues in the input. $text = str_replace('>', '> ', $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); From ce38a5947661964a1e3f0d23ae889ef558f8f9d6 Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Mon, 8 Jul 2024 16:02:17 +0200 Subject: [PATCH 006/240] Prepare Joomla! 4.4.6 592 --- components/com_wrapper/tmpl/wrapper/default.xml | 2 ++ modules/mod_wrapper/mod_wrapper.xml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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/modules/mod_wrapper/mod_wrapper.xml b/modules/mod_wrapper/mod_wrapper.xml index f998114851b4a..d7db7e4a81514 100644 --- a/modules/mod_wrapper/mod_wrapper.xml +++ b/modules/mod_wrapper/mod_wrapper.xml @@ -25,7 +25,9 @@
From 93db0360c36440679fbb8ea6a9a83266e121a84d Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Mon, 8 Jul 2024 16:02:19 +0200 Subject: [PATCH 007/240] Prepare Joomla! 4.4.6 594 --- administrator/components/com_fields/forms/field.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_fields/forms/field.xml b/administrator/components/com_fields/forms/field.xml index a25de44730f62..5d949e6a43413 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" /> Date: Mon, 8 Jul 2024 16:03:30 +0200 Subject: [PATCH 008/240] Joomla! 4.4.6 Stable --- administrator/manifests/files/joomla.xml | 2 +- libraries/src/Version.php | 8 ++++---- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index b00c3299a15f8..8cfb0b9c4105b 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 - 4.4.6-rc2-dev + 4.4.6 2024-07 FILES_JOOMLA_XML_DESCRIPTION diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 5d06cafb518e3..4da0a47da55d2 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 = 'rc2-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 = '4-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 = '18:01'; + public const RELTIME = '16:00'; /** * Release timezone. diff --git a/package.json b/package.json index 5f49e3baf389f..fd453f974b21b 100644 --- a/package.json +++ b/package.json @@ -111,4 +111,4 @@ "stylelint-order": "^5.0.0", "stylelint-scss": "^4.7.0" } -} +} \ No newline at end of file From 4fca71bcf083f0e110e0ab9bc6809f097b40fc35 Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Tue, 9 Jul 2024 18:25:32 +0200 Subject: [PATCH 009/240] Revert to dev Signed-off-by: Martin Kopp --- 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 ++++---- package.json | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index 6189242ecc04b..4bcba1e808c7c 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (en-GB) en-GB - 4.4.6 + 4.4.7 2024-07 Joomla! Project admin@joomla.org diff --git a/administrator/language/en-GB/langmetadata.xml b/administrator/language/en-GB/langmetadata.xml index f5709bcc0fbbc..ac08de35905ee 100644 --- a/administrator/language/en-GB/langmetadata.xml +++ b/administrator/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (en-GB) - 4.4.6 + 4.4.7 2024-07 Joomla! Project admin@joomla.org diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index 8cfb0b9c4105b..fd3629a487f6f 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 - 4.4.6 + 4.4.7-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 35274e3bd127d..765295bb1b86e 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 - 4.4.6.1 + 4.4.7.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 d3fb2d29c8053..11bfab02da3d7 100644 --- a/api/language/en-GB/install.xml +++ b/api/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (en-GB) en-GB - 4.4.6 + 4.4.7 2024-07 Joomla! Project admin@joomla.org diff --git a/api/language/en-GB/langmetadata.xml b/api/language/en-GB/langmetadata.xml index cd200124b38f5..84978b6b1d3ee 100644 --- a/api/language/en-GB/langmetadata.xml +++ b/api/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (en-GB) - 4.4.6 + 4.4.7 2024-07 Joomla! Project admin@joomla.org diff --git a/installation/language/en-GB/langmetadata.xml b/installation/language/en-GB/langmetadata.xml index daf99be4bc626..4c10f25a08b96 100644 --- a/installation/language/en-GB/langmetadata.xml +++ b/installation/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (United Kingdom) - 4.4.6 + 4.4.7 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 265f20d3ba98b..82887e08e6c02 100644 --- a/language/en-GB/install.xml +++ b/language/en-GB/install.xml @@ -2,7 +2,7 @@ English (en-GB) en-GB - 4.4.6 + 4.4.7 2024-07 Joomla! Project admin@joomla.org diff --git a/language/en-GB/langmetadata.xml b/language/en-GB/langmetadata.xml index c0381b7c51615..e1755842d0f49 100644 --- a/language/en-GB/langmetadata.xml +++ b/language/en-GB/langmetadata.xml @@ -1,7 +1,7 @@ English (en-GB) - 4.4.6 + 4.4.7 2024-07 Joomla! Project admin@joomla.org diff --git a/libraries/src/Version.php b/libraries/src/Version.php index 4da0a47da55d2..7cc56a9df0a48 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 = 6; + public const PATCH_VERSION = 7; /** * 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. diff --git a/package.json b/package.json index fd453f974b21b..de22c7687e3e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "joomla", - "version": "4.4.6", + "version": "4.4.7", "description": "Joomla CMS", "license": "GPL-2.0-or-later", "repository": { From 25168d3a9b6c007981a14d7de1382f9c5e3f763e Mon Sep 17 00:00:00 2001 From: Quy Date: Wed, 10 Jul 2024 12:45:26 -0700 Subject: [PATCH 010/240] [4.4] Fix display of total votes (#43740) * Fix display of total votes * phpcs * cs --- plugins/content/vote/tmpl/rating.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/content/vote/tmpl/rating.php b/plugins/content/vote/tmpl/rating.php index 2c1287628f0d4..e0f2a78b290ca 100644 --- a/plugins/content/vote/tmpl/rating.php +++ b/plugins/content/vote/tmpl/rating.php @@ -79,17 +79,17 @@ ?>
From 199e7da8a29a55555bb54105cea849380e2e3f5c Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Thu, 15 Aug 2024 18:26:33 +0200 Subject: [PATCH 080/240] [5.2] SEF: Enforcing correct SEF URL (#42854) * SEF: Enforcing correct SEF URL * Only redirect URLs with query if the result URL doesn't have query parameters anymore * Codestyle * Update plugins/system/sef/sef.xml * Switching to strict routing option --- plugins/system/sef/src/Extension/Sef.php | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/plugins/system/sef/src/Extension/Sef.php b/plugins/system/sef/src/Extension/Sef.php index cd2c7d242354a..01b753625d03d 100644 --- a/plugins/system/sef/src/Extension/Sef.php +++ b/plugins/system/sef/src/Extension/Sef.php @@ -109,6 +109,11 @@ public function onAfterRoute() if ($app->get('sef') && !$app->get('sef_suffix') && $this->params->get('trailingslash', '-1') != '-1') { $this->enforceTrailingSlash(); } + + // Enforce SEF URLs + if ($this->params->get('strictrouting') && $app->getInput()->getMethod() == 'GET') { + $this->enforceSEF(); + } } /** @@ -362,6 +367,36 @@ protected function enforceTrailingSlash() } } + /** + * Enforce a redirect from URL with query parameters to SEF URL + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function enforceSEF() + { + $app = $this->getApplication(); + $origUri = clone Uri::getInstance(); + + if (\count($origUri->getQuery(true))) { + $parsedVars = $app->getInput()->getArray(); + + if ($app->getLanguageFilter()) { + $parsedVars['lang'] = $parsedVars['language']; + unset($parsedVars['language']); + } + + $route = $origUri->toString(['path', 'query']); + $newRoute = Route::_($parsedVars, false); + $newUri = new Uri($newRoute); + + if (!\count($newUri->getQuery(true)) && $route !== $newRoute) { + $app->redirect($newRoute, 301); + } + } + } + /** * Check the buffer. * From 8f4dcfc54d78c8faebbb6acb1f3e483964e0f237 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Thu, 15 Aug 2024 20:25:04 +0100 Subject: [PATCH 081/240] [5.2] Custom Reply description (#43870) --- administrator/components/com_contact/config.xml | 3 ++- administrator/components/com_contact/forms/contact.xml | 1 + administrator/language/en-GB/com_contact.ini | 1 + components/com_contact/tmpl/categories/default.xml | 1 + components/com_contact/tmpl/category/default.xml | 1 + components/com_contact/tmpl/contact/default.xml | 1 + components/com_contact/tmpl/featured/default.xml | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml index 58171c31bfe59..85608932e1eec 100644 --- a/administrator/components/com_contact/config.xml +++ b/administrator/components/com_contact/config.xml @@ -980,8 +980,9 @@ diff --git a/administrator/components/com_contact/forms/contact.xml b/administrator/components/com_contact/forms/contact.xml index 7b8aa7b404f06..6e4754dd826dd 100644 --- a/administrator/components/com_contact/forms/contact.xml +++ b/administrator/components/com_contact/forms/contact.xml @@ -742,6 +742,7 @@ name="custom_reply" type="list" label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" + description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" useglobal="true" validate="options" > diff --git a/administrator/language/en-GB/com_contact.ini b/administrator/language/en-GB/com_contact.ini index 0233246a96443..daf6f4fea04de 100644 --- a/administrator/language/en-GB/com_contact.ini +++ b/administrator/language/en-GB/com_contact.ini @@ -36,6 +36,7 @@ COM_CONTACT_FIELD_CONFIG_CATEGORIES_DESC="These settings apply for Contact Categ COM_CONTACT_FIELD_CONFIG_CATEGORY_DESC="These settings apply for Contact Category Options unless they are changed for a specific menu item." COM_CONTACT_FIELD_CONFIG_CONTACT_FORM="Form" COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL="Country" +COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC="Stops Joomla from sending the email, allowing for Plugins to handle integration with other systems." COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL="Custom Reply" COM_CONTACT_FIELD_CONFIG_FAX_LABEL="Fax" COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DESC="These settings apply for a single Contact unless they are changed for a specific menu item or Contact." diff --git a/components/com_contact/tmpl/categories/default.xml b/components/com_contact/tmpl/categories/default.xml index 1c004137d0d6e..cee70d405d4e9 100644 --- a/components/com_contact/tmpl/categories/default.xml +++ b/components/com_contact/tmpl/categories/default.xml @@ -740,6 +740,7 @@ name="custom_reply" type="list" label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" + description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" useglobal="true" class="form-select-color-state" validate="options" diff --git a/components/com_contact/tmpl/category/default.xml b/components/com_contact/tmpl/category/default.xml index 51b20453e8105..c80d904e96a95 100644 --- a/components/com_contact/tmpl/category/default.xml +++ b/components/com_contact/tmpl/category/default.xml @@ -757,6 +757,7 @@ name="custom_reply" type="list" label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" + description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" useglobal="true" class="form-select-color-state" validate="options" diff --git a/components/com_contact/tmpl/contact/default.xml b/components/com_contact/tmpl/contact/default.xml index dd29a57ec63e4..9115a4873c347 100644 --- a/components/com_contact/tmpl/contact/default.xml +++ b/components/com_contact/tmpl/contact/default.xml @@ -444,6 +444,7 @@ name="custom_reply" type="list" label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" + description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" useglobal="true" class="form-select-color-state" validate="options" diff --git a/components/com_contact/tmpl/featured/default.xml b/components/com_contact/tmpl/featured/default.xml index 574336beb32c2..770fcbf92e63c 100644 --- a/components/com_contact/tmpl/featured/default.xml +++ b/components/com_contact/tmpl/featured/default.xml @@ -530,6 +530,7 @@ name="custom_reply" type="list" label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" + description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" useglobal="true" class="form-select-color-state" validate="options" From fac99cb3d09c76a2e64b3571358d7a68bf7abff0 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Thu, 15 Aug 2024 21:53:36 +0200 Subject: [PATCH 082/240] [5.2] SEF: Enable new SEF options for new installations (#43024) * Enable new SEF options for new installations * Updating all options --- installation/sql/mysql/base.sql | 2 +- installation/sql/postgresql/base.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 6a36467043e5d..c721c919e5c04 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -359,7 +359,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_system_remember', 'plugin', 'remember', 'system', 0, 1, 1, 0, 1, '', '', '', 16, 0), (0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 1, '', '{}', '', 17, 0), (0, 'plg_system_schemaorg', 'plugin', 'schemaorg', 'system', 0, 1, 1, 0, 0, '', '{}', '', 18, 0), -(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '', '', 19, 0), +(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '{"domain":"","indexphp":"1","trailingslash":"0","enforcesuffix":"1","strictrouting":"1"}', '', 19, 0), (0, 'plg_system_shortcut', 'plugin', 'shortcut', 'system', 0, 1, 1, 0, 1, '', '{}', '', 21, 0), (0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 22, 0), (0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 23, 0), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index bb30f0950f263..e058792e87991 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -365,7 +365,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_system_remember', 'plugin', 'remember', 'system', 0, 1, 1, 0, 1, '', '', '', 16, 0), (0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 1, '', '{}', '', 17, 0), (0, 'plg_system_schemaorg', 'plugin', 'schemaorg', 'system', 0, 1, 1, 0, 0, '', '{}', '', 18, 0), -(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '', '', 19, 0), +(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '{"domain":"","indexphp":"1","trailingslash":"0","enforcesuffix":"1","strictrouting":"1"}', '', 19, 0), (0, 'plg_system_shortcut', 'plugin', 'shortcut', 'system', 0, 1, 1, 0, 1, '', '{}', '', 21, 0), (0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 22, 0), (0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 23, 0), From c3bbc28dc6e2a1bda5600fcfb2535ef6524d511f Mon Sep 17 00:00:00 2001 From: Fedir Zinchuk Date: Thu, 15 Aug 2024 23:29:36 +0300 Subject: [PATCH 083/240] [5.2][Events] Use event classes for Editors and editor buttons plugins (#43635) --- .../article/src/Extension/Article.php | 4 +- .../contact/src/Extension/Contact.php | 75 +++++++--- .../fields/src/Extension/Fields.php | 75 +++++++--- .../editors-xtd/image/src/Extension/Image.php | 5 +- .../editors-xtd/menu/src/Extension/Menu.php | 80 ++++++++--- .../module/src/Extension/Module.php | 75 +++++++--- .../pagebreak/src/Extension/PageBreak.php | 73 ++++++++-- .../readmore/src/Extension/ReadMore.php | 18 ++- plugins/editors/none/src/Extension/None.php | 99 +++---------- .../none/src/Provider/EditorNoneProvider.php | 131 ++++++++++++++++++ .../PageBreak/Extension/PageBreakTest.php | 56 ++++++-- 11 files changed, 493 insertions(+), 198 deletions(-) create mode 100644 plugins/editors/none/src/Provider/EditorNoneProvider.php diff --git a/plugins/editors-xtd/article/src/Extension/Article.php b/plugins/editors-xtd/article/src/Extension/Article.php index d75f395194871..49b341a002300 100644 --- a/plugins/editors-xtd/article/src/Extension/Article.php +++ b/plugins/editors-xtd/article/src/Extension/Article.php @@ -46,7 +46,7 @@ public static function getSubscribedEvents(): array * * @since 5.0.0 */ - public function onEditorButtonsSetup(EditorButtonsSetupEvent $event) + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void { $subject = $event->getButtonsRegistry(); $disabled = $event->getDisabledButtons(); @@ -73,7 +73,7 @@ public function onEditorButtonsSetup(EditorButtonsSetupEvent $event) * * @since 1.5 * - * @deprecated 6.0 Use onEditorButtonsSetup event + * @deprecated 5.0 Use onEditorButtonsSetup event */ public function onDisplay($name) { diff --git a/plugins/editors-xtd/contact/src/Extension/Contact.php b/plugins/editors-xtd/contact/src/Extension/Contact.php index b6fc9205b6cd2..a3d7bb9a71051 100644 --- a/plugins/editors-xtd/contact/src/Extension/Contact.php +++ b/plugins/editors-xtd/contact/src/Extension/Contact.php @@ -10,10 +10,12 @@ namespace Joomla\Plugin\EditorsXtd\Contact\Extension; +use Joomla\CMS\Editor\Button\Button; +use Joomla\CMS\Event\Editor\EditorButtonsSetupEvent; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Session\Session; +use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -24,24 +26,52 @@ * * @since 3.7.0 */ -final class Contact extends CMSPlugin +final class Contact extends CMSPlugin implements SubscriberInterface { /** - * Load the language file on instantiation. + * Returns an array of events this subscriber will listen to. * - * @var boolean - * @since 3.7.0 + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public static function getSubscribedEvents(): array + { + return ['onEditorButtonsSetup' => 'onEditorButtonsSetup']; + } + + /** + * @param EditorButtonsSetupEvent $event + * @return void + * + * @since __DEPLOY_VERSION__ */ - protected $autoloadLanguage = true; + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void + { + $subject = $event->getButtonsRegistry(); + $disabled = $event->getDisabledButtons(); + + if (\in_array($this->_name, $disabled)) { + return; + } + + $button = $this->onDisplay($event->getEditorId()); + + if ($button) { + $subject->add($button); + } + } /** * Display the button * * @param string $name The name of the button to add * - * @return CMSObject|void The button options as CMSObject + * @return Button|void The button options as Button object * * @since 3.7.0 + * + * @deprecated 5.0 Use onEditorButtonsSetup event */ public function onDisplay($name) { @@ -52,22 +82,29 @@ public function onDisplay($name) || $user->authorise('core.edit', 'com_contact') || $user->authorise('core.edit.own', 'com_contact') ) { + $this->loadLanguage(); + // The URL for the contacts list $link = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&' . Session::getFormToken() . '=1&editor=' . $name; - $button = new CMSObject(); - $button->action = 'modal'; - $button->link = $link; - $button->text = Text::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT'); - $button->name = $this->_type . '_' . $this->_name; - $button->icon = 'address'; - $button->iconSVG = '' - . ''; + $button = new Button( + $this->_name, + [ + 'action' => 'modal', + 'link' => $link, + 'text' => Text::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT'), + 'icon' => 'address', + 'iconSVG' => '' + . '', + // This is whole Plugin name, it is needed for keeping backward compatibility + 'name' => $this->_type . '_' . $this->_name, + ] + ); return $button; } diff --git a/plugins/editors-xtd/fields/src/Extension/Fields.php b/plugins/editors-xtd/fields/src/Extension/Fields.php index 8ed11e14ff3e0..68169394f6996 100644 --- a/plugins/editors-xtd/fields/src/Extension/Fields.php +++ b/plugins/editors-xtd/fields/src/Extension/Fields.php @@ -11,10 +11,12 @@ namespace Joomla\Plugin\EditorsXtd\Fields\Extension; use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Editor\Button\Button; +use Joomla\CMS\Event\Editor\EditorButtonsSetupEvent; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Session\Session; +use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -25,22 +27,48 @@ * * @since 3.7.0 */ -final class Fields extends CMSPlugin +final class Fields extends CMSPlugin implements SubscriberInterface { /** - * Load the language file on instantiation. + * Returns an array of events this subscriber will listen to. * - * @var boolean - * @since 3.7.0 + * @return array + * + * @since __DEPLOY_VERSION__ */ - protected $autoloadLanguage = true; + public static function getSubscribedEvents(): array + { + return ['onEditorButtonsSetup' => 'onEditorButtonsSetup']; + } + + /** + * @param EditorButtonsSetupEvent $event + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void + { + $subject = $event->getButtonsRegistry(); + $disabled = $event->getDisabledButtons(); + + if (\in_array($this->_name, $disabled)) { + return; + } + + $button = $this->onDisplay($event->getEditorId()); + + if ($button) { + $subject->add($button); + } + } /** * Display the button * * @param string $name The name of the button to add * - * @return CMSObject|void The button options as CMSObject + * @return Button|void The button options as Button object * * @since 3.7.0 */ @@ -51,6 +79,8 @@ public function onDisplay($name) return; } + $this->loadLanguage(); + // Guess the field context based on view. $jinput = $this->getApplication()->getInput(); $context = $jinput->get('option') . '.' . $jinput->get('view'); @@ -63,19 +93,24 @@ public function onDisplay($name) $link = 'index.php?option=com_fields&view=fields&layout=modal&tmpl=component&context=' . $context . '&editor=' . $name . '&' . Session::getFormToken() . '=1'; - $button = new CMSObject(); - $button->action = 'modal'; - $button->link = $link; - $button->text = Text::_('PLG_EDITORS-XTD_FIELDS_BUTTON_FIELD'); - $button->name = $this->_type . '_' . $this->_name; - $button->icon = 'puzzle'; - $button->iconSVG = ''; + $button = new Button( + $this->_name, + [ + 'action' => 'modal', + 'link' => $link, + 'text' => Text::_('PLG_EDITORS-XTD_FIELDS_BUTTON_FIELD'), + 'icon' => 'puzzle', + 'iconSVG' => '', + // This is whole Plugin name, it is needed for keeping backward compatibility + 'name' => $this->_type . '_' . $this->_name, + ] + ); return $button; } diff --git a/plugins/editors-xtd/image/src/Extension/Image.php b/plugins/editors-xtd/image/src/Extension/Image.php index 90bd4ab984dee..e6d48d8758ddc 100644 --- a/plugins/editors-xtd/image/src/Extension/Image.php +++ b/plugins/editors-xtd/image/src/Extension/Image.php @@ -16,6 +16,7 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Uri\Uri; +use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -26,7 +27,7 @@ * * @since 1.5 */ -final class Image extends CMSPlugin +final class Image extends CMSPlugin implements SubscriberInterface { /** * Returns an array of events this subscriber will listen to. @@ -46,7 +47,7 @@ public static function getSubscribedEvents(): array * * @since 5.1.0 */ - public function onEditorButtonsSetup(EditorButtonsSetupEvent $event) + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void { $disabled = $event->getDisabledButtons(); diff --git a/plugins/editors-xtd/menu/src/Extension/Menu.php b/plugins/editors-xtd/menu/src/Extension/Menu.php index e6af865975019..e816d3548f09e 100644 --- a/plugins/editors-xtd/menu/src/Extension/Menu.php +++ b/plugins/editors-xtd/menu/src/Extension/Menu.php @@ -10,10 +10,12 @@ namespace Joomla\Plugin\EditorsXtd\Menu\Extension; +use Joomla\CMS\Editor\Button\Button; +use Joomla\CMS\Event\Editor\EditorButtonsSetupEvent; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Session\Session; +use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -24,51 +26,83 @@ * * @since 3.7.0 */ -final class Menu extends CMSPlugin +final class Menu extends CMSPlugin implements SubscriberInterface { /** - * Load the language file on instantiation. + * Returns an array of events this subscriber will listen to. * - * @var boolean - * @since 3.7.0 + * @return array + * + * @since __DEPLOY_VERSION__ */ - protected $autoloadLanguage = true; + public static function getSubscribedEvents(): array + { + return ['onEditorButtonsSetup' => 'onEditorButtonsSetup']; + } + + /** + * @param EditorButtonsSetupEvent $event + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void + { + $subject = $event->getButtonsRegistry(); + $disabled = $event->getDisabledButtons(); + + if (\in_array($this->_name, $disabled)) { + return; + } + + $button = $this->onDisplay($event->getEditorId()); + + if ($button) { + $subject->add($button); + } + } /** * Display the button * * @param string $name The name of the button to add * + * @return Button|void The button options as Button object + * * @since 3.7.0 - * @return CMSObject + * + * @deprecated 5.0 Use onEditorButtonsSetup event */ public function onDisplay($name) { - /* - * Use the built-in element view to select the menu item. - * Currently uses blank class. - */ $user = $this->getApplication()->getIdentity(); if ( $user->authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus') ) { + $this->loadLanguage(); + $link = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&' . Session::getFormToken() . '=1&editor=' . $name; - $button = new CMSObject(); - $button->action = 'modal'; - $button->link = $link; - $button->text = Text::_('PLG_EDITORS-XTD_MENU_BUTTON_MENU'); - $button->name = $this->_type . '_' . $this->_name; - $button->icon = 'list'; - $button->iconSVG = ''; + $button = new Button( + $this->_name, + [ + 'action' => 'modal', + 'link' => $link, + 'text' => Text::_('PLG_EDITORS-XTD_MENU_BUTTON_MENU'), + 'icon' => 'list', + 'iconSVG' => '', + // This is whole Plugin name, it is needed for keeping backward compatibility + 'name' => $this->_type . '_' . $this->_name, + ] + ); return $button; } diff --git a/plugins/editors-xtd/module/src/Extension/Module.php b/plugins/editors-xtd/module/src/Extension/Module.php index 56e03bf441c6b..4954ac1b1e5ab 100644 --- a/plugins/editors-xtd/module/src/Extension/Module.php +++ b/plugins/editors-xtd/module/src/Extension/Module.php @@ -10,10 +10,12 @@ namespace Joomla\Plugin\EditorsXtd\Module\Extension; +use Joomla\CMS\Editor\Button\Button; +use Joomla\CMS\Event\Editor\EditorButtonsSetupEvent; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Session\Session; +use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -24,31 +26,55 @@ * * @since 3.5 */ -final class Module extends CMSPlugin +final class Module extends CMSPlugin implements SubscriberInterface { /** - * Load the language file on instantiation. + * Returns an array of events this subscriber will listen to. * - * @var boolean - * @since 3.5 + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public static function getSubscribedEvents(): array + { + return ['onEditorButtonsSetup' => 'onEditorButtonsSetup']; + } + + /** + * @param EditorButtonsSetupEvent $event + * @return void + * + * @since __DEPLOY_VERSION__ */ - protected $autoloadLanguage = true; + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void + { + $subject = $event->getButtonsRegistry(); + $disabled = $event->getDisabledButtons(); + + if (\in_array($this->_name, $disabled)) { + return; + } + + $button = $this->onDisplay($event->getEditorId()); + + if ($button) { + $subject->add($button); + } + } /** * Display the button * * @param string $name The name of the button to add * - * @return CMSObject|void The button options as CMSObject + * @return Button|void The button options as Button object * * @since 3.5 + * + * @deprecated 5.0 Use onEditorButtonsSetup event */ public function onDisplay($name) { - /* - * Use the built-in element view to select the module. - * Currently uses blank class. - */ $user = $this->getApplication()->getIdentity(); if ( @@ -56,19 +82,26 @@ public function onDisplay($name) || $user->authorise('core.edit', 'com_modules') || $user->authorise('core.edit.own', 'com_modules') ) { + $this->loadLanguage(); + $link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&' . Session::getFormToken() . '=1&editor=' . $name; - $button = new CMSObject(); - $button->action = 'modal'; - $button->link = $link; - $button->text = Text::_('PLG_MODULE_BUTTON_MODULE'); - $button->name = $this->_type . '_' . $this->_name; - $button->icon = 'cube'; - $button->iconSVG = ''; + $button = new Button( + $this->_name, + [ + 'action' => 'modal', + 'link' => $link, + 'text' => Text::_('PLG_MODULE_BUTTON_MODULE'), + 'icon' => 'cube', + 'iconSVG' => '', + // This is whole Plugin name, it is needed for keeping backward compatibility + 'name' => $this->_type . '_' . $this->_name, + ] + ); return $button; } diff --git a/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php b/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php index 4d7cf7107c29a..c879fbdfe6fee 100644 --- a/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php +++ b/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php @@ -11,8 +11,11 @@ namespace Joomla\Plugin\EditorsXtd\PageBreak\Extension; use Joomla\CMS\Application\CMSWebApplicationInterface; -use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Editor\Button\Button; +use Joomla\CMS\Event\Editor\EditorButtonsSetupEvent; +use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\CMSPlugin; +use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -23,7 +26,7 @@ * * @since 1.5 */ -final class PageBreak extends CMSPlugin +final class PageBreak extends CMSPlugin implements SubscriberInterface { /** * Load the language file on instantiation. @@ -33,14 +36,50 @@ final class PageBreak extends CMSPlugin */ protected $autoloadLanguage = true; + /** + * Returns an array of events this subscriber will listen to. + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public static function getSubscribedEvents(): array + { + return ['onEditorButtonsSetup' => 'onEditorButtonsSetup']; + } + + /** + * @param EditorButtonsSetupEvent $event + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void + { + $subject = $event->getButtonsRegistry(); + $disabled = $event->getDisabledButtons(); + + if (\in_array($this->_name, $disabled)) { + return; + } + + $button = $this->onDisplay($event->getEditorId()); + + if ($button) { + $subject->add($button); + } + } + /** * Display the button * * @param string $name The name of the button to add * - * @return CMSObject|void The button options as CMSObject + * @return Button|void The button options as Button object * * @since 1.5 + * + * @deprecated 5.0 Use onEditorButtonsSetup event */ public function onDisplay($name) { @@ -66,18 +105,24 @@ public function onDisplay($name) return; } + $this->loadLanguage(); $app->getDocument()->addScriptOptions('xtd-pagebreak', ['editor' => $name]); - $link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name; - - $button = new CMSObject(); - $button->action = 'modal'; - $button->link = $link; - $button->text = $app->getLanguage()->_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'); - $button->name = $this->_type . '_' . $this->_name; - $button->icon = 'copy'; - $button->iconSVG = ''; + $link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name; + + $button = new Button( + $this->_name, + [ + 'action' => 'modal', + 'link' => $link, + 'text' => Text::_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'), + 'icon' => 'copy', + 'iconSVG' => '', + // This is whole Plugin name, it is needed for keeping backward compatibility + 'name' => $this->_type . '_' . $this->_name, + ] + ); return $button; } diff --git a/plugins/editors-xtd/readmore/src/Extension/ReadMore.php b/plugins/editors-xtd/readmore/src/Extension/ReadMore.php index 7f466c0d187fb..b65a337d8465a 100644 --- a/plugins/editors-xtd/readmore/src/Extension/ReadMore.php +++ b/plugins/editors-xtd/readmore/src/Extension/ReadMore.php @@ -45,7 +45,7 @@ public static function getSubscribedEvents(): array * * @since 5.0.0 */ - public function onEditorButtonsSetup(EditorButtonsSetupEvent $event) + public function onEditorButtonsSetup(EditorButtonsSetupEvent $event): void { $subject = $event->getButtonsRegistry(); $disabled = $event->getDisabledButtons(); @@ -54,8 +54,6 @@ public function onEditorButtonsSetup(EditorButtonsSetupEvent $event) return; } - $this->loadLanguage(); - $button = $this->onDisplay($event->getEditorId()); $subject->add($button); } @@ -65,23 +63,29 @@ public function onEditorButtonsSetup(EditorButtonsSetupEvent $event) * * @param string $name The name of the button to add * - * @return Button $button A two element array of (imageName, textToInsert) + * @return Button The button options as Button object * * @since 1.5 * - * @deprecated 6.0 Use onEditorButtonsSetup event + * @deprecated 5.0 Use onEditorButtonsSetup event */ public function onDisplay($name) { + /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ + $wa = $this->getApplication()->getDocument()->getWebAssetManager(); + // Register the asset "editor-button.