Changeset 21914
- Timestamp:
- 09/19/2012 12:43:31 PM (11 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r21866 r21914 30 30 */ 31 31 function wp_ajax_fetch_list() { 32 global $ current_screen, $wp_list_table;32 global $wp_list_table; 33 33 34 34 $list_class = $_GET['list_args']['class']; 35 35 check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' ); 36 36 37 $current_screen = convert_to_screen( $_GET['list_args']['screen']['id'] ); 38 39 define( 'WP_NETWORK_ADMIN', $current_screen->is_network ); 40 define( 'WP_USER_ADMIN', $current_screen->is_user ); 41 42 $wp_list_table = _get_list_table( $list_class ); 37 $wp_list_table = _get_list_table( $list_class, array( 'screen' => $_GET['list_args']['screen']['id'] ) ); 43 38 if ( ! $wp_list_table ) 44 39 wp_die( 0 ); … … 616 611 } 617 612 618 set_current_screen( $_POST['screen'] ); 619 620 $wp_list_table = _get_list_table('WP_Terms_List_Table'); 613 $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) ); 621 614 622 615 $level = 0; … … 687 680 check_ajax_referer( $action ); 688 681 689 set_current_screen( 'edit-comments' ); 690 691 $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); 682 $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 692 683 693 684 if ( !current_user_can( 'edit_post', $post_id ) ) … … 723 714 724 715 check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); 725 726 set_current_screen( 'edit-comments' );727 716 728 717 $comment_post_ID = (int) $_POST['comment_post_ID']; … … 783 772 } else { 784 773 if ( 'single' == $_REQUEST['mode'] ) { 785 $wp_list_table = _get_list_table('WP_Post_Comments_List_Table' );774 $wp_list_table = _get_list_table('WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 786 775 } else { 787 $wp_list_table = _get_list_table('WP_Comments_List_Table' );776 $wp_list_table = _get_list_table('WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 788 777 } 789 778 $wp_list_table->single_row( $comment ); … … 812 801 check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); 813 802 814 set_current_screen( 'edit-comments' );815 816 803 $comment_id = (int) $_POST['comment_ID']; 817 804 if ( ! current_user_can( 'edit_comment', $comment_id ) ) … … 828 815 829 816 $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; 830 $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table' );817 $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 831 818 832 819 $comment = get_comment( $comment_id ); … … 1331 1318 } 1332 1319 1333 set_current_screen( $_POST['screen'] );1334 1335 1320 if ( $last = wp_check_post_lock( $post_ID ) ) { 1336 1321 $last_user = get_userdata( $last ); … … 1368 1353 edit_post(); 1369 1354 1370 $wp_list_table = _get_list_table( 'WP_Posts_List_Table');1355 $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) ); 1371 1356 1372 1357 $mode = $_POST['post_view']; … … 1400 1385 wp_die( -1 ); 1401 1386 1402 set_current_screen( 'edit-' . $taxonomy ); 1403 1404 $wp_list_table = _get_list_table('WP_Terms_List_Table'); 1387 $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) ); 1405 1388 1406 1389 if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) ) -
trunk/wp-admin/includes/class-wp-links-list-table.php
r21789 r21914 10 10 class WP_Links_List_Table extends WP_List_Table { 11 11 12 function __construct( ) {12 function __construct( $args = array() ) { 13 13 parent::__construct( array( 14 14 'plural' => 'bookmarks', 15 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 15 16 ) ); 16 17 } -
trunk/wp-admin/includes/class-wp-list-table.php
r21789 r21914 82 82 'plural' => '', 83 83 'singular' => '', 84 'ajax' => false 84 'ajax' => false, 85 'screen' => null, 85 86 ) ); 86 87 87 $ screen = get_current_screen();88 89 add_filter( "manage_{$ screen->id}_columns", array( &$this, 'get_columns' ), 0 );88 $this->screen = convert_to_screen( $args['screen'] ); 89 90 add_filter( "manage_{$this->screen->id}_columns", array( &$this, 'get_columns' ), 0 ); 90 91 91 92 if ( !$args['plural'] ) 92 $args['plural'] = $ screen->base;93 $args['plural'] = $this->screen->base; 93 94 94 95 $args['plural'] = sanitize_key( $args['plural'] ); … … 243 244 */ 244 245 function views() { 245 $screen = get_current_screen();246 247 246 $views = $this->get_views(); 248 $views = apply_filters( 'views_' . $ screen->id, $views );247 $views = apply_filters( 'views_' . $this->screen->id, $views ); 249 248 250 249 if ( empty( $views ) ) … … 279 278 */ 280 279 function bulk_actions() { 281 $screen = get_current_screen();282 283 280 if ( is_null( $this->_actions ) ) { 284 281 $no_new_actions = $this->_actions = $this->get_bulk_actions(); 285 282 // This filter can currently only be used to remove actions. 286 $this->_actions = apply_filters( 'bulk_actions-' . $ screen->id, $this->_actions );283 $this->_actions = apply_filters( 'bulk_actions-' . $this->screen->id, $this->_actions ); 287 284 $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions ); 288 285 $two = ''; … … 605 602 return $this->_column_headers; 606 603 607 $screen = get_current_screen(); 608 609 $columns = get_column_headers( $screen ); 610 $hidden = get_hidden_columns( $screen ); 611 612 $_sortable = apply_filters( "manage_{$screen->id}_sortable_columns", $this->get_sortable_columns() ); 604 $columns = get_column_headers( $this->screen ); 605 $hidden = get_hidden_columns( $this->screen ); 606 607 $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $this->get_sortable_columns() ); 613 608 614 609 $sortable = array(); … … 652 647 */ 653 648 function print_column_headers( $with_id = true ) { 654 $screen = get_current_screen();655 656 649 list( $columns, $hidden, $sortable ) = $this->get_column_info(); 657 650 … … 915 908 */ 916 909 function _js_vars() { 917 $current_screen = get_current_screen();918 919 910 $args = array( 920 911 'class' => get_class( $this ), 921 912 'screen' => array( 922 'id' => $ current_screen->id,923 'base' => $ current_screen->base,913 'id' => $this->screen->id, 914 'base' => $this->screen->base, 924 915 ) 925 916 ); -
trunk/wp-admin/includes/class-wp-media-list-table.php
r21880 r21914 10 10 class WP_Media_List_Table extends WP_List_Table { 11 11 12 function __construct( ) {12 function __construct( $args = array() ) { 13 13 $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); 14 14 15 15 parent::__construct( array( 16 'plural' => 'media' 16 'plural' => 'media', 17 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 17 18 ) ); 18 19 } -
trunk/wp-admin/includes/class-wp-ms-sites-list-table.php
r21414 r21914 10 10 class WP_MS_Sites_List_Table extends WP_List_Table { 11 11 12 function __construct( ) {12 function __construct( $args = array() ) { 13 13 parent::__construct( array( 14 14 'plural' => 'sites', 15 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 15 16 ) ); 16 17 } -
trunk/wp-admin/includes/class-wp-ms-themes-list-table.php
r21755 r21914 13 13 var $is_site_themes; 14 14 15 function __construct( ) {15 function __construct( $args = array() ) { 16 16 global $status, $page; 17 18 parent::__construct( array( 19 'plural' => 'themes', 20 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 21 ) ); 17 22 18 23 $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all'; … … 22 27 $page = $this->get_pagenum(); 23 28 24 $screen = get_current_screen(); 25 $this->is_site_themes = ( 'site-themes-network' == $screen->id ) ? true : false; 29 $this->is_site_themes = ( 'site-themes-network' == $this->screen->id ) ? true : false; 26 30 27 31 if ( $this->is_site_themes ) 28 32 $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 29 30 parent::__construct( array(31 'plural' => 'themes'32 ) );33 33 } 34 34 -
trunk/wp-admin/includes/class-wp-plugins-list-table.php
r21789 r21914 10 10 class WP_Plugins_List_Table extends WP_List_Table { 11 11 12 function __construct( ) {12 function __construct( $args = array() ) { 13 13 global $status, $page; 14 15 parent::__construct( array( 16 'plural' => 'plugins', 17 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 18 ) ); 14 19 15 20 $status = 'all'; … … 21 26 22 27 $page = $this->get_pagenum(); 23 24 parent::__construct( array(25 'plural' => 'plugins',26 ) );27 28 } 28 29 … … 51 52 ); 52 53 53 $screen = get_current_screen();54 $screen = $this->screen; 54 55 55 56 if ( ! is_multisite() || ( $screen->is_network && current_user_can('manage_network_plugins') ) ) { … … 92 93 $plugins['active'][ $plugin_file ] = $plugin_data; 93 94 } else { 94 if ( ! $screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?95 if ( ! $screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated? 95 96 $plugins['recently_activated'][ $plugin_file ] = $plugin_data; 96 97 $plugins['inactive'][ $plugin_file ] = $plugin_data; … … 237 238 $actions = array(); 238 239 239 $screen = get_current_screen();240 241 240 if ( 'active' != $status ) 242 $actions['activate-selected'] = $ screen->is_network ? __( 'Network Activate' ) : __( 'Activate' );241 $actions['activate-selected'] = $this->screen->is_network ? __( 'Network Activate' ) : __( 'Activate' ); 243 242 244 243 if ( 'inactive' != $status && 'recent' != $status ) 245 $actions['deactivate-selected'] = $ screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' );246 247 if ( !is_multisite() || $ screen->is_network ) {244 $actions['deactivate-selected'] = $this->screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' ); 245 246 if ( !is_multisite() || $this->screen->is_network ) { 248 247 if ( current_user_can( 'update_plugins' ) ) 249 248 $actions['update-selected'] = __( 'Update' ); … … 272 271 echo '<div class="alignleft actions">'; 273 272 274 $screen = get_current_screen(); 275 276 if ( ! $screen->is_network && 'recently_activated' == $status ) 273 if ( ! $this->screen->is_network && 'recently_activated' == $status ) 277 274 submit_button( __( 'Clear List' ), 'small', 'clear-recent-list', false ); 278 275 elseif ( 'top' == $which && 'mustuse' == $status ) … … 294 291 global $status; 295 292 296 $screen = get_current_screen(); 297 298 if ( is_multisite() && !$screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) ) 293 if ( is_multisite() && ! $this->screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) ) 299 294 return; 300 295 … … 307 302 308 303 $context = $status; 309 310 $screen = get_current_screen(); 304 $screen = $this->screen; 311 305 312 306 // preorder -
trunk/wp-admin/includes/class-wp-posts-list-table.php
r21806 r21914 46 46 var $sticky_posts_count = 0; 47 47 48 function __construct( ) {48 function __construct( $args = array() ) { 49 49 global $post_type_object, $wpdb; 50 50 51 $post_type = get_current_screen()->post_type; 51 parent::__construct( array( 52 'plural' => 'posts', 53 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 54 ) ); 55 56 $post_type = $this->screen->post_type; 52 57 $post_type_object = get_post_type_object( $post_type ); 53 58 … … 67 72 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) ); 68 73 } 69 70 parent::__construct( array(71 'plural' => 'posts',72 ) );73 74 } 74 75 75 76 function ajax_user_can() { 76 global $post_type_object; 77 78 return current_user_can( $post_type_object->cap->edit_posts ); 77 return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); 79 78 } 80 79 81 80 function prepare_items() { 82 global $ post_type_object, $avail_post_stati, $wp_query, $per_page, $mode;81 global $avail_post_stati, $wp_query, $per_page, $mode; 83 82 84 83 $avail_post_stati = wp_edit_posts_query(); 85 84 86 $this->hierarchical_display = ( $post_type_object->hierarchical&& 'menu_order title' == $wp_query->query['orderby'] );85 $this->hierarchical_display = ( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] ); 87 86 88 87 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; 89 88 90 $post_type = $ post_type_object->name;89 $post_type = $this->screen->post_type; 91 90 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); 92 91 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); … … 113 112 114 113 function no_items() { 115 global $post_type_object;116 117 114 if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] ) 118 echo $post_type_object->labels->not_found_in_trash;115 echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; 119 116 else 120 echo $post_type_object->labels->not_found;117 echo get_post_type_object( $this->screen->post_type )->labels->not_found; 121 118 } 122 119 123 120 function get_views() { 124 global $ post_type_object, $locked_post_status, $avail_post_stati;125 126 $post_type = $ post_type_object->name;121 global $locked_post_status, $avail_post_stati; 122 123 $post_type = $this->screen->post_type; 127 124 128 125 if ( !empty($locked_post_status) ) … … 199 196 200 197 function extra_tablenav( $which ) { 201 global $ post_type_object, $cat;198 global $cat; 202 199 ?> 203 200 <div class="alignleft actions"> … … 205 202 if ( 'top' == $which && !is_singular() ) { 206 203 207 $this->months_dropdown( $ post_type_object->name );208 209 if ( is_object_in_taxonomy( $ post_type_object->name, 'category' ) ) {204 $this->months_dropdown( $this->screen->post_type ); 205 206 if ( is_object_in_taxonomy( $this->screen->post_type, 'category' ) ) { 210 207 $dropdown_options = array( 211 208 'show_option_all' => __( 'View all categories' ), … … 222 219 } 223 220 224 if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {221 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) { 225 222 submit_button( __( 'Empty Trash' ), 'small apply', 'delete_all', false ); 226 223 } … … 238 235 239 236 function pagination( $which ) { 240 global $ post_type_object, $mode;237 global $mode; 241 238 242 239 parent::pagination( $which ); 243 240 244 if ( 'top' == $which && ! $post_type_object->hierarchical)241 if ( 'top' == $which && ! is_post_type_hierarchical( $this->screen->post_type ) ) 245 242 $this->view_switcher( $mode ); 246 243 } 247 244 248 245 function get_table_classes() { 249 global $post_type_object; 250 251 return array( 'widefat', 'fixed', $post_type_object->hierarchical ? 'pages' : 'posts' ); 246 return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' ); 252 247 } 253 248 254 249 function get_columns() { 255 $screen = get_current_screen(); 256 257 if ( empty( $screen ) ) 258 $post_type = 'post'; 259 else 260 $post_type = $screen->post_type; 250 $post_type = $this->screen->post_type; 261 251 262 252 $posts_columns = array(); … … 314 304 315 305 function display_rows( $posts = array(), $level = 0 ) { 316 global $wp_query, $p ost_type_object, $per_page;306 global $wp_query, $per_page; 317 307 318 308 if ( empty( $posts ) ) … … 702 692 global $mode; 703 693 704 $screen = get_current_screen();694 $screen = $this->screen; 705 695 706 696 $post = get_default_post_to_edit( $screen->post_type ); … … 734 724 while ( $bulk < 2 ) { ?> 735 725 736 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit- $screen->post_type ";737 echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit- $screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";726 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-" . $screen->post_type; 727 echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}" : "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; 738 728 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 739 729 -
trunk/wp-admin/includes/class-wp-terms-list-table.php
r21323 r21914 12 12 var $callback_args; 13 13 14 function __construct() { 15 global $post_type, $taxonomy, $tax; 16 17 wp_reset_vars( array( 'action', 'taxonomy', 'post_type' ) ); 18 19 if ( empty( $taxonomy ) ) 20 $taxonomy = 'post_tag'; 21 22 if ( !taxonomy_exists( $taxonomy ) ) 23 wp_die( __( 'Invalid taxonomy' ) ); 24 25 $tax = get_taxonomy( $taxonomy ); 26 27 if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) 28 $post_type = 'post'; 14 function __construct( $args = array() ) { 15 global $post_type, $taxonomy, $action, $tax; 29 16 30 17 parent::__construct( array( 31 18 'plural' => 'tags', 32 19 'singular' => 'tag', 20 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 33 21 ) ); 22 23 $action = $this->screen->action; 24 $post_type = $this->screen->post_type; 25 $taxonomy = $this->screen->taxonomy; 26 27 if ( empty( $taxonomy ) ) 28 $taxonomy = 'post_tag'; 29 30 if ( ! taxonomy_exists( $taxonomy ) ) 31 wp_die( __( 'Invalid taxonomy' ) ); 32 33 $tax = get_taxonomy( $taxonomy ); 34 35 // @todo Still needed? Maybe just the show_ui part. 36 if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) 37 $post_type = 'post'; 38 34 39 } 35 40 36 41 function ajax_user_can() { 37 global $tax; 38 39 return current_user_can( $tax->cap->manage_terms ); 42 return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms ); 40 43 } 41 44 42 45 function prepare_items() { 43 global $taxonomy; 44 45 $tags_per_page = $this->get_items_per_page( 'edit_' . $taxonomy . '_per_page' ); 46 47 if ( 'post_tag' == $taxonomy ) { 46 $tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' ); 47 48 if ( 'post_tag' == $this->screen->taxonomy ) { 48 49 $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page ); 49 50 $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter 50 } elseif ( 'category' == $t axonomy ) {51 } elseif ( 'category' == $this->screen->taxonomy ) { 51 52 $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter 52 53 } … … 69 70 70 71 $this->set_pagination_args( array( 71 'total_items' => wp_count_terms( $t axonomy, compact( 'search' ) ),72 'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ), 72 73 'per_page' => $tags_per_page, 73 74 ) ); … … 94 95 95 96 function get_columns() { 96 global $taxonomy, $post_type;97 98 97 $columns = array( 99 98 'cb' => '<input type="checkbox" />', … … 103 102 ); 104 103 105 if ( 'link_category' == $t axonomy ) {104 if ( 'link_category' == $this->screen->taxonomy ) { 106 105 $columns['links'] = __( 'Links' ); 107 106 } else { 108 $post_type_object = get_post_type_object( $ post_type );107 $post_type_object = get_post_type_object( $this->screen->post_type ); 109 108 $columns['posts'] = $post_type_object ? $post_type_object->labels->name : __( 'Posts' ); 110 109 } … … 124 123 125 124 function display_rows_or_placeholder() { 126 global $taxonomy;125 $taxonomy = $this->screen->taxonomy; 127 126 128 127 $args = wp_parse_args( $this->callback_args, array( … … 232 231 233 232 function column_cb( $tag ) { 234 global $taxonomy, $tax; 235 236 $default_term = get_option( 'default_' . $taxonomy ); 237 238 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 233 $default_term = get_option( 'default_' . $this->screen->taxonomy ); 234 235 if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) && $tag->term_id != $default_term ) 239 236 return '<label class="screen-reader-text" for="cb-select-' . $tag->term_id . '">' . sprintf( __( 'Select %s' ), $tag->name ) . '</label>' 240 237 . '<input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" id="cb-select-' . $tag->term_id . '" />'; … … 244 241 245 242 function column_name( $tag ) { 246 global $taxonomy, $tax, $post_type; 243 $taxonomy = $this->screen->taxonomy; 244 $tax = get_taxonomy( $taxonomy ); 247 245 248 246 $default_term = get_option( 'default_' . $taxonomy ); … … 251 249 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 252 250 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 253 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $ post_type ) );251 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 254 252 255 253 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; … … 285 283 286 284 function column_posts( $tag ) { 287 global $taxonomy, $post_type;288 289 285 $count = number_format_i18n( $tag->count ); 290 286 291 $tax = get_taxonomy( $t axonomy );292 293 $ptype_object = get_post_type_object( $ post_type );287 $tax = get_taxonomy( $this->screen->taxonomy ); 288 289 $ptype_object = get_post_type_object( $this->screen->post_type ); 294 290 if ( ! $ptype_object->show_ui ) 295 291 return $count; … … 301 297 } 302 298 303 if ( 'post' != $ post_type )304 $args['post_type'] = $ post_type;299 if ( 'post' != $this->screen->post_type ) 300 $args['post_type'] = $this->screen->post_type; 305 301 306 302 return "<a href='" . esc_url ( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>"; … … 315 311 316 312 function column_default( $tag, $column_name ) { 317 $screen = get_current_screen(); 318 319 return apply_filters( "manage_{$screen->taxonomy}_custom_column", '', $column_name, $tag->term_id ); 313 return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id ); 320 314 } 321 315 … … 326 320 */ 327 321 function inline_edit() { 328 global $post_type, $tax;322 $tax = get_taxonomy( $this->screen->taxonomy ); 329 323 330 324 if ( ! current_user_can( $tax->cap->edit_terms ) ) … … 359 353 continue; 360 354 361 do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $t ax->name);355 do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy ); 362 356 } 363 357 … … 371 365 <span class="error" style="display:none;"></span> 372 366 <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?> 373 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $t ax->name); ?>" />374 <input type="hidden" name="post_type" value="<?php echo esc_attr( $ post_type ); ?>" />367 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" /> 368 <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" /> 375 369 <br class="clear" /> 376 370 </p> -
trunk/wp-admin/includes/class-wp-themes-list-table.php
r21816 r21914 13 13 var $features = array(); 14 14 15 function __construct( ) {15 function __construct( $args = array() ) { 16 16 parent::__construct( array( 17 17 'ajax' => true, 18 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 18 19 ) ); 19 20 } -
trunk/wp-admin/includes/class-wp-users-list-table.php
r21864 r21914 13 13 var $is_site_users; 14 14 15 function __construct() { 16 $screen = get_current_screen(); 17 $this->is_site_users = 'site-users-network' == $screen->id; 18 19 if ( $this->is_site_users ) 20 $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 21 15 function __construct( $args = array() ) { 22 16 parent::__construct( array( 23 17 'singular' => 'user', 24 'plural' => 'users' 18 'plural' => 'users', 19 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 25 20 ) ); 21 22 $this->is_site_users = 'site-users-network' == $this->screen->id; 23 24 if ( $this->is_site_users ) 25 $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 26 26 } 27 27 -
trunk/wp-admin/includes/list-table.php
r20094 r21914 15 15 * 16 16 * @param string $class The type of the list table, which is the class name. 17 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. 17 18 * @return object|bool Object on success, false if the class does not exist. 18 19 */ 19 function _get_list_table( $class ) {20 function _get_list_table( $class, $args = array() ) { 20 21 $core_classes = array( 21 22 //Site Admin … … 40 41 foreach ( (array) $core_classes[ $class ] as $required ) 41 42 require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' ); 42 return new $class; 43 44 if ( isset( $args['screen'] ) ) 45 $args['screen'] = convert_to_screen( $args['screen'] ); 46 else 47 $args['screen'] = get_current_screen(); 48 49 return new $class( $args ); 43 50 } 44 51
Note: See TracChangeset
for help on using the changeset viewer.