mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Add emoji URL support, and Twemoji fallback for displaying slugs in wp-admin, when the browser doesn't natively support emoji.
Props pento, SergeyBiryukov and boonebgorges. Fixes #31328 git-svn-id: https://develop.svn.wordpress.org/trunk@31734 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -785,21 +785,27 @@ function utf8_uri_encode( $utf8_string, $length = 0 ) {
|
||||
$unicode .= chr($value);
|
||||
$unicode_length++;
|
||||
} else {
|
||||
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
||||
if ( count( $values ) == 0 ) {
|
||||
if ( $value < 224 ) {
|
||||
$num_octets = 2;
|
||||
} elseif ( $value < 240 ) {
|
||||
$num_octets = 3;
|
||||
} else {
|
||||
$num_octets = 4;
|
||||
}
|
||||
}
|
||||
|
||||
$values[] = $value;
|
||||
|
||||
if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
|
||||
break;
|
||||
if ( count( $values ) == $num_octets ) {
|
||||
if ($num_octets == 3) {
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
|
||||
$unicode_length += 9;
|
||||
} else {
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
||||
$unicode_length += 6;
|
||||
for ( $j = 0; $j < $num_octets; $j++ ) {
|
||||
$unicode .= '%' . dechex( $values[ $j ] );
|
||||
}
|
||||
|
||||
$unicode_length += $num_octets * 3;
|
||||
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user