summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2025-03-29 10:36:08 +0000
committerwn_ <invalid@email.com>2025-03-29 10:36:08 +0000
commit10c488e1d05734e4e939db71a3ab9448c6e2ad11 (patch)
tree576ff3cd9a7b2b5db6d4f6a95688f9b0bdc618f6 /classes
parent043162b0ebe7b086bf7b19d5b4585ada36a4f9d5 (diff)
Strip '[\r\n\t]' from entry content during filter test.
This is to help get the content and regex match strings a bit closer.
Diffstat (limited to 'classes')
-rw-r--r--classes/Pref_Filters.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/classes/Pref_Filters.php b/classes/Pref_Filters.php
index 3e97309ac..e30a1468c 100644
--- a/classes/Pref_Filters.php
+++ b/classes/Pref_Filters.php
@@ -168,7 +168,6 @@ class Pref_Filters extends Handler_Protected {
$entry['author'], $entry_tags, $matched_rules);
if (count($rc) > 0) {
- $entry_content_text = strip_tags($entry["content"]);
$content_preview = "";
$matches = [];
@@ -186,6 +185,9 @@ class Pref_Filters extends Handler_Protected {
$matches[] = $rule_regexp_match;
if (in_array($rule['type'], ['content', 'both'])) {
+ // also stripping [\r\n\t] to match what's done for content in RSSUtils#get_article_filters()
+ $entry_content_text = strip_tags(preg_replace("/[\r\n\t]/", "", $entry["content"]));
+
$match_index = mb_strpos($entry_content_text, $rule_regexp_match);
$content_preview = truncate_string(mb_substr($entry_content_text, $match_index), 200);