Changeset 8422 for branches/crazyhorse/wp-admin/includes/media.php
- Timestamp:
- 07/23/2008 09:20:53 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/includes/media.php
r8335 r8422 68 68 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 69 69 70 // CAPTIONS_OFF is temporary. Do not use it. 71 if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html; 70 if ( empty($alt) ) return $html; 72 71 $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 73 72 … … 179 178 return $id; 180 179 } 181 182 180 183 181 // wrap iframe content (produced by $content_func) in a doctype, html head/body etc … … 250 248 check_admin_referer('media-form'); 251 249 252 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 253 $post = $_post = get_post($attachment_id, ARRAY_A); 254 if ( isset($attachment['post_content']) ) 255 $post['post_content'] = $attachment['post_content']; 256 if ( isset($attachment['post_title']) ) 257 $post['post_title'] = $attachment['post_title']; 258 if ( isset($attachment['post_excerpt']) ) 259 $post['post_excerpt'] = $attachment['post_excerpt']; 260 if ( isset($attachment['menu_order']) ) 261 $post['menu_order'] = $attachment['menu_order']; 262 263 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 264 265 if ( isset($post['errors']) ) { 266 $errors[$attachment_id] = $post['errors']; 267 unset($post['errors']); 268 } 269 270 if ( $post != $_post ) 271 wp_update_post($post); 272 273 foreach ( get_attachment_taxonomies($post) as $t ) 274 if ( isset($attachment[$t]) ) 275 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 276 } 250 if ( !empty($_POST['attachments']) ) 251 foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 252 $post = $_post = get_post($attachment_id, ARRAY_A); 253 if ( isset($attachment['post_content']) ) 254 $post['post_content'] = $attachment['post_content']; 255 if ( isset($attachment['post_title']) ) 256 $post['post_title'] = $attachment['post_title']; 257 if ( isset($attachment['post_excerpt']) ) 258 $post['post_excerpt'] = $attachment['post_excerpt']; 259 if ( isset($attachment['menu_order']) ) 260 $post['menu_order'] = $attachment['menu_order']; 261 262 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 263 264 if ( isset($post['errors']) ) { 265 $errors[$attachment_id] = $post['errors']; 266 unset($post['errors']); 267 } 268 269 if ( $post != $_post ) 270 wp_update_post($post); 271 272 foreach ( get_attachment_taxonomies($post) as $t ) 273 if ( isset($attachment[$t]) ) 274 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 275 } 277 276 278 277 if ( isset($_POST['insert-gallery']) ) … … 296 295 } 297 296 297 // crazyhorse 298 298 function media_upload_image() { 299 299 300 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 300 301 // Upload File button was clicked 302 if ( $_FILES['async-upload']['name'] == '' ) 303 return wp_iframe( 'media_error_nofile' ); 304 301 305 $id = media_handle_upload('async-upload', $_REQUEST['post_id']); 302 306 unset($_FILES); … … 335 339 } 336 340 337 return wp_iframe( 'media_ upload_type_form', 'image', $errors, $id );341 return wp_iframe( 'media_edit_single_form', $id ); 338 342 } 339 343 … … 507 511 } 508 512 513 // crazyhorse 509 514 function image_attachment_fields_to_edit($form_fields, $post) { 510 515 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 511 516 $form_fields['post_title']['required'] = true; 512 517 513 // CAPTIONS_OFF is temporary. Do not use it. 514 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) { 515 $form_fields['post_excerpt']['label'] = __('Alternate Text'); 516 $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"'); 517 } else { 518 $form_fields['post_excerpt']['label'] = __('Caption'); 519 $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image'); 520 } 521 522 $form_fields['post_content']['label'] = __('Description'); 523 524 $thumb = wp_get_attachment_thumb_url($post->ID); 518 $form_fields['post_excerpt']['label'] = __('Caption'); 519 $form_fields['post_excerpt']['helps'][] = __('Alternate text (e.g. Blue skies)'); 520 521 // $form_fields['post_content']['label'] = __('Description'); 522 523 // $thumb = wp_get_attachment_thumb_url($post->ID); 525 524 526 525 $form_fields['align'] = array( … … 537 536 <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 538 537 ); 538 /* 539 539 $form_fields['image-size'] = array( 540 540 'label' => __('Size'), … … 548 548 <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>", 549 549 ); 550 */ 550 551 } 551 552 return $form_fields; … … 597 598 add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3); 598 599 600 // crazyhorse 599 601 function get_attachment_fields_to_edit($post, $errors = null) { 600 602 if ( is_int($post) ) … … 605 607 $edit_post = sanitize_post($post, 'edit'); 606 608 $file = wp_get_attachment_url($post->ID); 607 $link = get_attachment_link($post->ID); 608 609 // CAPTIONS_OFF is temporary. Do not use it. 610 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) 611 $alt = __('Alternate Text'); 612 else 613 $alt = __('Caption'); 609 // $link = get_attachment_link($post->ID); 614 610 615 611 $form_fields = array( 616 612 'post_title' => array( 617 613 'label' => __('Title'), 618 'value' => $edit_post->post_title ,614 'value' => $edit_post->post_title 619 615 ), 620 616 'post_excerpt' => array( 621 'label' => $alt,622 'value' => $edit_post->post_excerpt ,617 'label' => __('Caption'), 618 'value' => $edit_post->post_excerpt 623 619 ), 620 /* 624 621 'post_content' => array( 625 622 'label' => __('Description'), … … 627 624 'input' => 'textarea', 628 625 ), 626 */ 629 627 'url' => array( 630 'label' => __('Link URL'), 631 'input' => 'html', 632 'html' => " 633 <input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($file) . "' /><br /> 634 <button type='button' class='button url-$post->ID' value=''>" . __('None') . "</button> 635 <button type='button' class='button url-$post->ID' value='" . attribute_escape($file) . "'>" . __('File URL') . "</button> 636 <button type='button' class='button url-$post->ID' value='" . attribute_escape($link) . "'>" . __('Post URL') . "</button> 637 <script type='text/javascript'> 638 jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(this.value);}); 639 </script>\n", 640 'helps' => __('Enter a link URL or click above for presets.'), 641 ), 628 'label' => __('Path'), 629 'value' => attribute_escape($file) 630 ) 631 /* 642 632 'menu_order' => array( 643 633 'label' => __('Order'), 644 634 'value' => $edit_post->menu_order 645 ), 635 ),*/ 646 636 ); 647 637 /* 648 638 foreach ( get_attachment_taxonomies($post) as $taxonomy ) { 649 639 $t = (array) get_taxonomy($taxonomy); … … 665 655 $form_fields[$taxonomy] = $t; 666 656 } 667 657 */ 668 658 // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default 669 659 // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) … … 675 665 } 676 666 677 function get_media_items( $post_id, $errors ) { 667 // crazyhorse 668 function get_media_items( $post_id ) { 678 669 if ( $post_id ) { 679 670 $post = get_post($post_id); … … 691 682 return ''; 692 683 684 $ins = isset($_REQUEST['ins']) ? 1 : 0; 685 693 686 foreach ( $attachments as $id => $attachment ) 694 if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) ) 695 $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>"; 687 if ( $item = get_media_item_link( $id, $ins ) ) 688 $output .= $item; 689 690 // $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div>$item\n</div>"; 696 691 697 692 return $output; 693 } 694 695 // crazyhorse 696 function get_media_item_link( $attachment_id, $ins ) { 697 698 if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) 699 $thumb_url = $thumb_url[0]; 700 else 701 return false; 702 703 $post = get_post($attachment_id); 704 $mime = $post->post_mime_type; 705 706 if ( false !== strpos($mime, 'image') ) $type = 'image'; 707 elseif ( false !== strpos($mime, 'audio') ) $type = 'audio'; 708 elseif ( false !== strpos($mime, 'video') ) $type = 'video'; 709 else $type = 'file'; 710 711 $ins = $ins ? '&ins=1' : ''; 712 $filename = basename($post->guid); 713 $title = attribute_escape($post->post_title); 714 $link = 'media-upload.php?att_id='.$attachment_id.'&tab=single&type='.$type.$ins; 715 716 $item = '<div class="filelink"> 717 <a href="'.$link.'"> 718 <img class="thumbnail" src="'.$thumb_url.'" alt="'.$title.'" title="'.$title.'" /></a> 719 <p class="filelink-caption">'.$filename.'</p></div>'."\n"; 720 721 722 return $item; 723 } 724 725 // crazyhorse 726 function media_edit_single_form($attachment_id = 0) { 727 global $redir_tab; 728 729 $redir_tab = 'gallery'; 730 $ins = isset($_REQUEST['ins']) ? true : false; 731 732 if ( ! $attachment_id ) 733 $attachment_id = (int) $_REQUEST['att_id']; 734 735 $class = ''; 736 if ( isset($_REQUEST['type']) ) 737 $class = ' class="type-'.$_REQUEST['type'].'"'; 738 739 $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; 740 $form_action_url = admin_url("media-upload.php?type=single&tab=gallery&post_id=$post_id"); 741 742 $post = get_post($attachment_id); 743 $filename = basename($post->guid); 744 745 media_upload_header(); 746 ?> 747 748 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> 749 <?php wp_nonce_field('media-form'); ?> 750 751 <div id="att-info"><p<?php echo $class; ?>> 752 <?php echo $filename; ?> 753 (<a href="<?php echo wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id); ?>" class="del-link" onclick="return confirm('<?php echo js_escape( __("You are about to delete this file\n 'Cancel' to stop, 'OK' to delete.")); ?>');"><?php _e('Remove'); ?></a> | <a href="media-upload.php?tab=gallery<?php if ( $ins ) echo '&ins=1'; ?>"><?php _e('Change'); ?></a>) 754 </p></div> 755 756 <?php echo media_edit_single($attachment_id); ?> 757 758 <p class="ml-submit"> 759 <?php if ( $ins ) { ?> 760 <input type="submit" class="button" name="send[<?php echo $attachment_id; ?>]" value="<?php echo attribute_escape( __( 'Insert into Post' ) ) ?>" /> 761 <input type="hidden" name="ins" value="1" /> 762 <?php } ?> 763 764 <input type="submit" class="button-link button" name="save" value="<?php echo attribute_escape( __( 'Save and Add Another' ) ); ?>" /> 765 766 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 767 <input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" /> 768 <input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" /> 769 </p> 770 </form> 771 <?php 772 } 773 774 // crazyhorse 775 function media_edit_single($attachment_id = null) { 776 global $post_mime_types; 777 778 $post = get_post($attachment_id); 779 780 $filename = basename($post->guid); 781 $title_label = __('Title'); 782 $title = attribute_escape($post->post_title); 783 784 if ( isset($post_mime_types) ) { 785 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 786 $type = array_shift($keys); 787 $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />"; 788 } 789 790 $form_fields = get_attachment_fields_to_edit($post); 791 792 $defaults = array( 793 'input' => 'text', 794 'required' => false, 795 'value' => '', 796 'extra_rows' => array(), 797 ); 798 799 $hidden_fields = array(); 800 801 $item = "<table class='slidetoggle describe $class'> 802 <thead class='media-item-info'>"; 803 804 foreach ( $form_fields as $id => $field ) { 805 if ( $id{0} == '_' ) 806 continue; 807 808 if ( !empty($field['tr']) ) { 809 $item .= $field['tr']; 810 continue; 811 } 812 813 $field = array_merge($defaults, $field); 814 $name = "attachments[$attachment_id][$id]"; 815 816 if ( $field['input'] == 'hidden' ) { 817 $hidden_fields[$name] = $field['value']; 818 continue; 819 } 820 821 $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : ''; 822 $aria_required = $field['required'] ? " aria-required='true' " : ''; 823 $class = $id; 824 $class .= $field['required'] ? ' form-required' : ''; 825 826 $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>"; 827 if ( !empty($field[$field['input']]) ) 828 $item .= $field[$field['input']]; 829 elseif ( $field['input'] == 'textarea' ) { 830 $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>"; 831 } else { 832 $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>"; 833 } 834 if ( !empty($field['helps']) ) 835 $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>'; 836 $item .= "</td>\n\t\t</tr>\n"; 837 838 $extra_rows = array(); 839 840 if ( !empty($field['errors']) ) 841 foreach ( array_unique((array) $field['errors']) as $error ) 842 $extra_rows['error'][] = $error; 843 844 if ( !empty($field['extra_rows']) ) 845 foreach ( $field['extra_rows'] as $class => $rows ) 846 foreach ( (array) $rows as $html ) 847 $extra_rows[$class][] = $html; 848 849 foreach ( $extra_rows as $class => $rows ) 850 foreach ( $rows as $html ) 851 $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n"; 852 } 853 854 if ( !empty($form_fields['_final']) ) 855 $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n"; 856 $item .= "\t</tbody>\n"; 857 $item .= "\t</table>\n"; 858 859 foreach ( $hidden_fields as $name => $value ) 860 $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n"; 861 862 return $item; 863 698 864 } 699 865 … … 865 1031 ?> 866 1032 <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script> 867 <div id="media-upload-header">868 <?php the_media_upload_tabs(); ?>869 </div>870 1033 <?php 871 1034 } … … 1022 1185 if ( f.alt.value ) { 1023 1186 alt = f.alt.value.replace(/['"<>]+/g, ''); 1024 <?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>1025 1187 caption = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1026 <?php } ?>1027 1188 } 1028 1189 … … 1132 1293 } 1133 1294 1295 // crazyhorse 1134 1296 function media_upload_library_form($errors) { 1135 1297 global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; … … 1137 1299 media_upload_header(); 1138 1300 1139 $post_id = i ntval($_REQUEST['post_id']);1140 1141 $form_action_url = admin_url("media-upload.php?type= {$GLOBALS['type']}&tab=library&post_id=$post_id");1301 $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; 1302 1303 $form_action_url = admin_url("media-upload.php?type=single&tab=library&post_id=$post_id"); 1142 1304 1143 1305 $_GET['paged'] = intval($_GET['paged']); … … 1147 1309 if ( $start < 1 ) 1148 1310 $start = 0; 1149 add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) );1311 add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 8';" ) ); 1150 1312 1151 1313 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 1152 1314 $ins = isset($_REQUEST['ins']) ? '<input type="hidden" name="ins" value="1" />' : ''; 1153 1315 ?> 1154 1316 1155 <form id="filter" action="" method="get"> 1156 <input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" /> 1157 <input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" /> 1158 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> 1159 <input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" /> 1160 1161 <div id="search-filter"> 1162 <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label> 1163 <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" /> 1164 <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" /> 1317 <div id="html-upload-ui"> 1318 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate"> 1319 <input type="file" name="async-upload" id="async-upload" /> 1320 <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> 1321 1322 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1323 <?php echo $ins; ?> 1324 <?php wp_nonce_field('media-form'); ?> 1325 </form> 1165 1326 </div> 1166 1327 1167 <ul class="subsubsub"> 1168 <?php 1169 $type_links = array(); 1170 $_num_posts = (array) wp_count_attachments(); 1171 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); 1172 foreach ( $matches as $_type => $reals ) 1173 foreach ( $reals as $real ) 1174 $num_posts[$_type] += $_num_posts[$real]; 1175 // If available type specified by media button clicked, filter by that type 1176 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) { 1177 $_GET['post_mime_type'] = $type; 1178 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 1179 } 1180 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' ) 1181 $class = ' class="current"'; 1182 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>"; 1183 foreach ( $post_mime_types as $mime_type => $label ) { 1184 $class = ''; 1185 1186 if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) 1187 continue; 1188 1189 if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) 1190 $class = ' class="current"'; 1191 1192 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>'; 1193 } 1194 echo implode(' | </li>', $type_links) . '</li>'; 1195 unset($type_links); 1196 ?> 1197 </ul> 1328 <div id="html-upload-help"><?php _e('Or select from your Media Library'); ?></div> 1198 1329 1199 1330 <div class="tablenav"> 1200 1201 1331 <?php 1202 1332 $page_links = paginate_links( array( … … 1210 1340 echo "<div class='tablenav-pages'>$page_links</div>"; 1211 1341 ?> 1212 1213 <div class="alignleft">1214 <?php1215 1216 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";1217 1218 $arc_result = $wpdb->get_results( $arc_query );1219 1220 $month_count = count($arc_result);1221 1222 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>1223 <select name='m'>1224 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>1225 <?php1226 foreach ($arc_result as $arc_row) {1227 if ( $arc_row->yyear == 0 )1228 continue;1229 $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );1230 1231 if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )1232 $default = ' selected="selected"';1233 else1234 $default = '';1235 1236 echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>";1237 echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );1238 echo "</option>\n";1239 }1240 ?>1241 </select>1242 <?php } ?>1243 1244 <input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter »' ) ); ?>" class="button-secondary" />1245 1246 1342 </div> 1247 1343 1344 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form"> 1345 1346 <?php wp_nonce_field('media-form'); ?> 1347 1348 <div id="media-items"> 1349 <?php echo get_media_items(null, $errors); ?> 1248 1350 <br class="clear" /> 1249 1351 </div> 1250 1352 </form> 1251 1252 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form">1253 1254 <?php wp_nonce_field('media-form'); ?>1255 <?php //media_upload_form( $errors ); ?>1256 1257 <script type="text/javascript">1258 <!--1259 jQuery(function($){1260 var preloaded = $(".media-item.preloaded");1261 if ( preloaded.length > 0 ) {1262 preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});1263 updateMediaForm();1264 }1265 });1266 -->1267 </script>1268 1269 <div id="media-items">1270 <?php echo get_media_items(null, $errors); ?>1271 </div>1272 <p class="ml-submit">1273 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />1274 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />1275 </p>1276 </form>1277 1353 <?php 1278 1354 } 1355 1356 function media_error_nofile() { ?> 1357 <div style="text-align:center;"><h3>Please choose a file to upload</h3> 1358 <p><button onclick="history.back();" class="button">Go Back</button></p></div> 1359 <?php } 1279 1360 1280 1361 function type_form_image() { … … 1296 1377 <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td> 1297 1378 </tr> 1298 '; 1299 // CAPTIONS_OFF is temporary. Do not use it. 1300 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) { 1301 $form .= ' 1302 <tr> 1303 <th valign="top" scope="row" class="label"> 1304 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span> 1305 </th> 1306 <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" /> 1307 <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td> 1308 </tr> 1309 '; 1310 1311 } else { 1312 $form .= ' 1379 1313 1380 <tr> 1314 1381 <th valign="top" scope="row" class="label"> … … 1318 1385 <p class="help">' . __('Also used as alternate text for the image') . '</p></td> 1319 1386 </tr> 1320 '; 1321 } 1322 $form .= ' 1387 1323 1388 <tr class="align"> 1324 1389 <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
Note: See TracChangeset
for help on using the changeset viewer.