/
SpinUpWP.php
56 lines (48 loc) · 1.21 KB
/
SpinUpWP.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace WP_Rocket\ThirdParty\Hostings;
use WP_Rocket\Event_Management\Subscriber_Interface;
use WP_Rocket\ThirdParty\NullSubscriber;
use WP_Rocket\ThirdParty\ReturnTypesTrait;
/**
* Compatibility class for SpinUpWP
*
* @since 3.6.2
*/
class SpinUpWP extends NullSubscriber implements Subscriber_Interface {
use ReturnTypesTrait;
/**
* Array of events this subscriber wants to listen to.
*
* @since 3.6.2
*
* @return array
*/
public static function get_subscribed_events() {
return [
'do_rocket_generate_caching_files' => 'return_false',
'rocket_display_varnish_options_tab' => 'return_false',
'rocket_cache_mandatory_cookies' => 'return_empty_array',
'after_rocket_clean_domain' => 'purge_site',
'wp_rocket_loaded' => 'remove_actions',
];
}
/**
* Purge SpinUpWP cache after clean domain.
*
* @since 3.6.2
*/
public function purge_site() {
if ( ! function_exists( 'spinupwp_purge_site' ) ) {
return;
}
spinupwp_purge_site();
}
/**
* Remove rocket_clean_domain which prevents a double clear of the cache.
*
* @since 3.6.2
*/
public function remove_actions() {
remove_action( 'switch_theme', 'rocket_clean_domain' );
}
}