X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/98a4d31e52bd56c908617df281730bd4ba58d110..9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f:/wp-admin/includes/media.php diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e6e7b6b8..8a5e6cc5 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -7,11 +7,11 @@ */ /** - * {@internal Missing Short Description}} + * Defines the default media upload tabs * - * @since unknown + * @since 2.5.0 * - * @return unknown + * @return array default tabs */ function media_upload_tabs() { $_default_tabs = array( @@ -21,16 +21,23 @@ function media_upload_tabs() { 'library' => __('Media Library') ); - return apply_filters('media_upload_tabs', $_default_tabs); + /** + * Filter the available tabs in the legacy (pre-3.5.0) media popup. + * + * @since 2.5.0 + * + * @param array $_default_tabs An array of media tabs. + */ + return apply_filters( 'media_upload_tabs', $_default_tabs ); } /** - * {@internal Missing Short Description}} + * Adds the gallery tab back to the tabs array if post has image attachments * - * @since unknown + * @since 2.5.0 * - * @param unknown_type $tabs - * @return unknown + * @param array $tabs + * @return array $tabs with gallery if post has image attachment */ function update_gallery_tab($tabs) { global $wpdb; @@ -40,8 +47,10 @@ function update_gallery_tab($tabs) { return $tabs; } - if ( intval($_REQUEST['post_id']) ) - $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id']))); + $post_id = intval($_REQUEST['post_id']); + + if ( $post_id ) + $attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) ); if ( empty($attachments) ) { unset($tabs['gallery']); @@ -57,26 +66,31 @@ add_filter('media_upload_tabs', 'update_gallery_tab'); /** * {@internal Missing Short Description}} * - * @since unknown + * @since 2.5.0 */ function the_media_upload_tabs() { global $redir_tab; $tabs = media_upload_tabs(); + $default = 'type'; if ( !empty($tabs) ) { echo "
- | $filename | -
$post->post_mime_type | |
" . mysql2date($post->post_date, get_option('time_format')) . " | |
" . apply_filters('media_meta', '', $post) . " |
+
+ $image_edit_button + |
+
+ " . __('File name:') . " $filename +" . __('File type:') . " $post->post_mime_type +" . __('Upload date:') . " " . mysql2date( get_option('date_format'), $post->post_date ). ' '; + if ( !empty( $media_dims ) ) + $item .= "" . __('Dimensions:') . " $media_dims \n"; + + $item .= " | \n";
+
+ $item .= "
- \n";
+
+
$send $delete
- " . sprintf(__("You are about to delete %s."), $filename) . " " . __('Continue') . "
- " . __('Cancel') . " | |
" . $r['send'] . " $thumbnail $delete | |
\n\t\t\t | "; - if ( !empty($field[$field['input']]) ) - $item .= $field[$field['input']]; + $item .= "\t\t |
---|---|
\n\t\t\t | ";
+ if ( !empty( $field[ $field['input'] ] ) )
+ $item .= $field[ $field['input'] ];
elseif ( $field['input'] == 'textarea' ) {
- $item .= "";
+ if ( 'post_content' == $id && user_can_richedit() ) {
+ // Sanitize_post() skips the post_content when user_can_richedit.
+ $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
+ }
+ // Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
+ $item .= "';
} else {
- $item .= "";
+ $item .= "";
}
- if ( !empty($field['helps']) )
- $item .= " " . join( " \n", array_unique((array) $field['helps']) ) . ' '; + if ( !empty( $field['helps'] ) ) + $item .= "" . join( " \n", array_unique( (array) $field['helps'] ) ) . ' '; $item .= " | \n\t\t
$html | |
{$form_fields['_final']} |
" . join( "
\n", array_unique( (array) $field['helps'] ) ) . '
'; + $item .= "' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.'), 'http://apps.wordpress.org/' ) . '
'; + return; + } - $flash = apply_filters('flash_uploader', $flash); + $upload_action_url = admin_url('async-upload.php'); $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; + $_type = isset($type) ? $type : ''; + $_tab = isset($tab) ? $tab : ''; + $max_upload_size = wp_max_upload_size(); + if ( ! $max_upload_size ) { + $max_upload_size = 0; + } ?> - -- +
+ - -- - + +
- - + | + + * | ||
---|---|---|---|
- + | + * | -+ | |
- + | |||
' . __('Link text, e.g. “Ransom Demands (PDF)”') . ' | |||
+ |
- ' . $alt_help . ' |
+ ||
+ ' . $caption . ' + | |||
@@ -1913,9 +2490,9 @@ function type_url_form_image() { | |||
- + | |||
+ | @@ -1923,201 +2500,489 @@ function type_url_form_image() { ' . __('Enter a link URL or click above for presets.') . ' |
||
+ | + ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . ' + | +
- - * - | -- |
---|---|
- - * - | -- |
' . __('Link text, e.g. “Still Alive by Jonathan Coulton”') . ' | |
- | - - | -
+ browser uploader instead.' ), $browser_uploader, '_blank' ); ?> +
+ -+ Switch to the multi-file uploader.'); ?> +
+ -'; - printf( __('You are using the Flash uploader. Problems? Try the Browser uploader instead.'), esc_url(add_query_arg('flash', 0)) ); - echo '
'; +function edit_form_image_editor( $post ) { + $open = isset( $_GET['image-editor'] ); + if ( $open ) + require_once ABSPATH . 'wp-admin/includes/image-edit.php'; + + $thumb_url = false; + if ( $attachment_id = intval( $post->ID ) ) + $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); + + $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); + + $att_url = wp_get_attachment_url( $post->ID ); ?> +
+
+
+
+
+
+
'; - _e('You are using the Browser uploader.'); - if ( $flash ) { - // the user manually selected the browser uploader, so let them switch back to Flash - echo ' '; - printf( __('Try the Flash uploader instead.'), esc_url(add_query_arg('flash', 1)) ); +function attachment_submitbox_metadata() { + $post = get_post(); + + $filename = esc_html( wp_basename( $post->guid ) ); + + $media_dims = ''; + $meta = wp_get_attachment_metadata( $post->ID ); + if ( isset( $meta['width'], $meta['height'] ) ) + $media_dims .= "{$meta['width']} × {$meta['height']} "; + /** This filter is documented in wp-admin/includes/media.php */ + $media_dims = apply_filters( 'media_meta', $media_dims, $post ); + + $att_url = wp_get_attachment_url( $post->ID ); +?> +