PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.0.1
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.0.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 9 months ago languages 9 months ago lets-encrypt 9 months ago lib 1 year ago mailer 10 months ago modal 9 months ago onboarding 10 months ago placeholders 9 months ago progress 1 year ago security 9 months ago settings 9 months ago testssl 5 years ago upgrade 9 months ago .wp-env.json 10 months ago SECURITY.md 9 months ago class-admin.php 9 months ago class-cache.php 2 years ago class-certificate.php 2 years ago class-front-end.php 1 year ago class-installer.php 10 months ago class-mixed-content-fixer.php 3 years ago class-multisite.php 1 year ago class-server.php 1 year ago class-site-health.php 1 year ago class-wp-cli.php 11 months ago compatibility.php 1 year ago force-deactivate.txt 1 year ago functions.php 10 months ago index.php 2 years ago readme.txt 9 months ago rector.php 1 year ago rlrsssl-really-simple-ssl.php 9 months ago rsssl-auto-loader.php 1 year ago sbom.json.gz 9 months ago ssl-test-page.php 2 years ago system-status.php 9 months ago uninstall.php 9 months ago upgrade.php 9 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