Make WordPress Core

Changeset 27662


Ignore:
Timestamp:
03/23/2014 11:44:20 PM (12 years ago)
Author:
azaozz
Message:

Plupload: switch to urlstream upload method when the 'flash' runtime is used in non IE browsers. This ensures cookies are sent but limits the maximum file size that flash can handle.

By default only IE9 and older use flash so this change is mostly for completeness. It would affect only the (extremely rare) cases where a plugin disables the html5 runtime.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r27626 r27662  
    17611761
    17621762$plupload_init = array(
    1763         'runtimes'            => 'html5,silverlight,flash,html4',
     1763        'runtimes'            => 'html5,flash,silverlight,html4',
    17641764        'browse_button'       => 'plupload-browse-button',
    17651765        'container'           => 'plupload-upload-ui',
  • trunk/src/wp-includes/js/plupload/handlers.js

    r27318 r27662  
    401401        // init and set the uploader
    402402        uploader_init = function() {
     403                var isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1;
     404
     405                 // Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode)
     406                 if ( ! isIE && 'flash' === plupload.predictRuntime( wpUploaderInit ) &&
     407                        ( ! wpUploaderInit.required_features || ! wpUploaderInit.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
     408
     409                        wpUploaderInit.required_features = wpUploaderInit.required_features || {};
     410                        wpUploaderInit.required_features.send_binary_string = true;
     411                }
     412
    403413                uploader = new plupload.Uploader(wpUploaderInit);
    404414
     
    431441                        }
    432442
    433                         if ( up.runtime == 'html4' )
     443                        if ( up.runtime === 'html4' ) {
    434444                                $('.upload-flash-bypass').hide();
     445                        }
    435446                });
    436447
  • trunk/src/wp-includes/js/plupload/wp-plupload.js

    r27343 r27662  
    2626        Uploader = function( options ) {
    2727                var self = this,
     28                        isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1,
    2829                        elements = {
    2930                                container: 'container',
     
    8485                if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) {
    8586                        return;
     87                }
     88
     89                 // Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode)
     90                 if ( ! isIE && 'flash' === plupload.predictRuntime( this.plupload ) &&
     91                        ( ! this.plupload.required_features || ! this.plupload.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
     92
     93                        this.plupload.required_features = this.plupload.required_features || {};
     94                        this.plupload.required_features.send_binary_string = true;
    8695                }
    8796
  • trunk/src/wp-includes/media.php

    r27657 r27662  
    21772177
    21782178        $defaults = array(
    2179                 'runtimes'            => 'html5,silverlight,flash,html4',
     2179                'runtimes'            => 'html5,flash,silverlight,html4',
    21802180                'file_data_name'      => 'async-upload', // key passed to $_FILE.
    21812181                'url'                 => admin_url( 'async-upload.php', 'relative' ),
Note: See TracChangeset for help on using the changeset viewer.