| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | * libraries bundled across many plugins, common enough to warrant a targeted |
| 8 | 8 | * case. Each entry is detached in-window and surfaced once in the shell, the |
| 9 | 9 | * same pattern as the core notices. |
| 10 | 10 | * |
| 11 | - * @package DesktopMode | |
| 11 | + * @package OpenStation | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | defined( 'ABSPATH' ) || exit; |
| 15 | 15 | |
| @@ -14,15 +14,15 @@ | ||
| 14 | 14 | defined( 'ABSPATH' ) || exit; |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * The allowlisted plugin/library notices for the current user, as shell |
| 18 | - * descriptors (same shape as `desktop_mode_get_core_notices()`). | |
| 18 | + * descriptors (same shape as `openstation_get_core_notices()`). | |
| 19 | 19 | * |
| 20 | 20 | * @return array<int,array{id:string,title:string,message:string,actionLabel:string,actionUrl:string}> |
| 21 | 21 | */ |
| 22 | -function desktop_mode_get_plugin_notices() { | |
| 22 | +function openstation_get_plugin_notices() { | |
| 23 | 23 | $builders = array( |
| 24 | - 'desktop_mode_plugin_notice_action_scheduler', | |
| 24 | + 'openstation_plugin_notice_action_scheduler', | |
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | 27 | $notices = array(); |
| 28 | 28 | foreach ( $builders as $builder ) { |
| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | * individual entries by `id`. |
| 39 | 39 | * |
| 40 | 40 | * @param array $notices List of notice descriptors. |
| 41 | 41 | */ |
| 42 | - return apply_filters( 'desktop_mode_plugin_notices', $notices ); | |
| 42 | + return apply_filters( 'openstation_plugin_notices', $notices ); | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Action Scheduler's "N past-due actions found" warning — bundled by |
| @@ -51,9 +51,14 @@ | ||
| 51 | 51 | * filters, so the count matches what Action Scheduler would show. |
| 52 | 52 | * |
| 53 | 53 | * @return array|null |
| 54 | 54 | */ |
| 55 | -function desktop_mode_plugin_notice_action_scheduler() { | |
| 55 | +function openstation_plugin_notice_action_scheduler() { | |
| 56 | + // Every filter applied below is Action Scheduler's own. Mirroring its | |
| 57 | + // check means honouring the same extension points a site has already | |
| 58 | + // hooked; prefixing them would consult filters nobody implements and | |
| 59 | + // silently diverge from the count Action Scheduler itself shows. | |
| 60 | + // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound | |
| 56 | 61 | if ( ! class_exists( 'ActionScheduler_Store' ) || ! function_exists( 'as_get_datetime_object' ) ) { |
| 57 | 62 | return null; |
| 58 | 63 | } |
| 59 | 64 | |
| @@ -88,8 +93,9 @@ | ||
| 88 | 93 | ); |
| 89 | 94 | if ( ! $check ) { |
| 90 | 95 | return null; |
| 91 | 96 | } |
| 97 | + // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound | |
| 92 | 98 | |
| 93 | 99 | $url = add_query_arg( |
| 94 | 100 | array( |
| 95 | 101 | 'page' => 'action-scheduler', |
| @@ -119,12 +125,12 @@ | ||
| 119 | 125 | |
| 120 | 126 | /** |
| 121 | 127 | * Detaches the allowlisted plugin/library notices inside chromeless iframes so |
| 122 | 128 | * they don't repeat in every window — the shell surfaces each once (see |
| 123 | - * `desktop_mode_get_plugin_notices()`). | |
| 129 | + * `openstation_get_plugin_notices()`). | |
| 124 | 130 | */ |
| 125 | -function desktop_mode_chromeless_suppress_plugin_notices() { | |
| 126 | - if ( ! desktop_mode_is_chromeless_request() ) { | |
| 131 | +function openstation_chromeless_suppress_plugin_notices() { | |
| 132 | + if ( ! openstation_is_chromeless_request() ) { | |
| 127 | 133 | return; |
| 128 | 134 | } |
| 129 | 135 | |
| 130 | 136 | // Action Scheduler registers the notice as an instance method on its |
| @@ -137,5 +143,5 @@ | ||
| 137 | 143 | remove_action( 'admin_notices', $callback, $priority ); |
| 138 | 144 | } |
| 139 | 145 | } |
| 140 | 146 | } |
| 141 | -add_action( 'admin_init', 'desktop_mode_chromeless_suppress_plugin_notices' ); | |
| 147 | +add_action( 'admin_init', 'openstation_chromeless_suppress_plugin_notices' ); | |