Changeset 20193 for trunk/wp-includes/class-wp-theme.php
- Timestamp:
- 03/15/2012 03:39:21 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-theme.php
r20176 r20193 385 385 return $this->get_stylesheet(); 386 386 case 'Template Files' : 387 $files = $this->get_files('php' );387 $files = $this->get_files('php', true); 388 388 foreach ( $files as &$file ) 389 389 $file = $this->theme_root . '/' . $file; 390 390 return $files; 391 391 case 'Stylesheet Files' : 392 $files = $this->get_files('css' );392 $files = $this->get_files('css', true); 393 393 foreach ( $files as &$file ) 394 394 $file = $this->theme_root . '/' . $file; … … 556 556 // Fall through otherwise. 557 557 case 'Name' : 558 case 'Author' :559 558 static $header_tags = array( 560 559 'abbr' => array( 'title' => true ), … … 566 565 $value = wp_kses( $value, $header_tags ); 567 566 break; 567 case 'Author' : 568 // There shouldn't be anchor tags in Author, but some themes like to be challenging. 568 569 case 'Description' : 569 570 static $header_tags_with_a = array( … … 936 937 // Template files can be one level down for the purposes of the theme editor, so this should be $depth = 1. 937 938 // Todo: We ignore this for now, but this is why the branching is weird. 938 $files = (array) self::scandir( $this->get_template_directory(), $this->get_template(), array( 'php', 'css' ) ); 939 $files = self::scandir( $this->get_template_directory(), $this->get_template(), array( 'php', 'css' ) ); 940 else 941 $files = array(); 939 942 if ( $this->is_child_theme() ) 940 943 $files = array_merge_recursive( $files, (array) self::scandir( $this->get_stylesheet_directory(), $this->get_stylesheet(), array( 'php', 'css' ) ) ); … … 990 993 */ 991 994 private static function scandir( $path, $relative_path, $extensions, $depth = 0 ) { 992 if ( is_array( $extensions ) )993 $extensions = implode( '|', $extensions );994 995 995 if ( ! is_dir( $path ) ) 996 996 return false; 997 997 998 998 $results = scandir( $path ); 999 $files = array(); 999 1000 $extensions = (array) $extensions; 1001 $files = array_fill_keys( $extensions, array() ); 1002 $extensions = implode( '|', $extensions ); 1000 1003 1001 1004 foreach ( $results as $result ) { … … 1008 1011 $files = array_merge_recursive( $files, $found ); 1009 1012 } elseif ( preg_match( '~\.(' . $extensions . ')$~', $result, $match ) ) { 1010 if ( ! isset( $files[ $match[1] ] ) ) 1011 $files[ $match[1] ] = array( $relative_path . '/'. $result ); 1012 else 1013 $files[ $match[1] ][] = $relative_path . '/' . $result; 1013 $files[ $match[1] ][] = $relative_path . '/' . $result; 1014 1014 } 1015 1015 }
Note: See TracChangeset
for help on using the changeset viewer.