Ticket #22924: 22924.2.diff
File 22924.2.diff, 1.7 KB (added by , 9 years ago) |
---|
-
src/wp-admin/theme-editor.php
61 61 wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() ); 62 62 } 63 63 64 $allowed_files = $theme->get_files( 'php', 1 ); 65 $has_templates = ! empty( $allowed_files ); 66 $style_files = $theme->get_files( 'css' ); 67 $allowed_files['style.css'] = $style_files['style.css']; 64 $allowed_files = $style_files = array(); 65 $has_templates = false; 66 68 67 /** 69 * Filter the allowed files.68 * Filter the list of file types allowed for editing in the Theme editor. 70 69 * 71 70 * @since 4.4.0 72 71 * 73 * @param array $style_files List of style files.72 * @param array $style_files List of file types. Default types include 'php' and 'css'. 74 73 * @param object $theme The current Theme object. 75 74 */ 76 $ allowed_files += apply_filters( 'wp_theme_editor_filetypes', $style_files, $theme );75 $file_types = apply_filters( 'wp_theme_editor_filetypes', array( 'php', 'css' ), $theme ); 77 76 77 $file_types = array_merge( $file_types, array( 'php', 'css' ) ); 78 79 foreach ( $file_types as $type ) { 80 switch ( $type ) { 81 case 'php': 82 $allowed_files += $theme->get_files( 'php', 1 ); 83 $has_templates = ! empty( $allowed_files ); 84 break; 85 case 'css': 86 $style_files = $theme->get_files( 'css' ); 87 $allowed_files['style.css'] = $style_files['style.css']; 88 $allowed_files += $style_files; 89 break; 90 default: 91 $allowed_files += $theme->get_files( $type ); 92 break; 93 } 94 } 95 78 96 if ( empty( $file ) ) { 79 97 $relative_file = 'style.css'; 80 98 $file = $allowed_files['style.css'];