Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: disable_captions

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

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
1681      insert : function() {
1682           var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
1683
1684           if ( '' == f.src.value || '' == t.width )
1685                return false;
1686
1687           if ( f.alt.value )
1688                alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
1689
1690 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
1691           if ( f.caption.value ) {
1692                caption = f.caption.value.replace(/\r\n|\r/g, '\n');
1693                caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
1694                     return a.replace(/[\r\n\t]+/, ' ');
1695                });
1696
1697                caption = caption.replace(/\s*\n\s*/g, '<br />');
1698           }
1699 <?php } ?>
 
Line Code
2087 /**
2088  * Creates the form for external url
2089  *
2090  * @since 2.7.0
2091  *
2092  * @param string $default_view
2093  * @return string the form html
2094  */
2095 function wp_media_insert_url_form( $default_view = 'image' ) {
2096      if ( !apply_filters( 'disable_captions', '' ) ) {
2097           $caption = '
2098           <tr class="image-only">
2099                <th valign="top" scope="row" class="label">
2100                     <label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label>
2101                </th>
2102                <td class="field"><textarea id="caption" name="caption"></textarea></td>
2103           </tr>
2104 ';
2105      } else {