Make WordPress Core

Ticket #26268: 26268.3.diff

File 26268.3.diff, 6.1 KB (added by seanchayes, 10 years ago)
  • src/wp-admin/css/list-tables.css

     
    715715        padding: 2px 0 0;
    716716}
    717717
     718.row-actions a {
     719        white-space: nowrap;
     720}
     721
    718722tr:hover .row-actions,
    719723.mobile .row-actions,
    720724.row-actions.visible,
  • src/wp-admin/edit-tags.php

     
    6565        exit;
    6666break;
    6767
     68case 'default':
     69        $tag_ID = (int) $_REQUEST['tag_ID'];
     70        check_admin_referer( 'default-tag_' . $tag_ID );
     71
     72        if ( !current_user_can( 'manage_options' ) ) {
     73                wp_die( __( 'Cheatin’ uh?' ) );
     74        }
     75
     76        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
     77
     78        if ( !isset( $_REQUEST['tag_ID'] ) ) {
     79                wp_redirect( $location );
     80                exit;
     81        }
     82
     83        $tag_ID = (int) $_REQUEST['tag_ID'];
     84
     85        if ( !term_exists( $tag_ID, $taxonomy ) ) {
     86                wp_redirect( $location );
     87                exit;
     88        }
     89
     90        update_option( 'default_' . $taxonomy,  $tag_ID );
     91
     92        if ( ! empty( $_REQUEST['paged'] ) ) {
     93                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
     94        }
     95
     96        $location = add_query_arg( 'message', 7, $location );
     97
     98        wp_redirect( $location );
     99        exit;
     100
     101break;
     102
    68103case 'delete':
    69104        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
    70105        if ( 'post' != $post_type )
     
    260295        3 => __( 'Item updated.' ),
    261296        4 => __( 'Item not added.' ),
    262297        5 => __( 'Item not updated.' ),
    263         6 => __( 'Items deleted.' )
     298        6 => __( 'Items deleted.' ),
     299        7 => __( 'Item set as default.')
    264300);
    265301$messages['category'] = array(
    266302        0 => '', // Unused. Messages start at index 1.
     
    269305        3 => __( 'Category updated.' ),
    270306        4 => __( 'Category not added.' ),
    271307        5 => __( 'Category not updated.' ),
    272         6 => __( 'Categories deleted.' )
     308        6 => __( 'Categories deleted.' ),
     309        7 => __( 'Category set as default.')
    273310);
    274311$messages['post_tag'] = array(
    275312        0 => '', // Unused. Messages start at index 1.
     
    278315        3 => __( 'Tag updated.' ),
    279316        4 => __( 'Tag not added.' ),
    280317        5 => __( 'Tag not updated.' ),
    281         6 => __( 'Tags deleted.' )
     318        6 => __( 'Tags deleted.' ),
     319        7 => __( 'Tag set as default.')
    282320);
    283321
    284322/**
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    268268
    269269                $default_term = get_option( 'default_' . $taxonomy );
    270270
     271                $default_term_label = '';
     272                if ( $tag->term_id == $default_term ) {
     273                        $default_term_label = ' - <span class="taxonomy-label"> ' . __( 'Default' ) . '</span>';
     274                }
     275                $default_link_args = array(
     276                        'action' => 'default',
     277                        'taxonomy' => $taxonomy,
     278                        'tag_ID' => $tag->term_id,
     279                        'paged' => $this->get_pagenum(),
     280                        );
     281                $default_link = wp_nonce_url( add_query_arg( $default_link_args, admin_url( 'edit-tags.php' ) ), 'default-tag_' . $tag->term_id );
     282
    271283                $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
    272284
    273285                /**
     
    288300                $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
    289301                $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
    290302
    291                 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
     303        $default_categories = array(
     304            'category',
     305            'link_category'
     306        );
     307       
     308                $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a>' . $default_term_label . '</strong><br />';
    292309
    293310                $actions = array();
    294311                if ( current_user_can( $tax->cap->edit_terms ) ) {
    295312                        $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    296                         $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
     313                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
    297314                }
     315                if ( current_user_can( 'manage_options' ) && $tag->term_id != $default_term && ( in_array( $taxonomy, $default_categories ) ) ) {
     316                        $actions['default'] = '<a href="' . $default_link . '">' . __( 'Set as Default' ) . '</a>';
     317                }
    298318                if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
    299319                        $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
    300320                if ( $tax->public )
  • src/wp-admin/options-writing.php

     
    7171<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>
    7272</fieldset></td>
    7373</tr>
    74 <tr>
    75 <th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
    76 <td>
    7774<?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 <?php
    8375$post_formats = get_post_format_strings();
    8476unset( $post_formats['standard'] );
    8577?>
     
    9486        </select>
    9587</td>
    9688</tr>
    97 <?php
    98 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 <?php
    104 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; ?>
    10989
    11090<?php
    11191do_settings_fields('writing', 'default');