X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-admin/includes/media.php?ds=sidebyside diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index fc8ce0fe..9990b9fd 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -36,7 +36,7 @@ function media_upload_tabs() { * * @since 2.5.0 * - * @global wpdb $wpdb + * @global wpdb $wpdb WordPress database abstraction object. * * @param array $tabs * @return array $tabs with gallery if post has image attachment @@ -65,7 +65,7 @@ function update_gallery_tab($tabs) { } /** - * {@internal Missing Short Description}} + * Outputs the legacy media upload tabs UI. * * @since 2.5.0 * @@ -102,25 +102,30 @@ function the_media_upload_tabs() { } /** - * {@internal Missing Short Description}} + * Retrieves the image HTML to send to the editor. * * @since 2.5.0 * - * @param integer $id image attachment id - * @param string $caption image caption - * @param string $alt image alt attribute - * @param string $title image title attribute - * @param string $align image css alignment property - * @param string $url image src url - * @param string|bool $rel image rel attribute - * @param string $size image size (thumbnail, medium, large, full or added with add_image_size() ) - * @return string the html to insert into editor + * @param int $id Image attachment id. + * @param string $caption Image caption. + * @param string $title Image title attribute. + * @param string $align Image CSS alignment property. + * @param string $url Optional. Image src URL. Default empty. + * @param string $rel Optional. Image rel attribute. Default empty. + * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width + * and height values in pixels (in that order). Default 'medium'. + * @param string $alt Optional. Image alt attribute. Default empty. + * @return string The HTML output to insert into the editor. */ -function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') { +function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = '', $size = 'medium', $alt = '' ) { $html = get_image_tag($id, $alt, '', $align, $size); - $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : ''; + if ( ! $rel ) { + $rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"'; + } else { + $rel = ' rel="' . esc_attr( $rel ) . '"'; + } if ( $url ) $html = '$html"; @@ -130,14 +135,15 @@ function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = * * @since 2.5.0 * - * @param string $html The image HTML markup to send. - * @param int $id The attachment id. - * @param string $caption The image caption. - * @param string $title The image title. - * @param string $align The image alignment. - * @param string $url The image source URL. - * @param string $size The image size. - * @param string $alt The image alternative, or alt, text. + * @param string $html The image HTML markup to send. + * @param int $id The attachment id. + * @param string $caption The image caption. + * @param string $title The image title. + * @param string $align The image alignment. + * @param string $url The image source URL. + * @param string|array $size Size of image. Image size or array of width and height values + * (in that order). Default 'medium'. + * @param string $alt The image alternative, or alt, text. */ $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt ); @@ -242,7 +248,7 @@ function media_send_to_editor($html) { ?> guid ) ); + $file = get_attached_file( $post->ID ); + $filename = esc_html( wp_basename( $file ) ); $title = esc_attr( $post->post_title ); $post_mime_types = get_post_mime_types(); @@ -1471,7 +1484,9 @@ function get_media_item( $attachment_id, $args = null ) { $delete = "" . __( 'Delete Permanently' ) . ''; } elseif ( !MEDIA_TRASH ) { $delete = "" . __( 'Delete' ) . " -