Ticket #10122: hierarchical_metaboxes.patch
File hierarchical_metaboxes.patch, 28.1 KB (added by , 15 years ago) |
---|
-
wp-admin/admin-ajax.php
191 191 $x->send(); 192 192 } 193 193 194 /** 195 * Handles heirarichal taxonomy meta_box add functions. Called via admin_ajax 196 * posts with action: add-{taxonomy name} 197 * 198 * @since 2.9 199 * 200 */ 201 function _wp_ajax_add_heirarichal_term() 202 { 203 $action = $_POST['action']; 204 $taxonomy = get_taxonomy(substr($action, 4)); 205 if(!$taxonomy) 206 die('-1'); 207 check_ajax_referer( $action ); 208 if ( !current_user_can( 'manage_categories' ) ) 209 die('-1'); 210 $names = explode(',', $_POST['new'.$taxonomy->name]); 211 if ( 0 > $parent = (int) $_POST['new'.$taxonomy->name.'_parent'] ) 212 $parent = 0; 213 $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array(); 214 $checked_categories = array_map( 'absint', (array) $post_category ); 215 $popular_ids = isset( $_POST['popular_ids'] ) ? 216 array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) : 217 false; 218 219 $x = new WP_Ajax_Response(); 220 foreach ( $names as $cat_name ) { 221 $cat_name = trim($cat_name); 222 $category_nicename = sanitize_title($cat_name); 223 if ( '' === $category_nicename ) 224 continue; 225 226 if(!($cat_id = is_term($cat_name, $taxonomy->name, $parent))) { 227 $cat_id = wp_insert_term($cat_name, $taxonomy->name, array('parent'=>$parent)); 228 } 229 if ( is_array($cat_id) ) 230 $cat_id = $cat_id['term_id']; 231 $checked_categories[] = $cat_id; 232 if ( $parent ) // Do these all at once in a second 233 continue; 234 $category = get_term( $cat_id, $taxonomy->name); 235 ob_start(); 236 wp_terms_checklist( 0, array('taxonomy'=>$taxonomy->name, 'descendants_and_self'=>$cat_id, 'selected_cats'=>$checked_categories, 'popular_cats'=>$popular_ids)); 237 $data = ob_get_contents(); 238 ob_end_clean(); 239 $x->add( array( 240 'what' => $taxonomy->name, 241 'id' => $cat_id, 242 'data' => $data, 243 'position' => -1 244 ) ); 245 } 246 if ( $parent ) { // Foncy - replace the parent and all its children 247 $parent = get_term($parent, $taxonomy->name); 248 ob_start(); 249 global $post_ID; 250 wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name)); 251 $data = ob_get_contents(); 252 ob_end_clean(); 253 $x->add( array( 254 'what' => $taxonomy->name, 255 'id' => $parent->term_id, 256 'old_id' => $parent->term_id, 257 'data' => $data, 258 'position' => -1 259 ) ); 260 261 } 262 $x->send(); 263 die(); 264 } 265 194 266 $id = isset($_POST['id'])? (int) $_POST['id'] : 0; 195 267 switch ( $action = $_POST['action'] ) : 196 268 case 'delete-comment' : // On success, die with time() instead of 1 … … 388 460 _wp_ajax_delete_comment_response( $comment->comment_ID ); 389 461 die( '0' ); 390 462 break; 391 case 'add-category' : // On the Fly392 check_ajax_referer( $action );393 if ( !current_user_can( 'manage_categories' ) )394 die('-1');395 $names = explode(',', $_POST['newcat']);396 if ( 0 > $parent = (int) $_POST['newcat_parent'] )397 $parent = 0;398 $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();399 $checked_categories = array_map( 'absint', (array) $post_category );400 $popular_ids = isset( $_POST['popular_ids'] ) ?401 array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :402 false;403 404 $x = new WP_Ajax_Response();405 foreach ( $names as $cat_name ) {406 $cat_name = trim($cat_name);407 $category_nicename = sanitize_title($cat_name);408 if ( '' === $category_nicename )409 continue;410 $cat_id = wp_create_category( $cat_name, $parent );411 $checked_categories[] = $cat_id;412 if ( $parent ) // Do these all at once in a second413 continue;414 $category = get_category( $cat_id );415 ob_start();416 wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );417 $data = ob_get_contents();418 ob_end_clean();419 $x->add( array(420 'what' => 'category',421 'id' => $cat_id,422 'data' => $data,423 'position' => -1424 ) );425 }426 if ( $parent ) { // Foncy - replace the parent and all its children427 $parent = get_category( $parent );428 ob_start();429 dropdown_categories( 0, $parent );430 $data = ob_get_contents();431 ob_end_clean();432 $x->add( array(433 'what' => 'category',434 'id' => $parent->term_id,435 'old_id' => $parent->term_id,436 'data' => $data,437 'position' => -1438 ) );439 440 }441 $x->send();442 break;443 463 case 'add-link-category' : // On the Fly 444 464 check_ajax_referer( $action ); 445 465 if ( !current_user_can( 'manage_categories' ) ) -
wp-admin/css/colors-classic.dev.css
104 104 } 105 105 106 106 div.tabs-panel, 107 ul #category-tabs li.tabs {107 ul.category-tabs li.tabs { 108 108 border-color: #dfdfdf; 109 109 } 110 110 111 ul #category-tabs li.tabs {111 ul.category-tabs li.tabs { 112 112 background-color: #f1f1f1; 113 113 } 114 114 … … 381 381 background:#faf9f7 !important; 382 382 } 383 383 384 #side-sortables #category-tabs .tabs a {384 #side-sortables .category-tabs .tabs a { 385 385 color: #333; 386 386 } 387 387 … … 1447 1447 background-color: #f5f5f5; 1448 1448 } 1449 1449 1450 #post-body ul #category-tabs li.tabs a {1450 #post-body ul.category-tabs li.tabs a { 1451 1451 color: #333; 1452 1452 } 1453 1453 -
wp-admin/css/colors-fresh.dev.css
104 104 } 105 105 106 106 div.tabs-panel, 107 ul #category-tabs li.tabs {107 ul.category-tabs li.tabs { 108 108 border-color: #dfdfdf; 109 109 } 110 110 111 ul #category-tabs li.tabs {111 ul.category-tabs li.tabs { 112 112 background-color: #f1f1f1; 113 113 } 114 114 … … 377 377 border-color: #dfdfdf; 378 378 } 379 379 380 #side-sortables #category-tabs .tabs a {380 #side-sortables .category-tabs .tabs a { 381 381 color: #333; 382 382 } 383 383 … … 1442 1442 background-color: #f5f5f5; 1443 1443 } 1444 1444 1445 #post-body ul #category-tabs li.tabs a {1445 #post-body ul.category-tabs li.tabs a { 1446 1446 color: #333; 1447 1447 } 1448 1448 -
wp-admin/css/press-this.dev.css
304 304 display: none; 305 305 } 306 306 307 #category-adder {307 .category-adder { 308 308 padding: 4px 0; 309 309 } 310 310 311 #category-adder h4 {311 .category-adder h4 { 312 312 margin: 0 0 8px; 313 313 } 314 314 … … 335 335 } 336 336 337 337 #category-add input, 338 #category-add-sumbit {338 .category-add-sumbit { 339 339 width: auto; 340 340 } 341 341 342 342 /* Categories */ 343 #categorydiv ul,343 .categorydiv ul, 344 344 #linkcategorydiv ul { 345 345 list-style: none; 346 346 padding: 0; 347 347 margin: 0; 348 348 } 349 349 350 #categorydiv ul.categorychecklist ul {350 .categorydiv ul.categorychecklist ul { 351 351 margin-left: 18px; 352 352 } 353 353 354 #categorydiv div.tabs-panel {354 .categorydiv div.tabs-panel { 355 355 height: 140px; 356 356 overflow: auto; 357 357 } -
wp-admin/edit-form-advanced.php
65 65 66 66 // all tag-style post taxonomies 67 67 foreach ( get_object_taxonomies('post') as $tax_name ) { 68 $taxonomy = get_taxonomy($tax_name); 69 $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name; 68 70 if ( !is_taxonomy_hierarchical($tax_name) ) { 69 $taxonomy = get_taxonomy($tax_name);70 $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;71 72 71 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core'); 72 } else { 73 add_meta_box($tax_name.'div', $label, 'post_categories_meta_box', 'post', 'side', 'core', array('taxonomy'=>$tax_name)); 73 74 } 74 75 } 75 76 76 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');77 77 // add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core'); 78 78 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core'); 79 79 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core'); -
wp-admin/includes/meta-boxes.php
258 258 * 259 259 * @param object $post 260 260 */ 261 function post_categories_meta_box($post) { 262 ?> 263 <ul id="category-tabs"> 264 <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> 265 <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 266 </ul> 261 function post_categories_meta_box($post, $box) { 262 $defaults = array( 263 'taxonomy' => 'category' 264 ); 265 if(!isset($box['args']) || !is_array($args = $box['args'])) 266 { 267 $args = array(); 268 } 269 extract(array_merge($defaults, $args)); 270 ?> 271 <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv"> 272 <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs"> 273 <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> 274 <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 275 </ul> 267 276 268 <div id="categories-pop" class="tabs-panel" style="display: none;">269 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >270 <?php $popular_ids = wp_popular_terms_checklist('category'); ?>271 </ul>272 </div>277 <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;"> 278 <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" > 279 <?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?> 280 </ul> 281 </div> 273 282 274 <div id="categories-all" class="tabs-panel">275 <ul id="categorychecklist" class="list:categorycategorychecklist form-no-clear">276 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>277 </ul>278 </div>283 <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel"> 284 <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear"> 285 <?php wp_terms_checklist($post->ID, array('taxonomy'=>$taxonomy, 'popular_cats'=> $popular_ids)) ?> 286 </ul> 287 </div> 279 288 280 <?php if ( current_user_can('manage_categories') ) : ?> 281 <div id="category-adder" class="wp-hidden-children"> 282 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> 283 <p id="category-add" class="wp-hidden-child"> 284 <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> 285 <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 286 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" /> 287 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 288 <span id="category-ajax-response"></span></p> 289 </div> 290 <?php 291 endif; 292 289 <?php if ( current_user_can('manage_categories') ) : ?> 290 <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children"> 291 <h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> 292 <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child"> 293 <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php _e( 'Add New Category' ); ?></label><input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> 294 <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 295 <input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" /> 296 <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce', false ); ?> 297 <span id="<?php echo $taxonomy; ?>-ajax-response"></span> 298 </p> 299 </div> 300 <?php endif; ?> 301 </div> 302 <?php 293 303 } 294 304 295 305 -
wp-admin/includes/template.php
467 467 468 468 function start_el(&$output, $category, $depth, $args) { 469 469 extract($args); 470 if(empty($taxonomy)) 471 $taxonomy = 'category'; 470 472 473 if($taxonomy == 'category') 474 $name = 'post_category'; 475 else 476 $name = 'tax_input['.$taxonomy.']'; 471 477 $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : ''; 472 $output .= "\n<li id=' category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';478 $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>'; 473 479 } 474 480 475 481 function end_el(&$output, $category, $depth, $args) { … … 488 494 * @param unknown_type $popular_cats 489 495 */ 490 496 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) { 497 wp_terms_checklist($post_id, 498 array( 499 'taxonomy' => 'category', 500 'descendants_and_self' => $descendants_and_self, 501 'selected_cats' => $selected_cats, 502 'popular_cats' => $popular_cats, 503 'walker' => $walker 504 ) 505 ); 506 } 507 508 /** 509 * Taxonomy independent version of wp_category_checklist 510 * 511 * @param int $post_id 512 * @param array $args 513 */ 514 function wp_terms_checklist($post_id = 0, $args = array()) 515 { 516 $defaults = array( 517 'descendants_and_self' => 0, 518 'selected_cats' => false, 519 'popular_cats' => false, 520 'walker' => null, 521 'taxonomy' => 'category' 522 ); 523 extract(array_merge($defaults, $args)); 524 491 525 if ( empty($walker) || !is_a($walker, 'Walker') ) 492 526 $walker = new Walker_Category_Checklist; 493 527 494 528 $descendants_and_self = (int) $descendants_and_self; 495 529 496 $args = array( );530 $args = array('taxonomy'=>$taxonomy); 497 531 498 532 if ( is_array( $selected_cats ) ) 499 533 $args['selected_cats'] = $selected_cats; 500 534 elseif ( $post_id ) 501 $args['selected_cats'] = wp_get_post_categories($post_id);535 $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); 502 536 else 503 537 $args['selected_cats'] = array(); 504 538 505 539 if ( is_array( $popular_cats ) ) 506 540 $args['popular_cats'] = $popular_cats; 507 541 else 508 $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); 509 542 $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); 510 543 if ( $descendants_and_self ) { 511 $categories = get_categories("child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );512 $self = get_ category( $descendants_and_self);544 $categories = (array) get_terms($taxonomy, "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" ); 545 $self = get_term( $descendants_and_self, $taxonomy ); 513 546 array_unshift( $categories, $self ); 514 547 } else { 515 $categories = get_categories('get=all');548 $categories = (array) get_terms($taxonomy, 'get=all'); 516 549 } 517 518 550 // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) 519 551 $checked_categories = array(); 520 552 $keys = array_keys( $categories ); -
wp-admin/js/post.dev.js
210 210 })(jQuery); 211 211 212 212 jQuery(document).ready( function($) { 213 var noSyncChecks = false, syncChecks, catAddAfter,stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';213 var stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = ''; 214 214 215 215 // postboxes 216 216 postboxes.add_postbox_toggles('post'); … … 227 227 $(this).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 228 228 }); 229 229 230 // category tabs 231 $('#category-tabs a').click(function(){ 232 var t = $(this).attr('href'); 233 $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); 234 $('.tabs-panel').hide(); 235 $(t).show(); 236 if ( '#categories-all' == t ) 237 deleteUserSetting('cats'); 238 else 239 setUserSetting('cats','pop'); 240 return false; 241 }); 242 if ( getUserSetting('cats') ) 243 $('#category-tabs a[href="#categories-pop"]').click(); 230 $('.categorydiv').each(function(){ 231 var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, popularCats; 232 var taxonomy = this_id.split('-').pop(); 233 var settingName = taxonomy+'_tab'; 234 if(taxonomy == 'category') 235 settingName = 'cats'; 244 236 245 // Ajax Cat 246 $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); 247 $('#category-add-sumbit').click(function(){$('#newcat').focus();}); 237 // category tabs 238 $('#'+taxonomy+'-tabs a').click(function(){ 239 var t = $(this).attr('href'); 240 $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); 241 $('#taxonomy-'+taxonomy+' .tabs-panel').hide(); 242 $(t).show(); 243 if ( '#'+taxonomy+'-all' == t ) 244 deleteUserSetting(settingName); 245 else 246 setUserSetting(settingName,'pop'); 247 return false; 248 }); 249 if ( getUserSetting(settingName) ) 250 $('#'+this_id+' a[href="#'+taxonomy+'-pop"]').click(); 248 251 249 syncChecks = function() { 250 if ( noSyncChecks ) 251 return; 252 noSyncChecks = true; 253 var th = jQuery(this), c = th.is(':checked'), id = th.val().toString(); 254 $('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); 255 noSyncChecks = false; 256 }; 252 // Ajax Cat 253 $('#new'+taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); 254 $('#'+taxonomy+'-add-submit').click(function(){$('#new'+taxonomy).focus();}); 257 255 258 popularCats = $('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(','); 259 catAddBefore = function( s ) { 260 if ( !$('#newcat').val() ) 261 return false; 262 s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize(); 263 return s; 264 }; 256 syncChecks = function() { 257 if ( noSyncChecks ) 258 return; 259 noSyncChecks = true; 260 var th = jQuery(this), c = th.is(':checked'), id = th.val().toString(); 261 $('#in-'+taxonomy+'-' + id + ', #in-'+taxonomy+'-category-' + id).attr( 'checked', c ); 262 noSyncChecks = false; 263 }; 265 264 266 catAddAfter = function( r, s ) { 267 var newCatParent = jQuery('#newcat_parent'), newCatParentOption = newCatParent.find( 'option[value="-1"]' ); 268 $(s.what + ' response_data', r).each( function() { 269 var t = $($(this).text()); 270 t.find( 'label' ).each( function() { 271 var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o; 272 $('#' + id).change( syncChecks ).change(); 273 if ( newCatParent.find( 'option[value="' + val + '"]' ).size() ) 274 return; 275 name = $.trim( th.text() ); 276 o = $( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 277 newCatParent.prepend( o ); 265 popularCats = $('#'+taxonomy+'checklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(','); 266 catAddBefore = function( s ) { 267 if ( !$('#new'+taxonomy).val() ) 268 return false; 269 s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#'+taxonomy+'checklist :checked' ).serialize(); 270 return s; 271 }; 272 273 catAddAfter = function( r, s ) { 274 var newCatParent = jQuery('#new'+taxonomy+'_parent'), newCatParentOption = newCatParent.find( 'option[value="-1"]' ); 275 $(s.what + ' response_data', r).each( function() { 276 var t = $($(this).text()); 277 t.find( 'label' ).each( function() { 278 var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o; 279 $('#' + id).change( syncChecks ).change(); 280 if ( newCatParent.find( 'option[value="' + val + '"]' ).size() ) 281 return; 282 name = $.trim( th.text() ); 283 o = $( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 284 newCatParent.prepend( o ); 285 } ); 286 newCatParentOption.attr( 'selected', 'selected' ); 278 287 } ); 279 newCatParentOption.attr( 'selected', 'selected' ); 288 }; 289 290 $('#'+taxonomy+'checklist').wpList( { 291 alt: '', 292 response: taxonomy+'-ajax-response', 293 addBefore: catAddBefore, 294 addAfter: catAddAfter 280 295 } ); 281 };282 296 283 $('#categorychecklist').wpList( { 284 alt: '', 285 response: 'category-ajax-response', 286 addBefore: catAddBefore, 287 addAfter: catAddAfter 288 } ); 297 $('#'+taxonomy+'-add-toggle').click( function() { 298 $('#'+taxonomy+'-adder').toggleClass( 'wp-hidden-children' ); 299 $('#'+taxonomy+'-tabs a[href="#'+taxonomy+'-all"]').click(); 300 return false; 301 } ); 289 302 290 $('#category-add-toggle').click( function() { 291 $('#category-adder').toggleClass( 'wp-hidden-children' ); 292 $('#category-tabs a[href="#categories-all"]').click(); 293 return false; 294 } ); 303 $('#'+taxonomy+'checklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = ''; 295 304 296 $('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = '';305 }); 297 306 298 307 function updateVisibility() { 299 308 if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { -
wp-admin/rtl.dev.css
298 298 margin-left: 0; 299 299 margin-right: 120px; 300 300 } 301 #post-body ul #category-tabs li.tabs {301 #post-body ul.category-tabs li.tabs { 302 302 -moz-border-radius: 0 3px 3px 0; 303 303 -webkit-border-top-left-radius: 0; 304 304 -webkit-border-top-right-radius: 3px; … … 309 309 border-bottom-left-radius: 0; 310 310 border-bottom-right-radius: 3px; 311 311 } 312 #post-body ul #category-tabs {312 #post-body ul.category-tabs { 313 313 float: right; 314 314 text-align: left; 315 315 margin: 0 0 0 -120px; … … 320 320 } 321 321 /* 1800 - 2000 322 322 =================================== */ 323 #side-sortables #category-tabs li {323 #side-sortables .category-tabs li { 324 324 padding-right: 0; 325 325 padding-left: 8px; 326 326 } -
wp-admin/wp-admin.dev.css
1938 1938 1939 1939 /* Categories */ 1940 1940 1941 #category-adder {1941 .category-adder { 1942 1942 margin-left: 120px; 1943 1943 padding: 4px 0; 1944 1944 } 1945 1945 1946 #category-adder h4 {1946 .category-adder h4 { 1947 1947 margin: 0 0 8px; 1948 1948 } 1949 1949 1950 #side-sortables #category-adder {1950 #side-sortables .category-adder { 1951 1951 margin: 0; 1952 1952 } 1953 1953 1954 #post-body #category-add input, #category-add select {1954 #post-body .category-add input, .category-add select { 1955 1955 width: 30%; 1956 1956 } 1957 1957 1958 #side-sortables #category-add input {1958 #side-sortables .category-add input { 1959 1959 width: 94%; 1960 1960 } 1961 1961 1962 #side-sortables #category-add select {1962 #side-sortables .category-add select { 1963 1963 width: 100%; 1964 1964 } 1965 1965 1966 # category-add input#category-add-sumbit {1966 #side-sortables .category-add input.category-add-sumbit, #post-body .category-add input.category-add-sumbit { 1967 1967 width: auto; 1968 1968 } 1969 1969 1970 #post-body ul #category-tabs {1970 #post-body ul.category-tabs { 1971 1971 float: left; 1972 1972 width: 120px; 1973 1973 text-align: right; … … 1976 1976 padding: 0; 1977 1977 } 1978 1978 1979 #post-body ul #category-tabs li {1979 #post-body ul.category-tabs li { 1980 1980 padding: 8px; 1981 1981 } 1982 1982 1983 #post-body ul #category-tabs li.tabs {1983 #post-body ul.category-tabs li.tabs { 1984 1984 -moz-border-radius: 3px 0 0 3px; 1985 1985 -webkit-border-top-left-radius: 3px; 1986 1986 -webkit-border-bottom-left-radius: 3px; … … 1990 1990 border-bottom-left-radius: 3px; 1991 1991 } 1992 1992 1993 #post-body ul #category-tabs li.tabs a {1993 #post-body ul.category-tabs li.tabs a { 1994 1994 font-weight: bold; 1995 1995 text-decoration: none; 1996 1996 } 1997 1997 1998 #categorydiv div.tabs-panel,1998 .categorydiv div.tabs-panel, 1999 1999 #linkcategorydiv div.tabs-panel { 2000 2000 height: 150px; 2001 2001 overflow: auto; … … 2004 2004 border-width: 1px; 2005 2005 } 2006 2006 2007 #post-body #categorydiv div.tabs-panel,2007 #post-body .categorydiv div.tabs-panel, 2008 2008 #post-body #linkcategorydiv div.tabs-panel { 2009 2009 margin: 0 5px 0 125px; 2010 2010 } 2011 2011 2012 #side-sortables #category-tabs li {2012 #side-sortables .category-tabs li { 2013 2013 display: inline; 2014 2014 padding-right: 8px; 2015 2015 } 2016 2016 2017 #side-sortables #category-tabs a {2017 #side-sortables .category-tabs a { 2018 2018 text-decoration: none; 2019 2019 } 2020 2020 2021 #side-sortables #category-tabs {2021 #side-sortables .category-tabs { 2022 2022 margin-bottom: 3px; 2023 2023 } 2024 2024 2025 #categorydiv ul,2025 .categorydiv ul, 2026 2026 #linkcategorydiv ul { 2027 2027 list-style: none; 2028 2028 padding: 0; 2029 2029 margin: 0; 2030 2030 } 2031 2031 2032 #categorydiv ul.categorychecklist ul,2032 .categorydiv ul.categorychecklist ul, 2033 2033 #linkcategorydiv ul.categorychecklist ul { 2034 2034 margin-left: 18px; 2035 2035 } … … 2040 2040 line-height: 19px; 2041 2041 } 2042 2042 2043 #category-adder h4 {2043 .category-adder h4 { 2044 2044 margin-top: 4px; 2045 2045 margin-bottom: 0px; 2046 2046 } 2047 2047 2048 #categorydiv .tabs-panel {2048 .categorydiv .tabs-panel { 2049 2049 border-width: 3px; 2050 2050 border-style: solid; 2051 2051 } 2052 2052 2053 ul #category-tabs {2053 ul.category-tabs { 2054 2054 margin-top: 12px; 2055 2055 } 2056 2056 2057 ul #category-tabs li.tabs {2057 ul.category-tabs li.tabs { 2058 2058 border-style: solid solid none; 2059 2059 border-width: 1px 1px 0; 2060 2060 } 2061 2061 2062 #post-body #category-tabs li.tabs {2062 #post-body .category-tabs li.tabs { 2063 2063 border-style: solid none solid solid; 2064 2064 border-width: 1px 0 1px 1px; 2065 2065 margin-right: -1px; 2066 2066 } 2067 2067 2068 ul #category-tabs li {2068 ul.category-tabs li { 2069 2069 padding: 5px 8px; 2070 2070 -moz-border-radius: 3px 3px 0 0; 2071 2071 -webkit-border-top-left-radius: 3px; -
wp-includes/category-template.php
331 331 */ 332 332 function wp_dropdown_categories( $args = '' ) { 333 333 $defaults = array( 334 'taxonomy' => 'category', 334 335 'show_option_all' => '', 'show_option_none' => '', 335 336 'orderby' => 'id', 'order' => 'ASC', 336 337 'show_last_update' => 0, 'show_count' => 0, … … 351 352 if ( (int) $tab_index > 0 ) 352 353 $tab_index_attribute = " tabindex=\"$tab_index\""; 353 354 354 $categories = get_ categories($r );355 $categories = get_terms( $taxonomy, $r ); 355 356 $name = esc_attr($name); 356 357 $class = esc_attr($class); 357 358 -
wp-includes/post.php
1924 1924 $tags = array(); 1925 1925 1926 1926 $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 1927 1928 $taxonomy_obj = get_taxonomy($taxonomy); 1929 if($taxonomy_obj->hierarchical) 1930 { 1931 $tags = array_map('intval', $tags); 1932 $tags = array_unique($tags); 1933 } 1934 1927 1935 wp_set_object_terms($post_id, $tags, $taxonomy, $append); 1928 1936 } 1929 1937 -
wp-includes/taxonomy.php
192 192 $args['name'] = $taxonomy; 193 193 $args['object_type'] = $object_type; 194 194 $wp_taxonomies[$taxonomy] = (object) $args; 195 196 //register meta_box 197 add_filter('wp_ajax_add-'.$taxonomy, '_wp_ajax_add_heirarichal_term'); 195 198 } 196 199 197 200 //