Make WordPress Core


Ignore:
Timestamp:
08/11/2008 10:52:43 PM (17 years ago)
Author:
ryan
Message:

crazyhorse: merge with log:trunk@8334:8619 , merge arrows unresolved

File:
1 edited

Legend:

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

    r8441 r8620  
    6868function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
    6969
     70<<<<<<< .working
    7071    if ( empty($alt) ) return $html;
     72=======
     73    if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
     74>>>>>>> .merge-right.r8619
    7175    $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
    7276
     
    103107
    104108    if ( isset($file['error']) )
    105         return new wp_error( 'upload_error', $file['error'] );
     109        return new WP_Error( 'upload_error', $file['error'] );
    106110
    107111    $url = $file['url'];
     
    143147
    144148    if ( isset($file['error']) )
    145         return new wp_error( 'upload_error', $file['error'] );
     149        return new WP_Error( 'upload_error', $file['error'] );
    146150
    147151    $url = $file['url'];
     
    281285        $keys = array_keys($_POST['send']);
    282286        $send_id = (int) array_shift($keys);
    283         $attachment = $_POST['attachments'][$send_id];
     287        $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
    284288        $html = $attachment['post_title'];
    285289        if ( !empty($attachment['url']) ) {
     
    297301// crazyhorse
    298302function media_upload_image() {
    299 
     303<<<<<<< .working
     304
     305=======
     306    $errors = array();
     307    $id = 0;
     308
     309>>>>>>> .merge-right.r8619
    300310    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    301311        // Upload File button was clicked
     
    365375
    366376function media_upload_audio() {
     377    $errors = array();
     378    $id = 0;
     379
    367380    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    368381        // Upload File button was clicked
     
    405418
    406419function media_upload_video() {
     420    $errors = array();
     421    $id = 0;
     422
    407423    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    408424        // Upload File button was clicked
     
    445461
    446462function media_upload_file() {
     463    $errors = array();
     464    $id = 0;
     465
    447466    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    448467        // Upload File button was clicked
     
    485504
    486505function media_upload_gallery() {
     506    $errors = array();
     507
    487508    if ( !empty($_POST) ) {
    488509        $return = media_upload_form_handler();
     
    499520
    500521function media_upload_library() {
     522    $errors = array();
    501523    if ( !empty($_POST) ) {
    502524        $return = media_upload_form_handler();
     
    511533}
    512534
     535<<<<<<< .working
    513536// crazyhorse
     537=======
     538function image_size_input_fields($post, $checked='') {
     539       
     540        // get a list of the actual pixel dimensions of each possible intermediate version of this image
     541        $sizes = array();
     542        $size_names = array('thumbnail' => 'Thumbnail', 'medium' => 'Medium', 'large' => 'Large', 'full' => 'Full size');
     543       
     544        foreach ( $size_names as $size => $name) {
     545            $downsize = image_downsize($post->ID, $size);
     546           
     547            // is this size selectable?
     548            $enabled = ( $downsize[3] || 'full' == $size );
     549            $css_id = "image-size-{$size}-{$post->ID}";
     550            // if $checked was not specified, default to the first available size that's bigger than a thumbnail
     551            if ( !$checked && $enabled && 'thumbnail' != $size )
     552                $checked = $size;
     553           
     554            $html = "<div class='image-size-item'><input type='radio' ".( $enabled ? '' : "disabled='disabled'")."name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'".( $checked == $size ? " checked='checked'" : '') ." />";
     555           
     556            $html .= "<label for='{$css_id}'>" . __($name). "</label>";
     557            // only show the dimensions if that choice is available
     558            if ( $enabled )
     559                $html .= " <label for='{$css_id}' class='help'>" . sprintf( __("(%d&nbsp;&times;&nbsp;%d)"), $downsize[1], $downsize[2] ). "</label>";
     560               
     561            $html .= '</div>';
     562       
     563            $out[] = $html;
     564        }
     565       
     566        return array(
     567            'label' => __('Size'),
     568            'input' => 'html',
     569            'html'  => join("\n", $out),
     570        );
     571}
     572
     573>>>>>>> .merge-right.r8619
    514574function image_attachment_fields_to_edit($form_fields, $post) {
    515575    if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
    516576        $form_fields['post_title']['required'] = true;
    517577
     578<<<<<<< .working
    518579        $form_fields['post_excerpt']['label'] = __('Caption');
    519580        $form_fields['post_excerpt']['helps'][] = __('Alternate text (e.g. Blue skies)');
     581=======
     582        $form_fields['post_excerpt']['label'] = __('Caption');
     583        $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
     584>>>>>>> .merge-right.r8619
    520585
    521586//      $form_fields['post_content']['label'] = __('Description');
    522587
     588<<<<<<< .working
    523589//      $thumb = wp_get_attachment_thumb_url($post->ID);
    524590
     591=======
     592>>>>>>> .merge-right.r8619
    525593        $form_fields['align'] = array(
    526594            'label' => __('Alignment'),
     
    536604                <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n",
    537605        );
     606<<<<<<< .working
    538607/*
    539608        $form_fields['image-size'] = array(
     
    548617                <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>",
    549618        );
     619=======
     620        $form_fields['image-size'] = image_size_input_fields($post);
     621>>>>>>> .merge-right.r8619
    550622*/
    551623    }
     
    615687        ),
    616688        'post_excerpt' => array(
     689<<<<<<< .working
    617690            'label'      => __('Caption'),
    618691            'value'      => $edit_post->post_excerpt
     692=======
     693            'label'      => __('Caption'),
     694            'value'      => $edit_post->post_excerpt,
     695>>>>>>> .merge-right.r8619
    619696        ),
    620697/*
     
    10661143
    10671144?>
    1068 <input type='hidden' name='post_id' value='<?php echo (int) $post_id; ?>' />
    10691145<div id="media-upload-notice">
    10701146<?php if (isset($errors['upload_notice']) ) { ?>
     
    11291205<?php do_action('pre-html-upload-ui'); ?>
    11301206    <p>
    1131     <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>
     1207    <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>
    11321208    </p>
    1133     <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
     1209
    11341210    <br class="clear" />
    11351211    <?php if ( is_lighttpd_before_150() ): ?>
     
    12031279        if ( f.alt.value ) {
    12041280            alt = f.alt.value.replace(/['"<>]+/g, '');
     1281<<<<<<< .working
     1282=======
     1283<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
     1284>>>>>>> .merge-right.r8619
    12051285            caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    12061286        }
     
    12621342</div>
    12631343<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
     1344</form>
    12641345<?php
    12651346    endif;
     
    13211402    $form_action_url = admin_url("media-upload.php?type=single&tab=library&post_id=$post_id");
    13221403
    1323     $_GET['paged'] = intval($_GET['paged']);
     1404    $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
    13241405    if ( $_GET['paged'] < 1 )
    13251406        $_GET['paged'] = 1;
     
    13821463
    13831464function type_form_image() {
    1384     $form = '
     1465
     1466    if ( apply_filters( 'disable_captions', '' ) ) {
     1467        $alt = __('Alternate Text');
     1468        $alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
     1469    } else {
     1470        $alt = __('Image Caption');
     1471        $alt_help = __('Also used as alternate text for the image');
     1472    }
     1473
     1474    return '
    13851475    <table class="describe"><tbody>
    13861476        <tr>
     
    13891479                <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
    13901480            </th>
    1391             <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()"></td>
     1481            <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
    13921482        </tr>
    13931483
     
    13991489            <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
    14001490        </tr>
    1401 
     1491<<<<<<< .working
     1492=======
     1493
     1494        <tr>
     1495            <th valign="top" scope="row" class="label">
     1496                <span class="alignleft"><label for="alt">' . $alt . '</label></span>
     1497            </th>
     1498            <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
     1499            <p class="help">' . $alt_help . '</p></td>
     1500        </tr>
     1501>>>>>>> .merge-right.r8619
     1502
     1503<<<<<<< .working
    14021504        <tr>
    14031505            <th valign="top" scope="row" class="label">
     
    14081510        </tr>
    14091511
     1512=======
     1513>>>>>>> .merge-right.r8619
    14101514        <tr class="align">
    14111515            <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
     
    14421546';
    14431547
    1444     return $form;
    14451548}
    14461549
Note: See TracChangeset for help on using the changeset viewer.