Make WordPress Core

Changeset 47198 for trunk/src/index.php


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

    r47122 r47198  
    99/** Define ABSPATH as this file's directory */
    1010if ( ! defined( 'ABSPATH' ) ) {
    11     define( 'ABSPATH', dirname( __FILE__ ) . '/' );
     11    define( 'ABSPATH', __DIR__ . '/' );
    1212}
    1313
     
    1818
    1919define( 'WPINC', 'wp-includes' );
    20 require_once( ABSPATH . WPINC . '/load.php' );
     20require_once ABSPATH . WPINC . '/load.php';
    2121
    2222// Standardize $_SERVER variables across setups.
    2323wp_fix_server_vars();
    2424
    25 require_once( ABSPATH . WPINC . '/functions.php' );
     25require_once ABSPATH . WPINC . '/functions.php';
    2626define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
    27 require_once( ABSPATH . WPINC . '/version.php' );
     27require_once ABSPATH . WPINC . '/version.php';
    2828
    2929wp_check_php_mysql_versions();
Note: See TracChangeset for help on using the changeset viewer.