Make WordPress Core


Ignore:
Timestamp:
03/11/2015 10:48:16 PM (9 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        /**
Note: See TracChangeset for help on using the changeset viewer.