From 9ce58d9d867aa23ffe2dd2d6ebdf7fbe49aa1f2f Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 25 Aug 2016 19:09:35 +0000 Subject: [PATCH] Site Icon: There is no good reason for `class-wp-site-icon.php` to drop a global instance of itself whenever the file is loaded. The lone use of the `global` instance of `WP_Site_Icon` is in an AJAX action that provides virtually no way to override - the file is loaded immediately before the `global` is used. Let us remove the `$wp_site_icon` global. I will fall on the sword if this comes back to bite us (waiting with bated breath). See #37699. Built from https://develop.svn.wordpress.org/trunk@38355 git-svn-id: http://core.svn.wordpress.org/trunk@38296 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 4 +--- wp-admin/includes/class-wp-site-icon.php | 5 ----- wp-includes/version.php | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index dc965d63cc..37fdc72067 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -3162,8 +3162,6 @@ function wp_ajax_press_this_add_category() { * Ajax handler for cropping an image. * * @since 4.3.0 - * - * @global WP_Site_Icon $wp_site_icon */ function wp_ajax_crop_image() { $attachment_id = absint( $_POST['id'] ); @@ -3184,7 +3182,7 @@ function wp_ajax_crop_image() { switch ( $context ) { case 'site-icon': require_once ABSPATH . '/wp-admin/includes/class-wp-site-icon.php'; - global $wp_site_icon; + $wp_site_icon = new WP_Site_Icon(); // Skip creating a new attachment if the attachment is a Site Icon. if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) { diff --git a/wp-admin/includes/class-wp-site-icon.php b/wp-admin/includes/class-wp-site-icon.php index 3afc83def7..a54c60b704 100644 --- a/wp-admin/includes/class-wp-site-icon.php +++ b/wp-admin/includes/class-wp-site-icon.php @@ -240,8 +240,3 @@ class WP_Site_Icon { return $value; } } - -/** - * @global WP_Site_Icon $wp_site_icon - */ -$GLOBALS['wp_site_icon'] = new WP_Site_Icon; diff --git a/wp-includes/version.php b/wp-includes/version.php index 4ce417c4e5..26174d679d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38354'; +$wp_version = '4.7-alpha-38355'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.