| | 1410 | // support a GET parameter for disabling the flash uploader |
| | 1411 | function media_upload_use_flash($flash) { |
| | 1412 | if ( array_key_exists('flash', $_REQUEST) ) |
| | 1413 | $flash = !empty($_REQUEST['flash']); |
| | 1414 | return $flash; |
| | 1415 | } |
| | 1416 | |
| | 1417 | add_filter('flash_uploader', 'media_upload_use_flash'); |
| | 1418 | |
| | 1419 | function media_upload_flash_bypass() { |
| | 1420 | echo '<p class="upload-flash-bypass">'; |
| | 1421 | printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), add_query_arg('flash', 0) ); |
| | 1422 | echo '</p>'; |
| | 1423 | } |
| | 1424 | |
| | 1425 | add_action('post-flash-upload-ui', 'media_upload_flash_bypass'); |
| | 1426 | |
| | 1427 | function media_upload_html_bypass() { |
| | 1428 | echo '<p class="upload-html-bypass">'; |
| | 1429 | if ( array_key_exists('flash', $_REQUEST) ) |
| | 1430 | // the user manually selected the browser uploader, so let them switch back to Flash |
| | 1431 | printf( __('You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'), add_query_arg('flash', 1) ); |
| | 1432 | else |
| | 1433 | // the user probably doesn't have Flash |
| | 1434 | printf( __('You are using the Browser uploader.') ); |
| | 1435 | |
| | 1436 | echo '</p>'; |
| | 1437 | } |
| | 1438 | |
| | 1439 | add_action('post-flash-upload-ui', 'media_upload_flash_bypass'); |
| | 1440 | add_action('post-html-upload-ui', 'media_upload_html_bypass'); |
| | 1441 | |
| | 1442 | // make sure the GET parameter sticks when we submit a form |
| | 1443 | function media_upload_bypass_url($url) { |
| | 1444 | if ( array_key_exists('flash', $_REQUEST) ) |
| | 1445 | $url = add_query_arg('flash', intval($_REQUEST['flash'])); |
| | 1446 | return $url; |
| | 1447 | } |
| | 1448 | |
| | 1449 | add_filter('media_upload_form_url', 'media_upload_bypass_url'); |
| | 1450 | |
| | 1451 | |
| | 1452 | |