Customizer: Export `nonce`, `theme`, and `url` app settings in preview as exported in pane.

* Introduce `WP_Customize_Manager::get_nonces()` to consolidate logic for retrieving nonces.
* Export nonces centrally in `wp.customize.settings.nonce` with each request and update nav menus preview to utilize.
* Send updated nonces to preview upon `nonce-refresh`.
* Request full preview refresh if Nav Menu selective refresh request fails (e.g. due to bad nonce).
* Update nav menus and widgets in Customizer to utilize `customize_refresh_nonces` for exporting nonces and keeping them up to date.

See #27355.
Fixes #35617.

Built from https://develop.svn.wordpress.org/trunk@36414


git-svn-id: http://core.svn.wordpress.org/trunk@36381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-01-27 17:55:26 +00:00
parent e8cc1b5a32
commit c376477265
14 changed files with 73 additions and 61 deletions

View File

@ -3375,6 +3375,7 @@
api.bind( 'nonce-refresh', function( nonce ) {
$.extend( api.settings.nonce, nonce );
$.extend( api.previewer.nonce, nonce );
api.previewer.send( 'nonce-refresh', nonce );
});
// Create Settings

File diff suppressed because one or more lines are too long

View File

@ -323,7 +323,7 @@
availableMenuItemContainer.find( '.accordion-section-title' ).addClass( 'loading' );
self.loading = true;
params = {
'customize-menus-nonce': api.Menus.data.nonce,
'customize-menus-nonce': api.settings.nonce['customize-menus'],
'wp_customize': 'on',
'type': type,
'object': object,

File diff suppressed because one or more lines are too long

View File

@ -1107,7 +1107,7 @@
params = {};
params.action = 'update-widget';
params.wp_customize = 'on';
params.nonce = api.Widgets.data.nonce;
params.nonce = api.settings.nonce['update-widget'];
params.theme = api.settings.theme.stylesheet;
params.customized = wp.customize.previewer.query().customized;
@ -2058,11 +2058,6 @@
sidebar_widgets: api.Widgets.SidebarControl
});
// Refresh the nonce if login sends updated nonces over.
api.bind( 'nonce-refresh', function( nonces ) {
api.Widgets.data.nonce = nonces['update-widget'];
});
/**
* Init Customizer for widgets.
*/

File diff suppressed because one or more lines are too long

View File

@ -801,20 +801,21 @@ final class WP_Customize_Manager {
*/
public function customize_preview_settings() {
$settings = array(
'theme' => array(
'stylesheet' => $this->get_stylesheet(),
'active' => $this->is_theme_active(),
),
'url' => array(
'self' => empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
),
'channel' => wp_unslash( $_POST['customize_messenger_channel'] ),
'activePanels' => array(),
'activeSections' => array(),
'activeControls' => array(),
'nonce' => $this->get_nonces(),
'_dirty' => array_keys( $this->unsanitized_post_values() ),
);
if ( 2 == $this->nonce_tick ) {
$settings['nonce'] = array(
'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() )
);
}
foreach ( $this->panels as $panel_id => $panel ) {
if ( $panel->check_capabilities() ) {
$settings['activePanels'][ $panel_id ] = $panel->active();
@ -1025,22 +1026,7 @@ final class WP_Customize_Manager {
wp_send_json_error( 'not_preview' );
}
$nonces = array(
'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
);
/**
* Filter nonces for a customize_refresh_nonces AJAX request.
*
* @since 4.2.0
*
* @param array $nonces Array of refreshed nonces for save and
* preview actions.
* @param WP_Customize_Manager $this WP_Customize_Manager instance.
*/
$nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this );
wp_send_json_success( $nonces );
wp_send_json_success( $this->get_nonces() );
}
/**
@ -1635,6 +1621,32 @@ final class WP_Customize_Manager {
return $this->autofocus;
}
/**
* Get nonces for the Customizer.
*
* @since 4.5.0
* @return array Nonces.
*/
public function get_nonces() {
$nonces = array(
'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
);
/**
* Filter nonces for Customizer.
*
* @since 4.2.0
*
* @param array $nonces Array of refreshed nonces for save and
* preview actions.
* @param WP_Customize_Manager $this WP_Customize_Manager instance.
*/
$nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this );
return $nonces;
}
/**
* Print JavaScript settings for parent window.
*
@ -1695,10 +1707,7 @@ final class WP_Customize_Manager {
),
'panels' => array(),
'sections' => array(),
'nonce' => array(
'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
),
'nonce' => $this->get_nonces(),
'autofocus' => array(),
'documentTitleTmpl' => $this->get_document_title_template(),
);

View File

@ -48,6 +48,7 @@ final class WP_Customize_Nav_Menus {
$this->previewed_menus = array();
$this->manager = $manager;
add_filter( 'customize_refresh_nonces', array( $this, 'filter_nonces' ) );
add_action( 'wp_ajax_load-available-menu-items-customizer', array( $this, 'ajax_load_available_items' ) );
add_action( 'wp_ajax_search-available-menu-items-customizer', array( $this, 'ajax_search_available_items' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@ -62,6 +63,20 @@ final class WP_Customize_Nav_Menus {
add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) );
}
/**
* Add nonce for customizing menus.
*
* @since 4.5.0
* @access public
*
* @param array $nonces Array of nonces.
* @return array $nonces Array of nonces.
*/
public function filter_nonces( $nonces ) {
$nonces['customize-menus'] = wp_create_nonce( 'customize-menus' );
return $nonces;
}
/**
* Ajax handler for loading available menu items.
*
@ -329,7 +344,6 @@ final class WP_Customize_Nav_Menus {
// Pass data to JS.
$settings = array(
'nonce' => wp_create_nonce( 'customize-menus' ),
'allMenus' => wp_get_nav_menus(),
'itemTypes' => $this->available_item_types(),
'l10n' => array(
@ -939,12 +953,6 @@ final class WP_Customize_Nav_Menus {
'renderQueryVar' => self::RENDER_QUERY_VAR,
'renderNonceValue' => wp_create_nonce( self::RENDER_AJAX_ACTION ),
'renderNoncePostKey' => self::RENDER_NONCE_POST_KEY,
'requestUri' => empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
'theme' => array(
'stylesheet' => $this->manager->get_stylesheet(),
'active' => $this->manager->is_theme_active(),
),
'previewCustomizeNonce' => wp_create_nonce( 'preview-customize_' . $this->manager->get_stylesheet() ),
'navMenuInstanceArgs' => $this->preview_nav_menu_instance_args,
'l10n' => array(
'editNavMenuItemTooltip' => __( 'Shift-click to edit this menu item.' ),

View File

@ -661,7 +661,6 @@ final class WP_Customize_Widgets {
);
$settings = array(
'nonce' => wp_create_nonce( 'update-widget' ),
'registeredSidebars' => array_values( $wp_registered_sidebars ),
'registeredWidgets' => $wp_registered_widgets,
'availableWidgets' => $available_widgets, // @todo Merge this with registered_widgets

View File

@ -13,12 +13,7 @@
renderQueryVar: null,
renderNonceValue: null,
renderNoncePostKey: null,
previewCustomizeNonce: null,
requestUri: '/',
theme: {
active: false,
stylesheet: ''
},
navMenuInstanceArgs: {},
l10n: {}
};
@ -200,11 +195,11 @@
menuId = parseInt( menuId, 10 );
data = {
nonce: settings.previewCustomizeNonce, // for Customize Preview
nonce: wp.customize.settings.nonce.preview,
wp_customize: 'on'
};
if ( ! settings.theme.active ) {
data.theme = settings.theme.stylesheet;
if ( ! wp.customize.settings.theme.active ) {
data.theme = wp.customize.settings.theme.stylesheet;
}
data[ settings.renderQueryVar ] = '1';
@ -239,7 +234,7 @@
request = wp.ajax.send( null, {
data: data,
url: settings.requestUri
url: api.settings.url.self
} );
request.done( function( data ) {
// If the menu is now not visible, refresh since the page layout may have changed.
@ -263,6 +258,9 @@
container.removeClass( 'customize-partial-refreshing' );
$( document ).trigger( 'customize-preview-menu-refreshed', [ eventParam ] );
} );
request.fail( function() {
api.preview.send( 'refresh' );
} );
},
refreshMenuInstanceDebounced : function( instanceNumber ) {

View File

@ -1 +1 @@
!function(a,b,c){"use strict";if(c&&c.customize){var d=c.customize,e={},f=200,g={},h={renderQueryVar:null,renderNonceValue:null,renderNoncePostKey:null,previewCustomizeNonce:null,requestUri:"/",theme:{active:!1,stylesheet:""},navMenuInstanceArgs:{},l10n:{}};d.MenusCustomizerPreview={init:function(){var a=this,c={};g=b.extend({},h),"undefined"!=typeof _wpCustomizePreviewNavMenusExports&&b.extend(g,_wpCustomizePreviewNavMenusExports),d.each(function(b,d){b.id=d,c[b.id]=!0,a.bindListener(b)}),d.preview.bind("setting",function(b){var e,f,g;b=b.slice(),e=b.shift(),f=b.shift(),g=d(e),g||(g=d.create(e,f)),g.id||(g.id=e),c[g.id]||(c[g.id]=!0,a.bindListener(g)&&g.callbacks.fireWith(g,[g(),null]))}),a.highlightControls()},bindListener:function(a){var c,d;return(c=a.id.match(/^nav_menu\[(-?\d+)]$/))?(a.navMenuId=parseInt(c[1],10),a.bind(this.onChangeNavMenuSetting),!0):(c=a.id.match(/^nav_menu_item\[(-?\d+)]$/))?(a.navMenuItemId=parseInt(c[1],10),a.bind(this.onChangeNavMenuItemSetting),!0):(c=a.id.match(/^nav_menu_locations\[(.+?)]/),c?(d=c[1],a.bind(b.bind(function(){this.refreshMenuLocation(d)},this)),!0):!1)},onChangeNavMenuSetting:function(){var a=this;if(!a.navMenuId)throw new Error("Expected navMenuId property to be set.");d.MenusCustomizerPreview.refreshMenu(a.navMenuId)},onChangeNavMenuItemSetting:function(a,b){!b||!b.nav_menu_term_id||a&&b.nav_menu_term_id===a.nav_menu_term_id||d.MenusCustomizerPreview.refreshMenu(b.nav_menu_term_id),a&&a.nav_menu_term_id&&d.MenusCustomizerPreview.refreshMenu(a.nav_menu_term_id)},refreshMenu:function(a){var c=[];d.each(function(b,d){var e=d.match(/^nav_menu_locations\[(.+?)]/);e&&a===b()&&c.push(e[1])}),b.each(g.navMenuInstanceArgs,function(d,e){(a===d.menu||-1!==b.indexOf(c,d.theme_location))&&this.refreshMenuInstanceDebounced(e)},this)},refreshMenuLocation:function(a){var c=!1;b.each(g.navMenuInstanceArgs,function(b,d){a===b.theme_location&&(this.refreshMenuInstanceDebounced(d),c=!0)},this),c||d.preview.send("refresh")},refreshMenuInstance:function(e){var f,h,i,j,k,l,m,n;if(!g.navMenuInstanceArgs[e])throw new Error("unknown_instance_number");return m=g.navMenuInstanceArgs[e],n="partial-refreshable-nav-menu-"+String(e),j=a("."+n),b.isNumber(m.menu)?h=m.menu:m.theme_location&&d.has("nav_menu_locations["+m.theme_location+"]")&&(h=d("nav_menu_locations["+m.theme_location+"]").get()),h&&m.can_partial_refresh&&0!==j.length?(h=parseInt(h,10),f={nonce:g.previewCustomizeNonce,wp_customize:"on"},g.theme.active||(f.theme=g.theme.stylesheet),f[g.renderQueryVar]="1",i={},d.each(function(a,b){var c=a.get(),d=!1;d=d||/^nav_menu_locations\[/.test(b),d=d||b==="nav_menu["+String(h)+"]",d=d||/^nav_menu_item\[/.test(b)&&(!1===c||h===c.nav_menu_term_id),d&&(i[b]=c)}),f.customized=JSON.stringify(i),f[g.renderNoncePostKey]=g.renderNonceValue,l=a.extend({},m),f.wp_nav_menu_args_hash=l.args_hash,delete l.args_hash,f.wp_nav_menu_args=JSON.stringify(l),j.addClass("customize-partial-refreshing"),k=c.ajax.send(null,{data:f,url:g.requestUri}),void k.done(function(b){if(!1===b)return void d.preview.send("refresh");var c,f=j;j=a(b),j.addClass(n),j.addClass("partial-refreshable-nav-menu customize-partial-refreshing"),f.replaceWith(j),c={instanceNumber:e,wpNavArgs:l,wpNavMenuArgs:l,oldContainer:f,newContainer:j},j.removeClass("customize-partial-refreshing"),a(document).trigger("customize-preview-menu-refreshed",[c])})):void d.preview.send("refresh")},refreshMenuInstanceDebounced:function(a){e[a]&&clearTimeout(e[a]),e[a]=setTimeout(b.bind(function(){this.refreshMenuInstance(a)},this),f)},highlightControls:function(){var b,c=".menu-item[id^=menu-item-]";a(document).on("click",c,function(b){var c;b.shiftKey&&(c=a(this).attr("id").match(/^menu-item-(\d+)$/),c&&(b.preventDefault(),b.stopPropagation(),d.preview.send("focus-nav-menu-item-control",parseInt(c[1],10))))}),b=function(a,b){b.newContainer.find(c).attr("title",g.l10n.editNavMenuItemTooltip)},b(null,{newContainer:a(document.body)}),a(document).on("customize-preview-menu-refreshed",b)}},d.bind("preview-ready",function(){d.preview.bind("active",function(){d.MenusCustomizerPreview.init()})})}}(jQuery,_,wp);
!function(a,b,c){"use strict";if(c&&c.customize){var d=c.customize,e={},f=200,g={},h={renderQueryVar:null,renderNonceValue:null,renderNoncePostKey:null,requestUri:"/",navMenuInstanceArgs:{},l10n:{}};d.MenusCustomizerPreview={init:function(){var a=this,c={};g=b.extend({},h),"undefined"!=typeof _wpCustomizePreviewNavMenusExports&&b.extend(g,_wpCustomizePreviewNavMenusExports),d.each(function(b,d){b.id=d,c[b.id]=!0,a.bindListener(b)}),d.preview.bind("setting",function(b){var e,f,g;b=b.slice(),e=b.shift(),f=b.shift(),g=d(e),g||(g=d.create(e,f)),g.id||(g.id=e),c[g.id]||(c[g.id]=!0,a.bindListener(g)&&g.callbacks.fireWith(g,[g(),null]))}),a.highlightControls()},bindListener:function(a){var c,d;return(c=a.id.match(/^nav_menu\[(-?\d+)]$/))?(a.navMenuId=parseInt(c[1],10),a.bind(this.onChangeNavMenuSetting),!0):(c=a.id.match(/^nav_menu_item\[(-?\d+)]$/))?(a.navMenuItemId=parseInt(c[1],10),a.bind(this.onChangeNavMenuItemSetting),!0):(c=a.id.match(/^nav_menu_locations\[(.+?)]/),c?(d=c[1],a.bind(b.bind(function(){this.refreshMenuLocation(d)},this)),!0):!1)},onChangeNavMenuSetting:function(){var a=this;if(!a.navMenuId)throw new Error("Expected navMenuId property to be set.");d.MenusCustomizerPreview.refreshMenu(a.navMenuId)},onChangeNavMenuItemSetting:function(a,b){!b||!b.nav_menu_term_id||a&&b.nav_menu_term_id===a.nav_menu_term_id||d.MenusCustomizerPreview.refreshMenu(b.nav_menu_term_id),a&&a.nav_menu_term_id&&d.MenusCustomizerPreview.refreshMenu(a.nav_menu_term_id)},refreshMenu:function(a){var c=[];d.each(function(b,d){var e=d.match(/^nav_menu_locations\[(.+?)]/);e&&a===b()&&c.push(e[1])}),b.each(g.navMenuInstanceArgs,function(d,e){(a===d.menu||-1!==b.indexOf(c,d.theme_location))&&this.refreshMenuInstanceDebounced(e)},this)},refreshMenuLocation:function(a){var c=!1;b.each(g.navMenuInstanceArgs,function(b,d){a===b.theme_location&&(this.refreshMenuInstanceDebounced(d),c=!0)},this),c||d.preview.send("refresh")},refreshMenuInstance:function(e){var f,h,i,j,k,l,m,n;if(!g.navMenuInstanceArgs[e])throw new Error("unknown_instance_number");return m=g.navMenuInstanceArgs[e],n="partial-refreshable-nav-menu-"+String(e),j=a("."+n),b.isNumber(m.menu)?h=m.menu:m.theme_location&&d.has("nav_menu_locations["+m.theme_location+"]")&&(h=d("nav_menu_locations["+m.theme_location+"]").get()),h&&m.can_partial_refresh&&0!==j.length?(h=parseInt(h,10),f={nonce:c.customize.settings.nonce.preview,wp_customize:"on"},c.customize.settings.theme.active||(f.theme=c.customize.settings.theme.stylesheet),f[g.renderQueryVar]="1",i={},d.each(function(a,b){var c=a.get(),d=!1;d=d||/^nav_menu_locations\[/.test(b),d=d||b==="nav_menu["+String(h)+"]",d=d||/^nav_menu_item\[/.test(b)&&(!1===c||h===c.nav_menu_term_id),d&&(i[b]=c)}),f.customized=JSON.stringify(i),f[g.renderNoncePostKey]=g.renderNonceValue,l=a.extend({},m),f.wp_nav_menu_args_hash=l.args_hash,delete l.args_hash,f.wp_nav_menu_args=JSON.stringify(l),j.addClass("customize-partial-refreshing"),k=c.ajax.send(null,{data:f,url:d.settings.url.self}),k.done(function(b){if(!1===b)return void d.preview.send("refresh");var c,f=j;j=a(b),j.addClass(n),j.addClass("partial-refreshable-nav-menu customize-partial-refreshing"),f.replaceWith(j),c={instanceNumber:e,wpNavArgs:l,wpNavMenuArgs:l,oldContainer:f,newContainer:j},j.removeClass("customize-partial-refreshing"),a(document).trigger("customize-preview-menu-refreshed",[c])}),void k.fail(function(){d.preview.send("refresh")})):void d.preview.send("refresh")},refreshMenuInstanceDebounced:function(a){e[a]&&clearTimeout(e[a]),e[a]=setTimeout(b.bind(function(){this.refreshMenuInstance(a)},this),f)},highlightControls:function(){var b,c=".menu-item[id^=menu-item-]";a(document).on("click",c,function(b){var c;b.shiftKey&&(c=a(this).attr("id").match(/^menu-item-(\d+)$/),c&&(b.preventDefault(),b.stopPropagation(),d.preview.send("focus-nav-menu-item-control",parseInt(c[1],10))))}),b=function(a,b){b.newContainer.find(c).attr("title",g.l10n.editNavMenuItemTooltip)},b(null,{newContainer:a(document.body)}),a(document).on("customize-preview-menu-refreshed",b)}},d.bind("preview-ready",function(){d.preview.bind("active",function(){d.MenusCustomizerPreview.init()})})}}(jQuery,_,wp);

View File

@ -146,9 +146,7 @@
});
api.preview.bind( 'active', function() {
if ( api.settings.nonce ) {
api.preview.send( 'nonce', api.settings.nonce );
}
api.preview.send( 'nonce', api.settings.nonce );
api.preview.send( 'documentTitle', document.title );
});
@ -163,6 +161,10 @@
} );
} );
api.preview.bind( 'nonce-refresh', function( nonce ) {
$.extend( api.settings.nonce, nonce );
} );
/*
* Send a message to the parent customize frame with a list of which
* containers and controls are active.

View File

@ -1 +1 @@
!function(a,b){var c,d=wp.customize;c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this;d.Messenger.prototype.initialize.call(this,a,e),this.body=b(document.body),this.body.on("click.preview","a",function(a){var c,d;c=b(this),d="#"===c.attr("href").substr(0,1),a.preventDefault(),d&&"#"!==c.attr("href")&&b(c.attr("href")).each(function(){this.scrollIntoView()}),a.shiftKey||d||(f.send("scroll",0),f.send("url",c.prop("href")))}),this.body.on("submit.preview","form",function(a){a.preventDefault()}),this.window=b(window),this.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),this.bind("scroll",function(a){f.window.scrollTop(a)})}}),b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.settings.nonce&&d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title)}),d.preview.bind("saved",function(a){d.trigger("saved",a)}),d.bind("saved",function(){d.each(function(a){a._dirty=!1})}),d.preview.send("ready",{activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls}),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","position_x","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(a,c,d,e,f){var g,h=b(document.body),i=b("head"),j=b("#custom-background-css");g=function(){var g="";h.toggleClass("custom-background",!(!a()&&!c())),a()&&(g+="background-color: "+a()+";"),c()&&(g+='background-image: url("'+c()+'");',g+="background-position: top "+d()+";",g+="background-repeat: "+e()+";",g+="background-attachment: "+f()+";"),j.remove(),j=b('<style type="text/css" id="custom-background-css">body.custom-background { '+g+" }</style>").appendTo(i)},b.each(arguments,function(){this.bind(g)})}),d.trigger("preview-ready"))})}(wp,jQuery);
!function(a,b){var c,d=wp.customize;c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this;d.Messenger.prototype.initialize.call(this,a,e),this.body=b(document.body),this.body.on("click.preview","a",function(a){var c,d;c=b(this),d="#"===c.attr("href").substr(0,1),a.preventDefault(),d&&"#"!==c.attr("href")&&b(c.attr("href")).each(function(){this.scrollIntoView()}),a.shiftKey||d||(f.send("scroll",0),f.send("url",c.prop("href")))}),this.body.on("submit.preview","form",function(a){a.preventDefault()}),this.window=b(window),this.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),this.bind("scroll",function(a){f.window.scrollTop(a)})}}),b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title)}),d.preview.bind("saved",function(a){d.trigger("saved",a)}),d.bind("saved",function(){d.each(function(a){a._dirty=!1})}),d.preview.bind("nonce-refresh",function(a){b.extend(d.settings.nonce,a)}),d.preview.send("ready",{activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls}),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","position_x","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(a,c,d,e,f){var g,h=b(document.body),i=b("head"),j=b("#custom-background-css");g=function(){var g="";h.toggleClass("custom-background",!(!a()&&!c())),a()&&(g+="background-color: "+a()+";"),c()&&(g+='background-image: url("'+c()+'");',g+="background-position: top "+d()+";",g+="background-repeat: "+e()+";",g+="background-attachment: "+f()+";"),j.remove(),j=b('<style type="text/css" id="custom-background-css">body.custom-background { '+g+" }</style>").appendTo(i)},b.each(arguments,function(){this.bind(g)})}),d.trigger("preview-ready"))})}(wp,jQuery);

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36413';
$wp_version = '4.5-alpha-36414';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.