Ticket #17323: 17323.8.diff
| File 17323.8.diff, 8.5 KB (added by aaroncampbell, 2 years ago) |
|---|
-
wp-admin/css/colors-classic.dev.css
641 641 border-color: #D1E5EE; 642 642 } 643 643 644 #dashboard_browser_nag.postbox.browser-insecure { 645 background-color: #AC1B1B; 646 border-color: #AC1B1B; 647 } 648 649 #dashboard_browser_nag.postbox { 650 background-color: #e29808; 651 border-color: #EDC048; 652 } 653 654 #dashboard_browser_nag.postbox { 655 -moz-box-shadow: none; 656 -webkit-box-shadow: none; 657 box-shadow:none; 658 } 659 660 #dashboard_browser_nag.browser-insecure.postbox h3 { 661 border-bottom-color: #CD5A5A; 662 } 663 664 #dashboard_browser_nag.postbox h3 { 665 border-bottom-color: #F6E2AC; 666 } 667 668 #dashboard_browser_nag.postbox h3 { 669 background:none; 670 text-shadow: none; 671 -moz-box-shadow: none; 672 -webkit-box-shadow: none; 673 box-shadow: none; 674 } 675 .ui-sortable #dashboard_browser_nag.postbox, 676 .ui-sortable #dashboard_browser_nag.postbox h3 { 677 color: #fff; 678 } 679 680 #dashboard_browser_nag a { 681 color: #fff; 682 } 683 684 #dashboard_browser_nag.browser-insecure a.browse-happy-link, 685 #dashboard_browser_nag.browser-insecure a.update-browser-link { 686 text-shadow: #871B15 0 1px 0; 687 } 688 689 #dashboard_browser_nag a.browse-happy-link, 690 #dashboard_browser_nag a.update-browser-link { 691 text-shadow: #D29A04 0 1px 0; 692 } 693 644 694 .widget, 645 695 .postbox { 646 696 background-color: #fff; -
wp-admin/css/colors-fresh.dev.css
675 675 background-color: #f4f4f4; 676 676 } 677 677 678 #dashboard_browser_nag.postbox.browser-insecure { 679 background-color: #AC1B1B; 680 border-color: #AC1B1B; 681 } 682 683 #dashboard_browser_nag.postbox { 684 background-color: #e29808; 685 border-color: #EDC048; 686 } 687 688 #dashboard_browser_nag.postbox { 689 -moz-box-shadow: none; 690 -webkit-box-shadow: none; 691 box-shadow:none; 692 } 693 694 #dashboard_browser_nag.postbox.browser-insecure h3 { 695 border-bottom-color: #CD5A5A; 696 } 697 698 #dashboard_browser_nag.postbox h3 { 699 border-bottom-color: #F6E2AC; 700 text-shadow: none; 701 -moz-box-shadow: none; 702 -webkit-box-shadow: none; 703 box-shadow: none; 704 background-image: none; 705 } 706 707 .ui-sortable #dashboard_browser_nag.postbox, 708 .ui-sortable #dashboard_browser_nag.postbox h3 { 709 color: #fff; 710 } 711 712 #dashboard_browser_nag a { 713 color: #fff; 714 } 715 716 #dashboard_browser_nag.browser-insecure a.browse-happy-link, 717 #dashboard_browser_nag.browser-insecure a.update-browser-link { 718 text-shadow: #871B15 0 1px 0; 719 } 720 721 #dashboard_browser_nag a.browse-happy-link, 722 #dashboard_browser_nag a.update-browser-link { 723 text-shadow: #D29A04 0 1px 0; 724 } 725 678 726 .ui-sortable .postbox h3 { 679 727 color: #464646; 680 728 } … … 1867 1915 .appearance_page_custom-header #upload-form p label { 1868 1916 color: #777; 1869 1917 } 1870 /* end custom header page */ 1871 No newline at end of file 1918 /* end custom header page */ -
wp-admin/css/dashboard.dev.css
73 73 text-decoration: none; 74 74 } 75 75 76 #dashboard-widgets a.update-browser-link { 77 font-size:1.2em; 78 font-weight:bold; 79 } 80 81 #dashboard-widgets #dashboard_browser_nag a, 76 82 #dashboard-widgets h3 a { 77 83 text-decoration: underline; 78 84 } 79 85 86 #dashboard-widgets p.browser-update-nag.has-browser-icon { 87 padding-right:125px; 88 } 89 90 #dashboard-widgets .browser-icon { 91 margin-top: -35px; 92 } 93 80 94 #dashboard-widgets h3 .postbox-title-action { 81 95 position: absolute; 82 96 right: 30px; -
wp-admin/includes/dashboard.php
25 25 26 26 /* Register Widgets and Controls */ 27 27 28 $response = wp_check_browser_version(); 29 30 if ( $response['upgrade'] ) { 31 add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' ); 32 if ( $response['insecure'] ) 33 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' ); 34 else 35 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' ); 36 } 37 28 38 // Right Now 29 39 if ( is_blog_admin() && current_user_can('edit_posts') ) 30 40 wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' ); … … 1147 1157 } 1148 1158 add_action( 'activity_box_end', 'wp_dashboard_quota' ); 1149 1159 1160 // Display Browser Nag Meta Box 1161 function wp_dashboard_browser_nag() { 1162 $notice = ''; 1163 $response = wp_check_browser_version(); 1164 1165 if ( $response['insecure'] ) { 1166 $msg = sprintf( __( 'It looks like you\'re using an insecure version of <a href="%1$s">%2$s</a>. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser.' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) ); 1167 } else { 1168 $msg = sprintf( __( 'It looks like you\'re using an old version of <a href="%1$s">%2$s</a>. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser.' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) ); 1169 } 1170 1171 $browser_nag_class = ''; 1172 if ( !empty( $response['img_src'] ) ) { 1173 $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src']; 1174 1175 $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>'; 1176 $browser_nag_class = ' has-browser-icon'; 1177 } 1178 $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; 1179 $notice .= 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>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), 'http://browsehappy.com/' ); 1180 $notice .= '<p><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>'; 1181 $notice .= '<div class="clear"></div>'; 1182 1183 echo apply_filters( 'browse-happy-notice', $notice, $response ); 1184 } 1185 1186 function dashboard_browser_nag_class( $classes ) { 1187 $response = wp_check_browser_version(); 1188 1189 if ( $response['insecure'] ) 1190 $classes[] = 'browser-insecure'; 1191 1192 return $classes; 1193 } 1194 1150 1195 /** 1196 * Check if the user needs a browser update 1197 * 1198 * @since 3.2 1199 */ 1200 function wp_check_browser_version() { 1201 $key = md5( $_SERVER['HTTP_USER_AGENT'] ); 1202 1203 if ( false === ($response = get_site_transient('browsehappy_' . $key) ) ) { 1204 global $wp_version; 1205 1206 $options = array( 1207 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 1208 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 1209 ); 1210 1211 $raw_response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options ); 1212 1213 if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] ) 1214 return; 1215 1216 /** 1217 * Response should be an array with: 1218 * 'name' - string- A user friendly browser name 1219 * 'version' - string - The most recent version of the browser 1220 * 'current_version' - string - The version of the browser the user is using 1221 * 'upgrade' - boolean - Whether the browser needs an upgrade 1222 * 'insecure' - boolean - Whether the browser is deemed insecure 1223 * 'upgrade_url' - string - The url to visit to upgrade 1224 * 'img_src' - string - An image representing the browser 1225 */ 1226 $response = unserialize( $raw_response['body'] ); 1227 1228 if ( ! $response ) 1229 return; 1230 1231 set_site_transient( 'browsehappy_' . $key, $response, 604800 ); // cache for 1 week 1232 } 1233 1234 return $response; 1235 } 1236 1237 /** 1151 1238 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS). 1152 1239 */ 1153 1240 function wp_dashboard_empty() {} -
wp-admin/js/postbox.dev.js
18 18 $('.postbox h3 a').click( function(e) { 19 19 e.stopPropagation(); 20 20 } ); 21 $('.postbox a.dismiss').click( function(e) { 22 var hide_id = $(this).parents('.postbox').attr('id') + '-hide'; 23 $( '#' + hide_id ).attr('checked', false).triggerHandler('click'); 24 return false; 25 } ); 21 26 $('.hide-postbox-tog').click( function() { 22 27 var box = $(this).val(); 23 28