Make WordPress Core

Changeset 31924


Ignore:
Timestamp:
03/30/2015 03:08:28 AM (9 years ago)
Author:
pento
Message:

Emoji: When staticizing emoji into <img> tags, include an alt attribute of the original Emoji, to match both Smiley and Twemoji <img> tags.

File:
1 edited

Legend:

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

    r31909 r31924  
    42764276
    42774277                        list( $char1, $char2 ) = str_split( $chars, 5 );
    4278                         $entity = '<img src="' . $cdn_url . $char1 . '-' . $char2 . $ext . '" class="wp-smiley" style="height: 1em; max-height: 1em;" />';
     4278                        $entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char1 . '-' . $char2 . $ext, html_entity_decode( $flag ) );
    42794279
    42804280                        $content = str_replace( $flag, $entity, $content );
     
    42914291                    foreach ( $matches[1] as $emoji ) {
    42924292                        $char = str_replace( array( '&#x', ';'), '', $emoji );
    4293                         $entity = '<img src="' . $cdn_url . $char . $ext . '" class="wp-smiley" style="height: 1em; max-height: 1em;" />';
     4293                        $entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char . $ext, html_entity_decode( $emoji ) );
    42944294
    42954295                        $content = str_replace( $emoji, $entity, $content );
Note: See TracChangeset for help on using the changeset viewer.