Make WordPress Core

Ticket #22924: 22924.diff

File 22924.diff, 1.4 KB (added by MikeHansenMe, 10 years ago)

Refreshed with docs

  • src/wp-admin/theme-editor.php

     
    4545
    4646wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
    4747
    48 if ( $theme )
     48if ( $theme ) {
    4949        $stylesheet = $theme;
    50 else
     50} else {
    5151        $stylesheet = get_stylesheet();
     52}
    5253
    5354$theme = wp_get_theme( $stylesheet );
    5455
    55 if ( ! $theme->exists() )
     56if ( ! $theme->exists() ) {
    5657        wp_die( __( 'The requested theme does not exist.' ) );
     58}
    5759
    58 if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() )
     60if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() ) {
    5961        wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
     62}
    6063
    6164$allowed_files = $theme->get_files( 'php', 1 );
    6265$has_templates = ! empty( $allowed_files );
    6366$style_files = $theme->get_files( 'css' );
    6467$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 );
    6677
    6778if ( empty( $file ) ) {
    6879        $relative_file = 'style.css';