X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/5aa86a9053fb0fa15846bb60aac2fb8fdfff524a..e0feb3b2e5b436a06bbb04fbc838d1cd6ec95399:/wp-admin/plugin-editor.php?ds=sidebyside diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index ef2c6410..6ffadf69 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-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( 'plugin-editor.php' ) ); @@ -20,17 +20,25 @@ if ( !current_user_can('edit_plugins') ) $title = __("Edit Plugins"); $parent_file = 'plugins.php'; -wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'plugin')); +wp_reset_vars( array( 'action', 'error', 'file', 'plugin' ) ); $plugins = get_plugins(); -if ( empty($plugins) ) - wp_die( __('There are no plugins installed on this site.') ); - -if ( isset($_REQUEST['file']) ) - $plugin = stripslashes($_REQUEST['file']); +if ( empty( $plugins ) ) { + include( ABSPATH . 'wp-admin/admin-header.php' ); + ?> +
+

+

+
+ time()) + (array)get_option('recently_activated')); + if ( ! is_network_admin() ) + update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); exit; @@ -76,8 +83,6 @@ case 'update': } exit; -break; - default: if ( isset($_GET['liveupdate']) ) { @@ -96,7 +101,15 @@ default: // List of allowable extensions $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); - $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); + + /** + * Filter file type extensions editable in the plugin editor. + * + * @since 2.8.0 + * + * @param array $editable_extensions An array of editable plugin file extensions. + */ + $editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions ); if ( ! is_file($real_file) ) { wp_die(sprintf('

%s

', __('No such file exists! Double check the name and try again.'))); @@ -116,16 +129,17 @@ default: 'content' => '

' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '

' . '

' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '

' . - '

' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function.') . '

' . + '

' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page 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. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '

' . '

' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '

' . ( is_network_admin() ? '

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

' : '' ) ) ); get_current_screen()->set_help_sidebar( '

' . __('For more information:') . '

' . - '

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

' . - '

' . __('Documentation on Writing Plugins') . '

' . - '

' . __('Support Forums') . '

' + '

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

' . + '

' . __('Documentation on Writing Plugins') . '

' . + '

' . __('Support Forums') . '

' ); require_once(ABSPATH . 'wp-admin/admin-header.php'); @@ -150,7 +164,7 @@ default: $content = esc_textarea( $content ); ?> -

+

fatal error.') ?>

- -

+

@@ -225,42 +238,40 @@ foreach ( $plugin_files as $plugin_file ) :
-
+
-
+
-

Warning: Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?>

+

Warning: Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?>

"; - submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) ); + submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false ); } else { - submit_button( __( 'Update File' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) ); + submit_button( __( 'Update File' ), 'primary', 'submit', false ); } ?>

-

the Codex for more information.'); ?>

+

the Codex for more information.'); ?>