188 'TB_iframe' => 'true', |
192 'TB_iframe' => 'true', |
189 'width' => 1024, |
193 'width' => 1024, |
190 'height' => 800, |
194 'height' => 800, |
191 ), |
195 ), |
192 $update['url'] |
196 $update['url'] |
193 ); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list. |
197 ); // Theme browser inside WP? Replace this. Also, theme preview JS will override this on the available list. |
194 $update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet ); |
198 $update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet ); |
195 |
199 |
196 if ( ! is_multisite() ) { |
200 if ( ! is_multisite() ) { |
197 if ( ! current_user_can( 'update_themes' ) ) { |
201 if ( ! current_user_can( 'update_themes' ) ) { |
198 /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number */ |
|
199 $html = sprintf( |
202 $html = sprintf( |
|
203 /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */ |
200 '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ) . '</strong></p>', |
204 '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ) . '</strong></p>', |
201 $theme_name, |
205 $theme_name, |
202 esc_url( $details_url ), |
206 esc_url( $details_url ), |
203 sprintf( |
207 sprintf( |
204 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
208 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
205 /* translators: 1: theme name, 2: version number */ |
209 /* translators: 1: Theme name, 2: Version number. */ |
206 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) |
210 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) |
207 ), |
211 ), |
208 $update['new_version'] |
212 $update['new_version'] |
209 ); |
213 ); |
210 } elseif ( empty( $update['package'] ) ) { |
214 } elseif ( empty( $update['package'] ) ) { |
211 /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number */ |
|
212 $html = sprintf( |
215 $html = sprintf( |
|
216 /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */ |
213 '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ) . '</strong></p>', |
217 '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ) . '</strong></p>', |
214 $theme_name, |
218 $theme_name, |
215 esc_url( $details_url ), |
219 esc_url( $details_url ), |
216 sprintf( |
220 sprintf( |
217 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
221 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
218 /* translators: 1: theme name, 2: version number */ |
222 /* translators: 1: Theme name, 2: Version number. */ |
219 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) |
223 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) |
220 ), |
224 ), |
221 $update['new_version'] |
225 $update['new_version'] |
222 ); |
226 ); |
223 } else { |
227 } else { |
224 /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */ |
|
225 $html = sprintf( |
228 $html = sprintf( |
|
229 /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */ |
226 '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ) . '</strong></p>', |
230 '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ) . '</strong></p>', |
227 $theme_name, |
231 $theme_name, |
228 esc_url( $details_url ), |
232 esc_url( $details_url ), |
229 sprintf( |
233 sprintf( |
230 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
234 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
231 /* translators: 1: theme name, 2: version number */ |
235 /* translators: 1: Theme name, 2: Version number. */ |
232 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) |
236 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) |
233 ), |
237 ), |
234 $update['new_version'], |
238 $update['new_version'], |
235 $update_url, |
239 $update_url, |
236 sprintf( |
240 sprintf( |
237 'aria-label="%s" id="update-theme" data-slug="%s"', |
241 'aria-label="%s" id="update-theme" data-slug="%s"', |
238 /* translators: %s: theme name */ |
242 /* translators: %s: Theme name. */ |
239 esc_attr( sprintf( __( 'Update %s now' ), $theme_name ) ), |
243 esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme_name ) ), |
240 $stylesheet |
244 $stylesheet |
241 ) |
245 ) |
242 ); |
246 ); |
243 } |
247 } |
244 } |
248 } |
249 |
253 |
250 /** |
254 /** |
251 * Retrieve list of WordPress theme features (aka theme tags). |
255 * Retrieve list of WordPress theme features (aka theme tags). |
252 * |
256 * |
253 * @since 3.1.0 |
257 * @since 3.1.0 |
|
258 * @since 3.2.0 Added 'Gray' color and 'Featured Image Header', 'Featured Images', |
|
259 * 'Full Width Template', and 'Post Formats' features. |
|
260 * @since 3.5.0 Added 'Flexible Header' feature. |
|
261 * @since 3.8.0 Renamed 'Width' filter to 'Layout'. |
|
262 * @since 3.8.0 Renamed 'Fixed Width' and 'Flexible Width' options |
|
263 * to 'Fixed Layout' and 'Fluid Layout'. |
|
264 * @since 3.8.0 Added 'Accessibility Ready' feature and 'Responsive Layout' option. |
|
265 * @since 3.9.0 Combined 'Layout' and 'Columns' filters. |
|
266 * @since 4.6.0 Removed 'Colors' filter. |
|
267 * @since 4.6.0 Added 'Grid Layout' option. |
|
268 * Removed 'Fixed Layout', 'Fluid Layout', and 'Responsive Layout' options. |
|
269 * @since 4.6.0 Added 'Custom Logo' and 'Footer Widgets' features. |
|
270 * Removed 'Blavatar' feature. |
|
271 * @since 4.6.0 Added 'Blog', 'E-Commerce', 'Education', 'Entertainment', 'Food & Drink', |
|
272 * 'Holiday', 'News', 'Photography', and 'Portfolio' subjects. |
|
273 * Removed 'Photoblogging' and 'Seasonal' subjects. |
|
274 * @since 4.9.0 Reordered the filters from 'Layout', 'Features', 'Subject' |
|
275 * to 'Subject', 'Features', 'Layout'. |
|
276 * @since 4.9.0 Removed 'BuddyPress', 'Custom Menu', 'Flexible Header', |
|
277 * 'Front Page Posting', 'Microformats', 'RTL Language Support', |
|
278 * 'Threaded Comments', and 'Translation Ready' features. |
|
279 * @since 5.5.0 Added 'Block Editor Patterns', 'Block Editor Styles', |
|
280 * and 'Full Site Editing' features. |
|
281 * @since 5.5.0 Added 'Wide Blocks' layout option. |
254 * |
282 * |
255 * @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true. |
283 * @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true. |
256 * @return array Array of features keyed by category with translations keyed by slug. |
284 * @return array Array of features keyed by category with translations keyed by slug. |
257 */ |
285 */ |
258 function get_theme_feature_list( $api = true ) { |
286 function get_theme_feature_list( $api = true ) { |
259 // Hard-coded list is used if api not accessible. |
287 // Hard-coded list is used if API is not accessible. |
260 $features = array( |
288 $features = array( |
261 |
289 |
262 __( 'Subject' ) => array( |
290 __( 'Subject' ) => array( |
263 'blog' => __( 'Blog' ), |
291 'blog' => __( 'Blog' ), |
264 'e-commerce' => __( 'E-Commerce' ), |
292 'e-commerce' => __( 'E-Commerce' ), |
271 'portfolio' => __( 'Portfolio' ), |
299 'portfolio' => __( 'Portfolio' ), |
272 ), |
300 ), |
273 |
301 |
274 __( 'Features' ) => array( |
302 __( 'Features' ) => array( |
275 'accessibility-ready' => __( 'Accessibility Ready' ), |
303 'accessibility-ready' => __( 'Accessibility Ready' ), |
|
304 'block-patterns' => __( 'Block Editor Patterns' ), |
|
305 'block-styles' => __( 'Block Editor Styles' ), |
276 'custom-background' => __( 'Custom Background' ), |
306 'custom-background' => __( 'Custom Background' ), |
277 'custom-colors' => __( 'Custom Colors' ), |
307 'custom-colors' => __( 'Custom Colors' ), |
278 'custom-header' => __( 'Custom Header' ), |
308 'custom-header' => __( 'Custom Header' ), |
279 'custom-logo' => __( 'Custom Logo' ), |
309 'custom-logo' => __( 'Custom Logo' ), |
280 'editor-style' => __( 'Editor Style' ), |
310 'editor-style' => __( 'Editor Style' ), |
281 'featured-image-header' => __( 'Featured Image Header' ), |
311 'featured-image-header' => __( 'Featured Image Header' ), |
282 'featured-images' => __( 'Featured Images' ), |
312 'featured-images' => __( 'Featured Images' ), |
283 'footer-widgets' => __( 'Footer Widgets' ), |
313 'footer-widgets' => __( 'Footer Widgets' ), |
|
314 'full-site-editing' => __( 'Full Site Editing' ), |
284 'full-width-template' => __( 'Full Width Template' ), |
315 'full-width-template' => __( 'Full Width Template' ), |
285 'post-formats' => __( 'Post Formats' ), |
316 'post-formats' => __( 'Post Formats' ), |
286 'sticky-post' => __( 'Sticky Post' ), |
317 'sticky-post' => __( 'Sticky Post' ), |
287 'theme-options' => __( 'Theme Options' ), |
318 'theme-options' => __( 'Theme Options' ), |
288 ), |
319 ), |
293 'two-columns' => __( 'Two Columns' ), |
324 'two-columns' => __( 'Two Columns' ), |
294 'three-columns' => __( 'Three Columns' ), |
325 'three-columns' => __( 'Three Columns' ), |
295 'four-columns' => __( 'Four Columns' ), |
326 'four-columns' => __( 'Four Columns' ), |
296 'left-sidebar' => __( 'Left Sidebar' ), |
327 'left-sidebar' => __( 'Left Sidebar' ), |
297 'right-sidebar' => __( 'Right Sidebar' ), |
328 'right-sidebar' => __( 'Right Sidebar' ), |
|
329 'wide-blocks' => __( 'Wide Blocks' ), |
298 ), |
330 ), |
299 |
331 |
300 ); |
332 ); |
301 |
333 |
302 if ( ! $api || ! current_user_can( 'install_themes' ) ) { |
334 if ( ! $api || ! current_user_can( 'install_themes' ) ) { |
303 return $features; |
335 return $features; |
304 } |
336 } |
305 |
337 |
306 if ( ! $feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) { |
338 $feature_list = get_site_transient( 'wporg_theme_feature_list' ); |
|
339 if ( ! $feature_list ) { |
307 set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); |
340 set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); |
308 } |
341 } |
309 |
342 |
310 if ( ! $feature_list ) { |
343 if ( ! $feature_list ) { |
311 $feature_list = themes_api( 'feature_list', array() ); |
344 $feature_list = themes_api( 'feature_list', array() ); |
324 'Layout' => __( 'Layout' ), |
357 'Layout' => __( 'Layout' ), |
325 'Features' => __( 'Features' ), |
358 'Features' => __( 'Features' ), |
326 'Subject' => __( 'Subject' ), |
359 'Subject' => __( 'Subject' ), |
327 ); |
360 ); |
328 |
361 |
329 // Loop over the wporg canonical list and apply translations |
|
330 $wporg_features = array(); |
362 $wporg_features = array(); |
|
363 |
|
364 // Loop over the wp.org canonical list and apply translations. |
331 foreach ( (array) $feature_list as $feature_category => $feature_items ) { |
365 foreach ( (array) $feature_list as $feature_category => $feature_items ) { |
332 if ( isset( $category_translations[ $feature_category ] ) ) { |
366 if ( isset( $category_translations[ $feature_category ] ) ) { |
333 $feature_category = $category_translations[ $feature_category ]; |
367 $feature_category = $category_translations[ $feature_category ]; |
334 } |
368 } |
|
369 |
335 $wporg_features[ $feature_category ] = array(); |
370 $wporg_features[ $feature_category ] = array(); |
336 |
371 |
337 foreach ( $feature_items as $feature ) { |
372 foreach ( $feature_items as $feature ) { |
338 if ( isset( $features[ $feature_category ][ $feature ] ) ) { |
373 if ( isset( $features[ $feature_category ][ $feature ] ) ) { |
339 $wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ]; |
374 $wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ]; |
426 * @return object|array|WP_Error Response object or array on success, WP_Error on failure. See the |
461 * @return object|array|WP_Error Response object or array on success, WP_Error on failure. See the |
427 * {@link https://developer.wordpress.org/reference/functions/themes_api/ function reference article} |
462 * {@link https://developer.wordpress.org/reference/functions/themes_api/ function reference article} |
428 * for more information on the make-up of possible return objects depending on the value of `$action`. |
463 * for more information on the make-up of possible return objects depending on the value of `$action`. |
429 */ |
464 */ |
430 function themes_api( $action, $args = array() ) { |
465 function themes_api( $action, $args = array() ) { |
431 // include an unmodified $wp_version |
466 // Include an unmodified $wp_version. |
432 include( ABSPATH . WPINC . '/version.php' ); |
467 require ABSPATH . WPINC . '/version.php'; |
433 |
468 |
434 if ( is_array( $args ) ) { |
469 if ( is_array( $args ) ) { |
435 $args = (object) $args; |
470 $args = (object) $args; |
436 } |
471 } |
437 |
472 |
438 if ( 'query_themes' == $action ) { |
473 if ( 'query_themes' === $action ) { |
439 if ( ! isset( $args->per_page ) ) { |
474 if ( ! isset( $args->per_page ) ) { |
440 $args->per_page = 24; |
475 $args->per_page = 24; |
441 } |
476 } |
442 } |
477 } |
443 |
478 |
444 if ( ! isset( $args->locale ) ) { |
479 if ( ! isset( $args->locale ) ) { |
445 $args->locale = get_user_locale(); |
480 $args->locale = get_user_locale(); |
446 } |
481 } |
447 |
482 |
448 if ( ! isset( $args->wp_version ) ) { |
483 if ( ! isset( $args->wp_version ) ) { |
449 $args->wp_version = substr( $wp_version, 0, 3 ); // X.y |
484 $args->wp_version = substr( $wp_version, 0, 3 ); // x.y |
450 } |
485 } |
451 |
486 |
452 /** |
487 /** |
453 * Filters arguments used to query for installer pages from the WordPress.org Themes API. |
488 * Filters arguments used to query for installer pages from the WordPress.org Themes API. |
454 * |
489 * |
644 wp_customize_url( $slug ) |
686 wp_customize_url( $slug ) |
645 ) |
687 ) |
646 ); |
688 ); |
647 } |
689 } |
648 |
690 |
|
691 $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; |
|
692 $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; |
|
693 |
|
694 $auto_update = in_array( $slug, $auto_updates, true ); |
|
695 $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; |
|
696 |
|
697 if ( isset( $updates[ $slug ] ) ) { |
|
698 $auto_update_supported = true; |
|
699 $auto_update_filter_payload = (object) $updates[ $slug ]; |
|
700 } elseif ( isset( $no_updates[ $slug ] ) ) { |
|
701 $auto_update_supported = true; |
|
702 $auto_update_filter_payload = (object) $no_updates[ $slug ]; |
|
703 } else { |
|
704 $auto_update_supported = false; |
|
705 /* |
|
706 * Create the expected payload for the auto_update_theme filter, this is the same data |
|
707 * as contained within $updates or $no_updates but used when the Theme is not known. |
|
708 */ |
|
709 $auto_update_filter_payload = (object) array( |
|
710 'theme' => $slug, |
|
711 'new_version' => $theme->get( 'Version' ), |
|
712 'url' => '', |
|
713 'package' => '', |
|
714 'requires' => $theme->get( 'RequiresWP' ), |
|
715 'requires_php' => $theme->get( 'RequiresPHP' ), |
|
716 ); |
|
717 } |
|
718 |
|
719 $type = 'theme'; |
|
720 /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ |
|
721 $auto_update_forced = apply_filters( "auto_update_{$type}", null, $auto_update_filter_payload ); |
|
722 |
649 $prepared_themes[ $slug ] = array( |
723 $prepared_themes[ $slug ] = array( |
650 'id' => $slug, |
724 'id' => $slug, |
651 'name' => $theme->display( 'Name' ), |
725 'name' => $theme->display( 'Name' ), |
652 'screenshot' => array( $theme->get_screenshot() ), // @todo multiple |
726 'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots. |
653 'description' => $theme->display( 'Description' ), |
727 'description' => $theme->display( 'Description' ), |
654 'author' => $theme->display( 'Author', false, true ), |
728 'author' => $theme->display( 'Author', false, true ), |
655 'authorAndUri' => $theme->display( 'Author' ), |
729 'authorAndUri' => $theme->display( 'Author' ), |
656 'version' => $theme->display( 'Version' ), |
730 'tags' => $theme->display( 'Tags' ), |
657 'tags' => $theme->display( 'Tags' ), |
731 'version' => $theme->get( 'Version' ), |
658 'parent' => $parent, |
732 'compatibleWP' => is_wp_version_compatible( $theme->get( 'RequiresWP' ) ), |
659 'active' => $slug === $current_theme, |
733 'compatiblePHP' => is_php_version_compatible( $theme->get( 'RequiresPHP' ) ), |
660 'hasUpdate' => isset( $updates[ $slug ] ), |
734 'updateResponse' => array( |
661 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), |
735 'compatibleWP' => is_wp_version_compatible( $update_requires_wp ), |
662 'update' => get_theme_update_available( $theme ), |
736 'compatiblePHP' => is_php_version_compatible( $update_requires_php ), |
663 'actions' => array( |
737 ), |
664 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, |
738 'parent' => $parent, |
665 'customize' => $customize_action, |
739 'active' => $slug === $current_theme, |
666 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, |
740 'hasUpdate' => isset( $updates[ $slug ] ), |
|
741 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), |
|
742 'update' => get_theme_update_available( $theme ), |
|
743 'autoupdate' => array( |
|
744 'enabled' => $auto_update || $auto_update_forced, |
|
745 'supported' => $auto_update_supported, |
|
746 'forced' => $auto_update_forced, |
|
747 ), |
|
748 'actions' => array( |
|
749 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, |
|
750 'customize' => $customize_action, |
|
751 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, |
|
752 'autoupdate' => wp_is_auto_update_enabled_for_type( 'theme' ) && ! is_multisite() && current_user_can( 'update_themes' ) |
|
753 ? wp_nonce_url( admin_url( 'themes.php?action=' . $auto_update_action . '&stylesheet=' . $encoded_slug ), 'updates' ) |
|
754 : null, |
667 ), |
755 ), |
668 ); |
756 ); |
669 } |
757 } |
670 |
758 |
671 // Remove 'delete' action if theme has an active child |
759 // Remove 'delete' action if theme has an active child. |
672 if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) { |
760 if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) { |
673 unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); |
761 unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); |
674 } |
762 } |
675 |
763 |
676 /** |
764 /** |
713 |
801 |
714 <div class="theme-info"> |
802 <div class="theme-info"> |
715 <# if ( data.active ) { #> |
803 <# if ( data.active ) { #> |
716 <span class="current-label"><?php _e( 'Current Theme' ); ?></span> |
804 <span class="current-label"><?php _e( 'Current Theme' ); ?></span> |
717 <# } #> |
805 <# } #> |
718 <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h2> |
806 <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"> |
719 <h3 class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></h3> |
807 <?php |
|
808 /* translators: %s: Theme version. */ |
|
809 printf( __( 'Version: %s' ), '{{ data.version }}' ); |
|
810 ?> |
|
811 </span></h2> |
|
812 <h3 class="theme-author"> |
|
813 <?php |
|
814 /* translators: %s: Theme author link. */ |
|
815 printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); |
|
816 ?> |
|
817 </h3> |
720 |
818 |
721 <# if ( data.stars && 0 != data.num_ratings ) { #> |
819 <# if ( data.stars && 0 != data.num_ratings ) { #> |
722 <div class="theme-rating"> |
820 <div class="theme-rating"> |
723 {{{ data.stars }}} |
821 {{{ data.stars }}} |
724 <a class="num-ratings" target="_blank" href="{{ data.reviews_url }}"> |
822 <a class="num-ratings" target="_blank" href="{{ data.reviews_url }}"> |
725 <?php |
823 <?php |
726 printf( |
824 printf( |
727 '%1$s <span class="screen-reader-text">%2$s</span>', |
825 '%1$s <span class="screen-reader-text">%2$s</span>', |
728 /* translators: %s: number of ratings */ |
826 /* translators: %s: Number of ratings. */ |
729 sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ), |
827 sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ), |
730 /* translators: accessibility text */ |
828 /* translators: Accessibility text. */ |
731 __( '(opens in a new tab)' ) |
829 __( '(opens in a new tab)' ) |
732 ); |
830 ); |
733 ?> |
831 ?> |
734 </a> |
832 </a> |
735 </div> |
833 </div> |
736 <# } #> |
834 <# } #> |
737 |
835 |
738 <# if ( data.hasUpdate ) { #> |
836 <# if ( data.hasUpdate ) { #> |
739 <div class="notice notice-warning notice-alt notice-large" data-slug="{{ data.id }}"> |
837 <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #> |
740 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> |
838 <div class="notice notice-warning notice-alt notice-large" data-slug="{{ data.id }}"> |
741 {{{ data.update }}} |
839 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> |
742 </div> |
840 {{{ data.update }}} |
|
841 </div> |
|
842 <# } else { #> |
|
843 <div class="notice notice-error notice-alt notice-large" data-slug="{{ data.id }}"> |
|
844 <h3 class="notice-title"><?php _e( 'Update Incompatible' ); ?></h3> |
|
845 <p> |
|
846 <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #> |
|
847 <?php |
|
848 printf( |
|
849 /* translators: %s: Theme name. */ |
|
850 __( 'There is a new version of %s available, but it doesn’t work with your versions of WordPress and PHP.' ), |
|
851 '{{{ data.name }}}' |
|
852 ); |
|
853 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
854 printf( |
|
855 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
|
856 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
857 self_admin_url( 'update-core.php' ), |
|
858 esc_url( wp_get_update_php_url() ) |
|
859 ); |
|
860 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
861 } elseif ( current_user_can( 'update_core' ) ) { |
|
862 printf( |
|
863 /* translators: %s: URL to WordPress Updates screen. */ |
|
864 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
865 self_admin_url( 'update-core.php' ) |
|
866 ); |
|
867 } elseif ( current_user_can( 'update_php' ) ) { |
|
868 printf( |
|
869 /* translators: %s: URL to Update PHP page. */ |
|
870 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
871 esc_url( wp_get_update_php_url() ) |
|
872 ); |
|
873 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
874 } |
|
875 ?> |
|
876 <# } else if ( ! data.updateResponse.compatibleWP ) { #> |
|
877 <?php |
|
878 printf( |
|
879 /* translators: %s: Theme name. */ |
|
880 __( 'There is a new version of %s available, but it doesn’t work with your version of WordPress.' ), |
|
881 '{{{ data.name }}}' |
|
882 ); |
|
883 if ( current_user_can( 'update_core' ) ) { |
|
884 printf( |
|
885 /* translators: %s: URL to WordPress Updates screen. */ |
|
886 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
887 self_admin_url( 'update-core.php' ) |
|
888 ); |
|
889 } |
|
890 ?> |
|
891 <# } else if ( ! data.updateResponse.compatiblePHP ) { #> |
|
892 <?php |
|
893 printf( |
|
894 /* translators: %s: Theme name. */ |
|
895 __( 'There is a new version of %s available, but it doesn’t work with your version of PHP.' ), |
|
896 '{{{ data.name }}}' |
|
897 ); |
|
898 if ( current_user_can( 'update_php' ) ) { |
|
899 printf( |
|
900 /* translators: %s: URL to Update PHP page. */ |
|
901 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
902 esc_url( wp_get_update_php_url() ) |
|
903 ); |
|
904 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
905 } |
|
906 ?> |
|
907 <# } #> |
|
908 </p> |
|
909 </div> |
|
910 <# } #> |
743 <# } #> |
911 <# } #> |
744 |
912 |
745 <# if ( data.parent ) { #> |
913 <# if ( data.parent ) { #> |
746 <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> |
914 <p class="parent-theme"> |
|
915 <?php |
|
916 printf( |
|
917 /* translators: %s: Theme name. */ |
|
918 __( 'This is a child theme of %s.' ), |
|
919 '<strong>{{{ data.parent }}}</strong>' |
|
920 ); |
|
921 ?> |
|
922 </p> |
|
923 <# } #> |
|
924 |
|
925 <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #> |
|
926 <div class="notice notice-error notice-alt notice-large"><p> |
|
927 <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #> |
|
928 <?php |
|
929 _e( 'This theme doesn’t work with your versions of WordPress and PHP.' ); |
|
930 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
931 printf( |
|
932 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
|
933 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
934 self_admin_url( 'update-core.php' ), |
|
935 esc_url( wp_get_update_php_url() ) |
|
936 ); |
|
937 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
938 } elseif ( current_user_can( 'update_core' ) ) { |
|
939 printf( |
|
940 /* translators: %s: URL to WordPress Updates screen. */ |
|
941 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
942 self_admin_url( 'update-core.php' ) |
|
943 ); |
|
944 } elseif ( current_user_can( 'update_php' ) ) { |
|
945 printf( |
|
946 /* translators: %s: URL to Update PHP page. */ |
|
947 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
948 esc_url( wp_get_update_php_url() ) |
|
949 ); |
|
950 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
951 } |
|
952 ?> |
|
953 <# } else if ( ! data.compatibleWP ) { #> |
|
954 <?php |
|
955 _e( 'This theme doesn’t work with your version of WordPress.' ); |
|
956 if ( current_user_can( 'update_core' ) ) { |
|
957 printf( |
|
958 /* translators: %s: URL to WordPress Updates screen. */ |
|
959 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
960 self_admin_url( 'update-core.php' ) |
|
961 ); |
|
962 } |
|
963 ?> |
|
964 <# } else if ( ! data.compatiblePHP ) { #> |
|
965 <?php |
|
966 _e( 'This theme doesn’t work with your version of PHP.' ); |
|
967 if ( current_user_can( 'update_php' ) ) { |
|
968 printf( |
|
969 /* translators: %s: URL to Update PHP page. */ |
|
970 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
971 esc_url( wp_get_update_php_url() ) |
|
972 ); |
|
973 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
974 } |
|
975 ?> |
|
976 <# } #> |
|
977 </p></div> |
747 <# } #> |
978 <# } #> |
748 |
979 |
749 <p class="theme-description">{{{ data.description }}}</p> |
980 <p class="theme-description">{{{ data.description }}}</p> |
750 |
981 |
751 <# if ( data.tags ) { #> |
982 <# if ( data.tags ) { #> |