wp/wp-admin/themes.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    72 				403
    72 				403
    73 			);
    73 			);
    74 		}
    74 		}
    75 
    75 
    76 		$active = wp_get_theme();
    76 		$active = wp_get_theme();
    77 		if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) {
    77 		if ( $active->get( 'Template' ) === $_GET['stylesheet'] ) {
    78 			wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );
    78 			wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );
    79 		} else {
    79 		} else {
    80 			delete_theme( $_GET['stylesheet'] );
    80 			delete_theme( $_GET['stylesheet'] );
    81 			wp_redirect( admin_url( 'themes.php?deleted=true' ) );
    81 			wp_redirect( admin_url( 'themes.php?deleted=true' ) );
    82 		}
    82 		}
   121 
   121 
   122 		exit;
   122 		exit;
   123 	}
   123 	}
   124 }
   124 }
   125 
   125 
   126 $title       = __( 'Manage Themes' );
   126 // Used in the HTML title tag.
       
   127 $title       = __( 'Themes' );
   127 $parent_file = 'themes.php';
   128 $parent_file = 'themes.php';
   128 
   129 
   129 // Help tab: Overview.
   130 // Help tab: Overview.
   130 if ( current_user_can( 'switch_themes' ) ) {
   131 if ( current_user_can( 'switch_themes' ) ) {
   131 	$help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' .
   132 	$help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' .
   132 		'<p>' . __( 'From this screen you can:' ) . '</p>' .
   133 		'<p>' . __( 'From this screen you can:' ) . '</p>' .
   133 		'<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
   134 		'<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
   134 		'<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
   135 		'<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
   135 		'<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
   136 		'<li>' . __( 'Click Customize for the active theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
   136 		'<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' .
   137 		'<p>' . __( 'The active theme is displayed highlighted as the first theme.' ) . '</p>' .
   137 		'<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>';
   138 		'<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>';
   138 
   139 
   139 	get_current_screen()->add_help_tab(
   140 	get_current_screen()->add_help_tab(
   140 		array(
   141 		array(
   141 			'id'      => 'overview',
   142 			'id'      => 'overview',
   202 } // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
   203 } // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
   203 
   204 
   204 get_current_screen()->set_help_sidebar(
   205 get_current_screen()->set_help_sidebar(
   205 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   206 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   206 	'<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/">Documentation on Using Themes</a>' ) . '</p>' .
   207 	'<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/">Documentation on Using Themes</a>' ) . '</p>' .
       
   208 	'<p>' . __( '<a href="https://wordpress.org/support/article/appearance-themes-screen/">Documentation on Managing Themes</a>' ) . '</p>' .
   207 	$help_sidebar_autoupdates .
   209 	$help_sidebar_autoupdates .
   208 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   210 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   209 );
   211 );
   210 
   212 
   211 if ( current_user_can( 'switch_themes' ) ) {
   213 if ( current_user_can( 'switch_themes' ) ) {
   304 }
   306 }
   305 
   307 
   306 $current_theme_actions = array();
   308 $current_theme_actions = array();
   307 
   309 
   308 if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
   310 if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
       
   311 	$forbidden_paths = array(
       
   312 		'themes.php',
       
   313 		'theme-editor.php',
       
   314 		'site-editor.php',
       
   315 		'edit.php?post_type=wp_navigation',
       
   316 	);
       
   317 
   309 	foreach ( (array) $submenu['themes.php'] as $item ) {
   318 	foreach ( (array) $submenu['themes.php'] as $item ) {
   310 		$class = '';
   319 		$class = '';
   311 		if ( 'themes.php' === $item[2] || 'theme-editor.php' === $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) {
   320 
       
   321 		if ( in_array( $item[2], $forbidden_paths, true ) || str_starts_with( $item[2], 'customize.php' ) ) {
   312 			continue;
   322 			continue;
   313 		}
   323 		}
       
   324 
   314 		// 0 = name, 1 = capability, 2 = file.
   325 		// 0 = name, 1 = capability, 2 = file.
   315 		if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) {
   326 		if ( 0 === strcmp( $self, $item[2] ) && empty( $parent_file )
       
   327 			|| $parent_file && $item[2] === $parent_file
       
   328 		) {
   316 			$class = ' current';
   329 			$class = ' current';
   317 		}
   330 		}
       
   331 
   318 		if ( ! empty( $submenu[ $item[2] ] ) ) {
   332 		if ( ! empty( $submenu[ $item[2] ] ) ) {
   319 			$submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index.
   333 			$submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index.
   320 			$menu_hook           = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] );
   334 			$menu_hook           = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] );
       
   335 
   321 			if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) {
   336 			if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) {
   322 				$current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
   337 				$current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
   323 			} else {
   338 			} else {
   324 				$current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
   339 				$current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
   325 			}
   340 			}
   360 /*
   375 /*
   361  * This PHP is synchronized with the tmpl-theme template below!
   376  * This PHP is synchronized with the tmpl-theme template below!
   362  */
   377  */
   363 
   378 
   364 foreach ( $themes as $theme ) :
   379 foreach ( $themes as $theme ) :
   365 	$aria_action = esc_attr( $theme['id'] . '-action' );
   380 	$aria_action = $theme['id'] . '-action';
   366 	$aria_name   = esc_attr( $theme['id'] . '-name' );
   381 	$aria_name   = $theme['id'] . '-name';
   367 
   382 
   368 	$active_class = '';
   383 	$active_class = '';
   369 	if ( $theme['active'] ) {
   384 	if ( $theme['active'] ) {
   370 		$active_class = ' active';
   385 		$active_class = ' active';
   371 	}
   386 	}
   372 	?>
   387 	?>
   373 <div class="theme<?php echo $active_class; ?>">
   388 <div class="theme<?php echo $active_class; ?>">
   374 	<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
   389 	<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
   375 		<div class="theme-screenshot">
   390 		<div class="theme-screenshot">
   376 			<img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
   391 			<img src="<?php echo esc_url( $theme['screenshot'][0] . '?ver=' . $theme['version'] ); ?>" alt="" />
   377 		</div>
   392 		</div>
   378 	<?php } else { ?>
   393 	<?php } else { ?>
   379 		<div class="theme-screenshot blank"></div>
   394 		<div class="theme-screenshot blank"></div>
   380 	<?php } ?>
   395 	<?php } ?>
   381 
   396 
   392 			<div class="update-message notice inline notice-error notice-alt"><p>
   407 			<div class="update-message notice inline notice-error notice-alt"><p>
   393 				<?php
   408 				<?php
   394 				if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
   409 				if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
   395 					printf(
   410 					printf(
   396 						/* translators: %s: Theme name. */
   411 						/* translators: %s: Theme name. */
   397 						__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
   412 						__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
   398 						$theme['name']
   413 						$theme['name']
   399 					);
   414 					);
   400 					if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   415 					if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   401 						printf(
   416 						printf(
   402 							/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   417 							/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   420 						wp_update_php_annotation( '</p><p><em>', '</em>' );
   435 						wp_update_php_annotation( '</p><p><em>', '</em>' );
   421 					}
   436 					}
   422 				} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
   437 				} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
   423 					printf(
   438 					printf(
   424 						/* translators: %s: Theme name. */
   439 						/* translators: %s: Theme name. */
   425 						__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
   440 						__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
   426 						$theme['name']
   441 						$theme['name']
   427 					);
   442 					);
   428 					if ( current_user_can( 'update_core' ) ) {
   443 					if ( current_user_can( 'update_core' ) ) {
   429 						printf(
   444 						printf(
   430 							/* translators: %s: URL to WordPress Updates screen. */
   445 							/* translators: %s: URL to WordPress Updates screen. */
   433 						);
   448 						);
   434 					}
   449 					}
   435 				} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
   450 				} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
   436 					printf(
   451 					printf(
   437 						/* translators: %s: Theme name. */
   452 						/* translators: %s: Theme name. */
   438 						__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
   453 						__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
   439 						$theme['name']
   454 						$theme['name']
   440 					);
   455 					);
   441 					if ( current_user_can( 'update_php' ) ) {
   456 					if ( current_user_can( 'update_php' ) ) {
   442 						printf(
   457 						printf(
   443 							/* translators: %s: URL to Update PHP page. */
   458 							/* translators: %s: URL to Update PHP page. */
   454 
   469 
   455 	<?php
   470 	<?php
   456 	if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
   471 	if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
   457 		echo '<div class="notice inline notice-error notice-alt"><p>';
   472 		echo '<div class="notice inline notice-error notice-alt"><p>';
   458 		if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
   473 		if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
   459 			_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
   474 			_e( 'This theme does not work with your versions of WordPress and PHP.' );
   460 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   475 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   461 				printf(
   476 				printf(
   462 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   477 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   463 					' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   478 					' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   464 					self_admin_url( 'update-core.php' ),
   479 					self_admin_url( 'update-core.php' ),
   478 					esc_url( wp_get_update_php_url() )
   493 					esc_url( wp_get_update_php_url() )
   479 				);
   494 				);
   480 				wp_update_php_annotation( '</p><p><em>', '</em>' );
   495 				wp_update_php_annotation( '</p><p><em>', '</em>' );
   481 			}
   496 			}
   482 		} elseif ( ! $theme['compatibleWP'] ) {
   497 		} elseif ( ! $theme['compatibleWP'] ) {
   483 			_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
   498 			_e( 'This theme does not work with your version of WordPress.' );
   484 			if ( current_user_can( 'update_core' ) ) {
   499 			if ( current_user_can( 'update_core' ) ) {
   485 				printf(
   500 				printf(
   486 					/* translators: %s: URL to WordPress Updates screen. */
   501 					/* translators: %s: URL to WordPress Updates screen. */
   487 					' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   502 					' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   488 					self_admin_url( 'update-core.php' )
   503 					self_admin_url( 'update-core.php' )
   489 				);
   504 				);
   490 			}
   505 			}
   491 		} elseif ( ! $theme['compatiblePHP'] ) {
   506 		} elseif ( ! $theme['compatiblePHP'] ) {
   492 			_e( 'This theme doesn&#8217;t work with your version of PHP.' );
   507 			_e( 'This theme does not work with your version of PHP.' );
   493 			if ( current_user_can( 'update_php' ) ) {
   508 			if ( current_user_can( 'update_php' ) ) {
   494 				printf(
   509 				printf(
   495 					/* translators: %s: URL to Update PHP page. */
   510 					/* translators: %s: URL to Update PHP page. */
   496 					' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
   511 					' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
   497 					esc_url( wp_get_update_php_url() )
   512 					esc_url( wp_get_update_php_url() )
   505 
   520 
   506 	<?php
   521 	<?php
   507 	/* translators: %s: Theme name. */
   522 	/* translators: %s: Theme name. */
   508 	$details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] );
   523 	$details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] );
   509 	?>
   524 	?>
   510 	<button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></button>
   525 	<button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo esc_attr( $aria_action ); ?>"><?php _e( 'Theme Details' ); ?></button>
   511 	<div class="theme-author">
   526 	<div class="theme-author">
   512 		<?php
   527 		<?php
   513 		/* translators: %s: Theme author name. */
   528 		/* translators: %s: Theme author name. */
   514 		printf( __( 'By %s' ), $theme['author'] );
   529 		printf( __( 'By %s' ), $theme['author'] );
   515 		?>
   530 		?>
   516 	</div>
   531 	</div>
   517 
   532 
   518 	<div class="theme-id-container">
   533 	<div class="theme-id-container">
   519 		<?php if ( $theme['active'] ) { ?>
   534 		<?php if ( $theme['active'] ) { ?>
   520 			<h2 class="theme-name" id="<?php echo $aria_name; ?>">
   535 			<h2 class="theme-name" id="<?php echo esc_attr( $aria_name ); ?>">
   521 				<span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?>
   536 				<span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?>
   522 			</h2>
   537 			</h2>
   523 		<?php } else { ?>
   538 		<?php } else { ?>
   524 			<h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
   539 			<h2 class="theme-name" id="<?php echo esc_attr( $aria_name ); ?>"><?php echo $theme['name']; ?></h2>
   525 		<?php } ?>
   540 		<?php } ?>
   526 
   541 
   527 		<div class="theme-actions">
   542 		<div class="theme-actions">
   528 		<?php if ( $theme['active'] ) { ?>
   543 		<?php if ( $theme['active'] ) { ?>
   529 			<?php
   544 			<?php
   538 			/* translators: %s: Theme name. */
   553 			/* translators: %s: Theme name. */
   539 			$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
   554 			$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
   540 			?>
   555 			?>
   541 			<a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
   556 			<a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
   542 			<?php
   557 			<?php
   543 			if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
   558 			if ( ! $theme['blockTheme'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
   544 				/* translators: %s: Theme name. */
   559 				/* translators: %s: Theme name. */
   545 				$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
   560 				$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
   546 				?>
   561 				?>
   547 				<a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
   562 				<a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
   548 			<?php } ?>
   563 			<?php } ?>
   550 			<?php
   565 			<?php
   551 			/* translators: %s: Theme name. */
   566 			/* translators: %s: Theme name. */
   552 			$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
   567 			$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
   553 			?>
   568 			?>
   554 			<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
   569 			<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
   555 			<?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
   570 			<?php if ( ! $theme['blockTheme'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
   556 				<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
   571 				<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
   557 			<?php } ?>
   572 			<?php } ?>
   558 		<?php } ?>
   573 		<?php } ?>
   559 
   574 
   560 		</div>
   575 		</div>
   722  */
   737  */
   723 ?>
   738 ?>
   724 <script id="tmpl-theme" type="text/template">
   739 <script id="tmpl-theme" type="text/template">
   725 	<# if ( data.screenshot[0] ) { #>
   740 	<# if ( data.screenshot[0] ) { #>
   726 		<div class="theme-screenshot">
   741 		<div class="theme-screenshot">
   727 			<img src="{{ data.screenshot[0] }}" alt="" />
   742 			<img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" />
   728 		</div>
   743 		</div>
   729 	<# } else { #>
   744 	<# } else { #>
   730 		<div class="theme-screenshot blank"></div>
   745 		<div class="theme-screenshot blank"></div>
   731 	<# } #>
   746 	<# } #>
   732 
   747 
   743 			<div class="update-message notice inline notice-error notice-alt"><p>
   758 			<div class="update-message notice inline notice-error notice-alt"><p>
   744 				<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
   759 				<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
   745 					<?php
   760 					<?php
   746 					printf(
   761 					printf(
   747 						/* translators: %s: Theme name. */
   762 						/* translators: %s: Theme name. */
   748 						__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
   763 						__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
   749 						'{{{ data.name }}}'
   764 						'{{{ data.name }}}'
   750 					);
   765 					);
   751 					if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   766 					if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   752 						printf(
   767 						printf(
   753 							/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   768 							/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   773 					?>
   788 					?>
   774 				<# } else if ( ! data.updateResponse.compatibleWP ) { #>
   789 				<# } else if ( ! data.updateResponse.compatibleWP ) { #>
   775 					<?php
   790 					<?php
   776 					printf(
   791 					printf(
   777 						/* translators: %s: Theme name. */
   792 						/* translators: %s: Theme name. */
   778 						__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
   793 						__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
   779 						'{{{ data.name }}}'
   794 						'{{{ data.name }}}'
   780 					);
   795 					);
   781 					if ( current_user_can( 'update_core' ) ) {
   796 					if ( current_user_can( 'update_core' ) ) {
   782 						printf(
   797 						printf(
   783 							/* translators: %s: URL to WordPress Updates screen. */
   798 							/* translators: %s: URL to WordPress Updates screen. */
   788 					?>
   803 					?>
   789 				<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
   804 				<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
   790 					<?php
   805 					<?php
   791 					printf(
   806 					printf(
   792 						/* translators: %s: Theme name. */
   807 						/* translators: %s: Theme name. */
   793 						__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
   808 						__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
   794 						'{{{ data.name }}}'
   809 						'{{{ data.name }}}'
   795 					);
   810 					);
   796 					if ( current_user_can( 'update_php' ) ) {
   811 					if ( current_user_can( 'update_php' ) ) {
   797 						printf(
   812 						printf(
   798 							/* translators: %s: URL to Update PHP page. */
   813 							/* translators: %s: URL to Update PHP page. */
   809 
   824 
   810 	<# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
   825 	<# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
   811 		<div class="notice notice-error notice-alt"><p>
   826 		<div class="notice notice-error notice-alt"><p>
   812 			<# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
   827 			<# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
   813 				<?php
   828 				<?php
   814 				_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
   829 				_e( 'This theme does not work with your versions of WordPress and PHP.' );
   815 				if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   830 				if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   816 					printf(
   831 					printf(
   817 						/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   832 						/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   818 						' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   833 						' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   819 						self_admin_url( 'update-core.php' ),
   834 						self_admin_url( 'update-core.php' ),
   835 					wp_update_php_annotation( '</p><p><em>', '</em>' );
   850 					wp_update_php_annotation( '</p><p><em>', '</em>' );
   836 				}
   851 				}
   837 				?>
   852 				?>
   838 			<# } else if ( ! data.compatibleWP ) { #>
   853 			<# } else if ( ! data.compatibleWP ) { #>
   839 				<?php
   854 				<?php
   840 				_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
   855 				_e( 'This theme does not work with your version of WordPress.' );
   841 				if ( current_user_can( 'update_core' ) ) {
   856 				if ( current_user_can( 'update_core' ) ) {
   842 					printf(
   857 					printf(
   843 						/* translators: %s: URL to WordPress Updates screen. */
   858 						/* translators: %s: URL to WordPress Updates screen. */
   844 						' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   859 						' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   845 						self_admin_url( 'update-core.php' )
   860 						self_admin_url( 'update-core.php' )
   846 					);
   861 					);
   847 				}
   862 				}
   848 				?>
   863 				?>
   849 			<# } else if ( ! data.compatiblePHP ) { #>
   864 			<# } else if ( ! data.compatiblePHP ) { #>
   850 				<?php
   865 				<?php
   851 				_e( 'This theme doesn&#8217;t work with your version of PHP.' );
   866 				_e( 'This theme does not work with your version of PHP.' );
   852 				if ( current_user_can( 'update_php' ) ) {
   867 				if ( current_user_can( 'update_php' ) ) {
   853 					printf(
   868 					printf(
   854 						/* translators: %s: URL to Update PHP page. */
   869 						/* translators: %s: URL to Update PHP page. */
   855 						' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
   870 						' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
   856 						esc_url( wp_get_update_php_url() )
   871 						esc_url( wp_get_update_php_url() )
   896 				<# if ( data.compatibleWP && data.compatiblePHP ) { #>
   911 				<# if ( data.compatibleWP && data.compatiblePHP ) { #>
   897 					<?php
   912 					<?php
   898 					/* translators: %s: Theme name. */
   913 					/* translators: %s: Theme name. */
   899 					$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
   914 					$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
   900 					?>
   915 					?>
   901 					<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
   916 					<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
   902 					<?php
   917 					<# if ( ! data.blockTheme ) { #>
   903 					/* translators: %s: Theme name. */
   918 						<?php
   904 					$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
   919 						/* translators: %s: Theme name. */
   905 					?>
   920 						$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
   906 					<a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
   921 						?>
       
   922 						<a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
       
   923 					<# } #>
   907 				<# } else { #>
   924 				<# } else { #>
   908 					<?php
   925 					<?php
   909 					/* translators: %s: Theme name. */
   926 					/* translators: %s: Theme name. */
   910 					$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
   927 					$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
   911 					?>
   928 					?>
   912 					<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
   929 					<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
   913 					<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
   930 					<# if ( ! data.blockTheme ) { #>
       
   931 						<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
       
   932 					<# } #>
   914 				<# } #>
   933 				<# } #>
   915 			<# } #>
   934 			<# } #>
   916 		</div>
   935 		</div>
   917 	</div>
   936 	</div>
   918 </script>
   937 </script>
   926 			<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
   945 			<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
   927 		</div>
   946 		</div>
   928 		<div class="theme-about wp-clearfix">
   947 		<div class="theme-about wp-clearfix">
   929 			<div class="theme-screenshots">
   948 			<div class="theme-screenshots">
   930 			<# if ( data.screenshot[0] ) { #>
   949 			<# if ( data.screenshot[0] ) { #>
   931 				<div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
   950 				<div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div>
   932 			<# } else { #>
   951 			<# } else { #>
   933 				<div class="screenshot blank"></div>
   952 				<div class="screenshot blank"></div>
   934 			<# } #>
   953 			<# } #>
   935 			</div>
   954 			</div>
   936 
   955 
   937 			<div class="theme-info">
   956 			<div class="theme-info">
   938 				<# if ( data.active ) { #>
   957 				<# if ( data.active ) { #>
   939 					<span class="current-label"><?php _e( 'Current Theme' ); ?></span>
   958 					<span class="current-label"><?php _e( 'Active Theme' ); ?></span>
   940 				<# } #>
   959 				<# } #>
   941 				<h2 class="theme-name">{{{ data.name }}}<span class="theme-version">
   960 				<h2 class="theme-name">{{{ data.name }}}<span class="theme-version">
   942 					<?php
   961 					<?php
   943 					/* translators: %s: Theme version. */
   962 					/* translators: %s: Theme version. */
   944 					printf( __( 'Version: %s' ), '{{ data.version }}' );
   963 					printf( __( 'Version: %s' ), '{{ data.version }}' );
   953 
   972 
   954 				<# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
   973 				<# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
   955 					<div class="notice notice-error notice-alt notice-large"><p>
   974 					<div class="notice notice-error notice-alt notice-large"><p>
   956 						<# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
   975 						<# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
   957 							<?php
   976 							<?php
   958 							_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
   977 							_e( 'This theme does not work with your versions of WordPress and PHP.' );
   959 							if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   978 							if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   960 								printf(
   979 								printf(
   961 									/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   980 									/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   962 									' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   981 									' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   963 									self_admin_url( 'update-core.php' ),
   982 									self_admin_url( 'update-core.php' ),
   979 								wp_update_php_annotation( '</p><p><em>', '</em>' );
   998 								wp_update_php_annotation( '</p><p><em>', '</em>' );
   980 							}
   999 							}
   981 							?>
  1000 							?>
   982 						<# } else if ( ! data.compatibleWP ) { #>
  1001 						<# } else if ( ! data.compatibleWP ) { #>
   983 							<?php
  1002 							<?php
   984 							_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
  1003 							_e( 'This theme does not work with your version of WordPress.' );
   985 							if ( current_user_can( 'update_core' ) ) {
  1004 							if ( current_user_can( 'update_core' ) ) {
   986 								printf(
  1005 								printf(
   987 									/* translators: %s: URL to WordPress Updates screen. */
  1006 									/* translators: %s: URL to WordPress Updates screen. */
   988 									' ' . __( '<a href="%s">Please update WordPress</a>.' ),
  1007 									' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   989 									self_admin_url( 'update-core.php' )
  1008 									self_admin_url( 'update-core.php' )
   990 								);
  1009 								);
   991 							}
  1010 							}
   992 							?>
  1011 							?>
   993 						<# } else if ( ! data.compatiblePHP ) { #>
  1012 						<# } else if ( ! data.compatiblePHP ) { #>
   994 							<?php
  1013 							<?php
   995 							_e( 'This theme doesn&#8217;t work with your version of PHP.' );
  1014 							_e( 'This theme does not work with your version of PHP.' );
   996 							if ( current_user_can( 'update_php' ) ) {
  1015 							if ( current_user_can( 'update_php' ) ) {
   997 								printf(
  1016 								printf(
   998 									/* translators: %s: URL to Update PHP page. */
  1017 									/* translators: %s: URL to Update PHP page. */
   999 									' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
  1018 									' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
  1000 									esc_url( wp_get_update_php_url() )
  1019 									esc_url( wp_get_update_php_url() )
  1018 							<p>
  1037 							<p>
  1019 								<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
  1038 								<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
  1020 									<?php
  1039 									<?php
  1021 									printf(
  1040 									printf(
  1022 										/* translators: %s: Theme name. */
  1041 										/* translators: %s: Theme name. */
  1023 										__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
  1042 										__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
  1024 										'{{{ data.name }}}'
  1043 										'{{{ data.name }}}'
  1025 									);
  1044 									);
  1026 									if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
  1045 									if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
  1027 										printf(
  1046 										printf(
  1028 											/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
  1047 											/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
  1048 									?>
  1067 									?>
  1049 								<# } else if ( ! data.updateResponse.compatibleWP ) { #>
  1068 								<# } else if ( ! data.updateResponse.compatibleWP ) { #>
  1050 									<?php
  1069 									<?php
  1051 									printf(
  1070 									printf(
  1052 										/* translators: %s: Theme name. */
  1071 										/* translators: %s: Theme name. */
  1053 										__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
  1072 										__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
  1054 										'{{{ data.name }}}'
  1073 										'{{{ data.name }}}'
  1055 									);
  1074 									);
  1056 									if ( current_user_can( 'update_core' ) ) {
  1075 									if ( current_user_can( 'update_core' ) ) {
  1057 										printf(
  1076 										printf(
  1058 											/* translators: %s: URL to WordPress Updates screen. */
  1077 											/* translators: %s: URL to WordPress Updates screen. */
  1063 									?>
  1082 									?>
  1064 								<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
  1083 								<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
  1065 									<?php
  1084 									<?php
  1066 									printf(
  1085 									printf(
  1067 										/* translators: %s: Theme name. */
  1086 										/* translators: %s: Theme name. */
  1068 										__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
  1087 										__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
  1069 										'{{{ data.name }}}'
  1088 										'{{{ data.name }}}'
  1070 									);
  1089 									);
  1071 									if ( current_user_can( 'update_php' ) ) {
  1090 									if ( current_user_can( 'update_php' ) ) {
  1072 										printf(
  1091 										printf(
  1073 											/* translators: %s: URL to Update PHP page. */
  1092 											/* translators: %s: URL to Update PHP page. */
  1114 					<?php
  1133 					<?php
  1115 					/* translators: %s: Theme name. */
  1134 					/* translators: %s: Theme name. */
  1116 					$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
  1135 					$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
  1117 					?>
  1136 					?>
  1118 					<# if ( data.actions.activate ) { #>
  1137 					<# if ( data.actions.activate ) { #>
  1119 						<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
  1138 						<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
  1120 					<# } #>
  1139 					<# } #>
  1121 					<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
  1140 					<# if ( ! data.blockTheme ) { #>
       
  1141 						<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
       
  1142 					<# } #>
  1122 				<# } else { #>
  1143 				<# } else { #>
  1123 					<?php
  1144 					<?php
  1124 					/* translators: %s: Theme name. */
  1145 					/* translators: %s: Theme name. */
  1125 					$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
  1146 					$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
  1126 					?>
  1147 					?>
  1127 					<# if ( data.actions.activate ) { #>
  1148 					<# if ( data.actions.activate ) { #>
  1128 						<a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
  1149 						<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
  1129 					<# } #>
  1150 					<# } #>
  1130 					<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
  1151 					<# if ( ! data.blockTheme ) { #>
       
  1152 						<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
       
  1153 					<# } #>
  1131 				<# } #>
  1154 				<# } #>
  1132 			</div>
  1155 			</div>
  1133 
  1156 
  1134 			<# if ( ! data.active && data.actions['delete'] ) { #>
  1157 			<# if ( ! data.active && data.actions['delete'] ) { #>
  1135 				<?php
  1158 				<?php
  1136 				/* translators: %s: Theme name. */
  1159 				/* translators: %s: Theme name. */
  1137 				$aria_label = sprintf( _x( 'Delete %s', 'theme' ), '{{ data.name }}' );
  1160 				$aria_label = sprintf( _x( 'Delete %s', 'theme' ), '{{ data.name }}' );
  1138 				?>
  1161 				?>
  1139 				<a href="{{{ data.actions['delete'] }}}" class="button delete-theme" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Delete' ); ?></a>
  1162 				<a href="{{{ data.actions['delete'] }}}" class="button delete-theme" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Delete' ); ?></a>
  1140 			<# } #>
  1163 			<# } #>
  1141 		</div>
  1164 		</div>
  1142 	</div>
  1165 	</div>
  1143 </script>
  1166 </script>
  1144 
  1167