Make WordPress Core

Ticket #21492: 21492.3.diff

File 21492.3.diff, 3.2 KB (added by MatheusGimenez, 8 years ago)

change (int) to absint() to convert values

  • 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(
     
    42194220
    42204221                return $color;
    42214222        }
     4223        /**
     4224         * Callback for validating page on front value
     4225         *
     4226         * @since 4.7.3
     4227         *
     4228         * @param object $validity
     4229         * @param mixed $value
     4230         * @access private
     4231         * @return mixed
     4232         */
     4233        public function _validate_page_on_front( $validity, $value ) {
     4234                $page_for_posts = absint( get_option( 'page_for_posts', 0 ) );
    42224235
     4236                $value = absint( $value );
     4237                if ( 0 === $value ) {
     4238                        return $validity;
     4239                }
     4240                if ( $value === $page_for_posts ) {
     4241                        // add error message
     4242                        $validity->add( 'same_id_for_page_for_posts', __( 'Warning: We advise you to chose a different page for your Posts page.' ) );
     4243                }
     4244                return $validity;
     4245        }
     4246
    42234247        /**
    42244248         * Callback for validating a background setting value.
    42254249         *
  • 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