Make WordPress Core

Changeset 31733


Ignore:
Timestamp:
03/11/2015 10:48:16 PM (12 years ago)
Author:
pento
Message:

Add emoji support, with Twemoji fallback.

Replace exisiting smilies with equivalent emoji, or with shiny new smiley images where no emoji existed.

Props batmoo, joen and mkaz for the original plugin upon which this is based.

Props pento, iseulde, kraftbj and peterwilsoncc for making the internet's dreams come true.

See #31242

Location:
trunk
Files:
8 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r31718 r31733  
    361361                                                'wpautoresize',
    362362                                                'wpeditimage',
     363                                                'wpemoji',
    363364                                                'wpgallery',
    364365                                                'wplink',
  • trunk/src/wp-includes/default-filters.php

    r31726 r31733  
    161161add_filter( 'the_title_rss',      'esc_html'        );
    162162add_filter( 'the_content_rss',    'ent2ncr',      8 );
     163add_filter( 'the_content_feed',   'feed_emoji'      );
    163164add_filter( 'the_excerpt_rss',    'convert_chars'   );
    164165add_filter( 'the_excerpt_rss',    'ent2ncr',      8 );
    … …  
    166167add_filter( 'comment_text_rss',   'ent2ncr',      8 );
    167168add_filter( 'comment_text_rss',   'esc_html'        );
     169add_filter( 'comment_text_rss',   'feed_emoji'      );
    168170add_filter( 'bloginfo_rss',       'ent2ncr',      8 );
    169171add_filter( 'the_author',         'ent2ncr',      8 );
    170172add_filter( 'the_guid',           'esc_url'         );
     173
     174// Email filters
     175add_filter( 'wp_mail', 'mail_emoji' );
    171176
    172177// Misc filters
    … …  
    219224add_action( 'init',                'check_theme_switched',            99    );
    220225add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
     226add_action( 'wp_print_styles',     'print_emoji_styles'                     );
    221227
    222228if ( isset( $_GET['replytocom'] ) )
    … …  
    249255add_action( 'admin_print_footer_scripts', '_wp_footer_scripts'                             );
    250256add_action( 'admin_print_styles',         'print_admin_styles',                      20    );
     257add_action( 'admin_print_styles',         'print_emoji_styles'                             );
    251258add_action( 'init',                       'smilies_init',                             5    );
    252259add_action( 'plugins_loaded',             'wp_maybe_load_widgets',                    0    );
  • trunk/src/wp-includes/feed.php

    r30681 r31733  
    650650        return $feed;
    651651}
     652
     653/**
     654 * Convert emoji characters in a feed into static images.
     655 *
     656 * @param string $content The content to convert.
     657 *
     658 * @return The converted content.
     659 */
     660function feed_emoji( $content ) {
     661        return wp_staticize_emoji( $content, true );
     662}
  • trunk/src/wp-includes/formatting.php

    r31678 r31733  
    20382038        $smiley = trim( reset( $matches ) );
    20392039        $img = $wpsmiliestrans[ $smiley ];
     2040
     2041        $matches = array();
     2042        $ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
     2043        $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
     2044
     2045        // Don't convert smilies that aren't images - they're probably emoji.
     2046        if ( ! in_array( $ext, $image_exts ) ) {
     2047                return $img;
     2048        }
    20402049
    20412050        /**
    … …  
    40164025        return $spaces;
    40174026}
     4027
     4028/**
     4029 * Print the important emoji-related styles.
     4030 *
     4031 * @since 4.2.0
     4032 */
     4033function print_emoji_styles() {
     4034?>
     4035<style type="text/css">
     4036img.wp-smiley,
     4037img.emoji {
     4038        border: none !important;
     4039        box-shadow: none !important;
     4040        height: 1em !important;
     4041        width: 1em !important;
     4042        margin: 0 .05em 0 .1em !important;
     4043        vertical-align: -0.1em !important;
     4044        background: none !important;
     4045        padding: 0 !important;
     4046}
     4047</style>
     4048<?php
     4049}
     4050
     4051/**
     4052 * Convert any 4 byte emoji in a string to their equivalent HTML entity.
     4053 * Currently, only Unicode 7 emoji are supported. Unicode 8 emoji will be added
     4054 * when the spec in finalised, along with the new skin-tone modifiers.
     4055 *
     4056 * This allows us to store emoji in a DB using the utf8 character set.
     4057 *
     4058 * @since 4.2.0
     4059 *
     4060 * @param string $content The content to encode.
     4061 * @return string The encoded content.
     4062 */
     4063function wp_encode_emoji( $content ) {
     4064        if ( function_exists( 'mb_convert_encoding' ) ) {
     4065                $regex = '/(
     4066                     \x23\xE2\x83\xA3               # Digits
     4067                     [\x30-\x39]\xE2\x83\xA3
     4068                   | \xF0\x9F[\x85-\x88][\xA6-\xBF] # Enclosed characters
     4069                   | \xF0\x9F[\x8C-\x97][\x80-\xBF] # Misc
     4070                   | \xF0\x9F\x98[\x80-\xBF]        # Smilies
     4071                   | \xF0\x9F\x99[\x80-\x8F]
     4072                   | \xF0\x9F\x9A[\x80-\xBF]        # Transport and map symbols
     4073                   | \xF0\x9F\x99[\x80-\x85]
     4074                )/x';
     4075
     4076                $matches = array();
     4077                if ( preg_match_all( $regex, $content, $matches ) ) {
     4078                        if ( ! empty( $matches[1] ) ) {
     4079                                foreach( $matches[1] as $emoji ) {
     4080                                        /*
     4081                                         * UTF-32's hex encoding is the same as HTML's hex encoding.
     4082                                         * So, by converting the emoji from UTF-8 to UTF-32, we magically
     4083                                         * get the correct hex encoding.
     4084                                         */
     4085                                        $unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
     4086                                        if ( isset( $unpacked[1] ) ) {
     4087                                                $entity = '&#x' . trim( $unpacked[1], '0' ) . ';';
     4088                                                $content = str_replace( $emoji, $entity, $content );
     4089                                        }
     4090                                }
     4091                        }
     4092                }
     4093        }
     4094
     4095        return $content;
     4096}
     4097
     4098/**
     4099 * Convert emoji to a static <img> link.
     4100 *
     4101 * @since 4.2.0
     4102 *
     4103 * @param string $content The content to encode.
     4104 * @return string The encoded content.
     4105 */
     4106function wp_staticize_emoji( $content ) {
     4107        $content = wp_encode_emoji( $content );
     4108
     4109        if ( ! class_exists( 'DOMDocument' ) ) {
     4110                return $content;
     4111        }
     4112
     4113        /** This filter is documented in wp-includes/script-loader.php */
     4114        $cdn_url = apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' );
     4115        /** This filter is documented in wp-includes/script-loader.php */
     4116        $ext = apply_filters( 'emoji_ext', '.png' );
     4117
     4118        $html = '<!DOCTYPE html><html><head></head><body>' . $content . '</body></html>';
     4119
     4120        $document = new DOMDocument;
     4121        if ( ! $document->loadHTML( $html ) ) {
     4122                return $content;
     4123        }
     4124
     4125        $xpath = new DOMXPath( $document );
     4126        $textnodes = $xpath->query( '//text()' );
     4127
     4128        foreach( $textnodes as $node ) {
     4129                $originalText = $text = wp_encode_emoji( $node->nodeValue );
     4130
     4131                $matches = array();
     4132                if ( preg_match_all( '/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $text, $matches ) ) {
     4133                        if ( ! empty( $matches[0] ) ) {
     4134                                foreach ( $matches[0] as $flag ) {
     4135                                        $chars = str_replace( array( '&#x', ';'), '', $flag );
     4136
     4137                                        list( $char1, $char2 ) = str_split( $chars, 5 );
     4138                                        $entity = '<img src="https:' . $cdn_url . $char1 . '-' . $char2 . $ext . '" class="wp-smiley" style="height: 1em;" />';
     4139
     4140                                        $text = str_replace( $flag, $entity, $text );
     4141                                }
     4142                        }
     4143                }
     4144
     4145                // Loosely match the Emoji Unicode range.
     4146                $regex = '/(&#x[2-3][0-9a-f]{3};|&#x1f[1-6][0-9a-f]{2};)/';
     4147
     4148                $matches = array();
     4149                if ( preg_match_all( $regex, $text, $matches ) ) {
     4150                        if ( ! empty( $matches[1] ) ) {
     4151                                foreach ( $matches[1] as $emoji ) {
     4152                                        $char = str_replace( array( '&#x', ';'), '', $emoji );
     4153                                        $entity = '<img src="https:' . $cdn_url . $char . $ext . '" class="wp-smiley" style="height: 1em;" />';
     4154
     4155                                        $text = str_replace( $emoji, $entity, $text );
     4156                                }
     4157                        }
     4158                }
     4159
     4160                if ( $originalText !== $text ) {
     4161                        $content = str_replace( $originalText, $text, $content );
     4162                }
     4163        }
     4164
     4165        return $content;
     4166}
     4167
     4168/**
     4169 * Convert emoji in emails into static images.
     4170 *
     4171 * @param array $mail The email data array.
     4172 *
     4173 * @return array The email data array, with emoji in the message staticized.
     4174 */
     4175function mail_emoji( $mail ) {
     4176        $mail['message'] = wp_staticize_emoji( $mail['message'], true );
     4177        return $mail;
     4178}
  • trunk/src/wp-includes/functions.php

    r31590 r31733  
    29462946        if ( !isset( $wpsmiliestrans ) ) {
    29472947                $wpsmiliestrans = array(
    2948                 ':mrgreen:' => 'icon_mrgreen.gif',
    2949                 ':neutral:' => 'icon_neutral.gif',
    2950                 ':twisted:' => 'icon_twisted.gif',
    2951                   ':arrow:' => 'icon_arrow.gif',
    2952                   ':shock:' => 'icon_eek.gif',
    2953                   ':smile:' => 'icon_smile.gif',
    2954                     ':???:' => 'icon_confused.gif',
    2955                    ':cool:' => 'icon_cool.gif',
    2956                    ':evil:' => 'icon_evil.gif',
    2957                    ':grin:' => 'icon_biggrin.gif',
    2958                    ':idea:' => 'icon_idea.gif',
    2959                    ':oops:' => 'icon_redface.gif',
    2960                    ':razz:' => 'icon_razz.gif',
    2961                    ':roll:' => 'icon_rolleyes.gif',
    2962                    ':wink:' => 'icon_wink.gif',
    2963                     ':cry:' => 'icon_cry.gif',
    2964                     ':eek:' => 'icon_surprised.gif',
    2965                     ':lol:' => 'icon_lol.gif',
    2966                     ':mad:' => 'icon_mad.gif',
    2967                     ':sad:' => 'icon_sad.gif',
    2968                       '8-)' => 'icon_cool.gif',
    2969                       '8-O' => 'icon_eek.gif',
    2970                       ':-(' => 'icon_sad.gif',
    2971                       ':-)' => 'icon_smile.gif',
    2972                       ':-?' => 'icon_confused.gif',
    2973                       ':-D' => 'icon_biggrin.gif',
    2974                       ':-P' => 'icon_razz.gif',
    2975                       ':-o' => 'icon_surprised.gif',
    2976                       ':-x' => 'icon_mad.gif',
    2977                       ':-|' => 'icon_neutral.gif',
    2978                       ';-)' => 'icon_wink.gif',
     2948                ':mrgreen:' => 'mrgreen.png',
     2949                ':neutral:' => "\xf0\x9f\x98\x90",
     2950                ':twisted:' => "\xf0\x9f\x98\x88",
     2951                  ':arrow:' => "\xe2\x9e\xa1",
     2952                  ':shock:' => "\xf0\x9f\x98\xaf",
     2953                  ':smile:' => 'simple-smile.png',
     2954                    ':???:' => "\xf0\x9f\x98\xaf",
     2955                   ':cool:' => "\xf0\x9f\x98\x8e",
     2956                   ':evil:' => "\xf0\x9f\x91\xbf",
     2957                   ':grin:' => "\xf0\x9f\x98\x84",
     2958                   ':idea:' => "\xf0\x9f\x92\xa1",
     2959                   ':oops:' => "\xf0\x9f\x98\xb3",
     2960                   ':razz:' => "\xf0\x9f\x98\x9b",
     2961                   ':roll:' => 'rolleyes.png',
     2962                   ':wink:' => "\xf0\x9f\x98\x89",
     2963                    ':cry:' => "\xf0\x9f\x98\xa5",
     2964                    ':eek:' => "\xf0\x9f\x98\xaf",
     2965                    ':lol:' => "\xf0\x9f\x98\x84",
     2966                    ':mad:' => "\xf0\x9f\x98\xa1",
     2967                    ':sad:' => "\xf0\x9f\x98\xa6",
     2968                      '8-)' => "\xf0\x9f\x98\x8e",
     2969                      '8-O' => "\xf0\x9f\x98\xaf",
     2970                      ':-(' => "\xf0\x9f\x98\xa6",
     2971                      ':-)' => 'simple-smile.png',
     2972                      ':-?' => "\xf0\x9f\x98\xaf",
     2973                      ':-D' => "\xf0\x9f\x98\x84",
     2974                      ':-P' => "\xf0\x9f\x98\x9b",
     2975                      ':-o' => "\xf0\x9f\x98\xaf",
     2976                      ':-x' => "\xf0\x9f\x98\xa1",
     2977                      ':-|' => "\xf0\x9f\x98\x90",
     2978                      ';-)' => "\xf0\x9f\x98\x89",
    29792979                // This one transformation breaks regular text with frequency.
    2980                 //     '8)' => 'icon_cool.gif',
    2981                        '8O' => 'icon_eek.gif',
    2982                        ':(' => 'icon_sad.gif',
    2983                        ':)' => 'icon_smile.gif',
    2984                        ':?' => 'icon_confused.gif',
    2985                        ':D' => 'icon_biggrin.gif',
    2986                        ':P' => 'icon_razz.gif',
    2987                        ':o' => 'icon_surprised.gif',
    2988                        ':x' => 'icon_mad.gif',
    2989                        ':|' => 'icon_neutral.gif',
    2990                        ';)' => 'icon_wink.gif',
    2991                       ':!:' => 'icon_exclaim.gif',
    2992                       ':?:' => 'icon_question.gif',
     2980                //     '8)' => "\xf0\x9f\x98\x8e",
     2981                       '8O' => "\xf0\x9f\x98\xaf",
     2982                       ':(' => "\xf0\x9f\x98\xa6",
     2983                       ':)' => 'simple-smile.png',
     2984                       ':?' => "\xf0\x9f\x98\xaf",
     2985                       ':D' => "\xf0\x9f\x98\x84",
     2986                       ':P' => "\xf0\x9f\x98\x9b",
     2987                       ':o' => "\xf0\x9f\x98\xaf",
     2988                       ':x' => "\xf0\x9f\x98\xa1",
     2989                       ':|' => "\xf0\x9f\x98\x90",
     2990                       ';)' => "\xf0\x9f\x98\x89",
     2991                      ':!:' => "\xe2\x9d\x97",
     2992                      ':?:' => "\xe2\x9d\x93",
    29932993                );
    29942994        }
  • trunk/src/wp-includes/post.php

    r31660 r31733  
    33303330        $data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' );
    33313331
     3332        $emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
     3333
     3334        foreach( $emoji_fields as $emoji_field ) {
     3335                if ( isset( $data[ $emoji_field ] ) ) {
     3336                        $charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
     3337                        if ( 'utf8' === $charset ) {
     3338                                $data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] );
     3339                        }
     3340                }
     3341        }
     3342
    33323343        if ( 'attachment' === $post_type ) {
    33333344                /**
  • trunk/src/wp-includes/script-loader.php

    r31723 r31733  
    425425        $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models', 'media-audiovideo', 'wp-playlist' ), false, 1 );
    426426
     427        $scripts->add( 'twemoji', "/wp-includes/js/twemoji$suffix.js", array(), false, 1 );
     428        $scripts->add( 'emoji', "/wp-includes/js/emoji$suffix.js", array( 'twemoji' ), false, 1 );
     429        did_action( 'init' ) && $scripts->localize( 'emoji', 'EmojiSettings', array(
     430                /**
     431                 * Filter the URL where emoji images are hosted.
     432                 *
     433                 * @since 4.2.0
     434                 *
     435                 * @param string The emoji base URL.
     436                 */
     437                'base_url' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' ),
     438                /**
     439                 * Filter the extension of the emoji files.
     440                 *
     441                 * @since 4.2.0
     442                 *
     443                 * @param string The emoji extension.
     444                 */
     445                'ext'      => apply_filters( 'emoji_ext', '.png' ),
     446        ) );
     447        $scripts->enqueue( 'emoji' );
     448
    427449        if ( is_admin() ) {
    428450                $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), false, 1 );
  • trunk/tests/phpunit/tests/dependencies/styles.php

    r31031 r31733  
    1313                $this->old_wp_styles = $GLOBALS['wp_styles'];
    1414                remove_action( 'wp_default_styles', 'wp_default_styles' );
     15                remove_action( 'wp_print_styles', 'print_emoji_styles' );
    1516                $GLOBALS['wp_styles'] = new WP_Styles();
    1617                $GLOBALS['wp_styles']->default_version = get_bloginfo( 'version' );
    … …  
    2021                $GLOBALS['wp_styles'] = $this->old_wp_styles;
    2122                add_action( 'wp_default_styles', 'wp_default_styles' );
     23                add_action( 'wp_print_styles', 'print_emoji_styles' );
    2224                parent::tearDown();
    2325        }
  • trunk/tests/phpunit/tests/formatting/Smilies.php

    r28717 r31733  
    1717                        array (
    1818                                'Lorem ipsum dolor sit amet mauris ;-) Praesent gravida sodales. :lol: Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, :eek: mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, :mrgreen: tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus :?:',
    19                                 'Lorem ipsum dolor sit amet mauris <img src="' . $includes_path . 'icon_wink.gif" alt=";-)" class="wp-smiley" /> Praesent gravida sodales. <img src="' . $includes_path . 'icon_lol.gif" alt=":lol:" class="wp-smiley" /> Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, <img src="' . $includes_path . 'icon_surprised.gif" alt=":eek:" class="wp-smiley" /> mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, <img src="' . $includes_path . 'icon_mrgreen.gif" alt=":mrgreen:" class="wp-smiley" /> tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus <img src="' . $includes_path . 'icon_question.gif" alt=":?:" class="wp-smiley" />'
     19                                "Lorem ipsum dolor sit amet mauris \xf0\x9f\x98\x89 Praesent gravida sodales. \xf0\x9f\x98\x84 Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, \xf0\x9f\x98\xaf mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, <img src=\"${includes_path}mrgreen.png\" alt=\":mrgreen:\" class=\"wp-smiley\" /> tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus \xe2\x9d\x93"
    2020                        ),
    2121                        array (
    2222                                '<strong>Welcome to the jungle!</strong> We got fun n games! :) We got everything you want 8-) <em>Honey we know the names :)</em>',
    23                                 '<strong>Welcome to the jungle!</strong> We got fun n games! <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> We got everything you want <img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <em>Honey we know the names <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /></em>'
     23                                "<strong>Welcome to the jungle!</strong> We got fun n games! <img src=\"${includes_path}simple-smile.png\" alt=\":)\" class=\"wp-smiley\" /> We got everything you want \xf0\x9f\x98\x8e <em>Honey we know the names <img src=\"${includes_path}simple-smile.png\" alt=\":)\" class=\"wp-smiley\" /></em>"
    2424                        ),
    2525                        array (
    2626                                "<strong;)>a little bit of this\na little bit:other: of that :D\n:D a little bit of good\nyeah with a little bit of bad8O",
    27                                 "<strong;)>a little bit of this\na little bit:other: of that <img src=\"{$includes_path}icon_biggrin.gif\" alt=\":D\" class=\"wp-smiley\" />\n<img src=\"{$includes_path}icon_biggrin.gif\" alt=\":D\" class=\"wp-smiley\" /> a little bit of good\nyeah with a little bit of bad8O"
     27                                "<strong;)>a little bit of this\na little bit:other: of that \xf0\x9f\x98\x84\n\xf0\x9f\x98\x84 a little bit of good\nyeah with a little bit of bad8O"
    2828                        ),
    2929                        array (
    … …  
    148148
    149149                $in_str = 'Do we ingore smilies ;-) in ' . $element . ' tags <' . $element . '>My Content Here :?: </' . $element . '>';
    150                 $exp_str = 'Do we ingore smilies <img src="' . $includes_path . 'icon_wink.gif" alt=";-)" class="wp-smiley" /> in ' . $element . ' tags <' . $element . '>My Content Here :?: </' . $element . '>';
     150                $exp_str = "Do we ingore smilies \xf0\x9f\x98\x89 in $element tags <$element>My Content Here :?: </$element>";
    151151
    152152                // standard smilies, use_smilies: ON
    … …  
    170170                        array (
    171171                                '8-O :-(',
    172                                 '<img src="' . $includes_path . 'icon_eek.gif" alt="8-O" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":-(" class="wp-smiley" />'
     172                                "\xf0\x9f\x98\xaf \xf0\x9f\x98\xa6"
    173173                        ),
    174174                        array (
    175175                                '8-) 8-O',
    176                                 '<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_eek.gif" alt="8-O" class="wp-smiley" />'
     176                                "\xf0\x9f\x98\x8e \xf0\x9f\x98\xaf"
    177177                        ),
    178178                        array (
    179179                                '8-) 8O',
    180                                 '<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_eek.gif" alt="8O" class="wp-smiley" />'
     180                                "\xf0\x9f\x98\x8e \xf0\x9f\x98\xaf"
    181181                        ),
    182182                        array (
    183183                                '8-) :-(',
    184                                 '<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":-(" class="wp-smiley" />'
     184                                "\xf0\x9f\x98\x8e \xf0\x9f\x98\xa6"
    185185                        ),
    186186                        array (
    187187                                '8-) :twisted:',
    188                                 '<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_twisted.gif" alt=":twisted:" class="wp-smiley" />'
     188                                "\xf0\x9f\x98\x8e \xf0\x9f\x98\x88"
    189189                        ),
    190190                        array (
    191191                                '8O :twisted: :( :? :(',
    192                                 '<img src="' . $includes_path . 'icon_eek.gif" alt="8O" class="wp-smiley" /> <img src="' . $includes_path . 'icon_twisted.gif" alt=":twisted:" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":(" class="wp-smiley" /> <img src="' . $includes_path . 'icon_confused.gif" alt=":?" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":(" class="wp-smiley" />'
     192                                "\xf0\x9f\x98\xaf \xf0\x9f\x98\x88 \xf0\x9f\x98\xa6 \xf0\x9f\x98\xaf \xf0\x9f\x98\xa6"
    193193                        ),
    194194                );
    … …  
    229229                        array (
    230230                                '8O :) additional text here :)',
    231                                 '8O <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> additional text here <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" />'
     231                                '8O <img src="' . $includes_path . 'simple-smile.png" alt=":)" class="wp-smiley" /> additional text here <img src="' . $includes_path . 'simple-smile.png" alt=":)" class="wp-smiley" />'
    232232                        ),
    233233                        array (
    234234                                ':) :) :) :)',
    235                                 '<img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" />'
     235                                '<img src="' . $includes_path . 'simple-smile.png" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'simple-smile.png" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'simple-smile.png" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'simple-smile.png" alt=":)" class="wp-smiley" />'
    236236                        ),
    237237                );
    … …  
    258258
    259259                $wpsmiliestrans = array (
    260                   ':)' => 'icon_smile.gif'
     260                  ':)' => 'simple-smile.png'
    261261                );
    262262
    … …  
    295295                $output[] = array('test <img ', 'alt=":)"', ' /> smile');
    296296
    297                 $input[]  = 'My test ;) smile';
    298                 $output[] = array('test <img ', 'alt=";)"', ' /> smile');
    299 
    300297                $input[]  = 'My test &nbsp;:)&nbsp;smile';
    301298                $output[] = array('test &nbsp;<img ', 'alt=":)"', ' />&nbsp;smile');
    302299
    303                 $input[]  = 'My test &nbsp;;)&nbsp;smile';
    304                 $output[] = array('test &nbsp;<img ', 'alt=";)"', ' />&nbsp;smile');
    305 
    306300                $input[]  = "My test {$nbsp}:){$nbsp}smile";
    307301                $output[] = array("test {$nbsp}<img ", 'alt=":)"', " />{$nbsp}smile");
    308 
    309                 $input[]  = "My test {$nbsp};){$nbsp}smile";
    310                 $output[] = array("test {$nbsp}<img ", 'alt=";)"', " />{$nbsp}smile");
    311302
    312303                foreach($input as $key => $in) {
Note: See TracChangeset for help on using the changeset viewer.