mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 09:10:06 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@47198 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -27,7 +27,7 @@ class Test_WP_Customize_Control extends WP_UnitTestCase {
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->wp_customize = $GLOBALS['wp_customize'];
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$this->manager = $this->instantiate();
|
||||
$this->undefined = new stdClass();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class Tests_WP_Customize_Panel extends WP_UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->manager = $GLOBALS['wp_customize'];
|
||||
$this->undefined = new stdClass();
|
||||
|
||||
@@ -31,7 +31,7 @@ class Test_WP_Customize_Partial extends WP_UnitTestCase {
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->wp_customize = $GLOBALS['wp_customize'];
|
||||
if ( isset( $this->wp_customize->selective_refresh ) ) {
|
||||
|
||||
@@ -21,7 +21,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->manager = $GLOBALS['wp_customize'];
|
||||
$this->undefined = new stdClass();
|
||||
|
||||
@@ -41,7 +41,7 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
add_filter( 'wp_doing_ajax', '__return_true' );
|
||||
add_filter( 'wp_die_ajax_handler', array( $this, 'get_wp_die_handler' ), 1, 1 );
|
||||
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->wp_customize = $GLOBALS['wp_customize'];
|
||||
if ( isset( $this->wp_customize->selective_refresh ) ) {
|
||||
|
||||
@@ -31,7 +31,7 @@ class Test_WP_Customize_Selective_Refresh extends WP_UnitTestCase {
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->wp_customize = $GLOBALS['wp_customize'];
|
||||
if ( isset( $this->wp_customize->selective_refresh ) ) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->manager = $GLOBALS['wp_customize'];
|
||||
$this->undefined = new stdClass();
|
||||
|
||||
@@ -22,7 +22,7 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
|
||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||
$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
|
||||
|
||||
Reference in New Issue
Block a user