Make WordPress Core

Ticket #35941: 35941.2.diff

File 35941.2.diff, 10.2 KB (added by westonruter, 9 years ago)

Refreshed patch after [35945]

  • src/wp-admin/css/customize-controls.css

    diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css
    index 82132e3..c3b6e01 100644
    p.customize-section-description { 
    721721.customize-control-background .current,
    722722.customize-control-cropped_image .current,
    723723.customize-control-site_icon .current,
    724 .customize-control-custom_logo .current,
    725724.customize-control-header .current {
    726725        margin-bottom: 8px;
    727726}
    p.customize-section-description { 
    763762.customize-control-site_icon .remove-button,
    764763.customize-control-site_icon .default-button,
    765764.customize-control-site_icon .upload-button,
    766 .customize-control-custom_logo .remove-button,
    767 .customize-control-custom_logo .default-button,
    768 .customize-control-custom_logo .upload-button,
    769765.customize-control-header button.new,
    770766.customize-control-header button.remove {
    771767        white-space: normal;
    p.customize-section-description { 
    779775.customize-control-background .current .container,
    780776.customize-control-cropped_image .current .container,
    781777.customize-control-site_icon .current .container,
    782 .customize-control-custom_logo .current .container,
    783778.customize-control-header .current .container {
    784779        overflow: hidden;
    785780        -webkit-border-radius: 2px;
    p.customize-section-description { 
    793788.customize-control-background .current .container,
    794789.customize-control-cropped_image .current .container,
    795790.customize-control-site_icon .current .container,
    796 .customize-control-custom_logo .current .container,
    797791.customize-control-image .current .container {
    798792        min-height: 40px;
    799793}
    p.customize-section-description { 
    822816.customize-control-background .inner,
    823817.customize-control-cropped_image .inner,
    824818.customize-control-site_icon .inner,
    825 .customize-control-custom_logo .inner,
    826819.customize-control-header .inner {
    827820        display: none;
    828821        position: absolute;
    p.customize-section-description { 
    838831.customize-control-background .inner,
    839832.customize-control-cropped_image .inner,
    840833.customize-control-site_icon .inner,
    841 .customize-control-custom_logo .inner,
    842834.customize-control-image .inner {
    843835        display: block;
    844836        min-height: 40px;
    p.customize-section-description { 
    850842.customize-control-background .inner,
    851843.customize-control-cropped_image .inner,
    852844.customize-control-site_icon .inner,
    853 .customize-control-custom_logo.inner,
    854845.customize-control-header .inner,
    855846.customize-control-header .inner .dashicons {
    856847        line-height: 20px;
    p.customize-section-description { 
    950941        100% { color: #d4b146; }
    951942}
    952943
    953 .customize-control-media .actions,
    954 .customize-control-upload .actions,
    955 .customize-control-image .actions,
    956 .customize-control-background .actions,
    957 .customize-control-cropped_image .actions,
    958 .customize-control-site_icon .actions,
    959 .customize-control-header .actions {
    960         margin-bottom: 32px;
    961 }
    962 
    963944.customize-control-header .choice {
    964945        position: relative;
    965946        display: block;
    p.customize-section-description { 
    994975.customize-control-cropped_image .default-button,
    995976.customize-control-site_icon .remove-button,
    996977.customize-control-site_icon .default-button,
    997 .customize-control-custom_logo .remove-button,
    998 .customize-control-custom_logo .default-button,
    999978.customize-control-header .remove {
    1000979        float: left;
    1001980        margin-right: 3px;
    p.customize-section-description { 
    1007986.customize-control-background .upload-button,
    1008987.customize-control-cropped_image .upload-button,
    1009988.customize-control-site_icon .upload-button,
    1010 .customize-control-custom_logo .upload-button,
    1011989.customize-control-header .new {
    1012990        float: right;
    1013991}
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 8fcf08b..f514cf7 100644
     
    17901790                                        control.pausePlayer();
    17911791                                });
    17921792
    1793                         // Re-render whenever the control's setting changes.
    1794                         control.setting.bind( function () { control.renderContent(); } );
     1793                        control.setting.bind( function( value ) {
     1794
     1795                                // Send attachment information to the preview for possible use in `postMessage` transport.
     1796                                wp.media.attachment( value ).fetch().done( function() {
     1797                                        wp.customize.previewer.send( control.setting.id + '-attachment-data', this.attributes );
     1798                                } );
     1799
     1800                                // Re-render whenever the control's setting changes.
     1801                                control.renderContent();
     1802                        } );
    17951803                },
    17961804
    17971805                pausePlayer: function () {
     
    23032311        });
    23042312
    23052313        /**
    2306          * A control for selecting custom logos.
    2307          *
    2308          * @class
    2309          * @augments wp.customize.MediaControl
    2310          * @augments wp.customize.Control
    2311          * @augments wp.customize.Class
    2312          */
    2313         api.CustomLogoControl = api.MediaControl.extend({
    2314 
    2315                 /**
    2316                  * When the control's DOM structure is ready,
    2317                  * set up internal event bindings.
    2318                  */
    2319                 ready: function() {
    2320                         var control = this;
    2321 
    2322                         // Shortcut so that we don't have to use _.bind every time we add a callback.
    2323                         _.bindAll( control, 'restoreDefault', 'removeFile', 'openFrame', 'select' );
    2324 
    2325                         // Bind events, with delegation to facilitate re-rendering.
    2326                         control.container.on( 'click keydown', '.upload-button', control.openFrame );
    2327                         control.container.on( 'click keydown', '.thumbnail-image img', control.openFrame );
    2328                         control.container.on( 'click keydown', '.default-button', control.restoreDefault );
    2329                         control.container.on( 'click keydown', '.remove-button', control.removeFile );
    2330 
    2331                         control.setting.bind( function( attachmentId ) {
    2332                                 wp.media.attachment( attachmentId ).fetch().done( function() {
    2333                                         wp.customize.previewer.send( 'custom-logo-attachment-data', this.attributes );
    2334                                 } );
    2335 
    2336                                 // Re-render whenever the control's setting changes.
    2337                                 control.renderContent();
    2338                         } );
    2339                 }
    2340         });
    2341 
    2342         /**
    23432314         * @class
    23442315         * @augments wp.customize.Control
    23452316         * @augments wp.customize.Class
     
    32453216                image:         api.ImageControl,
    32463217                cropped_image: api.CroppedImageControl,
    32473218                site_icon:     api.SiteIconControl,
    3248                 custom_logo:   api.CustomLogoControl,
    32493219                header:        api.HeaderControl,
    32503220                background:    api.BackgroundControl,
    32513221                theme:         api.ThemeControl
  • 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 ff204d9..3699b21 100644
    final class WP_Customize_Manager { 
    217217                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' );
    218218                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' );
    219219                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' );
    220                 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-custom-logo-control.php' );
    221220                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' );
    222221                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' );
    223222                require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' );
    final class WP_Customize_Manager { 
    18481847                $this->register_control_type( 'WP_Customize_Background_Image_Control' );
    18491848                $this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
    18501849                $this->register_control_type( 'WP_Customize_Site_Icon_Control' );
    1851                 $this->register_control_type( 'WP_Customize_Custom_Logo_Control' );
    18521850                $this->register_control_type( 'WP_Customize_Theme_Control' );
    18531851
    18541852                /* Themes */
    final class WP_Customize_Manager { 
    19651963                        'transport'      => 'postMessage',
    19661964                ) );
    19671965
    1968                 $this->add_control( new WP_Customize_Custom_Logo_Control( $this, 'custom_logo', array(
     1966                $this->add_control( new WP_Customize_Media_Control( $this, 'custom_logo', array(
    19691967                        'label'    => __( 'Logo' ),
    19701968                        'section'  => 'title_tagline',
    19711969                        'priority' => 0,
     1970                        'mime_type' => 'image',
     1971                        'button_labels' => array(
     1972                                'select'       => __( 'Select logo' ),
     1973                                'change'       => __( 'Change logo' ),
     1974                                'remove'       => __( 'Remove' ),
     1975                                'default'      => __( 'Default' ),
     1976                                'placeholder'  => __( 'No logo selected' ),
     1977                                'frame_title'  => __( 'Select logo' ),
     1978                                'frame_button' => __( 'Choose logo' ),
     1979                        ),
    19721980                ) ) );
    19731981
    19741982                if ( isset( $this->selective_refresh ) ) {
  • deleted file src/wp-includes/customize/class-wp-customize-custom-logo-control.php

    diff --git src/wp-includes/customize/class-wp-customize-custom-logo-control.php src/wp-includes/customize/class-wp-customize-custom-logo-control.php
    deleted file mode 100644
    index 9daff2d..0000000
    + -  
    1 <?php
    2 /**
    3  * Customize API: WP_Customize_Custom_Logo_Control class
    4  *
    5  * @package WordPress
    6  * @subpackage Customize
    7  * @since 4.5.0
    8  */
    9 
    10 /**
    11  * Customize custom logo control class.
    12  *
    13  * Used only for custom functionality in JavaScript.
    14  *
    15  * @since 4.5.0
    16  *
    17  * @see WP_Customize_Image_Control
    18  */
    19 class WP_Customize_Custom_Logo_Control extends WP_Customize_Image_Control {
    20 
    21         /**
    22          * Control type.
    23          *
    24          * @since 4.5.0
    25          * @access public
    26          * @var string
    27          */
    28         public $type = 'custom_logo';
    29 
    30         /**
    31          * Constructor.
    32          *
    33          * @since 4.5.0
    34          * @access public
    35          *
    36          * @param WP_Customize_Manager $manager Customizer bootstrap instance.
    37          * @param string               $id      Control ID.
    38          * @param array                $args    Optional. Arguments to override class property defaults.
    39          */
    40         public function __construct( $manager, $id, $args = array() ) {
    41                 parent::__construct( $manager, $id, $args );
    42 
    43                 $this->button_labels = array(
    44                         'select'       => __( 'Select logo' ),
    45                         'change'       => __( 'Change logo' ),
    46                         'remove'       => __( 'Remove' ),
    47                         'default'      => __( 'Default' ),
    48                         'placeholder'  => __( 'No logo selected' ),
    49                         'frame_title'  => __( 'Select logo' ),
    50                         'frame_button' => __( 'Choose logo' ),
    51                 );
    52         }
    53 }
  • src/wp-includes/js/customize-preview.js

    diff --git src/wp-includes/js/customize-preview.js src/wp-includes/js/customize-preview.js
    index 96a7b28..8d1d759 100644
     
    234234                 *
    235235                 * @since 4.5.0
    236236                 */
    237                 api.preview.bind( 'custom-logo-attachment-data', function( attachment ) {
     237                api.preview.bind( 'custom_logo-attachment-data', function( attachment ) {
    238238                        var $logo  = $( '.custom-logo' ),
    239239                                size   = $logo.data( 'size' ),
    240240                                srcset = [];