Changeset 15644 for trunk/wp-admin/includes/default-list-tables.php
- Timestamp:
- 09/22/2010 03:28:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/default-list-tables.php
r15642 r15644 3858 3858 class WP_Themes_Table extends WP_List_Table { 3859 3859 3860 var $search = array(); 3861 var $features = array(); 3862 3860 3863 function WP_Themes_Table() { 3861 3864 parent::__construct( array( … … 3875 3878 3876 3879 $themes = get_allowed_themes(); 3880 3881 $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : ''; 3882 3883 if ( '' !== $this->search ) { 3884 $this->search = array_merge( $this->search, array_filter( array_map( 'trim', explode( ',', $search ) ) ) ); 3885 $this->search = array_unique( $this->search ); 3886 foreach ( $themes as $key => $theme ) { 3887 if ( !$this->search_theme( $theme ) ) 3888 unset( $themes[ $key ] ); 3889 } 3890 } 3891 3877 3892 unset( $themes[$ct->name] ); 3878 3893 uksort( $themes, "strnatcasecmp" ); … … 4003 4018 <?php } // end foreach $table 4004 4019 } 4020 4021 function search_theme( $theme ) { 4022 $matched = 0; 4023 4024 // Match all phrases 4025 if ( count( $this->search ) > 0 ) { 4026 foreach ( $this->search as $word ) { 4027 $matched = 0; 4028 4029 // In a tag? 4030 if ( in_array( $word, array_map( 'sanitize_title_with_dashes', $theme['Tags'] ) ) ) 4031 $matched = 1; 4032 4033 // In one of the fields? 4034 foreach ( array( 'Name', 'Title', 'Description', 'Author', 'Template', 'Stylesheet' ) AS $field ) { 4035 if ( stripos( $theme[$field], $word ) !== false ) 4036 $matched++; 4037 } 4038 4039 if ( $matched == 0 ) 4040 return false; 4041 } 4042 } 4043 4044 // Now search the features 4045 if ( count( $this->features ) > 0 ) { 4046 foreach ( $this->features as $word ) { 4047 // In a tag? 4048 if ( !in_array( $word, array_map( 'sanitize_title_with_dashes', $theme['Tags'] ) ) ) 4049 return false; 4050 } 4051 } 4052 4053 // Only get here if each word exists in the tags or one of the fields 4054 return true; 4055 } 4005 4056 } 4006 4057
Note: See TracChangeset
for help on using the changeset viewer.