Press This: the file for the WP_Press_This class should not produce side effects. Similar to what we did in r38355 for WP_Site_Icon, drop the instances of global instantiation for $wp_press_this via loading the file. The variable can be set inline when necessary. In most of those places, if the global is already set, the file does not load and stomp it currently.

See #37699.

Built from https://develop.svn.wordpress.org/trunk@38397


git-svn-id: http://core.svn.wordpress.org/trunk@38338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2016-08-27 06:07:29 +00:00
parent e6ed174135
commit 85d63f2af5
5 changed files with 5 additions and 7 deletions

View File

@ -3138,6 +3138,7 @@ function wp_ajax_destroy_sessions() {
function wp_ajax_press_this_save_post() {
if ( empty( $GLOBALS['wp_press_this'] ) ) {
include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
$GLOBALS['wp_press_this'] = new WP_Press_This();
}
$GLOBALS['wp_press_this']->save_post();
@ -3153,6 +3154,7 @@ function wp_ajax_press_this_save_post() {
function wp_ajax_press_this_add_category() {
if ( empty( $GLOBALS['wp_press_this'] ) ) {
include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
$GLOBALS['wp_press_this'] = new WP_Press_This();
}
$GLOBALS['wp_press_this']->add_category();

View File

@ -1516,9 +1516,3 @@ class WP_Press_This {
die();
}
}
/**
*
* @global WP_Press_This $wp_press_this
*/
$GLOBALS['wp_press_this'] = new WP_Press_This;

View File

@ -24,6 +24,7 @@ if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_obj
*/
if ( empty( $GLOBALS['wp_press_this'] ) ) {
include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
$GLOBALS['wp_press_this'] = new WP_Press_This();
}
$GLOBALS['wp_press_this']->html();

View File

@ -2910,6 +2910,7 @@ function get_shortcut_link() {
global $is_IE, $wp_version;
include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
$GLOBALS['wp_press_this'] = new WP_Press_This();
$bookmarklet_version = $GLOBALS['wp_press_this']->version;
$link = '';

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38396';
$wp_version = '4.7-alpha-38397';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.