diff -r c7c34916027a -r 177826044cd9 wp/wp-admin/includes/class-wp-theme-install-list-table.php --- a/wp/wp-admin/includes/class-wp-theme-install-list-table.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-admin/includes/class-wp-theme-install-list-table.php Mon Oct 14 18:28:13 2019 +0200 @@ -20,7 +20,6 @@ public $features = array(); /** - * * @return bool */ public function ajax_user_can() { @@ -28,7 +27,6 @@ } /** - * * @global array $tabs * @global string $tab * @global int $paged @@ -41,30 +39,32 @@ global $tabs, $tab, $paged, $type, $theme_field_defaults; wp_reset_vars( array( 'tab' ) ); - $search_terms = array(); + $search_terms = array(); $search_string = ''; - if ( ! empty( $_REQUEST['s'] ) ){ + if ( ! empty( $_REQUEST['s'] ) ) { $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); - $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); + $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); } - if ( ! empty( $_REQUEST['features'] ) ) + if ( ! empty( $_REQUEST['features'] ) ) { $this->features = $_REQUEST['features']; + } $paged = $this->get_pagenum(); $per_page = 36; // These are the tabs which are shown on the page, - $tabs = array(); + $tabs = array(); $tabs['dashboard'] = __( 'Search' ); - if ( 'search' === $tab ) - $tabs['search'] = __( 'Search Results' ); - $tabs['upload'] = __( 'Upload' ); + if ( 'search' === $tab ) { + $tabs['search'] = __( 'Search Results' ); + } + $tabs['upload'] = __( 'Upload' ); $tabs['featured'] = _x( 'Featured', 'themes' ); //$tabs['popular'] = _x( 'Popular', 'themes' ); - $tabs['new'] = _x( 'Latest', 'themes' ); - $tabs['updated'] = _x( 'Recently Updated', 'themes' ); + $tabs['new'] = _x( 'Latest', 'themes' ); + $tabs['updated'] = _x( 'Recently Updated', 'themes' ); $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. @@ -76,16 +76,21 @@ * * @since 2.8.0 * - * @param array $nonmenu_tabs The tabs that don't have a menu item on - * the Install Themes screen. + * @param string[] $nonmenu_tabs The tabs that don't have a menu item on + * the Install Themes screen. */ $nonmenu_tabs = apply_filters( 'install_themes_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 ) ) ) { $tab = key( $tabs ); + } - $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults ); + $args = array( + 'page' => $paged, + 'per_page' => $per_page, + 'fields' => $theme_field_defaults, + ); switch ( $tab ) { case 'search': @@ -103,8 +108,8 @@ } if ( ! empty( $this->features ) ) { - $args['tag'] = $this->features; - $_REQUEST['s'] = implode( ',', $this->features ); + $args['tag'] = $this->features; + $_REQUEST['s'] = implode( ',', $this->features ); $_REQUEST['type'] = 'tag'; } @@ -112,7 +117,7 @@ break; case 'featured': - // case 'popular': + // case 'popular': case 'new': case 'updated': $args['browse'] = $tab; @@ -136,21 +141,25 @@ */ $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); - if ( ! $args ) + if ( ! $args ) { return; + } $api = themes_api( 'query_themes', $args ); - if ( is_wp_error( $api ) ) + if ( is_wp_error( $api ) ) { wp_die( $api->get_error_message() . '
' . __( 'Try again' ) . '' ); + } $this->items = $api->themes; - $this->set_pagination_args( array( - 'total_items' => $api->info['results'], - 'per_page' => $args['per_page'], - 'infinite_scroll' => true, - ) ); + $this->set_pagination_args( + array( + 'total_items' => $api->info['results'], + 'per_page' => $args['per_page'], + 'infinite_scroll' => true, + ) + ); } /** @@ -160,7 +169,6 @@ } /** - * * @global array $tabs * @global string $tab * @return array @@ -170,9 +178,9 @@ $display_tabs = array(); foreach ( (array) $tabs as $action => $text ) { - $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; - $href = self_admin_url('theme-install.php?tab=' . $action); - $display_tabs['theme-install-'.$action] = "$text"; + $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; + $href = self_admin_url( 'theme-install.php?tab=' . $action ); + $display_tabs[ 'theme-install-' . $action ] = "$text"; } return $display_tabs; @@ -181,8 +189,8 @@ /** */ public function display() { - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); -?> + wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); + ?>