Changeset 18674 for trunk/wp-admin/includes/media.php
- Timestamp:
- 09/15/2011 05:30:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r18596 r18674 1471 1471 do_action('pre-upload-ui'); 1472 1472 1473 // Set the post params, which plupload will post back with the file, and pass1474 // them through a filter.1475 1473 $post_params = array( 1476 1474 "post_id" => $post_id, 1477 "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]),1478 "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE],1479 1475 "_wpnonce" => wp_create_nonce('media-form'), 1480 1476 "type" => $type, … … 1484 1480 1485 1481 $post_params = apply_filters( 'upload_post_params', $post_params ); // hook change! old name: 'swfupload_post_params' 1486 $p = array(); 1487 1488 foreach ( $post_params as $param => $val ) { 1489 $val = esc_js( $val ); 1490 $p[] = "'$param' : '$val'"; 1491 } 1492 1493 $post_params_str = implode( ',', $p ). "\n"; 1482 1483 $plupload_init = array( 1484 'runtimes' => 'html5,silverlight,flash,html4', 1485 'browse_button' => 'plupload-browse-button', 1486 'container' => 'plupload-upload-ui', 1487 'drop_element' => 'wpwrap', 1488 'file_data_name' => 'async-upload', 1489 'multiple_queues' => true, 1490 'max_file_size' => round( (int) $max_upload_size / 1024 ) . 'kb', 1491 'url' => $upload_action_url, 1492 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 1493 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 1494 'filters' => array( array('title' => __( 'Allowed Files' ), 'extensions' => '*') ), 1495 'multipart' => true, 1496 'urlstream_upload' => true, 1497 'multipart_params' => $post_params 1498 ); 1499 1500 $plupload_init = apply_filters( 'plupload_init', $plupload_init ); 1494 1501 1495 1502 ?> 1503 1496 1504 <script type="text/javascript"> 1497 //<![CDATA[ 1498 var resize_height = <?php echo get_option('large_size_h', 1024); ?>, 1499 resize_width = <?php echo get_option('large_size_w', 1024); ?>; 1500 1501 jQuery(document).ready(function($) { 1502 window.uploader = new plupload.Uploader({ 1503 runtimes: '<?php echo apply_filters('plupload_runtimes', 'html5,silverlight,flash,html4'); ?>', 1504 browse_button: 'plupload-browse-button', 1505 container: 'plupload-upload-ui', 1506 drop_element: 'media-upload', 1507 file_data_name: 'async-upload', 1508 max_file_size: '<?php echo round( (int) $max_upload_size / 1024 ); ?>kb', 1509 url: '<?php echo esc_js( $upload_action_url ); ?>', 1510 flash_swf_url: '<?php echo esc_js( includes_url('js/plupload/plupload.flash.swf') ); ?>', 1511 silverlight_xap_url: '<?php echo esc_js( includes_url('js/plupload/plupload.silverlight.xap') ); ?>', 1512 filters: [ 1513 {title: '<?php echo esc_js( __( 'Allowed Files' ) ); ?>', extensions: '<?php echo esc_js( apply_filters('uploader_allowed_extensions', '*') ); ?>'} 1514 ], 1515 multipart: true, 1516 urlstream_upload: true, 1517 multipart_params : { 1518 <?php echo $post_params_str; ?> 1519 } 1520 }); 1521 1522 setResize( getUserSetting('upload_resize', false) ); 1523 1524 $('#image_resize').bind('change', function() { 1525 var arg = $(this).prop('checked'); 1526 1527 setResize( arg ); 1528 1529 if ( arg ) 1530 setUserSetting('upload_resize', 1); 1531 else 1532 deleteUserSetting('upload_resize'); 1533 }); 1534 1535 uploader.init(); 1536 1537 uploader.bind('FilesAdded', function(up, files) { 1538 $.each(files, function(i, file) { 1539 fileQueued(file); 1540 }); 1541 1542 up.refresh(); 1543 up.start(); 1544 }); 1545 1546 uploader.bind('BeforeUpload', function(up, file) { 1547 uploadStart(file); 1548 }); 1549 1550 uploader.bind('UploadProgress', function(up, file) { 1551 uploadProgress(file, file.loaded, file.size); 1552 }); 1553 1554 uploader.bind('Error', function(up, err) { 1555 uploadError(err.file, err.code, err.message); 1556 1557 up.refresh(); 1558 }); 1559 1560 uploader.bind('FileUploaded', function(up, file, response) { 1561 <?php echo apply_filters( 'plupload_success_handler', 'uploadSuccess' ); ?>(file, response.response); 1562 }); 1563 1564 if ( uploader.runtime == 'html5' ) 1565 $('.dragdrop-info').show(); 1566 }); 1567 //]]> 1505 var resize_height = <?php echo get_option('large_size_h', 1024); ?>, 1506 resize_width = <?php echo get_option('large_size_w', 1024); ?>, 1507 wpUploaderInit = <?php echo json_encode($plupload_init); ?>; 1568 1508 </script> 1569 1509 … … 1571 1511 <?php do_action('pre-plupload-upload-ui'); // hook change, old name: 'pre-flash-upload-ui' ?> 1572 1512 1573 < div>1513 <p> 1574 1514 <?php _e( 'Choose files to upload' ); ?> 1575 1515 <input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /> 1576 1516 <input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?>" class="button" /> 1577 </ div>1578 <p class="dragdrop-info howto"><?php _e('Or you can drop the files into this window.'); ?></p>1517 </p> 1518 <p class="dragdrop-info"><?php _e('Or you can drop the files into this window.'); ?></p> 1579 1519 <?php do_action('post-plupload-upload-ui'); // hook change, old name: 'post-flash-upload-ui' ?> 1580 1520 </div> … … 1589 1529 </p> 1590 1530 <div class="clear"></div> 1591 <?php do_action('post-html-upload-ui' , $plupload); ?>1531 <?php do_action('post-html-upload-ui'); ?> 1592 1532 </div> 1593 1533 … … 1595 1535 <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> 1596 1536 1597 <?php do_action('post-upload-ui'); ?>1598 1537 <?php 1538 do_action('post-upload-ui'); 1599 1539 } 1600 1540 … … 2282 2222 */ 2283 2223 function media_upload_max_image_resize() { 2224 $checked = get_user_setting('upload_resize') ? ' checked="true"' : ''; 2284 2225 ?> 2285 < label>2286 <input name="image_resize" type="checkbox" id="image_resize" value="true" />2226 <p class="hide-if-no-js"><label> 2227 <input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> /> 2287 2228 <?php printf( __( 'Scale images to max width %1$dpx or max height %2$dpx' ), (int) get_option( 'large_size_w' ), (int) get_option( 'large_size_h' ) ); ?> 2288 </label> 2229 </label></p> 2289 2230 <?php 2290 2231 }
Note: See TracChangeset
for help on using the changeset viewer.