/**
  * Loads assets for the emoji picker
  */
 public function load_assets()
 {
     wp_enqueue_style('emoji-reactions-display-reactions-css', plugins_url('assets/css/display-reactions.css', dirname(__FILE__)));
     wp_enqueue_script('emoji-reactions-display-reactions-js', plugins_url('assets/js/display-reactions.js', dirname(__FILE__)), array('jquery'));
     // data for displaying the reactions area
     wp_localize_script('emoji-reactions-display-reactions-js', 'emojiData', array('pluginURL' => plugins_url('', dirname(__FILE__)), 'custom' => Emoji_Reactions_Utils::get_custom_emoji()));
 }
 /**
  * Loads assets for the emoji picker
  */
 public function load_assets()
 {
     wp_enqueue_style('emoji-reactions-emoji-picker-css', plugins_url('assets/css/emoji-picker.css', dirname(__FILE__)));
     wp_enqueue_script('emoji-reactions-emoji-picker-js', plugins_url('assets/js/emoji-picker.js', dirname(__FILE__)), array('jquery'));
     // data for displaying the reactions area
     wp_localize_script('emoji-reactions-emoji-picker-js', 'emojiPickerData', array('pluginURL' => plugins_url('', dirname(__FILE__)), 'custom' => Emoji_Reactions_Utils::get_custom_emoji()));
     // i18n strings
     wp_localize_script('emoji-reactions-emoji-picker-js', 'emojiPickerStrings', array('people' => esc_html__('People', 'emoji-reactions'), 'nature' => esc_html__('Nature', 'emoji-reactions'), 'foods' => esc_html__('Food & Drink', 'emoji-reactions'), 'celebration' => esc_html__('Celebration', 'emoji-reactions'), 'activity' => esc_html__('Activity', 'emoji-reactions'), 'places' => esc_html__('Travel & Places', 'emoji-reactions'), 'symbols' => esc_html__('Objects & Symbols', 'emoji-reactions'), 'custom' => esc_html__('Custom', 'emoji-reactions')));
 }
示例#3
0
 /**
  * Returns true if the provided $emoji shorthand is a valid emoji or false if not
  * Checks against both custom emoji and standard emoji
  * @param  string  $emoji
  * @return boolean
  */
 public static function is_valid_emoji($emoji)
 {
     if ("custom_" === substr($emoji, 0, 7)) {
         $emoji = substr($emoji, 7);
     }
     $custom_emoji = Emoji_Reactions_Utils::get_custom_emoji();
     if (array_key_exists($emoji, $custom_emoji)) {
         return true;
     }
     $emoji_raw_json = file_get_contents(__DIR__ . '/../emoji.json');
     $emoji_json = json_decode($emoji_raw_json);
     $is_valid_emoji = false;
     foreach ($emoji_json as $single_emoji_object) {
         if ($emoji === $single_emoji_object->short_name) {
             $is_valid_emoji = true;
             break;
         }
     }
     return $is_valid_emoji;
 }