Changeset 20097
- Timestamp:
- 03/02/2012 10:31:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-theme-install-list-table.php
r20096 r20097 8 8 * @access private 9 9 */ 10 class WP_Theme_Install_List_Table extends WP_ List_Table {10 class WP_Theme_Install_List_Table extends WP_Themes_List_Table { 11 11 12 function __construct() { 13 parent::__construct( array( 14 'ajax' => true, 15 ) ); 16 } 12 var $features = array(); 17 13 18 14 function ajax_user_can() { 19 return current_user_can( 'install_themes');15 return current_user_can( 'install_themes' ); 20 16 } 21 17 … … 23 19 include( ABSPATH . 'wp-admin/includes/theme-install.php' ); 24 20 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' ) ); 26 23 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']; 28 33 29 34 $paged = $this->get_pagenum(); … … 56 61 case 'search': 57 62 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; 58 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';59 60 63 switch ( $type ) { 61 64 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 ); 66 66 break; 67 67 case 'term': 68 $args['search'] = $ term;68 $args['search'] = $search_string; 69 69 break; 70 70 case 'author': 71 $args['author'] = $ term;71 $args['author'] = $search_string; 72 72 break; 73 73 } 74 74 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 ); 81 78 $_REQUEST['type'] = 'tag'; 82 79 } … … 96 93 } 97 94 98 if ( ! $args )95 if ( ! $args ) 99 96 return; 100 97 … … 109 106 'total_items' => $api->info['results'], 110 107 'per_page' => $per_page, 108 'infinite_scroll' => true, 111 109 ) ); 112 110 } … … 129 127 } 130 128 131 function get_columns() {132 return array();133 }134 135 129 function display() { 136 137 130 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); 138 131 ?> … … 150 143 </div> 151 144 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' ); 158 147 } 159 148 … … 171 160 <?php } // end foreach $theme_names 172 161 } 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 } 173 176 }
Note: See TracChangeset
for help on using the changeset viewer.