-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-woocommerce.php
42 lines (34 loc) · 1.1 KB
/
class-woocommerce.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace SLCA\WooCommerce;
use wpCloud\StatelessMedia\Compatibility;
/**
* Class WooCommerce
*/
class WooCommerce extends Compatibility {
protected $id = 'woocommerce';
protected $title = 'WooCommerce';
protected $constant = 'WP_STATELESS_COMPATIBILITY_WOOCOMMERCE';
protected $description = 'Ensures compatibility with WooCommerce.';
protected $plugin_file = [ 'woocommerce/woocommerce.php' ];
protected $sm_mode_not_supported = [ 'stateless' ];
/**
* @param $sm
*/
public function module_init( $sm ) {
add_filter( 'stateless_skip_cache_busting', array( $this, 'skip_cache_busting' ), 10, 2 );
}
/**
* skip cache busting for template file name.a
* @param $return
* @param $filename
* @return mixed
*/
public function skip_cache_busting( $return, $filename ) {
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 8 );
$check = $backtrace && isset( $backtrace[7] ) && isset( $backtrace[7]['class'] ) ? $backtrace[7]['class'] : '';
if( strpos( $check, 'WC_CSV_Exporter' ) !== false ) {
return $filename;
}
return $return;
}
}