WordPress.org

Make WordPress Core

Changeset 32106


Ignore:
Timestamp:
04/10/2015 09:07:42 PM (4 years ago)
Author:
azaozz
Message:

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

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/press-this.css

    r32092 r32106  
    12521252}
    12531253
    1254 .alert.is-hidden {
    1255     display: none;
    1256 }
    12571254.alert.is-error:before {
    12581255    background: red;
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r32102 r32106  
    1515class WP_Press_This {
    1616
     17    // Used to trigger the bookmarklet update notice.
     18    public $version = 8;
     19
    1720    private $images = array();
    1821
     
    3942    public function site_settings() {
    4043        return array(
    41             /*
    42              * Used to trigger the bookmarklet update notice. Needs to be set here and in
    43              * get_shortcut_link() in wp-includes/link-template.php.
    44              */
    45             'version' => '8',
    46 
    4744            /**
    4845             * Filter whether or not Press This should redirect the user in the parent window upon save.
     
    13241321        <div class="editor-wrapper">
    13251322            <div class="alerts" role="alert" aria-live="assertive" aria-relevant="all" aria-atomic="true">
    1326                 <p class="alert is-notice is-hidden should-upgrade-bookmarklet">
    1327                     <?php printf( __( 'You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!' ), admin_url( 'tools.php' ) ); ?>
    1328                 </p>
     1323                <?php
     1324
     1325                if ( empty( $data['v'] ) || $this->version > $data['v'] ) {
     1326                    ?>
     1327                    <p class="alert is-notice">
     1328                        <?php printf( __( 'You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!' ), admin_url( 'tools.php' ) ); ?>
     1329                    </p>
     1330                    <?php
     1331                }
     1332
     1333                ?>
    13291334            </div>
    13301335
  • trunk/src/wp-admin/js/press-this.js

    r32098 r32106  
    367367                } );
    368368            }
    369 
    370             // Prompt user to upgrade their bookmarklet if there is a version mismatch.
    371             if ( data.v && settings.version && ( data.v + '' ) !== ( settings.version + '' ) ) {
    372                 $( '.should-upgrade-bookmarklet' ).removeClass( 'is-hidden' );
    373             }
    374369        }
    375370
  • trunk/src/wp-includes/link-template.php

    r32042 r32106  
    26012601    global $is_IE, $wp_version;
    26022602
    2603     $bookmarklet_version = '8';
     2603    include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
     2604    $bookmarklet_version = $GLOBALS['wp_press_this']->version;
    26042605    $link = '';
    26052606
Note: See TracChangeset for help on using the changeset viewer.