From 07d265659bbdbae22bb8f6864339fd3b28ef24fb Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 19 Nov 2010 00:04:04 +0000 Subject: [PATCH] get_media_item_args, swfupload_post_params, and swfupload_success_handler filters. Props simonwheatley. fixes #13817 git-svn-id: http://svn.automattic.com/wordpress/trunk@16476 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 55c1531512..408854e705 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1122,6 +1122,7 @@ function get_media_item( $attachment_id, $args = null ) { $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 ); $args = wp_parse_args( $args, $default_args ); + $args = apply_filters( 'get_media_item_args', $args ); extract( $args, EXTR_SKIP ); $toggle_on = __( 'Show' ); @@ -1397,7 +1398,26 @@ if ( is_multisite() && !is_upload_space_available() ) { do_action('pre-upload-ui'); -if ( $flash ) : ?> +if ( $flash ) : + +// Set the post params, which SWFUpload will post back with the file, and pass +// them through a filter. +$post_params = array( + "post_id" => $post_id, + "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]), + "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE], + "_wpnonce" => wp_create_nonce('media-form'), + "type" => $type, + "tab" => $tab, + "short" => "1", +); +$post_params = apply_filters( 'swfupload_post_params', $post_params ); +$p = array(); +foreach ( $post_params as $param => & $val ) + $p[] = "\t\t'$param' : '$val'"; +$post_params_str = implode( ", \n", $p ); + +?>