Site Health: Show parent theme in its own accordion on Site Health Info screen; rename "Other Themes" to "Inactive Themes".
Props garrett-eclipse, mukesh27, Clorith, xkon, msaggiorato. Fixes #46925. Built from https://develop.svn.wordpress.org/trunk@45680 git-svn-id: http://core.svn.wordpress.org/trunk@45491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dae07c8216
commit
e925997562
|
@ -128,8 +128,13 @@ class WP_Debug_Data {
|
||||||
'fields' => array(),
|
'fields' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$info['wp-themes'] = array(
|
$info['wp-parent-theme'] = array(
|
||||||
'label' => __( 'Other Themes' ),
|
'label' => __( 'Parent Theme' ),
|
||||||
|
'fields' => array(),
|
||||||
|
);
|
||||||
|
|
||||||
|
$info['wp-themes-inactive'] = array(
|
||||||
|
'label' => __( 'Inactive Themes' ),
|
||||||
'show_count' => true,
|
'show_count' => true,
|
||||||
'fields' => array(),
|
'fields' => array(),
|
||||||
);
|
);
|
||||||
|
@ -873,11 +878,34 @@ class WP_Debug_Data {
|
||||||
|
|
||||||
$active_theme_author_uri = $active_theme->offsetGet( 'Author URI' );
|
$active_theme_author_uri = $active_theme->offsetGet( 'Author URI' );
|
||||||
|
|
||||||
|
if ( $active_theme->parent_theme ) {
|
||||||
|
$active_theme_parent_theme = sprintf(
|
||||||
|
// translators: 1: Theme name. 2: Theme slug.
|
||||||
|
__( '%1$s (%2$s)' ),
|
||||||
|
$active_theme->parent_theme,
|
||||||
|
$active_theme->template
|
||||||
|
);
|
||||||
|
$active_theme_parent_theme_debug = sprintf(
|
||||||
|
'%s (%s)',
|
||||||
|
$active_theme->parent_theme,
|
||||||
|
$active_theme->template
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$active_theme_parent_theme = __( 'None' );
|
||||||
|
$active_theme_parent_theme_debug = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
$info['wp-active-theme']['fields'] = array(
|
$info['wp-active-theme']['fields'] = array(
|
||||||
'name' => array(
|
'name' => array(
|
||||||
'label' => __( 'Name' ),
|
'label' => __( 'Name' ),
|
||||||
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
'value' => $active_theme->Name,
|
'value' => sprintf(
|
||||||
|
// translators: 1: Theme name. 2: Theme slug.
|
||||||
|
__( '%1$s (%2$s)' ),
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
$active_theme->Name,
|
||||||
|
$active_theme->stylesheet
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'version' => array(
|
'version' => array(
|
||||||
'label' => __( 'Version' ),
|
'label' => __( 'Version' ),
|
||||||
|
@ -896,8 +924,8 @@ class WP_Debug_Data {
|
||||||
),
|
),
|
||||||
'parent_theme' => array(
|
'parent_theme' => array(
|
||||||
'label' => __( 'Parent theme' ),
|
'label' => __( 'Parent theme' ),
|
||||||
'value' => ( $active_theme->parent_theme ? $active_theme->parent_theme : __( 'None' ) ),
|
'value' => $active_theme_parent_theme,
|
||||||
'debug' => ( $active_theme->parent_theme ? $active_theme->parent_theme : 'none' ),
|
'debug' => $active_theme_parent_theme_debug,
|
||||||
),
|
),
|
||||||
'theme_features' => array(
|
'theme_features' => array(
|
||||||
'label' => __( 'Theme features' ),
|
'label' => __( 'Theme features' ),
|
||||||
|
@ -905,18 +933,75 @@ class WP_Debug_Data {
|
||||||
),
|
),
|
||||||
'theme_path' => array(
|
'theme_path' => array(
|
||||||
'label' => __( 'Theme directory location' ),
|
'label' => __( 'Theme directory location' ),
|
||||||
'value' => get_template_directory(),
|
'value' => get_stylesheet_directory(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$parent_theme = $active_theme->parent();
|
||||||
|
|
||||||
|
if ( $parent_theme ) {
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
$parent_theme_version = $parent_theme->Version;
|
||||||
|
$parent_theme_version_debug = $parent_theme_version;
|
||||||
|
|
||||||
|
if ( array_key_exists( $parent_theme->stylesheet, $theme_updates ) ) {
|
||||||
|
$parent_theme_update_new_version = $theme_updates[ $parent_theme->stylesheet ]->update['new_version'];
|
||||||
|
|
||||||
|
// translators: %s: Latest theme version number.
|
||||||
|
$parent_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $parent_theme_update_new_version );
|
||||||
|
$parent_theme_version_debug .= sprintf( ' (latest version: %s)', $parent_theme_update_new_version );
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent_theme_author_uri = $parent_theme->offsetGet( 'Author URI' );
|
||||||
|
|
||||||
|
$info['wp-parent-theme']['fields'] = array(
|
||||||
|
'name' => array(
|
||||||
|
'label' => __( 'Name' ),
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
'value' => sprintf(
|
||||||
|
// translators: 1: Theme name. 2: Theme slug.
|
||||||
|
__( '%1$s (%2$s)' ),
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
$parent_theme->Name,
|
||||||
|
$parent_theme->stylesheet
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'version' => array(
|
||||||
|
'label' => __( 'Version' ),
|
||||||
|
'value' => $parent_theme_version,
|
||||||
|
'debug' => $parent_theme_version_debug,
|
||||||
|
),
|
||||||
|
'author' => array(
|
||||||
|
'label' => __( 'Author' ),
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
'value' => wp_kses( $parent_theme->Author, array() ),
|
||||||
|
),
|
||||||
|
'author_website' => array(
|
||||||
|
'label' => __( 'Author website' ),
|
||||||
|
'value' => ( $parent_theme_author_uri ? $parent_theme_author_uri : __( 'Undefined' ) ),
|
||||||
|
'debug' => ( $parent_theme_author_uri ? $parent_theme_author_uri : '(undefined)' ),
|
||||||
|
),
|
||||||
|
'theme_path' => array(
|
||||||
|
'label' => __( 'Theme directory location' ),
|
||||||
|
'value' => get_template_directory(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Populate a list of all themes available in the install.
|
// Populate a list of all themes available in the install.
|
||||||
$all_themes = wp_get_themes();
|
$all_themes = wp_get_themes();
|
||||||
|
|
||||||
foreach ( $all_themes as $theme_slug => $theme ) {
|
foreach ( $all_themes as $theme_slug => $theme ) {
|
||||||
// Ignore the currently active theme from the list of all themes.
|
// Exclude the currently active theme from the list of all themes.
|
||||||
if ( $active_theme->stylesheet === $theme_slug ) {
|
if ( $active_theme->stylesheet === $theme_slug ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exclude the currently active parent theme from the list of all themes.
|
||||||
|
if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
$theme_version = $theme->Version;
|
$theme_version = $theme->Version;
|
||||||
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
|
@ -953,7 +1038,7 @@ class WP_Debug_Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
$info['wp-themes']['fields'][ sanitize_text_field( $theme->Name ) ] = array(
|
$info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->Name ) ] = array(
|
||||||
'label' => sprintf(
|
'label' => sprintf(
|
||||||
// translators: 1: Theme name. 2: Theme slug.
|
// translators: 1: Theme name. 2: Theme slug.
|
||||||
__( '%1$s (%2$s)' ),
|
__( '%1$s (%2$s)' ),
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45679';
|
$wp_version = '5.3-alpha-45680';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue