'😄',
':smiley:' => '😃',
':wink:' => '😉',
':blush:' => '😊',
':grin:' => '😁',
':smirk:' => '😏',
':heart_eyes:' => '😍',
':sunglasses:' => '😎',
':laughing:' => '😆',
':neutral_face:' => '😐',
':flushed:' => '😳',
':dizzy_face:' => '😵',
':cry:' => '😢',
':persevere:' => '😣',
':worried:' => '😟',
':hushed:' => '😮',
':mag:' => '🔍',
':hot_beverage:' => '☕',
':exclamation:' => '❗',
':question:' => '❓'
);
// outputs the editor toolbar
function plugin_emoticons() {
global $plugin_emoticons;
if (!count($plugin_emoticons))
return true;
echo '';
echo '
';
return true;
}
// replaces the text with an utf-8 emoticon
function plugin_emoticons_filter ($emostring) {
global $plugin_emoticons;
foreach ($plugin_emoticons as $text => $emoticon) {
$emostring = str_replace(
["$text"],
"{$emoticon}",
$emostring
);
}
return $emostring;
}
// css file
function plugin_emoticons_css() {
$pdir = plugin_geturl('emoticons');
echo '
';
}
// register css file
add_action('wp_head', 'plugin_emoticons_css', 0);
// register editor toolbar
add_filter('simple_toolbar_form', 'plugin_emoticons',);
// register to the hook
add_filter('the_content','plugin_emoticons_filter');
// register for emoticon in comment
add_filter('comment_text','plugin_emoticons_filter');
// register for the excerpt of a post
add_filter('the_excerpt', 'plugin_emoticons_filter');
?>