Changeset 8620 for branches/crazyhorse/wp-admin/includes/media.php
- Timestamp:
- 08/11/2008 10:52:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/includes/media.php
r8441 r8620 68 68 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 69 69 70 <<<<<<< .working 70 71 if ( empty($alt) ) return $html; 72 ======= 73 if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html; 74 >>>>>>> .merge-right.r8619 71 75 $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 72 76 … … 103 107 104 108 if ( isset($file['error']) ) 105 return new wp_error( 'upload_error', $file['error'] );109 return new WP_Error( 'upload_error', $file['error'] ); 106 110 107 111 $url = $file['url']; … … 143 147 144 148 if ( isset($file['error']) ) 145 return new wp_error( 'upload_error', $file['error'] );149 return new WP_Error( 'upload_error', $file['error'] ); 146 150 147 151 $url = $file['url']; … … 281 285 $keys = array_keys($_POST['send']); 282 286 $send_id = (int) array_shift($keys); 283 $attachment = $_POST['attachments'][$send_id];287 $attachment = stripslashes_deep( $_POST['attachments'][$send_id] ); 284 288 $html = $attachment['post_title']; 285 289 if ( !empty($attachment['url']) ) { … … 297 301 // crazyhorse 298 302 function media_upload_image() { 299 303 <<<<<<< .working 304 305 ======= 306 $errors = array(); 307 $id = 0; 308 309 >>>>>>> .merge-right.r8619 300 310 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 301 311 // Upload File button was clicked … … 365 375 366 376 function media_upload_audio() { 377 $errors = array(); 378 $id = 0; 379 367 380 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 368 381 // Upload File button was clicked … … 405 418 406 419 function media_upload_video() { 420 $errors = array(); 421 $id = 0; 422 407 423 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 408 424 // Upload File button was clicked … … 445 461 446 462 function media_upload_file() { 463 $errors = array(); 464 $id = 0; 465 447 466 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 448 467 // Upload File button was clicked … … 485 504 486 505 function media_upload_gallery() { 506 $errors = array(); 507 487 508 if ( !empty($_POST) ) { 488 509 $return = media_upload_form_handler(); … … 499 520 500 521 function media_upload_library() { 522 $errors = array(); 501 523 if ( !empty($_POST) ) { 502 524 $return = media_upload_form_handler(); … … 511 533 } 512 534 535 <<<<<<< .working 513 536 // crazyhorse 537 ======= 538 function 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 × %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 514 574 function image_attachment_fields_to_edit($form_fields, $post) { 515 575 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 516 576 $form_fields['post_title']['required'] = true; 517 577 578 <<<<<<< .working 518 579 $form_fields['post_excerpt']['label'] = __('Caption'); 519 580 $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 520 585 521 586 // $form_fields['post_content']['label'] = __('Description'); 522 587 588 <<<<<<< .working 523 589 // $thumb = wp_get_attachment_thumb_url($post->ID); 524 590 591 ======= 592 >>>>>>> .merge-right.r8619 525 593 $form_fields['align'] = array( 526 594 'label' => __('Alignment'), … … 536 604 <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 537 605 ); 606 <<<<<<< .working 538 607 /* 539 608 $form_fields['image-size'] = array( … … 548 617 <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>", 549 618 ); 619 ======= 620 $form_fields['image-size'] = image_size_input_fields($post); 621 >>>>>>> .merge-right.r8619 550 622 */ 551 623 } … … 615 687 ), 616 688 'post_excerpt' => array( 689 <<<<<<< .working 617 690 'label' => __('Caption'), 618 691 'value' => $edit_post->post_excerpt 692 ======= 693 'label' => __('Caption'), 694 'value' => $edit_post->post_excerpt, 695 >>>>>>> .merge-right.r8619 619 696 ), 620 697 /* … … 1066 1143 1067 1144 ?> 1068 <input type='hidden' name='post_id' value='<?php echo (int) $post_id; ?>' />1069 1145 <div id="media-upload-notice"> 1070 1146 <?php if (isset($errors['upload_notice']) ) { ?> … … 1129 1205 <?php do_action('pre-html-upload-ui'); ?> 1130 1206 <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="#" on Click="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> 1132 1208 </p> 1133 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1209 1134 1210 <br class="clear" /> 1135 1211 <?php if ( is_lighttpd_before_150() ): ?> … … 1203 1279 if ( f.alt.value ) { 1204 1280 alt = f.alt.value.replace(/['"<>]+/g, ''); 1281 <<<<<<< .working 1282 ======= 1283 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> 1284 >>>>>>> .merge-right.r8619 1205 1285 caption = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1206 1286 } … … 1262 1342 </div> 1263 1343 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 1344 </form> 1264 1345 <?php 1265 1346 endif; … … 1321 1402 $form_action_url = admin_url("media-upload.php?type=single&tab=library&post_id=$post_id"); 1322 1403 1323 $_GET['paged'] = i ntval($_GET['paged']);1404 $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0; 1324 1405 if ( $_GET['paged'] < 1 ) 1325 1406 $_GET['paged'] = 1; … … 1382 1463 1383 1464 function 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 ' 1385 1475 <table class="describe"><tbody> 1386 1476 <tr> … … 1389 1479 <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span> 1390 1480 </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> 1392 1482 </tr> 1393 1483 … … 1399 1489 <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td> 1400 1490 </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 1402 1504 <tr> 1403 1505 <th valign="top" scope="row" class="label"> … … 1408 1510 </tr> 1409 1511 1512 ======= 1513 >>>>>>> .merge-right.r8619 1410 1514 <tr class="align"> 1411 1515 <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th> … … 1442 1546 '; 1443 1547 1444 return $form;1445 1548 } 1446 1549
Note: See TracChangeset
for help on using the changeset viewer.