wp/wp-admin/includes/class-wp-theme-install-list-table.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    58 		$tabs              = array();
    58 		$tabs              = array();
    59 		$tabs['dashboard'] = __( 'Search' );
    59 		$tabs['dashboard'] = __( 'Search' );
    60 		if ( 'search' === $tab ) {
    60 		if ( 'search' === $tab ) {
    61 			$tabs['search'] = __( 'Search Results' );
    61 			$tabs['search'] = __( 'Search Results' );
    62 		}
    62 		}
    63 		$tabs['upload']   = __( 'Upload' );
    63 		$tabs['upload']   = _x( 'Upload', 'noun' );
    64 		$tabs['featured'] = _x( 'Featured', 'themes' );
    64 		$tabs['featured'] = _x( 'Featured', 'themes' );
    65 		//$tabs['popular']  = _x( 'Popular', 'themes' );
    65 		//$tabs['popular']  = _x( 'Popular', 'themes' );
    66 		$tabs['new']     = _x( 'Latest', 'themes' );
    66 		$tabs['new']     = _x( 'Latest', 'themes' );
    67 		$tabs['updated'] = _x( 'Recently Updated', 'themes' );
    67 		$tabs['updated'] = _x( 'Recently Updated', 'themes' );
    68 
    68 
   228 		<?php
   228 		<?php
   229 		$this->tablenav( 'bottom' );
   229 		$this->tablenav( 'bottom' );
   230 	}
   230 	}
   231 
   231 
   232 	/**
   232 	/**
       
   233 	 * Generates the list table rows.
       
   234 	 *
       
   235 	 * @since 3.1.0
   233 	 */
   236 	 */
   234 	public function display_rows() {
   237 	public function display_rows() {
   235 		$themes = $this->items;
   238 		$themes = $this->items;
   236 		foreach ( $themes as $theme ) {
   239 		foreach ( $themes as $theme ) {
   237 			?>
   240 			?>
   310 		$status = $this->_get_theme_status( $theme );
   313 		$status = $this->_get_theme_status( $theme );
   311 
   314 
   312 		switch ( $status ) {
   315 		switch ( $status ) {
   313 			case 'update_available':
   316 			case 'update_available':
   314 				$actions[] = sprintf(
   317 				$actions[] = sprintf(
   315 					'<a class="install-now" href="%s" title="%s">%s</a>',
   318 					'<a class="install-now" href="%s" aria-label="%s">%s</a>',
   316 					esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
   319 					esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
   317 					/* translators: %s: Theme version. */
   320 					/* translators: %s: Theme version. */
   318 					esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
   321 					esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
   319 					__( 'Update' )
   322 					__( 'Update' )
   320 				);
   323 				);
   321 				break;
   324 				break;
   322 			case 'newer_installed':
   325 			case 'newer_installed':
   323 			case 'latest_installed':
   326 			case 'latest_installed':
   324 				$actions[] = sprintf(
   327 				$actions[] = sprintf(
   325 					'<span class="install-now" title="%s">%s</span>',
   328 					'<span class="install-now">%s</span>',
   326 					esc_attr__( 'This theme is already installed and is up to date' ),
       
   327 					_x( 'Installed', 'theme' )
   329 					_x( 'Installed', 'theme' )
   328 				);
   330 				);
   329 				break;
   331 				break;
   330 			case 'install':
   332 			case 'install':
   331 			default:
   333 			default:
   332 				$actions[] = sprintf(
   334 				$actions[] = sprintf(
   333 					'<a class="install-now" href="%s" title="%s">%s</a>',
   335 					'<a class="install-now" href="%s" aria-label="%s">%s</a>',
   334 					esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
   336 					esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
   335 					/* translators: %s: Theme name. */
   337 					/* translators: %s: Theme name. */
   336 					esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
   338 					esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
   337 					_x( 'Install Now', 'theme' )
   339 					_x( 'Install Now', 'theme' )
   338 				);
   340 				);
   339 				break;
   341 				break;
   340 		}
   342 		}
   341 
   343 
   342 		$actions[] = sprintf(
   344 		$actions[] = sprintf(
   343 			'<a class="install-theme-preview" href="%s" title="%s">%s</a>',
   345 			'<a class="install-theme-preview" href="%s" aria-label="%s">%s</a>',
   344 			esc_url( $preview_url ),
   346 			esc_url( $preview_url ),
   345 			/* translators: %s: Theme name. */
   347 			esc_attr( $preview_title ),
   346 			esc_attr( sprintf( __( 'Preview %s' ), $name ) ),
       
   347 			__( 'Preview' )
   348 			__( 'Preview' )
   348 		);
   349 		);
   349 
   350 
   350 		/**
   351 		/**
   351 		 * Filters the install action links for a theme in the Install Themes list table.
   352 		 * Filters the install action links for a theme in the Install Themes list table.
   358 		 *                          WordPress.org API.
   359 		 *                          WordPress.org API.
   359 		 */
   360 		 */
   360 		$actions = apply_filters( 'theme_install_actions', $actions, $theme );
   361 		$actions = apply_filters( 'theme_install_actions', $actions, $theme );
   361 
   362 
   362 		?>
   363 		?>
   363 		<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
   364 		<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" aria-label="<?php echo esc_attr( $preview_title ); ?>">
   364 			<img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" />
   365 			<img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" />
   365 		</a>
   366 		</a>
   366 
   367 
   367 		<h3><?php echo $name; ?></h3>
   368 		<h3><?php echo $name; ?></h3>
   368 		<div class="theme-author">
   369 		<div class="theme-author">
   469 		<div class="install-theme-info">
   470 		<div class="install-theme-info">
   470 		<?php
   471 		<?php
   471 		switch ( $status ) {
   472 		switch ( $status ) {
   472 			case 'update_available':
   473 			case 'update_available':
   473 				printf(
   474 				printf(
   474 					'<a class="theme-install button button-primary" href="%s" title="%s">%s</a>',
   475 					'<a class="theme-install button button-primary" href="%s" aria-label="%s">%s</a>',
   475 					esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
   476 					esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
   476 					/* translators: %s: Theme version. */
   477 					/* translators: %s: Theme version. */
   477 					esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
   478 					esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
   478 					__( 'Update' )
   479 					__( 'Update' )
   479 				);
   480 				);
   480 				break;
   481 				break;
   481 			case 'newer_installed':
   482 			case 'newer_installed':
   482 			case 'latest_installed':
   483 			case 'latest_installed':
   483 				printf(
   484 				printf(
   484 					'<span class="theme-install" title="%s">%s</span>',
   485 					'<span class="theme-install">%s</span>',
   485 					esc_attr__( 'This theme is already installed and is up to date' ),
       
   486 					_x( 'Installed', 'theme' )
   486 					_x( 'Installed', 'theme' )
   487 				);
   487 				);
   488 				break;
   488 				break;
   489 			case 'install':
   489 			case 'install':
   490 			default:
   490 			default: