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 '
', '' ); } 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 @@