diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php index 41fbb6450..c855bc134 100644 --- a/wp-admin/includes/class-wp-theme-install-list-table.php +++ b/wp-admin/includes/class-wp-theme-install-list-table.php @@ -7,30 +7,25 @@ * @since 3.1.0 * @access private */ -class WP_Theme_Install_List_Table extends WP_Themes_List_Table { +class WP_Theme_Install_List_Table extends WP_List_Table { - var $features = array(); + function __construct() { + parent::__construct( array( + 'ajax' => true, + ) ); + } function ajax_user_can() { - return current_user_can( 'install_themes' ); + return current_user_can('install_themes'); } function prepare_items() { include( ABSPATH . 'wp-admin/includes/theme-install.php' ); - global $tabs, $tab, $paged, $type, $theme_field_defaults; + global $tabs, $tab, $paged, $type, $term, $theme_field_defaults; + wp_reset_vars( array( 'tab' ) ); - $search_terms = array(); - $search_string = ''; - if ( ! empty( $_REQUEST['s'] ) ){ - $search_string = strtolower( stripslashes( $_REQUEST['s'] ) ); - $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); - } - - if ( ! empty( $_REQUEST['features'] ) ) - $this->features = $_REQUEST['features']; - $paged = $this->get_pagenum(); $per_page = 36; @@ -60,21 +55,29 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { switch ( $tab ) { case 'search': $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; + $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; + switch ( $type ) { case 'tag': - $args['tag'] = array_map( 'sanitize_title_with_dashes', $search_terms ); + $terms = explode( ',', $term ); + $terms = array_map( 'trim', $terms ); + $terms = array_map( 'sanitize_key', $terms ); + $args['tag'] = $terms; break; case 'term': - $args['search'] = $search_string; + $args['search'] = $term; break; case 'author': - $args['author'] = $search_string; + $args['author'] = $term; break; } - if ( ! empty( $this->features ) ) { - $args['tag'] = $this->features; - $_REQUEST['s'] = implode( ',', $this->features ); + if ( !empty( $_REQUEST['features'] ) ) { + $terms = $_REQUEST['features']; + $terms = array_map( 'trim', $terms ); + $terms = array_map( 'sanitize_key', $terms ); + $args['tag'] = $terms; + $_REQUEST['s'] = implode( ',', $terms ); $_REQUEST['type'] = 'tag'; } @@ -92,7 +95,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { $args = false; } - if ( ! $args ) + if ( !$args ) return; $api = themes_api( 'query_themes', $args ); @@ -105,7 +108,6 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { $this->set_pagination_args( array( 'total_items' => $api->info['results'], 'per_page' => $per_page, - 'infinite_scroll' => true, ) ); } @@ -126,7 +128,12 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { return $display_tabs; } + function get_columns() { + return array(); + } + function display() { + wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); ?>
@@ -142,8 +149,12 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { display_rows_or_placeholder(); ?>
- + pagination( 'bottom' ); ?> + +
+ + Install screen - * @uses $type Global; type of search. - */ - function _js_vars() { - global $tab, $type; - parent::_js_vars( compact( $tab, $type ) ); - } }