Make WordPress Core

Ticket #21492: 21492.2.diff

File 21492.2.diff, 3.5 KB (added by MatheusGimenez, 8 years ago)
  • wp-includes/class-wp-customize-manager.php

     
    41124112                $this->add_setting( 'page_on_front', array(
    41134113                        'type'       => 'option',
    41144114                        'capability' => 'manage_options',
     4115                        'validate_callback' => array( $this, '_validate_page_on_front' ),
    41154116                ) );
    41164117
    41174118                $this->add_control( 'page_on_front', array(
     
    41214122                        'allow_addition' => true,
    41224123                ) );
    41234124
    4124                 $this->add_setting( 'page_for_posts', array(
    4125                         'type' => 'option',
    4126                         'capability' => 'manage_options',
    4127                 ) );
    4128 
    41294125                $this->add_control( 'page_for_posts', array(
    41304126                        'label' => __( 'Posts page' ),
    41314127                        'section' => 'static_front_page',
     
    42194215
    42204216                return $color;
    42214217        }
     4218        /**
     4219         * Callback for validating page on front value
     4220         *
     4221         * @since 4.7.3
     4222         *
     4223         * @param object $validity
     4224         * @param mixed $value
     4225         * @access private
     4226         * @return mixed
     4227         */
     4228        public function _validate_page_on_front( $validity, $value ) {
     4229                $page_for_posts = (int) get_option( 'page_for_posts', 0 );
    42224230
     4231                $value = (int) $value;
     4232                if ( 0 === $value ) {
     4233                        return $validity;
     4234                }
     4235                if ( $value === $page_for_posts ) {
     4236                        // add error message
     4237                        $validity->add( 'same_id_for_page_for_posts', __( 'Warning: We advise you to chose a different page for your Posts page.' ) );
     4238                }
     4239                return $validity;
     4240        }
     4241
    42234242        /**
    42244243         * Callback for validating a background setting value.
    42254244         *
  • wp-includes/js/media/views/attachments/browser.js

     
    4141                this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this );
    4242                this.controller.on( 'edit:selection', this.editSelection );
    4343                this.createToolbar();
    44                 this.createUploader();
    45                 this.createAttachments();
    46                 if ( this.options.sidebar ) {
    47                         this.createSidebar();
     44                // if its open in wp-admin/upload.php show sidebar first
     45                if ( 'library' === this.model.id ) {
     46                        if ( this.options.sidebar ) {
     47                                this.createSidebar();
     48                        }
     49                        this.createUploader();
     50                        this.createAttachments();
     51                } else {
     52                        // if its open inside a modal (not in wp-admin/upload.php ) show uploader and attachments first
     53                        this.createUploader();
     54                        this.createAttachments();
     55                        if ( this.options.sidebar ) {
     56                                this.createSidebar();
     57                        }
    4858                }
    4959                this.updateContent();
    5060
  • wp-includes/js/media-views.js

     
    37723772                this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this );
    37733773                this.controller.on( 'edit:selection', this.editSelection );
    37743774                this.createToolbar();
    3775                 this.createUploader();
    3776                 this.createAttachments();
    3777                 if ( this.options.sidebar ) {
    3778                         this.createSidebar();
     3775                // if its open in wp-admin/upload.php show sidebar first
     3776                if ( 'library' === this.model.id ) {
     3777                        if ( this.options.sidebar ) {
     3778                                this.createSidebar();
     3779                        }
     3780                        this.createUploader();
     3781                        this.createAttachments();
     3782                } else {
     3783                        // if its open inside a modal (not in wp-admin/upload.php ) show uploader and attachments first
     3784                        this.createUploader();
     3785                        this.createAttachments();
     3786                        if ( this.options.sidebar ) {
     3787                                this.createSidebar();
     3788                        }
    37793789                }
    37803790                this.updateContent();
    37813791