diff --git src/wp-includes/class-wp-theme.php src/wp-includes/class-wp-theme.php
index 171d8b6c58..d577ba7a6d 100644
|
|
|
final class WP_Theme implements ArrayAccess { |
| 984 | 984 | * being absolute paths. |
| 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 ); |
| | 987 | $do_caching = $depth > 1; |
| | 988 | $all_files = false; |
| | 989 | |
| | 990 | if ( $do_caching ) { |
| | 991 | // get and cache all theme files to start with. |
| | 992 | $label = sanitize_key( 'files_' . $this->cache_hash . '-' . $this->get( 'Version' ) ); |
| | 993 | $transient_key = substr( $label, 0, 29 ) . md5( $label ); |
| | 994 | |
| | 995 | $all_files = get_transient( $transient_key ); |
| | 996 | } |
| 990 | 997 | |
| 991 | | $all_files = get_transient( $transient_key ); |
| 992 | 998 | if ( false === $all_files ) { |
| 993 | 999 | $all_files = (array) self::scandir( $this->get_stylesheet_directory(), null, -1 ); |
| 994 | 1000 | |
| … |
… |
final class WP_Theme implements ArrayAccess { |
| 996 | 1002 | $all_files += (array) self::scandir( $this->get_template_directory(), null, -1 ); |
| 997 | 1003 | } |
| 998 | 1004 | |
| 999 | | set_transient( $transient_key, $all_files, HOUR_IN_SECONDS ); |
| | 1005 | $do_caching && set_transient( $transient_key, $all_files, 5 * MINUTE_IN_SECONDS ); |
| 1000 | 1006 | } |
| 1001 | 1007 | |
| 1002 | 1008 | // Filter $all_files by $type & $depth. |