Make WordPress Core

Ticket #42442: 42442.notice.diff

File 42442.notice.diff, 1.8 KB (added by dd32, 8 years ago)

Notice fix (And clarification of how the .org API works)

  • src/wp-includes/class-wp-customize-manager.php

    final class WP_Customize_Manager { 
    54345434
    54355435                                // Handle themes that are already installed as installed themes.
    54365436                                if ( in_array( $theme->slug, $installed_themes, true ) ) {
    54375437                                        $theme->type = 'installed';
    54385438                                } else {
    54395439                                        $theme->type = $theme_action;
    54405440                                }
    54415441
    54425442                                // Set active based on customized theme.
    54435443                                $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug );
    54445444
    54455445                                // Map available theme properties to installed theme properties.
    54465446                                $theme->id           = $theme->slug;
    54475447                                $theme->screenshot   = array( $theme->screenshot_url );
    54485448                                $theme->authorAndUri = $theme->author;
    5449                                 $theme->parent       = ( $theme->slug === $theme->template ) ? false : $theme->template; // The .org API does not seem to return the parent in a documented way; however, this check should yield a similar result in most cases.
     5449                                // The .org API can return the full parent theme details if passed the 'parent' arg, or if passed the 'template' option it'll return that in the event it's a child theme.
     5450                                if ( isset( $theme->parent ) ) {
     5451                                        $theme->parent = $theme->parent->slug;
     5452                                } else {
     5453                                        $theme->parent = false;
     5454                                }
    54505455                                unset( $theme->slug );
    54515456                                unset( $theme->screenshot_url );
    54525457                                unset( $theme->author );
    54535458                        } // End foreach().
    54545459                } // End if().
    54555460
    54565461                /**
    54575462                 * Filters the theme data loaded in the customizer.
    54585463                 *
    54595464                 * This allows theme data to be loading from an external source,
    54605465                 * or modification of data loaded from `wp_prepare_themes_for_js()`
    54615466                 * or WordPress.org via `themes_api()`.
    54625467                 *
    54635468                 * @since 4.9.0
    54645469                 *