Ticket #6387: 6387-r10220.patch
File 6387-r10220.patch, 25.5 KB (added by , 16 years ago) |
---|
-
wp-admin/admin-ajax.php
44 44 die('-1'); 45 45 46 46 $s = $_GET['q']; // is this slashed already? 47 48 if ( isset($_GET['tax']) ) 49 $taxonomy = sanitize_title($_GET['tax']); 50 else 51 die('0'); 47 52 48 53 if ( false !== strpos( $s, ',' ) ) { 49 54 $s = explode( ',', $s ); … … 52 57 $s = trim( $s ); 53 58 if ( strlen( $s ) < 2 ) 54 59 die; // require 2 chars for matching 55 $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = 'post_tag' AND t.name LIKE ('%". $s . "%')" ); 60 61 $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '$taxonomy' AND t.name LIKE ('%" . $s . "%')" ); 62 56 63 echo join( $results, "\n" ); 57 64 die; 58 65 break; … … 490 497 if ( !current_user_can( 'manage_categories' ) ) 491 498 die('-1'); 492 499 493 $tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); 500 if ( isset($_POST['tax']) ) 501 $taxonomy = sanitize_title($_POST['tax']); 502 else 503 die('0'); 504 505 $tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ), $taxonomy ); 494 506 495 507 if ( empty( $tags ) ) 496 508 die( __('No tags found!') ); … … 776 788 global $current_user; 777 789 778 790 $_POST['post_category'] = explode(",", $_POST['catslist']); 779 $_POST['tags_input'] = explode(",", $_POST['tags_input']);780 791 if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) 781 792 unset($_POST['post_category']); 782 793 -
wp-admin/css/colors-classic.css
682 682 color: #448abd; 683 683 } 684 684 685 #tagchecklist span a,685 .tagchecklist span a, 686 686 #bulk-titles div a { 687 687 background: url(../images/xit.gif) no-repeat; 688 688 } 689 689 690 #tagchecklist span a:hover,690 .tagchecklist span a:hover, 691 691 #bulk-titles div a:hover { 692 692 background: url(../images/xit.gif) no-repeat -10px 0; 693 693 } … … 1007 1007 1008 1008 #timestampdiv input, 1009 1009 #namediv input, 1010 # tagsdiv #the-tagcloud {1010 #poststuff .inside .the-tagcloud { 1011 1011 border-color: #ddd; 1012 1012 } 1013 1013 -
wp-admin/css/colors-fresh.css
682 682 color: #448abd; 683 683 } 684 684 685 #tagchecklist span a,685 .tagchecklist span a, 686 686 #bulk-titles div a { 687 687 background: url(../images/xit.gif) no-repeat; 688 688 } 689 689 690 #tagchecklist span a:hover,690 .tagchecklist span a:hover, 691 691 #bulk-titles div a:hover { 692 692 background: url(../images/xit.gif) no-repeat -10px 0; 693 693 } … … 1007 1007 1008 1008 #timestampdiv input, 1009 1009 #namediv input, 1010 # tagsdiv #the-tagcloud {1010 #poststuff .inside .the-tagcloud { 1011 1011 border-color: #ddd; 1012 1012 } 1013 1013 -
wp-admin/css/ie-rtl.css
44 44 padding-right: 0; 45 45 padding-left: 1px; 46 46 } 47 #tagchecklist span a {47 .tagchecklist span a { 48 48 margin: 4px -9px 0 0; 49 49 } 50 50 .widefat th input { -
wp-admin/css/ie.css
245 245 li.widget-list-control-item h4, 246 246 .widget-sortable, 247 247 .widget-control-actions, 248 #tagchecklist,248 .tagchecklist, 249 249 #col-container, 250 250 #col-left, 251 251 #col-right { … … 296 296 padding-right: 1px; 297 297 } 298 298 299 #tagchecklist span, #tagchecklist span a {299 .tagchecklist span, .tagchecklist span a { 300 300 display: inline-block; 301 301 display: block; 302 302 } 303 303 304 #tagchecklist span a {304 .tagchecklist span a { 305 305 margin: 4px 0 0 -9px; 306 306 } 307 307 -
wp-admin/edit-form-advanced.php
263 263 * 264 264 * @param object $post 265 265 */ 266 function post_tags_meta_box($post) { 266 function post_tags_meta_box($post, $box) { 267 $tax_name = substr($box['id'], 8); 268 $taxonomy = get_taxonomy($tax_name); 269 $helps = attribute_escape($taxonomy->helps); 267 270 ?> 268 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> 269 <div id="tagchecklist"></div> 270 <p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p> 271 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 272 <p class="jaxtag"> 273 <label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label> 274 <input type="hidden" name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" value="<?php echo get_tags_to_edit( $post->ID, $tax_name ); ?>" /> 275 276 <span class="ajaxtag" style="display:none;"> 277 <input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" /> 278 <input type="button" class="button tagadd" value="<?php _e('Add'); ?>" tabindex="3" /> 279 </span> 280 <?php echo $helps ? "<div class='howto'>$helps</div>" : ''; ?> 281 </p> 282 <div class="tagchecklist"></div> 283 </div> 284 <p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p> 271 285 <?php 272 286 } 273 add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core');274 287 288 // all tag-style post taxonomies 289 foreach ( get_object_taxonomies('post') as $tax_name ) { 290 if ( !is_taxonomy_hierarchical($tax_name) ) { 291 $taxonomy = get_taxonomy($tax_name); 292 $label = isset($taxonomy->label) ? attribute_escape($taxonomy->label) : $tax_name; 293 294 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core'); 295 } 296 } 297 275 298 /** 276 299 * Display post categories form fields. 277 300 * -
wp-admin/includes/taxonomy.php
194 194 * @param unknown_type $post_id 195 195 * @return unknown 196 196 */ 197 function get_tags_to_edit( $post_id ) {197 function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { 198 198 $post_id = (int) $post_id; 199 199 if ( !$post_id ) 200 200 return false; 201 201 202 $tags = wp_get_post_tags($post_id );202 $tags = wp_get_post_tags($post_id, array(), $taxonomy); 203 203 204 204 if ( !$tags ) 205 205 return false; 206 206 207 if ( is_wp_error($tags) ) 208 return show_message($tags); 209 207 210 foreach ( $tags as $tag ) 208 211 $tag_names[] = $tag->name; 209 212 $tags_to_edit = join( ',', $tag_names ); 210 213 $tags_to_edit = attribute_escape( $tags_to_edit ); 211 $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit ); 214 $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit, $taxonomy ); 215 212 216 return $tags_to_edit; 213 217 } 214 218 … … 220 224 * @param unknown_type $tag_name 221 225 * @return unknown 222 226 */ 223 function tag_exists($tag_name ) {224 return is_term($tag_name, 'post_tag');227 function tag_exists($tag_name, $taxonomy = 'post_tag') { 228 return is_term($tag_name, $taxonomy); 225 229 } 226 230 227 231 /** … … 232 236 * @param unknown_type $tag_name 233 237 * @return unknown 234 238 */ 235 function wp_create_tag($tag_name ) {236 if ( $id = tag_exists($tag_name ) )239 function wp_create_tag($tag_name, $taxonomy = 'post_tag') { 240 if ( $id = tag_exists($tag_name, $taxonomy) ) 237 241 return $id; 238 242 239 return wp_insert_term($tag_name, 'post_tag');243 return wp_insert_term($tag_name, $taxonomy); 240 244 } 241 242 ?> -
wp-admin/includes/template.php
2695 2695 * @param string $context The context within the page where the boxes should show ('normal', 'advanced'). 2696 2696 * @param string $priority The priority within the context where the boxes should show ('high', 'low'). 2697 2697 */ 2698 function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default' ) {2698 function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null) { 2699 2699 global $wp_meta_boxes; 2700 2700 2701 2701 if ( !isset($wp_meta_boxes) ) … … 2729 2729 } elseif ( 'sorted' == $priority ) { 2730 2730 $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title']; 2731 2731 $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback']; 2732 $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args']; 2732 2733 } 2733 2734 // An id can be in only one priority and one context 2734 2735 if ( $priority != $a_priority || $context != $a_context ) … … 2742 2743 if ( !isset($wp_meta_boxes[$page][$context][$priority]) ) 2743 2744 $wp_meta_boxes[$page][$context][$priority] = array(); 2744 2745 2745 $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback );2746 $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args); 2746 2747 } 2747 2748 2748 2749 /** -
wp-admin/js/post.js
1 1 // this file contains all the scripts used in the post/edit page 2 2 3 // return an array with any duplicate, whitespace or values removed 4 function array_unique_noempty(a) { 5 var out = []; 6 jQuery.each( a, function(key, val) { 7 val = jQuery.trim(val); 8 if ( val && jQuery.inArray(val, out) == -1 ) 9 out.push(val); 10 } ); 11 return out; 12 } 13 3 14 function new_tag_remove_tag() { 4 15 var id = jQuery( this ).attr( 'id' ); 5 var num = id.substr( 10 ); 6 var current_tags = jQuery( '#tags-input' ).val().split(','); 16 var num = id.split('-check-num-')[1]; 17 var taxbox = jQuery(this).parents('.tagsdiv'); 18 var current_tags = taxbox.find( '.the-tags' ).val().split(','); 7 19 delete current_tags[num]; 8 20 var new_tags = []; 9 jQuery.each( current_tags, function( key, val ) { 10 if ( val && !val.match(/^\s+$/) && '' != val ) { 11 new_tags = new_tags.concat( val ); 21 22 jQuery.each( current_tags, function(key, val) { 23 val = jQuery.trim(val); 24 if ( val ) { 25 new_tags.push(val); 12 26 } 13 27 }); 14 jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) ); 15 tag_update_quickclicks(); 16 jQuery('#newtag').focus(); 28 29 taxbox.find('.the-tags').val( new_tags.join(',').replace(/\s*,+\s*/, ',').replace(/,+/, ',').replace(/,+\s+,+/, ',').replace(/,+\s*$/, '').replace(/^\s*,+/, '') ); 30 31 tag_update_quickclicks(taxbox); 17 32 return false; 18 33 } 19 34 20 function tag_update_quickclicks( ) {21 if ( jQuery( '#tags-input').length == 0 )35 function tag_update_quickclicks(taxbox) { 36 if ( jQuery(taxbox).find('.the-tags').length == 0 ) 22 37 return; 23 var current_tags = jQuery( '#tags-input' ).val().split(','); 24 jQuery( '#tagchecklist' ).empty(); 38 39 var current_tags = jQuery(taxbox).find('.the-tags').val().split(','); 40 jQuery(taxbox).find('.tagchecklist').empty(); 25 41 shown = false; 26 // jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique 42 27 43 jQuery.each( current_tags, function( key, val ) { 28 val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim44 val = jQuery.trim(val); 29 45 if ( !val.match(/^\s+$/) && '' != val ) { 30 txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a> ' + val + '</span> ';31 jQuery( '#tagchecklist' ).append( txt );32 jQuery( '#tag-check-' + key ).click( new_tag_remove_tag);33 shown = true;46 var button_id = jQuery(taxbox).attr('id') + '-check-num-' + key; 47 txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a> ' + val + '</span> '; 48 jQuery(taxbox).find('.tagchecklist').append(txt); 49 jQuery( '#' + button_id ).click( new_tag_remove_tag ); 34 50 } 35 51 }); 36 52 if ( shown ) 37 jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />');53 jQuery(taxbox).find('.tagchecklist').prepend('<strong>'+postL10n.tagsUsed+'</strong><br />'); 38 54 } 39 55 40 function tag_flush_to_text( e,a) {56 function tag_flush_to_text(id, a) { 41 57 a = a || false; 42 var t ext = a ? jQuery(a).text() : jQuery('#newtag').val();43 var newtags = jQuery('#tags-input').val();58 var taxbox = jQuery('#'+id); 59 var text = a ? jQuery(a).text() : taxbox.find('input.newtag').val(); 44 60 45 var t = text.replace( /\s*([^,]+).*/, '$1,' ); 46 newtags += ',' 47 48 if ( newtags.indexOf(t) != -1 ) 61 // is the input box empty (i.e. showing the 'Add new tag' tip)? 62 if ( taxbox.find('input.newtag').hasClass('form-input-tip') && ! a ) 49 63 return false; 50 64 51 newtags += text; 65 var tags = taxbox.find('.the-tags').val(); 66 var newtags = tags ? tags + ',' + text : text; 52 67 53 68 // massage 54 newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' ); 55 jQuery('#tags-input').val( newtags ); 56 tag_update_quickclicks(); 57 if ( ! a ) { 58 jQuery('#newtag').val(''); 59 jQuery('#newtag').focus(); 60 } 69 newtags = newtags.replace(/\s+,+\s*/g, ',').replace(/,+/g, ',').replace(/,+\s+,+/g, ',').replace(/,+\s*$/g, '').replace(/^\s*,+/g, ''); 70 newtags = array_unique_noempty(newtags.split(',')).join(','); 71 taxbox.find('.the-tags').val(newtags); 72 tag_update_quickclicks(taxbox); 73 74 if ( ! a ) 75 taxbox.find('input.newtag').val('').focus(); 76 61 77 return false; 62 78 } 63 79 64 80 function tag_save_on_publish() { 65 if ( jQuery('#newtag').val() != postL10n.addTag ) 66 tag_flush_to_text(); 81 jQuery('.tagsdiv').each( function(i) { 82 if ( !jQuery(this).find('input.newtag').hasClass('form-input-tip') ) 83 tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id')); 84 } ); 67 85 } 68 86 69 87 function tag_press_key( e ) { 70 if ( 13 == e. keyCode) {71 tag_flush_to_text( );88 if ( 13 == e.which ) { 89 tag_flush_to_text(jQuery(e.target).parents('.tagsdiv').attr('id')); 72 90 return false; 73 91 } 74 92 }; 75 93 94 function tag_init() { 95 96 jQuery('.ajaxtag').show(); 97 jQuery('.tagsdiv').each( function(i) { 98 tag_update_quickclicks(this); 99 } ); 100 101 // add the quickadd form 102 jQuery('.ajaxtag input.tagadd').click(function(){tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id'));}); 103 jQuery('.ajaxtag input.newtag').focus(function() { 104 if ( this.value == postL10n.addTag ) { 105 jQuery(this).val( '' ).removeClass( 'form-input-tip' ); 106 } 107 }); 108 109 jQuery('.ajaxtag input.newtag').blur(function() { 110 if ( this.value == '' ) { 111 jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); 112 } 113 }); 114 115 // auto-save tags on post save/publish 116 jQuery('#publish').click( tag_save_on_publish ); 117 jQuery('#save-post').click( tag_save_on_publish ); 118 119 // catch the enter key 120 jQuery('.ajaxtag input.newtag').keypress( tag_press_key ); 121 } 122 76 123 (function($){ 77 124 tagCloud = { 78 125 init : function() { 79 $(' #tagcloud-link').click(function(){tagCloud.get(); $(this).unbind().click(function(){return false;}); return false;});126 $('.tagcloud-link').click(function(){tagCloud.get($(this).attr('id')); $(this).unbind().click(function(){return false;}); return false;}); 80 127 }, 81 128 82 get : function() { 83 $.post('admin-ajax.php', {'action':'get-tagcloud'}, function(r, stat) { 129 get : function(id) { 130 tax = id.substr(id.indexOf('-')+1); 131 132 $.post('admin-ajax.php', {'action':'get-tagcloud','tax':tax}, function(r, stat) { 84 133 if ( 0 == r || 'success' != stat ) 85 134 r = wpAjax.broken; 86 135 87 r = '<p id="the-tagcloud">'+r+'</p>';88 $(' #tagcloud-link').after($(r));89 $('#the-tagcloud a').click(function(){90 tag_flush_to_text( 0,this);136 r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>'); 137 $('a', r).click(function(){ 138 var id = $(this).parents('p').attr('id'); 139 tag_flush_to_text(id.substr(id.indexOf('-')+1), this); 91 140 return false; 92 141 }); 142 143 $('#'+id).after(r); 93 144 }); 94 145 } 95 146 } … … 107 158 // Editable slugs 108 159 make_slugedit_clickable(); 109 160 110 jQuery('#tags-input').hide(); 111 tag_update_quickclicks(); 112 // add the quickadd form 113 jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>'); 114 jQuery('#tagadd').click( tag_flush_to_text ); 115 jQuery('#newtag').focus(function() { 116 if ( this.value == postL10n.addTag ) 117 jQuery(this).val( '' ).removeClass( 'form-input-tip' ); 118 }); 119 jQuery('#newtag').blur(function() { 120 if ( this.value == '' ) 121 jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); 122 }); 161 // prepare the tag UI 162 tag_init(); 123 163 124 // auto-save tags on post save/publish125 jQuery('#publish').click( tag_save_on_publish );126 jQuery('#save-post').click( tag_save_on_publish );127 128 164 jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); 129 165 130 166 // auto-suggest stuff 131 jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 132 jQuery('#newtag').keypress( tag_press_key ); 167 jQuery('.newtag').each(function(){ 168 var tax = $(this).parents('div.tagsdiv').attr('id'); 169 $(this).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 170 }); 133 171 134 172 // category tabs 135 173 var categoryTabs =jQuery('#category-tabs').tabs(); -
wp-admin/rtl.css
211 211 #normal-sortables .postbox .submit { 212 212 float: left; 213 213 } 214 #post-body #tagsdiv #newtag {214 #post-body .tagsdiv #newtag { 215 215 margin-right: 0; 216 216 margin-left: 5px; 217 217 } … … 221 221 #comment-status-radio input { 222 222 margin: 2px 0 5px 3px; 223 223 } 224 #tagchecklist {224 .tagchecklist { 225 225 margin-left: 0; 226 226 margin-right: 10px; 227 227 } 228 #tagchecklist strong {228 .tagchecklist strong { 229 229 margin-left: 0; 230 230 margin-right: -8px; 231 231 } 232 #tagchecklist span {232 .tagchecklist span { 233 233 float: right; 234 234 } 235 #tagchecklist span a {235 .tagchecklist span a { 236 236 margin: 6px -9px 0 0; 237 237 float: right; 238 238 } -
wp-admin/wp-admin.css
1355 1355 display: none; 1356 1356 } 1357 1357 1358 #post-body #tagsdiv #newtag {1358 #post-body .tagsdiv #newtag { 1359 1359 margin-right: 5px; 1360 1360 width: 16em; 1361 1361 } … … 1364 1364 width: 94% 1365 1365 } 1366 1366 1367 #side-info-column #tagsdiv #newtag {1367 #side-info-column .tagsdiv #newtag { 1368 1368 width: 68%; 1369 1369 } 1370 1370 … … 1421 1421 padding: 5px 0; 1422 1422 } 1423 1423 1424 #tagchecklist {1424 .tagchecklist { 1425 1425 margin-left: 10px; 1426 1426 font-size: 12px; 1427 1427 overflow: auto; 1428 1428 } 1429 1429 1430 #tagchecklist strong {1430 .tagchecklist strong { 1431 1431 margin-left: -8px; 1432 1432 position: absolute; 1433 1433 } 1434 1434 1435 #tagchecklist span {1435 .tagchecklist span { 1436 1436 margin-right: 25px; 1437 1437 display: block; 1438 1438 float: left; … … 1442 1442 cursor: default; 1443 1443 } 1444 1444 1445 #tagchecklist span a {1445 .tagchecklist span a { 1446 1446 margin: 6px 0pt 0pt -9px; 1447 1447 cursor: pointer; 1448 1448 width: 10px; … … 2830 2830 margin-top: 8px; 2831 2831 } 2832 2832 2833 # tagsdiv #the-tagcloud {2834 margin: 5px 5px10px;2833 #poststuff .inside .the-tagcloud { 2834 margin: 5px 0 10px; 2835 2835 padding: 8px; 2836 2836 border-width: 1px; 2837 2837 border-style: solid; -
wp-includes/category.php
274 274 * @param string|array $args Tag arguments to use when retrieving tags. 275 275 * @return array List of tags. 276 276 */ 277 function &get_tags( $args = '' ) {278 $tags = get_terms( 'post_tag', $args );277 function &get_tags( $args = '', $taxonomy = 'post_tag' ) { 278 $tags = get_terms( $taxonomy, $args ); 279 279 280 280 if ( empty( $tags ) ) { 281 281 $return = array(); 282 282 return $return; 283 283 } 284 284 285 $tags = apply_filters( 'get_tags', $tags, $args );285 $tags = apply_filters( 'get_tags', $tags, $args, $taxonomy ); 286 286 return $tags; 287 287 } 288 288 -
wp-includes/js/autosave.js
130 130 post_ID: jQuery("#post_ID").val() || 0, 131 131 post_title: jQuery("#title").val() || "", 132 132 autosavenonce: jQuery('#autosavenonce').val(), 133 tags_input: jQuery("#tags-input").val() || "",133 //tags_input: jQuery("#tags-input").val() || "", 134 134 post_type: jQuery('#post_type').val() || "", 135 135 autosave: 1 136 136 }; 137 138 jQuery('.tags-input').each( function() { 139 post_data[this.name] = this.value; 140 } ); 137 141 138 142 // We always send the ajax request in order to keep the post lock fresh. 139 143 // This (bool) tells whether or not to write the post to the DB during the ajax request. -
wp-includes/post.php
1205 1205 * @param array $args Optional. Overwrite the defaults 1206 1206 * @return array List of post tags. 1207 1207 */ 1208 function wp_get_post_tags( $post_id = 0, $args = array() ) {1208 function wp_get_post_tags( $post_id = 0, $args = array(), $taxonomy = 'post_tag' ) { 1209 1209 $post_id = (int) $post_id; 1210 1210 1211 1211 $defaults = array('fields' => 'all'); 1212 1212 $args = wp_parse_args( $args, $defaults ); 1213 1213 1214 $tags = wp_get_object_terms($post_id, 'post_tag', $args);1214 $tags = wp_get_object_terms($post_id, $taxonomy, $args); 1215 1215 1216 1216 return $tags; 1217 1217 } … … 1498 1498 } 1499 1499 1500 1500 wp_set_post_categories( $post_ID, $post_category ); 1501 wp_set_post_tags( $post_ID, $tags_input ); 1501 // old-style tags_input 1502 if ( !empty($tags_input) ) 1503 wp_set_post_tags( $post_ID, $tags_input ); 1504 // new-style support for all tag-like taxonomies 1505 if ( !empty($tax_input) ) { 1506 foreach ( $tax_input as $taxonomy => $tags ) { 1507 wp_set_post_tax( $post_ID, $tags, $taxonomy ); 1508 } 1509 } 1502 1510 1503 1511 $current_guid = get_post_field( 'guid', $post_ID ); 1504 1512 … … 1685 1693 * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise 1686 1694 */ 1687 1695 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { 1696 return wp_set_post_tax( $post_id, $tags, 'post_tag', $append); 1697 } 1688 1698 1699 function wp_set_post_tax( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { 1689 1700 $post_id = (int) $post_id; 1690 1701 1691 1702 if ( !$post_id ) … … 1693 1704 1694 1705 if ( empty($tags) ) 1695 1706 $tags = array(); 1696 $tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 1697 wp_set_object_terms($post_id, $tags, 'post_tag', $append); 1707 1708 $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 1709 wp_set_object_terms($post_id, $tags, $taxonomy, $append); 1698 1710 } 1699 1711 1700 1712 /** -
wp-includes/script-loader.php
77 77 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};' 78 78 ) ); 79 79 80 $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '2008121 0' );80 $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081217' ); 81 81 82 82 $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20081210' ); 83 83 $scripts->localize( 'wp-lists', 'wpListL10n', array( … … 179 179 'cancel' => __('Cancel'), 180 180 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};' 181 181 ) ); 182 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '2008121 0' );182 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081217' ); 183 183 $scripts->localize( 'post', 'postL10n', array( 184 184 'tagsUsed' => __('Tags used on this post:'), 185 185 'add' => attribute_escape(__('Add')), -
wp-includes/taxonomy.php
17 17 * @global array $wp_taxonomies 18 18 */ 19 19 $wp_taxonomies = array(); 20 $wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count' );21 $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count' );20 $wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories')); 21 $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags')); 22 22 $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false); 23 23 24 24 /**