WordPress.org

Make WordPress Core

Changeset 16476


Ignore:
Timestamp:
11/19/2010 12:04:04 AM (9 years ago)
Author:
ryan
Message:

get_media_item_args, swfupload_post_params, and swfupload_success_handler filters. Props simonwheatley. fixes #13817

File:
1 edited

Legend:

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

    r16449 r16476  
    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
     
    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[
     
    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",
     
    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,
Note: See TracChangeset for help on using the changeset viewer.