diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-05-12 10:31:16 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-05-12 10:31:16 +0000 |
commit | aff35461690d5e839eccc7a1df30ea2f2d4503da (patch) | |
tree | 708f33920e50ce303954f30e9e91ff10a649c00b /wp-includes | |
parent | 2868986b308aad68733373888c825c77e6d1ff0c (diff) | |
download | wordpress-mu-aff35461690d5e839eccc7a1df30ea2f2d4503da.tar.gz wordpress-mu-aff35461690d5e839eccc7a1df30ea2f2d4503da.tar.xz wordpress-mu-aff35461690d5e839eccc7a1df30ea2f2d4503da.zip |
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
Diffstat (limited to 'wp-includes')
-rw-r--r-- | wp-includes/wpmu-functions.php | 41 |
1 files changed, 41 insertions, 0 deletions
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 '<p class="upload-flash-bypass">'; + printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), add_query_arg('flash', 0) ); + echo '</p>'; +} + +add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); + +function wpmu_upload_html_bypass() { + echo '<p class="upload-html-bypass">'; + 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 <a href="%s">Flash uploader</a> instead.'), add_query_arg('flash', 1) ); + else + // the user probably doesn't have Flash + printf( __('You are using the Browser uploader.') ); + + echo '</p>'; +} + +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'); + ?> |