Make WordPress Core

Changeset 22492


Ignore:
Timestamp:
11/09/2012 05:47:02 AM (12 years ago)
Author:
koopersmith
Message:

Customizer: Restrict image control uploaders to only allow image file types. see #22149.

Location:
trunk
Files:
3 edited

Legend:

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

    r22491 r22492  
    146146                dropzone:  this.container.find('.upload-dropzone'),
    147147                success:   this.success,
     148                plupload:  {},
    148149                params:    {}
    149150            }, this.uploader || {} );
     151
     152            if ( control.params.extensions ) {
     153                control.uploader.plupload.filters = [{
     154                    title:      api.l10n.allowedFiles,
     155                    extensions: control.params.extensions
     156                }];
     157            }
    150158
    151159            if ( control.params.context )
  • trunk/wp-includes/class-wp-customize-control.php

    r22400 r22492  
    403403    public $removed = '';
    404404    public $context;
     405    public $extensions;
    405406
    406407    /**
     
    426427        if ( $this->context )
    427428            $this->json['context'] = $this->context;
     429
     430        if ( $this->extensions )
     431            $this->json['extensions'] = $this->extensions;
    428432    }
    429433
     
    457461    public $get_url;
    458462    public $statuses;
     463    public $extensions = 'jpg,jpeg,gif,png';
    459464
    460465    protected $tabs = array();
  • trunk/wp-includes/script-loader.php

    r22480 r22492  
    314314        'close'     => __( 'Close' ),
    315315        'cheatin'   => __( 'Cheatin’ uh?' ),
     316
     317        // Used for overriding the file types allowed in plupload.
     318        'allowedFiles' => __( 'Allowed Files' ),
    316319    ) );
    317320
Note: See TracChangeset for help on using the changeset viewer.