WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 129 | * @param string $alt image alt attribute |
| 130 | * @param string $title image title attribute |
| 131 | * @param string $align image css alignment property |
| 132 | * @param string $url image src url |
| 133 | * @param string $size image size (thumbnail, medium, large, full or added with add_image_size() ) |
| 134 | * @return string |
| 135 | */ |
| 136 | function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { |
| 137 | |
| 138 | if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) |
| 139 | return $html; |
| 140 | |
| 141 | $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; |
| 142 | |
| 143 | if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) |
| 144 | return $html; |
| 145 | |
| 146 | $width = $matches[1]; |
| 147 | |
| Line | Code |
| 1735 | insert : function() { |
| 1736 | var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = ''; |
| 1737 | |
| 1738 | if ( '' == f.src.value || '' == t.width ) |
| 1739 | return false; |
| 1740 | |
| 1741 | if ( f.alt.value ) |
| 1742 | alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
| 1743 | |
| 1744 | <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> |
| 1745 | if ( f.caption.value ) { |
| 1746 | caption = f.caption.value.replace(/\r\n|\r/g, '\n'); |
| 1747 | caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ |
| 1748 | return a.replace(/[\r\n\t]+/, ' '); |
| 1749 | }); |
| 1750 | |
| 1751 | caption = caption.replace(/\s*\n\s*/g, '<br />'); |
| 1752 | } |
| 1753 | <?php } ?> |
| Line | Code |
| 2142 | /** |
| 2143 | * Creates the form for external url |
| 2144 | * |
| 2145 | * @since 2.7.0 |
| 2146 | * |
| 2147 | * @param string $default_view |
| 2148 | * @return string the form html |
| 2149 | */ |
| 2150 | function wp_media_insert_url_form( $default_view = 'image' ) { |
| 2151 | if ( !apply_filters( 'disable_captions', '' ) ) { |
| 2152 | $caption = ' |
| 2153 | <tr class="image-only"> |
| 2154 | <th valign="top" scope="row" class="label"> |
| 2155 | <label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label> |
| 2156 | </th> |
| 2157 | <td class="field"><textarea id="caption" name="caption"></textarea></td> |
| 2158 | </tr> |
| 2159 | '; |
| 2160 | } else { |