WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/10/2008 07:33:44 PM (12 years ago)
Author:
azaozz
Message:

Removes the disabling of captions, but leaves couple of hooks so a plugin can do it easily. For 2.6.1, see #6812

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/wp-admin/includes/media.php

    r8604 r8607  
    6868function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
    6969
    70     // CAPTIONS_OFF is temporary. Do not use it.
    71     if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html;
     70    if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
    7271    $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
    7372
     
    511510        $form_fields['post_title']['required'] = true;
    512511
    513         // CAPTIONS_OFF is temporary. Do not use it.
    514         if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
    515             $form_fields['post_excerpt']['label'] = __('Alternate Text');
    516             $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"');
    517         } else {
    518             $form_fields['post_excerpt']['label'] = __('Caption');
    519             $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
    520         }
     512        $form_fields['post_excerpt']['label'] = __('Caption');
     513        $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
    521514
    522515        $form_fields['post_content']['label'] = __('Description');
     
    607600    $link = get_attachment_link($post->ID);
    608601
    609     // CAPTIONS_OFF is temporary. Do not use it.
    610     if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
    611         $alt = __('Alternate Text');
    612     else
    613         $alt = __('Caption');
    614 
    615602    $form_fields = array(
    616603        'post_title'   => array(
     
    619606        ),
    620607        'post_excerpt' => array(
    621             'label'      => $alt,
     608            'label'      => __('Caption'),
    622609            'value'      => $edit_post->post_excerpt,
    623610        ),
     
    10201007        if ( f.alt.value ) {
    10211008            alt = f.alt.value.replace(/['"<>]+/g, '');
    1022 <?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
     1009<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
    10231010            caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    10241011<?php } ?>
     
    12781265
    12791266function type_form_image() {
    1280     $form = '
     1267
     1268    if ( apply_filters( 'disable_captions', '' ) ) {
     1269        $alt = __('Alternate Text');
     1270        $alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
     1271    } else {
     1272        $alt = __('Image Caption');
     1273        $alt_help = __('Also used as alternate text for the image');
     1274    }
     1275
     1276    return '
    12811277    <table class="describe"><tbody>
    12821278        <tr>
     
    12951291            <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
    12961292        </tr>
    1297 ';
    1298     // CAPTIONS_OFF is temporary. Do not use it.
    1299     if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
    1300         $form .= '
     1293
    13011294        <tr>
    13021295            <th valign="top" scope="row" class="label">
    1303                 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
     1296                <span class="alignleft"><label for="alt">' . $alt . '</label></span>
    13041297            </th>
    13051298            <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
    1306             <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
    1307         </tr>
    1308 ';
    1309 
    1310     } else {
    1311         $form .= '
    1312         <tr>
    1313             <th valign="top" scope="row" class="label">
    1314                 <span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span>
    1315             </th>
    1316             <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
    1317             <p class="help">' . __('Also used as alternate text for the image') . '</p></td>
    1318         </tr>
    1319 ';
    1320     }
    1321         $form .= '
     1299            <p class="help">' . $alt_help . '</p></td>
     1300        </tr>
     1301
    13221302        <tr class="align">
    13231303            <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
     
    13541334';
    13551335
    1356     return $form;
    13571336}
    13581337
Note: See TracChangeset for help on using the changeset viewer.