<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31734] trunk: Add emoji URL support, and Twemoji fallback for displaying slugs in wp-admin, when the browser doesn't natively support emoji.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31734">31734</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31734","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>pento</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-03-11 22:54:49 +0000 (Wed, 11 Mar 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>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 <a href="https://core.trac.wordpress.org/ticket/31328">#31328</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsinlineeditpostjs">trunk/src/wp-admin/js/inline-edit-post.js</a></li>
<li><a href="#trunksrcwpadminjsinlineedittaxjs">trunk/src/wp-admin/js/inline-edit-tax.js</a></li>
<li><a href="#trunksrcwpadminjspostjs">trunk/src/wp-admin/js/post.js</a></li>
<li><a href="#trunksrcwpadminjstagsjs">trunk/src/wp-admin/js/tags.js</a></li>
<li><a href="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
<li><a href="#trunksrcwpincludestaxonomyphp">trunk/src/wp-includes/taxonomy.php</a></li>
<li><a href="#trunktestsphpunitdataformattingutf8entitizedtxt">trunk/tests/phpunit/data/formatting/utf-8/entitized.txt</a></li>
<li><a href="#trunktestsphpunitdataformattingutf8uurlencodedtxt">trunk/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt</a></li>
<li><a href="#trunktestsphpunitdataformattingutf8urlencodedtxt">trunk/tests/phpunit/data/formatting/utf-8/urlencoded.txt</a></li>
<li><a href="#trunktestsphpunitdataformattingutf8utf8txt">trunk/tests/phpunit/data/formatting/utf-8/utf-8.txt</a></li>
<li><a href="#trunktestsphpunittestsformattingUrlEncodedToEntitiesphp">trunk/tests/phpunit/tests/formatting/UrlEncodedToEntities.php</a></li>
<li><a href="#trunktestsphpunitteststermphp">trunk/tests/phpunit/tests/term.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsinlineeditpostjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/inline-edit-post.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/inline-edit-post.js 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/src/wp-admin/js/inline-edit-post.js 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -117,7 +117,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> edit : function(id) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f, val;
</ins><span class="cx" style="display: block; padding: 0 10px"> t.revert();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( typeof(id) === 'object' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -155,7 +155,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> for ( f = 0; f < fields.length; f++ ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ val = $('.'+fields[f], rowData);
+ // Deal with Twemoji
+ val.find( 'img' ).replaceWith( function() { return this.alt; } );
+ val = val.text();
+ $(':input[name="' + fields[f] + '"]', editRow).val( val );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $( '.comment_status', rowData ).text() === 'open' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,11 +185,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> //flat taxonomies
</span><span class="cx" style="display: block; padding: 0 10px"> $('.tags_input', rowData).each(function(){
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var terms = $(this).text(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var terms = $(this),
</ins><span class="cx" style="display: block; padding: 0 10px"> taxname = $(this).attr('id').replace('_' + id, ''),
</span><span class="cx" style="display: block; padding: 0 10px"> textarea = $('textarea.tax_input_' + taxname, editRow),
</span><span class="cx" style="display: block; padding: 0 10px"> comma = inlineEditL10n.comma;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ terms.find( 'img' ).replaceWith( function() { return this.alt; } );
+ terms = terms.text();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( terms ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ',' !== comma ) {
</span><span class="cx" style="display: block; padding: 0 10px"> terms = terms.replace(/,/g, comma);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -265,6 +272,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( -1 !== r.indexOf( '<tr' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove();
</span><span class="cx" style="display: block; padding: 0 10px"> $('#edit-'+id).before(r).remove();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( WPEmoji ) {
+ WPEmoji.parse( $( inlineEditPost.what + id ).get( 0 ) );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> $(inlineEditPost.what+id).hide().fadeIn();
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> r = r.replace( /<.[^<>]*?>/g, '' );
</span></span></pre></div>
<a id="trunksrcwpadminjsinlineedittaxjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/inline-edit-tax.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/inline-edit-tax.js 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/src/wp-admin/js/inline-edit-tax.js 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,7 +45,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> edit : function(id) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var editRow, rowData,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var editRow, rowData, val,
</ins><span class="cx" style="display: block; padding: 0 10px"> t = this;
</span><span class="cx" style="display: block; padding: 0 10px"> t.revert();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,9 +58,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $(t.what+id).hide().before(editRow).before('<tr class="hidden"></tr>');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $(':input[name="name"]', editRow).val( $('.name', rowData).text() );
- $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ val = $('.name', rowData);
+ val.find( 'img' ).replaceWith( function() { return this.alt; } );
+ val = val.text();
+ $(':input[name="name"]', editRow).val( val );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ val = $('.slug', rowData);
+ val.find( 'img' ).replaceWith( function() { return this.alt; } );
+ val = val.text();
+ $(':input[name="slug"]', editRow).val( val );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
</span><span class="cx" style="display: block; padding: 0 10px"> $('.ptitle', editRow).eq(0).focus();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -110,6 +117,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Update the value in the Parent dropdown.
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( WPEmoji ) {
+ WPEmoji.parse( row.get( 0 ) );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> row.hide().fadeIn();
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $('#edit-'+id+' .inline-edit-save .error').html(r).show();
</span></span></pre></div>
<a id="trunksrcwpadminjspostjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/post.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/post.js 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/src/wp-admin/js/post.js 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -712,8 +712,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> revert_slug = real_slug.val(),
</span><span class="cx" style="display: block; padding: 0 10px"> b = $('#edit-slug-buttons'),
</span><span class="cx" style="display: block; padding: 0 10px"> revert_b = b.html(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- full = $('#editable-post-name-full').html();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ full = $('#editable-post-name-full');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Deal with Twemoji in the post-name
+ full.find( 'img' ).replaceWith( function() { return this.alt; } );
+ full = full.html();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $('#view-post-btn').hide();
</span><span class="cx" style="display: block; padding: 0 10px"> b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
</span><span class="cx" style="display: block; padding: 0 10px"> b.children('.save').click(function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -736,6 +740,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box.removeClass('hidden');
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( WPEmoji ) {
+ WPEmoji.parse( box.get( 0 ) );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> b.html(revert_b);
</span><span class="cx" style="display: block; padding: 0 10px"> real_slug.val(new_slug);
</span><span class="cx" style="display: block; padding: 0 10px"> $('#view-post-btn').show();
</span></span></pre></div>
<a id="trunksrcwpadminjstagsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/tags.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/tags.js 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/src/wp-admin/js/tags.js 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,6 +49,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> else
</span><span class="cx" style="display: block; padding: 0 10px"> $( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( WPEmoji ) {
+ WPEmoji.parse( $( '.tags' ).get( 0 ) );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $('.tags .no-items').remove();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( form.find('select#parent') ) {
</span></span></pre></div>
<a id="trunksrcwpincludesformattingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/formatting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/formatting.php 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/src/wp-includes/formatting.php 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -785,21 +785,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $unicode .= chr($value);
</span><span class="cx" style="display: block; padding: 0 10px"> $unicode_length++;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( count( $values ) == 0 ) {
+ if ( $value < 224 ) {
+ $num_octets = 2;
+ } elseif ( $value < 240 ) {
+ $num_octets = 3;
+ } else {
+ $num_octets = 4;
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $values[] = $value;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( count( $values ) == $num_octets ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for ( $j = 0; $j < $num_octets; $j++ ) {
+ $unicode .= '%' . dechex( $values[ $j ] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $unicode_length += $num_octets * 3;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $values = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $num_octets = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludestaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/taxonomy.php 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/src/wp-includes/taxonomy.php 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2879,13 +2879,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $slug_provided = ! empty( $args['slug'] );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $slug_provided ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_name = trim( $name );
- $existing_term = get_term_by( 'name', $_name, $taxonomy );
- if ( $existing_term ) {
- $slug = $existing_term->slug;
- } else {
- $slug = sanitize_title( $name );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $slug = sanitize_title( $name );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $slug = $args['slug'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2910,20 +2904,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Terms with duplicate names are not allowed at the same level of a taxonomy hierarchy.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $exists = term_exists( $slug, $taxonomy ) ) {
- $existing_term = get_term( $exists['term_id'], $taxonomy );
-
- if ( $name === $existing_term->name ) {
-
- if ( is_taxonomy_hierarchical( $taxonomy ) ) {
- $siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) );
- if ( in_array( $name, $siblings ) ) {
- return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists with this parent.' ), $exists['term_id'] );
- }
-
- } else {
- return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists in this taxonomy.' ), $exists['term_id'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $existing_term = get_term_by( 'name', $name, $taxonomy ) ) {
+ if ( is_taxonomy_hierarchical( $taxonomy ) ) {
+ $siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) );
+ if ( in_array( $name, $siblings ) ) {
+ return new WP_Error( 'term_exists', __( 'A term with the name already exists with this parent.' ), $existing_term->term_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return new WP_Error( 'term_exists', __( 'A term with the name already exists in this taxonomy.' ), $existing_term->term_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunitdataformattingutf8entitizedtxt"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/formatting/utf-8/entitized.txt</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/formatting/utf-8/entitized.txt 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/tests/phpunit/data/formatting/utf-8/entitized.txt 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,4 +2,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> François Truffaut
</span><span class="cx" style="display: block; padding: 0 10px"> საქართველო
</span><span class="cx" style="display: block; padding: 0 10px"> Björk Guðmundsdóttir
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-宮崎 駿
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+宮崎 駿
+👍
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsphpunitdataformattingutf8uurlencodedtxt"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,6 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-%u7AE0%u5B50%u6021
-%u0046%u0072%u0061%u006E%u00E7%u006F%u0069%u0073%u0020%u0054%u0072%u0075%u0066%u0066%u0061%u0075%u0074
-%u10E1%u10D0%u10E5%u10D0%u10E0%u10D7%u10D5%u10D4%u10DA%u10DD
-%u0042%u006A%u00F6%u0072%u006B%u0020%u0047%u0075%u00F0%u006D%u0075%u006E%u0064%u0073%u0064%u00F3%u0074%u0074%u0069%u0072
-%u5BAE%u5D0E%u3000%u99FF
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+%u7AE0%u5B50%u6021
+%u0046%u0072%u0061%u006E%u00E7%u006F%u0069%u0073%u0020%u0054%u0072%u0075%u0066%u0066%u0061%u0075%u0074
+%u10E1%u10D0%u10E5%u10D0%u10E0%u10D7%u10D5%u10D4%u10DA%u10DD
+%u0042%u006A%u00F6%u0072%u006B%u0020%u0047%u0075%u00F0%u006D%u0075%u006E%u0064%u0073%u0064%u00F3%u0074%u0074%u0069%u0072
+%u5BAE%u5D0E%u3000%u99FF
+%u1F44D
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsphpunitdataformattingutf8urlencodedtxt"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/formatting/utf-8/urlencoded.txt</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/formatting/utf-8/urlencoded.txt 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/tests/phpunit/data/formatting/utf-8/urlencoded.txt 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,6 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-%e7%ab%a0%e5%ad%90%e6%80%a1
-Fran%c3%a7ois Truffaut
-%e1%83%a1%e1%83%90%e1%83%a5%e1%83%90%e1%83%a0%e1%83%97%e1%83%95%e1%83%94%e1%83%9a%e1%83%9d
-Bj%c3%b6rk Gu%c3%b0mundsd%c3%b3ttir
-%e5%ae%ae%e5%b4%8e%e3%80%80%e9%a7%bf
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+%e7%ab%a0%e5%ad%90%e6%80%a1
+Fran%c3%a7ois Truffaut
+%e1%83%a1%e1%83%90%e1%83%a5%e1%83%90%e1%83%a0%e1%83%97%e1%83%95%e1%83%94%e1%83%9a%e1%83%9d
+Bj%c3%b6rk Gu%c3%b0mundsd%c3%b3ttir
+%e5%ae%ae%e5%b4%8e%e3%80%80%e9%a7%bf
+%f0%9f%91%8d
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsphpunitdataformattingutf8utf8txt"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/formatting/utf-8/utf-8.txt</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/formatting/utf-8/utf-8.txt 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/tests/phpunit/data/formatting/utf-8/utf-8.txt 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,3 +3,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> საქართველო
</span><span class="cx" style="display: block; padding: 0 10px"> Björk Guðmundsdóttir
</span><span class="cx" style="display: block; padding: 0 10px"> 宮崎 駿
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+👍
</ins></span></pre></div>
<a id="trunktestsphpunittestsformattingUrlEncodedToEntitiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/formatting/UrlEncodedToEntities.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/formatting/UrlEncodedToEntities.php 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/tests/phpunit/tests/formatting/UrlEncodedToEntities.php 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,7 +8,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @dataProvider data
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_convert_urlencoded_to_entities( $u_urlencoded, $entity ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( $entity, preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $u_urlencoded ), $entity );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( $entity, preg_replace_callback('/\%u([0-9A-F]{4,5})/', '_convert_urlencoded_to_entities', $u_urlencoded ), $entity );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function data() {
</span></span></pre></div>
<a id="trunktestsphpunitteststermphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/term.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/term.php 2015-03-11 22:48:16 UTC (rev 31733)
+++ trunk/tests/phpunit/tests/term.php 2015-03-11 22:54:49 UTC (rev 31734)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,8 +174,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Test existing term name with unique slug
</span><span class="cx" style="display: block; padding: 0 10px"> $term1 = $this->factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertFalse( is_wp_error( $term1 ) );
- $this->assertTrue( empty($term1->errors ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertTrue( is_wp_error( $term1 ) );
+ $this->assertSame( 'term_exists', $term1->get_error_code() );
+ $this->assertEquals( $term->term_id, $term1->get_error_data() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Test an existing term name
</span><span class="cx" style="display: block; padding: 0 10px"> $term2 = $this->factory->tag->create( array( 'name' => 'Bozo' ) );
</span></span></pre>
</div>
</div>
</body>
</html>