| 1899 | | // support a GET parameter for disabling the flash uploader |
|---|
| 1900 | | function wpmu_upload_flash($flash) { |
|---|
| 1901 | | if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| 1902 | | $flash = !empty($_REQUEST['flash']); |
|---|
| 1903 | | return $flash; |
|---|
| 1904 | | } |
|---|
| 1905 | | |
|---|
| 1906 | | add_filter('flash_uploader', 'wpmu_upload_flash'); |
|---|
| 1907 | | |
|---|
| 1908 | | function wpmu_upload_flash_bypass() { |
|---|
| 1909 | | echo '<p class="upload-flash-bypass">'; |
|---|
| 1910 | | printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), add_query_arg('flash', 0) ); |
|---|
| 1911 | | echo '</p>'; |
|---|
| 1912 | | } |
|---|
| 1913 | | |
|---|
| 1914 | | add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); |
|---|
| 1915 | | |
|---|
| 1916 | | function wpmu_upload_html_bypass() { |
|---|
| 1917 | | echo '<p class="upload-html-bypass">'; |
|---|
| 1918 | | if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| 1919 | | // the user manually selected the browser uploader, so let them switch back to Flash |
|---|
| 1920 | | printf( __('You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'), add_query_arg('flash', 1) ); |
|---|
| 1921 | | else |
|---|
| 1922 | | // the user probably doesn't have Flash |
|---|
| 1923 | | printf( __('You are using the Browser uploader.') ); |
|---|
| 1924 | | |
|---|
| 1925 | | echo '</p>'; |
|---|
| 1926 | | } |
|---|
| 1927 | | |
|---|
| 1928 | | add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); |
|---|
| 1929 | | add_action('post-html-upload-ui', 'wpmu_upload_html_bypass'); |
|---|
| 1930 | | |
|---|
| 1931 | | // make sure the GET parameter sticks when we submit a form |
|---|
| 1932 | | function wpmu_upload_bypass_url($url) { |
|---|
| 1933 | | if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| 1934 | | $url = add_query_arg('flash', intval($_REQUEST['flash'])); |
|---|
| 1935 | | return $url; |
|---|
| 1936 | | } |
|---|
| 1937 | | |
|---|
| 1938 | | add_filter('media_upload_form_url', 'wpmu_upload_bypass_url'); |
|---|
| 1939 | | |
|---|