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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2016-08-31 06:08:00 +00:00
parent 9383bf8f74
commit 1dc37b77ef
3 changed files with 4 additions and 9 deletions

View File

@ -13,8 +13,8 @@
* @since 4.2.0
*/
class WP_Press_This {
// Used to trigger the bookmarklet update notice.
const VERSION = 8;
public $version = 8;
private $images = array();

View File

@ -2898,15 +2898,10 @@ function the_comments_pagination( $args = array() ) {
* @since 2.6.0
*
* @global bool $is_IE Whether the browser matches an Internet Explorer user agent.
* @global WP_Press_This $wp_press_this
*
* @return string The Press This bookmarklet link URL.
*/
function get_shortcut_link() {
global $is_IE;
$GLOBALS['wp_press_this'] = new WP_Press_This();
$bookmarklet_version = $GLOBALS['wp_press_this']->version;
$link = '';
if ( $is_IE ) {
@ -2924,7 +2919,7 @@ function get_shortcut_link() {
$link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,' .
's=(e?e():(k)?k():(x?x.createRange().text:0)),f=' . $url . ',l=d.location,e=encodeURIComponent,' .
'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . $bookmarklet_version . '";' .
'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . WP_Press_This::VERSION . '";' .
'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};' .
'if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();void(0)';
}
@ -2934,7 +2929,7 @@ function get_shortcut_link() {
$src = @file_get_contents( ABSPATH . 'wp-admin/js/bookmarklet.min.js' );
if ( $src ) {
$url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version );
$url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . WP_Press_This::VERSION );
$link = 'javascript:' . str_replace( 'window.pt_url', $url, $src );
}
}

View File

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