Degrade flash upload if the server is lightttpd < 1.5. Props nbachyski. fixes #6243
git-svn-id: https://develop.svn.wordpress.org/trunk@7406 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a18dc5cb4d
commit
3e4d1197d5
|
@ -811,7 +811,6 @@ jQuery(function($){
|
||||||
file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
|
file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
|
||||||
swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
|
swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
|
||||||
degraded_element_id : "html-upload-ui", // when swfupload is unavailable
|
degraded_element_id : "html-upload-ui", // when swfupload is unavailable
|
||||||
swfupload_loaded_handler : uploadLoaded,
|
|
||||||
file_dialog_start_handler : fileDialogStart,
|
file_dialog_start_handler : fileDialogStart,
|
||||||
file_queued_handler : fileQueued,
|
file_queued_handler : fileQueued,
|
||||||
upload_start_handler : uploadStart,
|
upload_start_handler : uploadStart,
|
||||||
|
@ -843,6 +842,9 @@ jQuery(function($){
|
||||||
</p>
|
</p>
|
||||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
|
<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
|
||||||
<br class="clear" />
|
<br class="clear" />
|
||||||
|
<?php if ( is_lighttpd_before_150() ): ?>
|
||||||
|
<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>
|
||||||
|
<?php endif;?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -1705,4 +1705,15 @@ function _deprecated_file($file, $version, $replacement=null) {
|
||||||
trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."), $file, $version ) );
|
trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."), $file, $version ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is_lighttpd_before_150() - Is the server running earlier than 1.5.0 version of lighttpd
|
||||||
|
*
|
||||||
|
* @return bool Whether the server is running lighttpd < 1.5.0
|
||||||
|
*/
|
||||||
|
function is_lighttpd_before_150() {
|
||||||
|
$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
|
||||||
|
$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
|
||||||
|
return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
function uploadLoaded() {
|
|
||||||
jQuery("#html-upload-ui").remove();
|
|
||||||
jQuery("#flash-upload-ui").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
function fileDialogStart() {
|
function fileDialogStart() {
|
||||||
jQuery("#media-upload-error").empty();
|
jQuery("#media-upload-error").empty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ if (typeof(SWFUpload) === "function") {
|
||||||
SWFUpload.gracefulDegradation.swfUploadLoaded = function () {
|
SWFUpload.gracefulDegradation.swfUploadLoaded = function () {
|
||||||
var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
|
var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
|
||||||
try {
|
try {
|
||||||
|
if (uploadDegradeOptions.is_lighttpd_before_150) throw "Lighttpd versions earlier than 1.5.0 aren't supported!";
|
||||||
swfupload_element_id = this.getSetting("swfupload_element_id");
|
swfupload_element_id = this.getSetting("swfupload_element_id");
|
||||||
degraded_element_id = this.getSetting("degraded_element_id");
|
degraded_element_id = this.getSetting("degraded_element_id");
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,9 @@ class WP_Scripts {
|
||||||
$this->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1');
|
$this->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1');
|
||||||
$this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2');
|
$this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2');
|
||||||
$this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
|
$this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
|
||||||
|
$this->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
|
||||||
|
'is_lighttpd_before_150' => is_lighttpd_before_150(),
|
||||||
|
) );
|
||||||
$this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
|
$this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
|
||||||
$this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080301');
|
$this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080301');
|
||||||
// these error messages came from the sample swfupload js, they might need changing.
|
// these error messages came from the sample swfupload js, they might need changing.
|
||||||
|
|
Loading…
Reference in New Issue