From c5d19aed9c5dc3efe32118e0db228a2f7b51ab70 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 22 Feb 2008 05:53:47 +0000 Subject: [PATCH] Media library work from andy. see #5911 git-svn-id: http://svn.automattic.com/wordpress/trunk@6974 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/media.css | 14 +- wp-admin/edit-attachment-rows.php | 12 +- wp-admin/includes/media.php | 351 +++++---------------------- wp-includes/default-filters.php | 2 + wp-includes/formatting.php | 93 +++++++ wp-includes/general-template.php | 3 +- wp-includes/images/audio.png | Bin 0 -> 574 bytes wp-includes/images/css.png | Bin 0 -> 533 bytes wp-includes/images/default.png | Bin 0 -> 479 bytes wp-includes/images/doc.png | Bin 0 -> 1535 bytes wp-includes/images/exe.png | Bin 0 -> 194 bytes wp-includes/images/html.png | Bin 0 -> 537 bytes wp-includes/images/js.png | Bin 0 -> 517 bytes wp-includes/images/pdf.png | Bin 0 -> 1424 bytes wp-includes/images/swf.png | Bin 0 -> 1542 bytes wp-includes/images/tar.png | Bin 0 -> 1280 bytes wp-includes/images/text.png | Bin 0 -> 1559 bytes wp-includes/images/video.png | Bin 0 -> 596 bytes wp-includes/images/zip.png | Bin 0 -> 1270 bytes wp-includes/js/swfupload/handlers.js | 249 +++---------------- wp-includes/media.php | 2 +- wp-includes/post-template.php | 4 +- wp-includes/post.php | 72 +++--- wp-includes/script-loader.php | 2 +- 24 files changed, 264 insertions(+), 540 deletions(-) create mode 100644 wp-includes/images/audio.png create mode 100644 wp-includes/images/css.png create mode 100644 wp-includes/images/default.png create mode 100644 wp-includes/images/doc.png create mode 100644 wp-includes/images/exe.png create mode 100644 wp-includes/images/html.png create mode 100644 wp-includes/images/js.png create mode 100644 wp-includes/images/pdf.png create mode 100644 wp-includes/images/swf.png create mode 100644 wp-includes/images/tar.png create mode 100644 wp-includes/images/text.png create mode 100644 wp-includes/images/video.png create mode 100644 wp-includes/images/zip.png diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css index 62860a7663..fb86e84bbe 100644 --- a/wp-admin/css/media.css +++ b/wp-admin/css/media.css @@ -109,11 +109,17 @@ form.media-upload-form { background: url(../images/align-right.png) no-repeat center left; } -.media-upload-form fieldset#image-size label { +#flash-upload-ui, .insert-gallery { + display: none; +} + +tr.image-size label { display: inline; margin: 0 1em 0 0; } - +tr.image-size td.field { + text-align: center; +} .pinkynail { max-width: 40px; max-height: 40px; @@ -187,11 +193,11 @@ span.filename { .describe input[type="text"], .describe textarea { width: 460px; } -.describe a.delete { +a.delete { display: block; text-align: center; - line-height: 24px; width: 100%; + color: #246; } .describe-toggle-on, .describe-toggle-off { line-height: 36px; diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php index b8ae190bb7..ca3ab38873 100644 --- a/wp-admin/edit-attachment-rows.php +++ b/wp-admin/edit-attachment-rows.php @@ -46,16 +46,17 @@ foreach($posts_columns as $column_name=>$column_display_name) { case 'media': ?> - +
+ guid)); ?> + ID); ?> + - + post_excerpt : ''; ?> $column_display_name) { ?> - + -
-

- -
-
-get_error_message(); -} ?> -
- -
-

- - -

-

- -

-

- -

-

- -

-

- -

-
- - /> - - /> - - /> - - /> - -
-
- - /> - - /> - - /> - -
-

- - -

- - -
- $id, - 'post_title' => $_POST['image-title'], - 'post_content' => $_POST['image-alt'], - )); - } - else { - $id = image_upload_post(); - } - - // if the input was invalid, redisplay the form with its current values - if ( is_wp_error($id) ) - wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image', $_POST, $id ); - else { - media_send_to_editor(get_image_send_to_editor($id, $_POST['image-alt'], $_POST['image-title'], $_POST['image-align'], $_POST['image-url'], true, $_POST['image-size'])); - } - } -} - -// this returns html to include in the single image upload form when the async flash upload has finished -// i.e. show a thumb of the image, and include the attachment id as a hidden input -function async_image_callback($id) { - $thumb_url = wp_get_attachment_thumb_url($id); - if ( empty($thumb_url) ) - $thumb_url = wp_mime_type_icon($id); - - if ($thumb_url) { - $out = '

' - . ' ' - . basename(wp_get_attachment_url($id)).'

'; - } - else { - $out = '

' - . basename(wp_get_attachment_url($id)).'

'; - } - - $post = get_post($id); - $title = addslashes($post->post_title); - $alt = addslashes($post->post_content); - - // populate the input fields with post data (which in turn comes from exif/iptc) - $out .= << - - -EOF; - - return $out; -} - -add_filter('async_upload_image', 'async_image_callback'); - - function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') { $html = get_image_tag($id, $alt, $title, $align, $rel, $size); @@ -254,45 +62,6 @@ top.tb_remove(); exit; } -// this handles the file upload POST itself, validating input and inserting the file if it's valid -function image_upload_post() { - if ( empty($_FILES['image-file']['name']) ) - return new wp_error( 'image_file_required', __('Please choose an image file to upload') ); - if ( empty($_POST['image-alt']) ) - return new wp_error( 'image_alt_required', __('Please enter an <alt> description') ); - - $overrides = array('test_form'=>false); - $file = wp_handle_upload($_FILES['image-file'], $overrides); - - if ( isset($file['error']) ) - return new wp_error( 'upload_error', $file['error'] ); - - $url = $file['url']; - $type = $file['type']; - $file = $file['file']; - - $post_title = trim($_POST['image-title']); - $post_content = trim($_POST['image-alt']); - $post_parent = intval($_POST['parent_post_id']); - - // Construct the attachment array - $attachment = array( - 'post_title' => $post_title, - 'post_content' => $post_content, - 'post_type' => 'attachment', - 'post_parent' => $post_parent, - 'post_mime_type' => $type, - 'guid' => $url - ); - - // Save the data - $id = wp_insert_attachment($attachment, $file, $post_parent); - if ( !is_wp_error($id) ) - wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); - - return $id; -} - // this handles the file upload POST itself, creating the attachment post function media_handle_upload($file_id, $post_id, $post_data = array()) { $overrides = array('test_form'=>false); @@ -371,24 +140,12 @@ if ( is_string($content_func) ) - - - - - - -EOF; - echo $out; + echo "" . __('Add media'). ''; } add_action( 'media_buttons', 'media_buttons' ); @@ -522,11 +279,12 @@ function get_attachment_taxonomies($attachment) { function image_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $form_fields['post_title']['required'] = true; - $form_fields['post_excerpt']['label'] = __('Alternate Text'); - $form_fields['post_content']['label'] = __('Description'); + $form_fields['post_excerpt']['label'] = __('Description'); + $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"'); - if ( strlen(trim($post->post_excerpt)) == 0 ) - $form_fields['post_excerpt']['helps'][] = __('Alternate Text helps people who can not see the image.'); + $form_fields['post_content']['label'] = __('Long Description'); + + $thumb = wp_get_attachment_thumb_url(); $form_fields['_send']['url'] = array( 'label' => __('Link URL'), @@ -547,6 +305,17 @@ function image_attachment_fields_to_edit($form_fields, $post) { \n", ); + $form_fields['_send']['image-size'] = array( + 'label' => __('Size'), + 'input' => 'html', + 'html' => " + " . ( $thumb ? " + + " : '' ) . " + + + ", + ); } return $form_fields; } @@ -581,7 +350,12 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) { else $align = 'none'; - return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel); + if ( !empty($attachment['image-size']) ) + $size = $attachment['image-size']; + else + $size = 'medium'; + + return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size); } return $html; @@ -603,11 +377,11 @@ function get_attachment_fields_to_edit($post, $errors = null) { 'value' => $edit_post->post_title, ), 'post_excerpt' => array( - 'label' => __('Excerpt'), + 'label' => __('Description'), 'value' => $edit_post->post_excerpt, ), 'post_content' => array( - 'label' => __('Description'), + 'label' => __('Long description'), 'value' => $edit_post->post_content, 'input' => 'textarea', 'helps' => array(__('If filled, the default link URL will be the attachment permalink.')), @@ -637,25 +411,21 @@ function get_attachment_fields_to_edit($post, $errors = null) { // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) $form_fields = array_merge_recursive($form_fields, (array) $errors); - + $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); return $form_fields; } function get_multimedia_item( $attachment_id, $errors = null, $send = true ) { - $thumb_url = wp_get_attachment_thumb_url( $attachment_id ); - if ( empty($thumb_url) ) - $thumb_url = wp_mime_type_icon( $attachment_id ); - if ( empty($thumb_url) && ( $post =& get_post( $attachment_id ) ) && substr($post->post_mime_type, 0, 5) == 'image' ) - $thumb_url = wp_get_attachment_url( $attachment_id ); + $thumb_url = array_shift(get_attachment_icon_src( $attachment_id )); $title_label = __('Title'); $description_label = __('Description'); $tags_label = __('Tags'); - $toggle_on = __('Describe'); - $toggle_off = __('Describe «'); + $toggle_on = __('Show'); + $toggle_off = __('Hide'); $post = get_post($attachment_id); @@ -697,12 +467,12 @@ function get_multimedia_item( $attachment_id, $errors = null, $send = true ) { $send = ""; if ( empty($form_fields['save']) && empty($form_fields['_send']) ) { - $form_fields['save'] = array('tr' => "\t\t$delete$save$send\n"); + $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"); + $form_fields['send'] = array('tr' => "\t\t$delete$send"); } $hidden_fields = array(); @@ -773,13 +543,15 @@ function multimedia_upload_form( $errors = null ) { ?>
-

+

+
-
+ +
get_error_message(); ?> -
+
-
+
+

+

+
+

@@ -838,8 +610,6 @@ jQuery(function($){

- -
@@ -847,8 +617,7 @@ jQuery(function($){

- - +

@@ -862,20 +631,30 @@ add_action('admin_head_multimedia_upload_form', 'media_admin_css'); add_filter('async_upload_multimedia', 'get_multimedia_item', 10, 2); add_filter('media_upload_multimedia', 'multimedia_upload_handler'); + // Any 'attachment' taxonomy will be included in the description input form for the multi uploader // Example: +/* register_taxonomy( - // 'image_people', 'attachment:image', array( 'label' => __('People'), - 'template' => __('People: %s'), + 'template' => __('People: %l'), + 'helps' => __('Left to right, top to bottom.'), 'sort' => true, 'args' => array( 'orderby' => 'term_order' ) ) ); +*/ +/* +register_taxonomy('movie_director', 'attachment:video', array('label'=>__('Directors'), 'template'=>__('Directed by %l.'))); +register_taxonomy('movie_producer', 'attachment:video', array('label'=>__('Producers'), 'template'=>__('Produced by %l.'))); +register_taxonomy('movie_screenwriter', 'attachment:video', array('label'=>__('Screenwriter'), 'template'=>__('Screenplay by %l.'))); +register_taxonomy('movie_actor', 'attachment:video', array('label'=>__('Cast'), 'template'=>array(__('Cast: %l.'))); +register_taxonomy('movie_crew', 'attachment:video', array('label'=>__('Crew'), 'template'=>array(__('Crew: %l.'))); +*/ ?> diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 2c6020082c..4156ec4f65 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -125,6 +125,8 @@ add_filter('comment_excerpt', 'convert_chars'); add_filter('list_cats', 'wptexturize'); add_filter('single_post_title', 'wptexturize'); +add_filter('wp_sprintf', 'wp_sprintf_l', 10, 2); + // RSS filters add_filter('the_title_rss', 'strip_tags'); add_filter('the_title_rss', 'ent2ncr', 8); diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 241701e133..67cff31138 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1277,4 +1277,97 @@ function wp_pre_kses_less_than_callback( $matches ) { return $matches[0]; } +/** + * wp_sprintf() - sprintf() with filters + */ +function wp_sprintf( $pattern ) { + $args = func_get_args( ); + $len = strlen($pattern); + $start = 0; + $result = ''; + $arg_index = 0; + while ( $len > $start ) { + // Last character: append and break + if ( strlen($pattern) - 1 == $start ) { + $result .= substr($pattern, -1); + break; + } + + // Literal %: append and continue + if ( substr($pattern, $start, 2) == '%%' ) { + $start += 2; + $result .= '%'; + continue; + } + + // Get fragment before next % + $end = strpos($pattern, '%', $start + 1); + if ( false === $end ) + $end = $len; + $fragment = substr($pattern, $start, $end - $start); + + // Fragment has a specifier + if ( $pattern{$start} == '%' ) { + // Find numbered arguments or take the next one in order + if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) { + $arg = isset($args[$matches[1]]) ? $args[$matches[1]] : ''; + $fragment = str_replace("%{$matches[1]}$", '%', $fragment); + } else { + ++$arg_index; + $arg = isset($args[$arg_index]) ? $args[$arg_index] : ''; + } + + // Apply filters OR sprintf + $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg ); + if ( $_fragment != $fragment ) + $fragment = $_fragment; + else + $fragment = sprintf($fragment, strval($arg) ); + } + + // Append to result and move to next fragment + $result .= $fragment; + $start = $end; + } + return $result; +} + +/** + * wp_sprintf_l - List specifier %l for wp_sprintf + * + * @param unknown_type $pattern + * @param unknown_type $args + * @return unknown + */ +function wp_sprintf_l($pattern, $args) { + // Not a match + if ( substr($pattern, 0, 2) != '%l' ) + return $pattern; + + // Nothing to work with + if ( empty($args) ) + return ''; + + // Translate and filter the delimiter set (avoid ampersands and entities here) + $l = apply_filters('wp_sprintf_l', array( + 'between' => _c(', |between list items'), + 'between_last_two' => _c(', and |between last two list items'), + 'between_only_two' => _c(' and |between only two list items'), + )); + + $args = (array) $args; + $result = array_shift($args); + if ( count($args) == 1 ) + $result .= $l['between_two'] . array_shift($args); + // Loop when more than two args + while ( count($args) ) { + $arg = array_shift($args); + if ( $i == 1 ) + $result .= $l['between_last_two'] . $arg; + else + $result .= $l['between'] . $arg; + } + return $result . substr($pattern, 2); +} + ?> diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index c5be59fc2e..9d416142a1 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -941,8 +941,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button if ( $media_buttons ) { ?>
- - +
diff --git a/wp-includes/images/audio.png b/wp-includes/images/audio.png new file mode 100644 index 0000000000000000000000000000000000000000..7b2a854e3bf25a0a1279f1f1d6c5484f90be56eb GIT binary patch literal 574 zcmV-E0>S->P);o;$j ziHF(Q*}=oayS%;6(9&RtVnT~QEO0QLprw|WnR2#v$IHp5rlw-qR*txmvEZDn%J9?H z=g#QB-tgh`z4PSx?&S90z-sa?HUIztbV)=(RCwBK(uZ=xAPffJ2#^4= zJu^Dq|1AroZQ>!1^PN8bC$KM<-_q*8h9Sjr*_RT%q?CxrWl#rzt%Imrv9V-Nz&~MD ziOmj3`A2$0Vrln4zJ-)%K$tyvRu?=(X11q5c3{alqI3#0&vqhjREkvIfOx)ce9lvz z=Fn!fakEiUaI{x9=RD>y^bOenDb(_Ly@nc*-4t|N@32WQ%d&jVzCHmM--q3TxUS1G zdxKTneBTrG1^`VRa;0Dg2Dk-mBfkNFRo5}h6r@&I6LeeDCc&5*%~KF)iol@T$KNDi z1OSl&YwMizr7e5|M3UfK2=!;k-2d*|MkOZP$HDV8l zJ4gzmLpVv`gbnC644naypn)D1Pr$KWz|v{GfGpPh9nZ7fiu@5^0Qi&>V+0Cs+yDRo M07*qoM6N<$f&v~BDF6Tf literal 0 HcmV?d00001 diff --git a/wp-includes/images/css.png b/wp-includes/images/css.png new file mode 100644 index 0000000000000000000000000000000000000000..038e34de7f8ff08e9da24a0adf247b2d17f5ee3a GIT binary patch literal 533 zcmV+w0_y#VP)Gox`}+Ih;^O4wZYcq&d$!**w~Pekh;3M=H}+Kw6uD9dO5BW2mk;9OG!jQRCwBK(%F)OAP_)N7X$%u zVKMIh|6fki>I8_ls(m^|Ln>MJRCeWE_S!5Ur50mm?T&5v0l5caR0_qUHGKt-IJQxX z1W4>!GrOr)PQ3vs#t{U7deo7~8MN=aC(395$r%VRFJ=$mj1YXFOYCwq$GWbQGl9rE z>|#>sV}e#!eF6T6w*mog)h?e*0v-hyQOjb0d;z7@TKgEb3;*0X0992{>{1`*#S(y` zsIUj&8Wn+C|`rl77FZ77cQmo9#RuesyA{{nrIm(JjCt@D?3_9wsq X#atcCV8yGN00000NkvXXu0mjfxj_VW literal 0 HcmV?d00001 diff --git a/wp-includes/images/default.png b/wp-includes/images/default.png new file mode 100644 index 0000000000000000000000000000000000000000..c551227fb7ce05c255d59e4adb788402dde84237 GIT binary patch literal 479 zcmV<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~@mN&&Asl08z z>3-Q<{olw66dCwfIIA@@3NHso+QuFAey zz1w~E9G$-cnZ6noAhg z?|vvA#wZ^ucEA7M-Cpj7DfxmmHZx|w@mt^~m)@DRwz1*bEa}^`=QOaWC@^w*Fc`db swMq-HQK(V)A9AVs&n1i3|LZSG2i(&LduRLp5YSN!p00i_>zopr0HGO3(*OVf literal 0 HcmV?d00001 diff --git a/wp-includes/images/html.png b/wp-includes/images/html.png new file mode 100644 index 0000000000000000000000000000000000000000..ed81af1599c48acb7a679b7fedb8fae9986cf6c1 GIT binary patch literal 537 zcmV+!0_OdRP)=;-MF{{H>_{oLH#`1ttj?Cksc`}g?z+WJVVM7cJObvGN}{)xzk*YQ!CUqK zBDF8GOnt2;^#%m<9t42e+ndNMXxp|(RA&J^=13qF#S#I`fx!pb#U^|goOAuuA(1z! zoe5<_54nk6AbrF`fq=8xDet=nI2CL}&2tCj0-W=498XhiEFO13fKtj+yZTg7%m@?( zO`Rw$qi*0%lJE$$ZCeyS1q7Da1Oi&Or#Z;jRMidWWDtQl5coof6uUsc7_$?75zg-* zk?(CK493yGfIG!B1HuXh1Ow;HKmvh!(rZT;VK*S1s{%2G4B*z1yny(!lo6~XtPyAo zYUkvTfE?UP1|kUiK0y5gVHE&iHyBV_*YI#DWgNo5Ptag+C6A2J7qBaNX+_uC<}cao bPk;dc&aNH~hQ^aA00000NkvXXu0mjfh{OP_ literal 0 HcmV?d00001 diff --git a/wp-includes/images/js.png b/wp-includes/images/js.png new file mode 100644 index 0000000000000000000000000000000000000000..e0862d3515efc2c64cecaeabe04ea31c939480df GIT binary patch literal 517 zcmV+g0{Z=lP)gwvl!^5Vg zrr6ln@bK`?&d!jKkmly*w6wH(dV0FLx?I`sbpQYXJ4r-ARCwBK(pi>-APhiJM}|T~ zfx-cY{qM2^NDG$l`<^6tEQ(k&Hdn=KD}#iXm0G3Q&-n+G4lpf*7n79a6-2S0TCxY= zzOZIB6Bb6i0nW4r0RU^6i4sBEwmBk{1n`*QfzO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*XJx<#?Q~f&W=R^5U>j?2(z<*0IC88xC$mwAP@pN snuW!XQ4*GU8F2uZ0%m4h@&Ew_0HzhfbP5F?&Hw-a07*qoM6N<$f}#04IsgCw literal 0 HcmV?d00001 diff --git a/wp-includes/images/tar.png b/wp-includes/images/tar.png new file mode 100644 index 0000000000000000000000000000000000000000..0468ef83d583268de91dd25b2e575992d3318048 GIT binary patch literal 1280 zcmV+b1^@bqP)FMiYWn?Ck94=jZtN`1kksot>Ta_4W4l_Ve@e<>lpVZEf-K@#yI2>+9?C^714k zB<}9+oSdBR@9+Ej`{d;0{QUeYD=Qfp8QX$;^N|$mzTV}ykcTv+uPeaJ39{#50;je&d$!#($dq@)6dV(nwpx~ z+1Z4IguT7J1qB6ve}AN;r2YN<+}zwTF)_!-$KBoCOG`_>zP_lasL9F6nVFg4;o*XU zf~BRUdwY91IXMIb1k20I*Voq;78V>F9B*%L)YQ}=AtA)X#E*}Uw6wI)(9rev_44uZ zqobp&`1knC%*=*{hF@P_pP!$QkdSe4aRLGYS|V>>%Ja&mG}QBk+Iw;dfF>+J0C@b7eVbmipaVPRo>e0+t4 zg)J>Dp`oFRi;L6J(iayO7#J9Fn+7aBy(Bxw)R6o&f;? z{r>&N#>VI9=(V-A+}qo1Y;4QS%xi0F{r&vf+S*i9RNmg+;^X4;^YZKK>^eF+JUl$7 zr>7JY6q}oyj*gCsii(4SgANW3%F4&?y0FE20n_xIS?*y-r#{{R2u}) zquMgOZT;r4fw9)rCipC4s2`a3dc{|-?{q^`I-TBl^n(egfGo=dL8uq@4XFCvnP6vU z!=?Q@OyJT26iS|Ofa4QR-IuK!NmO?)GJ#)mp#p(X-gD;@;iQkGeC^qU1xSkDuTfg; zB=8V#C>nEye#Ly*GkH)fKt+-yf*7uRi(hkHrerLnM}22az^#E$kch;(cUMQcXhL&Q z1WiXvOu#Z6$0=B_I&+GRM`g*61VLK>gR?xZJfE&3S+MlUK}C_YD->ok0Zy_ktH{f< zkO1*Vlpr9X$@2iiFp$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Nj^{U?Pg5KnS(XZ@V?)%22qe zsrLG_&ld3L5eBDpxxm6M*$Cw;o3qsevn>#lJh(`tQ3%Xm3T1XzI#id>+JL0SVmhNo zkAVRE&9H==SQZWCw--RENU4$}K{!_blU(mvz$iq*h=(3pfZs?_q6D+YZ=P)KW1;S0 zAj`(fEPyzk=T#zH?f;5WaYc$@0a+X1NF)gA>&{9Vfw@1HtE!}5WeA4_NE#ueD%2GXTeN6udh~GQimz5lx|bY=HKWBquNjQvk5e7M-Usp<*`R3y@ey(I-d4 zRi9)^;CYJT#Zo(QIUX0hU=nyK0BHPbih;k)?fx(c@X~WSU;{6v#=lcg)60zoP|@xzG^' + fileObj.name + '
'); @@ -15,12 +16,14 @@ function fileQueuedMultimedia(fileObj) { jQuery('#insert-multimedia').attr('disabled', 'disabled'); } -function uploadProgressMultimedia(fileObj, bytesDone, bytesTotal) { +function uploadStart(fileObj) { return true; } + +function uploadProgress(fileObj, bytesDone, bytesTotal) { // Lengthen the progress bar jQuery('#multimedia-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal); } -function uploadSuccessMultimedia(fileObj, serverData) { +function uploadSuccess(fileObj, serverData) { // if async-upload returned an error message, place it in the multimedia item div and return if ( serverData.match('media-upload-error') ) { jQuery('#multimedia-item-' + fileObj.id).html(serverData); @@ -34,7 +37,7 @@ function uploadSuccessMultimedia(fileObj, serverData) { jQuery('#multimedia-item-' + fileObj.id).append(serverData); // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename - jQuery('#multimedia-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail').prependTo('#multimedia-item-' + fileObj.id); + jQuery('#multimedia-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#multimedia-item-' + fileObj.id); // Replace the original filename with the new (unique) one assigned during upload jQuery('#multimedia-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#multimedia-item-' + fileObj.id + ' .filename.new')); @@ -46,50 +49,24 @@ function uploadSuccessMultimedia(fileObj, serverData) { jQuery('#multimedia-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); // Bind AJAX to the new Delete button - jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/[^0-9]/g,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();});return false;}); + jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/[^0-9]/g,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();if(jQuery('.multimedia-item').length==0)jQuery('.insert-gallery').hide();});return false;}); // Open this item if it says to start open jQuery('#multimedia-item-' + fileObj.id + ' .startopen') .removeClass('startopen') .slideToggle(500) .parent().eq(0).children('.toggle').toggle(); + + jQuery('.insert-gallery').show(); } -function uploadCompleteMultimedia(fileObj) { +function uploadComplete(fileObj) { // If no more uploads queued, enable the submit button if ( swfu.getStats().files_queued == 0 ) jQuery('#insert-multimedia').attr('disabled', ''); } -// progress and success handlers for single image upload - -function uploadLoadedImage() { - jQuery('#image-alt').attr('disabled', true); - jQuery('#image-url').attr('disabled', true); - jQuery('#image-title').attr('disabled', true); - jQuery('#image-add').attr('disabled', true); -} - -function fileQueuedImage(fileObj) { - jQuery('#flash-upload-ui').append('

' + fileObj.name + '

'); -} - -function uploadProgressImage(fileObj, bytesDone, bytesTotal) { - jQuery('#image-progress .bar').width(450*bytesDone/bytesTotal); -} - -function uploadSuccessImage(fileObj, serverData) { - if ( serverData.match('media-upload-error') ) { - jQuery('#media-upload-error').replaceWith(serverData); - jQuery('#image-progress').replaceWith(''); - } - else { - jQuery('#media-upload-error').replaceWith(''); - jQuery('#flash-upload-ui').replaceWith(serverData); - } -} - // wp-specific error handlers // generic message @@ -121,14 +98,6 @@ function fileQueueError(fileObj, error_code, message) { } } -function fileQueued(fileObj) { - try { - var txtFileName = document.getElementById("txtFileName"); - txtFileName.value = fileObj.name; - } catch (e) { } - -} - function fileDialogComplete(num_files_queued) { try { if (num_files_queued > 0) { @@ -139,171 +108,33 @@ function fileDialogComplete(num_files_queued) { } } -function uploadProgress(fileObj, bytesLoaded, bytesTotal) { - - try { - var percent = Math.ceil((bytesLoaded / bytesTotal) * 100) - - fileObj.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file - var progress = new FileProgress(fileObj, this.customSettings.progress_target); - progress.SetProgress(percent); - progress.SetStatus("Uploading..."); - } catch (e) { } -} - -function uploadSuccess(fileObj, server_data) { - try { - fileObj.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file - var progress = new FileProgress(fileObj, this.customSettings.progress_target); - progress.SetComplete(); - progress.SetStatus("Complete."); - progress.ToggleCancel(false); - - if (server_data === " ") { - this.customSettings.upload_successful = false; - } else { - this.customSettings.upload_successful = true; - document.getElementById("hidFileID").value = server_data; - } - - } catch (e) { } -} - -function uploadComplete(fileObj) { - try { - if (this.customSettings.upload_successful) { - document.getElementById("btnBrowse").disabled = "true"; - uploadDone(); - } else { - fileObj.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file - var progress = new FileProgress(fileObj, this.customSettings.progress_target); - progress.SetError(); - progress.SetStatus("File rejected"); - progress.ToggleCancel(false); - - var txtFileName = document.getElementById("txtFileName"); - txtFileName.value = ""; - //validateForm(); - - alert("There was a problem with the upload.\nThe server did not accept it."); - } - } catch (e) { } -} - function uploadError(fileObj, error_code, message) { - - // first the file specific error - if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) { - wpFileError(fileObj, swfuploadL10n.missing_upload_url); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) { - wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded); - } - else { - wpFileError(fileObj, swfuploadL10n.default_error); - } - - // not sure if this is needed - fileObj.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file - var progress = new FileProgress(fileObj, this.customSettings.progress_target); - progress.SetError(); - progress.ToggleCancel(false); +alert(message);return; + // first the file specific error + if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) { + wpFileError(fileObj, swfuploadL10n.missing_upload_url); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) { + wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded); + } + else { + wpFileError(fileObj, swfuploadL10n.default_error); + } - // now the general upload status - if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) { - wpQueueError(swfuploadL10n.http_error); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) { - wpQueueError(swfuploadL10n.upload_failed); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) { - wpQueueError(swfuploadL10n.io_error); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) { - wpQueueError(swfuploadL10n.security_error); - } - else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) { - wpQueueError(swfuploadL10n.security_error); - } -} - - -/* ******************************************************** - * Utility for displaying the file upload information - * This is not part of SWFUpload, just part of the demo - * ******************************************************** */ -function FileProgress(fileObj, target_id) { - this.file_progress_id = fileObj.id; - - this.fileProgressElement = document.getElementById(this.file_progress_id); - if (!this.fileProgressElement) { - this.fileProgressElement = document.createElement("div"); - this.fileProgressElement.className = "progressContainer"; - this.fileProgressElement.id = this.file_progress_id; - - var progressCancel = document.createElement("a"); - progressCancel.className = "progressCancel"; - progressCancel.href = "#"; - progressCancel.style.visibility = "hidden"; - progressCancel.appendChild(document.createTextNode(" ")); - - var progressText = document.createElement("div"); - progressText.className = "progressName"; - progressText.appendChild(document.createTextNode(fileObj.name)); - - var progressBar = document.createElement("div"); - progressBar.className = "progressBarInProgress"; - - var progressStatus = document.createElement("div"); - progressStatus.className = "progressBarStatus"; - progressStatus.innerHTML = " "; - - this.fileProgressElement.appendChild(progressCancel); - this.fileProgressElement.appendChild(progressText); - this.fileProgressElement.appendChild(progressStatus); - this.fileProgressElement.appendChild(progressBar); - - document.getElementById(target_id).appendChild(this.fileProgressElement); - - } - -} -FileProgress.prototype.SetStart = function() { - this.fileProgressElement.className = "progressContainer"; - this.fileProgressElement.childNodes[3].className = "progressBarInProgress"; - this.fileProgressElement.childNodes[3].style.width = ""; -} - -FileProgress.prototype.SetProgress = function(percentage) { - this.fileProgressElement.className = "progressContainer green"; - this.fileProgressElement.childNodes[3].className = "progressBarInProgress"; - this.fileProgressElement.childNodes[3].style.width = percentage + "%"; -} -FileProgress.prototype.SetComplete = function() { - this.fileProgressElement.className = "progressContainer blue"; - this.fileProgressElement.childNodes[3].className = "progressBarComplete"; - this.fileProgressElement.childNodes[3].style.width = ""; - - -} -FileProgress.prototype.SetError = function() { - this.fileProgressElement.className = "progressContainer red"; - this.fileProgressElement.childNodes[3].className = "progressBarError"; - this.fileProgressElement.childNodes[3].style.width = ""; -} -FileProgress.prototype.SetCancelled = function() { - this.fileProgressElement.className = "progressContainer"; - this.fileProgressElement.childNodes[3].className = "progressBarError"; - this.fileProgressElement.childNodes[3].style.width = ""; -} -FileProgress.prototype.SetStatus = function(status) { - this.fileProgressElement.childNodes[2].innerHTML = status; -} - -FileProgress.prototype.ToggleCancel = function(show, upload_obj) { - this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden"; - if (upload_obj) { - var file_id = this.file_progress_id; - this.fileProgressElement.childNodes[0].onclick = function() { upload_obj.cancelUpload(file_id); return false; }; - } + // now the general upload status + if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) { + wpQueueError(swfuploadL10n.http_error); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) { + wpQueueError(swfuploadL10n.upload_failed); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) { + wpQueueError(swfuploadL10n.io_error); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) { + wpQueueError(swfuploadL10n.security_error); + } + else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) { + wpQueueError(swfuploadL10n.security_error); + } } diff --git a/wp-includes/media.php b/wp-includes/media.php index 7db43be898..878a808d69 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -85,7 +85,7 @@ function get_image_tag($id, $alt, $title, $align, $rel = false, $size='medium') list( $img_src, $width, $height ) = image_downsize($id, $size); $hwstring = image_hwstring($width, $height); - $html = ''.attribute_escape($alt).''; + $html = ''.attribute_escape($alt).''; $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 64c9899d00..98f174fc64 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -362,8 +362,8 @@ function walk_page_dropdown_tree() { // Attachments // -function the_attachment_link($id = 0, $fullsize = false, $max_dims = false) { - echo get_the_attachment_link($id, $fullsize, $max_dims); +function the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { + echo get_the_attachment_link($id, $fullsize, $max_dims, $permalink); } function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { diff --git a/wp-includes/post.php b/wp-includes/post.php index ff4d97fa85..b513d1fb85 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2302,41 +2302,55 @@ function wp_attachment_is_image( $post_id = 0 ) { */ function wp_mime_type_icon( $mime = 0 ) { $post_id = 0; - if ( is_numeric($mime) ) { - $mime = (int) $mime; - if ( !$post =& get_post( $mime ) ) - return false; - $post_id = (int) $post->ID; - $mime = $post->post_mime_type; - } - if ( empty($mime) ) - return false; + $icon = wp_cache_get('mime_type_icon'); + + if ( empty($icon) ) { + if ( is_numeric($mime) ) { + $mime = (int) $mime; + if ( !$post =& get_post( $mime ) ) + return false; + $post_id = (int) $post->ID; + $mime = $post->post_mime_type; + $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid); + } + + $types = array(); + + if ( !empty($ext) ) + $types[] = $ext; + + $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); + $icon_dir_uri = apply_filters( 'icon_dir_uri', get_template_directory_uri() . '/images' ); + $image_dir = apply_filters( 'image_dir', ABSPATH . WPINC . '/images' ); + $image_dir_uri = apply_filters( 'image_dir', get_option('siteurl') . '/' . WPINC . '/images' ); + $dirs = array($icon_dir => $icon_dir_uri, $image_dir => $image_dir_uri); + + + if ( ! empty($mime) ) { + $types[] = substr($mime, 0, strpos($mime, '/')); + $types[] = substr($mime, strpos($mime, '/') + 1); + $types[] = str_replace('/', '_', $mime); + } + + $types[] = 'default'; + + $exts = array('png', 'gif', 'jpg'); - $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); - $icon_dir_uri = apply_filters( 'icon_dir_uri', get_template_directory_uri() . '/images' ); - - $types = array( - substr($mime, 0, strpos($mime, '/')), - substr($mime, strpos($mime, '/') + 1), - str_replace('/', '_', $mime) - ); - - $exts = array('jpg', 'gif', 'png'); - - $src = false; - - foreach ( $types as $type ) { - foreach ( $exts as $ext ) { - $src_file = "$icon_dir/$type.$ext"; - if ( file_exists($src_file) ) { - $src = "$icon_dir_uri/$type.$ext"; - break 2; + foreach ( $types as $type ) { + foreach ( $exts as $ext ) { + foreach ( $dirs as $dir => $uri ) { + $src_file = "$dir/$type.$ext"; + if ( file_exists($src_file) ) { + $icon = "$uri/$type.$ext"; + break 3; + } + } } } } - return apply_filters( 'wp_mime_type_icon', $src, $mime, $post_id ); // Last arg is 0 if function pass mime type. + return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type. } /** diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index e7a1421820..7978a98ab2 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -94,7 +94,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-20080216'); + $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080220'); // 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.',