Ticket #14579: 14579-rework-get_list_table.3.diff
File 14579-rework-get_list_table.3.diff, 11.5 KB (added by , 14 years ago) |
---|
-
wp-admin/users.php
12 12 /** WordPress Registration API */ 13 13 require_once( ABSPATH . WPINC . '/registration.php'); 14 14 15 $wp_list_table = get_list_table(' users');15 $wp_list_table = get_list_table('WP_Users_Table'); 16 16 $wp_list_table->check_permissions(); 17 17 18 18 $title = __('Users'); -
wp-admin/edit-comments.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 $wp_list_table = get_list_table(' comments');12 $wp_list_table = get_list_table('WP_Comments_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 $doaction = $wp_list_table->current_action(); -
wp-admin/admin-ajax.php
51 51 if ( isset( $_GET['action'] ) ) : 52 52 switch ( $action = $_GET['action'] ) : 53 53 case 'fetch-list' : 54 require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' );55 // Temp56 require_once( ABSPATH . '/wp-admin/includes/list-table-posts.php' );57 54 58 $class = $_GET['list_args']['class']; 55 $wp_list_table = get_list_table( $_GET['list_args']['class'] ); 56 if ( ! $wp_list_table ) 57 die( '0' ); 59 58 60 if ( class_exists( $class ) ) { 61 $current_screen = (object) $_GET['list_args']['screen']; 62 $wp_list_table = new $class; 63 $wp_list_table->ajax_response(); 64 } 59 $current_screen = (object) $_GET['list_args']['screen']; 60 $wp_list_table->ajax_response(); 65 61 66 die('0');67 62 break; 68 63 case 'ajax-tag-search' : 69 64 if ( !current_user_can( 'edit_posts' ) ) … … 558 553 if ( isset($_POST['screen']) ) 559 554 set_current_screen($_POST['screen']); 560 555 561 $wp_list_table = get_list_table(' terms');556 $wp_list_table = get_list_table('WP_Terms_Table'); 562 557 563 558 $level = 0; 564 559 if ( is_taxonomy_hierarchical($taxonomy) ) { … … 622 617 if ( !current_user_can( 'edit_posts' ) ) 623 618 die('-1'); 624 619 625 $wp_list_table = get_list_table(' comments');620 $wp_list_table = get_list_table('WP_Comments_Table'); 626 621 $wp_list_table->from_ajax = true; 627 622 628 623 $wp_list_table->prepare_items(); … … 651 646 if ( !current_user_can( 'edit_post', $post_ID ) ) 652 647 die('-1'); 653 648 654 $wp_list_table = get_list_table(' post-comments');649 $wp_list_table = get_list_table('WP_Post_Comments_Table'); 655 650 656 651 $wp_list_table->prepare_items(); 657 652 … … 676 671 case 'replyto-comment' : 677 672 check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); 678 673 679 $wp_list_table = get_list_table(' comments');674 $wp_list_table = get_list_table('WP_Comments_Table'); 680 675 $wp_list_table->checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; 681 676 682 677 $comment_post_ID = (int) $_POST['comment_post_ID']; … … 757 752 $comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : ''; 758 753 759 754 $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; 760 $wp_list_table = get_list_table( $checkbox ? ' comments' : 'post-comments' );755 $wp_list_table = get_list_table( $checkbox ? 'WP_Comments_Table' : 'WP_Post_Comments_Table' ); 761 756 762 757 ob_start(); 763 758 $wp_list_table->single_row( get_comment( $comment_id ) ); … … 905 900 } 906 901 $user_object = new WP_User( $user_id ); 907 902 908 $wp_list_table = get_list_table(' users');903 $wp_list_table = get_list_table('WP_Users_Table'); 909 904 910 905 $x = new WP_Ajax_Response( array( 911 906 'what' => 'user', … … 1204 1199 // update the post 1205 1200 edit_post(); 1206 1201 1207 $wp_list_table = get_list_table(' posts');1202 $wp_list_table = get_list_table('WP_Posts_Table'); 1208 1203 1209 1204 $mode = $_POST['post_view']; 1210 1205 $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) ); … … 1214 1209 case 'inline-save-tax': 1215 1210 check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); 1216 1211 1217 $wp_list_table = get_list_table(' terms');1212 $wp_list_table = get_list_table('WP_Terms_Table'); 1218 1213 1219 1214 $wp_list_table->check_permissions('edit'); 1220 1215 -
wp-admin/includes/class-wp-list-table.php
815 815 * 816 816 * @since 3.1.0 817 817 * 818 * @param string $ type The type of the list table819 * @return object 818 * @param string $class The type of the list table, which is the class name except for core list tables. 819 * @return object|bool Object on success, false if the class does not exist. 820 820 */ 821 function get_list_table( $ type) {821 function get_list_table( $class ) { 822 822 require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' ); 823 // Temp824 require_once( ABSPATH . '/wp-admin/includes/list-table-posts.php' );825 823 826 $class = 'WP_' . strtr( ucwords( strtr( $type, '-', ' ') ), ' ', '_' ) . '_Table'; 827 $class = apply_filters( "get_list_table_$type", $class ); 824 $class = apply_filters( 'get_list_table', $class ); 828 825 829 return new $class; 826 require_list_table( $class ); 827 828 if ( class_exists( $class ) ) 829 return new $class; 830 return false; 830 831 } 831 832 833 /** 834 * Include the proper file for a core list table. 835 * 836 * Useful for extending a core class that would not otherwise be required. 837 * 838 * @since 3.1.0 839 * @uses do_action() Calls 'require_list_table_$class' if not a core class to allow 840 * a plugin to conditionally include a class when needed. 841 * 842 * @param string $table The core table to include. 843 */ 844 function require_list_table( $class ) { 845 $core_classes = array( 'WP_Posts_Table', 'WP_Media_Table', 'WP_Terms_Table', 'WP_Users_Table', 846 'WP_Comments_Table', 'WP_Post_Comments_Table', 'WP_Links_Table', 'WP_Sites_Table', 'WP_MS_Users_Table', 847 'WP_Plugins_Table', 'WP_Plugin_Install_Table', 'WP_Themes_Table', 'WP_Theme_Install_Table' ); 848 849 if ( in_array( $class, $core_classes ) ) { 850 $class = strtolower( str_replace( '_', '-', substr( $class, 3, -6 ) ) ); 851 require_once( ABSPATH . '/wp-admin/includes/list-table-' . $class . '.php' ); 852 } else { 853 do_action( "require_list_table_$class" ); 854 } 855 } 856 857 ?> -
wp-admin/includes/meta-boxes.php
461 461 462 462 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 463 463 464 $wp_list_table = get_list_table(' post-comments');464 $wp_list_table = get_list_table('WP_Post_Comments_Table'); 465 465 ?> 466 466 467 467 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;"> -
wp-admin/includes/template.php
329 329 return; 330 330 } 331 331 332 $wp_list_table = get_list_table(' comments');332 $wp_list_table = get_list_table('WP_Comments_Table'); 333 333 334 334 list ( $columns, $hidden ) = $wp_list_table->get_column_info(); 335 335 $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) ); -
wp-admin/edit-tags.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 $wp_list_table = get_list_table(' terms');12 $wp_list_table = get_list_table('WP_Terms_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 $title = $tax->labels->name; -
wp-admin/upload.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once( './admin.php' ); 11 11 12 $wp_list_table = get_list_table(' media');12 $wp_list_table = get_list_table('WP_Media_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 // Handle bulk actions -
wp-admin/plugin-install.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 $wp_list_table = get_list_table(' plugin-install');12 $wp_list_table = get_list_table('WP_Plugin_Install_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 $wp_list_table->prepare_items(); 15 15 -
wp-admin/network/users.php
9 9 10 10 require_once( './admin.php' ); 11 11 12 $wp_list_table = get_list_table(' ms-users');12 $wp_list_table = get_list_table('WP_MS_Users_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 $wp_list_table->prepare_items(); 15 15 -
wp-admin/network/sites.php
12 12 if ( ! is_multisite() ) 13 13 wp_die( __( 'Multisite support is not enabled.' ) ); 14 14 15 $wp_list_table = get_list_table(' sites');15 $wp_list_table = get_list_table('WP_Sites_Table'); 16 16 $wp_list_table->check_permissions(); 17 17 18 18 $title = __( 'Sites' ); -
wp-admin/plugins.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 $wp_list_table = get_list_table(' plugins');12 $wp_list_table = get_list_table('WP_Plugins_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 $action = $wp_list_table->current_action(); -
wp-admin/edit.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once( './admin.php' ); 11 11 12 $wp_list_table = get_list_table(' posts');12 $wp_list_table = get_list_table('WP_Posts_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 // Back-compat for viewing comments of an entry -
wp-admin/link-manager.php
9 9 /** Load WordPress Administration Bootstrap */ 10 10 require_once ('admin.php'); 11 11 12 $wp_list_table = get_list_table(' links');12 $wp_list_table = get_list_table('WP_Links_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 // Handle bulk deletes -
wp-admin/theme-install.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 $wp_list_table = get_list_table(' theme-install');12 $wp_list_table = get_list_table('WP_Theme_Install_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 $wp_list_table->prepare_items(); 15 15 -
wp-admin/themes.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 $wp_list_table = get_list_table(' themes');12 $wp_list_table = get_list_table('WP_Themes_Table'); 13 13 $wp_list_table->check_permissions(); 14 14 15 15 if ( current_user_can('switch_themes') && isset($_GET['action']) ) {