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
This commit is contained in:
Andrew Ozz 2015-04-10 21:07:42 +00:00
parent 1de9bc1670
commit 301bb0b9da
4 changed files with 16 additions and 18 deletions

View File

@ -1251,9 +1251,6 @@ html {
}
}
.alert.is-hidden {
display: none;
}
.alert.is-error:before {
background: red;
}

View File

@ -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 {
<div class="wrapper">
<div class="editor-wrapper">
<div class="alerts" role="alert" aria-live="assertive" aria-relevant="all" aria-atomic="true">
<p class="alert is-notice is-hidden should-upgrade-bookmarklet">
<?php printf( __( 'You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!' ), admin_url( 'tools.php' ) ); ?>
</p>
<?php
if ( empty( $data['v'] ) || $this->version > $data['v'] ) {
?>
<p class="alert is-notice">
<?php printf( __( 'You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!' ), admin_url( 'tools.php' ) ); ?>
</p>
<?php
}
?>
</div>
<div id="app-container" class="editor">

View File

@ -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' );
}
}
/**

View File

@ -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 ) {