Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring - wp-dropins #7418

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 36 additions & 26 deletions src/wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function debug_data() {
$info = array(
'wp-core' => array(),
'wp-paths-sizes' => array(),
'wp-dropins' => array(),
'wp-dropins' => self::get_wp_dropins(),
'wp-active-theme' => array(),
'wp-parent-theme' => array(),
'wp-themes-inactive' => array(),
Expand Down Expand Up @@ -172,17 +172,6 @@ public static function debug_data() {
);
}

$info['wp-dropins'] = array(
'label' => __( 'Drop-ins' ),
'show_count' => true,
'description' => sprintf(
/* translators: %s: wp-content directory name. */
__( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
'<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>'
),
'fields' => array(),
);

$info['wp-active-theme'] = array(
'label' => __( 'Active Theme' ),
'fields' => array(),
Expand Down Expand Up @@ -336,20 +325,6 @@ public static function debug_data() {
);
}

// Get a list of all drop-in replacements.
$dropins = get_dropins();

// Get dropins descriptions.
$dropin_descriptions = _get_dropins();

foreach ( $dropins as $dropin_key => $dropin ) {
$info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array(
'label' => $dropin_key,
'value' => $dropin_descriptions[ $dropin_key ][0],
'debug' => 'true',
);
}

// List all available plugins.
$plugins = get_plugins();
$plugin_updates = get_plugin_updates();
Expand Down Expand Up @@ -840,6 +815,41 @@ public static function debug_data() {
return $info;
}

/**
* Gets the WordPress drop-in section of the debug data.
*
* @since 6.7.0
*
* @return array
*/
public static function get_wp_dropins(): array {
// Get a list of all drop-in replacements.
$dropins = get_dropins();

// Get drop-ins descriptions.
$dropin_descriptions = _get_dropins();

$fields = array();
foreach ( $dropins as $dropin_key => $dropin ) {
$fields[ sanitize_text_field( $dropin_key ) ] = array(
'label' => $dropin_key,
'value' => $dropin_descriptions[ $dropin_key ][0],
'debug' => 'true',
);
}

return array(
'label' => __( 'Drop-ins' ),
'show_count' => true,
'description' => sprintf(
/* translators: %s: wp-content directory name. */
__( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
'<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>'
),
'fields' => $fields,
);
}

/**
* Gets the WordPress server section of the debug data.
*
Expand Down
Loading