From d6c2daee51fa90f000c106492141baf3824931d2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 25 Jan 2025 09:16:13 +0100 Subject: Add search operator intext: (#7228) * Add search operator intext: fix https://github.com/FreshRSS/FreshRSS/issues/6188 https://github.com/FreshRSS/FreshRSS/discussions/7220 * Add example to doc --- app/Models/Entry.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'app/Models/Entry.php') diff --git a/app/Models/Entry.php b/app/Models/Entry.php index f86948122..fe0cf7429 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -673,6 +673,26 @@ HTML; $ok &= preg_match($title, $this->title) === 0; } } + if ($ok && $filter->getIntext() !== null) { + foreach ($filter->getIntext() as $content) { + $ok &= stripos($this->content, $content) !== false; + } + } + if ($ok && $filter->getIntextRegex() !== null) { + foreach ($filter->getIntextRegex() as $content) { + $ok &= preg_match($content, $this->content) === 1; + } + } + if ($ok && $filter->getNotIntext() !== null) { + foreach ($filter->getNotIntext() as $content) { + $ok &= stripos($this->content, $content) === false; + } + } + if ($ok && $filter->getNotIntextRegex() !== null) { + foreach ($filter->getNotIntextRegex() as $content) { + $ok &= preg_match($content, $this->content) === 0; + } + } if ($ok && $filter->getTags() !== null) { foreach ($filter->getTags() as $tag2) { $found = false; -- cgit v1.2.3