<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[59176] trunk/src/wp-admin/includes/class-wp-debug-data.php: WP_Debug_Data: Extract `wp-themes` data into separate methods.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/59176">59176</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/59176","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dmsnell</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-10-05 19:21:59 +0000 (Sat, 05 Oct 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WP_Debug_Data: Extract `wp-themes` data into separate methods.

This is the last part in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other.

This patch separates the findal set of twelve groups, the `wp-active-theme`, `wp-parent-theme`, and `wp-themes-inactive` info, into a separate methods focused on those data.

This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code.

Developed in https://github.com/wordpress/wordpress-develop/pull/7507
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
Fixes <a href="https://core.trac.wordpress.org/ticket/61648">#61648</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpdebugdataphp">trunk/src/wp-admin/includes/class-wp-debug-data.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpdebugdataphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-debug-data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-debug-data.php       2024-10-05 16:26:17 UTC (rev 59175)
+++ trunk/src/wp-admin/includes/class-wp-debug-data.php 2024-10-05 19:21:59 UTC (rev 59176)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,18 +35,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return array The debug data for the site.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public static function debug_data() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                global $_wp_theme_features;
-
-               // Save few function calls.
-               $upload_dir             = wp_upload_dir();
-               $is_multisite           = is_multisite();
-
</del><span class="cx" style="display: block; padding: 0 10px">                 /*
</span><span class="cx" style="display: block; padding: 0 10px">                 * Set up the array that holds all debug information.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * When iterating through the debug data, the ordering of the sections
</span><span class="cx" style="display: block; padding: 0 10px">                 * occurs in insertion-order of the assignments into this array. Setting
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * up empty values here preserves that specific ordering so it doesn't
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * up empty values here preserves that specific ordering, so it doesn't
</ins><span class="cx" style="display: block; padding: 0 10px">                  * depend on when inside this method each section is otherwise assigned.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * When all sections have been modularized, this will be the final single
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,9 +52,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp-core'             => self::get_wp_core(),
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp-paths-sizes'      => self::get_wp_paths_sizes(),
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp-dropins'          => self::get_wp_dropins(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'wp-active-theme'     => array(),
-                       'wp-parent-theme'     => array(),
-                       'wp-themes-inactive'  => array(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'wp-active-theme'     => self::get_wp_active_theme(),
+                       'wp-parent-theme'     => self::get_wp_parent_theme(),
+                       'wp-themes-inactive'  => self::get_wp_themes_inactive(),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'wp-mu-plugins'       => self::get_wp_mu_plugins(),
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp-plugins-active'   => self::get_wp_plugins_active(),
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp-plugins-inactive' => self::get_wp_plugins_inactive(),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,341 +77,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $info['wp-active-theme'] = array(
-                       'label'  => __( 'Active Theme' ),
-                       'fields' => array(),
-               );
-
-               $info['wp-parent-theme'] = array(
-                       'label'  => __( 'Parent Theme' ),
-                       'fields' => array(),
-               );
-
-               $info['wp-themes-inactive'] = array(
-                       'label'      => __( 'Inactive Themes' ),
-                       'show_count' => true,
-                       'fields'     => array(),
-               );
-
-               // Populate the section for the currently active theme.
-               $theme_features = array();
-
-               if ( ! empty( $_wp_theme_features ) ) {
-                       foreach ( $_wp_theme_features as $feature => $options ) {
-                               $theme_features[] = $feature;
-                       }
-               }
-
-               $active_theme  = wp_get_theme();
-               $theme_updates = get_theme_updates();
-               $transient     = get_site_transient( 'update_themes' );
-
-               $active_theme_version       = $active_theme->version;
-               $active_theme_version_debug = $active_theme_version;
-
-               $auto_updates         = array();
-               $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' );
-               if ( $auto_updates_enabled ) {
-                       $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
-               }
-
-               if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
-                       $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version'];
-
-                       /* translators: %s: Latest theme version number. */
-                       $active_theme_version       .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_update_new_version );
-                       $active_theme_version_debug .= sprintf( ' (latest version: %s)', $theme_update_new_version );
-               }
-
-               $active_theme_author_uri = $active_theme->display( 'AuthorURI' );
-
-               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(
-                       'name'           => array(
-                               'label' => __( 'Name' ),
-                               'value' => sprintf(
-                                       /* translators: 1: Theme name. 2: Theme slug. */
-                                       __( '%1$s (%2$s)' ),
-                                       $active_theme->name,
-                                       $active_theme->stylesheet
-                               ),
-                       ),
-                       'version'        => array(
-                               'label' => __( 'Version' ),
-                               'value' => $active_theme_version,
-                               'debug' => $active_theme_version_debug,
-                       ),
-                       'author'         => array(
-                               'label' => __( 'Author' ),
-                               'value' => wp_kses( $active_theme->author, array() ),
-                       ),
-                       'author_website' => array(
-                               'label' => __( 'Author website' ),
-                               'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ),
-                               'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ),
-                       ),
-                       'parent_theme'   => array(
-                               'label' => __( 'Parent theme' ),
-                               'value' => $active_theme_parent_theme,
-                               'debug' => $active_theme_parent_theme_debug,
-                       ),
-                       'theme_features' => array(
-                               'label' => __( 'Theme features' ),
-                               'value' => implode( ', ', $theme_features ),
-                       ),
-                       'theme_path'     => array(
-                               'label' => __( 'Theme directory location' ),
-                               'value' => get_stylesheet_directory(),
-                       ),
-               );
-
-               if ( $auto_updates_enabled ) {
-                       if ( isset( $transient->response[ $active_theme->stylesheet ] ) ) {
-                               $item = $transient->response[ $active_theme->stylesheet ];
-                       } elseif ( isset( $transient->no_update[ $active_theme->stylesheet ] ) ) {
-                               $item = $transient->no_update[ $active_theme->stylesheet ];
-                       } else {
-                               $item = array(
-                                       'theme'        => $active_theme->stylesheet,
-                                       'new_version'  => $active_theme->version,
-                                       'url'          => '',
-                                       'package'      => '',
-                                       'requires'     => '',
-                                       'requires_php' => '',
-                               );
-                       }
-
-                       $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
-
-                       if ( ! is_null( $auto_update_forced ) ) {
-                               $enabled = $auto_update_forced;
-                       } else {
-                               $enabled = in_array( $active_theme->stylesheet, $auto_updates, true );
-                       }
-
-                       if ( $enabled ) {
-                               $auto_updates_string = __( 'Enabled' );
-                       } else {
-                               $auto_updates_string = __( 'Disabled' );
-                       }
-
-                       /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
-                       $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $active_theme, $enabled );
-
-                       $info['wp-active-theme']['fields']['auto_update'] = array(
-                               'label' => __( 'Auto-updates' ),
-                               'value' => $auto_updates_string,
-                               'debug' => $auto_updates_string,
-                       );
-               }
-
-               $parent_theme = $active_theme->parent();
-
-               if ( $parent_theme ) {
-                       $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->display( 'AuthorURI' );
-
-                       $info['wp-parent-theme']['fields'] = array(
-                               'name'           => array(
-                                       'label' => __( 'Name' ),
-                                       'value' => sprintf(
-                                               /* translators: 1: Theme name. 2: Theme slug. */
-                                               __( '%1$s (%2$s)' ),
-                                               $parent_theme->name,
-                                               $parent_theme->stylesheet
-                                       ),
-                               ),
-                               'version'        => array(
-                                       'label' => __( 'Version' ),
-                                       'value' => $parent_theme_version,
-                                       'debug' => $parent_theme_version_debug,
-                               ),
-                               'author'         => array(
-                                       'label' => __( 'Author' ),
-                                       '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(),
-                               ),
-                       );
-
-                       if ( $auto_updates_enabled ) {
-                               if ( isset( $transient->response[ $parent_theme->stylesheet ] ) ) {
-                                       $item = $transient->response[ $parent_theme->stylesheet ];
-                               } elseif ( isset( $transient->no_update[ $parent_theme->stylesheet ] ) ) {
-                                       $item = $transient->no_update[ $parent_theme->stylesheet ];
-                               } else {
-                                       $item = array(
-                                               'theme'        => $parent_theme->stylesheet,
-                                               'new_version'  => $parent_theme->version,
-                                               'url'          => '',
-                                               'package'      => '',
-                                               'requires'     => '',
-                                               'requires_php' => '',
-                                       );
-                               }
-
-                               $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
-
-                               if ( ! is_null( $auto_update_forced ) ) {
-                                       $enabled = $auto_update_forced;
-                               } else {
-                                       $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true );
-                               }
-
-                               if ( $enabled ) {
-                                       $parent_theme_auto_update_string = __( 'Enabled' );
-                               } else {
-                                       $parent_theme_auto_update_string = __( 'Disabled' );
-                               }
-
-                               /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
-                               $parent_theme_auto_update_string = apply_filters( 'theme_auto_update_debug_string', $parent_theme_auto_update_string, $parent_theme, $enabled );
-
-                               $info['wp-parent-theme']['fields']['auto_update'] = array(
-                                       'label' => __( 'Auto-update' ),
-                                       'value' => $parent_theme_auto_update_string,
-                                       'debug' => $parent_theme_auto_update_string,
-                               );
-                       }
-               }
-
-               // Populate a list of all themes available in the install.
-               $all_themes = wp_get_themes();
-
-               foreach ( $all_themes as $theme_slug => $theme ) {
-                       // Exclude the currently active theme from the list of all themes.
-                       if ( $active_theme->stylesheet === $theme_slug ) {
-                               continue;
-                       }
-
-                       // Exclude the currently active parent theme from the list of all themes.
-                       if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) {
-                               continue;
-                       }
-
-                       $theme_version = $theme->version;
-                       $theme_author  = $theme->author;
-
-                       // Sanitize.
-                       $theme_author = wp_kses( $theme_author, array() );
-
-                       $theme_version_string       = __( 'No version or author information is available.' );
-                       $theme_version_string_debug = 'undefined';
-
-                       if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
-                               /* translators: 1: Theme version number. 2: Theme author name. */
-                               $theme_version_string       = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author );
-                               $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author );
-                       } else {
-                               if ( ! empty( $theme_author ) ) {
-                                       /* translators: %s: Theme author name. */
-                                       $theme_version_string       = sprintf( __( 'By %s' ), $theme_author );
-                                       $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author );
-                               }
-
-                               if ( ! empty( $theme_version ) ) {
-                                       /* translators: %s: Theme version number. */
-                                       $theme_version_string       = sprintf( __( 'Version %s' ), $theme_version );
-                                       $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version );
-                               }
-                       }
-
-                       if ( array_key_exists( $theme_slug, $theme_updates ) ) {
-                               /* translators: %s: Latest theme version number. */
-                               $theme_version_string       .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] );
-                               $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] );
-                       }
-
-                       if ( $auto_updates_enabled ) {
-                               if ( isset( $transient->response[ $theme_slug ] ) ) {
-                                       $item = $transient->response[ $theme_slug ];
-                               } elseif ( isset( $transient->no_update[ $theme_slug ] ) ) {
-                                       $item = $transient->no_update[ $theme_slug ];
-                               } else {
-                                       $item = array(
-                                               'theme'        => $theme_slug,
-                                               'new_version'  => $theme->version,
-                                               'url'          => '',
-                                               'package'      => '',
-                                               'requires'     => '',
-                                               'requires_php' => '',
-                                       );
-                               }
-
-                               $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
-
-                               if ( ! is_null( $auto_update_forced ) ) {
-                                       $enabled = $auto_update_forced;
-                               } else {
-                                       $enabled = in_array( $theme_slug, $auto_updates, true );
-                               }
-
-                               if ( $enabled ) {
-                                       $auto_updates_string = __( 'Auto-updates enabled' );
-                               } else {
-                                       $auto_updates_string = __( 'Auto-updates disabled' );
-                               }
-
-                               /**
-                                * Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
-                                *
-                                * @since 5.5.0
-                                *
-                                * @param string   $auto_updates_string The string output for the auto-updates column.
-                                * @param WP_Theme $theme               An object of theme data.
-                                * @param bool     $enabled             Whether auto-updates are enabled for this item.
-                                */
-                               $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled );
-
-                               $theme_version_string       .= ' | ' . $auto_updates_string;
-                               $theme_version_string_debug .= ', ' . $auto_updates_string;
-                       }
-
-                       $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array(
-                               'label' => sprintf(
-                                       /* translators: 1: Theme name. 2: Theme slug. */
-                                       __( '%1$s (%2$s)' ),
-                                       $theme->name,
-                                       $theme_slug
-                               ),
-                               'value' => $theme_version_string,
-                               'debug' => $theme_version_string_debug,
-                       );
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the debug information shown on the Tools -> Site Health -> Info screen.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1351,6 +1010,392 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Gets the WordPress active theme section of the debug data.
+        *
+        * @since 6.7.0
+        *
+        * @return array
+        */
+       private static function get_wp_active_theme(): array {
+               global $_wp_theme_features;
+
+               // Populate the section for the currently active theme.
+               $theme_features = array();
+
+               if ( ! empty( $_wp_theme_features ) ) {
+                       foreach ( $_wp_theme_features as $feature => $options ) {
+                               $theme_features[] = $feature;
+                       }
+               }
+
+               $active_theme  = wp_get_theme();
+               $theme_updates = get_theme_updates();
+               $transient     = get_site_transient( 'update_themes' );
+
+               $active_theme_version       = $active_theme->version;
+               $active_theme_version_debug = $active_theme_version;
+
+               $auto_updates         = array();
+               $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' );
+               if ( $auto_updates_enabled ) {
+                       $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
+               }
+
+               if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
+                       $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version'];
+
+                       /* translators: %s: Latest theme version number. */
+                       $active_theme_version       .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_update_new_version );
+                       $active_theme_version_debug .= sprintf( ' (latest version: %s)', $theme_update_new_version );
+               }
+
+               $active_theme_author_uri = $active_theme->display( 'AuthorURI' );
+
+               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';
+               }
+
+               $fields = array(
+                       'name'           => array(
+                               'label' => __( 'Name' ),
+                               'value' => sprintf(
+                                       /* translators: 1: Theme name. 2: Theme slug. */
+                                       __( '%1$s (%2$s)' ),
+                                       $active_theme->name,
+                                       $active_theme->stylesheet
+                               ),
+                       ),
+                       'version'        => array(
+                               'label' => __( 'Version' ),
+                               'value' => $active_theme_version,
+                               'debug' => $active_theme_version_debug,
+                       ),
+                       'author'         => array(
+                               'label' => __( 'Author' ),
+                               'value' => wp_kses( $active_theme->author, array() ),
+                       ),
+                       'author_website' => array(
+                               'label' => __( 'Author website' ),
+                               'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ),
+                               'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ),
+                       ),
+                       'parent_theme'   => array(
+                               'label' => __( 'Parent theme' ),
+                               'value' => $active_theme_parent_theme,
+                               'debug' => $active_theme_parent_theme_debug,
+                       ),
+                       'theme_features' => array(
+                               'label' => __( 'Theme features' ),
+                               'value' => implode( ', ', $theme_features ),
+                       ),
+                       'theme_path'     => array(
+                               'label' => __( 'Theme directory location' ),
+                               'value' => get_stylesheet_directory(),
+                       ),
+               );
+
+               if ( $auto_updates_enabled ) {
+                       if ( isset( $transient->response[ $active_theme->stylesheet ] ) ) {
+                               $item = $transient->response[ $active_theme->stylesheet ];
+                       } elseif ( isset( $transient->no_update[ $active_theme->stylesheet ] ) ) {
+                               $item = $transient->no_update[ $active_theme->stylesheet ];
+                       } else {
+                               $item = array(
+                                       'theme'        => $active_theme->stylesheet,
+                                       'new_version'  => $active_theme->version,
+                                       'url'          => '',
+                                       'package'      => '',
+                                       'requires'     => '',
+                                       'requires_php' => '',
+                               );
+                       }
+
+                       $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
+
+                       if ( ! is_null( $auto_update_forced ) ) {
+                               $enabled = $auto_update_forced;
+                       } else {
+                               $enabled = in_array( $active_theme->stylesheet, $auto_updates, true );
+                       }
+
+                       if ( $enabled ) {
+                               $auto_updates_string = __( 'Enabled' );
+                       } else {
+                               $auto_updates_string = __( 'Disabled' );
+                       }
+
+                       /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
+                       $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $active_theme, $enabled );
+
+                       $fields['auto_update'] = array(
+                               'label' => __( 'Auto-updates' ),
+                               'value' => $auto_updates_string,
+                               'debug' => $auto_updates_string,
+                       );
+               }
+
+               return array(
+                       'label'  => __( 'Active Theme' ),
+                       'fields' => $fields,
+               );
+       }
+
+       /**
+        * Gets the WordPress parent theme section of the debug data.
+        *
+        * @since 6.7.0
+        *
+        * @return array
+        */
+       private static function get_wp_parent_theme(): array {
+               $theme_updates = get_theme_updates();
+               $transient     = get_site_transient( 'update_themes' );
+
+               $auto_updates         = array();
+               $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' );
+               if ( $auto_updates_enabled ) {
+                       $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
+               }
+
+               $active_theme = wp_get_theme();
+               $parent_theme = $active_theme->parent();
+               $fields       = array();
+
+               if ( $parent_theme ) {
+                       $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->display( 'AuthorURI' );
+
+                       $fields = array(
+                               'name'           => array(
+                                       'label' => __( 'Name' ),
+                                       'value' => sprintf(
+                                               /* translators: 1: Theme name. 2: Theme slug. */
+                                               __( '%1$s (%2$s)' ),
+                                               $parent_theme->name,
+                                               $parent_theme->stylesheet
+                                       ),
+                               ),
+                               'version'        => array(
+                                       'label' => __( 'Version' ),
+                                       'value' => $parent_theme_version,
+                                       'debug' => $parent_theme_version_debug,
+                               ),
+                               'author'         => array(
+                                       'label' => __( 'Author' ),
+                                       '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(),
+                               ),
+                       );
+
+                       if ( $auto_updates_enabled ) {
+                               if ( isset( $transient->response[ $parent_theme->stylesheet ] ) ) {
+                                       $item = $transient->response[ $parent_theme->stylesheet ];
+                               } elseif ( isset( $transient->no_update[ $parent_theme->stylesheet ] ) ) {
+                                       $item = $transient->no_update[ $parent_theme->stylesheet ];
+                               } else {
+                                       $item = array(
+                                               'theme'        => $parent_theme->stylesheet,
+                                               'new_version'  => $parent_theme->version,
+                                               'url'          => '',
+                                               'package'      => '',
+                                               'requires'     => '',
+                                               'requires_php' => '',
+                                       );
+                               }
+
+                               $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
+
+                               if ( ! is_null( $auto_update_forced ) ) {
+                                       $enabled = $auto_update_forced;
+                               } else {
+                                       $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true );
+                               }
+
+                               if ( $enabled ) {
+                                       $parent_theme_auto_update_string = __( 'Enabled' );
+                               } else {
+                                       $parent_theme_auto_update_string = __( 'Disabled' );
+                               }
+
+                               /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
+                               $parent_theme_auto_update_string = apply_filters( 'theme_auto_update_debug_string', $parent_theme_auto_update_string, $parent_theme, $enabled );
+
+                               $fields['auto_update'] = array(
+                                       'label' => __( 'Auto-update' ),
+                                       'value' => $parent_theme_auto_update_string,
+                                       'debug' => $parent_theme_auto_update_string,
+                               );
+                       }
+               }
+
+               return array(
+                       'label'  => __( 'Parent Theme' ),
+                       'fields' => $fields,
+               );
+       }
+
+       /**
+        * Gets the WordPress inactive themes section of the debug data.
+        *
+        * @since 6.7.0
+        *
+        * @return array
+        */
+       private static function get_wp_themes_inactive(): array {
+               $active_theme  = wp_get_theme();
+               $parent_theme  = $active_theme->parent();
+               $theme_updates = get_theme_updates();
+
+               $auto_updates         = array();
+               $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' );
+               if ( $auto_updates_enabled ) {
+                       $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
+               }
+
+               // Populate a list of all themes available in the installation.
+               $all_themes = wp_get_themes();
+               $fields     = array();
+
+               foreach ( $all_themes as $theme_slug => $theme ) {
+                       // Exclude the currently active theme from the list of all themes.
+                       if ( $active_theme->stylesheet === $theme_slug ) {
+                               continue;
+                       }
+
+                       // Exclude the currently active parent theme from the list of all themes.
+                       if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) {
+                               continue;
+                       }
+
+                       $theme_version = $theme->version;
+                       $theme_author  = $theme->author;
+
+                       // Sanitize.
+                       $theme_author = wp_kses( $theme_author, array() );
+
+                       $theme_version_string       = __( 'No version or author information is available.' );
+                       $theme_version_string_debug = 'undefined';
+
+                       if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
+                               /* translators: 1: Theme version number. 2: Theme author name. */
+                               $theme_version_string       = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author );
+                               $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author );
+                       } else {
+                               if ( ! empty( $theme_author ) ) {
+                                       /* translators: %s: Theme author name. */
+                                       $theme_version_string       = sprintf( __( 'By %s' ), $theme_author );
+                                       $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author );
+                               }
+
+                               if ( ! empty( $theme_version ) ) {
+                                       /* translators: %s: Theme version number. */
+                                       $theme_version_string       = sprintf( __( 'Version %s' ), $theme_version );
+                                       $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version );
+                               }
+                       }
+
+                       if ( array_key_exists( $theme_slug, $theme_updates ) ) {
+                               /* translators: %s: Latest theme version number. */
+                               $theme_version_string       .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] );
+                               $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] );
+                       }
+
+                       if ( $auto_updates_enabled ) {
+                               if ( isset( $transient->response[ $theme_slug ] ) ) {
+                                       $item = $transient->response[ $theme_slug ];
+                               } elseif ( isset( $transient->no_update[ $theme_slug ] ) ) {
+                                       $item = $transient->no_update[ $theme_slug ];
+                               } else {
+                                       $item = array(
+                                               'theme'        => $theme_slug,
+                                               'new_version'  => $theme->version,
+                                               'url'          => '',
+                                               'package'      => '',
+                                               'requires'     => '',
+                                               'requires_php' => '',
+                                       );
+                               }
+
+                               $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
+
+                               if ( ! is_null( $auto_update_forced ) ) {
+                                       $enabled = $auto_update_forced;
+                               } else {
+                                       $enabled = in_array( $theme_slug, $auto_updates, true );
+                               }
+
+                               if ( $enabled ) {
+                                       $auto_updates_string = __( 'Auto-updates enabled' );
+                               } else {
+                                       $auto_updates_string = __( 'Auto-updates disabled' );
+                               }
+
+                               /**
+                                * Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
+                                *
+                                * @since 5.5.0
+                                *
+                                * @param string   $auto_updates_string The string output for the auto-updates column.
+                                * @param WP_Theme $theme               An object of theme data.
+                                * @param bool     $enabled             Whether auto-updates are enabled for this item.
+                                */
+                               $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled );
+
+                               $theme_version_string       .= ' | ' . $auto_updates_string;
+                               $theme_version_string_debug .= ', ' . $auto_updates_string;
+                       }
+
+                       $fields[ sanitize_text_field( $theme->name ) ] = array(
+                               'label' => sprintf(
+                                       /* translators: 1: Theme name. 2: Theme slug. */
+                                       __( '%1$s (%2$s)' ),
+                                       $theme->name,
+                                       $theme_slug
+                               ),
+                               'value' => $theme_version_string,
+                               'debug' => $theme_version_string_debug,
+                       );
+               }
+
+               return array(
+                       'label'      => __( 'Inactive Themes' ),
+                       'show_count' => true,
+                       'fields'     => $fields,
+               );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Gets the WordPress constants section of the debug data.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 6.7.0
</span></span></pre>
</div>
</div>

</body>
</html>