<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[33911] trunk/src: Add Customizer docs.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/33911">33911</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/33911","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>wonderboymusic</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-09-05 19:52:17 +0000 (Sat, 05 Sep 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Add Customizer docs.
Props ericlewis.
See <a href="https://core.trac.wordpress.org/ticket/33503">#33503</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjscustomizecontrolsjs">trunk/src/wp-admin/js/customize-controls.js</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizesettingphp">trunk/src/wp-includes/class-wp-customize-setting.php</a></li>
<li><a href="#trunksrcwpincludesjscustomizebasejs">trunk/src/wp-includes/js/customize-base.js</a></li>
<li><a href="#trunksrcwpincludesjscustomizeloaderjs">trunk/src/wp-includes/js/customize-loader.js</a></li>
<li><a href="#trunksrcwpincludesjscustomizepreviewjs">trunk/src/wp-includes/js/customize-preview.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjscustomizecontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/customize-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/customize-controls.js 2015-09-05 19:49:53 UTC (rev 33910)
+++ trunk/src/wp-admin/js/customize-controls.js 2015-09-05 19:52:17 UTC (rev 33911)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,13 +3,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var Container, focus, api = wp.customize;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * A Customizer Setting.
+ *
+ * A setting is WordPress data (theme mod, option, menu, etc.) that the user can
+ * draft changes to in the Customizer.
+ *
+ * @see PHP class WP_Customize_Setting.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @class
</span><span class="cx" style="display: block; padding: 0 10px"> * @augments wp.customize.Value
</span><span class="cx" style="display: block; padding: 0 10px"> * @augments wp.customize.Class
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param options
- * - previewer - The Previewer instance to sync with.
- * - transport - The transport to use for previewing. Supports 'refresh' and 'postMessage'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {object} id The Setting ID.
+ * @param {object} value The initial value of the setting.
+ * @param {object} options.previewer The Previewer instance to sync with.
+ * @param {object} options.transport The transport to use for previewing. Supports 'refresh' and 'postMessage'.
+ * @param {object} options.dirty
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> api.Setting = api.Value.extend({
</span><span class="cx" style="display: block; padding: 0 10px"> initialize: function( id, value, options ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,8 +28,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.transport = this.transport || 'refresh';
</span><span class="cx" style="display: block; padding: 0 10px"> this._dirty = options.dirty || false;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Whenever the setting's value changes, refresh the preview.
</ins><span class="cx" style="display: block; padding: 0 10px"> this.bind( this.preview );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Refresh the preview, respective of the setting's refresh policy.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> preview: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( this.transport ) {
</span><span class="cx" style="display: block; padding: 0 10px"> case 'refresh':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -270,10 +284,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Handle changes to the active state.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Active state change handler.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This does not change the active state, it merely handles the behavior
- * for when it does change.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Shows the container if it is active, hides it if not.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * To override by subclass, update the container's UI to reflect the provided active state.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1347,14 +1360,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @class
</span><span class="cx" style="display: block; padding: 0 10px"> * @augments wp.customize.Class
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param {string} id Unique identifier for the control instance.
- * @param {object} options Options hash for the control instance.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {string} id Unique identifier for the control instance.
+ * @param {object} options Options hash for the control instance.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param {object} options.params
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.)
- * @param {string} options.params.content The HTML content for the control.
- * @param {string} options.params.priority Order of priority to show the control within the section.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.)
+ * @param {string} options.params.content The HTML content for the control.
+ * @param {string} options.params.priority Order of priority to show the control within the section.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param {string} options.params.active
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param {string} options.params.section
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {string} options.params.section The ID of the section the control belongs to.
+ * @param {string} options.params.settings.default The ID of the setting the control relates to.
+ * @param {string} options.params.settings.data
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param {string} options.params.label
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {string} options.params.description
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {string} options.params.instanceNumber Order in which this instance was created in relation to other instances.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1420,7 +1435,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> api.utils.bubbleChildValueChanges( control, [ 'section', 'priority', 'active' ] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Associate this control with its settings when they are created
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * After all settings related to the control are available,
+ * make them available on the control and embed the control into the page.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> settings = $.map( control.params.settings, function( value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return value;
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1437,6 +1455,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> control.embed();
</span><span class="cx" style="display: block; padding: 0 10px"> }) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // After the control is embedded on the page, invoke the "ready" method.
</ins><span class="cx" style="display: block; padding: 0 10px"> control.deferred.embedded.done( function () {
</span><span class="cx" style="display: block; padding: 0 10px"> control.ready();
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2573,6 +2592,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> api.panel = new api.Values({ defaultConstructor: api.Panel });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * An object that fetches a preview in the background of the document, which
+ * allows for seamless replacement of an existing preview.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @class
</span><span class="cx" style="display: block; padding: 0 10px"> * @augments wp.customize.Messenger
</span><span class="cx" style="display: block; padding: 0 10px"> * @augments wp.customize.Class
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2581,10 +2603,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> api.PreviewFrame = api.Messenger.extend({
</span><span class="cx" style="display: block; padding: 0 10px"> sensitivity: 2000,
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Initialize the PreviewFrame.
+ *
+ * @param {object} params.container
+ * @param {object} params.signature
+ * @param {object} params.previewUrl
+ * @param {object} params.query
+ * @param {object} options
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> initialize: function( params, options ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var deferred = $.Deferred();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // This is the promise object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * Make the instance of the PreviewFrame the promise object
+ * so other objects can easily interact with it.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> deferred.promise( this );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.container = params.container;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2601,6 +2635,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.run( deferred );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Run the preview request.
+ *
+ * @param {object} deferred jQuery Deferred object to be resolved with
+ * the request.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> run: function( deferred ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var self = this,
</span><span class="cx" style="display: block; padding: 0 10px"> loaded = false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2804,9 +2844,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> refreshBuffer: 250,
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Requires params:
- * - container - a selector or jQuery element
- * - previewUrl - the URL of preview frame
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {array} params.allowedUrls
+ * @param {string} params.container A selector or jQuery element for the preview
+ * frame to be placed.
+ * @param {string} params.form
+ * @param {string} params.previewUrl The URL to preview.
+ * @param {string} params.signature
+ * @param {object} options
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> initialize: function( params, options ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var self = this,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2919,6 +2963,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Query string data sent with each preview request.
+ *
+ * @abstract
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> query: function() {},
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> abort: function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2928,6 +2977,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Refresh the preview.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> refresh: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var self = this;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3140,6 +3192,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> nonce: api.settings.nonce,
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Build the query to send along with the Preview request.
+ *
+ * @return {object}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> query: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var dirtyCustomized = {};
</span><span class="cx" style="display: block; padding: 0 10px"> api.each( function ( value, key ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3467,14 +3524,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Create a potential postMessage connection with the parent frame.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * Create a postMessage connection with a parent frame,
+ * in case the Customizer frame was opened with the Customize loader.
+ *
+ * @see wp.customize.Loader
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> parent = new api.Messenger({
</span><span class="cx" style="display: block; padding: 0 10px"> url: api.settings.url.parent,
</span><span class="cx" style="display: block; padding: 0 10px"> channel: 'loader'
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If we receive a 'back' event, we're inside an iframe.
- // Send any clicks to the 'Return' link to the parent page.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * If we receive a 'back' event, we're inside an iframe.
+ * Send any clicks to the 'Return' link to the parent page.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> parent.bind( 'back', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> closeBtn.on( 'click.customize-controls-close', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> event.preventDefault();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3499,8 +3563,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // When activated, let the loader handle redirecting the page.
- // If no loader exists, redirect the page ourselves (if a url exists).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * When activated, let the loader handle redirecting the page.
+ * If no loader exists, redirect the page ourselves (if a url exists).
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> api.bind( 'activated', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( parent.targetWindow() )
</span><span class="cx" style="display: block; padding: 0 10px"> parent.send( 'activated', api.settings.url.activated );
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizesettingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-customize-setting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-customize-setting.php 2015-09-05 19:49:53 UTC (rev 33910)
+++ trunk/src/wp-includes/class-wp-customize-setting.php 2015-09-05 19:52:17 UTC (rev 33911)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,6 +24,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $manager;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Unique string identifier for the setting.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,6 +76,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public $dirty = false;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @var array
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> protected $id_data = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,7 +153,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $_original_value;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Handle previewing the setting.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Set up filters for the setting so that the preview request
+ * will render the drafted changes.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="trunksrcwpincludesjscustomizebasejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/customize-base.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/customize-base.js 2015-09-05 19:49:53 UTC (rev 33910)
+++ trunk/src/wp-includes/js/customize-base.js 2015-09-05 19:52:17 UTC (rev 33911)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,7 +78,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * If the class has a method called "instance",
</span><span class="cx" style="display: block; padding: 0 10px"> * the return value from the class' constructor will be a function that
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * calls invoked, along with all the object properties of the class.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * calls the "instance" method.
+ *
+ * It is also an object that has properties and methods inside it.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( this.instance ) {
</span><span class="cx" style="display: block; padding: 0 10px"> magic = function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -166,6 +168,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @constuctor
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> api.Value = api.Class.extend({
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @param {mixed} initial The initial value.
+ * @param {object} options
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> initialize: function( initial, options ) {
</span><span class="cx" style="display: block; padding: 0 10px"> this._value = initial; // @todo: potentially change this to a this.set() call.
</span><span class="cx" style="display: block; padding: 0 10px"> this.callbacks = $.Callbacks();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -184,10 +190,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return arguments.length ? this.set.apply( this, arguments ) : this.get();
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Get the value.
+ *
+ * @return {mixed}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> get: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> return this._value;
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Set the value and trigger all bound callbacks.
+ *
+ * @param {object} to New value.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> set: function( to ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var from = this._value;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,11 +246,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return value;
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Bind a function to be invoked whenever the value changes.
+ *
+ * @param {...Function} A function, or multiple functions, to add to the callback stack.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> bind: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.callbacks.add.apply( this.callbacks, arguments );
</span><span class="cx" style="display: block; padding: 0 10px"> return this;
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Unbind a previously bound function.
+ *
+ * @param {...Function} A function, or multiple functions, to remove from the callback stack.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> unbind: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.callbacks.remove.apply( this.callbacks, arguments );
</span><span class="cx" style="display: block; padding: 0 10px"> return this;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -283,6 +309,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @mixes wp.customize.Events
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> api.Values = api.Class.extend({
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * The default constructor for items of the collection.
+ *
+ * @type {object}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> defaultConstructor: api.Value,
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> initialize: function( options ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -347,6 +379,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this._value[ id ] = value;
</span><span class="cx" style="display: block; padding: 0 10px"> value.parent = this;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Propagate a 'change' event on an item up to the collection.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( value.extended( api.Value ) )
</span><span class="cx" style="display: block; padding: 0 10px"> value.bind( this._change );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -372,6 +406,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Iterate over all items in the collection invoking the provided callback.
+ *
+ * @param {Function} callback Function to invoke.
+ * @param {object} context Object context to invoke the function with. Optional.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> each: function( callback, context ) {
</span><span class="cx" style="display: block; padding: 0 10px"> context = typeof context === 'undefined' ? this : context;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -453,11 +493,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return dfd.promise();
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * A helper function to propagate a 'change' event from an item
+ * to the collection itself.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> _change: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.parent.trigger( 'change', this );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Create a global events bus on the Customizer.
</ins><span class="cx" style="display: block; padding: 0 10px"> $.extend( api.Values.prototype, api.Events );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -570,7 +615,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $.support.postMessage = !! window.postMessage;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Messenger for postMessage.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * A communicator for sending data from one window to another over postMessage.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @constuctor
</span><span class="cx" style="display: block; padding: 0 10px"> * @augments wp.customize.Class
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -649,6 +694,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $( window ).off( 'message', this.receive );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Receive data from the other window.
+ *
+ * @param {jQuery.Event} event Event with embedded data.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> receive: function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var message;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -679,6 +729,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.trigger( message.id, message.data );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Send data to the other window.
+ *
+ * @param {string} id The event name.
+ * @param {object} data Data.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> send: function( id, data ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var message;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -698,8 +754,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Add the Events mixin to api.Messenger.
</span><span class="cx" style="display: block; padding: 0 10px"> $.extend( api.Messenger.prototype, api.Events );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Core customize object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The main API object is also a collection of all customizer settings.
</ins><span class="cx" style="display: block; padding: 0 10px"> api = $.extend( new api.Values(), api );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Get all customize settings.
+ *
+ * @return {object}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> api.get = function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var result = {};
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesjscustomizeloaderjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/customize-loader.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/customize-loader.js 2015-09-05 19:49:53 UTC (rev 33910)
+++ trunk/src/wp-includes/js/customize-loader.js 2015-09-05 19:52:17 UTC (rev 33911)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -115,7 +115,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.active = true;
</span><span class="cx" style="display: block; padding: 0 10px"> this.body.addClass('customize-loading');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Dirty state of Customizer in iframe
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * Track the dirtiness state (whether the drafted changes have been published)
+ * of the Customizer in the iframe. This is used to decide whether to display
+ * an AYS alert if the user tries to close the window before saving changes.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> this.saved = new api.Value( true );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.iframe = $( '<iframe />', { 'src': src, 'title': Loader.settings.l10n.mainIframeTitle } ).appendTo( this.element );
</span></span></pre></div>
<a id="trunksrcwpincludesjscustomizepreviewjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/customize-preview.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/customize-preview.js 2015-09-05 19:49:53 UTC (rev 33910)
+++ trunk/src/wp-includes/js/customize-preview.js 2015-09-05 19:52:17 UTC (rev 33911)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -111,6 +111,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> api.preview.send( 'documentTitle', document.title );
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * Send a message to the parent customize frame with a list of which
+ * containers and controls are active.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> api.preview.send( 'ready', {
</span><span class="cx" style="display: block; padding: 0 10px"> activePanels: api.settings.activePanels,
</span><span class="cx" style="display: block; padding: 0 10px"> activeSections: api.settings.activeSections,
</span></span></pre>
</div>
</div>
</body>
</html>