WordPress.org

Make WordPress Core

Ticket #21114: media.php.patch

File media.php.patch, 2.0 KB (added by robertstaddon, 22 months ago)
  • media.php

     
    778778        elseif ( $url_type == 'post' ) 
    779779                $url = $link; 
    780780 
    781         return " 
    782         <input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br /> 
    783         <button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button> 
    784         <button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button> 
    785         <button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button> 
    786 "; 
     781        if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 
     782                $largeImageArray = wp_get_attachment_image_src($post->ID,'large'); 
     783                $fileLarge = $largeImageArray[0]; 
     784                $url = $fileLarge; 
     785                return "<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br /> 
     786                                <button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button> 
     787                                <button type='button' class='button urlfile' data-link-url='" . esc_attr($fileLarge) . "'>" . __('Large Image') . "</button> 
     788                                <button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('Full Size Image') . "</button> 
     789                                <button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button> 
     790        "; 
     791        } 
     792        else return "<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br /> 
     793                                <button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button> 
     794                                <button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button> 
     795                                <button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button> 
     796        "; 
    787797} 
    788798 
    789799function wp_caption_input_textarea($edit_post) {