Make WordPress Core

Ticket #26268: 26268.5.diff

File 26268.5.diff, 5.9 KB (added by wonderboymusic, 10 years ago)
  • src/wp-admin/css/list-tables.css

     
    741741        padding: 2px 0 0;
    742742}
    743743
     744.row-actions a {
     745        white-space: nowrap;
     746}
     747
    744748tr:hover .row-actions,
    745749.mobile .row-actions,
    746750.row-actions.visible,
  • src/wp-admin/edit-tags.php

     
    6666
    6767        break;
    6868
     69case '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
    6993case 'delete':
    7094        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
    7195        if ( 'post' != $post_type )
     
    256280        3 => __( 'Item updated.' ),
    257281        4 => __( 'Item not added.' ),
    258282        5 => __( 'Item not updated.' ),
    259         6 => __( 'Items deleted.' )
     283        6 => __( 'Items deleted.' ),
     284        7 => __( 'Item set as default.')
    260285);
    261286$messages['category'] = array(
    262287        0 => '', // Unused. Messages start at index 1.
     
    265290        3 => __( 'Category updated.' ),
    266291        4 => __( 'Category not added.' ),
    267292        5 => __( 'Category not updated.' ),
    268         6 => __( 'Categories deleted.' )
     293        6 => __( 'Categories deleted.' ),
     294        7 => __( 'Category set as default.')
    269295);
    270296$messages['post_tag'] = array(
    271297        0 => '', // Unused. Messages start at index 1.
     
    274300        3 => __( 'Tag updated.' ),
    275301        4 => __( 'Tag not added.' ),
    276302        5 => __( 'Tag not updated.' ),
    277         6 => __( 'Tags deleted.' )
     303        6 => __( 'Tags deleted.' ),
     304        7 => __( 'Tag set as default.')
    278305);
    279306
    280307/**
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    280280
    281281                $default_term = get_option( 'default_' . $taxonomy );
    282282
     283                $default_term_label = '';
     284                if ( $tag->term_id == $default_term ) {
     285                        $default_term_label = ' - <span class="taxonomy-label"> ' . __( 'Default' ) . '</span>';
     286                }
     287                $default_link_args = array(
     288                        'action' => 'default',
     289                        'taxonomy' => $taxonomy,
     290                        'tag_ID' => $tag->term_id,
     291                        'paged' => $this->get_pagenum(),
     292                        );
     293                $default_link = wp_nonce_url( add_query_arg( $default_link_args, admin_url( 'edit-tags.php' ) ), 'default-tag_' . $tag->term_id );
     294
    283295                $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
    284296
    285297                /**
     
    300312                $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
    301313                $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
    302314
    303                 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
     315        $default_categories = array(
     316            'category',
     317            'link_category'
     318        );
     319       
     320                $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 />';
    304321
    305322                $actions = array();
    306323                if ( current_user_can( $tax->cap->edit_terms ) ) {
    307324                        $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    308                         $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
     325                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
    309326                }
     327                if ( current_user_can( 'manage_options' ) && $tag->term_id != $default_term && ( in_array( $taxonomy, $default_categories ) ) ) {
     328                        $actions['default'] = '<a href="' . $default_link . '">' . __( 'Set as Default' ) . '</a>';
     329                }
    310330                if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
    311331                        $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>";
    312332                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');