diff options
author | emkael <emkael@tlen.pl> | 2017-05-06 15:25:59 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-05-06 15:25:59 +0200 |
commit | 039ad7e7c5cb66017430c1885dfc1201f7b3223e (patch) | |
tree | d5c07d6ff14911f676058ae1ea0e3250bc6c9c51 /providers | |
parent | 2a708631a005cdcd21798ac35cbb15c2093d6aad (diff) |
* Emoji-replacing filter
Diffstat (limited to 'providers')
-rw-r--r-- | providers/Provider.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/providers/Provider.php b/providers/Provider.php index 2e14d2b..bf85f12 100644 --- a/providers/Provider.php +++ b/providers/Provider.php @@ -41,12 +41,29 @@ 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); + } + } + } + return $items; + } + public function get() { $items = $this->_getItems(); if (isset($this->_options['spamfilter'])) { $items = $this->_spamFilter($items); } - return $this->_sortContent($this->_mapItems($items)); + return $this->_sortContent( + $this->_filterItemContent( + $this->_mapItems($items) + ) + ); } public function cacheTime() { |