Press This: check the bookmarklet version and add the update notice from PHP.

Fixes #31942.
Built from https://develop.svn.wordpress.org/trunk@32106


git-svn-id: http://core.svn.wordpress.org/trunk@32085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-04-10 21:08:29 +00:00
parent 56f59c2ad7
commit ad475b3c69
9 changed files with 20 additions and 25 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,9 @@
*/ */
class WP_Press_This { class WP_Press_This {
// Used to trigger the bookmarklet update notice.
public $version = 8;
private $images = array(); private $images = array();
private $embeds = array(); private $embeds = array();
@ -38,12 +41,6 @@ class WP_Press_This {
*/ */
public function site_settings() { public function site_settings() {
return array( 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. * 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="wrapper">
<div class="editor-wrapper"> <div class="editor-wrapper">
<div class="alerts" role="alert" aria-live="assertive" aria-relevant="all" aria-atomic="true"> <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
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' ) ); ?> <?php printf( __( 'You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!' ), admin_url( 'tools.php' ) ); ?>
</p> </p>
<?php
}
?>
</div> </div>
<div id="app-container" class="editor"> <div id="app-container" class="editor">

View File

@ -366,11 +366,6 @@
renderError( msg ); 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' );
}
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -2600,7 +2600,8 @@ function paginate_comments_links($args = array()) {
function get_shortcut_link() { function get_shortcut_link() {
global $is_IE, $wp_version; 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 = ''; $link = '';
if ( $is_IE ) { if ( $is_IE ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-beta4-32105'; $wp_version = '4.2-beta4-32106';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.