Changeset 31734
- Timestamp:
- 03/11/2015 10:54:49 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/inline-edit-post.js
r31690 r31734 118 118 119 119 edit : function(id) { 120 var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f ;120 var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f, val; 121 121 t.revert(); 122 122 … … 156 156 157 157 for ( f = 0; f < fields.length; f++ ) { 158 $(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() ); 158 val = $('.'+fields[f], rowData); 159 // Deal with Twemoji 160 val.find( 'img' ).replaceWith( function() { return this.alt; } ); 161 val = val.text(); 162 $(':input[name="' + fields[f] + '"]', editRow).val( val ); 159 163 } 160 164 … … 182 186 //flat taxonomies 183 187 $('.tags_input', rowData).each(function(){ 184 var terms = $(this) .text(),188 var terms = $(this), 185 189 taxname = $(this).attr('id').replace('_' + id, ''), 186 190 textarea = $('textarea.tax_input_' + taxname, editRow), 187 191 comma = inlineEditL10n.comma; 192 193 terms.find( 'img' ).replaceWith( function() { return this.alt; } ); 194 terms = terms.text(); 188 195 189 196 if ( terms ) { … … 266 273 $(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove(); 267 274 $('#edit-'+id).before(r).remove(); 275 if ( WPEmoji ) { 276 WPEmoji.parse( $( inlineEditPost.what + id ).get( 0 ) ); 277 } 268 278 $(inlineEditPost.what+id).hide().fadeIn(); 269 279 } else { -
trunk/src/wp-admin/js/inline-edit-tax.js
r31288 r31734 46 46 47 47 edit : function(id) { 48 var editRow, rowData, 48 var editRow, rowData, val, 49 49 t = this; 50 50 t.revert(); … … 59 59 $(t.what+id).hide().before(editRow).before('<tr class="hidden"></tr>'); 60 60 61 $(':input[name="name"]', editRow).val( $('.name', rowData).text() ); 62 $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() ); 61 val = $('.name', rowData); 62 val.find( 'img' ).replaceWith( function() { return this.alt; } ); 63 val = val.text(); 64 $(':input[name="name"]', editRow).val( val ); 65 66 val = $('.slug', rowData); 67 val.find( 'img' ).replaceWith( function() { return this.alt; } ); 68 val = val.text(); 69 $(':input[name="slug"]', editRow).val( val ); 63 70 64 71 $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); … … 111 118 $( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() ); 112 119 120 if ( WPEmoji ) { 121 WPEmoji.parse( row.get( 0 ) ); 122 } 123 113 124 row.hide().fadeIn(); 114 125 } else { -
trunk/src/wp-admin/js/post.js
r31538 r31734 713 713 b = $('#edit-slug-buttons'), 714 714 revert_b = b.html(), 715 full = $('#editable-post-name-full').html(); 715 full = $('#editable-post-name-full'); 716 717 // Deal with Twemoji in the post-name 718 full.find( 'img' ).replaceWith( function() { return this.alt; } ); 719 full = full.html(); 716 720 717 721 $('#view-post-btn').hide(); … … 737 741 }); 738 742 } 743 744 if ( WPEmoji ) { 745 WPEmoji.parse( box.get( 0 ) ); 746 } 747 739 748 b.html(revert_b); 740 749 real_slug.val(new_slug); -
trunk/src/wp-admin/js/tags.js
r26198 r31734 50 50 $( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm 51 51 52 if ( WPEmoji ) { 53 WPEmoji.parse( $( '.tags' ).get( 0 ) ); 54 } 55 52 56 $('.tags .no-items').remove(); 53 57 -
trunk/src/wp-includes/formatting.php
r31733 r31734 786 786 $unicode_length++; 787 787 } else { 788 if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; 788 if ( count( $values ) == 0 ) { 789 if ( $value < 224 ) { 790 $num_octets = 2; 791 } elseif ( $value < 240 ) { 792 $num_octets = 3; 793 } else { 794 $num_octets = 4; 795 } 796 } 789 797 790 798 $values[] = $value; … … 793 801 break; 794 802 if ( count( $values ) == $num_octets ) { 795 if ($num_octets == 3) { 796 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); 797 $unicode_length += 9; 798 } else { 799 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); 800 $unicode_length += 6; 803 for ( $j = 0; $j < $num_octets; $j++ ) { 804 $unicode .= '%' . dechex( $values[ $j ] ); 801 805 } 806 807 $unicode_length += $num_octets * 3; 802 808 803 809 $values = array(); -
trunk/src/wp-includes/taxonomy.php
r31652 r31734 2880 2880 $slug_provided = ! empty( $args['slug'] ); 2881 2881 if ( ! $slug_provided ) { 2882 $_name = trim( $name ); 2883 $existing_term = get_term_by( 'name', $_name, $taxonomy ); 2884 if ( $existing_term ) { 2885 $slug = $existing_term->slug; 2886 } else { 2887 $slug = sanitize_title( $name ); 2888 } 2882 $slug = sanitize_title( $name ); 2889 2883 } else { 2890 2884 $slug = $args['slug']; … … 2911 2905 2912 2906 // Terms with duplicate names are not allowed at the same level of a taxonomy hierarchy. 2913 if ( $exists = term_exists( $slug, $taxonomy ) ) { 2914 $existing_term = get_term( $exists['term_id'], $taxonomy ); 2915 2916 if ( $name === $existing_term->name ) { 2917 2918 if ( is_taxonomy_hierarchical( $taxonomy ) ) { 2919 $siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) ); 2920 if ( in_array( $name, $siblings ) ) { 2921 return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists with this parent.' ), $exists['term_id'] ); 2922 } 2923 2924 } else { 2925 return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists in this taxonomy.' ), $exists['term_id'] ); 2907 if ( $existing_term = get_term_by( 'name', $name, $taxonomy ) ) { 2908 if ( is_taxonomy_hierarchical( $taxonomy ) ) { 2909 $siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) ); 2910 if ( in_array( $name, $siblings ) ) { 2911 return new WP_Error( 'term_exists', __( 'A term with the name already exists with this parent.' ), $existing_term->term_id ); 2926 2912 } 2913 } else { 2914 return new WP_Error( 'term_exists', __( 'A term with the name already exists in this taxonomy.' ), $existing_term->term_id ); 2927 2915 } 2928 2916 } -
trunk/tests/phpunit/data/formatting/utf-8/entitized.txt
r25002 r31734 4 4 Björk Guðmundsdóttir 5 5 宮崎 駿 6 👍 -
trunk/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt
r25002 r31734 4 4 %u0042%u006A%u00F6%u0072%u006B%u0020%u0047%u0075%u00F0%u006D%u0075%u006E%u0064%u0073%u0064%u00F3%u0074%u0074%u0069%u0072 5 5 %u5BAE%u5D0E%u3000%u99FF 6 %u1F44D -
trunk/tests/phpunit/data/formatting/utf-8/urlencoded.txt
r25002 r31734 4 4 Bj%c3%b6rk Gu%c3%b0mundsd%c3%b3ttir 5 5 %e5%ae%ae%e5%b4%8e%e3%80%80%e9%a7%bf 6 %f0%9f%91%8d -
trunk/tests/phpunit/data/formatting/utf-8/utf-8.txt
r25002 r31734 4 4 Björk Guðmundsdóttir 5 5 宮崎 駿 6 👍 -
trunk/tests/phpunit/tests/formatting/UrlEncodedToEntities.php
r25002 r31734 9 9 */ 10 10 function test_convert_urlencoded_to_entities( $u_urlencoded, $entity ) { 11 $this->assertEquals( $entity, preg_replace_callback('/\%u([0-9A-F]{4 })/', '_convert_urlencoded_to_entities', $u_urlencoded ), $entity );11 $this->assertEquals( $entity, preg_replace_callback('/\%u([0-9A-F]{4,5})/', '_convert_urlencoded_to_entities', $u_urlencoded ), $entity ); 12 12 } 13 13 -
trunk/tests/phpunit/tests/term.php
r31418 r31734 175 175 // Test existing term name with unique slug 176 176 $term1 = $this->factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) ); 177 $this->assertFalse( is_wp_error( $term1 ) ); 178 $this->assertTrue( empty($term1->errors ) ); 177 $this->assertTrue( is_wp_error( $term1 ) ); 178 $this->assertSame( 'term_exists', $term1->get_error_code() ); 179 $this->assertEquals( $term->term_id, $term1->get_error_data() ); 179 180 180 181 // Test an existing term name
Note: See TracChangeset
for help on using the changeset viewer.