WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/27/2016 09:15:01 AM (4 years ago)
Author:
wonderboymusic
Message:

Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.

  • wp-admin and wp-includes are scanned for classes to autoload
  • Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see composer.json: autoload.exclude-from-classmap
  • wp-vendor/autoload_52.php is included at the top of wp-settings.php - no changes need to be made to unit tests to include the autoloader
  • An avalanche of require() and require_once() calls that loaded class files have been removed from the codebase.

The following files have been added to svn:ignore - they are not 5.2-compatible and fail during pre-commit:

  • src/wp-vendor/autoload.php
  • src/wp-vendor/composer/autoload_real.php
  • src/wp-vendor/composer/autoload_static.php
  • src/wp-vendor/composer/ClassLoader.php

We favor these files instead:

  • src/wp-vendor/autoload_52.php
  • src/wp-vendor/composer/autoload_real_52.php
  • src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run composer install or composer update from the project root to update the autoloader.

The future is now.

See #36335.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r38334 r38399  
    206206     */
    207207    public function __construct() {
    208         require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
    209         require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
    210         require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
    211         require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
    212 
    213         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php' );
    214         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php' );
    215         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php' );
    216         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php' );
    217         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' );
    218         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' );
    219         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' );
    220         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' );
    221         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' );
    222         require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' );
    223         require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' );
    224         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' );
    225         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' );
    226         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' );
    227         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
    228         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' );
    229         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' );
    230 
    231         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' );
    232 
    233         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php' );
    234         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' );
    235         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' );
    236         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' );
    237 
    238         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' );
    239         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php' );
    240         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php' );
    241         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php' );
    242         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php' );
    243 
    244208        /**
    245209         * Filters the core Customizer components to load.
     
    259223        $components = apply_filters( 'customize_loaded_components', $this->components, $this );
    260224
    261         require_once( ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php' );
    262225        $this->selective_refresh = new WP_Customize_Selective_Refresh( $this );
    263226
    264227        if ( in_array( 'widgets', $components, true ) ) {
    265             require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
    266228            $this->widgets = new WP_Customize_Widgets( $this );
    267229        }
    268230
    269231        if ( in_array( 'nav_menus', $components, true ) ) {
    270             require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
    271232            $this->nav_menus = new WP_Customize_Nav_Menus( $this );
    272233        }
Note: See TracChangeset for help on using the changeset viewer.