Strip '[\r\n\t]' from entry content during filter test.

This is to help get the content and regex match strings a bit closer.
This commit is contained in:
wn_
2025-03-29 10:36:08 +00:00
parent 043162b0eb
commit 10c488e1d0

View File

@@ -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);