PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.4.0
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.4.0
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 11 months ago languages 11 months ago lets-encrypt 1 year ago lib 1 year ago mailer 1 year ago modal 11 months ago onboarding 1 year ago placeholders 1 year ago progress 1 year ago security 11 months ago settings 11 months ago testssl 5 years ago upgrade 1 year ago class-admin.php 1 year ago class-cache.php 2 years ago class-certificate.php 2 years ago class-front-end.php 1 year ago class-installer.php 1 year 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 1 year ago index.php 2 years ago readme.txt 11 months ago rector.php 1 year ago rlrsssl-really-simple-ssl.php 11 months ago rsssl-auto-loader.php 1 year ago security.md 2 years ago ssl-test-page.php 2 years ago system-status.php 1 year ago uninstall.php 1 year ago upgrade.php 11 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