Changeset 1283

Show
Ignore:
Timestamp:
05/12/08 10:31:16 (7 months ago)
Author:
donncha
Message:

Add link to use browser upload rather than Flash uploader, props tellyworth

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/wpmu-functions.php

    r1281 r1283  
    18671867} 
    18681868 
     1869// support a GET parameter for disabling the flash uploader 
     1870function wpmu_upload_flash($flash) { 
     1871        if ( array_key_exists('flash', $_REQUEST) ) 
     1872                $flash = !empty($_REQUEST['flash']); 
     1873        return $flash; 
     1874}    
     1875 
     1876add_filter('flash_uploader', 'wpmu_upload_flash'); 
     1877 
     1878function 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 
     1884add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); 
     1885 
     1886function 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 
     1898add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass'); 
     1899add_action('post-html-upload-ui', 'wpmu_upload_html_bypass'); 
     1900 
     1901// make sure the GET parameter sticks when we submit a form 
     1902function 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 
     1908add_filter('media_upload_form_url', 'wpmu_upload_bypass_url'); 
     1909 
    18691910?>