Hook up theme filter. see #14936

git-svn-id: http://svn.automattic.com/wordpress/trunk@15807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-10-14 18:37:08 +00:00
parent 0a01e66745
commit 9a0595f302
2 changed files with 14 additions and 4 deletions

View File

@ -3870,7 +3870,7 @@ class WP_Themes_Table extends WP_List_Table {
if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
wp_die( __( 'Cheatin’ uh?' ) );
}
function prepare_items() {
global $ct;
@ -3880,9 +3880,19 @@ class WP_Themes_Table extends WP_List_Table {
$search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : '';
if ( '' !== $this->search ) {
if ( '' !== $search ) {
$this->search = array_merge( $this->search, array_filter( array_map( 'trim', explode( ',', $search ) ) ) );
$this->search = array_unique( $this->search );
}
if ( !empty( $_REQUEST['features'] ) ) {
$this->features = $_REQUEST['features'];
$this->features = array_map( 'trim', $this->features );
$this->features = array_map( 'sanitize_title_with_dashes', $this->features );
$this->features = array_unique( $this->features );
}
if ( $this->search || $this->features ) {
foreach ( $themes as $key => $theme ) {
if ( !$this->search_theme( $theme ) )
unset( $themes[ $key ] );

View File

@ -142,7 +142,7 @@ if ( ! current_user_can( 'switch_themes' ) ) {
<br class="clear"/>
<div id="filters" <?php if ( ! isset( $tpage ) || $tpage != 'filter' ) echo ' style="display: none"' ?>>
<div id="filters" style="display: none;">
<?php $feature_list = get_theme_feature_list(); ?>
<div class="feature-filter">
<p class="install-help"><?php _e('Theme filters') ?></p>
@ -160,7 +160,7 @@ if ( ! current_user_can( 'switch_themes' ) ) {
$feature = esc_attr($feature);
?>
<li>
<input type="checkbox" name="features[<?php echo $key; ?>]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( isset( $checked_features ) && in_array( $key, $checked_features ) ); ?>/>
<input type="checkbox" name="features[<?php echo $key; ?>]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( in_array( $key, $wp_list_table->features ) ); ?>/>
<label for="feature-id-<?php echo $key; ?>"><?php echo $feature_name; ?></label>
</li>
<?php endforeach; ?>