From 301bb0b9da0dd042289207bad9dc9fde91feddd8 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 10 Apr 2015 21:07:42 +0000 Subject: [PATCH] Press This: check the bookmarklet version and add the update notice from PHP. Fixes #31942. git-svn-id: https://develop.svn.wordpress.org/trunk@32106 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/press-this.css | 3 --- src/wp-admin/includes/class-wp-press-this.php | 23 +++++++++++-------- src/wp-admin/js/press-this.js | 5 ---- src/wp-includes/link-template.php | 3 ++- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/wp-admin/css/press-this.css b/src/wp-admin/css/press-this.css index 108601112f..c913dc8cbf 100644 --- a/src/wp-admin/css/press-this.css +++ b/src/wp-admin/css/press-this.css @@ -1251,9 +1251,6 @@ html { } } -.alert.is-hidden { - display: none; -} .alert.is-error:before { background: red; } diff --git a/src/wp-admin/includes/class-wp-press-this.php b/src/wp-admin/includes/class-wp-press-this.php index dab007d568..2bd392aea5 100644 --- a/src/wp-admin/includes/class-wp-press-this.php +++ b/src/wp-admin/includes/class-wp-press-this.php @@ -14,6 +14,9 @@ */ class WP_Press_This { + // Used to trigger the bookmarklet update notice. + public $version = 8; + private $images = array(); private $embeds = array(); @@ -38,12 +41,6 @@ class WP_Press_This { */ public function site_settings() { return array( - /* - * Used to trigger the bookmarklet update notice. Needs to be set here and in - * get_shortcut_link() in wp-includes/link-template.php. - */ - 'version' => '8', - /** * Filter whether or not Press This should redirect the user in the parent window upon save. * @@ -1323,9 +1320,17 @@ class WP_Press_This {
diff --git a/src/wp-admin/js/press-this.js b/src/wp-admin/js/press-this.js index 057ce0e5f7..b8f28c98a2 100644 --- a/src/wp-admin/js/press-this.js +++ b/src/wp-admin/js/press-this.js @@ -366,11 +366,6 @@ renderError( msg ); } ); } - - // Prompt user to upgrade their bookmarklet if there is a version mismatch. - if ( data.v && settings.version && ( data.v + '' ) !== ( settings.version + '' ) ) { - $( '.should-upgrade-bookmarklet' ).removeClass( 'is-hidden' ); - } } /** diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 1f90199e13..58b722cbad 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -2600,7 +2600,8 @@ function paginate_comments_links($args = array()) { function get_shortcut_link() { global $is_IE, $wp_version; - $bookmarklet_version = '8'; + include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' ); + $bookmarklet_version = $GLOBALS['wp_press_this']->version; $link = ''; if ( $is_IE ) {