WordPress.org

Make WordPress Core

Ticket #13528: wp-admin_includes_media.php.patch

File wp-admin_includes_media.php.patch, 1.5 KB (added by Wollari, 5 years ago)
  • wp-admin/includes/media.php

     
    907907       elseif ( $url_type == 'post' ) 
    908908               $url = $link; 
    909909 
    910        return " 
     910       $output = " 
    911911       <input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br /> 
    912912       <button type='button' class='button urlnone' title=''>" . __('None') . "</button> 
    913        <button type='button' class='button urlfile' title='" . esc_attr($file) . "'>" . __('File URL') . "</button> 
    914913       <button type='button' class='button urlpost' title='" . esc_attr($link) . "'>" . __('Post URL') . "</button> 
    915914"; 
     915 
     916       if( wp_attachment_is_image($post->ID) ) { 
     917               $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')); 
     918 
     919               foreach( $size_names AS $size => $size_name ) { 
     920                       $image  = image_downsize($post->ID, $size); 
     921                       if( $image ) 
     922                               $output .= "\t<button type='button' class='button url". $size ."' title='" . esc_attr($image[0]) . "'>" . __($size_name) . "</button>\n"; 
     923               } 
     924       } else { 
     925               $output .= "\t<button type='button' class='button urlfile' title='" . esc_attr($file) . "'>" . __('File URL') . "</button>\n"; 
     926       } 
     927       return $output; 
    916928} 
    917929 
    918930/**