Changeset 8239 for trunk/wp-admin/includes/media.php
- Timestamp:
- 07/02/2008 06:41:11 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/media.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r8201 r8239 62 62 return $html; 63 63 } 64 65 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 66 67 if ( empty($alt) ) return $html; 68 $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 69 70 preg_match( '/width="([0-9]+)/', $html, $matches ); 71 if ( ! isset($matches[1]) ) return $html; 72 $width = $matches[1]; 73 74 $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html ); 75 if ( empty($align) ) $align = 'none'; 76 77 $shcode = '[wp_caption id="' . $id . '" align="align' . $align 78 . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/wp_caption]'; 79 80 return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); 81 } 82 add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 ); 64 83 65 84 function media_send_to_editor($html) {
Note: See TracChangeset
for help on using the changeset viewer.