WordPress.org

Make WordPress Core

Ticket #17323: 17323.4.diff

File 17323.4.diff, 9.8 KB (added by aaroncampbell, 7 years ago)

As meta box

  • wp-admin/css/colors-classic.dev.css

     
    641641        border-color: #D1E5EE;
    642642}
    643643
     644#dashboard_browser_nag_insecure.postbox {
     645        background-color: #AC1B1B;
     646        border-color: #AC1B1B;
     647}
     648
     649#dashboard_browser_nag_update.postbox {
     650        background-color: #E7A904;
     651        border-color: #EDC048;
     652}
     653
     654#dashboard_browser_nag_insecure.postbox,
     655#dashboard_browser_nag_update.postbox {
     656        -moz-box-shadow: none;
     657        -webkit-box-shadow: none;
     658        box-shadow:none;
     659}
     660
     661#dashboard_browser_nag_insecure.postbox h3 {
     662        border-bottom-color: #CD5A5A;
     663}
     664
     665#dashboard_browser_nag_update.postbox h3 {
     666        border-bottom-color: #F6E2AC;
     667}
     668
     669#dashboard_browser_nag_insecure.postbox h3,
     670#dashboard_browser_nag_update.postbox h3 {
     671        background:none;
     672        text-shadow: none;
     673        -moz-box-shadow: none;
     674        -webkit-box-shadow: none;
     675        box-shadow: none;
     676}
     677.ui-sortable #dashboard_browser_nag_insecure.postbox,
     678.ui-sortable #dashboard_browser_nag_insecure.postbox h3,
     679.ui-sortable #dashboard_browser_nag_update.postbox,
     680.ui-sortable #dashboard_browser_nag_update.postbox h3 {
     681        color: #fff;
     682}
     683
     684#dashboard_browser_nag_insecure a,
     685#dashboard_browser_nag_update a {
     686        color: #fff;
     687}
     688
     689#dashboard_browser_nag_insecure a.browse-happy-link,
     690#dashboard_browser_nag_insecure a.update-browser-link {
     691        text-shadow: #871B15 0 1px 0;
     692}
     693
     694#dashboard_browser_nag_update a.browse-happy-link,
     695#dashboard_browser_nag_update a.update-browser-link {
     696        text-shadow: #D29A04 0 1px 0;
     697}
     698
    644699.widget,
    645700.postbox {
    646701        background-color: #fff;
  • wp-admin/css/colors-fresh.dev.css

     
    665665        background-color: #f9f9f9;
    666666}
    667667
     668#dashboard_browser_nag_insecure.postbox {
     669        background-color: #AC1B1B;
     670        border-color: #AC1B1B;
     671}
     672
     673#dashboard_browser_nag_update.postbox {
     674        background-color: #E7A904;
     675        border-color: #EDC048;
     676}
     677
     678#dashboard_browser_nag_insecure.postbox,
     679#dashboard_browser_nag_update.postbox {
     680        -moz-box-shadow: none;
     681        -webkit-box-shadow: none;
     682        box-shadow:none;
     683}
     684
     685#dashboard_browser_nag_insecure.postbox h3 {
     686        border-bottom-color: #CD5A5A;
     687}
     688
     689#dashboard_browser_nag_update.postbox h3 {
     690        border-bottom-color: #F6E2AC;
     691}
     692
     693#dashboard_browser_nag_insecure.postbox h3,
     694#dashboard_browser_nag_update.postbox h3 {
     695        text-shadow: none;
     696        -moz-box-shadow: none;
     697        -webkit-box-shadow: none;
     698        box-shadow: none;
     699}
     700.ui-sortable #dashboard_browser_nag_insecure.postbox,
     701.ui-sortable #dashboard_browser_nag_insecure.postbox h3,
     702.ui-sortable #dashboard_browser_nag_update.postbox,
     703.ui-sortable #dashboard_browser_nag_update.postbox h3 {
     704        color: #fff;
     705}
     706
     707#dashboard_browser_nag_insecure a,
     708#dashboard_browser_nag_update a {
     709        color: #fff;
     710}
     711
     712#dashboard_browser_nag_insecure a.browse-happy-link,
     713#dashboard_browser_nag_insecure a.update-browser-link {
     714        text-shadow: #871B15 0 1px 0;
     715}
     716
     717#dashboard_browser_nag_update a.browse-happy-link,
     718#dashboard_browser_nag_update a.update-browser-link {
     719        text-shadow: #D29A04 0 1px 0;
     720}
     721
    668722.ui-sortable .postbox h3 {
    669723        color: #464646;
    670724}
  • wp-admin/css/dashboard.dev.css

     
    7373        text-decoration: none;
    7474}
    7575
     76#dashboard-widgets a.update-browser-link {
     77        font-size:1.2em;
     78        font-weight:bold;
     79}
     80
     81#dashboard-widgets a.browse-happy-link,
     82#dashboard-widgets a.update-browser-link,
    7683#dashboard-widgets h3 a {
    7784        text-decoration: underline;
    7885}
    7986
     87#dashboard-widgets p.browser-update-nag {
     88        padding-right:125px;
     89}
     90
     91#dashboard-widgets .icon {
     92        float: right;
     93        width: 125px;
     94        height: 135px;
     95        margin: -35px auto 0;
     96        background: -625px 0 url(../images/browsers-sprite.png) no-repeat;
     97}
     98#dashboard-widgets .chrome.icon {
     99        background-position: 0 0;
     100}
     101#dashboard-widgets .firefox.icon {
     102        background-position: -125px 0;
     103}
     104#dashboard-widgets .opera.icon {
     105        background-position: -250px 0;
     106}
     107#dashboard-widgets .safari.icon {
     108        background-position: -375px 0;
     109}
     110#dashboard-widgets .internetexplorer.icon {
     111        background-position: -500px 0;
     112}
     113
    80114#dashboard-widgets h3 .postbox-title-action {
    81115        position: absolute;
    82116        right: 30px;
  • wp-admin/includes/dashboard.php

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-admin\images\browsers-sprite.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
     
    2525
    2626        /* Register Widgets and Controls */
    2727
     28        $response = wp_check_browser_version();
     29
     30        if ( $response['upgrade'] ) {
     31                if ( $response['insecure'] )
     32                        wp_add_dashboard_widget( 'dashboard_browser_nag_insecure', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
     33                else
     34                        wp_add_dashboard_widget( 'dashboard_browser_nag_update', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
     35        }
     36
    2837        // Right Now
    2938        if ( is_blog_admin() && current_user_can('edit_posts') )
    3039                wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
     
    11471156}
    11481157add_action( 'activity_box_end', 'wp_dashboard_quota' );
    11491158
     1159// Display Browser Nag Meta Box
     1160function wp_dashboard_browser_nag() {
     1161        $response = wp_check_browser_version();
     1162
     1163        /**
     1164         * @todo add to API?
     1165         */
     1166        if ( empty( $response['update_url'] ) ) {
     1167                $response['update_url'] = '';
     1168        }
     1169
     1170        $insecure = $response['insecure']? 'insecure' : 'old';
     1171
     1172        $msg = sprintf( __( 'It looks like you\'re using and old version of %1$s.  Using an outdated browser makes your computer unsafe.  For the best WordPress experience, please update your browser.' ), $response['name'] );
     1173        $msg = "<div class='icon " . sanitize_html_class( strtolower( $response['name'] ) ) . "'></div><p class='browser-update-nag'>{$msg}</p>";
     1174        $msg .= sprintf( __( '<p><a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a></p>' ), $response['update_url'], $response['name'], 'http://browsehappy.com/' );
     1175        $msg .= '<div class="clear"></div>';
     1176
     1177        echo apply_filters( 'browse-happy-notice', $msg );
     1178}
     1179
     1180
    11501181/**
    11511182 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
    11521183 */
  • wp-includes/functions.php

     
    8585        global $wp_locale;
    8686        $i = $unixtimestamp;
    8787
    88         if ( false === $i ) {
    89                 if ( ! $gmt )
    90                         $i = current_time( 'timestamp' );
    91                 else
    92                         $i = time();
    93                 // we should not let date() interfere with our
    94                 // specially computed timestamp
    95                 $gmt = true;
    96         }
    97 
    9888        // store original value for language with untypical grammars
    9989        // see http://core.trac.wordpress.org/ticket/9396
    10090        $req_format = $dateformatstring;
     
    600590
    601591        wp_protect_special_option( $option );
    602592
    603         /* 
     593        /*
    604594         * FIXME the next two lines of code are not necessary and should be removed.
    605595         * @see http://core.trac.wordpress.org/ticket/13480
    606596         */
     
    28762866 * @param string $title Error title.
    28772867 * @param string|array $args Optional arguements to control behaviour.
    28782868 */
    2879 function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 
     2869function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
    28802870        global $wp_xmlrpc_server;
    28812871        $defaults = array( 'response' => 500 );
    28822872
    28832873        $r = wp_parse_args($args, $defaults);
    28842874
    2885         if ( $wp_xmlrpc_server ) { 
    2886                 $error = new IXR_Error( $r['response'] , $message); 
    2887                 $wp_xmlrpc_server->output( $error->getXml() ); 
     2875        if ( $wp_xmlrpc_server ) {
     2876                $error = new IXR_Error( $r['response'] , $message);
     2877                $wp_xmlrpc_server->output( $error->getXml() );
    28882878        }
    28892879        die();
    28902880}
    28912881
    28922882/**
    28932883 * Filter to enable special wp_die handler for xmlrpc requests.
    2894  * 
     2884 *
    28952885 * @since 3.2.0
    28962886 * @access private
    28972887 */
    2898 function _xmlrpc_wp_die_filter() { 
     2888function _xmlrpc_wp_die_filter() {
    28992889        return '_xmlrpc_wp_die_handler';
    29002890}
    29012891
     
    45564546        @header( 'X-Frame-Options: SAMEORIGIN' );
    45574547}
    45584548
     4549/**
     4550 * Check if the user needs a browser update
     4551 *
     4552 * @since 3.2
     4553 */
     4554function wp_check_browser_version() {
     4555        $key = md5( $_SERVER['HTTP_USER_AGENT'] );
     4556
     4557        if ( false === ($response = get_site_transient('browsehappy_' . $key) ) ) {
     4558                global $wp_version;
     4559
     4560                $options = array(
     4561                        'body'                  => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
     4562                        'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
     4563                );
     4564
     4565                $raw_response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );
     4566
     4567                if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] )
     4568                        return;
     4569
     4570                /**
     4571                 * Response should be an array with:
     4572                 *  'name' - string- A user friendly browser name
     4573                 *  'version' - string - The most recent version of the browser
     4574                 *  'current_version' - string - The version of the browser the user is using
     4575                 *  'upgrade' - boolean - Whether the browser needs an upgrade
     4576                 *  'insecure' - boolean - Whether the browser is deemed insecure
     4577                 */
     4578                $response = unserialize( $raw_response['body'] );
     4579
     4580                if ( ! $response )
     4581                        return;
     4582
     4583                set_site_transient( 'browsehappy_' . $key, $response, 604800 ); // cache for 1 week
     4584        }
     4585
     4586        return $response;
     4587}
    45594588?>