PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.7.4
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.7.4
3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 All 195 releases
← All changes | admin/class-convertkit-admin-cache-plugins.php +38 -8 2.3.22.7.4 View file →
@@ -57,8 +57,9 @@
57 57 $this->litespeed_cache();
58 58 $this->w3_total_cache();
59 59 $this->wp_fastest_cache();
60 60 $this->wp_optimize();
61 + $this->wp_rocket();
61 62 $this->wp_super_cache();
62 63
63 64 }
64 65
@@ -111,9 +112,9 @@
111 112 public function litespeed_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
112 113
113 114 return sprintf(
114 115 '%s %s %s %s',
115 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
116 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
116 117 '<code>ck_subscriber_id</code>',
117 118 sprintf(
118 119 '<a href="%s">%s</a>',
119 120 esc_url(
@@ -182,9 +183,9 @@
182 183 public function w3_total_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
183 184
184 185 return sprintf(
185 186 '%s %s %s %s',
186 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
187 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
187 188 '<code>ck_subscriber_id</code>',
188 189 sprintf(
189 190 '<a href="%s">%s</a>',
190 191 esc_url(
@@ -265,13 +266,8 @@
265 266 // Fetch settings.
266 267 $config = new WPO_Cache_Config();
267 268 $settings = $config->get();
268 269
269 - // Check that we received an array of settings.
270 - if ( ! is_array( $settings ) ) {
271 - return;
272 - }
273 -
274 270 // Check the exception cookies array key exists in the settings.
275 271 if ( ! array_key_exists( 'cache_exception_cookies', $settings ) ) {
276 272 $settings['cache_exception_cookies'] = array();
277 273 }
@@ -289,8 +285,42 @@
289 285
290 286 }
291 287
292 288 /**
289 + * Add a rule to WP Rocket to prevent caching when
290 + * the ck_subscriber_id cookie is present.
291 + *
292 + * @since 2.7.0
293 + */
294 + public function wp_rocket() {
295 +
296 + // Bail if the WP Rocket plugin is not active.
297 + if ( ! is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) {
298 + return;
299 + }
300 +
301 + // Sanity check that we can access WP-Optimize's configuration class.
302 + if ( ! function_exists( 'update_rocket_option' ) ) {
303 + return;
304 + }
305 +
306 + // Fetch settings.
307 + $settings = get_rocket_option( 'cache_reject_cookies', array() );
308 +
309 + // If the cookie exception exists, no need to modify anything.
310 + if ( in_array( $this->key, $settings, true ) ) {
311 + return;
312 + }
313 +
314 + // Add cookie to exceptions.
315 + $settings[] = $this->key;
316 +
317 + // Update configuration to include excluding caching for the ck_subscriber_id cookie.
318 + update_rocket_option( 'cache_reject_cookies', $settings );
319 +
320 + }
321 +
322 + /**
293 323 * Show a notice in the WordPress Administration interface if
294 324 * WP Super Cache is active, its caching enabled and no rule to disable caching
295 325 * exists when the ck_subscriber_id cookie is present.
296 326 *
@@ -339,9 +369,9 @@
339 369 public function wp_super_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
340 370
341 371 return sprintf(
342 372 '%s %s %s %s',
343 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
373 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
344 374 '<code>ck_subscriber_id</code>',
345 375 sprintf(
346 376 '<a href="%s">%s</a>',
347 377 esc_url(