mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 19:24:34 +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:
@@ -28,7 +28,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
|
||||
|
||||
global $wpdb, $wp_local_package;
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
require ABSPATH . WPINC . '/version.php';
|
||||
$php_version = phpversion();
|
||||
|
||||
$current = get_site_transient( 'update_core' );
|
||||
@@ -261,11 +261,11 @@ function wp_update_plugins( $extra_stats = array() ) {
|
||||
}
|
||||
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
require ABSPATH . WPINC . '/version.php';
|
||||
|
||||
// If running blog-side, bail unless we've not checked in the last 12 hours.
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
$plugins = get_plugins();
|
||||
@@ -441,7 +441,7 @@ function wp_update_themes( $extra_stats = array() ) {
|
||||
}
|
||||
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
require ABSPATH . WPINC . '/version.php';
|
||||
|
||||
$installed_themes = wp_get_themes();
|
||||
$translations = wp_get_installed_translations( 'themes' );
|
||||
@@ -603,8 +603,8 @@ function wp_update_themes( $extra_stats = array() ) {
|
||||
* @since 3.7.0
|
||||
*/
|
||||
function wp_maybe_auto_update() {
|
||||
include_once( ABSPATH . 'wp-admin/includes/admin.php' );
|
||||
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
||||
include_once ABSPATH . 'wp-admin/includes/admin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
|
||||
$upgrader = new WP_Automatic_Updater;
|
||||
$upgrader->run();
|
||||
@@ -729,7 +729,7 @@ function wp_get_update_data() {
|
||||
*/
|
||||
function _maybe_update_core() {
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
require ABSPATH . WPINC . '/version.php';
|
||||
|
||||
$current = get_site_transient( 'update_core' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user