Changeset 18484
- Timestamp:
- 07/29/2011 07:21:21 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/media.dev.css
r18406 r18484 169 169 } 170 170 171 #media-upload #media-items:empty { 172 border: 0 none; 173 } 174 171 175 #media-upload .media-item { 172 176 border-bottom-width: 1px; -
trunk/wp-admin/includes/media.php
r18483 r18484 1439 1439 1440 1440 $upload_action_url = admin_url('async-upload.php'); 1441 1442 1441 $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; 1443 1442 1444 $upload_size_unit = $max_upload_size = 1443 $upload_size_unit = $max_upload_size = wp_max_upload_size(); 1445 1444 $sizes = array( 'KB', 'MB', 'GB' ); 1446 for ( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ ) 1445 1446 for ( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ ) { 1447 1447 $upload_size_unit /= 1024; 1448 } 1449 1448 1450 if ( $u < 0 ) { 1449 1451 $upload_size_unit = 0; … … 1454 1456 ?> 1455 1457 </script> 1458 1456 1459 <div id="media-upload-notice"> 1457 1460 <?php if (isset($errors['upload_notice']) ) { ?> … … 1459 1462 <?php } ?> 1460 1463 </div> 1464 1461 1465 <div id="media-upload-error"> 1462 1466 <?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?> … … 1484 1488 "short" => "1", 1485 1489 ); 1490 1486 1491 $post_params = apply_filters( 'upload_post_params', $post_params ); // hook change! old name: 'swfupload_post_params' 1487 1492 $p = array(); 1488 foreach ( $post_params as $param => $val ) 1493 1494 foreach ( $post_params as $param => $val ) { 1495 $val = esc_js( $val ); 1489 1496 $p[] = "\t\t'$param' : '$val'"; 1497 } 1498 1490 1499 $post_params_str = implode( ", \n", $p ); 1491 1500 … … 1493 1502 <script type="text/javascript"> 1494 1503 //<![CDATA[ 1495 var resize_height = <?php echo get_option('large_size_h' ); ?>,1496 resize_width = <?php echo get_option('large_size_w' ); ?>;1504 var resize_height = <?php echo get_option('large_size_h', 1024); ?>, 1505 resize_width = <?php echo get_option('large_size_w', 1024); ?>; 1497 1506 1498 1507 jQuery(document).ready(function($) { … … 1503 1512 drop_element: 'media-upload', 1504 1513 file_data_name: 'async-upload', 1505 max_file_size: '<?php echo $max_upload_size / 1024; ?>kb',1506 url: '<?php echo esc_ attr( $upload_action_url ); ?>',1507 flash_swf_url: '<?php echo includes_url('js/plupload/plupload.flash.swf'); ?>',1508 silverlight_xap_url: '<?php echo includes_url('js/plupload/plupload.silverlight.xap'); ?>',1514 max_file_size: '<?php echo round( (int) $max_upload_size / 1024 ); ?>kb', 1515 url: '<?php echo esc_js( $upload_action_url ); ?>', 1516 flash_swf_url: '<?php echo esc_js( includes_url('js/plupload/plupload.flash.swf') ); ?>', 1517 silverlight_xap_url: '<?php echo esc_js( includes_url('js/plupload/plupload.silverlight.xap') ); ?>', 1509 1518 filters: [ 1510 {title: '<?php _e( 'Allowed Files' ); ?>', extensions: '<?php echo apply_filters('upload_file_glob', '*'); ?>'}1519 {title: '<?php echo esc_js( __( 'Allowed Files' ) ); ?>', extensions: '<?php echo esc_js( apply_filters('uploader_allowed_extensions', '*') ); ?>'} 1511 1520 ], 1512 1521 multipart: true, … … 1589 1598 </div> 1590 1599 1591 <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u]); ?></p>1600 <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></p> 1592 1601 <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> 1593 1602 … … 1634 1643 //]]> 1635 1644 </script> 1636 <div id="media-items"> 1637 <?php 1645 <div id="media-items"><?php 1646 1638 1647 if ( $id ) { 1639 1648 if ( !is_wp_error($id) ) { … … 1641 1650 echo get_media_items( $id, $errors ); 1642 1651 } else { 1643 echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div> ';1652 echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div></div>'; 1644 1653 exit; 1645 1654 } 1646 1655 } 1647 ?> 1648 </div> 1656 ?></div> 1657 1649 1658 <p class="savebutton ml-submit"> 1650 1659 <?php submit_button( __( 'Save all changes' ), 'button', 'save', false ); ?> -
trunk/wp-includes/js/plupload/handlers.dev.js
r18482 r18484 34 34 } 35 35 36 function uploadProgress(fileObj, bytesDone, bytesTotal) { 37 // Lengthen the progress bar 36 function uploadProgress(fileObj, bytesDone, bytesTotal) { // Lengthen the progress bar 38 37 var w = jQuery('#media-items').width() - 2, item = jQuery('#media-item-' + fileObj.id); 38 39 39 jQuery('.bar', item).width( w * bytesDone / bytesTotal ); 40 40 jQuery('.percent', item).html( Math.ceil(bytesDone / bytesTotal * 100) + '%' ); … … 210 210 // file-specific message 211 211 function wpFileError(fileObj, message) { 212 var item = jQuery('#media-item-' + fileObj.id); 213 var filename = jQuery('.filename', item).text(); 212 var item = jQuery('#media-item-' + fileObj.id), filename = jQuery('.filename', item).text(); 214 213 215 214 item.html('<div class="error-div">' … … 222 221 223 222 function itemAjaxError(id, html) { 224 var item = jQuery('#media-item-' + id); 225 var filename = jQuery('.filename', item).text(); 223 var item = jQuery('#media-item-' + id), filename = jQuery('.filename', item).text(); 226 224 227 225 item.html('<div class="error-div">' … … 270 268 } 271 269 272 270 // SWFUpload? 273 271 function uploadComplete(fileObj) { 274 272 // If no more uploads queued, enable the submit button 275 273 if ( swfu.getStats().files_queued == 0 ) { 276 jQuery('#cancel-upload').attr('disabled', 'disabled'); 277 jQuery('#insert-gallery').attr('disabled', ''); 278 } 279 } 280 281 282 // wp-specific error handlers 283 284 // generic message 285 function wpQueueError(message) { 286 jQuery('#media-upload-error').show().text(message); 287 } 288 289 // file-specific message 290 function wpFileError(fileObj, message) { 291 var item = jQuery('#media-item-' + fileObj.id); 292 var filename = jQuery('.filename', item).text(); 293 294 item.html('<div class="error-div">' 295 + '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>' 296 + '<strong>' + pluploadL10n.error_uploading.replace('%s', filename) + '</strong><br />' 297 + message 298 + '</div>'); 299 item.find('a.dismiss').click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})}); 274 jQuery('#cancel-upload').prop('disabled', true); 275 jQuery('#insert-gallery').prop('disabled', false); 276 } 300 277 } 301 278 302 279 function switchUploader(s) { 303 280 var p = document.getElementById('flash-upload-ui'), h = document.getElementById('html-upload-ui'); 281 304 282 if ( s ) { 305 283 p.style.display = 'block'; … … 313 291 function dndHelper(s) { 314 292 var d = document.getElementById('dnd-helper'); 293 315 294 if ( s ) { 316 295 d.style.display = 'block'; … … 320 299 } 321 300 301 // SWFUpload? 322 302 function swfuploadPreLoad() { 323 303 if ( !uploaderMode ) { … … 328 308 } 329 309 310 // SWFUpload? 330 311 function swfuploadLoadFailed() { 331 312 switchUploader(0); -
trunk/wp-includes/js/plupload/handlers.js
r18482 r18484 1 var topWin=window.dialogArguments||opener||parent||top;function fileDialogStart(){jQuery("#media-upload-error").empty()} 2 function fileQueued(a){jQuery(".media-blank").remove();jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0&&(jQuery(".describe-toggle-on").show(),jQuery(".describe-toggle-off").hide(),jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden"));jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+ 3 a.name+"</div></div>");jQuery(".progress","#media-item-"+a.id).show();jQuery("#insert-gallery").attr("disabled","disabled");jQuery("#cancel-upload").attr("disabled","")}function uploadStart(){try{typeof topWin.tb_remove!="undefined"&&topWin.jQuery("#TB_overlay").unbind("click",topWin.tb_remove)}catch(a){}return!0} 4 function uploadProgress(a,b,c){var d=jQuery("#media-items").width()-2,a=jQuery("#media-item-"+a.id);jQuery(".bar",a).width(d*b/c);jQuery(".percent",a).html(Math.ceil(b/c*100)+"%");b==c&&jQuery(".bar",a).html('<strong class="crunching">'+pluploadL10n.crunching+"</strong>")} 5 function updateMediaForm(){var a=jQuery("form.type-form #media-items").children(),b=jQuery("#media-items").children();a.length==1&&jQuery(".slidetoggle",a).slideDown(500).siblings().addClass("hidden").filter(".toggle").toggle();b.not(".media-blank").length>0?jQuery(".savebutton").show():jQuery(".savebutton").hide();b.length>1?jQuery(".insert-gallery").show():jQuery(".insert-gallery").hide()} 6 function uploadSuccess(a,b){b.match("media-upload-error")?jQuery("#media-item-"+a.id).html(b):(prepareMediaItem(a,b),updateMediaForm(),jQuery("#media-item-"+a.id).hasClass("child-of-"+post_id)&&jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1))} 7 function setResize(a){jQuery("#image_resize").prop("checked",a);a?(uploader.settings.resize={width:resize_width,height:resize_height,quality:100},uploader.settings.multipart_params.image_resize=!0):(uploader.settings.resize={},uploader.settings.multipart_params.image_resize=null)} 8 function prepareMediaItem(a,b){var c=typeof shortform=="undefined"?1:2,d=jQuery("#media-item-"+a.id);jQuery(".bar",d).remove();jQuery(".progress",d).hide();try{typeof topWin.tb_remove!="undefined"&&topWin.jQuery("#TB_overlay").click(topWin.tb_remove)}catch(e){}isNaN(b)||!b?(d.append(b),prepareMediaItemInit(a)):d.load("async-upload.php",{attachment_id:b,fetch:c},function(){prepareMediaItemInit(a);updateMediaForm()})} 9 function prepareMediaItemInit(a){var b=jQuery("#media-item-"+a.id);jQuery(".thumbnail",b).clone().attr("class","pinkynail toggle").prependTo(b);jQuery(".filename.original",b).replaceWith(jQuery(".filename.new",b));jQuery("a.toggle",b).click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(350,function(){var a=jQuery(window).height(),b=jQuery(this).offset().top,e=jQuery(this).height(),f;a&&b&&e&&(f=b+e,f>a&&e+48<a?window.scrollBy(0,f-a+13):f>a&&window.scrollTo(0,b-36))});jQuery(this).siblings(".toggle").andSelf().toggle(); 10 jQuery(this).siblings("a.toggle").focus();return!1});jQuery("a.delete",b).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return!1});jQuery("a.undo",b).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/, 11 "")},success:function(){var b=jQuery("#media-item-"+a.id);(type=jQuery("#type-of-"+a.id).val())&&jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-0+1);b.hasClass("child-of-"+post_id)&&jQuery("#attachments-count").text(jQuery("#attachments-count").text()-0+1);jQuery(".filename .trashnotice",b).remove();jQuery(".filename .title",b).css("font-weight","normal");jQuery("a.undo",b).addClass("hidden");jQuery("a.describe-toggle-on, .menu_order_input",b).show();b.css({backgroundColor:"#ceb"}).animate({backgroundColor:"#fff"}, 12 {queue:!1,duration:500,complete:function(){jQuery(this).css({backgroundColor:""})}}).removeClass("undo")}});return!1});jQuery("#media-item-"+a.id+".startopen").removeClass("startopen").slideToggle(500).siblings(".toggle").toggle()}function cancelUpload(){uploader.stop();jQuery.each(uploader.files,function(a,b){b.status==plupload.STOPPED&&jQuery("#media-item-"+b.id).remove()})}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)} 13 function wpFileError(a,b){var c=jQuery("#media-item-"+a.id),d=jQuery(".filename",c).text();c.html('<div class="error-div"><a class="dismiss" href="#">'+pluploadL10n.dismiss+"</a><strong>"+pluploadL10n.error_uploading.replace("%s",d)+"</strong><br />"+b+"</div>");c.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})} 14 function itemAjaxError(a,b){var c=jQuery("#media-item-"+a),d=jQuery(".filename",c).text();c.html('<div class="error-div"><a class="dismiss" href="#">'+pluploadL10n.dismiss+"</a><strong>"+pluploadL10n.error_uploading.replace("%s",d)+"</strong><br />"+b+"</div>");c.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})} 15 function deleteSuccess(a){if(a=="-1")return itemAjaxError(this.id,"You do not have permission. Has your session expired?");if(a=="0")return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?");var a=this.id,b=jQuery("#media-item-"+a);(type=jQuery("#type-of-"+a).val())&&jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1);b.hasClass("child-of-"+post_id)&&jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1);jQuery("form.type-form #media-items").children().length== 16 1&&jQuery(".hidden","#media-items").length>0&&(jQuery(".toggle").toggle(),jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden"));jQuery(".toggle",b).toggle();jQuery(".slidetoggle",b).slideUp(200).siblings().removeClass("hidden");b.css({backgroundColor:"#faa"}).animate({backgroundColor:"#f4f4f4"},{queue:!1,duration:500}).addClass("undo");jQuery(".filename:empty",b).remove();jQuery(".filename .title",b).css("font-weight","bold");jQuery(".filename",b).append('<span class="trashnotice"> '+ 17 pluploadL10n.deleted+" </span>").siblings("a.toggle").hide();jQuery(".filename",b).append(jQuery("a.undo",b).removeClass("hidden"));jQuery(".menu_order_input",b).hide()}function deleteError(){}function uploadComplete(){swfu.getStats().files_queued==0&&(jQuery("#cancel-upload").attr("disabled","disabled"),jQuery("#insert-gallery").attr("disabled",""))}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)} 18 function wpFileError(a,b){var c=jQuery("#media-item-"+a.id),d=jQuery(".filename",c).text();c.html('<div class="error-div"><a class="dismiss" href="#">'+pluploadL10n.dismiss+"</a><strong>"+pluploadL10n.error_uploading.replace("%s",d)+"</strong><br />"+b+"</div>");c.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})} 19 function switchUploader(a){var b=document.getElementById("flash-upload-ui"),c=document.getElementById("html-upload-ui");a?(b.style.display="block",c.style.display="none"):(b.style.display="none",c.style.display="block")}function dndHelper(a){document.getElementById("dnd-helper").style.display=a?"block":"none"}function swfuploadPreLoad(){uploaderMode?switchUploader(0):switchUploader(1)}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").hide()} 20 function uploadError(a,b){switch(b){case plupload.FAILED:wpFileError(a,pluploadL10n.upload_failed);break;case plupload.FILE_EXTENSION_ERROR:wpFileError(a,pluploadL10n.invalid_filetype);break;case plupload.FILE_SIZE_ERROR:wpFileError(a,pluploadL10n.upload_limit_exceeded);break;case plupload.IMAGE_FORMAT_ERROR:wpFileError(a,pluploadL10n.not_an_image);break;case plupload.IMAGE_MEMORY_ERROR:wpFileError(a,pluploadL10n.image_memory_exceeded);break;case plupload.IMAGE_DIMENSIONS_ERROR:wpFileError(a,pluploadL10n.image_dimensions_exceeded); 21 break;case plupload.GENERIC_ERROR:wpQueueError(pluploadL10n.upload_failed);break;case plupload.IO_ERROR:wpQueueError(pluploadL10n.io_error);break;case plupload.HTTP_ERROR:wpQueueError(pluploadL10n.http_error);break;case plupload.INIT_ERROR:switchUploader(0);jQuery(".upload-html-bypass").hide();break;case plupload.SECURITY_ERROR:wpQueueError(pluploadL10n.security_error);break;default:wpFileError(a,pluploadL10n.default_error)}} 22 jQuery(document).ready(function(a){a('input[type="radio"]',"#media-items").live("click",function(){var b=a(this).closest("tr");a(b).hasClass("align")?setUserSetting("align",a(this).val()):a(b).hasClass("image-size")&&setUserSetting("imgsize",a(this).val())});a("button.button","#media-items").live("click",function(){var b=this.className||"";if((b=b.match(/url([^ '"]+)/))&&b[1])setUserSetting("urlbutton",b[1]),a(this).siblings(".urlfield").val(a(this).attr("title"))})}); 1 var topWin=window.dialogArguments||opener||parent||top;function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+a.name+"</div></div>");jQuery(".progress","#media-item-"+a.id).show();jQuery("#insert-gallery").prop("disabled",true);jQuery("#cancel-upload").prop("disabled",false)}function uploadStart(a){try{if(typeof topWin.tb_remove!="undefined"){topWin.jQuery("#TB_overlay").unbind("click",topWin.tb_remove)}}catch(b){}return true}function uploadProgress(e,b,d){var a=jQuery("#media-items").width()-2,c=jQuery("#media-item-"+e.id);jQuery(".bar",c).width(a*b/d);jQuery(".percent",c).html(Math.ceil(b/d*100)+"%");if(b==d){jQuery(".bar",c).html('<strong class="crunching">'+pluploadL10n.crunching+"</strong>")}}function updateMediaForm(){var b=jQuery("form.type-form #media-items").children(),a=jQuery("#media-items").children();if(b.length==1){jQuery(".slidetoggle",b).slideDown(500).siblings().addClass("hidden").filter(".toggle").toggle()}if(a.not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(a.length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function setResize(a){jQuery("#image_resize").prop("checked",a);if(a){uploader.settings.resize={width:resize_width,height:resize_height,quality:100};uploader.settings.multipart_params.image_resize=true}else{uploader.settings.resize={};uploader.settings.multipart_params.image_resize=null}}function prepareMediaItem(c,a){var d=(typeof shortform=="undefined")?1:2,b=jQuery("#media-item-"+c.id);jQuery(".bar",b).remove();jQuery(".progress",b).hide();try{if(typeof topWin.tb_remove!="undefined"){topWin.jQuery("#TB_overlay").click(topWin.tb_remove)}}catch(g){}if(isNaN(a)||!a){b.append(a);prepareMediaItemInit(c)}else{b.load("async-upload.php",{attachment_id:a,fetch:d},function(){prepareMediaItemInit(c);updateMediaForm()})}}function prepareMediaItemInit(b){var a=jQuery("#media-item-"+b.id);jQuery(".thumbnail",a).clone().attr("class","pinkynail toggle").prependTo(a);jQuery(".filename.original",a).replaceWith(jQuery(".filename.new",a));jQuery("a.toggle",a).click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(350,function(){var d=jQuery(window).height(),e=jQuery(this).offset().top,f=jQuery(this).height(),c;if(d&&e&&f){c=e+f;if(c>d&&(f+48)<d){window.scrollBy(0,c-d+13)}else{if(c>d){window.scrollTo(0,e-36)}}}});jQuery(this).siblings(".toggle").andSelf().toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("a.delete",a).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("a.undo",a).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")},success:function(d,e){var c=jQuery("#media-item-"+b.id);if(type=jQuery("#type-of-"+b.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-0+1)}if(c.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-0+1)}jQuery(".filename .trashnotice",c).remove();jQuery(".filename .title",c).css("font-weight","normal");jQuery("a.undo",c).addClass("hidden");jQuery("a.describe-toggle-on, .menu_order_input",c).show();c.css({backgroundColor:"#ceb"}).animate({backgroundColor:"#fff"},{queue:false,duration:500,complete:function(){jQuery(this).css({backgroundColor:""})}}).removeClass("undo")}});return false});jQuery("#media-item-"+b.id+".startopen").removeClass("startopen").slideToggle(500).siblings(".toggle").toggle()}function cancelUpload(){uploader.stop();jQuery.each(uploader.files,function(b,a){if(a.status==plupload.STOPPED){jQuery("#media-item-"+a.id).remove()}})}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(d,c){var b=jQuery("#media-item-"+d.id),a=jQuery(".filename",b).text();b.html('<div class="error-div"><a class="dismiss" href="#">'+pluploadL10n.dismiss+"</a><strong>"+pluploadL10n.error_uploading.replace("%s",a)+"</strong><br />"+c+"</div>");b.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function itemAjaxError(d,b){var c=jQuery("#media-item-"+d),a=jQuery(".filename",c).text();c.html('<div class="error-div"><a class="dismiss" href="#">'+pluploadL10n.dismiss+"</a><strong>"+pluploadL10n.error_uploading.replace("%s",a)+"</strong><br />"+b+"</div>");c.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function deleteSuccess(b,d){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var c=this.id,a=jQuery("#media-item-"+c);if(type=jQuery("#type-of-"+c).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery(".toggle",a).toggle();jQuery(".slidetoggle",a).slideUp(200).siblings().removeClass("hidden");a.css({backgroundColor:"#faa"}).animate({backgroundColor:"#f4f4f4"},{queue:false,duration:500}).addClass("undo");jQuery(".filename:empty",a).remove();jQuery(".filename .title",a).css("font-weight","bold");jQuery(".filename",a).append('<span class="trashnotice"> '+pluploadL10n.deleted+" </span>").siblings("a.toggle").hide();jQuery(".filename",a).append(jQuery("a.undo",a).removeClass("hidden"));jQuery(".menu_order_input",a).hide();return}function deleteError(c,b,a){}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").prop("disabled",true);jQuery("#insert-gallery").prop("disabled",false)}}function switchUploader(b){var c=document.getElementById("flash-upload-ui"),a=document.getElementById("html-upload-ui");if(b){c.style.display="block";a.style.display="none"}else{c.style.display="none";a.style.display="block"}}function dndHelper(a){var b=document.getElementById("dnd-helper");if(a){b.style.display="block"}else{b.style.display="none"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").hide()}function uploadError(b,c,a){switch(c){case plupload.FAILED:wpFileError(b,pluploadL10n.upload_failed);break;case plupload.FILE_EXTENSION_ERROR:wpFileError(b,pluploadL10n.invalid_filetype);break;case plupload.FILE_SIZE_ERROR:wpFileError(b,pluploadL10n.upload_limit_exceeded);break;case plupload.IMAGE_FORMAT_ERROR:wpFileError(b,pluploadL10n.not_an_image);break;case plupload.IMAGE_MEMORY_ERROR:wpFileError(b,pluploadL10n.image_memory_exceeded);break;case plupload.IMAGE_DIMENSIONS_ERROR:wpFileError(b,pluploadL10n.image_dimensions_exceeded);break;case plupload.GENERIC_ERROR:wpQueueError(pluploadL10n.upload_failed);break;case plupload.IO_ERROR:wpQueueError(pluploadL10n.io_error);break;case plupload.HTTP_ERROR:wpQueueError(pluploadL10n.http_error);break;case plupload.INIT_ERROR:switchUploader(0);jQuery(".upload-html-bypass").hide();break;case plupload.SECURITY_ERROR:wpQueueError(pluploadL10n.security_error);break;default:wpFileError(b,pluploadL10n.default_error)}}jQuery(document).ready(function(a){a('input[type="radio"]',"#media-items").live("click",function(){var b=a(this).closest("tr");if(a(b).hasClass("align")){setUserSetting("align",a(this).val())}else{if(a(b).hasClass("image-size")){setUserSetting("imgsize",a(this).val())}}});a("button.button","#media-items").live("click",function(){var b=this.className||"";b=b.match(/url([^ '"]+)/);if(b&&b[1]){setUserSetting("urlbutton",b[1]);a(this).siblings(".urlfield").val(a(this).attr("title"))}})}); -
trunk/wp-includes/script-loader.php
r18482 r18484 199 199 $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8-20110113'); 200 200 201 $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.2'); 202 203 // common bits for both uploaders 204 $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post; 205 206 if ( empty($max_upload_size) ) 207 $max_upload_size = __('not configured'); 208 209 // error messagoe for both plupload and swfupload 210 $uploader_l10n = array( 211 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), 212 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'), 213 'zero_byte_file' => __('This file is empty. Please try another.'), 214 'invalid_filetype' => __('This file type is not allowed. Please try another.'), 215 'not_an_image' => __('This file is not an image. Please try another.'), 216 'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'), 217 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'), 218 'default_error' => __('An error occurred in the upload. Please try again later.'), 219 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), 220 'upload_limit_exceeded' => __('You may only upload 1 file.'), 221 'http_error' => __('HTTP error.'), 222 'upload_failed' => __('Upload failed.'), 223 'io_error' => __('IO error.'), 224 'security_error' => __('Security error.'), 225 'file_cancelled' => __('File canceled.'), 226 'upload_stopped' => __('Upload stopped.'), 227 'dismiss' => __('Dismiss'), 228 'crunching' => __('Crunching…'), 229 'deleted' => __('moved to the trash.'), 230 'error_uploading' => __('“%s” has failed to upload due to an error') 231 ); 201 232 202 233 $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.js', false, '1.4.3.2'); … … 207 238 $scripts->add( 'plupload-html4', '/wp-includes/js/plupload/plupload.html4.js', array('plupload'), '1.4.3.2'); 208 239 209 // TODO: find out if we can use the plupload.full.js (it does load browserplus) 210 $scripts->add( 'plupload-full', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-gears', 'plupload-html4'), '1.4.3.2'); 211 212 $scripts->add( 'plupload-handlers', '/wp-includes/js/plupload/handlers.js', array('plupload-full', 'jquery'), '1.4.3.2'); 213 214 // TODO: find out if we really need this debug clause with plupload 215 /*if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { 240 // TODO: find out if we can use the plupload.full.js, it loads browserplus init JS from Yahoo 241 $scripts->add( 'plupload-full', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.4.3.2'); 242 243 $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-full', 'jquery'), '1.4.3.2'); 244 $scripts->add_script_data( 'plupload-handlers', 'pluploadL10n', $uploader_l10n ); 245 246 // keep 'swfupload' for back-compat. 247 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2201-20110113'); 248 $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201a'); 249 $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201'); 250 $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201'); 251 252 if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { 216 253 // queue all SWFUpload scripts that are used by default 217 254 $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201'); 218 255 } else { 219 $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201'); 220 }*/ 221 222 $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post; 223 if ( empty($max_upload_size) ) 224 $max_upload_size = __('not configured'); 225 226 $scripts->add_script_data( 'plupload-handlers', 'pluploadL10n', array( 227 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'), 228 'zero_byte_file' => __('This file is empty. Please try another.'), 229 'invalid_filetype' => __('This file type is not allowed. Please try another.'), 230 'not_an_image' => __('This file is not an image. Please try another.'), 231 'image_memory_exceeded' => __('Memery exceeded. Please try another smaller file.'), 232 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'), 233 'default_error' => __('An error occurred in the upload. Please try again later.'), 234 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), 235 'upload_limit_exceeded' => __('You may only upload 1 file.'), 236 'http_error' => __('HTTP error.'), 237 'upload_failed' => __('Upload failed.'), 238 'io_error' => __('IO error.'), 239 'security_error' => __('Security error.'), 240 'file_cancelled' => __('File canceled.'), 241 'upload_stopped' => __('Upload stopped.'), 242 'dismiss' => __('Dismiss'), 243 'crunching' => __('Crunching…'), 244 'deleted' => __('moved to the trash.'), 245 'error_uploading' => __('“%s” has failed to upload due to an error'), 246 ) ); 256 $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201a'); 257 } 258 259 $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524'); 260 $scripts->add_script_data( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n ); 247 261 248 262 $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
Note: See TracChangeset
for help on using the changeset viewer.