WordPress.org

Make WordPress Core

Ticket #19181: imagelinkfilter_refresh.diff

File imagelinkfilter_refresh.diff, 1.5 KB (added by ryanimel, 3 years ago)

(Sigh. Best if I upload the patch and not the file it applies to, eh?)

  • wp-admin/includes/media.php

     
    777777                $url = $file; 
    778778        elseif ( $url_type == 'post' ) 
    779779                $url = $link; 
    780  
    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 "; 
     780         
     781        $link_buttons = array( 
     782                'none' => "<button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button>", 
     783                'file' => "<button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button>", 
     784                'post' => "<button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>" 
     785        ); 
     786         
     787        $link_buttons = apply_filters( 'image_link_buttons', $link_buttons, $post, $url_type, $file, $link ); 
     788         
     789        $output = "<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />" . implode( '', $link_buttons ); 
     790         
     791        return $output; 
    787792} 
    788793 
    789794function wp_caption_input_textarea($edit_post) {