Make WordPress Core

Ticket #13817: media.php.diff

File media.php.diff, 2.4 KB (added by simonwheatley, 14 years ago)

Three proposed new filters for media.php - patch refreshed to current trunk

  • wp-admin/includes/media.php

     
    11221122
    11231123        $default_args = array( 'errors' => null, 'send' => $post->post_parent ? post_type_supports( get_post_type( $post->post_parent ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true );
    11241124        $args = wp_parse_args( $args, $default_args );
     1125        $args = apply_filters( 'get_media_item_args', $args );
    11251126        extract( $args, EXTR_SKIP );
    11261127
    11271128        $toggle_on  = __( 'Show' );
     
    13971398
    13981399do_action('pre-upload-ui');
    13991400
    1400 if ( $flash ) : ?>
     1401if ( $flash ) :
     1402
     1403// Set the post params, which SWFUpload will post back with the file, and pass
     1404// them through a filter.
     1405$post_params = array(
     1406                "post_id" => $post_id,
     1407                "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]),
     1408                "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE],
     1409                "_wpnonce" => wp_create_nonce('media-form'),
     1410                "type" => $type,
     1411                "tab" => $tab,
     1412                "short" => "1",
     1413);
     1414$post_params = apply_filters( 'swfupload_post_params', $post_params );
     1415$p = array();
     1416foreach ( $post_params as $param => & $val )
     1417        $p[] = "\t\t'$param' : '$val'";
     1418$post_params_str = implode( ", \n", $p );
     1419
     1420?>
    14011421<script type="text/javascript">
    14021422//<![CDATA[
    14031423var swfu;
     
    14151435                        file_post_name: "async-upload",
    14161436                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
    14171437                        post_params : {
    1418                                 "post_id" : "<?php echo $post_id; ?>",
    1419                                 "auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
    1420                                 "logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
    1421                                 "_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
    1422                                 "type" : "<?php echo $type; ?>",
    1423                                 "tab" : "<?php echo $tab; ?>",
    1424                                 "short" : "1"
     1438                                <?php echo $post_params_str; ?>
    14251439                        },
    14261440                        file_size_limit : "<?php echo $max_upload_size; ?>b",
    14271441                        file_dialog_start_handler : fileDialogStart,
     
    14291443                        upload_start_handler : uploadStart,
    14301444                        upload_progress_handler : uploadProgress,
    14311445                        upload_error_handler : uploadError,
    1432                         upload_success_handler : uploadSuccess,
     1446                        upload_success_handler : <?php echo apply_filters( 'swfupload_success_handler', 'uploadSuccess' ); ?>,
    14331447                        upload_complete_handler : uploadComplete,
    14341448                        file_queue_error_handler : fileQueueError,
    14351449                        file_dialog_complete_handler : fileDialogComplete,