Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/plupload
File: wp-plupload.js
/* global pluploadL10n, plupload, _wpPluploadSettings */
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* @namespace wp
[3] Fix | Delete
*/
[4] Fix | Delete
window.wp = window.wp || {};
[5] Fix | Delete
[6] Fix | Delete
( function( exports, $ ) {
[7] Fix | Delete
var Uploader;
[8] Fix | Delete
[9] Fix | Delete
if ( typeof _wpPluploadSettings === 'undefined' ) {
[10] Fix | Delete
return;
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* A WordPress uploader.
[15] Fix | Delete
*
[16] Fix | Delete
* The Plupload library provides cross-browser uploader UI integration.
[17] Fix | Delete
* This object bridges the Plupload API to integrate uploads into the
[18] Fix | Delete
* WordPress back end and the WordPress media experience.
[19] Fix | Delete
*
[20] Fix | Delete
* @class
[21] Fix | Delete
* @memberOf wp
[22] Fix | Delete
* @alias wp.Uploader
[23] Fix | Delete
*
[24] Fix | Delete
* @param {object} options The options passed to the new plupload instance.
[25] Fix | Delete
* @param {object} options.container The id of uploader container.
[26] Fix | Delete
* @param {object} options.browser The id of button to trigger the file select.
[27] Fix | Delete
* @param {object} options.dropzone The id of file drop target.
[28] Fix | Delete
* @param {object} options.plupload An object of parameters to pass to the plupload instance.
[29] Fix | Delete
* @param {object} options.params An object of parameters to pass to $_POST when uploading the file.
[30] Fix | Delete
* Extends this.plupload.multipart_params under the hood.
[31] Fix | Delete
*/
[32] Fix | Delete
Uploader = function( options ) {
[33] Fix | Delete
var self = this,
[34] Fix | Delete
isIE, // Not used, back-compat.
[35] Fix | Delete
elements = {
[36] Fix | Delete
container: 'container',
[37] Fix | Delete
browser: 'browse_button',
[38] Fix | Delete
dropzone: 'drop_element'
[39] Fix | Delete
},
[40] Fix | Delete
tryAgainCount = {},
[41] Fix | Delete
tryAgain,
[42] Fix | Delete
key,
[43] Fix | Delete
error,
[44] Fix | Delete
fileUploaded;
[45] Fix | Delete
[46] Fix | Delete
this.supports = {
[47] Fix | Delete
upload: Uploader.browser.supported
[48] Fix | Delete
};
[49] Fix | Delete
[50] Fix | Delete
this.supported = this.supports.upload;
[51] Fix | Delete
[52] Fix | Delete
if ( ! this.supported ) {
[53] Fix | Delete
return;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
// Arguments to send to pluplad.Uploader().
[57] Fix | Delete
// Use deep extend to ensure that multipart_params and other objects are cloned.
[58] Fix | Delete
this.plupload = $.extend( true, { multipart_params: {} }, Uploader.defaults );
[59] Fix | Delete
this.container = document.body; // Set default container.
[60] Fix | Delete
[61] Fix | Delete
/*
[62] Fix | Delete
* Extend the instance with options.
[63] Fix | Delete
*
[64] Fix | Delete
* Use deep extend to allow options.plupload to override individual
[65] Fix | Delete
* default plupload keys.
[66] Fix | Delete
*/
[67] Fix | Delete
$.extend( true, this, options );
[68] Fix | Delete
[69] Fix | Delete
// Proxy all methods so this always refers to the current instance.
[70] Fix | Delete
for ( key in this ) {
[71] Fix | Delete
if ( typeof this[ key ] === 'function' ) {
[72] Fix | Delete
this[ key ] = $.proxy( this[ key ], this );
[73] Fix | Delete
}
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
// Ensure all elements are jQuery elements and have id attributes,
[77] Fix | Delete
// then set the proper plupload arguments to the ids.
[78] Fix | Delete
for ( key in elements ) {
[79] Fix | Delete
if ( ! this[ key ] ) {
[80] Fix | Delete
continue;
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
this[ key ] = $( this[ key ] ).first();
[84] Fix | Delete
[85] Fix | Delete
if ( ! this[ key ].length ) {
[86] Fix | Delete
delete this[ key ];
[87] Fix | Delete
continue;
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
if ( ! this[ key ].prop('id') ) {
[91] Fix | Delete
this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ );
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
this.plupload[ elements[ key ] ] = this[ key ].prop('id');
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
// If the uploader has neither a browse button nor a dropzone, bail.
[98] Fix | Delete
if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) {
[99] Fix | Delete
return;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
// Initialize the plupload instance.
[103] Fix | Delete
this.uploader = new plupload.Uploader( this.plupload );
[104] Fix | Delete
delete this.plupload;
[105] Fix | Delete
[106] Fix | Delete
// Set default params and remove this.params alias.
[107] Fix | Delete
this.param( this.params || {} );
[108] Fix | Delete
delete this.params;
[109] Fix | Delete
[110] Fix | Delete
/**
[111] Fix | Delete
* Attempt to create image sub-sizes when an image was uploaded successfully
[112] Fix | Delete
* but the server responded with HTTP 5xx error.
[113] Fix | Delete
*
[114] Fix | Delete
* @since 5.3.0
[115] Fix | Delete
*
[116] Fix | Delete
* @param {string} message Error message.
[117] Fix | Delete
* @param {object} data Error data from Plupload.
[118] Fix | Delete
* @param {plupload.File} file File that was uploaded.
[119] Fix | Delete
*/
[120] Fix | Delete
tryAgain = function( message, data, file ) {
[121] Fix | Delete
var times, id;
[122] Fix | Delete
[123] Fix | Delete
if ( ! data || ! data.responseHeaders ) {
[124] Fix | Delete
error( pluploadL10n.http_error_image, data, file, 'no-retry' );
[125] Fix | Delete
return;
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
id = data.responseHeaders.match( /x-wp-upload-attachment-id:\s*(\d+)/i );
[129] Fix | Delete
[130] Fix | Delete
if ( id && id[1] ) {
[131] Fix | Delete
id = id[1];
[132] Fix | Delete
} else {
[133] Fix | Delete
error( pluploadL10n.http_error_image, data, file, 'no-retry' );
[134] Fix | Delete
return;
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
times = tryAgainCount[ file.id ];
[138] Fix | Delete
[139] Fix | Delete
if ( times && times > 4 ) {
[140] Fix | Delete
/*
[141] Fix | Delete
* The file may have been uploaded and attachment post created,
[142] Fix | Delete
* but post-processing and resizing failed...
[143] Fix | Delete
* Do a cleanup then tell the user to scale down the image and upload it again.
[144] Fix | Delete
*/
[145] Fix | Delete
$.ajax({
[146] Fix | Delete
type: 'post',
[147] Fix | Delete
url: ajaxurl,
[148] Fix | Delete
dataType: 'json',
[149] Fix | Delete
data: {
[150] Fix | Delete
action: 'media-create-image-subsizes',
[151] Fix | Delete
_wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce,
[152] Fix | Delete
attachment_id: id,
[153] Fix | Delete
_wp_upload_failed_cleanup: true,
[154] Fix | Delete
}
[155] Fix | Delete
});
[156] Fix | Delete
[157] Fix | Delete
error( message, data, file, 'no-retry' );
[158] Fix | Delete
return;
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if ( ! times ) {
[162] Fix | Delete
tryAgainCount[ file.id ] = 1;
[163] Fix | Delete
} else {
[164] Fix | Delete
tryAgainCount[ file.id ] = ++times;
[165] Fix | Delete
}
[166] Fix | Delete
[167] Fix | Delete
// Another request to try to create the missing image sub-sizes.
[168] Fix | Delete
$.ajax({
[169] Fix | Delete
type: 'post',
[170] Fix | Delete
url: ajaxurl,
[171] Fix | Delete
dataType: 'json',
[172] Fix | Delete
data: {
[173] Fix | Delete
action: 'media-create-image-subsizes',
[174] Fix | Delete
_wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce,
[175] Fix | Delete
attachment_id: id,
[176] Fix | Delete
}
[177] Fix | Delete
}).done( function( response ) {
[178] Fix | Delete
if ( response.success ) {
[179] Fix | Delete
fileUploaded( self.uploader, file, response );
[180] Fix | Delete
} else {
[181] Fix | Delete
if ( response.data && response.data.message ) {
[182] Fix | Delete
message = response.data.message;
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
error( message, data, file, 'no-retry' );
[186] Fix | Delete
}
[187] Fix | Delete
}).fail( function( jqXHR ) {
[188] Fix | Delete
// If another HTTP 5xx error, try try again...
[189] Fix | Delete
if ( jqXHR.status >= 500 && jqXHR.status < 600 ) {
[190] Fix | Delete
tryAgain( message, data, file );
[191] Fix | Delete
return;
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
error( message, data, file, 'no-retry' );
[195] Fix | Delete
});
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
/**
[199] Fix | Delete
* Custom error callback.
[200] Fix | Delete
*
[201] Fix | Delete
* Add a new error to the errors collection, so other modules can track
[202] Fix | Delete
* and display errors. @see wp.Uploader.errors.
[203] Fix | Delete
*
[204] Fix | Delete
* @param {string} message Error message.
[205] Fix | Delete
* @param {object} data Error data from Plupload.
[206] Fix | Delete
* @param {plupload.File} file File that was uploaded.
[207] Fix | Delete
* @param {string} retry Whether to try again to create image sub-sizes. Passing 'no-retry' will prevent it.
[208] Fix | Delete
*/
[209] Fix | Delete
error = function( message, data, file, retry ) {
[210] Fix | Delete
var isImage = file.type && file.type.indexOf( 'image/' ) === 0,
[211] Fix | Delete
status = data && data.status;
[212] Fix | Delete
[213] Fix | Delete
// If the file is an image and the error is HTTP 5xx try to create sub-sizes again.
[214] Fix | Delete
if ( retry !== 'no-retry' && isImage && status >= 500 && status < 600 ) {
[215] Fix | Delete
tryAgain( message, data, file );
[216] Fix | Delete
return;
[217] Fix | Delete
}
[218] Fix | Delete
[219] Fix | Delete
if ( file.attachment ) {
[220] Fix | Delete
file.attachment.destroy();
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
Uploader.errors.unshift({
[224] Fix | Delete
message: message || pluploadL10n.default_error,
[225] Fix | Delete
data: data,
[226] Fix | Delete
file: file
[227] Fix | Delete
});
[228] Fix | Delete
[229] Fix | Delete
self.error( message, data, file );
[230] Fix | Delete
};
[231] Fix | Delete
[232] Fix | Delete
/**
[233] Fix | Delete
* After a file is successfully uploaded, update its model.
[234] Fix | Delete
*
[235] Fix | Delete
* @param {plupload.Uploader} up Uploader instance.
[236] Fix | Delete
* @param {plupload.File} file File that was uploaded.
[237] Fix | Delete
* @param {Object} response Object with response properties.
[238] Fix | Delete
*/
[239] Fix | Delete
fileUploaded = function( up, file, response ) {
[240] Fix | Delete
var complete;
[241] Fix | Delete
[242] Fix | Delete
// Remove the "uploading" UI elements.
[243] Fix | Delete
_.each( ['file','loaded','size','percent'], function( key ) {
[244] Fix | Delete
file.attachment.unset( key );
[245] Fix | Delete
} );
[246] Fix | Delete
[247] Fix | Delete
file.attachment.set( _.extend( response.data, { uploading: false } ) );
[248] Fix | Delete
[249] Fix | Delete
wp.media.model.Attachment.get( response.data.id, file.attachment );
[250] Fix | Delete
[251] Fix | Delete
complete = Uploader.queue.all( function( attachment ) {
[252] Fix | Delete
return ! attachment.get( 'uploading' );
[253] Fix | Delete
});
[254] Fix | Delete
[255] Fix | Delete
if ( complete ) {
[256] Fix | Delete
Uploader.queue.reset();
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
self.success( file.attachment );
[260] Fix | Delete
}
[261] Fix | Delete
[262] Fix | Delete
/**
[263] Fix | Delete
* After the Uploader has been initialized, initialize some behaviors for the dropzone.
[264] Fix | Delete
*
[265] Fix | Delete
* @param {plupload.Uploader} uploader Uploader instance.
[266] Fix | Delete
*/
[267] Fix | Delete
this.uploader.bind( 'init', function( uploader ) {
[268] Fix | Delete
var timer, active, dragdrop,
[269] Fix | Delete
dropzone = self.dropzone;
[270] Fix | Delete
[271] Fix | Delete
dragdrop = self.supports.dragdrop = uploader.features.dragdrop && ! Uploader.browser.mobile;
[272] Fix | Delete
[273] Fix | Delete
// Generate drag/drop helper classes.
[274] Fix | Delete
if ( ! dropzone ) {
[275] Fix | Delete
return;
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
dropzone.toggleClass( 'supports-drag-drop', !! dragdrop );
[279] Fix | Delete
[280] Fix | Delete
if ( ! dragdrop ) {
[281] Fix | Delete
return dropzone.unbind('.wp-uploader');
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
// 'dragenter' doesn't fire correctly, simulate it with a limited 'dragover'.
[285] Fix | Delete
dropzone.on( 'dragover.wp-uploader', function() {
[286] Fix | Delete
if ( timer ) {
[287] Fix | Delete
clearTimeout( timer );
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
if ( active ) {
[291] Fix | Delete
return;
[292] Fix | Delete
}
[293] Fix | Delete
[294] Fix | Delete
dropzone.trigger('dropzone:enter').addClass('drag-over');
[295] Fix | Delete
active = true;
[296] Fix | Delete
});
[297] Fix | Delete
[298] Fix | Delete
dropzone.on('dragleave.wp-uploader, drop.wp-uploader', function() {
[299] Fix | Delete
/*
[300] Fix | Delete
* Using an instant timer prevents the drag-over class
[301] Fix | Delete
* from being quickly removed and re-added when elements
[302] Fix | Delete
* inside the dropzone are repositioned.
[303] Fix | Delete
*
[304] Fix | Delete
* @see https://core.trac.wordpress.org/ticket/21705
[305] Fix | Delete
*/
[306] Fix | Delete
timer = setTimeout( function() {
[307] Fix | Delete
active = false;
[308] Fix | Delete
dropzone.trigger('dropzone:leave').removeClass('drag-over');
[309] Fix | Delete
}, 0 );
[310] Fix | Delete
});
[311] Fix | Delete
[312] Fix | Delete
self.ready = true;
[313] Fix | Delete
$(self).trigger( 'uploader:ready' );
[314] Fix | Delete
});
[315] Fix | Delete
[316] Fix | Delete
this.uploader.bind( 'postinit', function( up ) {
[317] Fix | Delete
up.refresh();
[318] Fix | Delete
self.init();
[319] Fix | Delete
});
[320] Fix | Delete
[321] Fix | Delete
this.uploader.init();
[322] Fix | Delete
[323] Fix | Delete
if ( this.browser ) {
[324] Fix | Delete
this.browser.on( 'mouseenter', this.refresh );
[325] Fix | Delete
} else {
[326] Fix | Delete
this.uploader.disableBrowse( true );
[327] Fix | Delete
}
[328] Fix | Delete
[329] Fix | Delete
$( self ).on( 'uploader:ready', function() {
[330] Fix | Delete
$( '.moxie-shim-html5 input[type="file"]' )
[331] Fix | Delete
.attr( {
[332] Fix | Delete
tabIndex: '-1',
[333] Fix | Delete
'aria-hidden': 'true'
[334] Fix | Delete
} );
[335] Fix | Delete
} );
[336] Fix | Delete
[337] Fix | Delete
/**
[338] Fix | Delete
* After files were filtered and added to the queue, create a model for each.
[339] Fix | Delete
*
[340] Fix | Delete
* @param {plupload.Uploader} up Uploader instance.
[341] Fix | Delete
* @param {Array} files Array of file objects that were added to queue by the user.
[342] Fix | Delete
*/
[343] Fix | Delete
this.uploader.bind( 'FilesAdded', function( up, files ) {
[344] Fix | Delete
_.each( files, function( file ) {
[345] Fix | Delete
var attributes, image;
[346] Fix | Delete
[347] Fix | Delete
// Ignore failed uploads.
[348] Fix | Delete
if ( plupload.FAILED === file.status ) {
[349] Fix | Delete
return;
[350] Fix | Delete
}
[351] Fix | Delete
[352] Fix | Delete
if ( file.type === 'image/heic' && up.settings.heic_upload_error ) {
[353] Fix | Delete
// Show error but do not block uploading.
[354] Fix | Delete
Uploader.errors.unshift({
[355] Fix | Delete
message: pluploadL10n.unsupported_image,
[356] Fix | Delete
data: {},
[357] Fix | Delete
file: file
[358] Fix | Delete
});
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
// Generate attributes for a new `Attachment` model.
[362] Fix | Delete
attributes = _.extend({
[363] Fix | Delete
file: file,
[364] Fix | Delete
uploading: true,
[365] Fix | Delete
date: new Date(),
[366] Fix | Delete
filename: file.name,
[367] Fix | Delete
menuOrder: 0,
[368] Fix | Delete
uploadedTo: wp.media.model.settings.post.id
[369] Fix | Delete
}, _.pick( file, 'loaded', 'size', 'percent' ) );
[370] Fix | Delete
[371] Fix | Delete
// Handle early mime type scanning for images.
[372] Fix | Delete
image = /(?:jpe?g|png|gif)$/i.exec( file.name );
[373] Fix | Delete
[374] Fix | Delete
// For images set the model's type and subtype attributes.
[375] Fix | Delete
if ( image ) {
[376] Fix | Delete
attributes.type = 'image';
[377] Fix | Delete
[378] Fix | Delete
// `jpeg`, `png` and `gif` are valid subtypes.
[379] Fix | Delete
// `jpg` is not, so map it to `jpeg`.
[380] Fix | Delete
attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0];
[381] Fix | Delete
}
[382] Fix | Delete
[383] Fix | Delete
// Create a model for the attachment, and add it to the Upload queue collection
[384] Fix | Delete
// so listeners to the upload queue can track and display upload progress.
[385] Fix | Delete
file.attachment = wp.media.model.Attachment.create( attributes );
[386] Fix | Delete
Uploader.queue.add( file.attachment );
[387] Fix | Delete
[388] Fix | Delete
self.added( file.attachment );
[389] Fix | Delete
});
[390] Fix | Delete
[391] Fix | Delete
up.refresh();
[392] Fix | Delete
up.start();
[393] Fix | Delete
});
[394] Fix | Delete
[395] Fix | Delete
this.uploader.bind( 'UploadProgress', function( up, file ) {
[396] Fix | Delete
file.attachment.set( _.pick( file, 'loaded', 'percent' ) );
[397] Fix | Delete
self.progress( file.attachment );
[398] Fix | Delete
});
[399] Fix | Delete
[400] Fix | Delete
/**
[401] Fix | Delete
* After a file is successfully uploaded, update its model.
[402] Fix | Delete
*
[403] Fix | Delete
* @param {plupload.Uploader} up Uploader instance.
[404] Fix | Delete
* @param {plupload.File} file File that was uploaded.
[405] Fix | Delete
* @param {Object} response Object with response properties.
[406] Fix | Delete
* @return {mixed}
[407] Fix | Delete
*/
[408] Fix | Delete
this.uploader.bind( 'FileUploaded', function( up, file, response ) {
[409] Fix | Delete
[410] Fix | Delete
try {
[411] Fix | Delete
response = JSON.parse( response.response );
[412] Fix | Delete
} catch ( e ) {
[413] Fix | Delete
return error( pluploadL10n.default_error, e, file );
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
if ( ! _.isObject( response ) || _.isUndefined( response.success ) ) {
[417] Fix | Delete
return error( pluploadL10n.default_error, null, file );
[418] Fix | Delete
} else if ( ! response.success ) {
[419] Fix | Delete
return error( response.data && response.data.message, response.data, file );
[420] Fix | Delete
}
[421] Fix | Delete
[422] Fix | Delete
// Success. Update the UI with the new attachment.
[423] Fix | Delete
fileUploaded( up, file, response );
[424] Fix | Delete
});
[425] Fix | Delete
[426] Fix | Delete
/**
[427] Fix | Delete
* When plupload surfaces an error, send it to the error handler.
[428] Fix | Delete
*
[429] Fix | Delete
* @param {plupload.Uploader} up Uploader instance.
[430] Fix | Delete
* @param {Object} pluploadError Contains code, message and sometimes file and other details.
[431] Fix | Delete
*/
[432] Fix | Delete
this.uploader.bind( 'Error', function( up, pluploadError ) {
[433] Fix | Delete
var message = pluploadL10n.default_error,
[434] Fix | Delete
key;
[435] Fix | Delete
[436] Fix | Delete
// Check for plupload errors.
[437] Fix | Delete
for ( key in Uploader.errorMap ) {
[438] Fix | Delete
if ( pluploadError.code === plupload[ key ] ) {
[439] Fix | Delete
message = Uploader.errorMap[ key ];
[440] Fix | Delete
[441] Fix | Delete
if ( typeof message === 'function' ) {
[442] Fix | Delete
message = message( pluploadError.file, pluploadError );
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
break;
[446] Fix | Delete
}
[447] Fix | Delete
}
[448] Fix | Delete
[449] Fix | Delete
error( message, pluploadError, pluploadError.file );
[450] Fix | Delete
up.refresh();
[451] Fix | Delete
});
[452] Fix | Delete
[453] Fix | Delete
};
[454] Fix | Delete
[455] Fix | Delete
// Adds the 'defaults' and 'browser' properties.
[456] Fix | Delete
$.extend( Uploader, _wpPluploadSettings );
[457] Fix | Delete
[458] Fix | Delete
Uploader.uuid = 0;
[459] Fix | Delete
[460] Fix | Delete
// Map Plupload error codes to user friendly error messages.
[461] Fix | Delete
Uploader.errorMap = {
[462] Fix | Delete
'FAILED': pluploadL10n.upload_failed,
[463] Fix | Delete
'FILE_EXTENSION_ERROR': pluploadL10n.invalid_filetype,
[464] Fix | Delete
'IMAGE_FORMAT_ERROR': pluploadL10n.not_an_image,
[465] Fix | Delete
'IMAGE_MEMORY_ERROR': pluploadL10n.image_memory_exceeded,
[466] Fix | Delete
'IMAGE_DIMENSIONS_ERROR': pluploadL10n.image_dimensions_exceeded,
[467] Fix | Delete
'GENERIC_ERROR': pluploadL10n.upload_failed,
[468] Fix | Delete
'IO_ERROR': pluploadL10n.io_error,
[469] Fix | Delete
'SECURITY_ERROR': pluploadL10n.security_error,
[470] Fix | Delete
[471] Fix | Delete
'FILE_SIZE_ERROR': function( file ) {
[472] Fix | Delete
return pluploadL10n.file_exceeds_size_limit.replace( '%s', file.name );
[473] Fix | Delete
},
[474] Fix | Delete
[475] Fix | Delete
'HTTP_ERROR': function( file ) {
[476] Fix | Delete
if ( file.type && file.type.indexOf( 'image/' ) === 0 ) {
[477] Fix | Delete
return pluploadL10n.http_error_image;
[478] Fix | Delete
}
[479] Fix | Delete
[480] Fix | Delete
return pluploadL10n.http_error;
[481] Fix | Delete
},
[482] Fix | Delete
};
[483] Fix | Delete
[484] Fix | Delete
$.extend( Uploader.prototype, /** @lends wp.Uploader.prototype */{
[485] Fix | Delete
/**
[486] Fix | Delete
* Acts as a shortcut to extending the uploader's multipart_params object.
[487] Fix | Delete
*
[488] Fix | Delete
* param( key )
[489] Fix | Delete
* Returns the value of the key.
[490] Fix | Delete
*
[491] Fix | Delete
* param( key, value )
[492] Fix | Delete
* Sets the value of a key.
[493] Fix | Delete
*
[494] Fix | Delete
* param( map )
[495] Fix | Delete
* Sets values for a map of data.
[496] Fix | Delete
*/
[497] Fix | Delete
param: function( key, value ) {
[498] Fix | Delete
if ( arguments.length === 1 && typeof key === 'string' ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function