wp/wp-admin/theme-install.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    11 require( ABSPATH . 'wp-admin/includes/theme-install.php' );
    11 require( ABSPATH . 'wp-admin/includes/theme-install.php' );
    12 
    12 
    13 wp_reset_vars( array( 'tab' ) );
    13 wp_reset_vars( array( 'tab' ) );
    14 
    14 
    15 if ( ! current_user_can('install_themes') )
    15 if ( ! current_user_can('install_themes') )
    16 	wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
    16 	wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
    17 
    17 
    18 if ( is_multisite() && ! is_network_admin() ) {
    18 if ( is_multisite() && ! is_network_admin() ) {
    19 	wp_redirect( network_admin_url( 'theme-install.php' ) );
    19 	wp_redirect( network_admin_url( 'theme-install.php' ) );
    20 	exit();
    20 	exit();
    21 }
    21 }
    26 if ( ! is_network_admin() ) {
    26 if ( ! is_network_admin() ) {
    27 	$submenu_file = 'themes.php';
    27 	$submenu_file = 'themes.php';
    28 }
    28 }
    29 
    29 
    30 $installed_themes = search_theme_directories();
    30 $installed_themes = search_theme_directories();
       
    31 
       
    32 if ( false === $installed_themes ) {
       
    33 	$installed_themes = array();
       
    34 }
       
    35 
    31 foreach ( $installed_themes as $k => $v ) {
    36 foreach ( $installed_themes as $k => $v ) {
    32 	if ( false !== strpos( $k, '/' ) ) {
    37 	if ( false !== strpos( $k, '/' ) ) {
    33 		unset( $installed_themes[ $k ] );
    38 		unset( $installed_themes[ $k ] );
    34 	}
    39 	}
    35 }
    40 }
    36 
    41 
    37 wp_localize_script( 'theme', '_wpThemeSettings', array(
    42 wp_localize_script( 'theme', '_wpThemeSettings', array(
    38 	'themes'   => false,
    43 	'themes'   => false,
    39 	'settings' => array(
    44 	'settings' => array(
    40 		'isInstall'     => true,
    45 		'isInstall'  => true,
    41 		'canInstall'    => current_user_can( 'install_themes' ),
    46 		'canInstall' => current_user_can( 'install_themes' ),
    42 		'installURI'    => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
    47 		'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
    43 		'adminUrl'      => parse_url( self_admin_url(), PHP_URL_PATH )
    48 		'adminUrl'   => parse_url( self_admin_url(), PHP_URL_PATH )
    44 	),
    49 	),
    45 	'l10n' => array(
    50 	'l10n' => array(
    46 		'addNew' => __( 'Add New Theme' ),
    51 		'addNew'              => __( 'Add New Theme' ),
    47 		'search' => __( 'Search Themes' ),
    52 		'search'              => __( 'Search Themes' ),
    48 		'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis)
    53 		'searchPlaceholder'   => __( 'Search themes...' ), // placeholder (no ellipsis)
    49 		'upload' => __( 'Upload Theme' ),
    54 		'upload'              => __( 'Upload Theme' ),
    50 		'back'   => __( 'Back' ),
    55 		'back'                => __( 'Back' ),
    51 		'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ),
    56 		'error'               => sprintf(
    52 		'themesFound'   => __( 'Number of Themes found: %d' ),
    57 			/* translators: %s: support forums URL */
    53 		'noThemesFound' => __( 'No themes found. Try a different search.' ),
    58 			__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
       
    59 			__( 'https://wordpress.org/support/' )
       
    60 		),
       
    61 		'tryAgain'            => __( 'Try Again' ),
       
    62 		'themesFound'         => __( 'Number of Themes found: %d' ),
       
    63 		'noThemesFound'       => __( 'No themes found. Try a different search.' ),
       
    64 		'collapseSidebar'     => __( 'Collapse Sidebar' ),
       
    65 		'expandSidebar'       => __( 'Expand Sidebar' ),
       
    66 		/* translators: accessibility text */
       
    67 		'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ),
    54 	),
    68 	),
    55 	'installedThemes' => array_keys( $installed_themes ),
    69 	'installedThemes' => array_keys( $installed_themes ),
    56 ) );
    70 ) );
    57 
    71 
    58 wp_enqueue_script( 'theme' );
    72 wp_enqueue_script( 'theme' );
       
    73 wp_enqueue_script( 'updates' );
    59 
    74 
    60 if ( $tab ) {
    75 if ( $tab ) {
    61 	/**
    76 	/**
    62 	 * Fires before each of the tabs are rendered on the Install Themes page.
    77 	 * Fires before each of the tabs are rendered on the Install Themes page.
    63 	 *
    78 	 *
    64 	 * The dynamic portion of the hook name, `$tab`, refers to the current
    79 	 * The dynamic portion of the hook name, `$tab`, refers to the current
    65 	 * theme install tab. Possible values are 'dashboard', 'search', 'upload',
    80 	 * theme installation tab. Possible values are 'dashboard', 'search', 'upload',
    66 	 * 'featured', 'new', or 'updated'.
    81 	 * 'featured', 'new', or 'updated'.
    67 	 *
    82 	 *
    68 	 * @since 2.8.0
    83 	 * @since 2.8.0
    69 	 */
    84 	 */
    70 	do_action( "install_themes_pre_{$tab}" );
    85 	do_action( "install_themes_pre_{$tab}" );
    71 }
    86 }
    72 
    87 
    73 $help_overview =
    88 $help_overview =
    74 	'<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' .
    89 	'<p>' . sprintf(
       
    90 			/* translators: %s: Theme Directory URL */
       
    91 			__( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
       
    92 			__( 'https://wordpress.org/themes/' )
       
    93 		) . '</p>' .
    75 	'<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
    94 	'<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
    76 	'<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
    95 	'<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
    77 	'<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>';
    96 	'<p>' . sprintf(
       
    97 			/* translators: %s: /wp-content/themes */
       
    98 			__( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your %s directory.' ),
       
    99 			'<code>/wp-content/themes</code>'
       
   100 		) . '</p>';
    78 
   101 
    79 get_current_screen()->add_help_tab( array(
   102 get_current_screen()->add_help_tab( array(
    80 	'id'      => 'overview',
   103 	'id'      => 'overview',
    81 	'title'   => __('Overview'),
   104 	'title'   => __('Overview'),
    82 	'content' => $help_overview
   105 	'content' => $help_overview
    92 	'content' => $help_installing
   115 	'content' => $help_installing
    93 ) );
   116 ) );
    94 
   117 
    95 get_current_screen()->set_help_sidebar(
   118 get_current_screen()->set_help_sidebar(
    96 	'<p><strong>' . __('For more information:') . '</strong></p>' .
   119 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    97 	'<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' .
   120 	'<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes">Documentation on Adding New Themes</a>') . '</p>' .
    98 	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
   121 	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
    99 );
   122 );
   100 
   123 
   101 include(ABSPATH . 'wp-admin/admin-header.php');
   124 include(ABSPATH . 'wp-admin/admin-header.php');
   102 
   125 
   103 ?>
   126 ?>
   104 <div class="wrap">
   127 <div class="wrap">
   105 	<h2><?php
   128 	<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
   106 	echo esc_html( $title );
   129 
       
   130 	<?php
   107 
   131 
   108 	/**
   132 	/**
   109 	 * Filter the tabs shown on the Add Themes screen.
   133 	 * Filters the tabs shown on the Add Themes screen.
   110 	 *
   134 	 *
   111 	 * This filter is for backwards compatibility only, for the suppression
   135 	 * This filter is for backward compatibility only, for the suppression of the upload tab.
   112 	 * of the upload tab.
       
   113 	 *
   136 	 *
   114 	 * @since 2.8.0
   137 	 * @since 2.8.0
   115 	 *
   138 	 *
   116 	 * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'.
   139 	 * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'.
   117 	 */
   140 	 */
   118 	$tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
   141 	$tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
   119 	if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
   142 	if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
   120 		echo ' <a href="#" class="upload add-new-h2">' . __( 'Upload Theme' ) . '</a>';
   143 		echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">' . __( 'Upload Theme' ) . '</button>';
   121 		echo ' <a href="#" class="browse-themes add-new-h2">' . _x( 'Browse', 'themes' ) . '</a>';
       
   122 	}
   144 	}
   123 	?></h2>
   145 	?>
       
   146 
       
   147 	<hr class="wp-header-end">
       
   148 
       
   149 	<div class="error hide-if-js">
       
   150 		<p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p>
       
   151 	</div>
   124 
   152 
   125 	<div class="upload-theme">
   153 	<div class="upload-theme">
   126 	<?php install_themes_upload(); ?>
   154 	<?php install_themes_upload(); ?>
   127 	</div>
   155 	</div>
   128 
   156 
   129 	<div class="wp-filter">
   157 	<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Filter themes list' ); ?></h2>
       
   158 
       
   159 	<div class="wp-filter hide-if-no-js">
   130 		<div class="filter-count">
   160 		<div class="filter-count">
   131 			<span class="count theme-count"></span>
   161 			<span class="count theme-count"></span>
   132 		</div>
   162 		</div>
   133 
   163 
   134 		<ul class="filter-links">
   164 		<ul class="filter-links">
   135 			<li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li>
   165 			<li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li>
   136 			<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
   166 			<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
   137 			<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
   167 			<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
       
   168 			<li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li>
   138 		</ul>
   169 		</ul>
   139 
   170 
   140 		<a class="drawer-toggle" href="#"><?php _e( 'Feature Filter' ); ?></a>
   171 		<button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button>
   141 
   172 
   142 		<div class="search-form"></div>
   173 		<form class="search-form"></form>
       
   174 
       
   175 		<div class="favorites-form">
       
   176 			<?php
       
   177 			$action = 'save_wporg_username_' . get_current_user_id();
       
   178 			if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) {
       
   179 				$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
       
   180 				update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
       
   181 			} else {
       
   182 				$user = get_user_option( 'wporg_favorites' );
       
   183 			}
       
   184 			?>
       
   185 			<p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p>
       
   186 
       
   187 			<p>
       
   188 				<label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label>
       
   189 				<input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( $action ) ); ?>" />
       
   190 				<input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" />
       
   191 				<input type="button" class="button favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
       
   192 			</p>
       
   193 		</div>
   143 
   194 
   144 		<div class="filter-drawer">
   195 		<div class="filter-drawer">
   145 			<div class="buttons">
   196 			<div class="buttons">
   146 				<a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a>
   197 				<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
   147 				<a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a>
   198 				<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
   148 			</div>
   199 			</div>
   149 		<?php
   200 		<?php
   150 		$feature_list = get_theme_feature_list();
   201 		$feature_list = get_theme_feature_list( false ); // Use the core list, rather than the .org API, due to inconsistencies and to ensure tags are translated.
   151 		foreach ( $feature_list as $feature_name => $features ) {
   202 		foreach ( $feature_list as $feature_name => $features ) {
   152 			echo '<div class="filter-group">';
   203 			echo '<fieldset class="filter-group">';
   153 			$feature_name = esc_html( $feature_name );
   204 			$feature_name = esc_html( $feature_name );
   154 			echo '<h4>' . $feature_name . '</h4>';
   205 			echo '<legend>' . $feature_name . '</legend>';
   155 			echo '<ol class="feature-group">';
   206 			echo '<div class="filter-group-feature">';
   156 			foreach ( $features as $feature => $feature_name ) {
   207 			foreach ( $features as $feature => $feature_name ) {
   157 				$feature = esc_attr( $feature );
   208 				$feature = esc_attr( $feature );
   158 				echo '<li><input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
   209 				echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
   159 				echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label></li>';
   210 				echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label>';
   160 			}
   211 			}
   161 			echo '</ol>';
       
   162 			echo '</div>';
   212 			echo '</div>';
       
   213 			echo '</fieldset>';
   163 		}
   214 		}
   164 		?>
   215 		?>
       
   216 			<div class="buttons">
       
   217 				<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
       
   218 				<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
       
   219 			</div>
   165 			<div class="filtered-by">
   220 			<div class="filtered-by">
   166 				<span><?php _e( 'Filtering by:' ); ?></span>
   221 				<span><?php _e( 'Filtering by:' ); ?></span>
   167 				<div class="tags"></div>
   222 				<div class="tags"></div>
   168 				<a href="#"><?php _e( 'Edit' ); ?></a>
   223 				<button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button>
   169 			</div>
   224 			</div>
   170 		</div>
   225 		</div>
   171 	</div>
   226 	</div>
       
   227 	<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Themes list' ); ?></h2>
   172 	<div class="theme-browser content-filterable"></div>
   228 	<div class="theme-browser content-filterable"></div>
   173 	<div class="theme-install-overlay wp-full-overlay expanded"></div>
   229 	<div class="theme-install-overlay wp-full-overlay expanded"></div>
   174 
   230 
   175 	<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
   231 	<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
   176 	<span class="spinner"></span>
   232 	<span class="spinner"></span>
   177 
   233 
   178 	<br class="clear" />
       
   179 <?php
   234 <?php
   180 if ( $tab ) {
   235 if ( $tab ) {
   181 	/**
   236 	/**
   182 	 * Fires at the top of each of the tabs on the Install Themes page.
   237 	 * Fires at the top of each of the tabs on the Install Themes page.
   183 	 *
   238 	 *
   184 	 * The dynamic portion of the hook name, `$tab`, refers to the current
   239 	 * The dynamic portion of the hook name, `$tab`, refers to the current
   185 	 * theme install tab. Possible values are 'dashboard', 'search', 'upload',
   240 	 * theme installation tab. Possible values are 'dashboard', 'search', 'upload',
   186 	 * 'featured', 'new', or 'updated'.
   241 	 * 'featured', 'new', or 'updated'.
   187 	 *
   242 	 *
   188 	 * @since 2.8.0
   243 	 * @since 2.8.0
   189 	 *
   244 	 *
   190 	 * @param int $paged Number of the current page of results being viewed.
   245 	 * @param int $paged Number of the current page of results being viewed.
   201 		</div>
   256 		</div>
   202 	<# } else { #>
   257 	<# } else { #>
   203 		<div class="theme-screenshot blank"></div>
   258 		<div class="theme-screenshot blank"></div>
   204 	<# } #>
   259 	<# } #>
   205 	<span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
   260 	<span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
   206 	<div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div>
   261 	<div class="theme-author">
   207 	<h3 class="theme-name">{{ data.name }}</h3>
   262 		<?php
   208 
   263 		/* translators: %s: Theme author name */
   209 	<div class="theme-actions">
   264 		printf( __( 'By %s' ), '{{ data.author }}' );
   210 		<a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
   265 		?>
   211 		<a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
   266 	</div>
       
   267 
       
   268 	<div class="theme-id-container">
       
   269 		<h3 class="theme-name">{{ data.name }}</h3>
       
   270 
       
   271 		<div class="theme-actions">
       
   272 			<# if ( data.installed ) { #>
       
   273 				<?php
       
   274 				/* translators: %s: Theme name */
       
   275 				$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
       
   276 				?>
       
   277 				<# if ( data.activate_url ) { #>
       
   278 					<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
       
   279 				<# } #>
       
   280 				<# if ( data.customize_url ) { #>
       
   281 					<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
       
   282 				<# } else { #>
       
   283 					<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
       
   284 				<# } #>
       
   285 			<# } else { #>
       
   286 				<?php
       
   287 				/* translators: %s: Theme name */
       
   288 				$aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
       
   289 				?>
       
   290 				<a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
       
   291 				<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
       
   292 			<# } #>
       
   293 		</div>
   212 	</div>
   294 	</div>
   213 
   295 
   214 	<# if ( data.installed ) { #>
   296 	<# if ( data.installed ) { #>
   215 		<div class="theme-installed"><?php _ex( 'Already Installed', 'theme' ); ?></div>
   297 		<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
   216 	<# } #>
   298 	<# } #>
   217 </script>
   299 </script>
   218 
   300 
   219 <script id="tmpl-theme-preview" type="text/template">
   301 <script id="tmpl-theme-preview" type="text/template">
   220 	<div class="wp-full-overlay-sidebar">
   302 	<div class="wp-full-overlay-sidebar">
   221 		<div class="wp-full-overlay-header">
   303 		<div class="wp-full-overlay-header">
   222 			<a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></a>
   304 			<button class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
   223 			<a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></a>
   305 			<button class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></button>
   224 			<a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></a>
   306 			<button class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></button>
   225 		<# if ( data.installed ) { #>
   307 			<# if ( data.installed ) { #>
   226 			<a href="#" class="button button-primary theme-install disabled"><?php _ex( 'Installed', 'theme' ); ?></a>
   308 				<a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
   227 		<# } else { #>
   309 			<# } else { #>
   228 			<a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
   310 				<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
   229 		<# } #>
   311 			<# } #>
   230 		</div>
   312 		</div>
   231 		<div class="wp-full-overlay-sidebar-content">
   313 		<div class="wp-full-overlay-sidebar-content">
   232 			<div class="install-theme-info">
   314 			<div class="install-theme-info">
   233 				<h3 class="theme-name">{{ data.name }}</h3>
   315 				<h3 class="theme-name">{{ data.name }}</h3>
   234 				<span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span>
   316 					<span class="theme-by">
   235 
   317 						<?php
   236 				<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
   318 						/* translators: %s: Theme author name */
   237 
   319 						printf( __( 'By %s' ), '{{ data.author }}' );
   238 				<div class="theme-details">
   320 						?>
   239 					<# if ( data.rating ) { #>
   321 					</span>
   240 						<div class="rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
   322 
   241 							<span class="one"></span>
   323 					<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
   242 							<span class="two"></span>
   324 
   243 							<span class="three"></span>
   325 					<div class="theme-details">
   244 							<span class="four"></span>
   326 						<# if ( data.rating ) { #>
   245 							<span class="five"></span>
   327 							<div class="theme-rating">
   246 							<small class="ratings">{{ data.num_ratings }}</small>
   328 								{{{ data.stars }}}
       
   329 								<span class="num-ratings">({{ data.num_ratings }})</span>
       
   330 							</div>
       
   331 						<# } else { #>
       
   332 							<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
       
   333 						<# } #>
       
   334 						<div class="theme-version">
       
   335 							<?php
       
   336 							/* translators: %s: Theme version */
       
   337 							printf( __( 'Version: %s' ), '{{ data.version }}' );
       
   338 							?>
   247 						</div>
   339 						</div>
   248 					<# } else { #>
   340 						<div class="theme-description">{{{ data.description }}}</div>
   249 						<div class="rating">
   341 					</div>
   250 							<small class="ratings"><?php _e( 'This theme has not been rated yet.' ); ?></small>
       
   251 						</div>
       
   252 					<# } #>
       
   253 					<div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div>
       
   254 					<div class="theme-description">{{{ data.description }}}</div>
       
   255 				</div>
   342 				</div>
   256 			</div>
   343 			</div>
   257 		</div>
   344 			<div class="wp-full-overlay-footer">
   258 		<div class="wp-full-overlay-footer">
   345 				<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
   259 			<a href="#" class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
   346 					<span class="collapse-sidebar-arrow"></span>
   260 				<span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
   347 					<span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
   261 				<span class="collapse-sidebar-arrow"></span>
   348 				</button>
   262 			</a>
   349 			</div>
   263 		</div>
   350 		</div>
   264 	</div>
   351 		<div class="wp-full-overlay-main">
   265 	<div class="wp-full-overlay-main">
   352 		<iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>"></iframe>
   266 		<iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>" />
       
   267 	</div>
   353 	</div>
   268 </script>
   354 </script>
   269 
   355 
   270 <?php
   356 <?php
       
   357 wp_print_request_filesystem_credentials_modal();
       
   358 wp_print_admin_notice_templates();
       
   359 
   271 include(ABSPATH . 'wp-admin/admin-footer.php');
   360 include(ABSPATH . 'wp-admin/admin-footer.php');