| @@ -53,19 +53,12 @@ | ||
| 53 | 53 | * @since 2.2.2 |
| 54 | 54 | */ |
| 55 | 55 | public function maybe_configure_cache_plugins() { |
| 56 | 56 | |
| 57 | - // If no Pages, Posts or CPTs are configured to use Restrict Content, don't | |
| 58 | - // configure any caching plugins. | |
| 59 | - if ( ! WP_ConvertKit()->get_class( 'admin_restrict_content' )->restrict_content_enabled() ) { | |
| 60 | - return; | |
| 61 | - } | |
| 62 | - | |
| 63 | 57 | $this->litespeed_cache(); |
| 64 | 58 | $this->w3_total_cache(); |
| 65 | 59 | $this->wp_fastest_cache(); |
| 66 | 60 | $this->wp_optimize(); |
| 67 | - $this->wp_rocket(); | |
| 68 | 61 | $this->wp_super_cache(); |
| 69 | 62 | |
| 70 | 63 | } |
| 71 | 64 | |
| @@ -118,9 +111,9 @@ | ||
| 118 | 111 | public function litespeed_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found |
| 119 | 112 | |
| 120 | 113 | return sprintf( |
| 121 | 114 | '%s %s %s %s', |
| 122 | - esc_html__( 'Kit: Member Content: Please add', 'convertkit' ), | |
| 115 | + esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ), | |
| 123 | 116 | '<code>ck_subscriber_id</code>', |
| 124 | 117 | sprintf( |
| 125 | 118 | '<a href="%s">%s</a>', |
| 126 | 119 | esc_url( |
| @@ -189,9 +182,9 @@ | ||
| 189 | 182 | public function w3_total_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found |
| 190 | 183 | |
| 191 | 184 | return sprintf( |
| 192 | 185 | '%s %s %s %s', |
| 193 | - esc_html__( 'Kit: Member Content: Please add', 'convertkit' ), | |
| 186 | + esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ), | |
| 194 | 187 | '<code>ck_subscriber_id</code>', |
| 195 | 188 | sprintf( |
| 196 | 189 | '<a href="%s">%s</a>', |
| 197 | 190 | esc_url( |
| @@ -272,8 +265,13 @@ | ||
| 272 | 265 | // Fetch settings. |
| 273 | 266 | $config = new WPO_Cache_Config(); |
| 274 | 267 | $settings = $config->get(); |
| 275 | 268 | |
| 269 | + // Check that we received an array of settings. | |
| 270 | + if ( ! is_array( $settings ) ) { | |
| 271 | + return; | |
| 272 | + } | |
| 273 | + | |
| 276 | 274 | // Check the exception cookies array key exists in the settings. |
| 277 | 275 | if ( ! array_key_exists( 'cache_exception_cookies', $settings ) ) { |
| 278 | 276 | $settings['cache_exception_cookies'] = array(); |
| 279 | 277 | } |
| @@ -291,42 +289,8 @@ | ||
| 291 | 289 | |
| 292 | 290 | } |
| 293 | 291 | |
| 294 | 292 | /** |
| 295 | - * Add a rule to WP Rocket to prevent caching when | |
| 296 | - * the ck_subscriber_id cookie is present. | |
| 297 | - * | |
| 298 | - * @since 2.7.0 | |
| 299 | - */ | |
| 300 | - public function wp_rocket() { | |
| 301 | - | |
| 302 | - // Bail if the WP Rocket plugin is not active. | |
| 303 | - if ( ! is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) { | |
| 304 | - return; | |
| 305 | - } | |
| 306 | - | |
| 307 | - // Sanity check that we can access WP-Optimize's configuration class. | |
| 308 | - if ( ! function_exists( 'update_rocket_option' ) ) { | |
| 309 | - return; | |
| 310 | - } | |
| 311 | - | |
| 312 | - // Fetch settings. | |
| 313 | - $settings = get_rocket_option( 'cache_reject_cookies', array() ); | |
| 314 | - | |
| 315 | - // If the cookie exception exists, no need to modify anything. | |
| 316 | - if ( in_array( $this->key, $settings, true ) ) { | |
| 317 | - return; | |
| 318 | - } | |
| 319 | - | |
| 320 | - // Add cookie to exceptions. | |
| 321 | - $settings[] = $this->key; | |
| 322 | - | |
| 323 | - // Update configuration to include excluding caching for the ck_subscriber_id cookie. | |
| 324 | - update_rocket_option( 'cache_reject_cookies', $settings ); | |
| 325 | - | |
| 326 | - } | |
| 327 | - | |
| 328 | - /** | |
| 329 | 293 | * Show a notice in the WordPress Administration interface if |
| 330 | 294 | * WP Super Cache is active, its caching enabled and no rule to disable caching |
| 331 | 295 | * exists when the ck_subscriber_id cookie is present. |
| 332 | 296 | * |
| @@ -375,9 +339,9 @@ | ||
| 375 | 339 | public function wp_super_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found |
| 376 | 340 | |
| 377 | 341 | return sprintf( |
| 378 | 342 | '%s %s %s %s', |
| 379 | - esc_html__( 'Kit: Member Content: Please add', 'convertkit' ), | |
| 343 | + esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ), | |
| 380 | 344 | '<code>ck_subscriber_id</code>', |
| 381 | 345 | sprintf( |
| 382 | 346 | '<a href="%s">%s</a>', |
| 383 | 347 | esc_url( |