From 282ed12fa4ba1a699c62a0d7f014575a44ad1b16 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 28 Feb 2008 21:29:51 +0000 Subject: [PATCH] Media library updates from andy. see #5911 git-svn-id: http://svn.automattic.com/wordpress/trunk@7092 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/media.css | 29 +- wp-admin/includes/media.php | 497 +++++++++++++++++++++------ wp-admin/media-upload.php | 13 +- wp-includes/js/swfupload/handlers.js | 30 +- wp-includes/script-loader.php | 2 +- 5 files changed, 431 insertions(+), 140 deletions(-) diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css index d191f1c381..df62cc3b2b 100644 --- a/wp-admin/css/media.css +++ b/wp-admin/css/media.css @@ -46,10 +46,6 @@ form { margin: 0 1em 1em 0; } -.media-upload-form input[type="text"], .media-upload-form input[type="file"] { - width: 100%; -} - .media-upload-form fieldset { width: 100%; border: none; @@ -57,7 +53,7 @@ form { margin: 0 0 1em 0; padding: 0; } - +/* .media-upload-form button.button-ok { float: right; background-color: #ebebeb; @@ -74,7 +70,7 @@ form { text-decoration: underline; margin: 0.5em 1em; } - +*/ /* specific to the image upload form */ .align .field label { display: inline; @@ -156,13 +152,12 @@ span.filename { max-width: 40px; } .describe { - display: none; border-top: 1px solid #d0d0d0; padding: 5px; width: 100%; } -.startopen .describe { - display: block; +.describe.startopen, .describe.startclosed { + display: none; } .required abbr { color: red; @@ -179,18 +174,9 @@ span.filename { .describe td.A1 { width: 132px; } -.describe td.savesend { - text-align: right; -} .describe input[type="text"], .describe textarea { width: 460px; } -a.delete { - display: block; - text-align: center; - width: 100%; - color: #246; -} .describe-toggle-on, .describe-toggle-off { display: block; line-height: 36px; @@ -211,13 +197,12 @@ a.delete { border: none; z-index: 10; } -tr.submit input { - width: 128px; -} tr.align td.field { text-align: center; } - +a.delete { + color: #666; +} .hidden { height: 0px; width: 0px; diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e242fb4c7c..31d6fa8d7e 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2,28 +2,28 @@ function media_upload_tabs() { $_default_tabs = array( - 'computer' => __('From Computer'), // handler action suffix => tab text - 'attachments' => __('Attachments'), + 'type' => __('Choose File'), // handler action suffix => tab text + 'gallery' => __('Gallery'), 'library' => __('Media Library'), ); return apply_filters('media_upload_tabs', $_default_tabs); } -function update_attachments_tab($tabs) { +function update_gallery_tab($tabs) { global $wpdb; if ( !isset($_REQUEST['post_id']) ) { - unset($tabs['attachments']); + unset($tabs['gallery']); return $tabs; } if ( intval($_REQUEST['post_id']) ) - $attachments = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])); + $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id']))); - $tabs['attachments'] = sprintf(__('Attachments (%s)'), "$attachments"); + $tabs['gallery'] = sprintf(__('Gallery (%s)'), "$attachments"); return $tabs; } -add_filter('media_upload_tabs', 'update_attachments_tab'); +add_filter('media_upload_tabs', 'update_gallery_tab'); function the_media_upload_tabs() { $tabs = media_upload_tabs(); @@ -55,7 +55,7 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal $html = "$html"; elseif ( $size == 'thumb' || $size == 'medium' ) $html = ''.$html.''; - + $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); return $html; @@ -154,9 +154,23 @@ if ( is_string($content_func) ) function media_buttons() { global $post_ID, $temp_ID; $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); - $media_upload_iframe_src = "media-upload.php?type=media&post_id=$uploading_iframe_ID"; - $media_upload_iframe_src = apply_filters('media_upload_iframe_src', $media_upload_iframe_src); - echo "" . __('Add media'). ''; + $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID"; + $media_title = __('Add Media'); + $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&type=image"); + $image_title = __('Add an Image'); + $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&type=video"); + $video_title = __('Add Video'); + $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&type=audio"); + $audio_title = __('Add Audio'); + $out = <<$image_title + $video_title + $audio_title + $media_title + +EOF; + echo $out; } add_action( 'media_buttons', 'media_buttons' ); @@ -191,8 +205,10 @@ function media_upload_form_handler() { $id = media_handle_upload('async-upload', $_REQUEST['post_id']); - if ( is_wp_error($id) ) + if ( is_wp_error($id) ) { $errors['upload_error'] = $id; + $id = false; + } } if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { @@ -232,20 +248,139 @@ function media_upload_form_handler() { return $errors; } -function media_upload_computer() { +function media_upload_image() { + if ( !empty($_FILES) ) { + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $src = $_POST['insertonly']['src']; + if ( !strpos($src, '://') ) + $src = "http://$src"; + $alt = attribute_escape($_POST['insertonly']['alt']); + if ( isset($_POST['insertonly']['align']) ) { + $align = attribute_escape($_POST['insertonly']['align']); + $class = " class='align-$align'"; + } + $html = "$alt"; + return media_send_to_editor($html); + } + if ( !empty($_POST) ) { $return = media_upload_form_handler(); - + if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } - return wp_iframe( 'media_upload_computer_form', $errors ); + return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); } -function media_upload_attachments() { +function media_upload_audio() { + if ( !empty($_FILES) ) { + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $href = $_POST['insertonly']['href']; + if ( !strpos($href, '://') ) + $href = "http://$href"; + $title = attribute_escape($_POST['insertonly']['title']); + $html = "$title"; + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id ); +} + +function media_upload_video() { + if ( !empty($_FILES) ) { + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $href = $_POST['insertonly']['href']; + if ( !strpos($href, '://') ) + $href = "http://$href"; + $title = attribute_escape($_POST['insertonly']['title']); + $html = "$title"; + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + return wp_iframe( 'media_upload_type_form', 'video', $errors, $id ); +} + +function media_upload_file() { + if ( !empty($_FILES) ) { + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $href = $_POST['insertonly']['href']; + if ( !strpos($href, '://') ) + $href = "http://$href"; + $title = attribute_escape($_POST['insertonly']['title']); + $html = "$title"; + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + return wp_iframe( 'media_upload_type_form', 'file', $errors, $id ); +} + +function media_upload_gallery() { if ( !empty($_POST) ) { $return = media_upload_form_handler(); @@ -255,7 +390,7 @@ function media_upload_attachments() { $errors = $return; } - return wp_iframe( 'media_upload_attachments_form', $errors ); + return wp_iframe( 'media_upload_gallery_form', $errors ); } function media_upload_library() { @@ -271,25 +406,6 @@ function media_upload_library() { return wp_iframe( 'media_upload_library_form', $errors ); } -function get_media_items( $post_id, $errors ) { - if ( $post_id ) { - $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC"); - } else { - if ( is_array($GLOBALS['wp_the_query']->posts) ) - foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) - $attachments[$attachment->ID] = $attachment; - } - - if ( empty($attachments) ) - return ''; - - foreach ( $attachments as $id => $attachment ) - if ( $item = get_media_item($id, isset($errors[$id]) ? $errors[$id] : null) ) - $output .= "\n
$item
\n
"; - - return $output; -} - function get_attachment_taxonomies($attachment) { if ( is_int( $attachment ) ) $attachment = get_post($attachment); @@ -331,13 +447,7 @@ function image_attachment_fields_to_edit($form_fields, $post) { $thumb = wp_get_attachment_thumb_url(); - $form_fields['_send']['url'] = array( - 'label' => __('Link URL'), - 'input' => 'html', - 'html' => '', - 'helps' => __('If filled, this will override the default link URL.'), - ); - $form_fields['_send']['align'] = array( + $form_fields['align'] = array( 'label' => __('Alignment'), 'input' => 'html', 'html' => " @@ -350,7 +460,7 @@ function image_attachment_fields_to_edit($form_fields, $post) { \n", ); - $form_fields['_send']['image-size'] = array( + $form_fields['image-size'] = array( 'label' => __('Size'), 'input' => 'html', 'html' => " @@ -383,12 +493,7 @@ add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 function image_media_send_to_editor($html, $attachment_id, $attachment) { $post =& get_post($attachment_id); if ( substr($post->post_mime_type, 0, 5) == 'image' ) { - if ( !empty($attachment['url']) ) - $url = $attachment['url']; - elseif ( $rel = strlen(trim($post->post_content)) ) - $url = get_attachment_link($attachment_id); - else - $url = wp_get_attachment_url($attachment_id); + $url = $attachment['url']; if ( isset($attachment['align']) ) $align = $attachment['align']; @@ -415,11 +520,14 @@ function get_attachment_fields_to_edit($post, $errors = null) { $post = (object) $post; $edit_post = sanitize_post($post, 'edit'); + $file = wp_get_attachment_url($post->ID); + $link = get_attachment_link($post->ID); $form_fields = array( 'post_title' => array( 'label' => __('Title'), 'value' => $edit_post->post_title, + 'helps' => __(''), ), 'post_excerpt' => array( 'label' => __('Description'), @@ -429,7 +537,19 @@ function get_attachment_fields_to_edit($post, $errors = null) { 'label' => __('Long description'), 'value' => $edit_post->post_content, 'input' => 'textarea', - 'helps' => array(__('If filled, the default link URL will be the attachment permalink.')), + ), + 'url' => array( + 'label' => __('Link URL'), + 'input' => 'html', + 'html' => " + + + + + \n", + 'helps' => __('Enter a link URL or click above for presets.'), ), ); @@ -462,7 +582,30 @@ function get_attachment_fields_to_edit($post, $errors = null) { return $form_fields; } -function get_media_item( $attachment_id, $errors = null, $send = true ) { +function get_media_items( $post_id, $errors ) { + if ( $post_id && $post = get_post($post_id) ) { + if ( $post->post_type == 'attachment' ) + $attachments = array($post->ID => $post); + else + $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC"); + } else { + if ( is_array($GLOBALS['wp_the_query']->posts) ) + foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) + $attachments[$attachment->ID] = $attachment; + } + + if ( empty($attachments) ) + return ''; + + foreach ( $attachments as $id => $attachment ) + if ( $item = get_media_item($id, isset($errors[$id]) ? $errors[$id] : null) ) + $output .= "\n
$item
\n
"; + + return $output; +} + +function get_media_item( $attachment_id, $errors = null, $send = true, $delete = true ) { + global $post_mime_types; if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) $thumb_url = $thumb_url[0]; else @@ -486,10 +629,16 @@ function get_media_item( $attachment_id, $errors = null, $send = true ) { $tags = attribute_escape(join(', ', $tags)); } + if ( isset($post_mime_types) ) { + $type = array_shift(array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type))); + $type = ""; + } + $form_fields = get_attachment_fields_to_edit($post, $errors); $class = empty($errors) ? 'startclosed' : 'startopen'; $item = " + $type $toggle_on $toggle_off $filename @@ -510,18 +659,12 @@ function get_media_item( $attachment_id, $errors = null, $send = true ) { ); $delete_href = wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id); - $delete = __('Delete'); - $save = ""; - $send = ""; - - if ( empty($form_fields['save']) && empty($form_fields['_send']) ) { - $form_fields['save'] = array('tr' => "\t\t$delete$save$send\n"); - } elseif ( empty($form_fields['save']) ) { - $form_fields['save'] = array('tr' => "\t\t$save\n"); - foreach ( $form_fields['_send'] as $id => $field ) - $form_fields[$id] = $field; - $form_fields['send'] = array('tr' => "\t\t$delete$send"); - } + if ( $send ) + $send = "'; + if ( $delete ) + $delete = "" . __('Delete') . ""; + if ( ( $send || $delete ) && !isset($form_fields['buttons']) ) + $form_fields['buttons'] = array('tr' => "\t\t$send $delete\n"); $hidden_fields = array(); @@ -583,21 +726,27 @@ function get_media_item( $attachment_id, $errors = null, $send = true ) { return $item; } -function media_upload_header() { +function media_upload_header($title = false) { + if ( empty($title) ) + $title = __('Choose a File'); ?> +
-

+

+
get_error_message(); ?> @@ -614,7 +763,8 @@ jQuery(function($){ post_params : { "post_id" : "", "auth_cookie" : "", - "type" : "media" + "type" : "", + "tab" : "" }, file_size_limit : "b", swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available @@ -640,17 +790,12 @@ jQuery(function($){

-

+

-

- - -

- - +


@@ -658,34 +803,60 @@ jQuery(function($){ -
+ + +

-
-

- -

-
+ + +
+ +
+ + +
+

+

+
+ +
+
+ +
+
@@ -701,7 +872,7 @@ jQuery(function($){ --> -
+ @@ -717,13 +888,13 @@ jQuery(function($){ } function media_upload_library_form($errors) { - global $wpdb, $wp_query, $wp_locale; + global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; - media_upload_header(); + media_upload_header(__('Browse Media Library')); $post_id = intval($_REQUEST['post_id']); - $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=media&tab=library&post_id=$post_id"; + $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php"; $_GET['paged'] = intval($_GET['paged']); if ( $_GET['paged'] < 1 ) @@ -738,10 +909,10 @@ function media_upload_library_form($errors) { ?> - - + + - +
@@ -766,7 +937,7 @@ foreach ( $post_mime_types as $mime_type => $label ) { if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) $class = ' class="current"'; - $type_links[] = "
  • $mime_type, 'paged'=>false)) . "'$class>" . sprintf($label[2], $num_posts[$mime_type]) . ''; + $type_links[] = "
  • $mime_type, 'paged'=>false)) . "'$class>" . sprintf($label[2], "{$num_posts[$mime_type]}") . ''; } $class = empty($_GET['post_mime_type']) ? ' class="current"' : ''; $type_links[] = "
  • ".__('All Types').""; @@ -807,12 +978,12 @@ foreach ($arc_result as $arc_row) { if ( $arc_row->yyear == 0 ) continue; $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 ); - + if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) $default = ' selected="selected"'; else $default = ''; - + echo ""; echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear"; echo "\n"; @@ -829,7 +1000,10 @@ foreach ($arc_result as $arc_row) {
  • -
    + + + + - - -
    @@ -854,13 +1025,129 @@ jQuery(function($){ + + + * + + + + + * + + + ' . __('Alternate text, e.g. "The Mona Lisa"') . ' + + + + + + + + + + + + + + + + + + + + + +'; +} -add_filter('media_upload_computer', 'media_upload_computer'); -add_action('admin_head_media_upload_computer_form', 'media_admin_css'); +function type_form_audio() { + return ' + + + + + + + + + + + + + + + + +
    *
    *
    ' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '
    + +
    +'; +} -add_filter('media_upload_attachments', 'media_upload_attachments'); -add_action('admin_head_media_upload_attachments_form', 'media_admin_css'); +function type_form_video() { + return ' + + + + + + + + + + + + + + + + +
    *
    *
    ' . __('Link text, e.g. "Lucy on YouTube"') . '
    + +
    +'; +} + +function type_form_file() { + return ' + + + + + + + + + + + + + + + + +
    *
    *
    ' . __('Link text, e.g. "Ransom Demands (PDF)"') . '
    + +
    +'; +} + +add_filter('async_upload_image', 'get_media_item', 10, 2); +add_filter('async_upload_audio', 'get_media_item', 10, 2); +add_filter('async_upload_video', 'get_media_item', 10, 2); +add_filter('async_upload_file', 'get_media_item', 10, 2); + +add_action('media_upload_image', 'media_upload_image'); +add_action('media_upload_audio', 'media_upload_audio'); +add_action('media_upload_video', 'media_upload_video'); +add_action('media_upload_file', 'media_upload_file'); +add_action('admin_head_media_upload_type_form', 'media_admin_css'); + +add_filter('media_upload_gallery', 'media_upload_gallery'); +add_action('admin_head_media_upload_gallery_form', 'media_admin_css'); add_filter('media_upload_library', 'media_upload_library'); add_action('admin_head_media_upload_library_form', 'media_admin_css'); diff --git a/wp-admin/media-upload.php b/wp-admin/media-upload.php index 7589bd6b87..9243268843 100644 --- a/wp-admin/media-upload.php +++ b/wp-admin/media-upload.php @@ -19,12 +19,21 @@ if ( isset($action) && $action == 'edit' && !$ID ) wp_die(__("You are not allowed to be here")); // upload type: image, video, file, ..? +if ( isset($_GET['type']) ) + $type = strval($_GET['type']); +else + $type = apply_filters('media_upload_default_type', 'file'); + +// tab: gallery, library, or type-specific if ( isset($_GET['tab']) ) $tab = strval($_GET['tab']); else - $tab = apply_filters('media_upload_default_tab', 'computer'); + $tab = apply_filters('media_upload_default_tab', 'type'); // let the action code decide how to handle the request -do_action("media_upload_$tab"); +if ( $tab == 'type' ) + do_action("media_upload_$type"); +else + do_action("media_upload_$tab"); ?> diff --git a/wp-includes/js/swfupload/handlers.js b/wp-includes/js/swfupload/handlers.js index 6253ef7b2a..70f0307e51 100644 --- a/wp-includes/js/swfupload/handlers.js +++ b/wp-includes/js/swfupload/handlers.js @@ -9,8 +9,10 @@ function fileDialogStart() { // progress and success handlers for media multi uploads function fileQueued(fileObj) { + // Get rid of unused form + jQuery('.media-blank').remove(); // Create a progress bar containing the filename - jQuery('#media-items').prepend('
    ' + fileObj.name + '
    '); + jQuery('#media-items').prepend('
    ' + fileObj.name + '
    '); // Disable the submit button jQuery('#insert-media').attr('disabled', 'disabled'); @@ -50,8 +52,13 @@ function prepareMediaItem(fileObj, serverData) { action : 'delete-post', _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')} }); - // Decrement the counter. - jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1); + + // Decrement the counters. + if ( type = jQuery('#type-of-' + this.id.replace(/[^0-9]/g,'')).val() ) + jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1); + if ( jQuery(this).parents('.media-item').eq(0).hasClass('child-of-'+post_id) ) + jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1); + // Vanish it. jQuery(this).parents(".media-item").eq(0).slideToggle(300,function(){jQuery(this).remove();if(jQuery('.media-item').length==0)jQuery('.insert-gallery').hide();updateMediaForm();}); return false; @@ -66,11 +73,11 @@ function prepareMediaItem(fileObj, serverData) { function updateMediaForm() { // Just one file, no need for collapsible part - if ( jQuery('#computer-form #media-items>*').length == 1 ) { + if ( jQuery('.type-form #media-items>*').length == 1 ) { jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle(); - jQuery('#computer-form .slidetoggle').siblings().addClass('hidden'); + jQuery('.type-form .slidetoggle').siblings().addClass('hidden'); } else { - jQuery('#computer-form .slidetoggle').siblings().removeClass('hidden'); + jQuery('.type-form .slidetoggle').siblings().removeClass('hidden'); } // Only show Gallery button when there are at least two files. @@ -88,7 +95,10 @@ function uploadSuccess(fileObj, serverData) { } prepareMediaItem(fileObj, serverData); updateMediaForm(); - jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1); + + // Increment the counter. + if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) ) + jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1); } function uploadComplete(fileObj) { @@ -116,13 +126,13 @@ function fileQueueError(fileObj, error_code, message) { wpQueueError(swfuploadL10n.queue_limit_exceeded); } else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) { - wpQueueError(swfuploadL10n.file_exceeds_size_limit); + wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit); } else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) { - wpQueueError(swfuploadL10n.zero_byte_file); + wpFileError(fileObj, swfuploadL10n.zero_byte_file); } else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) { - wpQueueError(swfuploadL10n.invalid_filetype); + wpFileError(fileObj, swfuploadL10n.invalid_filetype); } else { wpQueueError(swfuploadL10n.default_error); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index ec7e90c88c..66e58e65a1 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -88,7 +88,7 @@ class WP_Scripts { $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2'); $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2'); $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2'); - $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080225'); + $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080227'); // these error messages came from the sample swfupload js, they might need changing. $this->localize( 'swfupload-handlers', 'swfuploadL10n', array( 'queue_limit_exceeded' => 'You have attempted to queue too many files.',