Ticket #17323: 17323.7.diff
| File 17323.7.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
671 671 background-color: #f4f4f4; 672 672 } 673 673 674 #dashboard_browser_nag.postbox.browser-insecure { 675 background-color: #AC1B1B; 676 border-color: #AC1B1B; 677 } 678 679 #dashboard_browser_nag.postbox { 680 background-color: #e29808; 681 border-color: #EDC048; 682 } 683 684 #dashboard_browser_nag.postbox { 685 -moz-box-shadow: none; 686 -webkit-box-shadow: none; 687 box-shadow:none; 688 } 689 690 #dashboard_browser_nag.postbox.browser-insecure h3 { 691 border-bottom-color: #CD5A5A; 692 } 693 694 #dashboard_browser_nag.postbox h3 { 695 border-bottom-color: #F6E2AC; 696 text-shadow: none; 697 -moz-box-shadow: none; 698 -webkit-box-shadow: none; 699 box-shadow: none; 700 background-image: none; 701 } 702 703 .ui-sortable #dashboard_browser_nag.postbox, 704 .ui-sortable #dashboard_browser_nag.postbox h3 { 705 color: #fff; 706 } 707 708 #dashboard_browser_nag a { 709 color: #fff; 710 } 711 712 #dashboard_browser_nag.browser-insecure a.browse-happy-link, 713 #dashboard_browser_nag.browser-insecure a.update-browser-link { 714 text-shadow: #871B15 0 1px 0; 715 } 716 717 #dashboard_browser_nag a.browse-happy-link, 718 #dashboard_browser_nag a.update-browser-link { 719 text-shadow: #D29A04 0 1px 0; 720 } 721 674 722 .ui-sortable .postbox h3 { 675 723 color: #464646; 676 724 } … … 1846 1894 .appearance_page_custom-header #upload-form p label { 1847 1895 color: #777; 1848 1896 } 1849 /* end custom header page */ 1850 No newline at end of file 1897 /* 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 if ( is_ssl() ) 1174 $response['img_src'] = str_replace( 'http://', 'https://', $response['img_src'] ); 1175 1176 $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr($response['img_src']) . '" alt="" /></a></div>'; 1177 $browser_nag_class = ' has-browser-icon'; 1178 } 1179 $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; 1180 $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/' ); 1181 $notice .= '<p><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>'; 1182 $notice .= '<div class="clear"></div>'; 1183 1184 echo apply_filters( 'browse-happy-notice', $notice ); 1185 } 1186 1187 function dashboard_browser_nag_class( $classes ) { 1188 $response = wp_check_browser_version(); 1189 1190 if ( $response['insecure'] ) 1191 $classes[] = 'browser-insecure'; 1192 1193 return $classes; 1194 } 1195 1150 1196 /** 1197 * Check if the user needs a browser update 1198 * 1199 * @since 3.2 1200 */ 1201 function wp_check_browser_version() { 1202 $key = md5( $_SERVER['HTTP_USER_AGENT'] ); 1203 1204 if ( false === ($response = get_site_transient('browsehappy_' . $key) ) ) { 1205 global $wp_version; 1206 1207 $options = array( 1208 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 1209 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 1210 ); 1211 1212 $raw_response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options ); 1213 1214 if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] ) 1215 return; 1216 1217 /** 1218 * Response should be an array with: 1219 * 'name' - string- A user friendly browser name 1220 * 'version' - string - The most recent version of the browser 1221 * 'current_version' - string - The version of the browser the user is using 1222 * 'upgrade' - boolean - Whether the browser needs an upgrade 1223 * 'insecure' - boolean - Whether the browser is deemed insecure 1224 * 'upgrade_url' - string - The url to visit to upgrade 1225 * 'img_src' - string - An image representing the browser 1226 */ 1227 $response = unserialize( $raw_response['body'] ); 1228 1229 if ( ! $response ) 1230 return; 1231 1232 set_site_transient( 'browsehappy_' . $key, $response, 604800 ); // cache for 1 week 1233 } 1234 1235 return $response; 1236 } 1237 1238 /** 1151 1239 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS). 1152 1240 */ 1153 1241 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