Make WordPress Core

Ticket #38908: 38908.0.diff

File 38908.0.diff, 16.8 KB (added by westonruter, 10 years ago)
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 3de502e..438af2b 100644
     
    4545                 * previewer.send() call to then fallback to refresh will not work.
    4646                 *
    4747                 * @since 3.4.0
     48                 * @access public
     49                 *
     50                 * @returns {void}
    4851                 */
    4952                preview: function() {
    5053                        var setting = this, transport;
    … …  
    5558                        }
    5659
    5760                        if ( 'postMessage' === transport ) {
    58                                 return setting.previewer.send( 'setting', [ setting.id, setting() ] );
     61                                setting.previewer.send( 'setting', [ setting.id, setting() ] );
    5962                        } else if ( 'refresh' === transport ) {
    60                                 return setting.previewer.refresh();
     63                                setting.previewer.refresh();
    6164                        }
    6265                },
    6366
    … …  
    130133        /**
    131134         * Get the dirty setting values.
    132135         *
     136         * @since 4.7.0
     137         * @access public
     138         *
    133139         * @param {object} [options] Options.
    134140         * @param {boolean} [options.unsaved=false] Whether only values not saved yet into a changeset will be returned (differential changes).
    135141         * @returns {object} Dirty setting values.
    … …  
    158164        /**
    159165         * Request updates to the changeset.
    160166         *
     167         * @since 4.7.0
     168         * @access public
     169         *
    161170         * @param {object} [changes] Mapping of setting IDs to setting params each normally including a value property, or mapping to null.
    162171         *                           If not provided, then the changes will still be obtained from unsaved dirty settings.
    163          * @returns {jQuery.Promise}
     172         * @returns {jQuery.Promise} Promise resolving with the response data.
    164173         */
    165174        api.requestChangesetUpdate = function requestChangesetUpdate( changes ) {
    166175                var deferred, request, submittedChanges = {}, data;
    … …  
    684693                 * Animate container state change if transitions are supported by the browser.
    685694                 *
    686695                 * @since 4.7.0
     696                 * @private
    687697                 *
    688698                 * @param {function} completeCallback Function to be called after transition is completed.
    689699                 * @returns {void}
    690                  * @private
    691700                 */
    692701                _animateChangeExpanded: function( completeCallback ) {
    693702                        // Return if CSS transitions are not supported.
    … …  
    778787                 * method to handle animating the panel/section into and out of view.
    779788                 *
    780789                 * @since 4.7.0
     790                 * @access public
    781791                 *
    782792                 * @returns {jQuery} Detached content element.
    783793                 */
    … …  
    935945                                content.toggleClass( 'open' );
    936946                                content.slideToggle();
    937947                                content.attr( 'aria-expanded', function ( i, attr ) {
    938                                         return attr === 'true' ? 'false' : 'true';
     948                                        return 'true' === attr ? 'false' : 'true';
    939949                                });
    940950                        });
    941951                },
    … …  
    14191429                 * Load theme preview.
    14201430                 *
    14211431                 * @since 4.7.0
     1432                 * @access public
    14221433                 *
    14231434                 * @param {string} themeId Theme ID.
    14241435                 * @returns {jQuery.promise} Promise.
    … …  
    14511462                                request.done( function() {
    14521463                                        $( window ).off( 'beforeunload.customize-confirm' );
    14531464                                        top.location.href = urlParser.href;
     1465                                        deferred.resolve();
    14541466                                } );
    14551467                                request.fail( function() {
    14561468                                        overlay.removeClass( 'customize-loading' );
     1469                                        deferred.reject();
    14571470                                } );
    14581471                        };
    14591472
    … …  
    22732286                                // Reset the create page form.
    22742287                                container.slideUp( 180 );
    22752288                                toggle.slideDown( 180 );
    2276                         } )
    2277                         .always( function() {
     2289                        } );
     2290                        promise.always( function() {
    22782291                                input.val( '' ).removeAttr( 'disabled' );
    22792292                        } );
    22802293                }
    … …  
    23202333                        }
    23212334
    23222335                        control.setting.bind( function ( value ) {
    2323                                 // bail if the update came from the control itself
     2336                                // Bail if the update came from the control itself.
    23242337                                if ( updating ) {
    23252338                                        return;
    23262339                                }
    … …  
    26412654                 * Set up control UI once embedded in DOM and settings are created.
    26422655                 *
    26432656                 * @since 4.7.0
     2657                 * @access public
    26442658                 */
    26452659                ready: function() {
    26462660                        var control = this, updateRadios;
    … …  
    37133727                                        parsedCandidateUrls.unshift( urlParser );
    37143728                                }
    37153729
    3716                                 // Attempt to match the URL to the control frame's scheme
    3717                                 // and check if it's allowed. If not, try the original URL.
     3730                                // Attempt to match the URL to the control frame's scheme and check if it's allowed. If not, try the original URL.
    37183731                                parsedAllowedUrl = document.createElement( 'a' );
    37193732                                _.find( parsedCandidateUrls, function( parsedCandidateUrl ) {
    37203733                                        return ! _.isUndefined( _.find( previewer.allowedUrls, function( allowedUrl ) {
    … …  
    37713784                 * Handle the preview receiving the ready message.
    37723785                 *
    37733786                 * @since 4.7.0
     3787                 * @access public
    37743788                 *
    37753789                 * @param {object} data - Data from preview.
    37763790                 * @param {string} data.currentUrl - Current URL.
    … …  
    38453859                 * If a message is not received in the allotted time then the iframe will be set back to the last known valid URL.
    38463860                 *
    38473861                 * @since 4.7.0
     3862                 * @access public
    38483863                 *
    38493864                 * @returns {void}
    38503865                 */
    … …  
    39043919
    39053920                /**
    39063921                 * Refresh the preview seamlessly.
     3922                 *
     3923                 * @since 3.4.0
     3924                 * @access public
     3925                 * @returns {void}
    39073926                 */
    39083927                refresh: function() {
    39093928                        var previewer = this, onSettingChange;
    … …  
    42994318                        /**
    43004319                         * Build the query to send along with the Preview request.
    43014320                         *
     4321                         * @since 3.4.0
    43024322                         * @since 4.7.0 Added options param.
     4323                         * @access public
    43034324                         *
    43044325                         * @param {object}  [options] Options.
    43054326                         * @param {boolean} [options.excludeCustomizedSaved=false] Exclude saved settings in customized response (values pending writing to changeset).
    … …  
    43334354                         * A revision will be made for the changeset post if revisions support
    43344355                         * has been added to the post type.
    43354356                         *
     4357                         * @since 3.4.0
     4358                         * @since 4.7.0 Added args param and return value.
     4359                         *
    43364360                         * @param {object} [args] Args.
    43374361                         * @param {string} [args.status=publish] Status.
    43384362                         * @param {string} [args.date] Date, in local time in MySQL format.
    43394363                         * @param {string} [args.title] Title
    4340                          *
    4341                          * @returns {jQuery.promise}
     4364                         * @returns {jQuery.promise} Promise.
    43424365                         */
    43434366                        save: function( args ) {
    43444367                                var previewer = this,
    … …  
    46934716                                }
    46944717                        });
    46954718
     4719                        /**
     4720                         * Populate URL with UUID via `history.replaceState()`.
     4721                         *
     4722                         * @since 4.7.0
     4723                         * @access private
     4724                         *
     4725                         * @param {boolean} isIncluded Is UUID included.
     4726                         * @returns {void}
     4727                         */
    46964728                        populateChangesetUuidParam = function( isIncluded ) {
    46974729                                var urlParser, queryParams;
    46984730                                urlParser = document.createElement( 'a' );
    … …  
    48294861                                changeContainer, getHeaderHeight, releaseStickyHeader, resetStickyHeader, positionStickyHeader,
    48304862                                activeHeader, lastScrollTop;
    48314863
    4832                         // Determine which panel or section is currently expanded.
     4864                        /**
     4865                         * Determine which panel or section is currently expanded.
     4866                         *
     4867                         * @since 4.7.0
     4868                         * @access private
     4869                         *
     4870                         * @param {wp.customize.Panel|wp.customize.Section} container Construct.
     4871                         * @returns {void}
     4872                         */
    48334873                        changeContainer = function( container ) {
    48344874                                var newInstance = container,
    48354875                                        expandedSection = api.state( 'expandedSection' ).get(),
    … …  
    49054945                                headerParent.css( 'padding-top', '' );
    49064946                        };
    49074947
    4908                         // Get header height.
     4948                        /**
     4949                         * Get header height.
     4950                         *
     4951                         * @since 4.7.0
     4952                         * @access private
     4953                         *
     4954                         * @param {jQuery} headerElement Header element.
     4955                         * @returns {number} Height.
     4956                         */
    49094957                        getHeaderHeight = function( headerElement ) {
    49104958                                var height = headerElement.data( 'height' );
    49114959                                if ( ! height ) {
    … …  
    49154963                                return height;
    49164964                        };
    49174965
    4918                         // Reposition header on throttled `scroll` event.
     4966                        /**
     4967                         * Reposition header on throttled `scroll` event.
     4968                         *
     4969                         * @param {object}  header        Header.
     4970                         * @param {number}  scrollTop     Scroll top.
     4971                         * @param {boolean} isScrollingUp Is scrolling up?
     4972                         * @returns {void}
     4973                         */
    49194974                        positionStickyHeader = function( header, scrollTop, isScrollingUp ) {
    49204975                                var headerElement = header.element,
    49214976                                        headerParent = header.parent,
    … …  
    53625417                        /**
    53635418                         * Request changeset update and then re-schedule the next changeset update time.
    53645419                         *
     5420                         * @since 4.7.0
    53655421                         * @private
    53665422                         */
    53675423                        updateChangesetWithReschedule = function() {
    … …  
    53775433                        /**
    53785434                         * Schedule changeset update.
    53795435                         *
     5436                         * @since 4.7.0
    53805437                         * @private
    53815438                         */
    53825439                        scheduleChangesetUpdate = function() {
  • src/wp-admin/js/customize-nav-menus.js

    diff --git src/wp-admin/js/customize-nav-menus.js src/wp-admin/js/customize-nav-menus.js
    index 5e4e5f9..be3fba1 100644
     
    8585        /**
    8686         * Insert a new `auto-draft` post.
    8787         *
     88         * @since 4.7.0
     89         * @access public
     90         *
    8891         * @param {object} params - Parameters for the draft post to create.
    8992         * @param {string} params.post_type - Post type to add.
    9093         * @param {string} params.post_title - Post title to use.
    … …  
    562565                        itemName.val( '' );
    563566                },
    564567
    565                 // Submit handler for keypress (enter) on field and click on button.
     568                /**
     569                 * Submit handler for keypress (enter) on field and click on button.
     570                 *
     571                 * @since 4.7.0
     572                 * @private
     573                 *
     574                 * @param {jQuery.Event} event Event.
     575                 * @returns {void}
     576                 */
    566577                _submitNew: function( event ) {
    567578                        var container;
    568579
    … …  
    580591                        this.submitNew( container );
    581592                },
    582593
    583                 // Creates a new object and adds an associated menu item to the menu.
     594                /**
     595                 * Creates a new object and adds an associated menu item to the menu.
     596                 *
     597                 * @since 4.7.0
     598                 * @private
     599                 *
     600                 * @param {jQuery} container
     601                 * @returns {void}
     602                 */
    584603                submitNew: function( container ) {
    585604                        var panel = this,
    586605                                itemName = container.find( '.create-item-input' ),
  • src/wp-includes/class-wp-customize-control.php

    diff --git src/wp-includes/class-wp-customize-control.php src/wp-includes/class-wp-customize-control.php
    index 40e10dc..07c6dcf 100644
    class WP_Customize_Control {  
    119119         *
    120120         * @since 4.7.0
    121121         * @access public
    122          * @var array
     122         * @var bool
    123123         */
    124124        public $allow_addition = false;
    125125
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index 439e2b5..e71787c 100644
    final class WP_Customize_Manager {  
    39673967                        if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ) ) ) {
    39683968                                return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
    39693969                        }
    3970                 } else if ( 'background_attachment' === $setting->id ) {
     3970                } elseif ( 'background_attachment' === $setting->id ) {
    39713971                        if ( ! in_array( $value, array( 'fixed', 'scroll' ) ) ) {
    39723972                                return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) );
    39733973                        }
    3974                 } else if ( 'background_position_x' === $setting->id ) {
     3974                } elseif ( 'background_position_x' === $setting->id ) {
    39753975                        if ( ! in_array( $value, array( 'left', 'center', 'right' ), true ) ) {
    39763976                                return new WP_Error( 'invalid_value', __( 'Invalid value for background position X.' ) );
    39773977                        }
    3978                 } else if ( 'background_position_y' === $setting->id ) {
     3978                } elseif ( 'background_position_y' === $setting->id ) {
    39793979                        if ( ! in_array( $value, array( 'top', 'center', 'bottom' ), true ) ) {
    39803980                                return new WP_Error( 'invalid_value', __( 'Invalid value for background position Y.' ) );
    39813981                        }
    3982                 } else if ( 'background_size' === $setting->id ) {
     3982                } elseif ( 'background_size' === $setting->id ) {
    39833983                        if ( ! in_array( $value, array( 'auto', 'contain', 'cover' ), true ) ) {
    39843984                                return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
    39853985                        }
    3986                 } else if ( 'background_preset' === $setting->id ) {
     3986                } elseif ( 'background_preset' === $setting->id ) {
    39873987                        if ( ! in_array( $value, array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) {
    39883988                                return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
    39893989                        }
    3990                 } else if ( 'background_image' === $setting->id || 'background_image_thumb' === $setting->id ) {
     3990                } elseif ( 'background_image' === $setting->id || 'background_image_thumb' === $setting->id ) {
    39913991                        $value = empty( $value ) ? '' : esc_url_raw( $value );
    39923992                } else {
    39933993                        return new WP_Error( 'unrecognized_setting', __( 'Unrecognized background setting.' ) );
  • src/wp-includes/customize/class-wp-customize-color-control.php

    diff --git src/wp-includes/customize/class-wp-customize-color-control.php src/wp-includes/customize/class-wp-customize-color-control.php
    index e29b2e4..7f6a9b5 100644
     
    1616 */
    1717class WP_Customize_Color_Control extends WP_Customize_Control {
    1818        /**
     19         * Type.
     20         *
    1921         * @access public
    2022         * @var string
    2123         */
    2224        public $type = 'color';
    2325
    2426        /**
     27         * Statuses.
     28         *
    2529         * @access public
    2630         * @var array
    2731         */
    2832        public $statuses;
    2933
    3034        /**
    31         * @access public
    32         * @var string
    33         */
     35         * Mode.
     36         *
     37         * @since 4.7.0
     38         * @access public
     39         * @var string
     40         */
    3441        public $mode = 'full';
    3542
    3643        /**
  • src/wp-includes/customize/class-wp-customize-custom-css-setting.php

    diff --git src/wp-includes/customize/class-wp-customize-custom-css-setting.php src/wp-includes/customize/class-wp-customize-custom-css-setting.php
    index eadd47c..f43859a 100644
    final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {  
    2121        /**
    2222         * The setting type.
    2323         *
    24          * @var string
    25          *
    2624         * @since 4.7.0
    2725         * @access public
     26         * @var string
    2827         */
    2928        public $type = 'custom_css';
    3029
    … … final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {  
    3332         *
    3433         * @since 4.7.0
    3534         * @access public
    36          *
    3735         * @var string
    3836         */
    3937        public $transport = 'postMessage';
    … … final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {  
    4341         *
    4442         * @since 4.7.0
    4543         * @access public
    46          *
    4744         * @var string
    4845         */
    4946        public $capability = 'edit_css';
    … … final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {  
    5350         *
    5451         * @since 4.7.0
    5552         * @access public
    56          *
    5753         * @var string
    5854         */
    5955        public $stylesheet = '';
  • src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php

    diff --git src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
    index 00d6952..8bffb0e 100644
    class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {  
    267267         * Get original title.
    268268         *
    269269         * @since 4.7.0
     270         * @access protected
    270271         *
    271272         * @param object $item Nav menu item.
    272273         * @return string The original title.
  • src/wp-includes/js/customize-preview.js

    diff --git src/wp-includes/js/customize-preview.js src/wp-includes/js/customize-preview.js
    index 7a37ba5..a4cb196 100644
     
    132132                 * Handle link clicks in preview.
    133133                 *
    134134                 * @since 4.7.0
     135                 * @access public
    135136                 *
    136137                 * @param {jQuery.Event} event Event.
    137138                 */
    … …  
    178179                 * Handle form submit.
    179180                 *
    180181                 * @since 4.7.0
     182                 * @access public
    181183                 *
    182184                 * @param {jQuery.Event} event Event.
    183185                 */
  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index 75006a7..f6dfa0b 100644
    wp.customize.selectiveRefresh = ( function( $, api ) {  
    104104                 * Create and show the edit shortcut for a given partial placement container.
    105105                 *
    106106                 * @since 4.7.0
     107                 * @access public
    107108                 *
    108109                 * @param {Placement} placement The placement container element.
    109110                 * @returns {void}
    … … wp.customize.selectiveRefresh = ( function( $, api ) {  
    132133                 * Add an edit shortcut to the placement container.
    133134                 *
    134135                 * @since 4.7.0
     136                 * @access public
    135137                 *
    136138                 * @param {Placement} placement The placement for the partial.
    137139                 * @param {jQuery} $editShortcut The shortcut element as a jQuery object.
    … … wp.customize.selectiveRefresh = ( function( $, api ) {  
    149151                 * Return the unique class name for the edit shortcut button for this partial.
    150152                 *
    151153                 * @since 4.7.0
     154                 * @access public
    152155                 *
    153156                 * @return {string} Partial ID converted into a class name for use in shortcut.
    154157                 */
    … … wp.customize.selectiveRefresh = ( function( $, api ) {  
    162165                 * Return the appropriate translated string for the edit shortcut button.
    163166                 *
    164167                 * @since 4.7.0
     168                 * @access public
    165169                 *
    166170                 * @return {string} Tooltip for edit shortcut.
    167171                 */
    … … wp.customize.selectiveRefresh = ( function( $, api ) {  
    187191                 * Will use `params.type` if set, but otherwise will try to infer type from settingId.
    188192                 *
    189193                 * @since 4.7.0
     194                 * @access public
    190195                 *
    191196                 * @return {string} Type of partial derived from type param or the related setting ID.
    192197                 */
    … … wp.customize.selectiveRefresh = ( function( $, api ) {  
    209214                 * Create an edit shortcut button for this partial.
    210215                 *
    211216                 * @since 4.7.0
     217                 * @access public
    212218                 *
    213219                 * @return {jQuery} The edit shortcut button element.
    214220                 */