From 21663b39eaa6aef8d6a5db4ac71bd7531cb9ff73 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 2 Mar 2012 22:31:15 +0000 Subject: [PATCH] Revert [20096] which was an accidental partial revert of [20094]. see #19815. git-svn-id: http://svn.automattic.com/wordpress/trunk@20097 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-theme-install-list-table.php | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) 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 c855bc134..41fbb6450 100644 --- a/wp-admin/includes/class-wp-theme-install-list-table.php +++ b/wp-admin/includes/class-wp-theme-install-list-table.php @@ -7,25 +7,30 @@ * @since 3.1.0 * @access private */ -class WP_Theme_Install_List_Table extends WP_List_Table { +class WP_Theme_Install_List_Table extends WP_Themes_List_Table { - function __construct() { - parent::__construct( array( - 'ajax' => true, - ) ); - } + var $features = array(); 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, $term, $theme_field_defaults; - + global $tabs, $tab, $paged, $type, $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; @@ -55,29 +60,21 @@ class WP_Theme_Install_List_Table extends WP_List_Table { switch ( $tab ) { case 'search': $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; - $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; - switch ( $type ) { case 'tag': - $terms = explode( ',', $term ); - $terms = array_map( 'trim', $terms ); - $terms = array_map( 'sanitize_key', $terms ); - $args['tag'] = $terms; + $args['tag'] = array_map( 'sanitize_title_with_dashes', $search_terms ); break; case 'term': - $args['search'] = $term; + $args['search'] = $search_string; break; case 'author': - $args['author'] = $term; + $args['author'] = $search_string; break; } - 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 ); + if ( ! empty( $this->features ) ) { + $args['tag'] = $this->features; + $_REQUEST['s'] = implode( ',', $this->features ); $_REQUEST['type'] = 'tag'; } @@ -95,7 +92,7 @@ class WP_Theme_Install_List_Table extends WP_List_Table { $args = false; } - if ( !$args ) + if ( ! $args ) return; $api = themes_api( 'query_themes', $args ); @@ -108,6 +105,7 @@ class WP_Theme_Install_List_Table extends WP_List_Table { $this->set_pagination_args( array( 'total_items' => $api->info['results'], 'per_page' => $per_page, + 'infinite_scroll' => true, ) ); } @@ -128,12 +126,7 @@ class WP_Theme_Install_List_Table extends WP_List_Table { return $display_tabs; } - function get_columns() { - return array(); - } - function display() { - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); ?>
@@ -149,12 +142,8 @@ class WP_Theme_Install_List_Table extends WP_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 ) ); + } }