Changeset 839
- Timestamp:
- 09/08/2014 06:20:32 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/ssl.php
r838 r839 44 44 } 45 45 add_filter( 'set_url_scheme', 'use_http_url_scheme', 10, 3 ); 46 47 /** 48 * Load certain stylesheets from the WordPress.org CDN instead of their local copies. 49 * 50 * On the login screen and Network Dashboard, many stylesheets that are loaded from the canonical 51 * WordCamp.org domain get redirected to central.wordcamp.org by an Nginx rule, and then blocked 52 * by the browser because they're loading over HTTP instead of HTTPS. 53 * 54 * Note: s.w.org runs trunk while WordCamp.org runs the latest tag, so be careful to only do this for 55 * stylesheets that are unlikely to have a significant impact if out of sync. 56 * 57 * @param WP_Styles $styles 58 */ 59 function load_select_core_styles_from_cdn( $styles ) { 60 global $pagenow; 61 62 if ( ! is_network_admin() && 'wp-login.php' != $pagenow ) { 63 return; 64 } 65 66 $targets = array( 'dashicons' ); 67 68 foreach ( $targets as $target ) { 69 if ( isset( $styles->registered[ $target ]->src ) ) { 70 $styles->registered[ $target ]->src = 'https://s.w.org' . $styles->registered[ $target ]->src; 71 } 72 } 73 } 74 add_action( 'wp_default_styles', 'load_select_core_styles_from_cdn' ); 75 76 /** 77 * Load certain stylesheets from the WordPress.org CDN instead of their local copies. 78 * 79 * See notes in load_select_core_styles_from_cdn() for details. 80 * 81 * @param string $hook 82 */ 83 function load_select_plugin_styles_from_cdn( $hook ) { 84 if ( ! is_network_admin() ) { 85 return; 86 } 87 88 global $wp_styles; 89 $targets = array( 'debug-bar' ); 90 91 foreach ( $targets as $target ) { 92 if ( isset( $wp_styles->registered[ $target ]->src ) ) { 93 $wp_styles->registered[ $target ]->src = str_replace( 'https://' . $_SERVER['HTTP_HOST'], 'https://s.w.org', $wp_styles->registered[ $target ]->src ); 94 } 95 } 96 97 } 98 add_action( 'admin_enqueue_scripts', 'load_select_plugin_styles_from_cdn' );
Note: See TracChangeset
for help on using the changeset viewer.