PluginProbe
WP-Stateless – Google Cloud Storage / 3.2.0
WP-Stateless – Google Cloud Storage v3.2.0
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
wp-stateless / lib / classes / compatibility / divi.php

divi.php in WP-Stateless – Google Cloud Storage 3.2.0, at lib/classes/compatibility/divi.php

66 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Theme Name: Divi
4 * Theme URI: https://www.elegantthemes.com/gallery/divi/
5 *
6 * Compatibility Description: Ensures compatibility with Divi themes Builder Export addon.
7 * https://github.com/wpCloud/wp-stateless/issues/224
8 *
9 */
10
11 namespace wpCloud\StatelessMedia {
12
13 if( !class_exists( 'wpCloud\StatelessMedia\Divi' ) ) {
14
15 class Divi extends ICompatibility {
16 protected $id = 'divi';
17 protected $title = 'Divi';
18 protected $constant = 'WP_STATELESS_COMPATIBILITY_DIVI';
19 protected $description = 'Ensures compatibility with Divi theme.';
20 protected $theme_name = 'Divi';
21
22 /**
23 * Cache Busting call stack conditions to disable.
24 * Fixing the issue with multiple cache files being created on each page load.
25 * @see https://github.com/wpCloud/wp-stateless/issues/430
26 * @var array
27 */
28 private $cache_busting_disable_conditions = array(
29 array( 'stack_level' => 7, 'function' => '__construct', 'class' => 'ET_Core_PageResource' ),
30 array( 'stack_level' => 7, 'function' => 'get_cache_filename', 'class' => 'ET_Builder_Element' )
31 );
32
33 /**
34 * Initialize compatibility module
35 * @param $sm
36 */
37 public function module_init( $sm ) {
38 // exclude randomize_filename from export
39 if( !empty( $_GET[ 'et_core_portability' ] ) || wp_doing_ajax() && ( !empty( $_POST[ 'action' ] )
40 && $_POST[ 'action' ] == 'et_core_portability_export' ) || ( !empty( $_POST[ 'et_core_portability_export' ] )
41 && $_POST[ 'et_core_portability_export' ] == 'et_core_portability_export' ) ) {
42 remove_filter( 'sanitize_file_name', array( "wpCloud\StatelessMedia\Utility", 'randomize_filename' ), 10 );
43 }
44
45 // maybe skip cache busting
46 add_filter( 'stateless_skip_cache_busting', array( $this, 'maybe_skip_cache_busting' ), 10, 2 );
47 }
48
49 /**
50 * Maybe skip cache busting
51 * @param $null
52 * @param $filename
53 * @return bool | string
54 */
55 public function maybe_skip_cache_busting( $null, $filename ) {
56 $callstack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 8 );
57 if( Utility::isCallStackMatches( $callstack, $this->cache_busting_disable_conditions ) ) return $filename;
58 return $null;
59 }
60
61 }
62
63 }
64
65 }
66