PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.2.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.2.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 2.3.1 2.3.2 All 195 releases
← All changes | admin/class-convertkit-admin-cache-plugins.php +44 -8 2.3.23.2.3 View file →
@@ -53,12 +53,19 @@
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 +
57 63 $this->litespeed_cache();
58 64 $this->w3_total_cache();
59 65 $this->wp_fastest_cache();
60 66 $this->wp_optimize();
67 + $this->wp_rocket();
61 68 $this->wp_super_cache();
62 69
63 70 }
64 71
@@ -111,9 +118,9 @@
111 118 public function litespeed_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
112 119
113 120 return sprintf(
114 121 '%s %s %s %s',
115 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
122 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
116 123 '<code>ck_subscriber_id</code>',
117 124 sprintf(
118 125 '<a href="%s">%s</a>',
119 126 esc_url(
@@ -182,9 +189,9 @@
182 189 public function w3_total_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
183 190
184 191 return sprintf(
185 192 '%s %s %s %s',
186 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
193 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
187 194 '<code>ck_subscriber_id</code>',
188 195 sprintf(
189 196 '<a href="%s">%s</a>',
190 197 esc_url(
@@ -265,13 +272,8 @@
265 272 // Fetch settings.
266 273 $config = new WPO_Cache_Config();
267 274 $settings = $config->get();
268 275
269 - // Check that we received an array of settings.
270 - if ( ! is_array( $settings ) ) {
271 - return;
272 - }
273 -
274 276 // Check the exception cookies array key exists in the settings.
275 277 if ( ! array_key_exists( 'cache_exception_cookies', $settings ) ) {
276 278 $settings['cache_exception_cookies'] = array();
277 279 }
@@ -289,8 +291,42 @@
289 291
290 292 }
291 293
292 294 /**
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 + /**
293 329 * Show a notice in the WordPress Administration interface if
294 330 * WP Super Cache is active, its caching enabled and no rule to disable caching
295 331 * exists when the ck_subscriber_id cookie is present.
296 332 *
@@ -339,9 +375,9 @@
339 375 public function wp_super_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
340 376
341 377 return sprintf(
342 378 '%s %s %s %s',
343 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
379 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
344 380 '<code>ck_subscriber_id</code>',
345 381 sprintf(
346 382 '<a href="%s">%s</a>',
347 383 esc_url(