| @@ -7,10 +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 | - * @since 0.9.6 | |
| 12 | - * @package DesktopMode | |
| 11 | + * @package OpenStation | |
| 13 | 12 | */ |
| 14 | 13 | |
| 15 | 14 | defined( 'ABSPATH' ) || exit; |
| 16 | 15 | |
| @@ -15,17 +14,15 @@ | ||
| 15 | 14 | defined( 'ABSPATH' ) || exit; |
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * The allowlisted plugin/library notices for the current user, as shell |
| 19 | - * descriptors (same shape as `desktop_mode_get_core_notices()`). | |
| 18 | + * descriptors (same shape as `openstation_get_core_notices()`). | |
| 20 | 19 | * |
| 21 | - * @since 0.9.6 | |
| 22 | - * | |
| 23 | 20 | * @return array<int,array{id:string,title:string,message:string,actionLabel:string,actionUrl:string}> |
| 24 | 21 | */ |
| 25 | -function desktop_mode_get_plugin_notices() { | |
| 22 | +function openstation_get_plugin_notices() { | |
| 26 | 23 | $builders = array( |
| 27 | - 'desktop_mode_plugin_notice_action_scheduler', | |
| 24 | + 'openstation_plugin_notice_action_scheduler', | |
| 28 | 25 | ); |
| 29 | 26 | |
| 30 | 27 | $notices = array(); |
| 31 | 28 | foreach ( $builders as $builder ) { |
| @@ -39,13 +36,11 @@ | ||
| 39 | 36 | * Filters the allowlisted plugin/library notices surfaced once in the |
| 40 | 37 | * desktop shell. Return an empty array to suppress them all, or unset |
| 41 | 38 | * individual entries by `id`. |
| 42 | 39 | * |
| 43 | - * @since 0.9.6 | |
| 44 | - * | |
| 45 | 40 | * @param array $notices List of notice descriptors. |
| 46 | 41 | */ |
| 47 | - return apply_filters( 'desktop_mode_plugin_notices', $notices ); | |
| 42 | + return apply_filters( 'openstation_plugin_notices', $notices ); | |
| 48 | 43 | } |
| 49 | 44 | |
| 50 | 45 | /** |
| 51 | 46 | * Action Scheduler's "N past-due actions found" warning — bundled by |
| @@ -54,13 +49,16 @@ | ||
| 54 | 49 | * repeats in every window). Re-derived here from Action Scheduler's own store, |
| 55 | 50 | * mirroring `ActionScheduler_AdminView::check_pastdue_actions()` including its |
| 56 | 51 | * filters, so the count matches what Action Scheduler would show. |
| 57 | 52 | * |
| 58 | - * @since 0.9.6 | |
| 59 | - * | |
| 60 | 53 | * @return array|null |
| 61 | 54 | */ |
| 62 | -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 | |
| 63 | 61 | if ( ! class_exists( 'ActionScheduler_Store' ) || ! function_exists( 'as_get_datetime_object' ) ) { |
| 64 | 62 | return null; |
| 65 | 63 | } |
| 66 | 64 | |
| @@ -95,8 +93,9 @@ | ||
| 95 | 93 | ); |
| 96 | 94 | if ( ! $check ) { |
| 97 | 95 | return null; |
| 98 | 96 | } |
| 97 | + // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound | |
| 99 | 98 | |
| 100 | 99 | $url = add_query_arg( |
| 101 | 100 | array( |
| 102 | 101 | 'page' => 'action-scheduler', |
| @@ -126,14 +125,12 @@ | ||
| 126 | 125 | |
| 127 | 126 | /** |
| 128 | 127 | * Detaches the allowlisted plugin/library notices inside chromeless iframes so |
| 129 | 128 | * they don't repeat in every window — the shell surfaces each once (see |
| 130 | - * `desktop_mode_get_plugin_notices()`). | |
| 131 | - * | |
| 132 | - * @since 0.9.6 | |
| 129 | + * `openstation_get_plugin_notices()`). | |
| 133 | 130 | */ |
| 134 | -function desktop_mode_chromeless_suppress_plugin_notices() { | |
| 135 | - if ( ! desktop_mode_is_chromeless_request() ) { | |
| 131 | +function openstation_chromeless_suppress_plugin_notices() { | |
| 132 | + if ( ! openstation_is_chromeless_request() ) { | |
| 136 | 133 | return; |
| 137 | 134 | } |
| 138 | 135 | |
| 139 | 136 | // Action Scheduler registers the notice as an instance method on its |
| @@ -146,5 +143,5 @@ | ||
| 146 | 143 | remove_action( 'admin_notices', $callback, $priority ); |
| 147 | 144 | } |
| 148 | 145 | } |
| 149 | 146 | } |
| 150 | -add_action( 'admin_init', 'desktop_mode_chromeless_suppress_plugin_notices' ); | |
| 147 | +add_action( 'admin_init', 'openstation_chromeless_suppress_plugin_notices' ); | |