Changeset 12022 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 10/13/2009 10:02:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r12021 r12022 400 400 $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array(); 401 401 $checked_categories = array_map( 'absint', (array) $post_category ); 402 $popular_ids = isset( $_POST['popular_ids'] ) ? 403 array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) : 404 false; 405 406 $x = new WP_Ajax_Response(); 402 $popular_ids = wp_popular_terms_checklist('category', 0, 10, false); 403 407 404 foreach ( $names as $cat_name ) { 408 405 $cat_name = trim($cat_name); … … 419 416 $data = ob_get_contents(); 420 417 ob_end_clean(); 421 $ x->add(array(418 $add = array( 422 419 'what' => 'category', 423 420 'id' => $cat_id, 424 'data' => $data,421 'data' => str_replace( array("\n", "\t"), '', $data), 425 422 'position' => -1 426 ) );423 ); 427 424 } 428 425 if ( $parent ) { // Foncy - replace the parent and all its children 429 426 $parent = get_category( $parent ); 427 $term_id = $parent->term_id; 428 429 while ( $parent->parent ) { // get the top parent 430 $parent = &get_category( $parent->parent ); 431 if ( is_wp_error( $parent ) ) 432 break; 433 $term_id = $parent->term_id; 434 } 435 430 436 ob_start(); 431 dropdown_categories( 0, $parent);437 wp_category_checklist( 0, $term_id, $checked_categories, $popular_ids, null, false ); 432 438 $data = ob_get_contents(); 433 439 ob_end_clean(); 434 $ x->add(array(440 $add = array( 435 441 'what' => 'category', 436 'id' => $parent->term_id, 437 'old_id' => $parent->term_id, 438 'data' => $data, 442 'id' => $term_id, 443 'data' => str_replace( array("\n", "\t"), '', $data), 439 444 'position' => -1 440 ) ); 441 442 } 445 ); 446 } 447 448 ob_start(); 449 wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); 450 $sup = ob_get_contents(); 451 ob_end_clean(); 452 $add['supplemental'] = array( 'newcat_parent' => $sup ); 453 454 $x = new WP_Ajax_Response( $add ); 443 455 $x->send(); 444 456 break; … … 997 1009 998 1010 if ( is_array($hidden) ) { 999 $hidden = array_diff( $hidden, array('submitdiv', ' pagesubmitdiv', 'linksubmitdiv') ); // postboxes that are always shown1011 $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown 1000 1012 update_usermeta($user->ID, 'meta-box-hidden_'.$page, $hidden); 1001 1013 }
Note: See TracChangeset
for help on using the changeset viewer.