Ticket #7897: 7897.diff
File 7897.diff, 10.9 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
2907 2907 if ( empty($tags) ) 2908 2908 $tags = array(); 2909 2909 2910 $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 2910 if ( ! is_array( $tags ) ) { 2911 $comma = _x( ',', 'tag delimiter' ); 2912 if ( ',' !== $comma ) 2913 $tags = str_replace( $comma, ',', $tags ); 2914 $tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) ); 2915 } 2911 2916 2912 2917 // Hierarchical taxonomies must always pass IDs rather than names so that children with the same 2913 2918 // names but different parents aren't confused. -
wp-includes/script-loader.php
330 330 'publicSticky' => __('Public, Sticky'), 331 331 'password' => __('Password Protected'), 332 332 'privatelyPublished' => __('Privately Published'), 333 'published' => __('Published') 333 'published' => __('Published'), 334 'comma' => _x( ',', 'tag delimiter' ), 334 335 ) ); 335 336 336 337 $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), false, 1 ); … … 353 354 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 354 355 'error' => __('Error while saving the changes.'), 355 356 'ntdeltitle' => __('Remove From Bulk Edit'), 356 'notitle' => __('(no title)') 357 'notitle' => __('(no title)'), 358 'comma' => _x( ',', 'tag delimiter' ), 357 359 ) ); 358 360 359 361 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 ); -
wp-admin/includes/class-wp-posts-list-table.php
609 609 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) 610 610 ); 611 611 } 612 echo join( ', ', $out ); 612 /* translators: used between list items, there is a space after the comma */ 613 echo join( __( ', ' ), $out ); 613 614 } else { 614 615 _e( 'Uncategorized' ); 615 616 } … … 629 630 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) ) 630 631 ); 631 632 } 632 echo join( ', ', $out ); 633 /* translators: used between list items, there is a space after the comma */ 634 echo join( __( ', ' ), $out ); 633 635 } else { 634 636 _e( 'No Tags' ); 635 637 } -
wp-admin/includes/ajax-actions.php
66 66 67 67 $s = stripslashes( $_GET['q'] ); 68 68 69 $comma = _x( ',', 'tag delimiter' ); 70 if ( ',' !== $comma ) 71 $s = str_replace( $comma, ',', $s ); 69 72 if ( false !== strpos( $s, ',' ) ) { 70 73 $s = explode( ',', $s ); 71 74 $s = $s[count( $s ) - 1]; -
wp-admin/includes/post.php
302 302 if ( empty($terms) ) 303 303 continue; 304 304 if ( is_taxonomy_hierarchical( $tax_name ) ) { 305 $tax_input[ $tax_name] = array_map( 'absint', $terms );305 $tax_input[ $tax_name ] = array_map( 'absint', $terms ); 306 306 } else { 307 $tax_input[$tax_name] = preg_replace( '/\s*,\s*/', ',', rtrim( trim($terms), ' ,' ) ); 308 $tax_input[$tax_name] = explode(',', $tax_input[$tax_name]); 307 $comma = _x( ',', 'tag delimiter' ); 308 if ( ',' !== $comma ) 309 $terms = str_replace( $comma, ',', $terms ); 310 $tax_input[ $tax_name ] = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); 309 311 } 310 312 } 311 313 } -
wp-admin/includes/meta-boxes.php
276 276 $tax_name = esc_attr($taxonomy); 277 277 $taxonomy = get_taxonomy($taxonomy); 278 278 $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : ''; 279 $comma = _x( ',', 'tag delimiter' ); 279 280 ?> 280 281 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 281 282 <div class="jaxtag"> 282 283 <div class="nojs-tags hide-if-js"> 283 284 <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p> 284 <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php echo $disabled; ?>><?php echo get_terms_to_edit( $post->ID, $tax_name); // textarea_escaped by esc_attr() ?></textarea></div>285 <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php echo $disabled; ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div> 285 286 <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?> 286 287 <div class="ajaxtag hide-if-no-js"> 287 288 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> -
wp-admin/includes/template.php
264 264 foreach ( $taxonomy_names as $taxonomy_name) { 265 265 $taxonomy = get_taxonomy( $taxonomy_name ); 266 266 267 if ( $taxonomy->hierarchical && $taxonomy->show_ui ) 268 echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '</div>'; 269 elseif ( $taxonomy->show_ui ) 270 echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '</div>'; 267 if ( $taxonomy->hierarchical && $taxonomy->show_ui ) { 268 echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' 269 . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array( 'fields' => 'ids' ) ) ) . '</div>'; 270 } elseif ( $taxonomy->show_ui ) { 271 echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' 272 . esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '</div>'; 273 } 271 274 } 272 275 273 276 if ( !$post_type_object->hierarchical ) -
wp-admin/js/post.dev.js
15 15 16 16 tagBox = { 17 17 clean : function(tags) { 18 return tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, ''); 18 var comma = postL10n.comma; 19 if ( ',' !== comma ) 20 tags = tags.replace(new RegExp(comma, 'g'), ','); 21 tags = tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, ''); 22 if ( ',' !== comma ) 23 tags = tags.replace(/,/g, comma); 24 return tags; 19 25 }, 20 26 21 27 parseTags : function(el) { 22 var id = el.id, num = id.split('-check-num-')[1], taxbox = $(el).closest('.tagsdiv'), thetags = taxbox.find('.the-tags'), current_tags = thetags.val().split(','), new_tags = []; 28 var id = el.id, num = id.split('-check-num-')[1], taxbox = $(el).closest('.tagsdiv'), 29 thetags = taxbox.find('.the-tags'), comma = postL10n.comma, 30 current_tags = thetags.val().split(comma), new_tags = []; 23 31 delete current_tags[num]; 24 32 25 33 $.each( current_tags, function(key, val) { … … 29 37 } 30 38 }); 31 39 32 thetags.val( this.clean( new_tags.join( ',') ) );40 thetags.val( this.clean( new_tags.join(comma) ) ); 33 41 34 42 this.quickClicks(taxbox); 35 43 return false; … … 46 54 47 55 disabled = thetags.prop('disabled'); 48 56 49 current_tags = thetags.val().split( ',');57 current_tags = thetags.val().split(postL10n.comma); 50 58 tagchecklist.empty(); 51 59 52 60 $.each( current_tags, function( key, val ) { … … 74 82 75 83 flushTags : function(el, a, f) { 76 84 a = a || false; 77 var text, tags = $('.the-tags', el), newtag = $('input.newtag', el), newtags; 85 var tags = $('.the-tags', el), 86 newtag = $('input.newtag', el), 87 comma = postL10n.comma, 88 newtags, text; 78 89 79 90 text = a ? $(a).text() : newtag.val(); 80 91 tagsval = tags.val(); 81 newtags = tagsval ? tagsval + ','+ text : text;92 newtags = tagsval ? tagsval + comma + text : text; 82 93 83 94 newtags = this.clean( newtags ); 84 newtags = array_unique_noempty( newtags.split( ',') ).join(',');95 newtags = array_unique_noempty( newtags.split(comma) ).join(comma); 85 96 tags.val(newtags); 86 97 this.quickClicks(el); 87 98 … … 96 107 get : function(id) { 97 108 var tax = id.substr(id.indexOf('-')+1); 98 109 99 $.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {110 $.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) { 100 111 if ( 0 == r || 'success' != stat ) 101 112 r = wpAjax.broken; 102 113 … … 142 153 } 143 154 }).each(function(){ 144 155 var tax = $(this).closest('div.tagsdiv').attr('id'); 145 $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ","} );156 $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: postL10n.comma + ' ' } ); 146 157 }); 147 158 148 159 // save tags on post save/publish -
wp-admin/js/inline-edit-post.dev.js
117 117 if ( 'post' == type ) { 118 118 // support multi taxonomies? 119 119 tax = 'post_tag'; 120 $('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", "} );120 $('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } ); 121 121 } 122 122 $('html, body').animate( { scrollTop: 0 }, 'fast' ); 123 123 }, … … 184 184 $('.tags_input', rowData).each(function(){ 185 185 var terms = $(this).text(), 186 186 taxname = $(this).attr('id').replace('_' + id, ''), 187 textarea = $('textarea.tax_input_' + taxname, editRow); 187 textarea = $('textarea.tax_input_' + taxname, editRow), 188 comma = inlineEditL10n.comma; 188 189 189 if ( terms ) 190 if ( terms ) { 191 if ( ',' !== comma ) 192 terms = terms.replace(/,/g, comma); 190 193 textarea.val(terms); 194 } 191 195 192 textarea.suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: ", "} );196 textarea.suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } ); 193 197 }); 194 198 195 199 // handle the post status