File Editor: Add support for more than one sub-directory level.

The theme and plugin editors now list all files in the selected theme or plugin, recursing through subdirectories as necessary.

Props WraithKenny, schlessera, chsxf, MikeHansenMe, Daedalon, valendesigns, westonruter, pento.
Fixes #6531.



git-svn-id: https://develop.svn.wordpress.org/trunk@41806 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-10-10 05:33:57 +00:00
parent 5deddd9c62
commit 33a0ff50b7
6 changed files with 149 additions and 50 deletions

View File

@@ -75,16 +75,16 @@ $file_types = wp_get_theme_file_editable_extensions( $theme );
foreach ( $file_types as $type ) {
switch ( $type ) {
case 'php':
$allowed_files += $theme->get_files( 'php', 1 );
$allowed_files += $theme->get_files( 'php', -1 );
$has_templates = ! empty( $allowed_files );
break;
case 'css':
$style_files = $theme->get_files( 'css' );
$style_files = $theme->get_files( 'css', -1 );
$allowed_files['style.css'] = $style_files['style.css'];
$allowed_files += $style_files;
break;
default:
$allowed_files += $theme->get_files( $type );
$allowed_files += $theme->get_files( $type, -1 );
break;
}
}