commit vendor
This commit is contained in:
29
vendor/elvanto/litemoji/bin/generate-shortcodes-array.php
vendored
Normal file
29
vendor/elvanto/litemoji/bin/generate-shortcodes-array.php
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
function normalizeShortcode($shortcode) {
|
||||
return str_replace('-', '_', strtolower($shortcode));
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents(__DIR__ . '/../vendor/milesj/emojibase/packages/data/en/raw.json'), true);
|
||||
$emoji_array = require(__DIR__ . '/../src/shortcodes-array.php');
|
||||
$existing_shortcodes = array_map('normalizeShortcode', array_keys($emoji_array));
|
||||
|
||||
foreach ($data as $emoji) {
|
||||
foreach ($emoji['shortcodes'] as $shortcode) {
|
||||
|
||||
if (in_array(normalizeShortcode($shortcode), $existing_shortcodes)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$emoji_array[ (string) $shortcode] = $emoji['hexcode'];
|
||||
}
|
||||
}
|
||||
|
||||
ksort($emoji_array, SORT_NATURAL);
|
||||
$output = "<?php\nreturn [\n";
|
||||
foreach ($emoji_array as $shortcode => $codepoints) {
|
||||
$output .= " '$shortcode' => '$codepoints',\n";
|
||||
};
|
||||
$output .= '];';
|
||||
file_put_contents('src/shortcodes-array.php', $output);
|
||||
Reference in New Issue
Block a user