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
133  * @param unknown_type $alt
134  * @param unknown_type $title
135  * @param unknown_type $align
136  * @param unknown_type $url
137  * @param unknown_type $size
138  * @return unknown
139  */
140 function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
141
142      if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
143           return $html;
144
145      $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
146
147      if ( ! preg_match( '/width="([0-9]+)/', $html, $matches ) )
148           return $html;
149
150      $width = $matches[1];
151
 
Line Code
1510
1511           if ( f.title.value ) {
1512                title = f.title.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
1513                title = ' title="'+title+'"';
1514           }
1515
1516           if ( f.alt.value )
1517                alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
1518
1519 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
1520           if ( f.caption.value )
1521                caption = f.caption.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
1522 <?php } ?>
1523
1524           cls = caption ? '' : ' class="'+t.align+'"';
1525
1526           html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';
1527
1528           if ( f.url.value ) {
 
Line Code
1908
1909 /**
1910  * {@internal Missing Short Description}}
1911  *
1912  * @since 2.7.0
1913  *
1914  * @return unknown
1915  */
1916 function wp_media_insert_url_form( $default_view = 'image' ) {
1917      if ( !apply_filters( 'disable_captions', '' ) ) {
1918           $caption = '
1919           <tr class="image-only">
1920                <th valign="top" scope="row" class="label">
1921                     <span class="alignleft"><label for="caption">' . __('Image Caption') . '</label></span>
1922                </th>
1923                <td class="field"><input id="caption" name="caption" value="" type="text" /></td>
1924           </tr>
1925 ';
1926      } else {