Changeset 42243
- Timestamp:
- 11/27/2017 02:59:27 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-admin/includes/plugin.php
r41819 r42243 195 195 $dir = dirname( $plugin_file ); 196 196 197 $data = get_plugin_data( $plugin_file );198 $label = isset( $data['Version'] )199 ? sanitize_key( 'files_' . $plugin . '-' . $data['Version'] )200 : sanitize_key( 'files_' . $plugin );201 $transient_key = substr( $label, 0, 29 ) . md5( $label );202 203 $plugin_files = get_transient( $transient_key );204 if ( false !== $plugin_files ) {205 return $plugin_files;206 }207 208 197 $plugin_files = array( plugin_basename( $plugin_file ) ); 209 198 … … 225 214 $plugin_files = array_values( array_unique( $plugin_files ) ); 226 215 } 227 228 set_transient( $transient_key, $plugin_files, HOUR_IN_SECONDS );229 216 230 217 return $plugin_files; -
branches/4.9/src/wp-includes/class-wp-theme.php
r41975 r42243 985 985 */ 986 986 public function get_files( $type = null, $depth = 0, $search_parent = false ) { 987 // get and cache all theme files to start with. 988 $label = sanitize_key( 'files_' . $this->cache_hash . '-' . $this->get( 'Version' ) ); 989 $transient_key = substr( $label, 0, 29 ) . md5( $label ); 990 991 $all_files = get_transient( $transient_key ); 992 if ( false === $all_files ) { 993 $all_files = (array) self::scandir( $this->get_stylesheet_directory(), null, -1 ); 994 995 if ( $search_parent && $this->parent() ) { 996 $all_files += (array) self::scandir( $this->get_template_directory(), null, -1 ); 997 } 998 999 set_transient( $transient_key, $all_files, HOUR_IN_SECONDS ); 1000 } 1001 1002 // Filter $all_files by $type & $depth. 1003 $files = array(); 1004 if ( $type ) { 1005 $type = (array) $type; 1006 $_extensions = implode( '|', $type ); 1007 } 1008 foreach ( $all_files as $key => $file ) { 1009 if ( $depth >= 0 && substr_count( $key, '/' ) > $depth ) { 1010 continue; // Filter by depth. 1011 } 1012 if ( ! $type || preg_match( '~\.(' . $_extensions . ')$~', $file ) ) { // Filter by type. 1013 $files[ $key ] = $file; 1014 } 987 $files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth ); 988 989 if ( $search_parent && $this->parent() ) { 990 $files += (array) self::scandir( $this->get_template_directory(), $type, $depth ); 1015 991 } 1016 992
Note: See TracChangeset
for help on using the changeset viewer.