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
127  * @param unknown_type $alt
128  * @param unknown_type $title
129  * @param unknown_type $align
130  * @param unknown_type $url
131  * @param unknown_type $size
132  * @return unknown
133  */
134 function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
135
136      if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
137           return $html;
138
139      $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
140
141      if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) )
142           return $html;
143
144      $width = $matches[1];
145
 
Line Code
1518
1519           if ( f.title.value ) {
1520                title = f.title.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
1521                title = ' title="'+title+'"';
1522           }
1523
1524           if ( f.alt.value )
1525                alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
1526
1527 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
1528           if ( f.caption.value ) {
1529                caption = f.caption.value.replace(/\r\n|\r/g, '\n');
1530                caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
1531                     return a.replace(/[\r\n\t]+/, ' ');
1532                });
1533
1534                caption = caption.replace(/\s*\n\s*/g, '<br />');
1535           }
1536 <?php } ?>
 
Line Code
1923
1924 /**
1925  * {@internal Missing Short Description}}
1926  *
1927  * @since 2.7.0
1928  *
1929  * @return unknown
1930  */
1931 function wp_media_insert_url_form( $default_view = 'image' ) {
1932      if ( !apply_filters( 'disable_captions', '' ) ) {
1933           $caption = '
1934           <tr class="image-only">
1935                <th valign="top" scope="row" class="label">
1936                     <span class="alignleft"><label for="caption">' . __('Image Caption') . '</label></span>
1937                </th>
1938                <td class="field"><textarea id="caption" name="caption"></textarea></td>
1939           </tr>
1940 ';
1941      } else {