Make WordPress Core


Ignore:
Timestamp:
02/06/2020 06:31:22 AM (5 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/tests/phpunit/tests/oembed/template.php

    r46586 r47198  
    2525
    2626        ob_start();
    27         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     27        require ABSPATH . WPINC . '/theme-compat/embed.php';
    2828        $actual = ob_get_clean();
    2929
     
    5757
    5858        ob_start();
    59         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     59        require ABSPATH . WPINC . '/theme-compat/embed.php';
    6060        $actual = ob_get_clean();
    6161
     
    7474
    7575        ob_start();
    76         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     76        require ABSPATH . WPINC . '/theme-compat/embed.php';
    7777        $actual = ob_get_clean();
    7878
     
    101101
    102102        ob_start();
    103         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     103        require ABSPATH . WPINC . '/theme-compat/embed.php';
    104104        $actual = ob_get_clean();
    105105
     
    126126
    127127        ob_start();
    128         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     128        require ABSPATH . WPINC . '/theme-compat/embed.php';
    129129        $actual = ob_get_clean();
    130130
     
    150150
    151151        ob_start();
    152         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     152        require ABSPATH . WPINC . '/theme-compat/embed.php';
    153153        $actual = ob_get_clean();
    154154
     
    173173
    174174        ob_start();
    175         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     175        require ABSPATH . WPINC . '/theme-compat/embed.php';
    176176        $actual = ob_get_clean();
    177177
     
    200200
    201201        ob_start();
    202         include( ABSPATH . WPINC . '/theme-compat/embed.php' );
     202        require ABSPATH . WPINC . '/theme-compat/embed.php';
    203203        $actual = ob_get_clean();
    204204
Note: See TracChangeset for help on using the changeset viewer.