WordPress.org

Make WordPress Core

Changeset 38462


Ignore:
Timestamp:
08/31/2016 06:07:01 AM (3 years ago)
Author:
wonderboymusic
Message:

Press This: in get_shortcut_link(), just check a class constant on WP_Press_This instead of instantiating the object and reading an instance prop.

See #37699.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r38459 r38462  
    1414 */
    1515class WP_Press_This {
    16 
    1716    // Used to trigger the bookmarklet update notice.
     17    const VERSION = 8;
    1818    public $version = 8;
    1919
  • trunk/src/wp-includes/link-template.php

    r38459 r38462  
    28992899 *
    29002900 * @global bool          $is_IE      Whether the browser matches an Internet Explorer user agent.
    2901  * @global WP_Press_This $wp_press_this
    2902  *
    2903  * @return string The Press This bookmarklet link URL.
    29042901 */
    29052902function get_shortcut_link() {
    29062903    global $is_IE;
    29072904
    2908     $GLOBALS['wp_press_this'] = new WP_Press_This();
    2909     $bookmarklet_version = $GLOBALS['wp_press_this']->version;
    29102905    $link = '';
    29112906
     
    29252920            $link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,' .
    29262921                's=(e?e():(k)?k():(x?x.createRange().text:0)),f=' . $url . ',l=d.location,e=encodeURIComponent,' .
    2927                 'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . $bookmarklet_version . '";' .
     2922                'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . WP_Press_This::VERSION . '";' .
    29282923                'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};' .
    29292924                'if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();void(0)';
     
    29352930
    29362931        if ( $src ) {
    2937             $url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version );
     2932            $url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . WP_Press_This::VERSION );
    29382933            $link = 'javascript:' . str_replace( 'window.pt_url', $url, $src );
    29392934        }
Note: See TracChangeset for help on using the changeset viewer.