Make WordPress Core

Changeset 38397


Ignore:
Timestamp:
08/27/2016 06:06:50 AM (8 years ago)
Author:
wonderboymusic
Message:

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.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r38355 r38397  
    31393139    if ( empty( $GLOBALS['wp_press_this'] ) ) {
    31403140        include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
     3141        $GLOBALS['wp_press_this'] = new WP_Press_This();
    31413142    }
    31423143
     
    31543155    if ( empty( $GLOBALS['wp_press_this'] ) ) {
    31553156        include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
     3157        $GLOBALS['wp_press_this'] = new WP_Press_This();
    31563158    }
    31573159
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r38361 r38397  
    15171517    }
    15181518}
    1519 
    1520 /**
    1521  *
    1522  * @global WP_Press_This $wp_press_this
    1523  */
    1524 $GLOBALS['wp_press_this'] = new WP_Press_This;
  • trunk/src/wp-admin/press-this.php

    r37914 r38397  
    2525if ( empty( $GLOBALS['wp_press_this'] ) ) {
    2626    include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
     27    $GLOBALS['wp_press_this'] = new WP_Press_This();
    2728}
    2829
  • trunk/src/wp-includes/link-template.php

    r38388 r38397  
    29112911
    29122912    include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
     2913    $GLOBALS['wp_press_this'] = new WP_Press_This();
    29132914    $bookmarklet_version = $GLOBALS['wp_press_this']->version;
    29142915    $link = '';
Note: See TracChangeset for help on using the changeset viewer.