wp/wp-includes/customize/class-wp-customize-theme-control.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    72 			<div class="theme" tabindex="0" aria-describedby="{{ data.section }}-{{ data.theme.id }}-action">
    72 			<div class="theme" tabindex="0" aria-describedby="{{ data.section }}-{{ data.theme.id }}-action">
    73 		<# } #>
    73 		<# } #>
    74 
    74 
    75 			<# if ( data.theme.screenshot && data.theme.screenshot[0] ) { #>
    75 			<# if ( data.theme.screenshot && data.theme.screenshot[0] ) { #>
    76 				<div class="theme-screenshot">
    76 				<div class="theme-screenshot">
    77 					<img data-src="{{ data.theme.screenshot[0] }}" alt="" />
    77 					<img data-src="{{ data.theme.screenshot[0] }}?ver={{ data.theme.version }}" alt="" />
    78 				</div>
    78 				</div>
    79 			<# } else { #>
    79 			<# } else { #>
    80 				<div class="theme-screenshot blank"></div>
    80 				<div class="theme-screenshot blank"></div>
    81 			<# } #>
    81 			<# } #>
    82 
    82 
   111 						<p>
   111 						<p>
   112 							<# if ( ! data.theme.updateResponse.compatibleWP && ! data.theme.updateResponse.compatiblePHP ) { #>
   112 							<# if ( ! data.theme.updateResponse.compatibleWP && ! data.theme.updateResponse.compatiblePHP ) { #>
   113 								<?php
   113 								<?php
   114 								printf(
   114 								printf(
   115 									/* translators: %s: Theme name. */
   115 									/* translators: %s: Theme name. */
   116 									__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
   116 									__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
   117 									'{{{ data.theme.name }}}'
   117 									'{{{ data.theme.name }}}'
   118 								);
   118 								);
   119 								if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   119 								if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   120 									printf(
   120 									printf(
   121 										/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   121 										/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   141 								?>
   141 								?>
   142 							<# } else if ( ! data.theme.updateResponse.compatibleWP ) { #>
   142 							<# } else if ( ! data.theme.updateResponse.compatibleWP ) { #>
   143 								<?php
   143 								<?php
   144 								printf(
   144 								printf(
   145 									/* translators: %s: Theme name. */
   145 									/* translators: %s: Theme name. */
   146 									__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
   146 									__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
   147 									'{{{ data.theme.name }}}'
   147 									'{{{ data.theme.name }}}'
   148 								);
   148 								);
   149 								if ( current_user_can( 'update_core' ) ) {
   149 								if ( current_user_can( 'update_core' ) ) {
   150 									printf(
   150 									printf(
   151 										/* translators: %s: URL to WordPress Updates screen. */
   151 										/* translators: %s: URL to WordPress Updates screen. */
   156 								?>
   156 								?>
   157 							<# } else if ( ! data.theme.updateResponse.compatiblePHP ) { #>
   157 							<# } else if ( ! data.theme.updateResponse.compatiblePHP ) { #>
   158 								<?php
   158 								<?php
   159 								printf(
   159 								printf(
   160 									/* translators: %s: Theme name. */
   160 									/* translators: %s: Theme name. */
   161 									__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
   161 									__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
   162 									'{{{ data.theme.name }}}'
   162 									'{{{ data.theme.name }}}'
   163 								);
   163 								);
   164 								if ( current_user_can( 'update_php' ) ) {
   164 								if ( current_user_can( 'update_php' ) ) {
   165 									printf(
   165 									printf(
   166 										/* translators: %s: URL to Update PHP page. */
   166 										/* translators: %s: URL to Update PHP page. */
   178 
   178 
   179 			<# if ( ! data.theme.compatibleWP || ! data.theme.compatiblePHP ) { #>
   179 			<# if ( ! data.theme.compatibleWP || ! data.theme.compatiblePHP ) { #>
   180 				<div class="notice notice-error notice-alt"><p>
   180 				<div class="notice notice-error notice-alt"><p>
   181 					<# if ( ! data.theme.compatibleWP && ! data.theme.compatiblePHP ) { #>
   181 					<# if ( ! data.theme.compatibleWP && ! data.theme.compatiblePHP ) { #>
   182 						<?php
   182 						<?php
   183 						_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
   183 						_e( 'This theme does not work with your versions of WordPress and PHP.' );
   184 						if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   184 						if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   185 							printf(
   185 							printf(
   186 								/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   186 								/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   187 								' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   187 								' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   188 								self_admin_url( 'update-core.php' ),
   188 								self_admin_url( 'update-core.php' ),
   204 							wp_update_php_annotation( '</p><p><em>', '</em>' );
   204 							wp_update_php_annotation( '</p><p><em>', '</em>' );
   205 						}
   205 						}
   206 						?>
   206 						?>
   207 					<# } else if ( ! data.theme.compatibleWP ) { #>
   207 					<# } else if ( ! data.theme.compatibleWP ) { #>
   208 						<?php
   208 						<?php
   209 						_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
   209 						_e( 'This theme does not work with your version of WordPress.' );
   210 						if ( current_user_can( 'update_core' ) ) {
   210 						if ( current_user_can( 'update_core' ) ) {
   211 							printf(
   211 							printf(
   212 								/* translators: %s: URL to WordPress Updates screen. */
   212 								/* translators: %s: URL to WordPress Updates screen. */
   213 								' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   213 								' ' . __( '<a href="%s">Please update WordPress</a>.' ),
   214 								self_admin_url( 'update-core.php' )
   214 								self_admin_url( 'update-core.php' )
   215 							);
   215 							);
   216 						}
   216 						}
   217 						?>
   217 						?>
   218 					<# } else if ( ! data.theme.compatiblePHP ) { #>
   218 					<# } else if ( ! data.theme.compatiblePHP ) { #>
   219 						<?php
   219 						<?php
   220 						_e( 'This theme doesn&#8217;t work with your version of PHP.' );
   220 						_e( 'This theme does not work with your version of PHP.' );
   221 						if ( current_user_can( 'update_php' ) ) {
   221 						if ( current_user_can( 'update_php' ) ) {
   222 							printf(
   222 							printf(
   223 								/* translators: %s: URL to Update PHP page. */
   223 								/* translators: %s: URL to Update PHP page. */
   224 								' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
   224 								' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
   225 								esc_url( wp_get_update_php_url() )
   225 								esc_url( wp_get_update_php_url() )
   240 						<button type="button" class="button button-primary customize-theme" aria-label="<?php echo esc_attr( $customize_label ); ?>"><?php _e( 'Customize' ); ?></button>
   240 						<button type="button" class="button button-primary customize-theme" aria-label="<?php echo esc_attr( $customize_label ); ?>"><?php _e( 'Customize' ); ?></button>
   241 					</div>
   241 					</div>
   242 				</div>
   242 				</div>
   243 				<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
   243 				<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
   244 			<# } else if ( 'installed' === data.theme.type ) { #>
   244 			<# } else if ( 'installed' === data.theme.type ) { #>
   245 				<div class="theme-id-container">
   245 				<# if ( data.theme.blockTheme ) { #>
   246 					<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
   246 					<div class="theme-id-container">
   247 					<div class="theme-actions">
   247 						<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
   248 						<# if ( data.theme.compatibleWP && data.theme.compatiblePHP ) { #>
   248 						<div class="theme-actions">
   249 							<button type="button" class="button button-primary preview-theme" aria-label="<?php echo esc_attr( $preview_label ); ?>" data-slug="{{ data.theme.id }}"><?php _e( 'Live Preview' ); ?></button>
   249 							<# if ( data.theme.actions.activate ) { #>
   250 						<# } else { #>
   250 								<?php
   251 							<button type="button" class="button button-primary disabled" aria-label="<?php echo esc_attr( $preview_label ); ?>"><?php _e( 'Live Preview' ); ?></button>
   251 									/* translators: %s: Theme name. */
   252 						<# } #>
   252 									$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
   253 					</div>
   253 								?>
   254 				</div>
   254 								<a href="{{{ data.theme.actions.activate }}}" class="button button-primary activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
   255 				<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
   255 							<# } #>
       
   256 						</div>
       
   257 					</div>
       
   258 					<div class="notice notice-error notice-alt"><p>
       
   259 					<?php
       
   260 						_e( 'This theme doesn\'t support Customizer.' );
       
   261 					?>
       
   262 					<# if ( data.theme.actions.activate ) { #>
       
   263 						<?php
       
   264 							echo ' ';
       
   265 							printf(
       
   266 								/* translators: %s: URL to the themes page (also it activates the theme). */
       
   267 								__( 'However, you can still <a href="%s">activate this theme</a>, and use the Site Editor to customize it.' ),
       
   268 								'{{{ data.theme.actions.activate }}}'
       
   269 							);
       
   270 						?>
       
   271 					<# } #>
       
   272 					</p></div>
       
   273 				<# } else { #>
       
   274 					<div class="theme-id-container">
       
   275 						<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
       
   276 						<div class="theme-actions">
       
   277 							<# if ( data.theme.compatibleWP && data.theme.compatiblePHP ) { #>
       
   278 								<button type="button" class="button button-primary preview-theme" aria-label="<?php echo esc_attr( $preview_label ); ?>" data-slug="{{ data.theme.id }}"><?php _e( 'Live Preview' ); ?></button>
       
   279 							<# } else { #>
       
   280 								<button type="button" class="button button-primary disabled" aria-label="<?php echo esc_attr( $preview_label ); ?>"><?php _e( 'Live Preview' ); ?></button>
       
   281 							<# } #>
       
   282 						</div>
       
   283 					</div>
       
   284 					<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
       
   285 				<# } #>
   256 			<# } else { #>
   286 			<# } else { #>
   257 				<div class="theme-id-container">
   287 				<div class="theme-id-container">
   258 					<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
   288 					<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
   259 					<div class="theme-actions">
   289 					<div class="theme-actions">
   260 						<# if ( data.theme.compatibleWP && data.theme.compatiblePHP ) { #>
   290 						<# if ( data.theme.compatibleWP && data.theme.compatiblePHP ) { #>