diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/class-wp-plugin-install-list-table.php --- a/wp/wp-admin/includes/class-wp-plugin-install-list-table.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/includes/class-wp-plugin-install-list-table.php Tue Dec 15 13:49:49 2020 +0100 @@ -85,7 +85,7 @@ * @global string $term */ public function prepare_items() { - include( ABSPATH . 'wp-admin/includes/plugin-install.php' ); + include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; global $tabs, $tab, $paged, $type, $term; @@ -95,13 +95,13 @@ $per_page = 36; - // These are the tabs which are shown on the page + // These are the tabs which are shown on the page. $tabs = array(); if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } - if ( $tab === 'beta' || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { + if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); } $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); @@ -117,26 +117,26 @@ $nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item. /** - * Filters the tabs shown on the Plugin Install screen. + * Filters the tabs shown on the Add Plugins screen. * * @since 2.7.0 * - * @param string[] $tabs The tabs shown on the Plugin Install screen. Defaults include 'featured', 'popular', - * 'recommended', 'favorites', and 'upload'. + * @param string[] $tabs The tabs shown on the Add Plugins screen. Defaults include + * 'featured', 'popular', 'recommended', 'favorites', and 'upload'. */ $tabs = apply_filters( 'install_plugins_tabs', $tabs ); /** - * Filters tabs not associated with a menu item on the Plugin Install screen. + * Filters tabs not associated with a menu item on the Add Plugins screen. * * @since 2.7.0 * - * @param string[] $nonmenu_tabs The tabs that don't have a menu item on the Plugin Install screen. + * @param string[] $nonmenu_tabs The tabs that don't have a menu item on the Add Plugins screen. */ $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); // If a non-valid menu tab has been selected, And it's not a non-menu action. - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) { + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } @@ -207,14 +207,14 @@ } /** - * Filters API request arguments for each Plugin Install screen tab. + * Filters API request arguments for each Add Plugins screen tab. * * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs. * Default tabs include 'featured', 'popular', 'recommended', 'favorites', and 'upload'. * * @since 3.7.0 * - * @param array|bool $args Plugin Install API arguments. + * @param array|false $args Plugin install API arguments. */ $args = apply_filters( "install_plugins_table_api_args_{$tab}", $args ); @@ -333,7 +333,11 @@ } /** - * Override the parent display() so we can provide a different container. + * Displays the plugin install table. + * + * Overrides the parent display() method to provide a different container. + * + * @since 4.0.0 */ public function display() { $singular = $this->_args['singular']; @@ -365,7 +369,7 @@ * @param string $which */ protected function display_tablenav( $which ) { - if ( $GLOBALS['tab'] === 'featured' ) { + if ( 'featured' === $GLOBALS['tab'] ) { return; } @@ -467,7 +471,7 @@ $plugin = (array) $plugin; } - // Display the group heading if there is one + // Display the group heading if there is one. if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { if ( isset( $this->groups[ $plugin['group'] ] ) ) { $group_name = $this->groups[ $plugin['group'] ]; @@ -478,13 +482,13 @@ $group_name = $plugin['group']; } - // Starting a new group, close off the divs of the last one + // Starting a new group, close off the divs of the last one. if ( ! empty( $group ) ) { echo ''; } echo '

' . esc_html( $group_name ) . '

'; - // needs an extra wrapping div for nth-child selectors to work + // Needs an extra wrapping div for nth-child selectors to work. echo '
'; $group = $plugin['group']; @@ -499,6 +503,7 @@ $author = wp_kses( $plugin['author'], $plugins_allowedtags ); if ( ! empty( $author ) ) { + /* translators: %s: Plugin author. */ $author = ' ' . sprintf( __( 'By %s' ), $author ) . ''; } @@ -522,8 +527,8 @@ '%s', esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), - /* translators: %s: plugin name and version */ - esc_attr( sprintf( __( 'Install %s now' ), $name ) ), + /* translators: %s: Plugin name and version. */ + esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), esc_attr( $name ), __( 'Install Now' ) ); @@ -544,8 +549,8 @@ esc_attr( $status['file'] ), esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), - /* translators: %s: plugin name and version */ - esc_attr( sprintf( __( 'Update %s now' ), $name ) ), + /* translators: %s: Plugin name and version. */ + esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ), esc_attr( $name ), __( 'Update Now' ) ); @@ -567,7 +572,7 @@ ); } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { $button_text = __( 'Activate' ); - /* translators: %s: plugin name */ + /* translators: %s: Plugin name. */ $button_label = _x( 'Activate %s', 'plugin' ); $activate_url = add_query_arg( array( @@ -580,7 +585,7 @@ if ( is_network_admin() ) { $button_text = __( 'Network Activate' ); - /* translators: %s: plugin name */ + /* translators: %s: Plugin name. */ $button_label = _x( 'Network Activate %s', 'plugin' ); $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); } @@ -609,7 +614,7 @@ $action_links[] = sprintf( '%s', esc_url( $details_link ), - /* translators: %s: plugin name and version */ + /* translators: %s: Plugin name and version. */ esc_attr( sprintf( __( 'More information about %s' ), $name ) ), esc_attr( $name ), __( 'More Details' ) @@ -645,7 +650,7 @@ _e( 'This plugin doesn’t work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( - /* translators: 1: "Update WordPress" screen URL, 2: "Update PHP" page URL */ + /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) @@ -653,13 +658,13 @@ wp_update_php_annotation( '

', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( - /* translators: %s: "Update WordPress" screen URL */ + /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( - /* translators: %s: "Update PHP" page URL */ + /* translators: %s: URL to Update PHP page. */ ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); @@ -669,7 +674,7 @@ _e( 'This plugin doesn’t work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( - /* translators: %s: "Update WordPress" screen URL */ + /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); @@ -678,7 +683,7 @@ _e( 'This plugin doesn’t work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( - /* translators: %s: "Update PHP" page URL */ + /* translators: %s: URL to Update PHP page. */ ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); @@ -693,7 +698,7 @@

- +

@@ -723,13 +728,18 @@
- + +
= 1000000 ) { $active_installs_millions = floor( $plugin['active_installs'] / 1000000 ); $active_installs_text = sprintf( + /* translators: %s: Number of millions. */ _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), number_format_i18n( $active_installs_millions ) ); @@ -738,6 +748,7 @@ } else { $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; } + /* translators: %s: Number of installations. */ printf( __( '%s Active Installations' ), $active_installs_text ); ?>
@@ -757,7 +768,7 @@ '; }