diff options
-rw-r--r-- | bin/emoji-list.py | 4 | ||||
-rw-r--r-- | providers/Provider.php | 21 |
2 files changed, 15 insertions, 10 deletions
diff --git a/bin/emoji-list.py b/bin/emoji-list.py index 9e17c30..590dddc 100644 --- a/bin/emoji-list.py +++ b/bin/emoji-list.py @@ -2,7 +2,7 @@ import json, os, urllib.request, urllib.parse, urllib.error import xml.etree.ElementTree as ET emoji_list = json.load(urllib.request.urlopen( - 'https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json' + 'https://raw.githubusercontent.com/iamcal/emoji-data/refs/heads/master/emoji.json' )) dictionary = {} for emoji in emoji_list: @@ -11,7 +11,7 @@ for emoji in emoji_list: dictionary[character] = ' [%s] ' % (name) stupidspeak_map = ET.fromstring(urllib.request.urlopen( - 'http://slothsoft.net/getResource.php/slothsoft/unicode-mapper' + 'http://slothsoft.net/slothsoft@slothsoft.net/static/unicode-mapper' ).read()) for letter in stupidspeak_map.findall('.//letter'): if letter.attrib['target'] != letter.attrib['source']: 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; } |