X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8ab4a4532479e8db471032b51042ec8c4716d091..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-admin/plugin-editor.php diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index f6033e9a..ab8968db 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -15,20 +15,18 @@ if ( is_multisite() && ! is_network_admin() ) { } if ( !current_user_can('edit_plugins') ) - wp_die( __('You do not have sufficient permissions to edit plugins for this site.') ); + wp_die( __('Sorry, you are not allowed to edit plugins for this site.') ); $title = __("Edit Plugins"); $parent_file = 'plugins.php'; -wp_reset_vars( array( 'action', 'error', 'file', 'plugin' ) ); - $plugins = get_plugins(); if ( empty( $plugins ) ) { include( ABSPATH . 'wp-admin/admin-header.php' ); ?>
-

+

time() ) + (array) get_option( 'recently_activated' ) ); + } else { + update_site_option( 'recently_activated', array( $file => time() ) + (array) get_site_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)); + wp_redirect( add_query_arg( '_wpnonce', wp_create_nonce( 'edit-plugin-test_' . $file ), "plugin-editor.php?file=$file&plugin=$plugin&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide ) ); exit; } - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); + wp_redirect( self_admin_url( "plugin-editor.php?file=$file&plugin=$plugin&a=te&scrollto=$scrollto" ) ); } else { - wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ); + wp_redirect( self_admin_url( "plugin-editor.php?file=$file&plugin=$plugin&scrollto=$scrollto" ) ); } exit; -default: +} else { if ( isset($_GET['liveupdate']) ) { check_admin_referer('edit-plugin-test_' . $file); - $error = validate_plugin($file); - if ( is_wp_error($error) ) + $error = validate_plugin( $plugin ); + + if ( is_wp_error( $error ) ) { wp_die( $error ); + } - if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) - activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error + if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network( $file ) ) || ! is_plugin_active( $file ) ) { + activate_plugin( $plugin, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); + } // we'll override this later if the plugin can be included without fatal error - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); + wp_redirect( self_admin_url("plugin-editor.php?file=$file&plugin=$plugin&a=te&scrollto=$scrollto") ); exit; } @@ -103,7 +118,7 @@ default: $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); /** - * Filter file type extensions editable in the plugin editor. + * Filters file type extensions editable in the plugin editor. * * @since 2.8.0 * @@ -128,7 +143,7 @@ default: 'title' => __('Overview'), '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.') . '

' . + '

' . __('Choose a plugin to edit from the dropdown menu 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 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.') . '

' . @@ -137,9 +152,9 @@ default: 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'); @@ -168,27 +183,39 @@ default:

fatal error.') ?>

- + if ( wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $file ) ) { + $iframe_url = add_query_arg( array( + 'action' => 'error_scrape', + 'plugin' => urlencode( $file ), + '_wpnonce' => urlencode( $_GET['_error_nonce'] ), + ), admin_url( 'plugins.php' ) ); + ?> +
-

+

%s (active)'), $file); - else - echo sprintf(__('Browsing %s (active)'), $file); + if ( is_plugin_active( $plugin ) ) { + if ( is_writeable( $real_file ) ) { + /* translators: %s: plugin file name */ + echo sprintf( __( 'Editing %s (active)' ), '' . $file . '' ); + } else { + /* translators: %s: plugin file name */ + echo sprintf( __( 'Browsing %s (active)' ), '' . $file . '' ); + } } else { - if ( is_writeable($real_file) ) - echo sprintf(__('Editing %s (inactive)'), $file); - else - echo sprintf(__('Browsing %s (inactive)'), $file); + if ( is_writeable( $real_file ) ) { + /* translators: %s: plugin file name */ + echo sprintf( __( 'Editing %s (inactive)' ), '' . $file . '' ); + } else { + /* translators: %s: plugin file name */ + echo sprintf( __( 'Browsing %s (inactive)' ), '' . $file . '' ); + } } ?>
@@ -209,14 +236,14 @@ default: } ?> - +

-

+

-
+
- +

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

@@ -274,6 +301,6 @@ jQuery(document).ready(function($){ });