PluginProbe
Noted! / trunk
Noted! vtrunk
2.0.2 2.0.1 trunk 1.0 2.0
noted / includes / Compatibility.php

Compatibility.php in Noted! trunk, at includes/Compatibility.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Noted;
6
7 /**
8 * Third-party plugin integrations that are not core Noted behaviour.
9 */
10 final class Compatibility
11 {
12 /**
13 * Register compatibility filters for plugins that aggressively dequeue
14 * admin scripts/styles. Adding our slug to their allowlists keeps the
15 * Noted! assets loading on screens where they would otherwise be cut.
16 */
17 public static function register(): void
18 {
19 add_filter('fluentform/exclude_js_slugs_from_dequeue', [self::class, 'fluentFormsCompatibility']);
20 add_filter('mailpoet_conflict_resolver_whitelist_script', [self::class, 'mailpoetCompatibility'], 10, 1);
21 add_filter('mailpoet_conflict_resolver_whitelist_style', [self::class, 'mailpoetCompatibility'], 10, 1);
22 }
23
24 /**
25 * Fluent Forms may dequeue third-party JS in the admin; keep Noted
26 * scripts when both plugins are active.
27 *
28 * @param array<int|string, mixed> $slugs
29 * @return array<int|string, mixed>
30 */
31 public static function fluentFormsCompatibility(array $slugs): array
32 {
33 $slugs[] = 'noted';
34
35 return $slugs;
36 }
37
38 /**
39 * MailPoet's conflict resolver may dequeue admin scripts; allow Noted
40 * assets when both plugins are active.
41 *
42 * @param array<int|string, mixed> $patterns
43 * @return array<int|string, mixed>
44 */
45 public static function mailpoetCompatibility(array $patterns): array
46 {
47 $patterns[] = 'noted';
48
49 return $patterns;
50 }
51 }
52