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
This commit is contained in:
Scott Taylor 2016-08-25 19:09:35 +00:00
parent ed0da659bc
commit 9ce58d9d86
3 changed files with 2 additions and 9 deletions

View File

@ -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 ) {

View File

@ -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;

View File

@ -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.