Upgrade Plupload to 2.1.1, props kovshenin, see #25663

Built from https://develop.svn.wordpress.org/trunk@27316


git-svn-id: http://core.svn.wordpress.org/trunk@27168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-02-27 20:01:16 +00:00
parent baeecbe763
commit d896fa2487
18 changed files with 120 additions and 343 deletions

View File

@ -1765,15 +1765,13 @@ $plupload_init = array(
'container' => 'plupload-upload-ui',
'drop_element' => 'drag-drop-area',
'file_data_name' => 'async-upload',
'multiple_queues' => true,
'max_file_size' => $max_upload_size . 'b',
'url' => $upload_action_url,
'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
'filters' => array( array('title' => __( 'Allowed Files' ), 'extensions' => '*') ),
'multipart' => true,
'urlstream_upload' => true,
'multipart_params' => $post_params
'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ),
'silverlight_xap_url' => includes_url( 'js/plupload/Moxie.xap' ),
'filters' => array(
'max_file_size' => $max_upload_size . 'b',
),
'multipart_params' => $post_params,
);
// Multi-file uploading doesn't currently work in iOS Safari,
@ -1860,9 +1858,6 @@ do_action( 'post-html-upload-ui' );
<span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span>
<?php
if ( ($is_IE || $is_opera) && $max_upload_size > 100 * 1024 * 1024 ) { ?>
<span class="big-file-warning"><?php _e('Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.'); ?></span>
<?php }
/**
* Fires on the post upload UI screen.

Binary file not shown.

Binary file not shown.

View File

@ -1,241 +0,0 @@
Version 1.5.7 (2013-04-10)
HTML5: Workaround for squish problem in iOS6, when uploading resized images.
HTML5: Fix failing workaround for FormData+Blob bug on Android...
HTML5: Allow multiple uploads on iOS.
Include VB build script that doesn't depend on Ant and is said to be native to Windows.
Version 1.5.6 (2013-02-28)
Fix regression: getPos() wrong on ie6/7.
HTML5: Send file as binary string if it was mangled, even if multipart is set to false.
HTML5: Add workaround Android browsers, that are unable to properly send blobs in FormData.
HTML4/Flash/Silverlight: Destroy fails to cleanup everything when container not defined.
UI, Queue: Use html() instead of text(), otherwise special characters fail to display properly.
UI, Queue: Use on() instead of delegate() or live(). Update examples to use jQuery 1.9.0 by default.
Queue: Blur rename input field when ESC is pressed.
Additional language packs: Slovak.
Version 1.5.5 (2013-01-23)
UI Widget: Fix sortable feature, broken in jQuery UI 1.9.
Queue: Replace live() with delegate(), as live() was removed from jQuery 1.9.
HTML5: window.getComputedStyle in Firefox doesn't support dashed rulenames - use zIndex instead of z-index.
HTML5/Flash/Silverlight/Gears: Process JPEGs, if quality parameter is present, whatever the scale factor.
Flash: Survive invalid EXIF tag offsets.
Flash: Allow only letters, digits and underscore in runtime id to avoid script injection.
SilverLight: Prepend ampersand to the query string, for non multipart cases (as in Flash and HTML5).
Add mime types for m2v,3gp,3g2 extensions.
Version 1.5.4 (2012-04-12)
Flash: Disable scripting if swf was loaded from another domain.
Version 1.5.3 (2012-04-05)
HTML5: Check if xhr object is initialized, before calling abort() on it.
HTML4: Postpone form removal until uploaders state changes, to avoid error on resuming stopped uploads.
BrowserPlus: Fix mechanical typo, that caused error during mime type check.
BrowserPlus: browserPlus.Uploader.Cancel() has two required parameters, dies with the error if not passed.
Flash: Improve runtime's behaviour during upload cancellation.
Flash: Survive the case when GPSVersionID contains unexpected value.
Flash: Fix random freeze in Chrome's bundled Flash Player.
Flash: Avoid the silent break when URLStream not yet open, but close is called on it.
Flash: Move Destroy handler out of Flash:Init handler, since it might be called not only after Flash:Init but also before it.
Flash: Avoid warning during build with mxmlc.
Try removeEventListener first in IE and only if it fails - detachEvent.
Fix plupload.getPos to return proper value in IE8+.
Do not initiate plupload.STARTED state, if file queue is empty.
Additional language packs: Estonian, Polish, Korean, French-Canadian, Greek, Persian/Farsi.
Version 1.5.2 (2012-01-06)
UI Widget: Do not show UI if no runtime can be initialized.
UI Widget: Timely update file size and total size if resize in action.
UI Widget: Constrain renaming feature to queued files only.
UI Widget: Disable Add button properly, if requested, rather then just hide.
HTML4/HTML5/BrowserPlus: Avoid adding mime type twice to dialog trigger.
HTML5: fix regression, when unresized images were failing on FF3.6.
HTML5: Constrain Gecko 2,5,6 workaround to multipart mode only.
HTML5/Flash: Take into account weird possibilities of ExifVersion being a string, rather then standard Undefined.
Flash: Simplify event dispatching in BitmapDataUnlimited class, in order to avoid freezing on resizing in FP11.
Add ability to disable file dialog trigger on request (uploader.disableBrowse(true/false)).
Support for immediate abort of upload process, be it chunked upload or regular one.
Abort all activity, before destroying uploader.
Revive temporary file removal logic in upload.php.
Fix potential vulnerability in dump.php and upload.php.
Additional MIME types: application/vnd.openxmlformats-officedocument.*, application/x-javascript, application/json, text/css,css, application/vnd.oasis.opendocument.formula-templat.
Additional language packs: Hungarian, Croatian, Serbian, Romanian.
Version 1.5.1.1 (2011-09-27)
HTML5: Fix mechanical typo, that successfully broke drag and drop, wherever could.
Version 1.5.1 (2011-09-26)
HTML4: Add support for server responses in HTML format.
HTML5: Disable multiple file selection in Safari 5.x for Windows (see #363).
HTML5: Gecko 2/5/6 should upload chunks as binary strings when in chunking mode and client side resize is requested.
Flash: Enforce URLStream mode when custom headers are passed.
Flash: Fix embedding problems in IE9 (and all other IEs).
Flash/Gears/BrowserPlus/SilverLight: Expose multi_selection feature, to be used in required_features (mainly to overcome Safari for Windows problem).
SilverLight: Properly handle custom and null headers.
UploadComplete moved to fire after the last StateChanged event.
Additional language packs: Finnish.
Version 1.5b (2011-09-11)
UI Widget: Fix sortable logic.
UI Widget: Fix bug, when message was displayed simultaneously across all Plupload UI instances on the page.
UI Widget: notify() method is now public - users can throw their own messages into the widget header.
HTML4/HTML5: Revise input[type=file] placement logic to support cursor styling on Geko 2+.
HTML5: Revise Drag'n'Drop detection logic.
HTML5: Make Exif and GPS information available to user, introduce two new events: ExifData and GpsData.
HTML5: Add support for File.prototype.slice() method (mozSlice/webkitSlice) in order to be able to upload files in chunks without preloading.
HTML5: Remove any JPEG headers before restoring them, 'cause user agent (like Chrome), might be inserting it's own.
Flash: Remove a limit on the depth of image header check, since it still fails in some cases and performance gain is negligible.
Flash: Fix regression, when runtime hanged when not images where passed in as images.
SilverLight: Fix bug, when JSON serializer was failing on null.
SilverLight: Remove cast to integer for chunk boundary, which resulted in a wrong size for last chunks on huge files.
SilverLight: Increase read buffer, add disposal of ImageStream and FileStream, optimize for performance.
Updated build.xml to include language packs in release package under js/ folder.
Gears/BrowserPlus: Add support for * file filter.
BeforeUpload now can cancel upload if required.
Additional MIME types: text/csv, image/photoshop, video/x-ms-wmv, video/avi, video/webm support
Additional language packs: Japanese
Cleaned examples.
Version 1.4.3.2 (2011-04-13)
Fixed bug in HTML5 runtime, when was reduced by a factor of 100 after every upload.
Version 1.4.3.1 (2011-04-12)
Fixed build script, mistakenly populating jquery.plupload.queue directory from jquery.ui.plupload sources.
Fixed script urls in all examples, build script now will alter them automatically from dev to release when needed.
Fixed isEmptyObj undefined error in HTML4 runtime.
Fixed bug in UI Widget preventing UploadComplete from triggering.
Version 1.4.3 (2011-04-11)
Added Latvian language pack and updated French.
Fixed bug in Flash runtime when JPEG header was not investigated deep enough to reach SOFn marker in large images.
Fixed bug, when PNGs were cropped to width in Flash runtimes, rather then resized.
Fixed Flash to allow multiple uploading of the same file, with different settings.
Fixed Flash runtime to clean anonymous listeners properly.
Fixed HTML5 runtime to resolve to mimeType in case-insensitive way.
Fixed HTML5/Flash/SilverLight/Gears runtimes for inconsistency in naming of chunks feature, comparing to other runtimes.
Fixed HTML4/HTML5 runtimes for input[type=file] to outsize contaner effectively enough to fill the whole click area.
Fixed all runtimes to preserve position (relative/absolute) rule on containers that already have it.
Fixed SilverLight runtime to support large files (over 2GB).
Restructured the examples, src and build scripts to make it more clear that jQuery is optional.
Added support for *.* filter.
Added support for preserving ICC and IPTC headers when resizing JPEGs.
Added Image.onerror/onabort handlers to HTML5 in order to gracefully bypass faulty images.
Added ability to drop image size (by lowering quality), while preserving original dimension (HTML5/Flash/Gears).
Ported EXIF, ICC, IPTC preservation code to Flash runtime.
Version 1.4.2 (2011-02-20)
Added Brazilian Portuguese, German, Russian and Spanish translations.
Added support for file_data_name option to SilverLight runtime.
Added support for better quality image resizing to Flash runtime.
Added support for properly handling images with dimensions up to 8191x8191 pixels to Flash runtime.
Added 'updatelist' event to UI Widget, which will be triggered every time file list will get redrawn.
Added support for dynamically changing options to UI Widget.
Fixed HTML4 runtime bug, when UploadFile handler was attached twice.
Fixed HTML5 to use FileReader.readAsBinaryString() instead of File.getAsBinary() on newer WebKit browsers (like Chrome 9).
Fixed Flash runtime from sending duplicate Filename param, when using FileReference.upload().
Updated S3 example to illustrate support for a proper progress indication.
Version 1.4.1 (2011-02-01)
Added an example on how to use Plupload with Amazon S3 written in PHP but can easily be ported to other languages.
Fixed bug where hidden input elements wasn't created when the multiple_queues option wasn't used.
Fixed bug where FF4 would produce an exception about missing BlobBuilder.
Version 1.4.0 (2011-01-26)
Added removeEvent and removeAllEvents methods and modified addEvent accordingly, in order to support dynamic unload.
Added unbindAll method.
Added UploadComplete event, which fires when internal iterator reaches the end of the queue.
Added public destroy method to plupload object, new event - Destroy, and corresponding handlers to all runtimes.
Added Czech, Italian, French, Dutch translations.
Added support for translatable error messages.
Added two new options: browse_button_hover and browse_button_active, in order to support browse_button interactivity.
Added support for 'multi_selection: false' to Silverlight runtime.
Added support for video/mp4, video/x-m4v and audio/mp4 MIME Types.
Added artificial sendAsBinary method to XMLHttpRequest.prototype for browsers that have support for BlobBuilder and typed arrays.
Added version tracking variable into plupload object and version comment to the header of every file.
Fixed measurements of browse_button element in order to size and position input[type=file] element to fit it fully.
Fixed Flash runtime behavior for multiple_select=false and other simpleUpload usage cases: basically new FileReference has to be created for every select dialog.
Fixed browser sniffer to match only Safari, for fakeSafariDragDrop (seems like Safari on Mac doesn't require it either).
Fixed so that ExternalInterface escapes strings properly, before passing them to JS.
Fixed eventual reinitialization of flash/silverlight runtimes, especially for cases when object wrapper needed to be programmatically hidden and then shown again.
Fixed so that Plupload will now ignore files with duplicate names when adding to the queue, in one set. Mainly introduced to work around Safari on Windows bug (https://bugs.webkit.org/show_bug.cgi?id=37957).
Fixed bug, when final UploadProgress was firing after FileUploaded for Flash simpleUpload.
Fixed bug where upload would fail if an error was produced inside the FilesAdded event.
Fixed bug in Flash runtime when it used a wrong size when resizing, but not chunking.
Fixed bug in Silverlight runtime that would keep sending 0 byte packages when a picture was chunked before resized.
Disabled blur filter (is going to be replaced with some bilinear resampling in next release).
Completely revised UI Widget, to be more jQuery UI oriented. Optionally depends on UI Button, UI Sortable, UI ProgressBar.
Version 1.3.0 (2010-11-24)
Added new jQuery UI widget that supports jQuery UI themes.
Added new multiple_queues option that enables you to upload multiple times in the queue widgets.
Added support for crossdomain loading of the XAP and SWF files and crossdomain upload.
Added new multiple_queues option that enables you to upload multiple times in the queue widgets.
Added support for crossdomain loading of the XAP and SWF files and crossdomain upload.
Added preinit/init options to to ease up the binding of custom events to queueWidget and the Uploader class.
Added drag/drop support for Safari until they fix the broken drag/drop support on Windows.
Added events example file that show how to bind all events and display event specific data.
Added support for retaining Exif data on images when they where resized using the HTML5 runtime.
Fixed logic issue with the upload.php example file. Chunking wasn't working correctly.
Fixed issue with HTML4 not handling the form encoding correctly on older IE versions. Patch contributed by jinxdone.
Fixed so the HTML4 runtime only submits the defined multipart_params arguments.
Fixes issue where it wasn't possible to dynamically override url or mutlipart_params for the HTML4 runtime.
Fixed so all runtimes pass the name, chunk and chunks parameters as multipart parameters instead of querystring parameters.
Fixed so files are read using the newer FileReader class if it's available if not it tries the older getAsXXX on Gecko.
Fixed bug where IE 9 beta 1 wouldn't render Silverlight properly.
Fixed bug where Flash would do extra empty requests if images below a specific size would be uploaded.
Fixed bug where Google Gears would resize and re-encode images even if the it wasn't changed in scale.
Fixed bug where the HTML5 runtime wouldn't free memory after each request on Gecko.
Version 1.2.4 (2010-09-08)
Added new BeforeUpload event to make it easier to override settings before a file is uploaded.
Added new automatic usage of FileReference in Flash if it's possible. Contributed by Marcel Jackwerth.
Added new chunking support for Chrome 5 and Firefox 3.6 using the HTML 5 runtime.
Added new multipart upload support for WebKit using the HTML 5 runtime and the FormData object.
Added new image scaling method for the Flash runtime contributed by rcoopman.
Added new alert error message if the user selected invalid files.
Added new automatic unique name generation to the example.php script. Contributed by Brandon Kelly.
Changed so the default upload method is multipart and the default chunk size is 0.
Fixed progress issue with the HTML5 runtime running on Gecko.
Fixed so longer extensions can be used such as .tar.gz.
Fixed so the file extension is retained when using the unique_names option.
Version 1.2.3 (2010-05-27)
Added new drag/drop support for HTML5 running on Chrome beta.
Added new multipart state for the features object. It's now possible to detect multipart support.
Added new getFeatures function to all runtime. Basic concept by Javier Martinez Fernandez.
Fixed bug where runtimes where initialized even if they didn't match the required_features setting.
Version 1.2.2.1 (2010-05-04)
Added new headers option, enables you to set custom headers for the upload requests.
Fixed bug where the file extension checking was case sensitive.
Version 1.2.2 (2010-04-26)
Added new file_data_name option that enables you to set the multipart file data param. Patch contributed by Alex Ganov.
Added new FILE_SIZE_ERROR type that will be triggered if the user selected a file that is to large or zero bytes.
Added new FILE_EXTENSION_ERROR type that will be triggered if you add a file with an invalid file extension.
Added new required_features setting, enables you to specify a list of required features that the runtime must have.
Fixed so the plupload.buildUrl function uses the UTF compatible encodeURIComponent method instead of escape.
Fixed so that all file types can be selected if you don't specify a filter setting.
Fixed so more valid HTTP status codes are accepted as valid responses.
Fixed so all runtimes fills the features object with available features.
Fixed some issues with the HTML4 runtime if there wasn't any existing forms on the page.
Fixed some conflict issues with HTML4 runtime and forms with the input names of action or target.
Fixed bug where some Gecko versions would produce exceptions when checking the HTTP status of a XHR.
Version 1.2.1 (2010-03-22)
Fixed bug with incorrect aspect ratio in Flash image scaling.
Fixed bug where chunked uploads could get scrambled in the Flash runtime. Patch contributed by Grady Werner.
Fixed bug where a beta version of Chrome wouldn't handle drag/drop correctly because of missing drag effect.
Fixed so the HTML 4 runtime displays N/A for file sizes and the progress is based on uploaded files instead of bytes.
Fixed so chunking can be disabled properly in Flash but that will affect the progress bar.
Fixed so queue widget displays the drag/drop message if file queue is emptied.
Fixed small files are uploaded as one single chunk and not forced into 4 chunks in the Flash runtime.
Version 1.2 (2010-03-09)
Added new rename file support for jQuery queue widget, click on a file name to rename it if it's enabled.
Added official ChunkUploaded event, it similar to FileUploaded but executed for each chunk.
Added bytes per second support to total queue progress.
Added better error handling to core API using the new Error event.
Added better error handling to jQuery queue widget.
Fixed so chunking uploads is dispatch from JS not from inside Flash/Silverlight.
Version 1.1.1 (2010-02-25)
Added new setup setting to queue widget. Makes it easier to bind custom events to uploader instance.
Fixed so it's possible to disable chunking compleatly. It's now disabled by default.
Fixed bug where multipart mode was enabled all the time in the Flash runtime.
Fixed bug where chunked uploading in Silverlight would fail.
Fixed bug where the delete button was visible while uploading.
Fixed bug where unique_names setting wasn't working when the core API was used.
Fixed bug where the queue widget wouldn't display the currently uploaded file if the unique_names was enabled.
Version 1.1 (2010-02-24)
Added new multipart and multipart_params support.
Added new container option, enables you to specify where flash/silverlight objects would be added.
Added chunking support to BrowserPlus runtime, contributed by Steve Spencer.
Added FileUploaded event that fires when a file is uploaded.
Added more easily understandable buttons to queue widget.
Added html4 runtime, contributed by Ryan Demmer.
Fixed issues with i18n support and added a Swedish and Danish language pack.
Fixed bug where the Flash runtime could do empty requests if the image was scaled down.
Fixed bug where uploading small images in Silverlight would produce an exception.
Fixed so the runtime list can include whitespace or missing runtimes. Patch contributed by Øyvind Sean Kinsey.
Fixed so to large files are ignored and never dispatched to the FilesAdded event.
Version 1.0 (2010-02-03)
First official release of Plupload.

View File

@ -1,5 +1,4 @@
/* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting */
/* global resize_width, resize_height, shortform */
/* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting, shortform */
var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init;
// progress and success handlers for media multi uploads
@ -43,11 +42,11 @@ function uploadProgress(up, file) {
// check to see if a large file failed to upload
function fileUploading( up, file ) {
var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
var hundredmb = 100 * 1024 * 1024,
max = parseInt( up.settings.max_file_size, 10 );
if ( max > hundredmb && file.size > hundredmb ) {
setTimeout( function() {
if ( file.status < 3 && file.loaded === 0 ) { // not uploading
wpFileError( file, pluploadL10n.big_upload_failed.replace( '%1$s', '<a class="uploader-html" href="#">' ).replace( '%2$s', '</a>' ) );
up.stop(); // stops the whole queue
@ -102,12 +101,17 @@ function uploadSuccess(fileObj, serverData) {
function setResize( arg ) {
if ( arg ) {
if ( uploader.features.jpgresize )
uploader.settings.resize = { width: resize_width, height: resize_height, quality: 100 };
else
uploader.settings.multipart_params.image_resize = true;
if ( window.resize_width && window.resize_height ) {
uploader.settings.resize = {
enabled: true,
width: window.resize_width,
height: window.resize_height,
quality: 100
};
} else {
uploader.settings.multipart_params.image_resize = true;
}
} else {
delete(uploader.settings.resize);
delete( uploader.settings.multipart_params.image_resize );
}
}
@ -299,7 +303,7 @@ function uploadError(fileObj, errorCode, message, uploader) {
wpQueueError(pluploadL10n.upload_failed);
break;
case plupload.IO_ERROR:
max = parseInt(uploader.settings.max_file_size, 10);
max = parseInt( uploader.settings.filters.max_file_size, 10 );
if ( max > hundredmb && fileObj.size > hundredmb )
wpFileError( fileObj, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>') );
@ -397,7 +401,7 @@ jQuery(document).ready(function($){
// init and set the uploader
uploader_init = function() {
uploader = new plupload.Uploader(wpUploaderInit);
//console.dir(uploader)
$('#image_resize').bind('change', function() {
var arg = $(this).prop('checked');
@ -411,7 +415,7 @@ jQuery(document).ready(function($){
uploader.bind('Init', function(up) {
var uploaddiv = $('#plupload-upload-ui');
window.console.dir('init...');window.console.dir(up);
setResize( getUserSetting('upload_resize', false) );
if ( up.features.dragdrop && ! $(document.body).hasClass('mobile') ) {
@ -433,15 +437,10 @@ jQuery(document).ready(function($){
uploader.init();
uploader.bind('FilesAdded', function( up, files ) {
var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
$('#media-upload-error').html('');
uploadStart();
plupload.each( files, function( file ) {
if ( max > hundredmb && file.size > hundredmb && up.runtime != 'html5' )
uploadSizeError( up, file, true );
else
fileQueued( file );
});
@ -449,8 +448,6 @@ jQuery(document).ready(function($){
up.start();
});
// uploader.bind('BeforeUpload', function(up, file) {});
uploader.bind('UploadFile', function(up, file) {
fileUploading(up, file);
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(function(d,a,b,c){function e(f){return a.getElementById(f)}b.runtimes.Html4=b.addRuntime("html4",{getFeatures:function(){return{multipart:true,triggerDialog:(b.ua.gecko&&d.FormData||b.ua.webkit)}},init:function(f,g){f.bind("Init",function(p){var j=a.body,n,h="javascript",k,x,q,z=[],r=/MSIE/.test(navigator.userAgent),t=[],m=p.settings.filters,o,l,s,w;no_type_restriction:for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(w=0;w<l.length;w++){if(l[w]==="*"){t=[];break no_type_restriction}s=b.mimeTypes[l[w]];if(s&&b.inArray(s,t)===-1){t.push(s)}}}t=t.join(",");function v(){var B,y,i,A;q=b.guid();z.push(q);B=a.createElement("form");B.setAttribute("id","form_"+q);B.setAttribute("method","post");B.setAttribute("enctype","multipart/form-data");B.setAttribute("encoding","multipart/form-data");B.setAttribute("target",p.id+"_iframe");B.style.position="absolute";y=a.createElement("input");y.setAttribute("id","input_"+q);y.setAttribute("type","file");y.setAttribute("accept",t);y.setAttribute("size",1);A=e(p.settings.browse_button);if(p.features.triggerDialog&&A){b.addEvent(e(p.settings.browse_button),"click",function(C){if(!y.disabled){y.click()}C.preventDefault()},p.id)}b.extend(y.style,{width:"100%",height:"100%",opacity:0,fontSize:"99px",cursor:"pointer"});b.extend(B.style,{overflow:"hidden"});i=p.settings.shim_bgcolor;if(i){B.style.background=i}if(r){b.extend(y.style,{filter:"alpha(opacity=0)"})}b.addEvent(y,"change",function(F){var D=F.target,C,E=[],G;if(D.value){e("form_"+q).style.top=-1048575+"px";C=D.value.replace(/\\/g,"/");C=C.substring(C.length,C.lastIndexOf("/")+1);E.push(new b.File(q,C));if(!p.features.triggerDialog){b.removeAllEvents(B,p.id)}else{b.removeEvent(A,"click",p.id)}b.removeEvent(y,"change",p.id);v();if(E.length){f.trigger("FilesAdded",E)}}},p.id);B.appendChild(y);j.appendChild(B);p.refresh()}function u(){var i=a.createElement("div");i.innerHTML='<iframe id="'+p.id+'_iframe" name="'+p.id+'_iframe" src="'+h+':&quot;&quot;" style="display:none"></iframe>';n=i.firstChild;j.appendChild(n);b.addEvent(n,"load",function(C){var D=C.target,B,y;if(!k){return}try{B=D.contentWindow.document||D.contentDocument||d.frames[D.id].document}catch(A){p.trigger("Error",{code:b.SECURITY_ERROR,message:b.translate("Security error."),file:k});return}y=B.documentElement.innerText||B.documentElement.textContent;if(y){k.status=b.DONE;k.loaded=1025;k.percent=100;p.trigger("UploadProgress",k);p.trigger("FileUploaded",k,{response:y})}},p.id)}if(p.settings.container){j=e(p.settings.container);if(b.getStyle(j,"position")==="static"){j.style.position="relative"}}p.bind("UploadFile",function(i,A){var B,y;if(A.status==b.DONE||A.status==b.FAILED||i.state==b.STOPPED){return}B=e("form_"+A.id);y=e("input_"+A.id);y.setAttribute("name",i.settings.file_data_name);B.setAttribute("action",i.settings.url);b.each(b.extend({name:A.target_name||A.name},i.settings.multipart_params),function(E,C){var D=a.createElement("input");b.extend(D,{type:"hidden",name:C,value:E});B.insertBefore(D,B.firstChild)});k=A;e("form_"+q).style.top=-1048575+"px";B.submit()});p.bind("FileUploaded",function(i){i.refresh()});p.bind("StateChanged",function(i){if(i.state==b.STARTED){u()}else{if(i.state==b.STOPPED){d.setTimeout(function(){b.removeEvent(n,"load",i.id);if(n.parentNode){n.parentNode.removeChild(n)}},0)}}b.each(i.files,function(A,y){if(A.status===b.DONE||A.status===b.FAILED){var B=e("form_"+A.id);if(B){B.parentNode.removeChild(B)}}})});p.bind("Refresh",function(y){var F,A,B,C,i,G,H,E,D;F=e(y.settings.browse_button);if(F){i=b.getPos(F,e(y.settings.container));G=b.getSize(F);H=e("form_"+q);E=e("input_"+q);b.extend(H.style,{top:i.y+"px",left:i.x+"px",width:G.w+"px",height:G.h+"px"});if(y.features.triggerDialog){if(b.getStyle(F,"position")==="static"){b.extend(F.style,{position:"relative"})}D=parseInt(F.style.zIndex,10);if(isNaN(D)){D=0}b.extend(F.style,{zIndex:D});b.extend(H.style,{zIndex:D-1})}B=y.settings.browse_button_hover;C=y.settings.browse_button_active;A=y.features.triggerDialog?F:H;if(B){b.addEvent(A,"mouseover",function(){b.addClass(F,B)},y.id);b.addEvent(A,"mouseout",function(){b.removeClass(F,B)},y.id)}if(C){b.addEvent(A,"mousedown",function(){b.addClass(F,C)},y.id);b.addEvent(a.body,"mouseup",function(){b.removeClass(F,C)},y.id)}}});f.bind("FilesRemoved",function(y,B){var A,C;for(A=0;A<B.length;A++){C=e("form_"+B[A].id);if(C){C.parentNode.removeChild(C)}}});f.bind("DisableBrowse",function(i,A){var y=a.getElementById("input_"+q);if(y){y.disabled=A}});f.bind("Destroy",function(i){var y,A,B,C={inputContainer:"form_"+q,inputFile:"input_"+q,browseButton:i.settings.browse_button};for(y in C){A=e(C[y]);if(A){b.removeAllEvents(A,i.id)}}b.removeAllEvents(a.body,i.id);b.each(z,function(E,D){B=e("form_"+E);if(B){B.parentNode.removeChild(B)}})});v()});g({success:true})}})})(window,document,plupload);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,9 @@ window.wp = window.wp || {};
( function( exports, $ ) {
var Uploader;
if ( typeof _wpPluploadSettings === 'undefined' )
if ( typeof _wpPluploadSettings === 'undefined' ) {
return;
}
/**
* An object that helps create a WordPress uploader using plupload.
@ -37,8 +38,9 @@ window.wp = window.wp || {};
this.supported = this.supports.upload;
if ( ! this.supported )
if ( ! this.supported ) {
return;
}
// Use deep extend to ensure that multipart_params and other objects are cloned.
this.plupload = $.extend( true, { multipart_params: {} }, Uploader.defaults );
@ -52,15 +54,17 @@ window.wp = window.wp || {};
// Proxy all methods so this always refers to the current instance.
for ( key in this ) {
if ( $.isFunction( this[ key ] ) )
if ( $.isFunction( this[ key ] ) ) {
this[ key ] = $.proxy( this[ key ], this );
}
}
// Ensure all elements are jQuery elements and have id attributes
// Then set the proper plupload arguments to the ids.
for ( key in elements ) {
if ( ! this[ key ] )
if ( ! this[ key ] ) {
continue;
}
this[ key ] = $( this[ key ] ).first();
@ -69,14 +73,17 @@ window.wp = window.wp || {};
continue;
}
if ( ! this[ key ].prop('id') )
if ( ! this[ key ].prop('id') ) {
this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ );
}
this.plupload[ elements[ key ] ] = this[ key ].prop('id');
}
// If the uploader has neither a browse button nor a dropzone, bail.
if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) )
if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) {
return;
}
this.uploader = new plupload.Uploader( this.plupload );
delete this.plupload;
@ -86,8 +93,9 @@ window.wp = window.wp || {};
delete this.params;
error = function( message, data, file ) {
if ( file.attachment )
if ( file.attachment ) {
file.attachment.destroy();
}
Uploader.errors.unshift({
message: message || pluploadL10n.default_error,
@ -98,30 +106,33 @@ window.wp = window.wp || {};
self.error( message, data, file );
};
this.uploader.init();
this.uploader.bind( 'init', function( uploader ) {
var timer, active, dragdrop,
dropzone = self.dropzone;
this.supports.dragdrop = this.uploader.features.dragdrop && ! Uploader.browser.mobile;
dragdrop = self.supports.dragdrop = uploader.features.dragdrop && ! Uploader.browser.mobile;
// Generate drag/drop helper classes.
(function( dropzone, supported ) {
var timer, active;
if ( ! dropzone )
if ( ! dropzone ) {
return;
}
dropzone.toggleClass( 'supports-drag-drop', !! supported );
dropzone.toggleClass( 'supports-drag-drop', !! dragdrop );
if ( ! supported )
if ( ! dragdrop ) {
return dropzone.unbind('.wp-uploader');
}
// 'dragenter' doesn't fire correctly,
// simulate it with a limited 'dragover'
dropzone.bind( 'dragover.wp-uploader', function() {
if ( timer )
if ( timer ) {
clearTimeout( timer );
}
if ( active )
if ( active ) {
return;
}
dropzone.trigger('dropzone:enter').addClass('drag-over');
active = true;
@ -138,7 +149,9 @@ window.wp = window.wp || {};
dropzone.trigger('dropzone:leave').removeClass('drag-over');
}, 0 );
});
}( this.dropzone, this.supports.dragdrop ));
});
this.uploader.init();
if ( this.browser ) {
this.browser.on( 'mouseenter', this.refresh );
@ -153,8 +166,9 @@ window.wp = window.wp || {};
var attributes, image;
// Ignore failed uploads.
if ( plupload.FAILED === file.status )
if ( plupload.FAILED === file.status ) {
return;
}
// Generate attributes for a new `Attachment` model.
attributes = _.extend({
@ -234,8 +248,11 @@ window.wp = window.wp || {};
for ( key in Uploader.errorMap ) {
if ( pluploadError.code === plupload[ key ] ) {
message = Uploader.errorMap[ key ];
if ( _.isFunction( message ) )
if ( _.isFunction( message ) ) {
message = message( pluploadError.file, pluploadError );
}
break;
}
}
@ -282,8 +299,9 @@ window.wp = window.wp || {};
* Sets values for a map of data.
*/
param: function( key, value ) {
if ( arguments.length === 1 && typeof key === 'string' )
if ( arguments.length === 1 && typeof key === 'string' ) {
return this.uploader.settings.multipart_params[ key ];
}
if ( arguments.length > 1 ) {
this.uploader.settings.multipart_params[ key ] = value;

View File

@ -1 +1 @@
window.wp=window.wp||{},function(a,b){var c;"undefined"!=typeof _wpPluploadSettings&&(c=function(a){var d,e,f=this,g={container:"container",browser:"browse_button",dropzone:"drop_element"};if(this.supports={upload:c.browser.supported},this.supported=this.supports.upload,this.supported){this.plupload=b.extend(!0,{multipart_params:{}},c.defaults),this.container=document.body,b.extend(!0,this,a);for(d in this)b.isFunction(this[d])&&(this[d]=b.proxy(this[d],this));for(d in g)this[d]&&(this[d]=b(this[d]).first(),this[d].length?(this[d].prop("id")||this[d].prop("id","__wp-uploader-id-"+c.uuid++),this.plupload[g[d]]=this[d].prop("id")):delete this[d]);(this.browser&&this.browser.length||this.dropzone&&this.dropzone.length)&&(this.uploader=new plupload.Uploader(this.plupload),delete this.plupload,this.param(this.params||{}),delete this.params,e=function(a,b,d){d.attachment&&d.attachment.destroy(),c.errors.unshift({message:a||pluploadL10n.default_error,data:b,file:d}),f.error(a,b,d)},this.uploader.init(),this.supports.dragdrop=this.uploader.features.dragdrop&&!c.browser.mobile,function(a,b){var c,d;if(a){if(a.toggleClass("supports-drag-drop",!!b),!b)return a.unbind(".wp-uploader");a.bind("dragover.wp-uploader",function(){c&&clearTimeout(c),d||(a.trigger("dropzone:enter").addClass("drag-over"),d=!0)}),a.bind("dragleave.wp-uploader, drop.wp-uploader",function(){c=setTimeout(function(){d=!1,a.trigger("dropzone:leave").removeClass("drag-over")},0)})}}(this.dropzone,this.supports.dragdrop),this.browser?this.browser.on("mouseenter",this.refresh):(this.uploader.disableBrowse(!0),b("#"+this.uploader.id+"_html5_container").hide()),this.uploader.bind("FilesAdded",function(a,b){_.each(b,function(a){var b,d;plupload.FAILED!==a.status&&(b=_.extend({file:a,uploading:!0,date:new Date,filename:a.name,menuOrder:0,uploadedTo:wp.media.model.settings.post.id},_.pick(a,"loaded","size","percent")),d=/(?:jpe?g|png|gif)$/i.exec(a.name),d&&(b.type="image",b.subtype="jpg"===d[0]?"jpeg":d[0]),a.attachment=wp.media.model.Attachment.create(b),c.queue.add(a.attachment),f.added(a.attachment))}),a.refresh(),a.start()}),this.uploader.bind("UploadProgress",function(a,b){b.attachment.set(_.pick(b,"loaded","percent")),f.progress(b.attachment)}),this.uploader.bind("FileUploaded",function(a,b,d){var g;try{d=JSON.parse(d.response)}catch(h){return e(pluploadL10n.default_error,h,b)}return!_.isObject(d)||_.isUndefined(d.success)?e(pluploadL10n.default_error,null,b):d.success?(_.each(["file","loaded","size","percent"],function(a){b.attachment.unset(a)}),b.attachment.set(_.extend(d.data,{uploading:!1})),wp.media.model.Attachment.get(d.data.id,b.attachment),g=c.queue.all(function(a){return!a.get("uploading")}),g&&c.queue.reset(),void f.success(b.attachment)):e(d.data&&d.data.message,d.data,b)}),this.uploader.bind("Error",function(a,b){var d,f=pluploadL10n.default_error;for(d in c.errorMap)if(b.code===plupload[d]){f=c.errorMap[d],_.isFunction(f)&&(f=f(b.file,b));break}e(f,b,b.file),a.refresh()}),this.init())}},b.extend(c,_wpPluploadSettings),c.uuid=0,c.errorMap={FAILED:pluploadL10n.upload_failed,FILE_EXTENSION_ERROR:pluploadL10n.invalid_filetype,IMAGE_FORMAT_ERROR:pluploadL10n.not_an_image,IMAGE_MEMORY_ERROR:pluploadL10n.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:pluploadL10n.image_dimensions_exceeded,GENERIC_ERROR:pluploadL10n.upload_failed,IO_ERROR:pluploadL10n.io_error,HTTP_ERROR:pluploadL10n.http_error,SECURITY_ERROR:pluploadL10n.security_error,FILE_SIZE_ERROR:function(a){return pluploadL10n.file_exceeds_size_limit.replace("%s",a.name)}},b.extend(c.prototype,{param:function(a,c){return 1===arguments.length&&"string"==typeof a?this.uploader.settings.multipart_params[a]:void(arguments.length>1?this.uploader.settings.multipart_params[a]=c:b.extend(this.uploader.settings.multipart_params,a))},init:function(){},error:function(){},success:function(){},added:function(){},progress:function(){},complete:function(){},refresh:function(){var a,c,d,e;if(this.browser){for(a=this.browser[0];a;){if(a===document.body){c=!0;break}a=a.parentNode}c||(e="wp-uploader-browser-"+this.uploader.id,d=b("#"+e),d.length||(d=b('<div class="wp-uploader-browser" />').css({position:"fixed",top:"-1000px",left:"-1000px",height:0,width:0}).attr("id","wp-uploader-browser-"+this.uploader.id).appendTo("body")),d.append(this.browser))}this.uploader.refresh()}}),c.queue=new wp.media.model.Attachments([],{query:!1}),c.errors=new Backbone.Collection,a.Uploader=c)}(wp,jQuery);
window.wp=window.wp||{},function(a,b){var c;"undefined"!=typeof _wpPluploadSettings&&(c=function(a){var d,e,f=this,g={container:"container",browser:"browse_button",dropzone:"drop_element"};if(this.supports={upload:c.browser.supported},this.supported=this.supports.upload,this.supported){this.plupload=b.extend(!0,{multipart_params:{}},c.defaults),this.container=document.body,b.extend(!0,this,a);for(d in this)b.isFunction(this[d])&&(this[d]=b.proxy(this[d],this));for(d in g)this[d]&&(this[d]=b(this[d]).first(),this[d].length?(this[d].prop("id")||this[d].prop("id","__wp-uploader-id-"+c.uuid++),this.plupload[g[d]]=this[d].prop("id")):delete this[d]);(this.browser&&this.browser.length||this.dropzone&&this.dropzone.length)&&(this.uploader=new plupload.Uploader(this.plupload),delete this.plupload,this.param(this.params||{}),delete this.params,e=function(a,b,d){d.attachment&&d.attachment.destroy(),c.errors.unshift({message:a||pluploadL10n.default_error,data:b,file:d}),f.error(a,b,d)},this.uploader.bind("init",function(a){var b,d,e,g=f.dropzone;if(e=f.supports.dragdrop=a.features.dragdrop&&!c.browser.mobile,g){if(g.toggleClass("supports-drag-drop",!!e),!e)return g.unbind(".wp-uploader");g.bind("dragover.wp-uploader",function(){b&&clearTimeout(b),d||(g.trigger("dropzone:enter").addClass("drag-over"),d=!0)}),g.bind("dragleave.wp-uploader, drop.wp-uploader",function(){b=setTimeout(function(){d=!1,g.trigger("dropzone:leave").removeClass("drag-over")},0)})}}),this.uploader.init(),this.browser?this.browser.on("mouseenter",this.refresh):(this.uploader.disableBrowse(!0),b("#"+this.uploader.id+"_html5_container").hide()),this.uploader.bind("FilesAdded",function(a,b){_.each(b,function(a){var b,d;plupload.FAILED!==a.status&&(b=_.extend({file:a,uploading:!0,date:new Date,filename:a.name,menuOrder:0,uploadedTo:wp.media.model.settings.post.id},_.pick(a,"loaded","size","percent")),d=/(?:jpe?g|png|gif)$/i.exec(a.name),d&&(b.type="image",b.subtype="jpg"===d[0]?"jpeg":d[0]),a.attachment=wp.media.model.Attachment.create(b),c.queue.add(a.attachment),f.added(a.attachment))}),a.refresh(),a.start()}),this.uploader.bind("UploadProgress",function(a,b){b.attachment.set(_.pick(b,"loaded","percent")),f.progress(b.attachment)}),this.uploader.bind("FileUploaded",function(a,b,d){var g;try{d=JSON.parse(d.response)}catch(h){return e(pluploadL10n.default_error,h,b)}return!_.isObject(d)||_.isUndefined(d.success)?e(pluploadL10n.default_error,null,b):d.success?(_.each(["file","loaded","size","percent"],function(a){b.attachment.unset(a)}),b.attachment.set(_.extend(d.data,{uploading:!1})),wp.media.model.Attachment.get(d.data.id,b.attachment),g=c.queue.all(function(a){return!a.get("uploading")}),g&&c.queue.reset(),void f.success(b.attachment)):e(d.data&&d.data.message,d.data,b)}),this.uploader.bind("Error",function(a,b){var d,f=pluploadL10n.default_error;for(d in c.errorMap)if(b.code===plupload[d]){f=c.errorMap[d],_.isFunction(f)&&(f=f(b.file,b));break}e(f,b,b.file),a.refresh()}),this.init())}},b.extend(c,_wpPluploadSettings),c.uuid=0,c.errorMap={FAILED:pluploadL10n.upload_failed,FILE_EXTENSION_ERROR:pluploadL10n.invalid_filetype,IMAGE_FORMAT_ERROR:pluploadL10n.not_an_image,IMAGE_MEMORY_ERROR:pluploadL10n.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:pluploadL10n.image_dimensions_exceeded,GENERIC_ERROR:pluploadL10n.upload_failed,IO_ERROR:pluploadL10n.io_error,HTTP_ERROR:pluploadL10n.http_error,SECURITY_ERROR:pluploadL10n.security_error,FILE_SIZE_ERROR:function(a){return pluploadL10n.file_exceeds_size_limit.replace("%s",a.name)}},b.extend(c.prototype,{param:function(a,c){return 1===arguments.length&&"string"==typeof a?this.uploader.settings.multipart_params[a]:void(arguments.length>1?this.uploader.settings.multipart_params[a]=c:b.extend(this.uploader.settings.multipart_params,a))},init:function(){},error:function(){},success:function(){},added:function(){},progress:function(){},complete:function(){},refresh:function(){var a,c,d,e;if(this.browser){for(a=this.browser[0];a;){if(a===document.body){c=!0;break}a=a.parentNode}c||(e="wp-uploader-browser-"+this.uploader.id,d=b("#"+e),d.length||(d=b('<div class="wp-uploader-browser" />').css({position:"fixed",top:"-1000px",left:"-1000px",height:0,width:0}).attr("id","wp-uploader-browser-"+this.uploader.id).appendTo("body")),d.append(this.browser))}this.uploader.refresh()}}),c.queue=new wp.media.model.Attachments([],{query:!1}),c.errors=new Backbone.Collection,a.Uploader=c)}(wp,jQuery);

View File

@ -99,13 +99,6 @@ function wp_print_media_templates() {
printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($byte_sizes[$u]) );
?></p>
<?php if ( ( $GLOBALS['is_IE'] || $GLOBALS['is_opera']) && $max_upload_size > 100 * 1024 * 1024 ) :
$browser_uploader = admin_url( 'media-new.php?browser-uploader&post_id=' ) . '{{ data.postId }}';
?>
<p class="big-file-warning"><?php printf( __( 'Your browser has some limitations uploading large files with the multi-file uploader. Please use the <a href="%1$s" target="%2$s">browser uploader</a> for files over 100MB.' ),
$browser_uploader, '_blank' ); ?></p>
<?php endif; ?>
<?php
/** This action is documented in wp-admin/includes/media.php */
do_action( 'post-upload-ui' ); ?>

View File

@ -2053,16 +2053,14 @@ function wp_plupload_default_settings() {
$max_upload_size = wp_max_upload_size();
$defaults = array(
'runtimes' => 'html5,silverlight,flash,html4',
'runtimes' => 'flash,html4', // html5,silverlight,
'file_data_name' => 'async-upload', // key passed to $_FILE.
'multiple_queues' => true,
'max_file_size' => $max_upload_size . 'b',
'url' => admin_url( 'async-upload.php', 'relative' ),
'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
'filters' => array( array( 'title' => __( 'Allowed Files' ), 'extensions' => '*') ),
'multipart' => true,
'urlstream_upload' => true,
'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ),
'silverlight_xap_url' => includes_url( 'js/plupload/Moxie.xap' ),
'filters' => array(
'max_file_size' => $max_upload_size . 'b',
),
);
// Multi-file uploading doesn't currently work in iOS Safari,

View File

@ -250,14 +250,9 @@ function wp_default_scripts( &$scripts ) {
'error_uploading' => __('&#8220;%s&#8221; has failed to upload.')
);
$scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.js', array(), '1.5.7' );
$scripts->add( 'plupload-html5', '/wp-includes/js/plupload/plupload.html5.js', array('plupload'), '1.5.7' );
$scripts->add( 'plupload-flash', '/wp-includes/js/plupload/plupload.flash.js', array('plupload'), '1.5.7' );
$scripts->add( 'plupload-silverlight', '/wp-includes/js/plupload/plupload.silverlight.js', array('plupload'), '1.5.7' );
$scripts->add( 'plupload-html4', '/wp-includes/js/plupload/plupload.html4.js', array('plupload'), '1.5.7' );
// cannot use the plupload.full.js, as it loads browserplus init JS from Yahoo
$scripts->add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.5.7' );
// Back compat
$scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.1' );
$scripts->add( 'plupload-all', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.1' );
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery') );
did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );