summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/wpmu-functions.php41
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');
+
?>