Changeset 9894 for trunk/wp-admin/includes/media.php
- Timestamp:
- 11/26/2008 02:27:37 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r9746 r9894 16 16 function media_upload_tabs() { 17 17 $_default_tabs = array( 18 'type' => __('Choose File'), // handler action suffix => tab text 18 'type' => __('From Computer'), // handler action suffix => tab text 19 'type_url' => __('From URL'), 19 20 'gallery' => __('Gallery'), 20 'library' => __('Media Library') ,21 'library' => __('Media Library') 21 22 ); 22 23 … … 330 331 $context = apply_filters('media_buttons_context', __('Upload %s')); 331 332 $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID"; 332 $media_title = __(' Upload Media');333 $media_title = __('Add Media'); 333 334 $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&type=image"); 334 $image_title = __(' Upload an Image');335 $image_title = __('Add an Image'); 335 336 $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&type=video"); 336 $video_title = __(' Upload Video');337 $video_title = __('Add Video'); 337 338 $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&type=audio"); 338 $audio_title = __(' Upload Audio');339 $audio_title = __('Add Audio'); 339 340 $out = <<<EOF 340 341 … … 386 387 } 387 388 388 if ( isset($_POST['insert-gallery']) ) 389 return media_send_to_editor('[gallery]'); 389 if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?> 390 <script type="text/javascript"> 391 /* <![CDATA[ */ 392 var win = window.dialogArguments || opener || parent || top; 393 win.tb_remove(); 394 /* ]]> */ 395 </script> 396 <?php 397 exit; 398 } 390 399 391 400 if ( isset($_POST['send']) ) { … … 454 463 return media_upload_gallery(); 455 464 } 465 466 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) 467 return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id ); 456 468 457 469 return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); … … 543 555 } 544 556 557 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) 558 return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id ); 559 545 560 return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id ); 546 561 } … … 593 608 } 594 609 610 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) 611 return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id ); 612 595 613 return wp_iframe( 'media_upload_type_form', 'video', $errors, $id ); 596 614 } … … 643 661 } 644 662 663 if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) 664 return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id ); 665 645 666 return wp_iframe( 'media_upload_type_form', 'file', $errors, $id ); 646 667 } … … 1301 1322 $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); 1302 1323 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); 1303 1304 $callback = "type_form_$type";1305 1324 ?> 1306 1325 … … 1308 1327 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1309 1328 <?php wp_nonce_field('media-form'); ?> 1310 <h3><?php _e('From Computer'); ?></h3> 1329 1330 <div class="media-blank"> 1331 <h3><?php _e('Add media files from your computer'); ?></h3> 1332 </div> 1333 1311 1334 <?php media_upload_form( $errors ); ?> 1312 1335 … … 1322 1345 --> 1323 1346 </script> 1324 <?php if ( $id && !is_wp_error($id) ) :?>1347 <?php if ( $id && !is_wp_error($id) ) { ?> 1325 1348 <div id="media-items"> 1326 1349 <?php echo get_media_items( $id, $errors ); ?> 1327 1350 </div> 1328 1351 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 1329 1330 <?php elseif ( is_callable($callback) ) : ?> 1352 <?php 1353 } elseif ( is_wp_error($id) ) { 1354 echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>'; 1355 exit; 1356 } 1357 } 1358 1359 /** 1360 * {@internal Missing Short Description}} 1361 * 1362 * @since unknown 1363 * 1364 * @param unknown_type $type 1365 * @param unknown_type $errors 1366 * @param unknown_type $id 1367 */ 1368 function media_upload_type_url_form($type = 'file', $errors = null, $id = null) { 1369 media_upload_header(); 1370 1371 $post_id = intval($_REQUEST['post_id']); 1372 1373 $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); 1374 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); 1375 1376 $callback = "type_url_form_$type"; 1377 ?> 1378 1379 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form"> 1380 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1381 <?php wp_nonce_field('media-form'); ?> 1382 1383 <?php if ( is_callable($callback) ) { ?> 1331 1384 1332 1385 <div class="media-blank"> 1333 <p style="text-align:center"><?php _e('— OR —'); ?></p> 1334 <h3><?php _e('From URL'); ?></h3> 1386 <h3><?php _e('Add media file from URL'); ?></h3> 1335 1387 </div> 1336 1388 … … 1415 1467 </div> 1416 1468 </div> 1417 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />1418 1469 </form> 1419 1470 <?php 1420 endif; 1471 } else { 1472 wp_die( __('Unknown action.') ); 1473 } 1421 1474 } 1422 1475 … … 1462 1515 <?php echo get_media_items($post_id, $errors); ?> 1463 1516 </div> 1517 1464 1518 <p class="ml-submit"> 1465 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 1466 <input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?>" /> 1519 <input type="submit" class="button savebutton" style="display:none;" name="save" id="save-all" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 1467 1520 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1468 1521 <input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" /> 1469 1522 <input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" /> 1470 1523 </p> 1524 1525 <div id="gallery-settings" style="display:none;"> 1526 <div class="title"><?php _e('Gallery Settings'); ?></div> 1527 <table id="basic" class="describe"><tbody> 1528 <tr> 1529 <th scope="row" class="label"> 1530 <label> 1531 <span class="alignleft"><?php _e('Link thumbnails to:'); ?></span> 1532 </label> 1533 </th> 1534 <td class="field"> 1535 <input type="radio" name="linkto" id="linkto-file" value="file" /> 1536 <label for="linkto-file" class="radio"><?php _e('Image File'); ?></label> 1537 1538 <input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" /> 1539 <label for="linkto-post" class="radio"><?php _e('Attachment Page'); ?></label> 1540 </td> 1541 </tr> 1542 1543 <tr> 1544 <th scope="row" class="label"> 1545 <label> 1546 <span class="alignleft"><?php _e('Order images by:'); ?></span> 1547 </label> 1548 </th> 1549 <td class="field"> 1550 <select id="orderby" name="orderby"> 1551 <option value="menu_order" selected="selected"><?php _e('Menu order'); ?></option> 1552 <option value="post_name"><?php _e('Name'); ?></option> 1553 <option value="ID"><?php _e('Date/Time'); ?></option> 1554 </select> 1555 </td> 1556 </tr> 1557 1558 <tr> 1559 <th scope="row" class="label"> 1560 <label> 1561 <span class="alignleft"><?php _e('Order:'); ?></span> 1562 </label> 1563 </th> 1564 <td class="field"> 1565 <input type="radio" checked="checked" name="order" id="order-asc" value="asc" /> 1566 <label for="order-asc" class="radio"><?php _e('Ascending'); ?></label> 1567 1568 <input type="radio" name="order" id="order-desc" value="desc" /> 1569 <label for="order-desc" class="radio"><?php _e('Descending'); ?></label> 1570 </td> 1571 </tr> 1572 1573 <tr> 1574 <th scope="row" class="label"> 1575 <label> 1576 <span class="alignleft"><?php _e('Gallery columns:'); ?></span> 1577 </label> 1578 </th> 1579 <td class="field"> 1580 <select id="columns" name="columns"> 1581 <option value="2"><?php _e('2'); ?></option> 1582 <option value="3" selected="selected"><?php _e('3'); ?></option> 1583 <option value="4"><?php _e('4'); ?></option> 1584 <option value="5"><?php _e('5'); ?></option> 1585 <option value="6"><?php _e('6'); ?></option> 1586 <option value="7"><?php _e('7'); ?></option> 1587 <option value="8"><?php _e('8'); ?></option> 1588 <option value="9"><?php _e('9'); ?></option> 1589 </select> 1590 </td> 1591 </tr> 1592 </tbody></table> 1593 1594 <p class="ml-submit"> 1595 <input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery' ) ); ?>" /> 1596 <input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php echo attribute_escape( __( 'Update gallery settings' ) ); ?>" /> 1597 </p> 1598 </div> 1471 1599 </form> 1472 1600 <?php … … 1635 1763 * @return unknown 1636 1764 */ 1637 function type_ form_image() {1765 function type_url_form_image() { 1638 1766 1639 1767 if ( apply_filters( 'disable_captions', '' ) ) { … … 1718 1846 * @return unknown 1719 1847 */ 1720 function type_ form_audio() {1848 function type_url_form_audio() { 1721 1849 return ' 1722 1850 <table class="describe"><tbody> … … 1753 1881 * @return unknown 1754 1882 */ 1755 function type_ form_video() {1883 function type_url_form_video() { 1756 1884 return ' 1757 1885 <table class="describe"><tbody> … … 1788 1916 * @return unknown 1789 1917 */ 1790 function type_ form_file() {1918 function type_url_form_file() { 1791 1919 return ' 1792 1920 <table class="describe"><tbody>
Note: See TracChangeset
for help on using the changeset viewer.