Changeset 6876
- Timestamp:
- 02/16/2008 09:54:47 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/media.css
r6795 r6876 45 45 } 46 46 47 .media-upload-form label.form-help {47 .media-upload-form label.form-help, td.help { 48 48 color: #9a9a9a; 49 49 font-style: italic; … … 85 85 86 86 /* specific to the image upload form */ 87 .media-upload-form fieldset#image-align label {87 .media-upload-form fieldset#image-align label, .align .field label { 88 88 display: inline; 89 89 padding: 0 0 0 28px; 90 90 margin: 0 0; 91 91 } 92 93 #image-align-none-label { 92 .media-upload-form fieldset#image-align input, .align .field input { 93 margin-left: 15px; 94 } 95 96 #image-align-none-label, .image-align-none-label { 94 97 background: url(../images/align-none.png) no-repeat center left; 95 98 } 96 99 97 #image-align-left-label {100 #image-align-left-label, .image-align-left-label { 98 101 background: url(../images/align-left.png) no-repeat center left; 99 102 } 100 103 101 #image-align-center-label {104 #image-align-center-label, .image-align-center-label { 102 105 background: url(../images/align-center.png) no-repeat center left; 103 106 } 104 107 105 #image-align-right-label {108 #image-align-right-label, .image-align-right-label { 106 109 background: url(../images/align-right.png) no-repeat center left; 107 110 } … … 154 157 border-top: 1px solid #d0d0d0; 155 158 padding: 5px; 156 } 157 .describe fieldset { 158 width: 470px; 159 float: right; 160 } 161 .describe img { 162 float: left; 159 width: 100%; 160 } 161 .startopen .describe { 162 display: auto; 163 } 164 .required abbr { 165 color: red; 166 text-decoration: none; 167 border: none; 168 } 169 170 .describe label { 171 display: inline; 172 } 173 .describe td { 174 vertical-align: middle; 175 } 176 .describe td.A1 { 177 width: 132px; 178 } 179 .describe td.savesend { 180 text-align: right; 163 181 } 164 182 .describe input[type="text"], .describe textarea { 165 width: 450px; 166 } 167 .describe label { 168 padding-right: 1em; 169 } 170 p.delete { 171 clear: both; 172 margin: 0; 173 } 174 p.delete a { 175 padding: 4px; 183 width: 460px; 184 } 185 .describe a.delete { 186 display: block; 187 text-align: center; 188 line-height: 24px; 189 width: 100%; 176 190 } 177 191 .describe-toggle-on, .describe-toggle-off { … … 194 208 z-index: 10; 195 209 } 210 tr.submit input { 211 width: 128px; 212 } 213 tr.align td.field { 214 text-align: center; 215 } -
trunk/wp-admin/includes/media.php
r6874 r6876 175 175 wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image', $_POST, $id ); 176 176 else { 177 image_send_to_editor($id, $_POST['image-alt'], $_POST['image-title'], $_POST['image-align'], $_POST['image-url']);177 media_send_to_editor(get_image_send_to_editor($id, $_POST['image-alt'], $_POST['image-title'], $_POST['image-align'], $_POST['image-url'])); 178 178 } 179 179 } … … 233 233 } 234 234 235 function image_send_to_editor($id, $alt, $title, $align, $url='') {235 function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false) { 236 236 237 237 $img_src = wp_get_attachment_url($id); … … 244 244 } 245 245 246 $html = '<img src="'.attribute_escape($img_src).'" rel="attachment wp-att-'.attribute_escape($id).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'"'.$hwstring.' class="align-'.attribute_escape($align).'" />'; 247 246 $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'"'.$hwstring.' class="align-'.attribute_escape($align).'" />'; 247 248 $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : ''; 248 249 if ( $url ) 249 $html = '<a href="'.attribute_escape($url).'">'.$html.'</a>';250 $html = "<a href='".attribute_escape($url)."'$rel>$html</a>"; 250 251 251 252 $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); 252 253 253 media_send_to_editor($html);254 return $html; 254 255 } 255 256 … … 263 264 </script> 264 265 <?php 266 exit; 265 267 } 266 268 … … 431 433 } 432 434 433 if ( empty($_POST) ) { 434 // no button click, we're just displaying the form 435 wp_iframe( 'multimedia_upload_form' ); 436 } elseif ( empty($_POST['upload-button']) ) { 437 // Insert multimedia button was clicked 438 check_admin_referer('multimedia-form'); 439 440 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 441 $post = $_post = get_post($attachment_id, ARRAY_A); 435 // no button click, we're just displaying the form 436 if ( empty($_POST) ) 437 return wp_iframe( 'multimedia_upload_form' ); 438 439 check_admin_referer('multimedia-form'); 440 441 // Insert multimedia button was clicked 442 if ( !empty($_FILES) ) { 443 // Upload File button was clicked 444 445 $id = media_handle_upload('async-upload', $_REQUEST['post_id']); 446 447 if ( is_wp_error($id) ) 448 $errors['upload_error'] = $id; 449 } 450 451 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 452 $post = $_post = get_post($attachment_id, ARRAY_A); 453 if ( isset($attachment['post_content']) ) 442 454 $post['post_content'] = $attachment['post_content']; 455 if ( isset($attachment['post_title']) ) 443 456 $post['post_title'] = $attachment['post_title']; 444 if ( $post != $_post ) 445 wp_update_post($post); 446 447 if ( $taxonomies = get_object_taxonomies('attachment') ) foreach ( $taxonomies as $t ) 448 if ( isset($attachment[$t]) ) 449 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 457 if ( isset($attachment['post_excerpt']) ) 458 $post['post_excerpt'] = $attachment['post_excerpt']; 459 460 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 461 462 if ( isset($post['errors']) ) { 463 $errors[$attachment_id] = $post['errors']; 464 unset($post['errors']); 450 465 } 451 466 452 media_send_to_editor('[gallery]'); 453 } else { 454 // Upload File button was clicked 455 456 $id = media_handle_upload('async-upload', $_REQUEST['post_id']); 457 458 wp_iframe( 'multimedia_upload_form' ); 459 } 460 } 461 462 function get_multimedia_items( $post_id ) { 467 if ( $post != $_post ) 468 wp_update_post($post); 469 470 foreach ( get_attachment_taxonomies($post) as $t ) 471 if ( isset($attachment[$t]) ) 472 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 473 } 474 475 if ( isset($_POST['insert-multimedia']) ) 476 return media_send_to_editor('[gallery]'); 477 478 if ( isset($_POST['send']) ) { 479 $send_id = (int) array_shift(array_keys($_POST['send'])); 480 $attachment = $_POST['attachments'][$send_id]; 481 $html = apply_filters('media_send_to_editor', get_the_attachment_link($send_id, 0, array(125,125), !empty($attachment['post_content'])), $send_id, $attachment); 482 return media_send_to_editor($html); 483 } 484 485 wp_iframe( 'multimedia_upload_form', $errors ); 486 } 487 488 function get_multimedia_items( $post_id, $errors ) { 463 489 $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=\"menu_order ASC, ID ASC\""); 464 490 … … 468 494 foreach ( $attachments as $id => $attachment ) { 469 495 $output .= "\n<div id='multimedia-item-$id' class='multimedia-item preloaded'><div id='media-upload-error-$id'></div><span class='filename'></span><div class='progress'><div class='bar'></div></div>"; 470 $output .= get_multimedia_item($id );496 $output .= get_multimedia_item($id, isset($errors[$id]) ? $errors[$id] : null); 471 497 $output .= " <div class='progress clickmask'></div>\n</div>"; 472 498 } … … 475 501 } 476 502 477 function get_multimedia_item( $attachment_id ) { 503 function get_attachment_taxonomies($attachment) { 504 if ( is_int( $attachment ) ) 505 $attachment = get_post($attachment); 506 else if ( is_array($attachment) ) 507 $attachment = (object) $attachment; 508 509 if ( ! is_object($attachment) ) 510 return array(); 511 512 $filename = basename($attachment->guid); 513 514 $objects = array('attachment'); 515 516 if ( false !== strpos($filename, '.') ) 517 $objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1); 518 if ( !empty($attachment->post_mime_type) ) { 519 $objects[] = 'attachment:' . $attachment->post_mime_type; 520 if ( false !== strpos($attachment->post_mime_type, '/') ) 521 foreach ( explode('/', $attachment->post_mime_type) as $token ) 522 if ( !empty($token) ) 523 $objects[] = "attachment:$token"; 524 } 525 526 $taxonomies = array(); 527 foreach ( $objects as $object ) 528 if ( $taxes = get_object_taxonomies($object) ) 529 $taxonomies = array_merge($taxonomies, $taxes); 530 531 return array_unique($taxonomies); 532 } 533 534 function image_attachment_fields_to_edit($form_fields, $post) { 535 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 536 $form_fields['post_title']['required'] = true; 537 $form_fields['post_excerpt']['label'] = __('Alternate Text'); 538 $form_fields['post_content']['label'] = __('Description'); 539 540 if ( strlen(trim($post->post_excerpt)) == 0 ) 541 $form_fields['post_excerpt']['helps'][] = __('Alternate Text helps people who can not see the image.'); 542 543 $form_fields['_send']['url'] = array( 544 'label' => __('Link URL'), 545 'input' => 'html', 546 'html' => '', 547 'helps' => __('If filled, this will override the default link URL.'), 548 ); 549 $form_fields['_send']['align'] = array( 550 'label' => __('Alignment'), 551 'input' => 'html', 552 'html' => " 553 <input type='radio' name='attachments[$post->ID][align]' id='image-align-none-$post->ID' value='none' /> 554 <label for='image-align-none-$post->ID' class='align image-align-none-label'>" . __('None') . "</label> 555 <input type='radio' name='attachments[$post->ID][align]' id='image-align-left-$post->ID' value='left' /> 556 <label for='image-align-left-$post->ID' class='align image-align-left-label'>" . __('Left') . "</label> 557 <input type='radio' name='attachments[$post->ID][align]' id='image-align-center-$post->ID' value='center' /> 558 <label for='image-align-center-$post->ID' class='align image-align-center-label'>" . __('Center') . "</label> 559 <input type='radio' name='attachments[$post->ID][align]' id='image-align-right-$post->ID' value='right' /> 560 <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 561 ); 562 } 563 return $form_fields; 564 } 565 566 add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2); 567 568 function image_attachment_fields_to_save($post, $attachment) { 569 if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { 570 if ( strlen(trim($post['post_title'])) == 0 ) { 571 $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid'])); 572 $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.'); 573 } 574 } 575 576 return $post; 577 } 578 579 add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2); 580 581 function image_media_send_to_editor($html, $attachment_id, $attachment) { 582 $post =& get_post($attachment_id); 583 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 584 if ( !empty($attachment['url']) ) 585 $url = $attachment['url']; 586 elseif ( $rel = strlen(trim($post->post_content)) ) 587 $url = get_attachment_link($attachment_id); 588 else 589 $url = wp_get_attachment_url($attachment_id); 590 591 if ( isset($attachment['align']) ) 592 $align = $attachment['align']; 593 else 594 $align = 'none'; 595 596 return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel); 597 } 598 599 return $html; 600 } 601 602 add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3); 603 604 function get_attachment_fields_to_edit($post, $errors = null) { 605 if ( is_int($post) ) 606 $post =& get_post($post); 607 if ( is_array($post) ) 608 $post = (object) $post; 609 610 $edit_post = sanitize_post($post, 'edit'); 611 612 $form_fields = array( 613 'post_title' => array( 614 'label' => __('Title'), 615 'value' => $edit_post->post_title, 616 ), 617 'post_excerpt' => array( 618 'label' => __('Excerpt'), 619 'value' => $edit_post->post_excerpt, 620 ), 621 'post_content' => array( 622 'label' => __('Description'), 623 'value' => $edit_post->post_content, 624 'input' => 'textarea', 625 'helps' => array(__('If filled, the default link URL will be the attachment permalink.')), 626 ), 627 ); 628 629 foreach ( get_attachment_taxonomies($post) as $taxonomy ) { 630 $t = (array) get_taxonomy($taxonomy); 631 if ( empty($t['label']) ) 632 $t['label'] = $taxonomy; 633 if ( empty($t['args']) ) 634 $t['args'] = array(); 635 636 $terms = get_object_term_cache($post->ID, $taxonomy); 637 if ( empty($terms) ) 638 $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); 639 640 $values = array(); 641 642 foreach ( $terms as $term ) 643 $values[] = $term->name; 644 $t['value'] = join(', ', $values); 645 646 $form_fields[$taxonomy] = $t; 647 } 648 649 // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default 650 // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) 651 $form_fields = array_merge_recursive($form_fields, (array) $errors); 652 653 $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); 654 655 return $form_fields; 656 } 657 658 function get_multimedia_item( $attachment_id, $errors = null, $send = true ) { 478 659 $thumb_url = wp_get_attachment_thumb_url( $attachment_id ); 479 660 if ( empty($thumb_url) ) … … 500 681 } 501 682 502 $ delete_href = wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id);503 $delete = __('Delete'); 504 683 $form_fields = get_attachment_fields_to_edit($post, $errors); 684 685 $class = empty($errors) ? 'startclosed' : 'startopen'; 505 686 $item = " 506 687 <a class='toggle describe-toggle-on' href='#'>$toggle_on</a> 507 688 <a class='toggle describe-toggle-off' href='#'>$toggle_off</a> 508 689 <span class='filename new'>$filename</span> 509 <div class='slidetoggle describe'> 510 <img class='thumbnail' src='$thumb_url' alt='' /> 511 <fieldset> 512 <p><label for='attachments[$attachment_id][post_title]'>$title_label</label><input type='text' id='attachments[$attachment_id][post_title]' name='attachments[$attachment_id][post_title]' value='$title' /></p> 513 <p><label for='attachments[$attachment_id][post_content]'>$description_label</label><input type='text' id='attachments[$attachment_id][post_content]' name='attachments[$attachment_id][post_content]' value='$description' /></p> 514 "; 515 516 if ( $taxonomies = get_object_taxonomies('attachment') ) foreach ( $taxonomies as $t ) { 517 $tax = get_taxonomy($t); 518 $t_title = !empty($tax->title) ? $tax->title : $t; 519 if ( false === $terms = get_object_term_cache( $attachment_id, $t ) ) 520 $_terms = wp_get_object_terms($attachment_id, $t); 521 if ( $_terms ) { 522 foreach ( $_terms as $term ) 523 $terms[] = $term->name; 524 $terms = join(', ', $terms); 525 } else 526 $terms = ''; 527 $item .= "<p><label for='attachments[$attachment_id][$t]'>$t_title</label><input type='text' id='attachments[$attachment_id][$t]' name='attachments[$attachment_id][$t]' value='$terms' /></p>\n"; 528 } 529 530 $item .= " 531 </fieldset> 532 <p class='delete'><a id='del$attachment_id' class='delete' href='$delete_href'>$delete</a></p> 533 </div> 534 "; 690 <table class='slidetoggle describe $class'><tbody> 691 <tr> 692 <td class='A1B1' rowspan='4' colspan='2'><img class='thumbnail' src='$thumb_url' alt='' /></td> 693 <td>$filename</td> 694 </tr> 695 <tr><td>$post->post_mime_type</td></tr> 696 <tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr> 697 <tr><td>" . apply_filters('multimedia_meta', '', $post) . "</tr></td>\n"; 698 699 $defaults = array( 700 'input' => 'text', 701 'required' => false, 702 'value' => '', 703 'extra_rows' => array(), 704 ); 705 706 $delete_href = wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id); 707 $delete = __('Delete'); 708 $save = "<input type='submit' value='" . wp_specialchars(__('Save'), 1) . "' />"; 709 $send = "<input type='submit' value='" . wp_specialchars(__('Send to Editor'), 1) . "' id='send[$attachment_id]' name='send[$attachment_id]' />"; 710 711 if ( empty($form_fields['save']) && empty($form_fields['_send']) ) { 712 $form_fields['save'] = array('tr' => "\t\t<tr class='submit'><td colspan='2' class='del'><a id='del[$attachment_id]' class='delete' href='$delete_href'>$delete</a></td><td class='savesend'>$save$send</td></tr>\n"); 713 } elseif ( empty($form_fields['save']) ) { 714 $form_fields['save'] = array('tr' => "\t\t<tr class='submit'><td></td><td></td><td class='savesend'>$save</td></tr>\n"); 715 foreach ( $form_fields['_send'] as $id => $field ) 716 $form_fields[$id] = $field; 717 $form_fields['send'] = array('tr' => "\t\t<tr class='submit'><td colspan='2' class='del'><a id='del[$attachment_id]' class='delete' href='$delete_href'>$delete</a></td><td class='savesend'>$send</td>"); 718 } 719 720 $hidden_fields = array(); 721 722 foreach ( $form_fields as $id => $field ) { 723 if ( $id{0} == '_' ) 724 continue; 725 726 if ( !empty($field['tr']) ) { 727 $item .= $field['tr']; 728 continue; 729 } 730 731 $field = array_merge($defaults, $field); 732 $name = "attachments[$attachment_id][$id]"; 733 734 if ( $field['input'] == 'hidden' ) { 735 $hidden_fields[$name] = $field['value']; 736 continue; 737 } 738 739 $required = $field['required'] ? '<abbr title="required">*</abbr>' : ''; 740 $item .= "\t\t<tr class='$id'>\n\t\t\t<td class='label'><label for='$name'>{$field['label']}</label></td>\n\t\t\t<td class='required'>$required</td>\n\t\t\t<td class='field'>"; 741 if ( !empty($field[$field['input']]) ) 742 $item .= $field[$field['input']]; 743 elseif ( $field['input'] == 'textarea' ) { 744 $item .= "<textarea type='text' id='$name' name='$name'>" . wp_specialchars($field['value'], 1) . "</textarea>"; 745 } else { 746 $item .= "<input type='text' id='$name' name='$name' value='" . wp_specialchars($field['value'], 1) . "' />"; 747 } 748 $item .= "</td>\n\t\t</tr>\n"; 749 750 $extra_rows = array(); 751 752 if ( !empty($field['errors']) ) 753 foreach ( array_unique((array) $field['errors']) as $error ) 754 $extra_rows['error'][] = $error; 755 756 if ( !empty($field['helps']) ) 757 foreach ( array_unique((array) $field['helps']) as $help ) 758 $extra_rows['help'][] = $help; 759 760 if ( !empty($field['extra_rows']) ) 761 foreach ( $field['extra_rows'] as $class => $rows ) 762 foreach ( (array) $rows as $html ) 763 $extra_rows[$class][] = $html; 764 765 foreach ( $extra_rows as $class => $rows ) 766 foreach ( $rows as $html ) 767 $item .= "\t\t<tr><td colspan='2'></td><td class='$class'>$html</td></tr>\n"; 768 } 769 770 if ( !empty($form_fields['_final']) ) 771 $item .= "\t\t<tr class='final'><td colspan='3'>{$form_fields['_final']}</td></tr>\n"; 772 $item .= "\t</table>\n"; 773 774 foreach ( $hidden_fields as $name => $value ) 775 $item .= "\t<input type='hidden' name='$name' id='$name' value='" . wp_specialchars($value, 1) . "' />\n"; 535 776 536 777 return $item; 537 778 } 538 779 539 function multimedia_upload_form( $error = null ) {780 function multimedia_upload_form( $errors = null ) { 540 781 $flash_action_url = get_option('siteurl') . '/wp-admin/async-upload.php?type=multimedia'; 541 782 $form_action_url = get_option('siteurl') . '/wp-admin/media-upload.php?type=multimedia'; … … 548 789 </div> 549 790 <div id="media-upload-error"> 550 <?php if ( $error) { ?>551 <?php echo $error ->get_error_message(); ?>791 <?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?> 792 <?php echo $errors['upload_error']->get_error_message(); ?> 552 793 <?php } ?> 553 794 </div> … … 567 808 swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available 568 809 degraded_element_id : "html-upload-ui", // when swfupload is unavailable 810 swfupload_loaded_handler : uploadLoadedMultimedia, 569 811 //upload_start_handler : uploadStart, 570 812 upload_progress_handler : uploadProgressMultimedia, … … 580 822 }); 581 823 $("#flash-browse-button").bind( "click", function(){swfu.selectFiles();}); 582 $("#insert-multimedia").bind( "click", function(){jQuery(this).parents('form').get(0).submit();}); 583 $(".multimedia-item.preloaded").each(function(){uploadSuccessMultimedia({id:this.id.replace(/[^0-9]/g, '')},'');jQuery('#insert-multimedia').attr('disabled', '');}); 824 var preloaded = $(".multimedia-item.preloaded"); 825 if ( preloaded ) { 826 jQuery('#insert-multimedia').attr('disabled', ''); 827 preloaded.each(function(){uploadSuccessMultimedia({id:this.id.replace(/[^0-9]/g, '')},'');}); 828 } 584 829 $("a.delete").bind('click',function(){$.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/del/,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});$(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){$(this).remove();});return false;}); 585 830 }); … … 610 855 <div id="multimedia-items"> 611 856 612 <?php echo get_multimedia_items($post_id ); ?>857 <?php echo get_multimedia_items($post_id, $errors); ?> 613 858 614 859 </div> … … 616 861 <p class="submit"> 617 862 <a href="#" onClick="return top.tb_remove();" id="image-cancel" class="button-cancel"><?php _e('Cancel'); ?></a> 618 <input type=" button" class="submit" id="insert-multimedia" value="<?php _e('Insert gallery into post'); ?>" disabled="disabled" />863 <input type="submit" class="submit" id="insert-multimedia" name="insert-multimedia" value="<?php _e('Insert gallery into post'); ?>" disabled="disabled" /> 619 864 </p> 620 865 … … 627 872 628 873 add_action('admin_head_multimedia_upload_form', 'media_admin_css'); 629 add_filter('async_upload_multimedia', 'get_multimedia_item' );874 add_filter('async_upload_multimedia', 'get_multimedia_item', 10, 2); 630 875 add_filter('media_upload_multimedia', 'multimedia_upload_handler'); 631 876 632 877 // Any 'attachment' taxonomy will be included in the description input form for the multi uploader 633 878 // Example: 634 //register_taxonomy('attachment_people', 'attachment', array('title' => 'People')); 879 register_taxonomy( 880 // 881 'image_people', 882 'attachment:image', 883 array( 884 'label' => __('People'), 885 'template' => __('People: %s'), 886 'sort' => true, 887 'args' => array( 888 'orderby' => 'term_order' 889 ) 890 ) 891 ); 635 892 636 893 ?> -
trunk/wp-includes/js/swfupload/handlers.js
r6676 r6876 1 function uploadLoadedMultimedia() { 2 jQuery("#html-upload-ui").empty(); 3 } 4 1 5 function fileDialogStart() { 2 6 jQuery("#media-upload-error").empty(); … … 43 47 44 48 // Bind AJAX to the new Delete button 45 jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/del/,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();});return false;}); 49 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;}); 50 51 // Open this item if it says to start open 52 jQuery('#multimedia-item-' + fileObj.id + ' .startopen') 53 .removeClass('startopen') 54 .slideToggle(500) 55 .parent().eq(0).children('.toggle').toggle(); 46 56 } 47 57 -
trunk/wp-includes/post-template.php
r6711 r6876 367 367 } 368 368 369 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false ) {369 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 370 370 $id = (int) $id; 371 371 $_post = & get_post($id); … … 373 373 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) 374 374 return __('Missing Attachment'); 375 376 if ( $permalink ) 377 $url = get_attachment_link($_post->ID); 375 378 376 379 $post_title = attribute_escape($_post->post_title);
Note: See TracChangeset
for help on using the changeset viewer.