Ticket #22924: 22924.diff
File 22924.diff, 1.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/theme-editor.php
45 45 46 46 wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) ); 47 47 48 if ( $theme ) 48 if ( $theme ) { 49 49 $stylesheet = $theme; 50 else 50 } else { 51 51 $stylesheet = get_stylesheet(); 52 } 52 53 53 54 $theme = wp_get_theme( $stylesheet ); 54 55 55 if ( ! $theme->exists() ) 56 if ( ! $theme->exists() ) { 56 57 wp_die( __( 'The requested theme does not exist.' ) ); 58 } 57 59 58 if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() ) 60 if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() ) { 59 61 wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() ); 62 } 60 63 61 64 $allowed_files = $theme->get_files( 'php', 1 ); 62 65 $has_templates = ! empty( $allowed_files ); 63 66 $style_files = $theme->get_files( 'css' ); 64 67 $allowed_files['style.css'] = $style_files['style.css']; 65 $allowed_files += $style_files; 68 /** 69 * Filter the allowed files. 70 * 71 * @since 4.2.0 72 * 73 * @param array $style_files List of style files. 74 * @param object $theme The current Theme object. 75 */ 76 $allowed_files += apply_filters( 'wp_theme_editor_filetypes', $style_files, $theme ); 66 77 67 78 if ( empty( $file ) ) { 68 79 $relative_file = 'style.css';