mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * WordPress Administration Media API.
mp-wp_genesis 4 *
mp-wp_genesis 5 * @package WordPress
mp-wp_genesis 6 * @subpackage Administration
mp-wp_genesis 7 */
mp-wp_genesis 8
mp-wp_genesis 9 /**
mp-wp_genesis 10 * {@internal Missing Short Description}}
mp-wp_genesis 11 *
mp-wp_genesis 12 * This handles the file upload POST itself, creating the attachment post.
mp-wp_genesis 13 *
mp-wp_genesis 14 * @since unknown
mp-wp_genesis 15 *
mp-wp_genesis 16 * @param unknown_type $file_id
mp-wp_genesis 17 * @param unknown_type $post_id
mp-wp_genesis 18 * @param unknown_type $post_data
mp-wp_genesis 19 * @return unknown
mp-wp_genesis 20 */
mp-wp_genesis 21 function media_handle_upload($file_id, $post_id, $post_data = array()) {
mp-wp_genesis 22 $overrides = array('test_form'=>false);
mp-wp_genesis 23
mp-wp_genesis 24 $time = current_time('mysql');
mp-wp_genesis 25 if ( $post = get_post($post_id) ) {
mp-wp_genesis 26 if ( substr( $post->post_date, 0, 4 ) > 0 )
mp-wp_genesis 27 $time = $post->post_date;
mp-wp_genesis 28 }
mp-wp_genesis 29
mp-wp_genesis 30 $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
mp-wp_genesis 31
mp-wp_genesis 32 if ( isset($file['error']) )
mp-wp_genesis 33 return new WP_Error( 'upload_error', $file['error'] );
mp-wp_genesis 34
mp-wp_genesis 35 $url = $file['url'];
mp-wp_genesis 36 $type = $file['type'];
mp-wp_genesis 37 $file = $file['file'];
mp-wp_genesis 38 $title = preg_replace('/\.[^.]+$/', '', basename($file));
mp-wp_genesis 39 $content = '';
mp-wp_genesis 40
mp-wp_genesis 41 // use image exif/iptc data for title and caption defaults if possible
mp-wp_genesis 42 if ( $image_meta = @wp_read_image_metadata($file) ) {
mp-wp_genesis 43 if ( trim($image_meta['title']) )
mp-wp_genesis 44 $title = $image_meta['title'];
mp-wp_genesis 45 if ( trim($image_meta['caption']) )
mp-wp_genesis 46 $content = $image_meta['caption'];
mp-wp_genesis 47 }
mp-wp_genesis 48
mp-wp_genesis 49 // Construct the attachment array
mp-wp_genesis 50 $attachment = array_merge( array(
mp-wp_genesis 51 'post_mime_type' => $type,
mp-wp_genesis 52 'guid' => $url,
mp-wp_genesis 53 'post_parent' => $post_id,
mp-wp_genesis 54 'post_title' => $title,
mp-wp_genesis 55 'post_content' => $content,
mp-wp_genesis 56 ), $post_data );
mp-wp_genesis 57
mp-wp_genesis 58 // Save the data
mp-wp_genesis 59 $id = wp_insert_attachment($attachment, $file, $post_id);
mp-wp_genesis 60 if ( !is_wp_error($id) ) {
mp-wp_genesis 61 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
mp-wp_genesis 62 }
mp-wp_genesis 63
mp-wp_genesis 64 return $id;
mp-wp_genesis 65
mp-wp_genesis 66 }
mp-wp_genesis 67
mp-wp_genesis 68 /**
mp-wp_genesis 69 * {@internal Missing Short Description}}
mp-wp_genesis 70 *
mp-wp_genesis 71 * @since unknown
mp-wp_genesis 72 *
mp-wp_genesis 73 * @return unknown
mp-wp_genesis 74 */
mp-wp_genesis 75 function media_upload_form_handler() {
mp-wp_genesis 76 check_admin_referer('media-form');
mp-wp_genesis 77
mp-wp_genesis 78 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
mp-wp_genesis 79 $post = $_post = get_post($attachment_id, ARRAY_A);
mp-wp_genesis 80 if ( isset($attachment['post_content']) )
mp-wp_genesis 81 $post['post_content'] = $attachment['post_content'];
mp-wp_genesis 82 if ( isset($attachment['post_title']) )
mp-wp_genesis 83 $post['post_title'] = $attachment['post_title'];
mp-wp_genesis 84 if ( isset($attachment['post_excerpt']) )
mp-wp_genesis 85 $post['post_excerpt'] = $attachment['post_excerpt'];
mp-wp_genesis 86 if ( isset($attachment['menu_order']) )
mp-wp_genesis 87 $post['menu_order'] = $attachment['menu_order'];
mp-wp_genesis 88 if ( isset($attachment['post_parent']) )
mp-wp_genesis 89 $post['post_parent'] = $attachment['post_parent'];
mp-wp_genesis 90
mp-wp_genesis 91 $post = apply_filters('attachment_fields_to_save', $post, $attachment);
mp-wp_genesis 92
mp-wp_genesis 93 if ( isset($post['errors']) ) {
mp-wp_genesis 94 $errors[$attachment_id] = $post['errors'];
mp-wp_genesis 95 unset($post['errors']);
mp-wp_genesis 96 }
mp-wp_genesis 97
mp-wp_genesis 98 if ( $post != $_post )
mp-wp_genesis 99 wp_update_post($post);
mp-wp_genesis 100
mp-wp_genesis 101 foreach ( get_attachment_taxonomies($post) as $t )
mp-wp_genesis 102 if ( isset($attachment[$t]) )
mp-wp_genesis 103 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
mp-wp_genesis 104 }
mp-wp_genesis 105
mp-wp_genesis 106 return $errors;
mp-wp_genesis 107 }
mp-wp_genesis 108
mp-wp_genesis 109 /**
mp-wp_genesis 110 * {@internal Missing Short Description}}
mp-wp_genesis 111 *
mp-wp_genesis 112 * @since unknown
mp-wp_genesis 113 *
mp-wp_genesis 114 * @param unknown_type $form_fields
mp-wp_genesis 115 * @param unknown_type $post
mp-wp_genesis 116 * @return unknown
mp-wp_genesis 117 */
mp-wp_genesis 118 function media_single_attachment_fields_to_edit( $form_fields, $post ) {
mp-wp_genesis 119 unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
mp-wp_genesis 120 return $form_fields;
mp-wp_genesis 121 }
mp-wp_genesis 122
mp-wp_genesis 123 /**
mp-wp_genesis 124 * {@internal Missing Short Description}}
mp-wp_genesis 125 *
mp-wp_genesis 126 * @since unknown
mp-wp_genesis 127 *
mp-wp_genesis 128 * @param unknown_type $post
mp-wp_genesis 129 * @param unknown_type $attachment
mp-wp_genesis 130 * @return unknown
mp-wp_genesis 131 */
mp-wp_genesis 132 function image_attachment_fields_to_save($post, $attachment) {
mp-wp_genesis 133 if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
mp-wp_genesis 134 if ( strlen(trim($post['post_title'])) == 0 ) {
mp-wp_genesis 135 $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));
mp-wp_genesis 136 $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');
mp-wp_genesis 137 }
mp-wp_genesis 138 }
mp-wp_genesis 139
mp-wp_genesis 140 return $post;
mp-wp_genesis 141 }
mp-wp_genesis 142
mp-wp_genesis 143 add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
mp-wp_genesis 144
mp-wp_genesis 145 /**
mp-wp_genesis 146 * {@internal Missing Short Description}}
mp-wp_genesis 147 *
mp-wp_genesis 148 * @since unknown
mp-wp_genesis 149 *
mp-wp_genesis 150 * @param unknown_type $post
mp-wp_genesis 151 * @param unknown_type $errors
mp-wp_genesis 152 * @return unknown
mp-wp_genesis 153 */
mp-wp_genesis 154 function get_attachment_fields_to_edit($post, $errors = null) {
mp-wp_genesis 155 if ( is_int($post) )
mp-wp_genesis 156 $post =& get_post($post);
mp-wp_genesis 157 if ( is_array($post) )
mp-wp_genesis 158 $post = (object) $post;
mp-wp_genesis 159
mp-wp_genesis 160 $edit_post = sanitize_post($post, 'edit');
mp-wp_genesis 161
mp-wp_genesis 162 $form_fields = array(
mp-wp_genesis 163 'post_title' => array(
mp-wp_genesis 164 'label' => __('Title'),
mp-wp_genesis 165 'value' => $edit_post->post_title,
mp-wp_genesis 166 ),
mp-wp_genesis 167 'post_excerpt' => array(
mp-wp_genesis 168 'label' => __('Caption'),
mp-wp_genesis 169 'value' => $edit_post->post_excerpt,
mp-wp_genesis 170 ),
mp-wp_genesis 171 'post_content' => array(
mp-wp_genesis 172 'label' => __('Description'),
mp-wp_genesis 173 'value' => $edit_post->post_content,
mp-wp_genesis 174 'input' => 'textarea',
mp-wp_genesis 175 ),
mp-wp_genesis 176 'menu_order' => array(
mp-wp_genesis 177 'label' => __('Order'),
mp-wp_genesis 178 'value' => $edit_post->menu_order
mp-wp_genesis 179 ),
mp-wp_genesis 180 );
mp-wp_genesis 181
mp-wp_genesis 182 foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
mp-wp_genesis 183 $t = (array) get_taxonomy($taxonomy);
mp-wp_genesis 184 if ( empty($t['label']) )
mp-wp_genesis 185 $t['label'] = $taxonomy;
mp-wp_genesis 186 if ( empty($t['args']) )
mp-wp_genesis 187 $t['args'] = array();
mp-wp_genesis 188
mp-wp_genesis 189 $terms = get_object_term_cache($post->ID, $taxonomy);
mp-wp_genesis 190 if ( empty($terms) )
mp-wp_genesis 191 $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
mp-wp_genesis 192
mp-wp_genesis 193 $values = array();
mp-wp_genesis 194
mp-wp_genesis 195 foreach ( $terms as $term )
mp-wp_genesis 196 $values[] = $term->name;
mp-wp_genesis 197 $t['value'] = join(', ', $values);
mp-wp_genesis 198
mp-wp_genesis 199 $form_fields[$taxonomy] = $t;
mp-wp_genesis 200 }
mp-wp_genesis 201
mp-wp_genesis 202 // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
mp-wp_genesis 203 // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
mp-wp_genesis 204 $form_fields = array_merge_recursive($form_fields, (array) $errors);
mp-wp_genesis 205
mp-wp_genesis 206 $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
mp-wp_genesis 207
mp-wp_genesis 208 return $form_fields;
mp-wp_genesis 209 }
mp-wp_genesis 210
mp-wp_genesis 211
mp-wp_genesis 212 /**
mp-wp_genesis 213 * Retrieve HTML form for modifying the image attachment.
mp-wp_genesis 214 *
mp-wp_genesis 215 * @since unknown
mp-wp_genesis 216 *
mp-wp_genesis 217 * @param int $attachment_id Attachment ID for modification.
mp-wp_genesis 218 * @param string|array $args Optional. Override defaults.
mp-wp_genesis 219 * @return string HTML form for attachment.
mp-wp_genesis 220 */
mp-wp_genesis 221 function get_media_item( $attachment_id, $args = null ) {
mp-wp_genesis 222 global $redir_tab;
mp-wp_genesis 223
mp-wp_remove-all-... 224 $default_args = array( 'errors' => null, 'delete' => true, 'toggle' => true, 'show_title' => true );
mp-wp_genesis 225 $args = wp_parse_args( $args, $default_args );
mp-wp_genesis 226 extract( $args, EXTR_SKIP );
mp-wp_genesis 227
mp-wp_genesis 228 global $post_mime_types;
mp-wp_genesis 229 if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
mp-wp_genesis 230 $thumb_url = $thumb_url[0];
mp-wp_genesis 231 else
mp-wp_genesis 232 return false;
mp-wp_genesis 233
mp-wp_genesis 234 $toggle_on = __('Show');
mp-wp_genesis 235 $toggle_off = __('Hide');
mp-wp_genesis 236
mp-wp_genesis 237 $post = get_post($attachment_id);
mp-wp_genesis 238
mp-wp_genesis 239 $filename = basename($post->guid);
mp-wp_genesis 240 $title = attribute_escape($post->post_title);
mp-wp_genesis 241
mp-wp_genesis 242 if ( $_tags = get_the_tags($attachment_id) ) {
mp-wp_genesis 243 foreach ( $_tags as $tag )
mp-wp_genesis 244 $tags[] = $tag->name;
mp-wp_genesis 245 $tags = attribute_escape(join(', ', $tags));
mp-wp_genesis 246 }
mp-wp_genesis 247
mp-wp_genesis 248 $type = '';
mp-wp_genesis 249 if ( isset($post_mime_types) ) {
mp-wp_genesis 250 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
mp-wp_genesis 251 $type = array_shift($keys);
mp-wp_genesis 252 $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />";
mp-wp_genesis 253 }
mp-wp_genesis 254
mp-wp_genesis 255 $form_fields = get_attachment_fields_to_edit($post, $errors);
mp-wp_genesis 256
mp-wp_genesis 257 if ( $toggle ) {
mp-wp_genesis 258 $class = empty($errors) ? 'startclosed' : 'startopen';
mp-wp_genesis 259 $toggle_links = "
mp-wp_genesis 260 <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
mp-wp_genesis 261 <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
mp-wp_genesis 262 } else {
mp-wp_genesis 263 $class = 'form-table';
mp-wp_genesis 264 $toggle_links = '';
mp-wp_genesis 265 }
mp-wp_genesis 266
mp-wp_genesis 267 $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
mp-wp_genesis 268 $display_title = $show_title ? "<div class='filename new'>" . wp_html_excerpt($display_title, 60) . "</div>" : '';
mp-wp_genesis 269
mp-wp_genesis 270 $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
mp-wp_genesis 271 $order = '';
mp-wp_genesis 272
mp-wp_genesis 273 foreach ( $form_fields as $key => $val ) {
mp-wp_genesis 274 if ( 'menu_order' == $key ) {
mp-wp_genesis 275 if ( $gallery )
mp-wp_genesis 276 $order = '<div class="menu_order"> <input class="menu_order_input" type="text" id="attachments['.$attachment_id.'][menu_order]" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" /></div>';
mp-wp_genesis 277 else
mp-wp_genesis 278 $order = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" />';
mp-wp_genesis 279
mp-wp_genesis 280 unset($form_fields['menu_order']);
mp-wp_genesis 281 break;
mp-wp_genesis 282 }
mp-wp_genesis 283 }
mp-wp_genesis 284
mp-wp_genesis 285 $item = "
mp-wp_genesis 286 $type
mp-wp_genesis 287 $toggle_links
mp-wp_genesis 288 $order
mp-wp_genesis 289 $display_title
mp-wp_genesis 290 <table class='slidetoggle describe $class'>
mp-wp_genesis 291 <thead class='media-item-info'>
mp-wp_genesis 292 <tr>
mp-wp_genesis 293 <td class='A1B1' rowspan='4'><img class='thumbnail' src='$thumb_url' alt='' /></td>
mp-wp_genesis 294 <td>$filename</td>
mp-wp_genesis 295 </tr>
mp-wp_genesis 296 <tr><td>$post->post_mime_type</td></tr>
mp-wp_genesis 297 <tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr>
mp-wp_genesis 298 <tr><td>" . apply_filters('media_meta', '', $post) . "</td></tr>
mp-wp_genesis 299 </thead>
mp-wp_genesis 300 <tbody>\n";
mp-wp_genesis 301
mp-wp_genesis 302 $defaults = array(
mp-wp_genesis 303 'input' => 'text',
mp-wp_genesis 304 'required' => false,
mp-wp_genesis 305 'value' => '',
mp-wp_genesis 306 'extra_rows' => array(),
mp-wp_genesis 307 );
mp-wp_genesis 308
mp-wp_genesis 309 $hidden_fields = array();
mp-wp_genesis 310
mp-wp_genesis 311 foreach ( $form_fields as $id => $field ) {
mp-wp_genesis 312 if ( $id{0} == '_' )
mp-wp_genesis 313 continue;
mp-wp_genesis 314
mp-wp_genesis 315 if ( !empty($field['tr']) ) {
mp-wp_genesis 316 $item .= $field['tr'];
mp-wp_genesis 317 continue;
mp-wp_genesis 318 }
mp-wp_genesis 319
mp-wp_genesis 320 $field = array_merge($defaults, $field);
mp-wp_genesis 321 $name = "attachments[$attachment_id][$id]";
mp-wp_genesis 322
mp-wp_genesis 323 if ( $field['input'] == 'hidden' ) {
mp-wp_genesis 324 $hidden_fields[$name] = $field['value'];
mp-wp_genesis 325 continue;
mp-wp_genesis 326 }
mp-wp_genesis 327
mp-wp_genesis 328 $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
mp-wp_genesis 329 $aria_required = $field['required'] ? " aria-required='true' " : '';
mp-wp_genesis 330 $class = $id;
mp-wp_genesis 331 $class .= $field['required'] ? ' form-required' : '';
mp-wp_genesis 332
mp-wp_genesis 333 $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'>";
mp-wp_genesis 334 if ( !empty($field[$field['input']]) )
mp-wp_genesis 335 $item .= $field[$field['input']];
mp-wp_genesis 336 elseif ( $field['input'] == 'textarea' ) {
mp-wp_genesis 337 $item .= "<textarea type='text' id='$name' name='$name'" . $aria_required . ">" . htmlspecialchars( $field['value'] ) . "</textarea>";
mp-wp_genesis 338 } else {
mp-wp_genesis 339 $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
mp-wp_genesis 340 }
mp-wp_genesis 341 if ( !empty($field['helps']) )
mp-wp_genesis 342 $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
mp-wp_genesis 343 $item .= "</td>\n\t\t</tr>\n";
mp-wp_genesis 344
mp-wp_genesis 345 $extra_rows = array();
mp-wp_genesis 346
mp-wp_genesis 347 if ( !empty($field['errors']) )
mp-wp_genesis 348 foreach ( array_unique((array) $field['errors']) as $error )
mp-wp_genesis 349 $extra_rows['error'][] = $error;
mp-wp_genesis 350
mp-wp_genesis 351 if ( !empty($field['extra_rows']) )
mp-wp_genesis 352 foreach ( $field['extra_rows'] as $class => $rows )
mp-wp_genesis 353 foreach ( (array) $rows as $html )
mp-wp_genesis 354 $extra_rows[$class][] = $html;
mp-wp_genesis 355
mp-wp_genesis 356 foreach ( $extra_rows as $class => $rows )
mp-wp_genesis 357 foreach ( $rows as $html )
mp-wp_genesis 358 $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
mp-wp_genesis 359 }
mp-wp_genesis 360
mp-wp_genesis 361 if ( !empty($form_fields['_final']) )
mp-wp_genesis 362 $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
mp-wp_genesis 363 $item .= "\t</tbody>\n";
mp-wp_genesis 364 $item .= "\t</table>\n";
mp-wp_genesis 365
mp-wp_genesis 366 foreach ( $hidden_fields as $name => $value )
mp-wp_genesis 367 $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n";
mp-wp_genesis 368
mp-wp_genesis 369 if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) {
mp-wp_genesis 370 $parent = (int) $_REQUEST['post_id'];
mp-wp_genesis 371 $parent_name = "attachments[$attachment_id][post_parent]";
mp-wp_genesis 372
mp-wp_genesis 373 $item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='" . $parent . "' />\n";
mp-wp_genesis 374 }
mp-wp_genesis 375
mp-wp_genesis 376 return $item;
mp-wp_genesis 377 }
mp-wp_genesis 378
mp-wp_genesis 379 /**
mp-wp_genesis 380 * {@internal Missing Short Description}}
mp-wp_genesis 381 *
mp-wp_genesis 382 * @since unknown
mp-wp_genesis 383 */
mp-wp_genesis 384 function media_upload_header() {
mp-wp_genesis 385 ?>
mp-wp_genesis 386 <div id="media-upload-header">
mp-wp_genesis 387 <?php the_media_upload_tabs(); ?>
mp-wp_genesis 388 </div>
mp-wp_genesis 389 <?php
mp-wp_genesis 390 }
mp-wp_genesis 391
mp-wp_genesis 392 /**
mp-wp_genesis 393 * {@internal Missing Short Description}}
mp-wp_genesis 394 *
mp-wp_genesis 395 * @since unknown
mp-wp_genesis 396 *
mp-wp_genesis 397 * @param unknown_type $errors
mp-wp_genesis 398 */
mp-wp_genesis 399 function media_upload_form( $errors = null ) {
mp-wp_genesis 400 global $type, $tab;
mp-wp_genesis 401
mp-wp_genesis 402 $flash_action_url = admin_url('async-upload.php');
mp-wp_genesis 403
mp-wp_genesis 404 // If Mac and mod_security, no Flash. :(
mp-wp_genesis 405 $flash = true;
mp-wp_genesis 406 if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
mp-wp_genesis 407 $flash = false;
mp-wp_genesis 408
mp-wp_genesis 409 $flash = apply_filters('flash_uploader', $flash);
mp-wp_genesis 410 $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
mp-wp_genesis 411
mp-wp_genesis 412 ?>
mp-wp_genesis 413 <div id="media-upload-notice">
mp-wp_genesis 414 <?php if (isset($errors['upload_notice']) ) { ?>
mp-wp_genesis 415 <?php echo $errors['upload_notice']; ?>
mp-wp_genesis 416 <?php } ?>
mp-wp_genesis 417 </div>
mp-wp_genesis 418 <div id="media-upload-error">
mp-wp_genesis 419 <?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
mp-wp_genesis 420 <?php echo $errors['upload_error']->get_error_message(); ?>
mp-wp_genesis 421 <?php } ?>
mp-wp_genesis 422 </div>
mp-wp_genesis 423
mp-wp_genesis 424 <?php do_action('pre-upload-ui'); ?>
mp-wp_genesis 425
mp-wp_genesis 426 <div id="html-upload-ui">
mp-wp_genesis 427 <?php do_action('pre-html-upload-ui'); ?>
mp-wp_genesis 428 <p id="async-upload-wrap">
mp-wp_remove-all-... 429 <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="upload.php"><?php _e('Cancel'); ?></a>
mp-wp_genesis 430 </p>
mp-wp_genesis 431
mp-wp_genesis 432 <br class="clear" />
mp-wp_genesis 433 <?php if ( is_lighttpd_before_150() ): ?>
mp-wp_genesis 434 <p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
mp-wp_genesis 435 <?php endif;?>
mp-wp_genesis 436 <?php do_action('post-html-upload-ui'); ?>
mp-wp_genesis 437 </div>
mp-wp_genesis 438 <?php do_action('post-upload-ui'); ?>
mp-wp_genesis 439 <?php
mp-wp_genesis 440 }
mp-wp_genesis 441
mp-wp_genesis 442 ?>