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