WordPress.org

Make WordPress Core

Changeset 15175


Ignore:
Timestamp:
06/08/2010 03:34:42 PM (8 years ago)
Author:
ryan
Message:

Make set_current_screen() taxonomy aware. Use current_screen when setting up table headers for edit-tags.php. see #13783

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin.php

    r14970 r15175  
    8282
    8383if ( isset($_GET['post_type']) )
    84     $typenow = sanitize_user($_GET['post_type'], true);
     84    $typenow = sanitize_key($_GET['post_type']);
    8585else
    8686    $typenow = '';
     87
     88if ( isset($_GET['taxonomy']) )
     89    $taxnow = sanitize_key($_GET['taxonomy']);
     90else
     91    $taxnow = '';
    8792
    8893require(ABSPATH . 'wp-admin/menu.php');
  • trunk/wp-admin/edit-tags.php

    r15141 r15175  
    297297
    298298<div class="clear"></div>
    299 <?php $table_type = ('category' == $taxonomy ? 'categories' : 'edit-tags'); ?>
    300299<table class="widefat tag fixed" cellspacing="0">
    301300    <thead>
    302301    <tr>
    303 <?php print_column_headers($table_type); ?>
     302<?php print_column_headers($current_screen); ?>
    304303    </tr>
    305304    </thead>
     
    307306    <tfoot>
    308307    <tr>
    309 <?php print_column_headers($table_type, false); ?>
     308<?php print_column_headers($current_screen, false); ?>
    310309    </tr>
    311310    </tfoot>
  • trunk/wp-admin/includes/template.php

    r15148 r15175  
    397397 */
    398398function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
    399         global $post_type;
     399        global $post_type, $current_screen;
    400400        static $row_class = '';
    401401        $row_class = ($row_class == '' ? ' class="alternate"' : '');
     
    423423
    424424
    425         $columns = get_column_headers('edit-tags');
    426         $hidden = get_hidden_columns('edit-tags');
     425        $columns = get_column_headers($current_screen);
     426        $hidden = get_hidden_columns($current_screen);
    427427        $default_term = get_option('default_' . $taxonomy);
    428428        foreach ( $columns as $column_name => $column_display_name ) {
     
    39013901 */
    39023902function set_current_screen( $id =  '' ) {
    3903     global $current_screen, $hook_suffix, $typenow;
     3903    global $current_screen, $hook_suffix, $typenow, $taxnow;
    39043904
    39053905    if ( empty($id) ) {
     
    39333933        $current_screen->id = $typenow;
    39343934        $current_screen->post_type = $typenow;
     3935    } elseif ( 'edit-tags' == $current_screen->id ) {
     3936        if ( empty($taxnow) )
     3937            $taxnow = 'post_tag';
     3938        $current_screen->id = 'edit-' . $taxnow;
     3939        $current_screen->taxonomy = $taxnow;
    39353940    }
    39363941
Note: See TracChangeset for help on using the changeset viewer.