| | 1869 | // support a GET parameter for disabling the flash uploader |
|---|
| | 1870 | function wpmu_upload_flash($flash) { |
|---|
| | 1871 | if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| | 1872 | $flash = !empty($_REQUEST['flash']); |
|---|
| | 1873 | return $flash; |
|---|
| | 1874 | } |
|---|
| | 1875 | |
|---|
| | 1876 | add_filter('flash_uploader', 'wpmu_upload_flash'); |
|---|
| | 1877 | |
|---|
| | 1878 | function wpmu_upload_flash_bypass() { |
|---|
| | 1879 | echo '<p class="upload-flash-bypass">'; |
|---|
| | 1880 | printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), add_query_arg('flash', 0) ); |
|---|
| | 1881 | echo '</p>'; |
|---|
| | 1882 | } |
|---|
| | 1883 | |
|---|
| | 1884 | add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); |
|---|
| | 1885 | |
|---|
| | 1886 | function wpmu_upload_html_bypass() { |
|---|
| | 1887 | echo '<p class="upload-html-bypass">'; |
|---|
| | 1888 | if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| | 1889 | // the user manually selected the browser uploader, so let them switch back to Flash |
|---|
| | 1890 | printf( __('You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'), add_query_arg('flash', 1) ); |
|---|
| | 1891 | else |
|---|
| | 1892 | // the user probably doesn't have Flash |
|---|
| | 1893 | printf( __('You are using the Browser uploader.') ); |
|---|
| | 1894 | |
|---|
| | 1895 | echo '</p>'; |
|---|
| | 1896 | } |
|---|
| | 1897 | |
|---|
| | 1898 | add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); |
|---|
| | 1899 | add_action('post-html-upload-ui', 'wpmu_upload_html_bypass'); |
|---|
| | 1900 | |
|---|
| | 1901 | // make sure the GET parameter sticks when we submit a form |
|---|
| | 1902 | function wpmu_upload_bypass_url($url) { |
|---|
| | 1903 | if ( array_key_exists('flash', $_REQUEST) ) |
|---|
| | 1904 | $url = add_query_arg('flash', intval($_REQUEST['flash'])); |
|---|
| | 1905 | return $url; |
|---|
| | 1906 | } |
|---|
| | 1907 | |
|---|
| | 1908 | add_filter('media_upload_form_url', 'wpmu_upload_bypass_url'); |
|---|
| | 1909 | |
|---|