WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r8321 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
     
    104103
    105104    if ( isset($file['error']) )
    106         return new wp_error( 'upload_error', $file['error'] );
     105        return new WP_Error( 'upload_error', $file['error'] );
    107106
    108107    $url = $file['url'];
     
    144143
    145144    if ( isset($file['error']) )
    146         return new wp_error( 'upload_error', $file['error'] );
     145        return new WP_Error( 'upload_error', $file['error'] );
    147146
    148147    $url = $file['url'];
     
    282281        $keys = array_keys($_POST['send']);
    283282        $send_id = (int) array_shift($keys);
    284         $attachment = $_POST['attachments'][$send_id];
     283        $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
    285284        $html = $attachment['post_title'];
    286285        if ( !empty($attachment['url']) ) {
     
    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        ),
     
    885872
    886873?>
    887 <input type='hidden' name='post_id' value='<?php echo (int) $post_id; ?>' />
    888874<div id="media-upload-notice">
    889875<?php if (isset($errors['upload_notice']) ) { ?>
     
    948934<?php do_action('pre-html-upload-ui'); ?>
    949935    <p>
    950     <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
     936    <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
    951937    </p>
    952     <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
    953938    <br class="clear" />
    954939    <?php if ( is_lighttpd_before_150() ): ?>
     
    10221007        if ( f.alt.value ) {
    10231008            alt = f.alt.value.replace(/['"<>]+/g, '');
    1024 <?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
     1009<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
    10251010            caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    10261011<?php } ?>
     
    10831068</div>
    10841069<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
     1070</form>
    10851071<?php
    10861072    endif;
     
    12791265
    12801266function type_form_image() {
    1281     $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 '
    12821277    <table class="describe"><tbody>
    12831278        <tr>
     
    12861281                <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
    12871282            </th>
    1288             <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()"></td>
     1283            <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
    12891284        </tr>
    12901285
     
    12961291            <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
    12971292        </tr>
    1298 ';
    1299     // CAPTIONS_OFF is temporary. Do not use it.
    1300     if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
    1301         $form .= '
     1293
    13021294        <tr>
    13031295            <th valign="top" scope="row" class="label">
    1304                 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
     1296                <span class="alignleft"><label for="alt">' . $alt . '</label></span>
    13051297            </th>
    13061298            <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
    1307             <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
    1308         </tr>
    1309 ';
    1310 
    1311     } else {
    1312         $form .= '
    1313         <tr>
    1314             <th valign="top" scope="row" class="label">
    1315                 <span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span>
    1316             </th>
    1317             <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
    1318             <p class="help">' . __('Also used as alternate text for the image') . '</p></td>
    1319         </tr>
    1320 ';
    1321     }
    1322         $form .= '
     1299            <p class="help">' . $alt_help . '</p></td>
     1300        </tr>
     1301
    13231302        <tr class="align">
    13241303            <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
     
    13551334';
    13561335
    1357     return $form;
    13581336}
    13591337
Note: See TracChangeset for help on using the changeset viewer.