PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.2
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.2
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 +49 -8 2.3.23.4.2 View file →
@@ -53,12 +53,24 @@
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 +
57 68 $this->litespeed_cache();
58 69 $this->w3_total_cache();
59 70 $this->wp_fastest_cache();
60 71 $this->wp_optimize();
72 + $this->wp_rocket();
61 73 $this->wp_super_cache();
62 74
63 75 }
64 76
@@ -111,9 +123,9 @@
111 123 public function litespeed_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
112 124
113 125 return sprintf(
114 126 '%s %s %s %s',
115 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
127 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
116 128 '<code>ck_subscriber_id</code>',
117 129 sprintf(
118 130 '<a href="%s">%s</a>',
119 131 esc_url(
@@ -182,9 +194,9 @@
182 194 public function w3_total_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
183 195
184 196 return sprintf(
185 197 '%s %s %s %s',
186 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
198 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
187 199 '<code>ck_subscriber_id</code>',
188 200 sprintf(
189 201 '<a href="%s">%s</a>',
190 202 esc_url(
@@ -265,13 +277,8 @@
265 277 // Fetch settings.
266 278 $config = new WPO_Cache_Config();
267 279 $settings = $config->get();
268 280
269 - // Check that we received an array of settings.
270 - if ( ! is_array( $settings ) ) {
271 - return;
272 - }
273 -
274 281 // Check the exception cookies array key exists in the settings.
275 282 if ( ! array_key_exists( 'cache_exception_cookies', $settings ) ) {
276 283 $settings['cache_exception_cookies'] = array();
277 284 }
@@ -289,8 +296,42 @@
289 296
290 297 }
291 298
292 299 /**
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 + /**
293 334 * Show a notice in the WordPress Administration interface if
294 335 * WP Super Cache is active, its caching enabled and no rule to disable caching
295 336 * exists when the ck_subscriber_id cookie is present.
296 337 *
@@ -339,9 +380,9 @@
339 380 public function wp_super_cache_notice( $notice ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
340 381
341 382 return sprintf(
342 383 '%s %s %s %s',
343 - esc_html__( 'ConvertKit: Member Content: Please add', 'convertkit' ),
384 + esc_html__( 'Kit: Member Content: Please add', 'convertkit' ),
344 385 '<code>ck_subscriber_id</code>',
345 386 sprintf(
346 387 '<a href="%s">%s</a>',
347 388 esc_url(