From aff35461690d5e839eccc7a1df30ea2f2d4503da Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 12 May 2008 10:31:16 +0000 Subject: Add link to use browser upload rather than Flash uploader, props tellyworth git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1283 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/wpmu-functions.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'wp-includes/wpmu-functions.php') diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php index bc5764f..97e6f76 100644 --- a/wp-includes/wpmu-functions.php +++ b/wp-includes/wpmu-functions.php @@ -1866,4 +1866,45 @@ if( is_object( $wp_object_cache ) ) { $wp_object_cache->non_persistent_groups = array('comment', 'counts'); } +// support a GET parameter for disabling the flash uploader +function wpmu_upload_flash($flash) { + if ( array_key_exists('flash', $_REQUEST) ) + $flash = !empty($_REQUEST['flash']); + return $flash; +} + +add_filter('flash_uploader', 'wpmu_upload_flash'); + +function wpmu_upload_flash_bypass() { + echo '

'; + printf( __('You are using the Flash uploader. Problems? Try the Browser uploader instead.'), add_query_arg('flash', 0) ); + echo '

'; +} + +add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); + +function wpmu_upload_html_bypass() { + echo '

'; + if ( array_key_exists('flash', $_REQUEST) ) + // the user manually selected the browser uploader, so let them switch back to Flash + printf( __('You are using the Browser uploader. Try the Flash uploader instead.'), add_query_arg('flash', 1) ); + else + // the user probably doesn't have Flash + printf( __('You are using the Browser uploader.') ); + + echo '

'; +} + +add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); +add_action('post-html-upload-ui', 'wpmu_upload_html_bypass'); + +// make sure the GET parameter sticks when we submit a form +function wpmu_upload_bypass_url($url) { + if ( array_key_exists('flash', $_REQUEST) ) + $url = add_query_arg('flash', intval($_REQUEST['flash'])); + return $url; +} + +add_filter('media_upload_form_url', 'wpmu_upload_bypass_url'); + ?> -- cgit