| 1 | Index: wp-admin/includes/file.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/file.php (revision 18463) |
|---|
| 4 | +++ wp-admin/includes/file.php (working copy) |
|---|
| 5 | @@ -322,12 +322,28 @@ |
|---|
| 6 | return call_user_func($upload_error_handler, $file, $uploads['error'] ); |
|---|
| 7 | |
|---|
| 8 | $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); |
|---|
| 9 | + |
|---|
| 10 | + // Temporary file for fixing EXIF rotation and performing scaling (if requested) |
|---|
| 11 | + $tmp_file = wp_tempnam($filename); |
|---|
| 12 | |
|---|
| 13 | // Move the file to the uploads dir |
|---|
| 14 | - $new_file = $uploads['path'] . "/$filename"; |
|---|
| 15 | - if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) |
|---|
| 16 | + if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) ) |
|---|
| 17 | return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); |
|---|
| 18 | |
|---|
| 19 | + // If a resize was requested, perform the resize. |
|---|
| 20 | + if ($resize) { |
|---|
| 21 | + $old_temp = $tmp_file; |
|---|
| 22 | + $tmp_file = image_resize( $tmp_file, (int) get_option('large_size_w'), (int) get_option('large_size_h'), 0, 'resized'); |
|---|
| 23 | + if ( ! is_wp_error($tmp_file) ) { |
|---|
| 24 | + unlink($old_temp); |
|---|
| 25 | + } |
|---|
| 26 | + } |
|---|
| 27 | + |
|---|
| 28 | + // Copy the temporary file into its destination |
|---|
| 29 | + $new_file = $uploads['path'] . "/$filename"; |
|---|
| 30 | + copy( $tmp_file, $new_file ); |
|---|
| 31 | + unlink($tmp_file); |
|---|
| 32 | + |
|---|
| 33 | // Set correct file permissions |
|---|
| 34 | $stat = stat( dirname( $new_file )); |
|---|
| 35 | $perms = $stat['mode'] & 0000666; |
|---|
| 36 | Index: wp-admin/includes/media.php |
|---|
| 37 | =================================================================== |
|---|
| 38 | --- wp-admin/includes/media.php (revision 18463) |
|---|
| 39 | +++ wp-admin/includes/media.php (working copy) |
|---|
| 40 | @@ -1437,14 +1437,8 @@ |
|---|
| 41 | function media_upload_form( $errors = null ) { |
|---|
| 42 | global $type, $tab, $pagenow; |
|---|
| 43 | |
|---|
| 44 | - $flash_action_url = admin_url('async-upload.php'); |
|---|
| 45 | + $upload_action_url = admin_url('async-upload.php'); |
|---|
| 46 | |
|---|
| 47 | - // If Mac and mod_security, no Flash. :( |
|---|
| 48 | - $flash = true; |
|---|
| 49 | - if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security') ) |
|---|
| 50 | - $flash = false; |
|---|
| 51 | - |
|---|
| 52 | - $flash = apply_filters('flash_uploader', $flash); |
|---|
| 53 | $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; |
|---|
| 54 | |
|---|
| 55 | $upload_size_unit = $max_upload_size = wp_max_upload_size(); |
|---|
| 56 | @@ -1458,15 +1452,6 @@ |
|---|
| 57 | $upload_size_unit = (int) $upload_size_unit; |
|---|
| 58 | } |
|---|
| 59 | ?> |
|---|
| 60 | -<script type="text/javascript"> |
|---|
| 61 | -//<![CDATA[ |
|---|
| 62 | -var uploaderMode = 0; |
|---|
| 63 | -jQuery(document).ready(function($){ |
|---|
| 64 | - uploaderMode = getUserSetting('uploader'); |
|---|
| 65 | - $('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;}); |
|---|
| 66 | - $('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;}); |
|---|
| 67 | -}); |
|---|
| 68 | -//]]> |
|---|
| 69 | </script> |
|---|
| 70 | <div id="media-upload-notice"> |
|---|
| 71 | <?php if (isset($errors['upload_notice']) ) { ?> |
|---|
| 72 | @@ -1487,9 +1472,7 @@ |
|---|
| 73 | |
|---|
| 74 | do_action('pre-upload-ui'); |
|---|
| 75 | |
|---|
| 76 | -if ( $flash ) : |
|---|
| 77 | - |
|---|
| 78 | -// Set the post params, which SWFUpload will post back with the file, and pass |
|---|
| 79 | +// Set the post params, which plupload will post back with the file, and pass |
|---|
| 80 | // them through a filter. |
|---|
| 81 | $post_params = array( |
|---|
| 82 | "post_id" => $post_id, |
|---|
| 83 | @@ -1500,94 +1483,108 @@ |
|---|
| 84 | "tab" => $tab, |
|---|
| 85 | "short" => "1", |
|---|
| 86 | ); |
|---|
| 87 | -$post_params = apply_filters( 'swfupload_post_params', $post_params ); |
|---|
| 88 | +$post_params = apply_filters( 'upload_post_params', $post_params ); |
|---|
| 89 | $p = array(); |
|---|
| 90 | foreach ( $post_params as $param => $val ) |
|---|
| 91 | $p[] = "\t\t'$param' : '$val'"; |
|---|
| 92 | $post_params_str = implode( ", \n", $p ); |
|---|
| 93 | |
|---|
| 94 | -// #8545. wmode=transparent cannot be used with SWFUpload |
|---|
| 95 | -if ( 'media-new.php' == $pagenow ) { |
|---|
| 96 | - $upload_image_path = get_user_option( 'admin_color' ); |
|---|
| 97 | - if ( 'classic' != $upload_image_path ) |
|---|
| 98 | - $upload_image_path = 'fresh'; |
|---|
| 99 | - $upload_image_path = admin_url( 'images/upload-' . $upload_image_path . '.png?ver=20101205' ); |
|---|
| 100 | -} else { |
|---|
| 101 | - $upload_image_path = includes_url( 'images/upload.png?ver=20100531' ); |
|---|
| 102 | -} |
|---|
| 103 | - |
|---|
| 104 | ?> |
|---|
| 105 | <script type="text/javascript"> |
|---|
| 106 | //<![CDATA[ |
|---|
| 107 | -var swfu; |
|---|
| 108 | -SWFUpload.onload = function() { |
|---|
| 109 | - var settings = { |
|---|
| 110 | - button_text: '<span class="button"><?php _e('Select Files'); ?><\/span>', |
|---|
| 111 | - button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646; }', |
|---|
| 112 | - button_height: "23", |
|---|
| 113 | - button_width: "132", |
|---|
| 114 | - button_text_top_padding: 3, |
|---|
| 115 | - button_image_url: '<?php echo $upload_image_path; ?>', |
|---|
| 116 | - button_placeholder_id: "flash-browse-button", |
|---|
| 117 | - upload_url : "<?php echo esc_attr( $flash_action_url ); ?>", |
|---|
| 118 | - flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>", |
|---|
| 119 | - file_post_name: "async-upload", |
|---|
| 120 | - file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>", |
|---|
| 121 | - post_params : { |
|---|
| 122 | - <?php echo $post_params_str; ?> |
|---|
| 123 | - }, |
|---|
| 124 | - file_size_limit : "<?php echo $max_upload_size; ?>b", |
|---|
| 125 | - file_dialog_start_handler : fileDialogStart, |
|---|
| 126 | - file_queued_handler : fileQueued, |
|---|
| 127 | - upload_start_handler : uploadStart, |
|---|
| 128 | - upload_progress_handler : uploadProgress, |
|---|
| 129 | - upload_error_handler : uploadError, |
|---|
| 130 | - upload_success_handler : <?php echo apply_filters( 'swfupload_success_handler', 'uploadSuccess' ); ?>, |
|---|
| 131 | - upload_complete_handler : uploadComplete, |
|---|
| 132 | - file_queue_error_handler : fileQueueError, |
|---|
| 133 | - file_dialog_complete_handler : fileDialogComplete, |
|---|
| 134 | - swfupload_pre_load_handler: swfuploadPreLoad, |
|---|
| 135 | - swfupload_load_failed_handler: swfuploadLoadFailed, |
|---|
| 136 | - custom_settings : { |
|---|
| 137 | - degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable |
|---|
| 138 | - swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available |
|---|
| 139 | - }, |
|---|
| 140 | - debug: false |
|---|
| 141 | - }; |
|---|
| 142 | - swfu = new SWFUpload(settings); |
|---|
| 143 | -}; |
|---|
| 144 | +var resize_mode = false; |
|---|
| 145 | +var resize_height = <?php echo get_option('large_size_h'); ?>, |
|---|
| 146 | + resize_width = <?php echo get_option('large_size_w'); ?>; |
|---|
| 147 | + |
|---|
| 148 | +jQuery(function($) { |
|---|
| 149 | + window.uploader = new plupload.Uploader({ |
|---|
| 150 | + runtimes: '<?php echo apply_filters('plupload_runtimes', 'html5,silverlight,flash,html4'); ?>', |
|---|
| 151 | + browse_button: 'plupload-browse-button', |
|---|
| 152 | + container: 'plupload-upload-ui', |
|---|
| 153 | + drop_element: 'wpwrap', |
|---|
| 154 | + file_data_name: 'async-upload', |
|---|
| 155 | + max_file_size: '<?php echo $max_upload_size / 1024; ?>kb', |
|---|
| 156 | + url: '<?php echo esc_attr( $upload_action_url ); ?>', |
|---|
| 157 | + plupload_swf_url: '<?php echo includes_url('js/plupload/plupload.plupload.swf'); ?>', |
|---|
| 158 | + silverlight_xap_url: '<?php echo includes_url('js/plupload/plupload.silverlight.xap'); ?>', |
|---|
| 159 | + filters: [ |
|---|
| 160 | + {title: "Allowed files", extensions: "<?php echo apply_filters('upload_file_glob', '*'); ?>"} |
|---|
| 161 | + ], |
|---|
| 162 | + multipart: true, |
|---|
| 163 | + multipart_params : { |
|---|
| 164 | + <?php echo $post_params_str; ?> |
|---|
| 165 | + } |
|---|
| 166 | + }); |
|---|
| 167 | + |
|---|
| 168 | + resize_mode = getUserSetting('resize_mode') == 'true'; |
|---|
| 169 | + setResize(resize_mode) |
|---|
| 170 | + $('#image_resize').bind('change', function() { |
|---|
| 171 | + setResize($(this).prop('checked')); |
|---|
| 172 | + }); |
|---|
| 173 | + |
|---|
| 174 | + uploader.init(); |
|---|
| 175 | + |
|---|
| 176 | + uploader.bind('FilesAdded', function(up, files) { |
|---|
| 177 | + $.each(files, function(i, file) { |
|---|
| 178 | + fileQueued(file); |
|---|
| 179 | + }); |
|---|
| 180 | + |
|---|
| 181 | + up.refresh(); |
|---|
| 182 | + up.start(); |
|---|
| 183 | + }); |
|---|
| 184 | + |
|---|
| 185 | + uploader.bind('BeforeUpload', function(up, file) { |
|---|
| 186 | + uploadStart(file); |
|---|
| 187 | + }); |
|---|
| 188 | + |
|---|
| 189 | + uploader.bind('UploadProgress', function(up, file) { |
|---|
| 190 | + uploadProgress(file, file.loaded, file.size); |
|---|
| 191 | + }); |
|---|
| 192 | + |
|---|
| 193 | + uploader.bind('Error', function(up, err) { |
|---|
| 194 | + uploadError(err.file, err.code, err.message); |
|---|
| 195 | + |
|---|
| 196 | + up.refresh(); |
|---|
| 197 | + }); |
|---|
| 198 | + |
|---|
| 199 | + uploader.bind('FileUploaded', function(up, file, response) { |
|---|
| 200 | + <?php echo apply_filters( 'plupload_success_handler', 'uploadSuccess' ); ?>(file, response.response); |
|---|
| 201 | + }); |
|---|
| 202 | + |
|---|
| 203 | +}); |
|---|
| 204 | //]]> |
|---|
| 205 | </script> |
|---|
| 206 | |
|---|
| 207 | -<div id="flash-upload-ui" class="hide-if-no-js"> |
|---|
| 208 | -<?php do_action('pre-flash-upload-ui'); ?> |
|---|
| 209 | +<div id="plupload-upload-ui" class="hide-if-no-js"> |
|---|
| 210 | +<?php do_action('pre-plupload-upload-ui'); ?> |
|---|
| 211 | |
|---|
| 212 | <div> |
|---|
| 213 | <?php _e( 'Choose files to upload' ); ?> |
|---|
| 214 | - <div id="flash-browse-button"></div> |
|---|
| 215 | + <span id="plupload-browse-button" class="button"><?php _e('Select Files'); ?></span> |
|---|
| 216 | <span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?>" class="button" /></span> |
|---|
| 217 | </div> |
|---|
| 218 | - <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p> |
|---|
| 219 | -<?php do_action('post-flash-upload-ui'); ?> |
|---|
| 220 | - <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> |
|---|
| 221 | +<?php do_action('post-plupload-upload-ui'); ?> |
|---|
| 222 | </div> |
|---|
| 223 | -<?php endif; // $flash ?> |
|---|
| 224 | |
|---|
| 225 | -<div id="html-upload-ui" <?php if ( $flash ) echo 'class="hide-if-js"'; ?>> |
|---|
| 226 | +<?php if ( !IFRAME_REQUEST ): ?> |
|---|
| 227 | +<div id="html-upload-ui" class="hide-if-js"> |
|---|
| 228 | <?php do_action('pre-html-upload-ui'); ?> |
|---|
| 229 | <p id="async-upload-wrap"> |
|---|
| 230 | <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label> |
|---|
| 231 | <input type="file" name="async-upload" id="async-upload" /> |
|---|
| 232 | <?php submit_button( __( 'Upload' ), 'button', 'html-upload', false ); ?> |
|---|
| 233 | - <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a> |
|---|
| 234 | + <a href="<?php echo admin_url('upload.php'); ?>"><?php _e('Cancel'); ?></a> |
|---|
| 235 | </p> |
|---|
| 236 | <div class="clear"></div> |
|---|
| 237 | - <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p> |
|---|
| 238 | - <?php if ( is_lighttpd_before_150() ): ?> |
|---|
| 239 | - <p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please update to lighttpd 1.5.'); ?></p> |
|---|
| 240 | - <?php endif;?> |
|---|
| 241 | -<?php do_action('post-html-upload-ui', $flash); ?> |
|---|
| 242 | +<?php do_action('post-html-upload-ui', $plupload); ?> |
|---|
| 243 | </div> |
|---|
| 244 | +<?php endif; ?> |
|---|
| 245 | + |
|---|
| 246 | +<input name="image_resize" type="checkbox" id="image_resize" value="1" /> |
|---|
| 247 | +<label for="image_resize"><?php printf( __( 'Resize images to %d x %d'), get_option('large_size_w'), get_option('large_size_h') ); ?></label> |
|---|
| 248 | +<p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p> |
|---|
| 249 | +<p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> |
|---|
| 250 | + |
|---|
| 251 | <?php do_action('post-upload-ui'); ?> |
|---|
| 252 | <?php |
|---|
| 253 | } |
|---|
| 254 | @@ -2272,69 +2269,17 @@ |
|---|
| 255 | /** |
|---|
| 256 | * {@internal Missing Short Description}} |
|---|
| 257 | * |
|---|
| 258 | - * Support a GET parameter for disabling the flash uploader. |
|---|
| 259 | - * |
|---|
| 260 | * @since 2.6.0 |
|---|
| 261 | - * |
|---|
| 262 | - * @param unknown_type $flash |
|---|
| 263 | - * @return unknown |
|---|
| 264 | */ |
|---|
| 265 | -function media_upload_use_flash($flash) { |
|---|
| 266 | - if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| 267 | - $flash = !empty($_REQUEST['flash']); |
|---|
| 268 | - return $flash; |
|---|
| 269 | +function media_upload_max_image_resize() { |
|---|
| 270 | +?> |
|---|
| 271 | +<input name="image_resize" type="checkbox" id="image_resize" value="1" /> |
|---|
| 272 | +<label for="image_resize"><?php printf( __( 'Resize images to %d x %d'), get_option('large_size_w'), get_option('large_size_h') ); ?></label> |
|---|
| 273 | +<?php |
|---|
| 274 | } |
|---|
| 275 | |
|---|
| 276 | -add_filter('flash_uploader', 'media_upload_use_flash'); |
|---|
| 277 | +add_action('post-upload-ui', 'media_upload_max_image_resize'); |
|---|
| 278 | |
|---|
| 279 | -/** |
|---|
| 280 | - * {@internal Missing Short Description}} |
|---|
| 281 | - * |
|---|
| 282 | - * @since 2.6.0 |
|---|
| 283 | - */ |
|---|
| 284 | -function media_upload_flash_bypass() { |
|---|
| 285 | - echo '<p class="upload-flash-bypass">'; |
|---|
| 286 | - printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), esc_url(add_query_arg('flash', 0)) ); |
|---|
| 287 | - echo '</p>'; |
|---|
| 288 | -} |
|---|
| 289 | - |
|---|
| 290 | -/** |
|---|
| 291 | - * {@internal Missing Short Description}} |
|---|
| 292 | - * |
|---|
| 293 | - * @since 2.6.0 |
|---|
| 294 | - */ |
|---|
| 295 | -function media_upload_html_bypass($flash = true) { |
|---|
| 296 | - echo '<p class="upload-html-bypass hide-if-no-js">'; |
|---|
| 297 | - _e('You are using the Browser uploader.'); |
|---|
| 298 | - if ( $flash ) { |
|---|
| 299 | - // the user manually selected the browser uploader, so let them switch back to Flash |
|---|
| 300 | - echo ' '; |
|---|
| 301 | - printf( __('Try the <a href="%s">Flash uploader</a> instead.'), esc_url(add_query_arg('flash', 1)) ); |
|---|
| 302 | - } |
|---|
| 303 | - echo "</p>\n"; |
|---|
| 304 | -} |
|---|
| 305 | - |
|---|
| 306 | -add_action('post-flash-upload-ui', 'media_upload_flash_bypass'); |
|---|
| 307 | -add_action('post-html-upload-ui', 'media_upload_html_bypass'); |
|---|
| 308 | - |
|---|
| 309 | -/** |
|---|
| 310 | - * {@internal Missing Short Description}} |
|---|
| 311 | - * |
|---|
| 312 | - * Make sure the GET parameter sticks when we submit a form. |
|---|
| 313 | - * |
|---|
| 314 | - * @since 2.6.0 |
|---|
| 315 | - * |
|---|
| 316 | - * @param unknown_type $url |
|---|
| 317 | - * @return unknown |
|---|
| 318 | - */ |
|---|
| 319 | -function media_upload_bypass_url($url) { |
|---|
| 320 | - if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| 321 | - $url = add_query_arg('flash', intval($_REQUEST['flash'])); |
|---|
| 322 | - return $url; |
|---|
| 323 | -} |
|---|
| 324 | - |
|---|
| 325 | -add_filter('media_upload_form_url', 'media_upload_bypass_url'); |
|---|
| 326 | - |
|---|
| 327 | add_filter('async_upload_image', 'get_media_item', 10, 2); |
|---|
| 328 | add_filter('async_upload_audio', 'get_media_item', 10, 2); |
|---|
| 329 | add_filter('async_upload_video', 'get_media_item', 10, 2); |
|---|
| 330 | Index: wp-admin/media-upload.php |
|---|
| 331 | =================================================================== |
|---|
| 332 | --- wp-admin/media-upload.php (revision 18463) |
|---|
| 333 | +++ wp-admin/media-upload.php (working copy) |
|---|
| 334 | @@ -18,8 +18,8 @@ |
|---|
| 335 | if (!current_user_can('upload_files')) |
|---|
| 336 | wp_die(__('You do not have permission to upload files.')); |
|---|
| 337 | |
|---|
| 338 | -wp_enqueue_script('swfupload-all'); |
|---|
| 339 | -wp_enqueue_script('swfupload-handlers'); |
|---|
| 340 | +wp_enqueue_script('plupload-full'); |
|---|
| 341 | +wp_enqueue_script('plupload-handlers'); |
|---|
| 342 | wp_enqueue_script('image-edit'); |
|---|
| 343 | wp_enqueue_script('set-post-thumbnail' ); |
|---|
| 344 | wp_enqueue_style('imgareaselect'); |
|---|
| 345 | Index: wp-includes/script-loader.php |
|---|
| 346 | =================================================================== |
|---|
| 347 | --- wp-includes/script-loader.php (revision 18463) |
|---|
| 348 | +++ wp-includes/script-loader.php (working copy) |
|---|
| 349 | @@ -206,30 +206,38 @@ |
|---|
| 350 | |
|---|
| 351 | $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8-20110113'); |
|---|
| 352 | |
|---|
| 353 | - $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.2'); |
|---|
| 354 | |
|---|
| 355 | - $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2201-20110113'); |
|---|
| 356 | - $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201a'); |
|---|
| 357 | - $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201'); |
|---|
| 358 | - $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201'); |
|---|
| 359 | + $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.js', false, '1.4.3.2'); |
|---|
| 360 | + $scripts->add( 'plupload-html5', '/wp-includes/js/plupload/plupload.html5.js', array('plupload'), '1.4.3.2'); |
|---|
| 361 | + $scripts->add( 'plupload-flash', '/wp-includes/js/plupload/plupload.flash.js', array('plupload'), '1.4.3.2'); |
|---|
| 362 | + $scripts->add( 'plupload-silverlight', '/wp-includes/js/plupload/plupload.silverlight.js', array('plupload'), '1.4.3.2'); |
|---|
| 363 | + $scripts->add( 'plupload-gears', '/wp-includes/js/plupload/plupload.gears.js', array('plupload'), '1.4.3.2'); |
|---|
| 364 | + $scripts->add( 'plupload-html4', '/wp-includes/js/plupload/plupload.html4.js', array('plupload'), '1.4.3.2'); |
|---|
| 365 | |
|---|
| 366 | - if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { |
|---|
| 367 | + // TODO: find out if we can use the plupload.full.js (it does load browserplus) |
|---|
| 368 | + $scripts->add( 'plupload-full', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-gears', 'plupload-html4'), '1.4.3.2'); |
|---|
| 369 | + |
|---|
| 370 | + $scripts->add( 'plupload-handlers', '/wp-includes/js/plupload/handlers.js', array('plupload-full', 'jquery'), '1.4.3.2'); |
|---|
| 371 | + |
|---|
| 372 | + // TODO: find out if we really need this debug clause with plupload |
|---|
| 373 | + /*if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { |
|---|
| 374 | // queue all SWFUpload scripts that are used by default |
|---|
| 375 | $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201'); |
|---|
| 376 | } else { |
|---|
| 377 | - $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201a'); |
|---|
| 378 | - } |
|---|
| 379 | + $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201'); |
|---|
| 380 | + }*/ |
|---|
| 381 | |
|---|
| 382 | - $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524'); |
|---|
| 383 | $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post; |
|---|
| 384 | if ( empty($max_upload_size) ) |
|---|
| 385 | $max_upload_size = __('not configured'); |
|---|
| 386 | // these error messages came from the sample swfupload js, they might need changing. |
|---|
| 387 | - $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array( |
|---|
| 388 | - 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), |
|---|
| 389 | + $scripts->localize( 'plupload-handlers', 'pluploadL10n', array( |
|---|
| 390 | 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'), |
|---|
| 391 | 'zero_byte_file' => __('This file is empty. Please try another.'), |
|---|
| 392 | 'invalid_filetype' => __('This file type is not allowed. Please try another.'), |
|---|
| 393 | + 'not_an_image' => __('This file is not an image. Please try another.'), |
|---|
| 394 | + 'image_memory_exceeded' => __('Memery exceeded. Please try another smaller file.'), |
|---|
| 395 | + 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'), |
|---|
| 396 | 'default_error' => __('An error occurred in the upload. Please try again later.'), |
|---|
| 397 | 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), |
|---|
| 398 | 'upload_limit_exceeded' => __('You may only upload 1 file.'), |
|---|
| 399 | @@ -243,7 +251,7 @@ |
|---|
| 400 | 'crunching' => __('Crunching…'), |
|---|
| 401 | 'deleted' => __('moved to the trash.'), |
|---|
| 402 | 'error_uploading' => __('“%s” has failed to upload due to an error'), |
|---|
| 403 | - 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};', |
|---|
| 404 | + 'l10n_print_after' => 'try{convertEntities(pluploadL10n);}catch(e){};', |
|---|
| 405 | ) ); |
|---|
| 406 | |
|---|
| 407 | $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102'); |
|---|