Make WordPress Core

Changeset 20097


Ignore:
Timestamp:
03/02/2012 10:31:15 PM (12 years ago)
Author:
nacin
Message:

Revert [20096] which was an accidental partial revert of [20094]. see #19815.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-theme-install-list-table.php

    r20096 r20097  
    88 * @access private
    99 */
    10 class WP_Theme_Install_List_Table extends WP_List_Table {
     10class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
    1111
    12     function __construct() {
    13         parent::__construct( array(
    14             'ajax' => true,
    15         ) );
    16     }
     12    var $features = array();
    1713
    1814    function ajax_user_can() {
    19         return current_user_can('install_themes');
     15        return current_user_can( 'install_themes' );
    2016    }
    2117
     
    2319        include( ABSPATH . 'wp-admin/includes/theme-install.php' );
    2420
    25         global $tabs, $tab, $paged, $type, $term, $theme_field_defaults;
     21        global $tabs, $tab, $paged, $type, $theme_field_defaults;
     22        wp_reset_vars( array( 'tab' ) );
    2623
    27         wp_reset_vars( array( 'tab' ) );
     24        $search_terms = array();
     25        $search_string = '';
     26        if ( ! empty( $_REQUEST['s'] ) ){
     27            $search_string = strtolower( stripslashes( $_REQUEST['s'] ) );
     28            $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) );
     29        }
     30
     31        if ( ! empty( $_REQUEST['features'] ) )
     32            $this->features = $_REQUEST['features'];
    2833
    2934        $paged = $this->get_pagenum();
     
    5661            case 'search':
    5762                $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
    58                 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
    59 
    6063                switch ( $type ) {
    6164                    case 'tag':
    62                         $terms = explode( ',', $term );
    63                         $terms = array_map( 'trim', $terms );
    64                         $terms = array_map( 'sanitize_key', $terms );
    65                         $args['tag'] = $terms;
     65                        $args['tag'] = array_map( 'sanitize_title_with_dashes', $search_terms );
    6666                        break;
    6767                    case 'term':
    68                         $args['search'] = $term;
     68                        $args['search'] = $search_string;
    6969                        break;
    7070                    case 'author':
    71                         $args['author'] = $term;
     71                        $args['author'] = $search_string;
    7272                        break;
    7373                }
    7474
    75                 if ( !empty( $_REQUEST['features'] ) ) {
    76                     $terms = $_REQUEST['features'];
    77                     $terms = array_map( 'trim', $terms );
    78                     $terms = array_map( 'sanitize_key', $terms );
    79                     $args['tag'] = $terms;
    80                     $_REQUEST['s'] = implode( ',', $terms );
     75                if ( ! empty( $this->features ) ) {
     76                    $args['tag'] = $this->features;
     77                    $_REQUEST['s'] = implode( ',', $this->features );
    8178                    $_REQUEST['type'] = 'tag';
    8279                }
     
    9693        }
    9794
    98         if ( !$args )
     95        if ( ! $args )
    9996            return;
    10097
     
    109106            'total_items' => $api->info['results'],
    110107            'per_page' => $per_page,
     108            'infinite_scroll' => true,
    111109        ) );
    112110    }
     
    129127    }
    130128
    131     function get_columns() {
    132         return array();
    133     }
    134 
    135129    function display() {
    136 
    137130        wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
    138131?>
     
    150143        </div>
    151144
    152         <div class="tablenav bottom themes">
    153             <?php $this->pagination( 'bottom' ); ?>
    154             <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
    155             <br class="clear" />
    156         </div>
    157 <?php
     145        <?php
     146        parent::tablenav( 'bottom' );
    158147    }
    159148
     
    171160        <?php } // end foreach $theme_names
    172161    }
     162
     163    /**
     164     * Send required variables to JavaScript land
     165     *
     166     * @since 3.4
     167     * @access private
     168     *
     169     * @uses $tab Global; current tab within Themes->Install screen
     170     * @uses $type Global; type of search.
     171     */
     172    function _js_vars() {
     173        global $tab, $type;
     174        parent::_js_vars( compact( $tab, $type ) );
     175    }
    173176}
Note: See TracChangeset for help on using the changeset viewer.