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/tools.php

    r47093 r47198  
    1111    // continues to work after creating the new files for exporting and erasing of personal data.
    1212    if ( $_GET['page'] === 'export_personal_data' ) {
    13         require_once( ABSPATH . 'wp-admin/export-personal-data.php' );
     13        require_once ABSPATH . 'wp-admin/export-personal-data.php';
    1414        return;
    1515    } elseif ( $_GET['page'] === 'remove_personal_data' ) {
    16         require_once( ABSPATH . 'wp-admin/erase-personal-data.php' );
     16        require_once ABSPATH . 'wp-admin/erase-personal-data.php';
    1717        return;
    1818    }
     
    2020
    2121/** WordPress Administration Bootstrap */
    22 require_once( dirname( __FILE__ ) . '/admin.php' );
     22require_once __DIR__ . '/admin.php';
    2323
    2424// The privacy policy guide used to be outputted from here. Since WP 5.3 it is in wp-admin/privacy-policy-guide.php.
     
    5454);
    5555
    56 require_once( ABSPATH . 'wp-admin/admin-header.php' );
     56require_once ABSPATH . 'wp-admin/admin-header.php';
    5757
    5858?>
     
    9393<?php
    9494
    95 include( ABSPATH . 'wp-admin/admin-footer.php' );
     95require_once ABSPATH . 'wp-admin/admin-footer.php';
Note: See TracChangeset for help on using the changeset viewer.