From 063a161bf7ca2bb3f5eb6a6c75d08058d158c316 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 7 Apr 2025 15:48:44 +0200 Subject: Enable no-emoji mode by default + update emoji list URLs --- providers/Provider.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'providers') diff --git a/providers/Provider.php b/providers/Provider.php index fe2195c..baec215 100644 --- a/providers/Provider.php +++ b/providers/Provider.php @@ -44,22 +44,27 @@ abstract class Provider { } } - protected function _filterItemContent($items) { - if (in_array('noemoji', $this->_options)) { - $dictionary = json_decode(file_get_contents('../config/emoji.json'), TRUE); - $filtered = []; - foreach ($items as $item) { - foreach (['Title', 'Text'] as $field) { - $item->{$field} = strtr($item->{$field}, $dictionary); - } + private function _filterEmoji($items) { + $dictionary = json_decode(file_get_contents('../config/emoji.json'), TRUE); + $filtered = []; + foreach ($items as $item) { + foreach (['Title', 'Text'] as $field) { + $item->{$field} = strtr($item->{$field}, $dictionary); } } + return $items; + } + + protected function _filterItemContent($items) { + $items = $this->_filterEmoji($items); + if (array_key_exists('title', $this->_options)) { $keyword = strtolower($this->_options['title']); $items = array_filter($items, function($item) use($keyword) { return str_contains(strtolower($item->Title), $keyword); }); } + return $items; } -- cgit v1.2.3