Make WordPress Core

Changeset 7406


Ignore:
Timestamp:
03/20/2008 12:33:59 AM (19 years ago)
Author:
ryan
Message:

Degrade flash upload if the server is lightttpd < 1.5. Props nbachyski. fixes #6243

Location:
trunk
Files:
5 edited

Legend:

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

    r7401 r7406  
    812812                        swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
    813813                        degraded_element_id : "html-upload-ui",   // when swfupload is unavailable
    814                         swfupload_loaded_handler : uploadLoaded,
    815814                        file_dialog_start_handler : fileDialogStart,
    816815                        file_queued_handler : fileQueued,
    … …  
    844843        <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
    845844        <br class="clear" />
     845        <?php if ( is_lighttpd_before_150() ): ?>
     846        <p><?php _e('If you want to use all capabilties of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
     847        <?php endif;?>
    846848</div>
    847849<?php
  • trunk/wp-includes/functions.php

    r7405 r7406  
    17061706        }
    17071707}
     1708
     1709/**
     1710 * is_lighttpd_before_150() - Is the server running earlier than 1.5.0 version of lighttpd
     1711 *
     1712 * @return bool Whether the server is running lighttpd < 1.5.0
     1713 */
     1714function is_lighttpd_before_150() {
     1715        $server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
     1716        $server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
     1717        return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
     1718}
    17081719?>
  • trunk/wp-includes/js/swfupload/handlers.js

    r7256 r7406  
    1 function uploadLoaded() {
    2         jQuery("#html-upload-ui").remove();
    3         jQuery("#flash-upload-ui").show();
    4 }
    5 
    61function fileDialogStart() {
    72        jQuery("#media-upload-error").empty();
  • trunk/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js

    r6659 r7406  
    3737                var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
    3838                try {
     39                        if (uploadDegradeOptions.is_lighttpd_before_150) throw "Lighttpd versions earlier than 1.5.0 aren't supported!";
    3940                        swfupload_element_id = this.getSetting("swfupload_element_id");
    4041                        degraded_element_id = this.getSetting("degraded_element_id");
  • trunk/wp-includes/script-loader.php

    r7394 r7406  
    8484                $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2');
    8585                $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
     86                $this->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
     87                        'is_lighttpd_before_150' => is_lighttpd_before_150(),
     88                ) );
    8689                $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
    8790                $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080301');
Note: See TracChangeset for help on using the changeset viewer.