Make WordPress Core


Ignore:
Timestamp:
07/11/2008 01:45:41 AM (16 years ago)
Author:
ryan
Message:

Add flash uploader bypass toggle. Props tellyworth. fixes #7281

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r8304 r8310  
    14081408}
    14091409
     1410// support a GET parameter for disabling the flash uploader
     1411function media_upload_use_flash($flash) {
     1412        if ( array_key_exists('flash', $_REQUEST) )
     1413                $flash = !empty($_REQUEST['flash']);
     1414        return $flash;
     1415}
     1416
     1417add_filter('flash_uploader', 'media_upload_use_flash');
     1418
     1419function 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
     1425add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
     1426
     1427function 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
     1439add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
     1440add_action('post-html-upload-ui', 'media_upload_html_bypass');
     1441
     1442// make sure the GET parameter sticks when we submit a form
     1443function 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
     1449add_filter('media_upload_form_url', 'media_upload_bypass_url');
     1450
     1451
     1452
    14101453add_filter('async_upload_image', 'get_media_item', 10, 2);
    14111454add_filter('async_upload_audio', 'get_media_item', 10, 2);
Note: See TracChangeset for help on using the changeset viewer.