WP_Theme_Install_List_Table::install_theme_info() – Prints the info for a theme (to be used in the theme installer modal).

You appear to be a bot. Output may be restricted

Description

Prints the info for a theme (to be used in the theme installer modal).

Usage

WP_Theme_Install_List_Table::install_theme_info( $theme );

Parameters

$theme
( stdClass ) required – A WordPress.org Theme API object.

Returns

void

Source

File name: wordpress/wp-admin/includes/class-wp-theme-install-list-table.php
Lines:

1 to 91 of 91
  public function install_theme_info( $theme ) {
    global $themes_allowedtags;

    if ( empty( $theme ) ) {
      return;
    }

    $name   = wp_kses( $theme->name, $themes_allowedtags );
    $author = wp_kses( $theme->author, $themes_allowedtags );

    $install_url = add_query_arg(
      array(
        'action' => 'install-theme',
        'theme'  => $theme->slug,
      ),
      self_admin_url( 'update.php' )
    );

    $update_url = add_query_arg(
      array(
        'action' => 'upgrade-theme',
        'theme'  => $theme->slug,
      ),
      self_admin_url( 'update.php' )
    );

    $status = $this->WP_Theme_Install_List_Table::_get_theme_status( $theme );

    ?>
		<div class="install-theme-info">
		<?php
    switch ( $status ) {
      case 'update_available':
        printf(
          '<a class="theme-install button button-primary" href="%s" title="%s">%s</a>',
          esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
          /* translators: %s: Theme version. */
          esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
          __( 'Update' )
        );
        break;
      case 'newer_installed':
      case 'latest_installed':
        printf(
          '<span class="theme-install" title="%s">%s</span>',
          esc_attr__( 'This theme is already installed and is up to date' ),
          _x( 'Installed', 'theme' )
        );
        break;
      case 'install':
      default:
        printf(
          '<a class="theme-install button button-primary" href="%s">%s</a>',
          esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
          __( 'Install' )
        );
        break;
    }
    ?>
			<h3 class="theme-name"><?php echo $name; ?></h3>
			<span class="theme-by">
			<?php
        /* translators: %s: Theme author. */
        printf( __( 'By %s' ), $author );
      ?>
			</span>
			<?php if ( isset( $theme->screenshot_url ) ) : ?>
				<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" alt="" />
			<?php endif; ?>
			<div class="theme-details">
				<?php
        wp_star_rating(
          array(
            'rating' => $theme->rating,
            'type'   => 'percent',
            'number' => $theme->num_ratings,
          )
        );
        ?>
				<div class="theme-version">
					<strong><?php _e( 'Version:' ); ?> </strong>
					<?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
				</div>
				<div class="theme-description">
					<?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
				</div>
			</div>
			<input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
		</div>
		<?php
  }
 

 View on GitHub View on Trac