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. git-svn-id: https://develop.svn.wordpress.org/trunk@38462 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1825eff382
commit
988752b138
@ -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();
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user