Changeset 20886
- Timestamp:
- 05/24/2012 09:13:21 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/customize.php
r20882 r20886 108 108 $admin_origin = parse_url( admin_url() ); 109 109 $home_origin = parse_url( home_url() ); 110 $cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) ); 110 111 111 if ( is_ssl() && ( $admin_origin[ 'host' ] == $home_origin[ 'host' ] ))112 if ( is_ssl() && ! $cross_domain ) 112 113 $allowed_urls[] = home_url( '/', 'https' ); 113 114 114 115 $allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) ); 116 117 $fallback_url = add_query_arg( array( 118 'preview' => 1, 119 'template' => $wp_customize->get_template(), 120 'stylesheet' => $wp_customize->get_stylesheet(), 121 'preview_iframe' => true, 122 'TB_iframe' => 'true' 123 ), home_url( '/' ) ); 115 124 116 125 $settings = array( … … 120 129 ), 121 130 'url' => array( 122 'preview' => esc_url( home_url( '/' ) ), 123 'parent' => esc_url( admin_url() ), 124 'ajax' => esc_url( admin_url( 'admin-ajax.php', 'relative' ) ), 125 'allowed' => array_map( 'esc_url', $allowed_urls ), 131 'preview' => esc_url( home_url( '/' ) ), 132 'parent' => esc_url( admin_url() ), 133 'ajax' => esc_url( admin_url( 'admin-ajax.php', 'relative' ) ), 134 'allowed' => array_map( 'esc_url', $allowed_urls ), 135 'isCrossDomain' => $cross_domain, 136 'fallback' => $fallback_url, 126 137 ), 127 138 'settings' => array(), -
trunk/wp-includes/js/customize-base.dev.js
r20801 r20886 475 475 * ===================================================================== */ 476 476 477 $.support.postMessage = !! window.postMessage; 478 477 479 api.Messenger = api.Class.extend({ 478 480 add: function( key, initial, options ) { -
trunk/wp-includes/js/customize-controls.dev.js
r20882 r20886 442 442 if ( ! api.settings ) 443 443 return; 444 445 if ( ! $.support.postMessage || ( ! $.support.cors && api.settings.isCrossDomain ) ) 446 return window.location = api.settings.url.fallback; 444 447 445 448 // Initialize Previewer -
trunk/wp-includes/js/customize-loader.dev.js
r20864 r20886 6 6 Loader; 7 7 8 $.extend( $.support, { 9 history: !! ( window.history && history.pushState ), 10 hashchange: ('onhashchange' in window) && (document.documentMode === undefined || document.documentMode > 7) 11 }); 12 8 13 Loader = $.extend( {}, api.Events, { 9 supports: { 10 history: !! ( window.history && history.pushState ), 11 hashchange: ('onhashchange' in window) && (document.documentMode === undefined || document.documentMode > 7) 12 }, 14 initialize: function() { 15 this.body = $( document.body ); 13 16 14 initialize: function() { 15 this.body = $( document.body ).addClass('customize-support'); 17 // Ensure the loader is supported. 18 // Check for settings, postMessage support, and whether we require CORS support. 19 if ( ! Loader.settings || ! $.support.postMessage || ( ! $.support.cors && Loader.settings.isCrossDomain ) ) { 20 this.body.removeClass( 'customize-support' ).addClass( 'no-customize-support' ); 21 return; 22 } 23 24 this.body.removeClass( 'no-customize-support' ).addClass( 'customize-support' ); 25 16 26 this.window = $( window ); 17 27 this.element = $( '<div id="customize-container" class="wp-full-overlay" />' ).appendTo( this.body ); … … 28 38 29 39 // Add navigation listeners. 30 if ( this.supports.history )40 if ( $.support.history ) 31 41 this.window.on( 'popstate', Loader.popstate ); 32 42 33 if ( this.supports.hashchange )43 if ( $.support.hashchange ) 34 44 this.window.on( 'hashchange', Loader.hashchange ); 35 45 }, … … 49 59 Loader.open( wpCustomizeLoaderL10n.url + '?' + hash ); 50 60 51 if ( ! hash && ! Loader.supports.history )61 if ( ! hash && ! $.support.history ) 52 62 Loader.close(); 53 63 }, … … 74 84 75 85 this.messenger.bind( 'close', function() { 76 if ( Loader.supports.history )86 if ( $.support.history ) 77 87 history.back(); 78 else if ( Loader.supports.hashchange )88 else if ( $.support.hashchange ) 79 89 window.location.hash = ''; 80 90 else … … 85 95 86 96 // Ensure we don't call pushState if the user hit the forward button. 87 if ( Loader.supports.history && window.location.href !== src )97 if ( $.support.history && window.location.href !== src ) 88 98 history.pushState( { customize: src }, '', src ); 89 else if ( ! Loader.supports.history && Loader.supports.hashchange && hash )99 else if ( ! $.support.history && $.support.hashchange && hash ) 90 100 window.location.hash = hash; 91 101 … … 129 139 130 140 $( function() { 131 if ( window.postMessage )132 141 Loader.settings = _wpCustomizeLoaderSettings; 142 Loader.initialize(); 133 143 }); 134 144 -
trunk/wp-includes/theme.php
r20864 r20886 1585 1585 1586 1586 /** 1587 * Localizesthe customize-loader script.1587 * Adds settings for the customize-loader script. 1588 1588 * 1589 1589 * @since 3.4.0 1590 1590 */ 1591 function _wp_customize_loader_localize() { 1592 wp_localize_script( 'customize-loader', 'wpCustomizeLoaderL10n', array( 1593 'url' => admin_url( 'admin.php' ), 1594 ) ); 1595 } 1596 add_action( 'admin_enqueue_scripts', '_wp_customize_loader_localize' ); 1591 function _wp_customize_loader_settings() { 1592 global $wp_scripts; 1593 1594 $admin_origin = parse_url( admin_url() ); 1595 $home_origin = parse_url( home_url() ); 1596 $cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) ); 1597 1598 $settings = array( 1599 'url' => esc_url( admin_url( 'admin.php' ) ), 1600 'isCrossDomain' => $cross_domain, 1601 ); 1602 1603 $script = 'var _wpCustomizeLoaderSettings = ' . json_encode( $settings ) . ';'; 1604 1605 $data = $wp_scripts->get_data( 'customize-loader', 'data' ); 1606 if ( $data ) 1607 $script = "$data\n$script"; 1608 1609 $wp_scripts->add_data( 'customize-loader', 'data', $script ); 1610 } 1611 add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' ); 1597 1612 1598 1613 /**
Note: See TracChangeset
for help on using the changeset viewer.