Index: wp-admin/plugin-editor.php =================================================================== --- wp-admin/plugin-editor.php (revision 11178) +++ wp-admin/plugin-editor.php (working copy) @@ -84,47 +84,44 @@ } wp_enqueue_script( 'codepress' ); - add_action( 'admin_print_footer_scripts', 'codepress_footer_js' ); - require_once('admin-header.php'); - - update_recently_edited(WP_PLUGIN_DIR . '/' . $file); - + add_action( 'admin_print_footer_scripts', 'codepress_footer_js' ); + // List of allowable extensions $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); - $extra_extensions = apply_filters('editable_extensions', null); - if ( is_array($extra_extensions) ) - $editable_extensions = array_merge($editable_extensions, $extra_extensions); + $editable_extensions =(array) apply_filters('editable_extensions', $editable_extensions); if ( ! is_file($real_file) ) { - $error = __('No such file exists! Double check the name and try again.'); + wp_die(sprintf('
%s
', __('No such file exists! Double check the name and try again.'))); } else { // Get the extension of the file if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { $ext = strtolower($matches[1]); // If extension is not in the acceptable list, skip it if ( !in_array( $ext, $editable_extensions) ) - $error = __('Files of this type are not editable.'); + wp_die(sprintf('%s
', __('Files of this type are not editable.'))); } } + + update_recently_edited(WP_PLUGIN_DIR . '/' . $file); + + require_once('admin-header.php'); - if ( ! $error ) { - $content = file_get_contents( $real_file ); + $content = file_get_contents( $real_file ); - if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { - $functions = wp_doc_link_parse( $content ); + if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { + $functions = wp_doc_link_parse( $content ); - $docs_select = ''; + $docs_select = ''; } + $content = htmlspecialchars( $content ); + $codepress_lang = codepress_get_lang($real_file); + ?>' . $error . '
'; } ?>