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-admin/includes/deprecated.php

    r47157 r47198  
    764764
    765765    if ( ! class_exists( '_WP_Editors', false ) )
    766         require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
     766        require_once ABSPATH . WPINC . '/class-wp-editor.php';
    767767
    768768    $editor_id = 'content' . $num++;
     
    11581158        add_filter('update_feedback', $feedback);
    11591159
    1160     include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
     1160    require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    11611161    $upgrader = new Core_Upgrader();
    11621162    return $upgrader->upgrade($current);
     
    11811181        add_filter('update_feedback', $feedback);
    11821182
    1183     include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
     1183    require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    11841184    $upgrader = new Plugin_Upgrader();
    11851185    return $upgrader->upgrade($plugin);
     
    12031203        add_filter('update_feedback', $feedback);
    12041204
    1205     include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
     1205    require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    12061206    $upgrader = new Theme_Upgrader();
    12071207    return $upgrader->upgrade($theme);
Note: See TracChangeset for help on using the changeset viewer.