diff options
author | emkael <emkael@tlen.pl> | 2025-04-07 15:48:44 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2025-04-07 15:48:44 +0200 |
commit | 063a161bf7ca2bb3f5eb6a6c75d08058d158c316 (patch) | |
tree | b7c56b6a01225add4998a02da3a91e212322a300 | |
parent | 57f61fd6a62c7051e98fb040ca0b08f958710898 (diff) |
Enable no-emoji mode by default + update emoji list URLs
-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; } |