Changeset 41702
- Timestamp:
- 10/03/2017 09:56:45 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r41701 r41702 5114 5114 5115 5115 foreach ( $emoji as $emojum ) { 5116 $emoji_char = html_entity_decode( $emojum ); 5116 if ( version_compare( phpversion(), '5.4', '<' ) ) { 5117 $emoji_char = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' ); 5118 } else { 5119 $emoji_char = html_entity_decode( $emojum ); 5120 } 5117 5121 if ( false !== strpos( $content, $emoji_char ) ) { 5118 5122 $content = preg_replace( "/$emoji_char/", $emojum, $content ); … … 5152 5156 foreach( $emoji as $emojum ) { 5153 5157 if ( false !== strpos( $text, $emojum ) ) { 5154 $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); 5158 if ( version_compare( phpversion(), '5.4', '<' ) ) { 5159 $possible_emoji[ $emojum ] = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' ); 5160 } else { 5161 $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); 5162 } 5155 5163 } 5156 5164 } -
trunk/tests/phpunit/tests/formatting/Emoji.php
r41701 r41702 123 123 // Simple emoji 124 124 '🙂', 125 '<img src="' . $this->png_cdn . '1f642.png" alt=" " class="wp-smiley" style="height: 1em; max-height: 1em;" />',125 '<img src="' . $this->png_cdn . '1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" />', 126 126 ), 127 127 array( 128 128 // Skin tone, gender, ZWJ, emoji selector 129 129 '👮🏼♀️', 130 '<img src="' . $this->png_cdn . '1f46e-1f3fc-200d-2640-fe0f.png" alt=" " class="wp-smiley" style="height: 1em; max-height: 1em;" />',130 '<img src="' . $this->png_cdn . '1f46e-1f3fc-200d-2640-fe0f.png" alt="👮🏼♀️" class="wp-smiley" style="height: 1em; max-height: 1em;" />', 131 131 ), 132 132 array( 133 133 // Unicode 10 134 134 '🧚', 135 '<img src="' . $this->png_cdn . '1f9da.png" alt=" " class="wp-smiley" style="height: 1em; max-height: 1em;" />',135 '<img src="' . $this->png_cdn . '1f9da.png" alt="🧚" class="wp-smiley" style="height: 1em; max-height: 1em;" />', 136 136 ), 137 137 ); 138 139 // Older versions of PHP don't html_entity_decode() emoji, so we need to make sure they're testing in the expected form.140 foreach ( $data as $key => $datum ) {141 $emoji = html_entity_decode( wp_encode_emoji( $datum[0] ) );142 $data[ $key ][1] = str_replace( 'alt=""', 'alt="' . $emoji . '"', $datum[1] );143 }144 138 145 139 return $data;
Note: See TracChangeset
for help on using the changeset viewer.