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.4 3.4.3 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 All 197 releases
← All changes | admin/class-convertkit-admin-cache-plugins.php +38 -14 2.2.82.7.4 View file →
@@ -53,18 +53,13 @@
53 53 * @since 2.2.2
54 54 */
55 55 public function maybe_configure_cache_plugins() {
56 56
57 - // Bail if Restrict Content is disabled.
58 - $restrict_content_settings = new ConvertKit_Settings_Restrict_Content();
59 - if ( ! $restrict_content_settings->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();
61 + $this->wp_rocket();
67 62 $this->wp_super_cache();
68 63
69 64 }
70 65
@@ -117,9 +112,9 @@
117 112 public function litespeed_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
118 113
119 114 return sprintf(
120 115 '%s %s %s %s',
121 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
116 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
122 117 '<code>ck_subscriber_id</code>',
123 118 sprintf(
124 119 '<a href="%s">%s</a>',
125 120 esc_url(
@@ -188,9 +183,9 @@
188 183 public function w3_total_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
189 184
190 185 return sprintf(
191 186 '%s %s %s %s',
192 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
187 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
193 188 '<code>ck_subscriber_id</code>',
194 189 sprintf(
195 190 '<a href="%s">%s</a>',
196 191 esc_url(
@@ -271,13 +266,8 @@
271 266 // Fetch settings.
272 267 $config = new WPO_Cache_Config();
273 268 $settings = $config->get();
274 269
275 - // Check that we received an array of settings.
276 - if ( ! is_array( $settings ) ) {
277 - return;
278 - }
279 -
280 270 // Check the exception cookies array key exists in the settings.
281 271 if ( ! array_key_exists( 'cache_exception_cookies', $settings ) ) {
282 272 $settings['cache_exception_cookies'] = array();
283 273 }
@@ -295,8 +285,42 @@
295 285
296 286 }
297 287
298 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 + /**
299 323 * Show a notice in the WordPress Administration interface if
300 324 * WP Super Cache is active, its caching enabled and no rule to disable caching
301 325 * exists when the ck_subscriber_id cookie is present.
302 326 *
@@ -345,9 +369,9 @@
345 369 public function wp_super_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
346 370
347 371 return sprintf(
348 372 '%s %s %s %s',
349 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
373 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
350 374 '<code>ck_subscriber_id</code>',
351 375 sprintf(
352 376 '<a href="%s">%s</a>',
353 377 esc_url(