Skip to content

Commit

Permalink
Coding Standards: Explicitly declare the $wp_version global used in…
Browse files Browse the repository at this point in the history
… some core files.

Props jaydeep-rami, sabernhardt.
Fixes #44932.

git-svn-id: https://develop.svn.wordpress.org/trunk@48971 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Sep 12, 2020
1 parent 2c843f0 commit 9066eb1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/wp-admin/includes/class-plugin-upgrader.php
Expand Up @@ -406,13 +406,14 @@ public function bulk_upgrade( $plugins, $args = array() ) {
* @since 3.3.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* @global string $wp_version The WordPress version string.
*
* @param string $source The path to the downloaded package source.
* @return string|WP_Error The source as passed, or a WP_Error object
* if no plugins were found.
*/
public function check_package( $source ) {
global $wp_filesystem;
global $wp_filesystem, $wp_version;

$this->new_plugin_data = array();

Expand Down Expand Up @@ -459,7 +460,7 @@ public function check_package( $source ) {
$error = sprintf(
/* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */
__( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ),
$GLOBALS['wp_version'],
$wp_version,
$requires_wp
);

Expand Down
5 changes: 3 additions & 2 deletions src/wp-admin/includes/class-theme-upgrader.php
Expand Up @@ -519,12 +519,13 @@ public function bulk_upgrade( $themes, $args = array() ) {
* @since 3.3.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* @global string $wp_version The WordPress version string.
*
* @param string $source The full path to the package source.
* @return string|WP_Error The source or a WP_Error.
*/
public function check_package( $source ) {
global $wp_filesystem;
global $wp_filesystem, $wp_version;

$this->new_theme_data = array();

Expand Down Expand Up @@ -606,7 +607,7 @@ public function check_package( $source ) {
$error = sprintf(
/* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
__( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ),
$GLOBALS['wp_version'],
$wp_version,
$requires_wp
);

Expand Down
6 changes: 3 additions & 3 deletions src/wp-includes/default-constants.php
Expand Up @@ -16,7 +16,7 @@
* @global string $wp_version The WordPress version string.
*/
function wp_initial_constants() {
global $blog_id;
global $blog_id, $wp_version;

/**#@+
* Constants for expressing human-readable data sizes in their respective number of bytes.
Expand Down Expand Up @@ -99,8 +99,8 @@ function wp_initial_constants() {
// Add define( 'SCRIPT_DEBUG', true ); to wp-config.php to enable loading of non-minified,
// non-concatenated scripts and stylesheets.
if ( ! defined( 'SCRIPT_DEBUG' ) ) {
if ( ! empty( $GLOBALS['wp_version'] ) ) {
$develop_src = false !== strpos( $GLOBALS['wp_version'], '-src' );
if ( ! empty( $wp_version ) ) {
$develop_src = false !== strpos( $wp_version, '-src' );
} else {
$develop_src = false;
}
Expand Down

0 comments on commit 9066eb1

Please sign in to comment.