diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/theme-editor.php --- a/wp/wp-admin/theme-editor.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/theme-editor.php Fri Sep 05 18:40:08 2025 +0200 @@ -50,13 +50,16 @@ get_current_screen()->set_help_sidebar( '
' . __( 'For more information:' ) . '
' . '' . __( 'Documentation on Theme Development' ) . '
' . - '' . __( 'Documentation on Editing Themes' ) . '
' . - '' . __( 'Documentation on Editing Files' ) . '
' . + '' . __( 'Documentation on Editing Themes' ) . '
' . + '' . __( 'Documentation on Editing Files' ) . '
' . '' . __( 'Documentation on Template Tags' ) . '
' . - '' . __( 'Support' ) . '
' + '' . __( 'Support forums' ) . '
' ); -wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) ); +$action = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : ''; +$theme = ! empty( $_REQUEST['theme'] ) ? sanitize_text_field( $_REQUEST['theme'] ) : ''; +$file = ! empty( $_REQUEST['file'] ) ? sanitize_text_field( $_REQUEST['file'] ) : ''; +$error = ! empty( $_REQUEST['error'] ); if ( $theme ) { $stylesheet = $theme; @@ -161,15 +164,19 @@ $f = fopen( $file, 'r' ); $content = fread( $f, filesize( $file ) ); - if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) { + if ( str_ends_with( $file, '.php' ) ) { $functions = wp_doc_link_parse( $content ); - $docs_select = ''; } $content = esc_textarea( $content ); @@ -185,31 +192,44 @@get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); ?>-
' . __( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ) . '
+' . $error_code . ''; + wp_admin_notice( + $message, + array( + 'type' => 'error', + 'id' => 'message', + ) + ); +} - -
-
- built-in CSS editor.' ), - esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) - ); - ?> -
-' . __( 'Did you know?' ) . '
' . sprintf( + /* translators: %s: Link to Custom CSS section in the Customizer. */ + __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the built-in CSS editor.' ), + esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) + ) . '
'; + wp_admin_notice( + $message, + array( + 'type' => 'info', + 'id' => 'message', + ) + ); +} +?>' . __( 'This theme is broken.' ) . ' ' . $theme->errors()->get_error_message() . '
' . __( 'File does not exist! Please double check the name and try again.' ) . '