Make WordPress Core

Changeset 39345


Ignore:
Timestamp:
11/23/2016 06:04:23 AM (7 years ago)
Author:
westonruter
Message:

Customize: Clean up docs and code style for customize changes in 4.7.

  • Adds missing resolve/fail for promise returned by loadThemePreview.
  • Adds missing jsdoc blocks and tags.
  • Adds missing phpdoc and makes corrections.

See #37770.
Fixes #38908.

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r39271 r39345  
    4646         *
    4747         * @since 3.4.0
     48         * @access public
     49         *
     50         * @returns {void}
    4851         */
    4952        preview: function() {
     
    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        },
     
    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).
     
    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 ) {
     
    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 ) {
     
    779788         *
    780789         * @since 4.7.0
     790         * @access public
    781791         *
    782792         * @returns {jQuery} Detached content element.
     
    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            });
     
    14201430         *
    14211431         * @since 4.7.0
     1432         * @access public
    14221433         *
    14231434         * @param {string} themeId Theme ID.
     
    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            };
     
    22742287                container.slideUp( 180 );
    22752288                toggle.slideDown( 180 );
    2276             } )
    2277             .always( function() {
     2289            } );
     2290            promise.always( function() {
    22782291                input.val( '' ).removeAttr( 'disabled' );
    22792292            } );
     
    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;
     
    26422655         *
    26432656         * @since 4.7.0
     2657         * @access public
    26442658         */
    26452659        ready: function() {
     
    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 ) {
     
    37723785         *
    37733786         * @since 4.7.0
     3787         * @access public
    37743788         *
    37753789         * @param {object} data - Data from preview.
     
    38463860         *
    38473861         * @since 4.7.0
     3862         * @access public
    38483863         *
    38493864         * @returns {void}
     
    39053920        /**
    39063921         * Refresh the preview seamlessly.
     3922         *
     3923         * @since 3.4.0
     3924         * @access public
     3925         * @returns {void}
    39073926         */
    39083927        refresh: function() {
     
    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.
     
    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 ) {
     
    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;
     
    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,
     
    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' );
     
    49164964            };
    49174965
    4918             // Reposition header on throttled `scroll` event.
     4966            /**
     4967             * Reposition header on throttled `scroll` event.
     4968             *
     4969             * @since 4.7.0
     4970             * @access private
     4971             *
     4972             * @param {object}  header        Header.
     4973             * @param {number}  scrollTop     Scroll top.
     4974             * @param {boolean} isScrollingUp Is scrolling up?
     4975             * @returns {void}
     4976             */
    49194977            positionStickyHeader = function( header, scrollTop, isScrollingUp ) {
    49204978                var headerElement = header.element,
     
    53635421             * Request changeset update and then re-schedule the next changeset update time.
    53645422             *
     5423             * @since 4.7.0
    53655424             * @private
    53665425             */
     
    53785437             * Schedule changeset update.
    53795438             *
     5439             * @since 4.7.0
    53805440             * @private
    53815441             */
  • trunk/src/wp-admin/js/customize-nav-menus.js

    r39138 r39345  
    8585    /**
    8686     * Insert a new `auto-draft` post.
     87     *
     88     * @since 4.7.0
     89     * @access public
    8790     *
    8891     * @param {object} params - Parameters for the draft post to create.
     
    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;
     
    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,
  • trunk/src/wp-includes/class-wp-customize-control.php

    r39194 r39345  
    120120     * @since 4.7.0
    121121     * @access public
    122      * @var array
     122     * @var bool
    123123     */
    124124    public $allow_addition = false;
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r39332 r39345  
    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 {
  • trunk/src/wp-includes/customize/class-wp-customize-color-control.php

    r38931 r39345  
    1717class WP_Customize_Color_Control extends WP_Customize_Control {
    1818    /**
     19     * Type.
     20     *
    1921     * @access public
    2022     * @var string
     
    2325
    2426    /**
     27     * Statuses.
     28     *
    2529     * @access public
    2630     * @var array
     
    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
  • trunk/src/wp-includes/customize/class-wp-customize-custom-css-setting.php

    r39318 r39345  
    2222     * The setting type.
    2323     *
     24     * @since 4.7.0
     25     * @access public
    2426     * @var string
    25      *
    26      * @since 4.7.0
    27      * @access public
    2827     */
    2928    public $type = 'custom_css';
     
    3433     * @since 4.7.0
    3534     * @access public
    36      *
    3735     * @var string
    3836     */
     
    4442     * @since 4.7.0
    4543     * @access public
    46      *
    4744     * @var string
    4845     */
     
    5451     * @since 4.7.0
    5552     * @access public
    56      *
    5753     * @var string
    5854     */
  • trunk/src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php

    r38991 r39345  
    268268     *
    269269     * @since 4.7.0
     270     * @access protected
    270271     *
    271272     * @param object $item Nav menu item.
  • trunk/src/wp-includes/js/customize-preview.js

    r39332 r39345  
    133133         *
    134134         * @since 4.7.0
     135         * @access public
    135136         *
    136137         * @param {jQuery.Event} event Event.
     
    179180         *
    180181         * @since 4.7.0
     182         * @access public
    181183         *
    182184         * @param {jQuery.Event} event Event.
  • trunk/src/wp-includes/js/customize-selective-refresh.js

    r39281 r39345  
    105105         *
    106106         * @since 4.7.0
     107         * @access public
    107108         *
    108109         * @param {Placement} placement The placement container element.
     
    133134         *
    134135         * @since 4.7.0
     136         * @access public
    135137         *
    136138         * @param {Placement} placement The placement for the 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.
     
    163166         *
    164167         * @since 4.7.0
     168         * @access public
    165169         *
    166170         * @return {string} Tooltip for edit shortcut.
     
    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.
     
    210215         *
    211216         * @since 4.7.0
     217         * @access public
    212218         *
    213219         * @return {jQuery} The edit shortcut button element.
Note: See TracChangeset for help on using the changeset viewer.