PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
← All changes | addons/cookie-consent/helper.php +41 -0 2.12.0 → 2.14.0 View file →
@@ -341,13 +341,24 @@
341 341 // The output-buffer layer. On by default because without it the
342 342 // feature covers only enqueued scripts, which is most of what a
343 343 // site owner would consider "not covered".
344 344 'buffer_gating' => true,
345 + // The iframe and pixel layer. Separate from `buffer_gating`
346 + // because it is the one that can change what the visitor sees: a
347 + // site that wants scripts held back but its videos left alone can
348 + // say so without giving up the rest.
349 + 'embed_gating' => true,
350 + 'embed_rules' => [],
351 + 'pixel_rules' => [],
345 352 // Report what would be gated, gate nothing. The way to find out
346 353 // what breaks before it breaks.
347 354 'dry_run' => false,
348 355 'consent_mode' => true,
349 356 'consent_mode_wait' => 500,
357 + // `ads_data_redaction` and `url_passthrough`. On by default: they
358 + // only change what happens once something has been refused, and
359 + // what they change is the cost of the refusal.
360 + 'consent_mode_ads' => true,
350 361 'record_enabled' => true,
351 362 'record_ip' => false,
352 363 'record_retention_days' => 730,
353 364 'hide_for_admins' => false,
@@ -461,8 +472,27 @@
461 472 return apply_filters( 'ablocks/cookie_consent/categories', $categories );
462 473 }
463 474
464 475 /**
476 + * Whether a category exists and is switched on.
477 + *
478 + * A rule pointing at a category the site has deleted would gate against a
479 + * choice the visitor is never offered — for a script that means it never
480 + * runs, and for an embed it means a card that can never be dismissed.
481 + *
482 + * @param string $slug Category slug.
483 + * @return bool
484 + */
485 + public static function category_is_active( $slug ) {
486 + foreach ( self::active_categories() as $category ) {
487 + if ( isset( $category['slug'] ) && $category['slug'] === $slug ) {
488 + return true;
489 + }
490 + }
491 + return false;
492 + }
493 +
494 + /**
465 495 * Category slugs that a visitor can actually refuse.
466 496 */
467 497 public static function refusable_slugs() {
468 498 $slugs = [];
@@ -498,11 +528,22 @@
498 528 * Whether gating should run at all for this request.
499 529 *
500 530 * Dry run counts as "running": it walks the same rules, it just reports
501 531 * instead of rewriting.
532 + *
533 + * This has to answer false wherever `should_render_banner()` does, because
534 + * the two halves are one mechanism: gating holds a tag back, and the banner
535 + * is the only thing that ever lets it go. Gate without a banner and the tag
536 + * is frozen for the rest of that visitor's session, with nothing on the
537 + * page able to release it.
502 538 */
503 539 public static function is_gating_active() {
504 540 if ( ! self::get( 'enabled', true ) || 'optin' !== self::get( 'mode', 'optin' ) ) {
541 + return false;
542 + }
543 + // The earliest caller registers on `wp`, so the current user is
544 + // resolved by the time this runs and the capability check is safe here.
545 + if ( self::get( 'hide_for_admins', false ) && current_user_can( 'manage_options' ) ) {
505 546 return false;
506 547 }
507 548 if ( is_admin() || wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
508 549 return false;