From f9e90d3aebfbf9cc3dfd0525126fad02f52b3aa4 Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Thu, 20 Oct 2022 11:08:35 +0200 Subject: [PATCH 1/7] onContentPrepare: Ignore Macros while indexing --- plugins/content/loadmodule/loadmodule.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/content/loadmodule/loadmodule.php b/plugins/content/loadmodule/loadmodule.php index 87dfee54e909e..b3b1297ec9702 100644 --- a/plugins/content/loadmodule/loadmodule.php +++ b/plugins/content/loadmodule/loadmodule.php @@ -44,11 +44,6 @@ class PlgContentLoadmodule extends CMSPlugin */ public function onContentPrepare($context, &$article, &$params, $page = 0) { - // Don't run this plugin when the content is being indexed - if ($context === 'com_finder.indexer') { - return; - } - // Simple performance check to determine whether bot should process further if (strpos($article->text, 'loadposition') === false && strpos($article->text, 'loadmodule') === false) { return; @@ -65,6 +60,23 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // Expression to search for(id) $regexmodid = '/{loadmoduleid\s([1-9][0-9]*)}/i'; + // Don't run this plugin when the content is being indexed + if ($context === 'com_finder.indexer') { + //Remove macros if any + if (strpos($article->text, 'loadposition')) { + $article->text = preg_replace($regex, '', $article->text); + } + + if (strpos($article->text, 'loadmoduleid')) { + $article->text = preg_replace($regexmodid, '', $article->text); + } + + if (strpos($article->text, 'loadmodule')) { + $article->text = preg_replace($regexmod, '', $article->text); + } + + return; + } // Find all instances of plugin and put in $matches for loadposition // $matches[0] is full pattern match, $matches[1] is the position preg_match_all($regex, $article->text, $matches, PREG_SET_ORDER); From 6fcb7c4aca51433c73e51c08b5acfa025a76b808 Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Sun, 29 Jan 2023 11:02:11 +0100 Subject: [PATCH 2/7] Code style - remove trailing space --- .../templates/administrator/atum/scss/blocks/_modals.scss | 0 plugins/content/loadmodule/loadmodule.php | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 build/media_source/templates/administrator/atum/scss/blocks/_modals.scss diff --git a/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss b/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss old mode 100755 new mode 100644 diff --git a/plugins/content/loadmodule/loadmodule.php b/plugins/content/loadmodule/loadmodule.php index 39660d5ad216f..c30a8ea6c6062 100644 --- a/plugins/content/loadmodule/loadmodule.php +++ b/plugins/content/loadmodule/loadmodule.php @@ -65,7 +65,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // Expression to search for(id) $regexmodid = '/{loadmoduleid\s([1-9][0-9]*)}/i'; - // Remove macros and don't run this plugin when the content is being indexed + // Remove macros and don't run this plugin when the content is being indexed if ($context === 'com_finder.indexer') { //Remove macros if any if (strpos($article->text, 'loadposition')) { From 22b58c101dbb7a119779484e1e89b0e749812795 Mon Sep 17 00:00:00 2001 From: Martin Carl Kopp Date: Mon, 13 Mar 2023 00:45:46 +0100 Subject: [PATCH 3/7] untouch _modals.scss --- .../templates/administrator/atum/scss/blocks/_modals.scss | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build/media_source/templates/administrator/atum/scss/blocks/_modals.scss diff --git a/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss b/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss old mode 100644 new mode 100755 From 7ea5f53de8a4b8b4cf3fb41b10e4c49140c3c3ab Mon Sep 17 00:00:00 2001 From: Martin Carl Kopp Date: Mon, 13 Mar 2023 00:46:07 +0100 Subject: [PATCH 4/7] untouch _modals.scss --- .../templates/administrator/atum/scss/blocks/_modals.scss | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 build/media_source/templates/administrator/atum/scss/blocks/_modals.scss diff --git a/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss b/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss old mode 100755 new mode 100644 From ebda79a89e26d506779153c5a90874fb8935e83c Mon Sep 17 00:00:00 2001 From: MacJoom Date: Mon, 13 Mar 2023 00:54:22 +0100 Subject: [PATCH 5/7] untouch _modals.scss --- .../templates/administrator/atum/scss/blocks/_modals.scss | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build/media_source/templates/administrator/atum/scss/blocks/_modals.scss diff --git a/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss b/build/media_source/templates/administrator/atum/scss/blocks/_modals.scss old mode 100644 new mode 100755 From 9d9a6833dcb4eaba3c06f7f3e1249a735cde50d1 Mon Sep 17 00:00:00 2001 From: Martin Kopp Date: Wed, 17 May 2023 11:38:32 +0200 Subject: [PATCH 6/7] Use str_contains instead of strpos --- plugins/content/loadmodule/loadmodule.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/content/loadmodule/loadmodule.php b/plugins/content/loadmodule/loadmodule.php index 43faec4e5949e..2fb8aea64acc9 100644 --- a/plugins/content/loadmodule/loadmodule.php +++ b/plugins/content/loadmodule/loadmodule.php @@ -68,15 +68,15 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) if ($context === 'com_finder.indexer') { //Remove macros if any - if (strpos($article->text, 'loadposition')) { + if (str_contains($article->text, 'loadposition')) { $article->text = preg_replace($regex, '', $article->text); } - if (strpos($article->text, 'loadmoduleid')) { + if (str_contains($article->text, 'loadmoduleid')) { $article->text = preg_replace($regexmodid, '', $article->text); } - if (strpos($article->text, 'loadmodule')) { + if (str_contains($article->text, 'loadmodule')) { $article->text = preg_replace($regexmod, '', $article->text); } From 9a37f4e3c45256b2183bf8c683c946337b84ed1d Mon Sep 17 00:00:00 2001 From: Olivier Buisard Date: Sat, 15 Jul 2023 14:40:10 -0400 Subject: [PATCH 7/7] Update plugins/content/loadmodule/loadmodule.php Move comment before test Co-authored-by: Quy --- plugins/content/loadmodule/loadmodule.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/content/loadmodule/loadmodule.php b/plugins/content/loadmodule/loadmodule.php index 2fb8aea64acc9..dc2df02ecf645 100644 --- a/plugins/content/loadmodule/loadmodule.php +++ b/plugins/content/loadmodule/loadmodule.php @@ -64,10 +64,9 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // Expression to search for(id) $regexmodid = '/{loadmoduleid\s([1-9][0-9]*)}/i'; - // Remove macros and don't run this plugin when the content is being indexed + // Remove macros and don't run this plugin when the content is being indexed if ($context === 'com_finder.indexer') { - //Remove macros if any if (str_contains($article->text, 'loadposition')) { $article->text = preg_replace($regex, '', $article->text); }