diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/plugins.php --- a/wp/wp-admin/plugins.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/plugins.php Tue Dec 15 13:49:49 2020 +0100 @@ -7,7 +7,7 @@ */ /** WordPress Administration Bootstrap */ -require_once( dirname( __FILE__ ) . '/admin.php' ); +require_once __DIR__ . '/admin.php'; if ( ! current_user_can( 'activate_plugins' ) ) { wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) ); @@ -22,7 +22,21 @@ $s = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : ''; // Clean up request URI from temporary args for screen options/paging uri's to work as expected. -$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ), $_SERVER['REQUEST_URI'] ); +$query_args_to_remove = array( + 'error', + 'deleted', + 'activate', + 'activate-multi', + 'deactivate', + 'deactivate-multi', + 'enabled-auto-update', + 'disabled-auto-update', + 'enabled-auto-update-multi', + 'disabled-auto-update-multi', + '_error_nonce', +); + +$_SERVER['REQUEST_URI'] = remove_query_arg( $query_args_to_remove, $_SERVER['REQUEST_URI'] ); wp_enqueue_script( 'updates' ); @@ -43,7 +57,7 @@ $result = activate_plugin( $plugin, self_admin_url( 'plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() ); if ( is_wp_error( $result ) ) { - if ( 'unexpected_output' == $result->get_error_code() ) { + if ( 'unexpected_output' === $result->get_error_code() ) { $redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s" ); wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); exit; @@ -62,12 +76,14 @@ update_site_option( 'recently_activated', $recent ); } - if ( isset( $_GET['from'] ) && 'import' == $_GET['from'] ) { - wp_redirect( self_admin_url( 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) ) ) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix - } elseif ( isset( $_GET['from'] ) && 'press-this' == $_GET['from'] ) { + if ( isset( $_GET['from'] ) && 'import' === $_GET['from'] ) { + // Overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix. + wp_redirect( self_admin_url( 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) ) ) ); + } elseif ( isset( $_GET['from'] ) && 'press-this' === $_GET['from'] ) { wp_redirect( self_admin_url( 'press-this.php' ) ); } else { - wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s" ) ); // overrides the ?error=true one above + // Overrides the ?error=true one above. + wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s" ) ); } exit; @@ -141,7 +157,7 @@ $parent_file = 'plugins.php'; wp_enqueue_script( 'updates' ); - require_once( ABSPATH . 'wp-admin/admin-header.php' ); + require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
-
' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '
' . - '' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . '
' . + '' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '
' . + '' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . '
' . '' . sprintf( - /* translators: %s: WordPress Plugin Directory URL */ - __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), + /* translators: %s: WordPress Plugin Directory URL. */ + __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), __( 'https://wordpress.org/plugins/' ) ) . '
', ) @@ -450,18 +556,36 @@ 'id' => 'compatibility-problems', 'title' => __( 'Troubleshooting' ), 'content' => - '' . __( 'Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.' ) . '
' . + '' . __( 'Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.' ) . '
' . '' . sprintf(
- /* translators: WP_PLUGIN_DIR constant value */
- __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ),
+ /* translators: %s: WP_PLUGIN_DIR constant value. */
+ __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ),
'' . WP_PLUGIN_DIR . '
'
) . '
' . __( 'Auto-updates can be enabled or disabled for each individual plugin. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '
' . + '' . __( 'Auto-updates are only available for plugins recognized by WordPress.org, or that include a compatible update system.' ) . '
' . + '' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '
', + ) + ); + + $help_sidebar_autoupdates = '' . __( 'Learn more: Auto-updates documentation' ) . '
'; +} + get_current_screen()->set_help_sidebar( '' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Managing Plugins' ) . '
' . + '' . __( 'Documentation on Managing Plugins' ) . '
' . + $help_sidebar_autoupdates . '' . __( 'Support' ) . '
' ); @@ -476,30 +600,29 @@ $title = __( 'Plugins' ); $parent_file = 'plugins.php'; -require_once( ABSPATH . 'wp-admin/admin-header.php' ); +require_once ABSPATH . 'wp-admin/admin-header.php'; $invalid = validate_active_plugins(); if ( ! empty( $invalid ) ) { foreach ( $invalid as $plugin_file => $error ) { echo '';
printf(
- /* translators: 1: plugin file, 2: error message */
- __( 'The plugin %1$s has been deactivated due to an error: %2$s' ),
+ /* translators: 1: Plugin file, 2: Error message. */
+ __( 'The plugin %1$s has been deactivated due to an error: %2$s' ),
'' . esc_html( $plugin_file ) . '
',
$error->get_error_message()
);
echo '
get_error_message() ); ?>
+ get_error_message() + ); + ?> +
+deleted.' ); + if ( 1 === (int) $_GET['deleted'] ) { + _e( 'The selected plugin has been deleted.' ); } else { - _e( 'The selected plugins have been deleted.' ); + _e( 'The selected plugins have been deleted.' ); } ?>
activated.' ); ?>
activated.' ); ?>
deactivated.' ); ?>
deactivated.' ); ?>
resumed.' ); ?>