Ticket #19181: imagelinkfilter_refresh.diff

File imagelinkfilter_refresh.diff, 1.5 KB (added by ryanimel, 11 months ago)

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

Line 
1Index: wp-admin/includes/media.php
2===================================================================
3--- wp-admin/includes/media.php (revision 21224)
4+++ wp-admin/includes/media.php (working copy)
5@@ -777,13 +777,18 @@
6                $url = $file;
7        elseif ( $url_type == 'post' )
8                $url = $link;
9-
10-       return "
11-       <input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
12-       <button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button>
13-       <button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button>
14-       <button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>
15-";
16+       
17+       $link_buttons = array(
18+               'none' => "<button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button>",
19+               'file' => "<button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button>",
20+               'post' => "<button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>"
21+       );
22+       
23+       $link_buttons = apply_filters( 'image_link_buttons', $link_buttons, $post, $url_type, $file, $link );
24+       
25+       $output = "<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />" . implode( '', $link_buttons );
26+       
27+       return $output;
28 }
29 
30 function wp_caption_input_textarea($edit_post) {