diff --git a/wp-includes/images/upload.png b/wp-includes/images/upload.png
new file mode 100644
index 0000000000..74c6f12f0b
Binary files /dev/null and b/wp-includes/images/upload.png differ
diff --git a/wp-includes/js/swfupload/handlers.js b/wp-includes/js/swfupload/handlers.js
index e1049eb298..8842f13195 100644
--- a/wp-includes/js/swfupload/handlers.js
+++ b/wp-includes/js/swfupload/handlers.js
@@ -205,6 +205,14 @@ function fileDialogComplete(num_files_queued) {
}
}
+function swfuploadPreLoad() {
+ return true;
+}
+
+function swfuploadLoadFailed() {
+ return true;
+}
+
function uploadError(fileObj, error_code, message) {
// first the file specific error
if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) {
diff --git a/wp-includes/js/swfupload/plugins/swfupload.cookies.js b/wp-includes/js/swfupload/plugins/swfupload.cookies.js
index 4d41612df3..dd3b78bbcf 100644
--- a/wp-includes/js/swfupload/plugins/swfupload.cookies.js
+++ b/wp-includes/js/swfupload/plugins/swfupload.cookies.js
@@ -8,42 +8,45 @@
var SWFUpload;
if (typeof(SWFUpload) === "function") {
- SWFUpload.prototype.initSettings = function (old_initSettings) {
- return function (init_settings) {
- if (typeof(old_initSettings) === "function") {
- old_initSettings.call(this, init_settings);
+ SWFUpload.prototype.initSettings = function (oldInitSettings) {
+ return function () {
+ if (typeof(oldInitSettings) === "function") {
+ oldInitSettings.call(this);
}
this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
};
}(SWFUpload.prototype.initSettings);
- // refreshes the post_params and updates SWFUpload. The send_to_flash parameters is optional and defaults to True
- SWFUpload.prototype.refreshCookies = function (send_to_flash) {
- if (send_to_flash !== false) send_to_flash = true;
+ // refreshes the post_params and updates SWFUpload. The sendToFlash parameters is optional and defaults to True
+ SWFUpload.prototype.refreshCookies = function (sendToFlash) {
+ if (sendToFlash === undefined) {
+ sendToFlash = true;
+ }
+ sendToFlash = !!sendToFlash;
// Get the post_params object
- var post_params = this.getSetting("post_params");
+ var postParams = this.settings.post_params;
// Get the cookies
- var i, cookie_array = document.cookie.split(';'), ca_length = cookie_array.length, c, eq_index, name, value;
- for(i = 0; i < ca_length; i++) {
- c = cookie_array[i];
+ var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
+ for (i = 0; i < caLength; i++) {
+ c = cookieArray[i];
// Left Trim spaces
- while (c.charAt(0) == " ") {
+ while (c.charAt(0) === " ") {
c = c.substring(1, c.length);
}
- eq_index = c.indexOf("=");
- if (eq_index > 0) {
- name = c.substring(0, eq_index);
- value = c.substring(eq_index+1);
- post_params[name] = value;
+ eqIndex = c.indexOf("=");
+ if (eqIndex > 0) {
+ name = c.substring(0, eqIndex);
+ value = c.substring(eqIndex + 1);
+ postParams[name] = value;
}
}
- if (send_to_flash) {
- this.setPostParams(post_params);
+ if (sendToFlash) {
+ this.setPostParams(postParams);
}
};
diff --git a/wp-includes/js/swfupload/plugins/swfupload.queue.js b/wp-includes/js/swfupload/plugins/swfupload.queue.js
index 9752e282d2..b04d87acf4 100644
--- a/wp-includes/js/swfupload/plugins/swfupload.queue.js
+++ b/wp-includes/js/swfupload/plugins/swfupload.queue.js
@@ -2,9 +2,12 @@
Queue Plug-in
Features:
- cancelQueue method for cancelling the entire queue.
- All queued files are uploaded when startUpload() is called.
- If false is returned from uploadComplete then the queue upload is stopped. If false is not returned (strict comparison) then the queue upload is continued.
+ *Adds a cancelQueue() method for cancelling the entire queue.
+ *All queued files are uploaded when startUpload() is called.
+ *If false is returned from uploadComplete then the queue upload is stopped.
+ If false is not returned (strict comparison) then the queue upload is continued.
+ *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
+ Set the event handler with the queue_complete_handler setting.
*/
@@ -12,47 +15,63 @@ var SWFUpload;
if (typeof(SWFUpload) === "function") {
SWFUpload.queue = {};
- SWFUpload.prototype.initSettings = function (old_initSettings) {
- return function (init_settings) {
- if (typeof(old_initSettings) === "function") {
- old_initSettings.call(this, init_settings);
+ SWFUpload.prototype.initSettings = (function (oldInitSettings) {
+ return function () {
+ if (typeof(oldInitSettings) === "function") {
+ oldInitSettings.call(this);
}
this.customSettings.queue_cancelled_flag = false;
+ this.customSettings.queue_upload_count = 0;
- this.addSetting("user_upload_complete_handler", init_settings.upload_complete_handler, SWFUpload.uploadComplete);
- this.uploadComplete_handler = SWFUpload.queue.uploadComplete;
+ this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
+ this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
+
+ this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
};
- }(SWFUpload.prototype.initSettings);
+ })(SWFUpload.prototype.initSettings);
+
+ SWFUpload.prototype.startUpload = function (fileID) {
+ this.customSettings.queue_cancelled_flag = false;
+ this.callFlash("StartUpload", false, [fileID]);
+ };
SWFUpload.prototype.cancelQueue = function () {
- var stats = this.getStats();
- this.customSettings.queue_cancelled_flag = false;
-
- if (stats.in_progress > 0) {
- this.customSettings.queue_cancelled_flag = true;
- }
+ this.customSettings.queue_cancelled_flag = true;
+ this.stopUpload();
- while(stats.files_queued > 0) {
+ var stats = this.getStats();
+ while (stats.files_queued > 0) {
this.cancelUpload();
stats = this.getStats();
}
};
- SWFUpload.queue.uploadComplete = function (file) {
- var user_upload_complete_handler = this.getSetting("user_upload_complete_handler");
- var continue_upload = true;
+ SWFUpload.queue.uploadCompleteHandler = function (file) {
+ var user_upload_complete_handler = this.settings.user_upload_complete_handler;
+ var continueUpload;
+
+ if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
+ this.customSettings.queue_upload_count++;
+ }
+
if (typeof(user_upload_complete_handler) === "function") {
- continue_upload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+ continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+ } else {
+ continueUpload = true;
}
- if (continue_upload) {
+ if (continueUpload) {
var stats = this.getStats();
if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
this.startUpload();
+ } else if (this.customSettings.queue_cancelled_flag === false) {
+ this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
+ this.customSettings.queue_upload_count = 0;
} else {
this.customSettings.queue_cancelled_flag = false;
+ this.customSettings.queue_upload_count = 0;
}
}
};
-}
+}
\ No newline at end of file
diff --git a/wp-includes/js/swfupload/plugins/swfupload.swfobject.js b/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
new file mode 100644
index 0000000000..9d6c3d87df
--- /dev/null
+++ b/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
@@ -0,0 +1,110 @@
+/*
+ SWFUpload.SWFObject Plugin
+
+ Summary:
+ This plugin uses SWFObject to embed SWFUpload dynamically in the page. SWFObject provides accurate Flash Player detection and DOM Ready loading.
+ This plugin replaces the Graceful Degradation plugin.
+
+ Features:
+ * swfupload_load_failed_hander event
+ * swfupload_pre_load_handler event
+ * minimum_flash_version setting (default: "9.0.28")
+ * SWFUpload.onload event for early loading
+
+ Usage:
+ Provide handlers and settings as needed. When using the SWFUpload.SWFObject plugin you should initialize SWFUploading
+ in SWFUpload.onload rather than in window.onload. When initialized this way SWFUpload can load earlier preventing the UI flicker
+ that was seen using the Graceful Degradation plugin.
+
+
+
+ Notes:
+ You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8.
+ The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met. Other issues such as missing SWF files, browser bugs
+ or corrupt Flash Player installations will not trigger this event.
+ The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found. It does not wait for SWFUpload to load and can
+ be used to prepare the SWFUploadUI and hide alternate content.
+ swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser.
+ Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made.
+*/
+
+
+/* SWFObject v2.0 rc4
+ Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
+ This software is released under the MIT License
+*/
+var swfobject=function(){var X="undefined",P="object",a="visibility:visible",e="visibility:hidden",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",V="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,S=false,C=false;var Y=function(){var l=typeof g.getElementById!=X&&typeof g.getElementsByTagName!=X&&typeof g.createElement!=X&&typeof g.appendChild!=X&&typeof g.replaceChild!=X&&typeof g.removeChild!=X&&typeof g.cloneNode!=X,t=[0,0,0],n=null;if(typeof N.plugins!=X&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=X){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var d=function(){if(!Y.w3cdom){return }J(I);if(Y.ie&&Y.win){try{g.write("