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. git-svn-id: https://develop.svn.wordpress.org/trunk@27662 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d5889105bf
commit
263d9c7f33
@ -1760,7 +1760,7 @@ $post_params = array(
|
|||||||
$post_params = apply_filters( 'upload_post_params', $post_params );
|
$post_params = apply_filters( 'upload_post_params', $post_params );
|
||||||
|
|
||||||
$plupload_init = array(
|
$plupload_init = array(
|
||||||
'runtimes' => 'html5,silverlight,flash,html4',
|
'runtimes' => 'html5,flash,silverlight,html4',
|
||||||
'browse_button' => 'plupload-browse-button',
|
'browse_button' => 'plupload-browse-button',
|
||||||
'container' => 'plupload-upload-ui',
|
'container' => 'plupload-upload-ui',
|
||||||
'drop_element' => 'drag-drop-area',
|
'drop_element' => 'drag-drop-area',
|
||||||
|
@ -400,6 +400,16 @@ jQuery(document).ready(function($){
|
|||||||
|
|
||||||
// init and set the uploader
|
// init and set the uploader
|
||||||
uploader_init = function() {
|
uploader_init = function() {
|
||||||
|
var isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1;
|
||||||
|
|
||||||
|
// Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode)
|
||||||
|
if ( ! isIE && 'flash' === plupload.predictRuntime( wpUploaderInit ) &&
|
||||||
|
( ! wpUploaderInit.required_features || ! wpUploaderInit.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
|
||||||
|
|
||||||
|
wpUploaderInit.required_features = wpUploaderInit.required_features || {};
|
||||||
|
wpUploaderInit.required_features.send_binary_string = true;
|
||||||
|
}
|
||||||
|
|
||||||
uploader = new plupload.Uploader(wpUploaderInit);
|
uploader = new plupload.Uploader(wpUploaderInit);
|
||||||
|
|
||||||
$('#image_resize').bind('change', function() {
|
$('#image_resize').bind('change', function() {
|
||||||
@ -430,8 +440,9 @@ jQuery(document).ready(function($){
|
|||||||
$('#drag-drop-area').unbind('.wp-uploader');
|
$('#drag-drop-area').unbind('.wp-uploader');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( up.runtime == 'html4' )
|
if ( up.runtime === 'html4' ) {
|
||||||
$('.upload-flash-bypass').hide();
|
$('.upload-flash-bypass').hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
uploader.init();
|
uploader.init();
|
||||||
|
@ -25,6 +25,7 @@ window.wp = window.wp || {};
|
|||||||
*/
|
*/
|
||||||
Uploader = function( options ) {
|
Uploader = function( options ) {
|
||||||
var self = this,
|
var self = this,
|
||||||
|
isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1,
|
||||||
elements = {
|
elements = {
|
||||||
container: 'container',
|
container: 'container',
|
||||||
browser: 'browse_button',
|
browser: 'browse_button',
|
||||||
@ -85,6 +86,14 @@ window.wp = window.wp || {};
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode)
|
||||||
|
if ( ! isIE && 'flash' === plupload.predictRuntime( this.plupload ) &&
|
||||||
|
( ! this.plupload.required_features || ! this.plupload.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
|
||||||
|
|
||||||
|
this.plupload.required_features = this.plupload.required_features || {};
|
||||||
|
this.plupload.required_features.send_binary_string = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.uploader = new plupload.Uploader( this.plupload );
|
this.uploader = new plupload.Uploader( this.plupload );
|
||||||
delete this.plupload;
|
delete this.plupload;
|
||||||
|
|
||||||
|
@ -2176,7 +2176,7 @@ function wp_plupload_default_settings() {
|
|||||||
$max_upload_size = wp_max_upload_size();
|
$max_upload_size = wp_max_upload_size();
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'runtimes' => 'html5,silverlight,flash,html4',
|
'runtimes' => 'html5,flash,silverlight,html4',
|
||||||
'file_data_name' => 'async-upload', // key passed to $_FILE.
|
'file_data_name' => 'async-upload', // key passed to $_FILE.
|
||||||
'url' => admin_url( 'async-upload.php', 'relative' ),
|
'url' => admin_url( 'async-upload.php', 'relative' ),
|
||||||
'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ),
|
'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ),
|
||||||
|
Loading…
Reference in New Issue
Block a user