Changeset 27316
- Timestamp:
- 02/27/2014 08:00:55 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 added
- 7 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r27127 r27316 1761 1761 1762 1762 $plupload_init = array( 1763 'runtimes' => 'html5,silverlight,flash,html4', 1764 'browse_button' => 'plupload-browse-button', 1765 'container' => 'plupload-upload-ui', 1766 'drop_element' => 'drag-drop-area', 1767 'file_data_name' => 'async-upload', 1768 'multiple_queues' => true, 1769 'max_file_size' => $max_upload_size . 'b', 1770 'url' => $upload_action_url, 1771 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 1772 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 1773 'filters' => array( array('title' => __( 'Allowed Files' ), 'extensions' => '*') ), 1774 'multipart' => true, 1775 'urlstream_upload' => true, 1776 'multipart_params' => $post_params 1763 'runtimes' => 'html5,silverlight,flash,html4', 1764 'browse_button' => 'plupload-browse-button', 1765 'container' => 'plupload-upload-ui', 1766 'drop_element' => 'drag-drop-area', 1767 'file_data_name' => 'async-upload', 1768 'url' => $upload_action_url, 1769 'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ), 1770 'silverlight_xap_url' => includes_url( 'js/plupload/Moxie.xap' ), 1771 'filters' => array( 1772 'max_file_size' => $max_upload_size . 'b', 1773 ), 1774 'multipart_params' => $post_params, 1777 1775 ); 1778 1776 … … 1861 1859 <span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span> 1862 1860 <?php 1863 if ( ($is_IE || $is_opera) && $max_upload_size > 100 * 1024 * 1024 ) { ?>1864 <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>1865 <?php }1866 1861 1867 1862 /** -
trunk/src/wp-includes/js/plupload/handlers.js
r27243 r27316 1 /* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting */ 2 /* global resize_width, resize_height, shortform */ 1 /* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting, shortform */ 3 2 var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init; 4 3 … … 43 42 44 43 // check to see if a large file failed to upload 45 function fileUploading(up, file) { 46 var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10); 44 function fileUploading( up, file ) { 45 var hundredmb = 100 * 1024 * 1024, 46 max = parseInt( up.settings.max_file_size, 10 ); 47 47 48 48 if ( max > hundredmb && file.size > hundredmb ) { 49 setTimeout(function(){ 50 49 setTimeout( function() { 51 50 if ( file.status < 3 && file.loaded === 0 ) { // not uploading 52 wpFileError( file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));51 wpFileError( file, pluploadL10n.big_upload_failed.replace( '%1$s', '<a class="uploader-html" href="#">' ).replace( '%2$s', '</a>' ) ); 53 52 up.stop(); // stops the whole queue 54 up.removeFile( file);53 up.removeFile( file ); 55 54 up.start(); // restart the queue 56 55 } 57 }, 10000 ); // wait for 10 sec. for the file to start uploading56 }, 10000 ); // wait for 10 sec. for the file to start uploading 58 57 } 59 58 } … … 101 100 } 102 101 103 function setResize( arg) {102 function setResize( arg ) { 104 103 if ( arg ) { 105 if ( uploader.features.jpgresize ) 106 uploader.settings.resize = { width: resize_width, height: resize_height, quality: 100 }; 107 else 104 if ( window.resize_width && window.resize_height ) { 105 uploader.settings.resize = { 106 enabled: true, 107 width: window.resize_width, 108 height: window.resize_height, 109 quality: 100 110 }; 111 } else { 108 112 uploader.settings.multipart_params.image_resize = true; 113 } 109 114 } else { 110 delete(uploader.settings.resize); 111 delete(uploader.settings.multipart_params.image_resize); 115 delete( uploader.settings.multipart_params.image_resize ); 112 116 } 113 117 } … … 300 304 break; 301 305 case plupload.IO_ERROR: 302 max = parseInt( uploader.settings.max_file_size, 10);306 max = parseInt( uploader.settings.filters.max_file_size, 10 ); 303 307 304 308 if ( max > hundredmb && fileObj.size > hundredmb ) 305 wpFileError( fileObj, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));309 wpFileError( fileObj, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>') ); 306 310 else 307 311 wpQueueError(pluploadL10n.io_error); … … 398 402 uploader_init = function() { 399 403 uploader = new plupload.Uploader(wpUploaderInit); 400 404 //console.dir(uploader) 401 405 $('#image_resize').bind('change', function() { 402 406 var arg = $(this).prop('checked'); … … 412 416 uploader.bind('Init', function(up) { 413 417 var uploaddiv = $('#plupload-upload-ui'); 414 418 window.console.dir('init...');window.console.dir(up); 415 419 setResize( getUserSetting('upload_resize', false) ); 416 420 … … 433 437 uploader.init(); 434 438 435 uploader.bind('FilesAdded', function(up, files) { 436 var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10); 437 439 uploader.bind('FilesAdded', function( up, files ) { 438 440 $('#media-upload-error').html(''); 439 441 uploadStart(); 440 442 441 plupload.each(files, function(file){ 442 if ( max > hundredmb && file.size > hundredmb && up.runtime != 'html5' ) 443 uploadSizeError( up, file, true ); 444 else 445 fileQueued(file); 443 plupload.each( files, function( file ) { 444 fileQueued( file ); 446 445 }); 447 446 … … 449 448 up.start(); 450 449 }); 451 452 // uploader.bind('BeforeUpload', function(up, file) {});453 450 454 451 uploader.bind('UploadFile', function(up, file) { -
trunk/src/wp-includes/js/plupload/wp-plupload.js
r26213 r27316 3 3 window.wp = window.wp || {}; 4 4 5 ( function( exports, $ ) {5 ( function( exports, $ ) { 6 6 var Uploader; 7 7 8 if ( typeof _wpPluploadSettings === 'undefined' ) 8 if ( typeof _wpPluploadSettings === 'undefined' ) { 9 9 return; 10 } 10 11 11 12 /** … … 38 39 this.supported = this.supports.upload; 39 40 40 if ( ! this.supported ) 41 if ( ! this.supported ) { 41 42 return; 43 } 42 44 43 45 // Use deep extend to ensure that multipart_params and other objects are cloned. … … 53 55 // Proxy all methods so this always refers to the current instance. 54 56 for ( key in this ) { 55 if ( $.isFunction( this[ key ] ) ) 57 if ( $.isFunction( this[ key ] ) ) { 56 58 this[ key ] = $.proxy( this[ key ], this ); 59 } 57 60 } 58 61 … … 60 63 // Then set the proper plupload arguments to the ids. 61 64 for ( key in elements ) { 62 if ( ! this[ key ] ) 65 if ( ! this[ key ] ) { 63 66 continue; 67 } 64 68 65 69 this[ key ] = $( this[ key ] ).first(); … … 70 74 } 71 75 72 if ( ! this[ key ].prop('id') ) 76 if ( ! this[ key ].prop('id') ) { 73 77 this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ ); 78 } 79 74 80 this.plupload[ elements[ key ] ] = this[ key ].prop('id'); 75 81 } 76 82 77 83 // If the uploader has neither a browse button nor a dropzone, bail. 78 if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) 84 if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) { 79 85 return; 86 } 80 87 81 88 this.uploader = new plupload.Uploader( this.plupload ); … … 87 94 88 95 error = function( message, data, file ) { 89 if ( file.attachment ) 96 if ( file.attachment ) { 90 97 file.attachment.destroy(); 98 } 91 99 92 100 Uploader.errors.unshift({ … … 99 107 }; 100 108 101 this.uploader.init(); 102 103 this.supports.dragdrop = this.uploader.features.dragdrop && ! Uploader.browser.mobile; 104 105 // Generate drag/drop helper classes. 106 (function( dropzone, supported ) { 107 var timer, active; 108 109 if ( ! dropzone ) 109 this.uploader.bind( 'init', function( uploader ) { 110 var timer, active, dragdrop, 111 dropzone = self.dropzone; 112 113 dragdrop = self.supports.dragdrop = uploader.features.dragdrop && ! Uploader.browser.mobile; 114 115 // Generate drag/drop helper classes. 116 if ( ! dropzone ) { 110 117 return; 111 112 dropzone.toggleClass( 'supports-drag-drop', !! supported ); 113 114 if ( ! supported ) 118 } 119 120 dropzone.toggleClass( 'supports-drag-drop', !! dragdrop ); 121 122 if ( ! dragdrop ) { 115 123 return dropzone.unbind('.wp-uploader'); 124 } 116 125 117 126 // 'dragenter' doesn't fire correctly, 118 127 // simulate it with a limited 'dragover' 119 dropzone.bind( 'dragover.wp-uploader', function() {120 if ( timer ) 128 dropzone.bind( 'dragover.wp-uploader', function() { 129 if ( timer ) { 121 130 clearTimeout( timer ); 122 123 if ( active ) 131 } 132 133 if ( active ) { 124 134 return; 135 } 125 136 126 137 dropzone.trigger('dropzone:enter').addClass('drag-over'); … … 128 139 }); 129 140 130 dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function() {141 dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function() { 131 142 // Using an instant timer prevents the drag-over class from 132 143 // being quickly removed and re-added when elements inside the … … 139 150 }, 0 ); 140 151 }); 141 }( this.dropzone, this.supports.dragdrop )); 152 }); 153 154 this.uploader.init(); 142 155 143 156 if ( this.browser ) { … … 154 167 155 168 // Ignore failed uploads. 156 if ( plupload.FAILED === file.status ) 169 if ( plupload.FAILED === file.status ) { 157 170 return; 171 } 158 172 159 173 // Generate attributes for a new `Attachment` model. … … 235 249 if ( pluploadError.code === plupload[ key ] ) { 236 250 message = Uploader.errorMap[ key ]; 237 if ( _.isFunction( message ) ) 251 252 if ( _.isFunction( message ) ) { 238 253 message = message( pluploadError.file, pluploadError ); 254 } 255 239 256 break; 240 257 } … … 283 300 */ 284 301 param: function( key, value ) { 285 if ( arguments.length === 1 && typeof key === 'string' ) 302 if ( arguments.length === 1 && typeof key === 'string' ) { 286 303 return this.uploader.settings.multipart_params[ key ]; 304 } 287 305 288 306 if ( arguments.length > 1 ) { -
trunk/src/wp-includes/media-template.php
r27313 r27316 100 100 ?></p> 101 101 102 <?php if ( ( $GLOBALS['is_IE'] || $GLOBALS['is_opera']) && $max_upload_size > 100 * 1024 * 1024 ) :103 $browser_uploader = admin_url( 'media-new.php?browser-uploader&post_id=' ) . '{{ data.postId }}';104 ?>105 <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.' ),106 $browser_uploader, '_blank' ); ?></p>107 <?php endif; ?>108 109 102 <?php 110 103 /** This action is documented in wp-admin/includes/media.php */ -
trunk/src/wp-includes/media.php
r27312 r27316 2054 2054 2055 2055 $defaults = array( 2056 'runtimes' => ' html5,silverlight,flash,html4',2056 'runtimes' => 'flash,html4', // html5,silverlight, 2057 2057 'file_data_name' => 'async-upload', // key passed to $_FILE. 2058 'multiple_queues' => true,2059 'max_file_size' => $max_upload_size . 'b',2060 2058 'url' => admin_url( 'async-upload.php', 'relative' ), 2061 'flash_swf_url' => includes_url( 'js/plupload/ plupload.flash.swf' ),2062 'silverlight_xap_url' => includes_url( 'js/plupload/ plupload.silverlight.xap' ),2063 'filters' => array( array( 'title' => __( 'Allowed Files' ), 'extensions' => '*') ),2064 'multipart' => true,2065 'urlstream_upload' => true,2059 'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ), 2060 'silverlight_xap_url' => includes_url( 'js/plupload/Moxie.xap' ), 2061 'filters' => array( 2062 'max_file_size' => $max_upload_size . 'b', 2063 ), 2066 2064 ); 2067 2065 -
trunk/src/wp-includes/script-loader.php
r27303 r27316 251 251 ); 252 252 253 $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.js', array(), '1.5.7' ); 254 $scripts->add( 'plupload-html5', '/wp-includes/js/plupload/plupload.html5.js', array('plupload'), '1.5.7' ); 255 $scripts->add( 'plupload-flash', '/wp-includes/js/plupload/plupload.flash.js', array('plupload'), '1.5.7' ); 256 $scripts->add( 'plupload-silverlight', '/wp-includes/js/plupload/plupload.silverlight.js', array('plupload'), '1.5.7' ); 257 $scripts->add( 'plupload-html4', '/wp-includes/js/plupload/plupload.html4.js', array('plupload'), '1.5.7' ); 258 259 // cannot use the plupload.full.js, as it loads browserplus init JS from Yahoo 260 $scripts->add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.5.7' ); 253 // Back compat 254 $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.1' ); 255 $scripts->add( 'plupload-all', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.1' ); 261 256 262 257 $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery') );
Note: See TracChangeset
for help on using the changeset viewer.