PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.1
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.1
9.5.11 9.5.10.1 9.5.10 trunk 9.4.0 9.4.1 9.4.2 9.4.3 9.5.0 9.5.0.1 9.5.0.2 9.5.1 9.5.2 9.5.2.2 9.5.2.3 9.5.3 9.5.3.1 9.5.3.2 9.5.4 9.5.5 9.5.6 9.5.7 9.5.8 9.5.9
really-simple-ssl / class-cache.php
really-simple-ssl Last commit date
assets 8 months ago languages 8 months ago lets-encrypt 8 months ago lib 8 months ago mailer 8 months ago modal 8 months ago onboarding 8 months ago placeholders 8 months ago progress 8 months ago security 8 months ago settings 8 months ago testssl 8 months ago upgrade 8 months ago .wp-env.json 8 months ago SECURITY.md 8 months ago class-admin.php 8 months ago class-cache.php 8 months ago class-certificate.php 8 months ago class-front-end.php 8 months ago class-installer.php 8 months ago class-mixed-content-fixer.php 8 months ago class-multisite.php 8 months ago class-server.php 8 months ago class-site-health.php 8 months ago class-wp-cli.php 8 months ago compatibility.php 8 months ago force-deactivate.txt 8 months ago functions.php 8 months ago index.php 8 months ago readme.txt 8 months ago rector.php 8 months ago rlrsssl-really-simple-ssl.php 8 months ago rsssl-auto-loader.php 8 months ago sbom.json.gz 8 months ago ssl-test-page.php 8 months ago system-status.php 8 months ago uninstall.php 8 months ago upgrade.php 8 months ago
class-cache.php
138 lines
1 <?php
2 defined( 'ABSPATH' ) or die( );
3 if ( ! class_exists( 'rsssl_cache' ) ) {
4 class rsssl_cache {
5 private static $_this;
6
7 public function __construct() {
8 if ( isset( self::$_this ) ) {
9 wp_die( 'you cannot create a second instance.' );
10 }
11
12 self::$_this = $this;
13 }
14
15 public static function this() {
16 return self::$_this;
17 }
18
19 /**
20 * Flushes the cache for popular caching plugins to prevent mixed content errors
21 * When .htaccess is changed, all traffic should flow over https, so clear cache when possible.
22 * supported: W3TC, WP fastest Cache, Zen Cache, wp_rocket
23 *
24 * @since 2.0
25 *
26 * @access public
27 *
28 */
29
30 public function flush() {
31 if ( ! rsssl_user_can_manage() ) {
32 return;
33 }
34
35 add_action( 'admin_head', array( $this, 'maybe_flush_w3tc_cache' ) );
36 add_action( 'admin_head', array( $this, 'maybe_flush_wp_optimize_cache' ) );
37 add_action( 'admin_head', array( $this, 'maybe_flush_litespeed_cache' ) );
38 add_action( 'admin_head', array( $this, 'maybe_flush_hummingbird_cache' ) );
39 add_action( 'admin_head', array( $this, 'maybe_flush_fastest_cache' ) );
40 add_action( 'admin_head', array( $this, 'maybe_flush_autoptimize_cache' ) );
41 add_action( 'admin_head', array( $this, 'maybe_flush_wp_rocket' ) );
42 add_action( 'admin_head', array( $this, 'maybe_flush_cache_enabler' ) );
43 add_action( 'admin_head', array( $this, 'maybe_flush_wp_super_cache' ) );
44 }
45
46 public function maybe_flush_w3tc_cache() {
47 if ( ! rsssl_user_can_manage() ) {
48 return;
49 }
50
51 if ( function_exists( 'w3tc_flush_all' ) ) {
52 w3tc_flush_all();
53 }
54 }
55
56 public function maybe_flush_wp_optimize_cache() {
57 if ( ! rsssl_user_can_manage() ) {
58 return;
59 }
60
61 if ( function_exists( 'wpo_cache_flush' ) ) {
62 wpo_cache_flush();
63 }
64 }
65
66 public function maybe_flush_litespeed_cache() {
67 if ( ! rsssl_user_can_manage() ) {
68 return;
69 }
70
71 if ( class_exists( 'LiteSpeed' ) ) {
72 Litespeed\Purge::purge_all();
73 }
74 }
75
76 public function maybe_flush_hummingbird_cache() {
77 if ( ! rsssl_user_can_manage() ) {
78 return;
79 }
80
81 if ( is_callable( array( 'Hummingbird\WP_Hummingbird', 'flush_cache' ) ) ) {
82 Hummingbird\WP_Hummingbird::flush_cache();
83 }
84 }
85
86 public function maybe_flush_fastest_cache() {
87 if ( ! rsssl_user_can_manage() ) {
88 return;
89 }
90
91 if ( class_exists( 'WpFastestCache' ) ) {
92 // Non-static cannot be called statically ::
93 ( new WpFastestCache() )->deleteCache();
94 }
95 }
96
97 public function maybe_flush_autoptimize_cache() {
98 if ( ! rsssl_user_can_manage() ) {
99 return;
100 }
101
102 if ( class_exists( 'autoptimizeCache' ) ) {
103 autoptimizeCache::clearall();
104 }
105 }
106
107 public function maybe_flush_wp_rocket() {
108 if ( ! rsssl_user_can_manage() ) {
109 return;
110 }
111
112 if ( function_exists( 'rocket_clean_domain' ) ) {
113 rocket_clean_domain();
114 }
115 }
116
117 public function maybe_flush_cache_enabler() {
118 if ( ! rsssl_user_can_manage() ) {
119 return;
120 }
121
122 if ( class_exists( 'Cache_Enabler' ) ) {
123 Cache_Enabler::clear_complete_cache();
124 }
125 }
126
127 public function maybe_flush_wp_super_cache() {
128 if ( ! rsssl_user_can_manage() ) {
129 return;
130 }
131
132 if ( function_exists( 'wp_cache_clear_cache' ) ) {
133 wp_cache_clear_cache();
134 }
135 }
136 }//class closure
137 }
138