Make WordPress Core


Ignore:
Timestamp:
02/06/2020 06:31:22 AM (4 years 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/general-template.php

    r47122 r47198  
    256256    if ( '' != $search_form_template ) {
    257257        ob_start();
    258         require( $search_form_template );
     258        require $search_form_template;
    259259        $form = ob_get_clean();
    260260    } else {
     
    34093409function wp_editor( $content, $editor_id, $settings = array() ) {
    34103410    if ( ! class_exists( '_WP_Editors', false ) ) {
    3411         require( ABSPATH . WPINC . '/class-wp-editor.php' );
     3411        require ABSPATH . WPINC . '/class-wp-editor.php';
    34123412    }
    34133413    _WP_Editors::editor( $content, $editor_id, $settings );
     
    34253425function wp_enqueue_editor() {
    34263426    if ( ! class_exists( '_WP_Editors', false ) ) {
    3427         require( ABSPATH . WPINC . '/class-wp-editor.php' );
     3427        require ABSPATH . WPINC . '/class-wp-editor.php';
    34283428    }
    34293429
Note: See TracChangeset for help on using the changeset viewer.