File download method opton
This commit is contained in:
parent
c29702ee6b
commit
cf52e99bd5
|
@ -165,7 +165,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Scripts & Styling', 'woothemes' ),
|
||||
'name' => __( 'Styling', 'woothemes' ),
|
||||
'desc' => __( 'Enable WooCommerce CSS styles', 'woothemes' ),
|
||||
'id' => 'woocommerce_frontend_css',
|
||||
'std' => 'yes',
|
||||
|
@ -174,11 +174,20 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Enable the "Demo Store" notice on your site', 'woothemes' ),
|
||||
'id' => 'woocommerce_demo_store',
|
||||
'std' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Scripts', 'woothemes' ),
|
||||
'desc' => __( 'Enable AJAX add to cart buttons on product archives', 'woothemes' ),
|
||||
'id' => 'woocommerce_enable_ajax_add_to_cart',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
||||
array(
|
||||
|
@ -206,19 +215,18 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Demo store notice', 'woothemes' ),
|
||||
'desc' => __( 'Enable the "Demo Store" notice on your site', 'woothemes' ),
|
||||
'id' => 'woocommerce_demo_store',
|
||||
'std' => 'no',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __('File downloads', 'woothemes'),
|
||||
'desc' => __('Use <code>X-Accel-Redirect</code>/ <code>X-Sendfile</code> to serve downloads (server requires <code>mod_xsendfile</code>)', 'woothemes'),
|
||||
'id' => 'woocommerce_mod_xsendfile_enabled',
|
||||
'type' => 'checkbox',
|
||||
'std' => 'no',
|
||||
'name' => __('File download method', 'woothemes'),
|
||||
'desc' => __('Forcing downloads will keep URLs hidden, but some servers may serve large files unreliably. If supported, <code>X-Accel-Redirect</code>/ <code>X-Sendfile</code> can be used to serve downloads instead (server requires <code>mod_xsendfile</code>).', 'woothemes'),
|
||||
'id' => 'woocommerce_file_download_method',
|
||||
'type' => 'select',
|
||||
'class' => 'chosen_select',
|
||||
'css' => 'min-width:300px;',
|
||||
'std' => 'force',
|
||||
'options' => array(
|
||||
'force' => __( 'Force Downloads', 'woothemes' ),
|
||||
'xsendfile' => __( 'X-Accel-Redirect/X-Sendfile', 'woothemes' ),
|
||||
'redirect' => __( 'Redirect only', 'woothemes' ),
|
||||
)
|
||||
),
|
||||
|
||||
array(
|
||||
|
|
|
@ -216,7 +216,7 @@ table.bar_chart tbody td{text-align:right;line-height:24px;padding:6px 6px 6px 0
|
|||
table.bar_chart tbody td span.alt{color:#47a03e;margin-top:6px;}
|
||||
table.bar_chart tbody td.bars{position:relative;text-align:left;padding:6px 6px 6px 0;border-bottom:1px solid #fee;}table.bar_chart tbody td.bars span,table.bar_chart tbody td.bars a{text-decoration:none;clear:both;background:#8a4b75;float:left;display:block;line-height:24px;height:24px;-moz-border-radius:3px;-webkit-border-radius:3px;-o-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;}
|
||||
table.bar_chart tbody td.bars span.alt{clear:both;background:#47a03e;}table.bar_chart tbody td.bars span.alt span{margin:0;color:#c5dec2 !important;text-shadow:0 1px 0 #47a03e;background:transparent;}
|
||||
#woocommerce_allowed_countries_chzn .chzn-search{display:none;}
|
||||
#woocommerce_allowed_countries_chzn .chzn-search,#woocommerce_file_download_method_chzn .chzn-search{display:none;}
|
||||
.chzn-container{font-size:13px;position:relative;display:inline-block;zoom:1;*display:inline;margin-right:5px;}
|
||||
.chzn-container .chzn-drop{background:#fff;border:1px solid #aaa;border-top:0;position:absolute;top:29px;left:0;-webkit-box-shadow:0 4px 5px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 4px 5px rgba(0, 0, 0, 0.15);-o-box-shadow:0 4px 5px rgba(0, 0, 0, 0.15);box-shadow:0 4px 5px rgba(0, 0, 0, 0.15);z-index:999;}
|
||||
.chzn-container-single .chzn-single{background-color:#fff;background-image:-webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));background-image:-webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);background-image:-moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);background-image:-o-linear-gradient(top, #eeeeee 0%, #ffffff 50%);background-image:-ms-linear-gradient(top, #eeeeee 0%, #ffffff 50%);background-image:linear-gradient(top, #eeeeee 0%, #ffffff 50%);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #aaa;display:block;overflow:hidden;white-space:nowrap;position:relative;height:23px;line-height:23px;padding:0 0 0 8px;color:#444;text-decoration:none;}
|
||||
|
|
|
@ -1296,8 +1296,10 @@ table.bar_chart {
|
|||
|
||||
/* Chosen multiselect enhancement
|
||||
----------------------------------*/
|
||||
#woocommerce_allowed_countries_chzn .chzn-search {
|
||||
display: none;
|
||||
#woocommerce_allowed_countries_chzn, #woocommerce_file_download_method_chzn {
|
||||
.chzn-search {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* @group Base */
|
||||
|
|
|
@ -98,6 +98,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
|||
* Tax rates based on shipping address
|
||||
* Helpers for outputting JS in the footer
|
||||
* Fixed sale widget
|
||||
* File download method option so force download can be switched off
|
||||
|
||||
= 1.3 - 01/12/2011 =
|
||||
* Minor bug fixes + localisations
|
||||
|
|
|
@ -920,6 +920,15 @@ function woocommerce_download_product() {
|
|||
|
||||
if (!$file_path) exit;
|
||||
|
||||
$file_download_method = apply_filters('woocommerce_file_download_method', get_option('woocommerce_file_download_method'), $download_file);
|
||||
|
||||
if ($file_download_method=='redirect') :
|
||||
|
||||
header('Location: '.$file_path);
|
||||
exit;
|
||||
|
||||
endif;
|
||||
|
||||
if (!is_multisite()) :
|
||||
$file_path = str_replace(trailingslashit(site_url()), ABSPATH, $file_path);
|
||||
else :
|
||||
|
@ -956,7 +965,7 @@ function woocommerce_download_product() {
|
|||
default: $ctype="application/force-download";
|
||||
endswitch;
|
||||
|
||||
if (get_option('woocommerce_mod_xsendfile_enabled')=='yes') :
|
||||
if ($file_download_method=='xsendfile') :
|
||||
|
||||
header("X-Accel-Redirect: $file_path");
|
||||
header("X-Sendfile: $file_path");
|
||||
|
|
Loading…
Reference in New Issue