diff options
Diffstat (limited to 'providers')
-rw-r--r-- | providers/Provider.php | 21 |
1 files changed, 13 insertions, 8 deletions
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; } |