Ticket #26268: 26268.7.diff
File 26268.7.diff, 7.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/list-tables.css
741 741 padding: 2px 0 0; 742 742 } 743 743 744 .row-actions a { 745 white-space: nowrap; 746 } 747 744 748 tr:hover .row-actions, 745 749 .mobile .row-actions, 746 750 .row-actions.visible, -
src/wp-admin/edit-tags.php
66 66 67 67 break; 68 68 69 case 'default': 70 71 if ( ! current_user_can( 'manage_options' ) ) { 72 wp_die( __( 'Cheatin’ uh?' ) ); 73 } 74 75 $location = 'edit-tags.php?taxonomy=' . $taxonomy; 76 if ( ! isset( $_REQUEST['tag_ID'] ) ) { 77 break; 78 } 79 80 $tag_ID = (int) $_REQUEST['tag_ID']; 81 check_admin_referer( 'default-tag_' . $tag_ID ); 82 83 if ( ! term_exists( $tag_ID, $taxonomy ) ) { 84 break; 85 } 86 87 update_option( 'default_' . $taxonomy, $tag_ID ); 88 89 $location = add_query_arg( 'message', 7, $location ); 90 91 break; 92 69 93 case 'delete': 70 94 $location = 'edit-tags.php?taxonomy=' . $taxonomy; 71 95 if ( 'post' != $post_type ) … … 256 280 3 => __( 'Item updated.' ), 257 281 4 => __( 'Item not added.' ), 258 282 5 => __( 'Item not updated.' ), 259 6 => __( 'Items deleted.' ) 283 6 => __( 'Items deleted.' ), 284 7 => __( 'Item set as default.') 260 285 ); 261 286 $messages['category'] = array( 262 287 0 => '', // Unused. Messages start at index 1. … … 265 290 3 => __( 'Category updated.' ), 266 291 4 => __( 'Category not added.' ), 267 292 5 => __( 'Category not updated.' ), 268 6 => __( 'Categories deleted.' ) 293 6 => __( 'Categories deleted.' ), 294 7 => __( 'Category set as default.') 269 295 ); 270 296 $messages['post_tag'] = array( 271 297 0 => '', // Unused. Messages start at index 1. … … 274 300 3 => __( 'Tag updated.' ), 275 301 4 => __( 'Tag not added.' ), 276 302 5 => __( 'Tag not updated.' ), 277 6 => __( 'Tags deleted.' ) 303 6 => __( 'Tags deleted.' ), 304 7 => __( 'Tag set as default.') 278 305 ); 279 306 280 307 /** -
src/wp-admin/includes/class-wp-terms-list-table.php
192 192 } else { 193 193 $children = _get_term_hierarchy( $taxonomy ); 194 194 } 195 // Handle custom display of default category by showing it first in the list 196 197 if ( 'category' == $taxonomy ) { 198 $default_category = get_term( get_option( 'default_category' ), 'category' ); 199 $this->single_row( $default_category ); 200 } 201 195 202 // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake 196 203 $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); 197 204 } else { 198 205 $terms = get_terms( $taxonomy, $args ); 206 207 // Handle custom display of default category by showing it first in the list 208 209 $default_category_id = false; 210 if ( 'category' == $taxonomy ) { 211 $default_category = get_term( get_option( 'default_category' ), 'category' ); 212 $this->single_row( $default_category ); 213 $default_category_id = $default_category->term_id; 214 } 215 199 216 foreach ( $terms as $term ) { 217 if ( $default_category_id == $term->term_taxonomy_id ) { 218 continue; 219 } 200 220 $this->single_row( $term ); 201 221 } 202 222 } … … 206 226 207 227 $end = $start + $per_page; 208 228 229 // Handle display of default category by showing it first in the list, capture default category id 230 231 $default_category_id = false; 232 if ( 'category' == $taxonomy ) { 233 $default_category_id = get_option( 'default_category' ); 234 } 235 209 236 foreach ( $terms as $key => $term ) { 210 237 211 238 if ( $count >= $end ) … … 214 241 if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) 215 242 continue; 216 243 217 // If the page starts in a subtree, print the parents. 244 // Skip duplicating display of default category 245 if ( $default_category_id == $term->term_taxonomy_id ) { 246 continue; 247 } 248 249 // If the page starts in a subtree, print the parents. 218 250 if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { 219 251 $my_parents = $parent_ids = array(); 220 252 $p = $term->parent; … … 280 312 281 313 $default_term = get_option( 'default_' . $taxonomy ); 282 314 315 $default_term_label = ''; 316 if ( $tag->term_id == $default_term ) { 317 $default_term_label = ' - <span class="taxonomy-label"> ' . __( 'Default' ) . '</span>'; 318 } 319 $default_link_args = array( 320 'action' => 'default', 321 'taxonomy' => $taxonomy, 322 'tag_ID' => $tag->term_id, 323 'paged' => $this->get_pagenum(), 324 ); 325 $default_link = wp_nonce_url( add_query_arg( $default_link_args, admin_url( 'edit-tags.php' ) ), 'default-tag_' . $tag->term_id ); 326 283 327 $pad = str_repeat( '— ', max( 0, $this->level ) ); 284 328 285 329 /** … … 300 344 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 301 345 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 302 346 303 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 347 $default_categories = array( 348 'category', 349 'link_category' 350 ); 351 352 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a>' . $default_term_label . '</strong><br />'; 304 353 305 354 $actions = array(); 306 355 if ( current_user_can( $tax->cap->edit_terms ) ) { 307 356 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 308 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';357 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 309 358 } 359 if ( current_user_can( 'manage_options' ) && $tag->term_id != $default_term && ( in_array( $taxonomy, $default_categories ) ) ) { 360 $actions['default'] = '<a href="' . $default_link . '">' . __( 'Set as Default' ) . '</a>'; 361 } 310 362 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 311 363 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>"; 312 364 if ( $tax->public ) -
src/wp-admin/options-writing.php
71 71 <label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label> 72 72 </fieldset></td> 73 73 </tr> 74 <tr>75 <th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>76 <td>77 74 <?php 78 wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true));79 ?>80 </td>81 </tr>82 <?php83 75 $post_formats = get_post_format_strings(); 84 76 unset( $post_formats['standard'] ); 85 77 ?> … … 94 86 </select> 95 87 </td> 96 88 </tr> 97 <?php98 if ( get_option( 'link_manager_enabled' ) ) :99 ?>100 <tr>101 <th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>102 <td>103 <?php104 wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'taxonomy' => 'link_category'));105 ?>106 </td>107 </tr>108 <?php endif; ?>109 89 110 90 <?php 111 91 do_settings_fields('writing', 'default');