X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..1132430022383fdf47fa6cb9377300fd885297aa:/wp-admin/theme-editor.php diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index 8eab0751..d0ecee48 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -7,7 +7,7 @@ */ /** WordPress Administration Bootstrap */ -require_once('./admin.php'); +require_once( dirname( __FILE__ ) . '/admin.php' ); if ( is_multisite() && ! is_network_admin() ) { wp_redirect( network_admin_url( 'theme-editor.php' ) ); @@ -26,10 +26,11 @@ get_current_screen()->add_help_tab( array( 'content' => '

' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '

' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '

-

' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '

+

' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.') . '

+

' . __('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.') . '

' . __('After typing in your edits, click Update File.') . '

' . __('Advice: think very carefully about your site crashing if you are live-editing the theme currently in use.') . '

-

' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a child theme instead.') . '

' . +

' . sprintf( __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a child theme instead.'), __('http://codex.wordpress.org/Child_Themes') ) . '

' . ( is_network_admin() ? '

' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '

' : '' ) ) ); @@ -39,13 +40,13 @@ get_current_screen()->set_help_sidebar( '

' . __('Documentation on Using Themes') . '

' . '

' . __('Documentation on Editing Files') . '

' . '

' . __('Documentation on Template Tags') . '

' . - '

' . __('Support Forums') . '

' + '

' . __('Support Forums') . '

' ); wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) ); if ( $theme ) - $stylesheet = urldecode( $theme ); + $stylesheet = $theme; else $stylesheet = get_stylesheet(); @@ -67,7 +68,7 @@ if ( empty( $file ) ) { $relative_file = 'style.css'; $file = $allowed_files['style.css']; } else { - $relative_file = urldecode( stripslashes( $file ) ); + $relative_file = $file; $file = $theme->get_stylesheet_directory() . '/' . $relative_file; } @@ -77,10 +78,10 @@ $scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0; switch( $action ) { case 'update': check_admin_referer( 'edit-theme_' . $file . $stylesheet ); - $newcontent = stripslashes( $_POST['newcontent'] ); + $newcontent = wp_unslash( $_POST['newcontent'] ); $location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto; if ( is_writeable( $file ) ) { - //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable + // is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable $f = fopen( $file, 'w+' ); if ( $f !== false ) { fwrite( $f, $newcontent ); @@ -91,7 +92,6 @@ case 'update': } wp_redirect( $location ); exit; -break; default: @@ -111,7 +111,7 @@ default: $functions = wp_doc_link_parse( $content ); $docs_select = ' - - - - - +
+ + + + +
- +
@@ -219,7 +217,7 @@ else : ?> '2' ) ); + submit_button( __( 'Update File' ), 'primary', 'submit', true ); else : ?>

the Codex for more information.'); ?>