WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/06/2020 06:31:22 AM (14 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.

This avoids the performance overhead of the function call every time dirname( __FILE__ ) was used instead of __DIR__.

This commit also includes:

  • Removing unnecessary parentheses from include/require statements. These are language constructs, not function calls.
  • Replacing include statements for several files with require_once, for consistency:
    • wp-admin/admin-header.php
    • wp-admin/admin-footer.php
    • wp-includes/version.php

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.

File:
1 edited

Legend:

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

    r45932 r47198  
    694694 * WP_Customize_Color_Control class.
    695695 */
    696 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php' );
     696require_once ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php';
    697697
    698698/**
    699699 * WP_Customize_Media_Control class.
    700700 */
    701 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php' );
     701require_once ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php';
    702702
    703703/**
    704704 * WP_Customize_Upload_Control class.
    705705 */
    706 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php' );
     706require_once ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php';
    707707
    708708/**
    709709 * WP_Customize_Image_Control class.
    710710 */
    711 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php' );
     711require_once ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php';
    712712
    713713/**
    714714 * WP_Customize_Background_Image_Control class.
    715715 */
    716 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' );
     716require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php';
    717717
    718718/**
    719719 * WP_Customize_Background_Position_Control class.
    720720 */
    721 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php' );
     721require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php';
    722722
    723723/**
    724724 * WP_Customize_Cropped_Image_Control class.
    725725 */
    726 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' );
     726require_once ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php';
    727727
    728728/**
    729729 * WP_Customize_Site_Icon_Control class.
    730730 */
    731 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' );
     731require_once ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php';
    732732
    733733/**
    734734 * WP_Customize_Header_Image_Control class.
    735735 */
    736 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' );
     736require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php';
    737737
    738738/**
    739739 * WP_Customize_Theme_Control class.
    740740 */
    741 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' );
     741require_once ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php';
    742742
    743743/**
    744744 * WP_Widget_Area_Customize_Control class.
    745745 */
    746 require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' );
     746require_once ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php';
    747747
    748748/**
    749749 * WP_Widget_Form_Customize_Control class.
    750750 */
    751 require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' );
     751require_once ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php';
    752752
    753753/**
    754754 * WP_Customize_Nav_Menu_Control class.
    755755 */
    756 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' );
     756require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php';
    757757
    758758/**
    759759 * WP_Customize_Nav_Menu_Item_Control class.
    760760 */
    761 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' );
     761require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php';
    762762
    763763/**
    764764 * WP_Customize_Nav_Menu_Location_Control class.
    765765 */
    766 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' );
     766require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php';
    767767
    768768/**
     
    770770 *
    771771 * As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent
    772  * release, the require_once() here will be removed and _deprecated_file() will be called if file is
     772 * release, the require_once here will be removed and _deprecated_file() will be called if file is
    773773 * required at all.
    774774 *
    775775 * @deprecated 4.9.0 This file is no longer used due to new menu creation UX.
    776776 */
    777 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
     777require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php';
    778778
    779779/**
    780780 * WP_Customize_Nav_Menu_Locations_Control class.
    781781 */
    782 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php' );
     782require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php';
    783783
    784784/**
    785785 * WP_Customize_Nav_Menu_Auto_Add_Control class.
    786786 */
    787 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' );
     787require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php';
    788788
    789789/**
    790790 * WP_Customize_Date_Time_Control class.
    791791 */
    792 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-date-time-control.php' );
     792require_once ABSPATH . WPINC . '/customize/class-wp-customize-date-time-control.php';
Note: See TracChangeset for help on using the changeset viewer.