| @@ -4,10 +4,9 @@ | ||
| 4 | 4 | * otherwise repeat in every desktop window — into shell descriptors, so the |
| 5 | 5 | * shell can surface each once. The update nag is handled separately (see |
| 6 | 6 | * update-notice.php); this covers the rest. |
| 7 | 7 | * |
| 8 | - * @since 0.9.6 | |
| 9 | - * @package DesktopMode | |
| 8 | + * @package OpenStation | |
| 10 | 9 | */ |
| 11 | 10 | |
| 12 | 11 | defined( 'ABSPATH' ) || exit; |
| 13 | 12 | |
| @@ -17,20 +16,18 @@ | ||
| 17 | 16 | * actionUrl? }`, re-derived from authoritative state (never scraped) and |
| 18 | 17 | * capability-gated exactly as Core gates the underlying notice. The shell |
| 19 | 18 | * renders each as a persistent, dismissible toast. |
| 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_core_notices() { | |
| 22 | +function openstation_get_core_notices() { | |
| 26 | 23 | $builders = array( |
| 27 | - 'desktop_mode_core_notice_maintenance', | |
| 28 | - 'desktop_mode_core_notice_recovery_mode', | |
| 29 | - 'desktop_mode_core_notice_default_password', | |
| 30 | - 'desktop_mode_core_notice_deactivated_plugins', | |
| 31 | - 'desktop_mode_core_notice_paused_plugins', | |
| 32 | - 'desktop_mode_core_notice_paused_themes', | |
| 24 | + 'openstation_core_notice_maintenance', | |
| 25 | + 'openstation_core_notice_recovery_mode', | |
| 26 | + 'openstation_core_notice_default_password', | |
| 27 | + 'openstation_core_notice_deactivated_plugins', | |
| 28 | + 'openstation_core_notice_paused_plugins', | |
| 29 | + 'openstation_core_notice_paused_themes', | |
| 33 | 30 | ); |
| 34 | 31 | |
| 35 | 32 | $notices = array(); |
| 36 | 33 | foreach ( $builders as $builder ) { |
| @@ -43,24 +40,20 @@ | ||
| 43 | 40 | /** |
| 44 | 41 | * Filters the core notices surfaced once in the desktop shell. Return an |
| 45 | 42 | * empty array to suppress them all, or unset individual entries by `id`. |
| 46 | 43 | * |
| 47 | - * @since 0.9.6 | |
| 48 | - * | |
| 49 | 44 | * @param array $notices List of notice descriptors. |
| 50 | 45 | */ |
| 51 | - return apply_filters( 'desktop_mode_core_notices', $notices ); | |
| 46 | + return apply_filters( 'openstation_core_notices', $notices ); | |
| 52 | 47 | } |
| 53 | 48 | |
| 54 | 49 | /** |
| 55 | 50 | * Normalizes a notice descriptor, filling optional fields. |
| 56 | 51 | * |
| 57 | - * @since 0.9.6 | |
| 58 | - * | |
| 59 | 52 | * @param array $notice Partial descriptor with at least `id` + `message`. |
| 60 | 53 | * @return array{id:string,title:string,message:string,actionLabel:string,actionUrl:string} |
| 61 | 54 | */ |
| 62 | -function desktop_mode_core_notice( array $notice ) { | |
| 55 | +function openstation_core_notice( array $notice ) { | |
| 63 | 56 | return array( |
| 64 | 57 | 'id' => (string) $notice['id'], |
| 65 | 58 | 'title' => isset( $notice['title'] ) ? (string) $notice['title'] : '', |
| 66 | 59 | 'message' => (string) $notice['message'], |
| @@ -71,13 +64,11 @@ | ||
| 71 | 64 | |
| 72 | 65 | /** |
| 73 | 66 | * Interrupted / failed automated core update — mirrors `maintenance_nag()`. |
| 74 | 67 | * |
| 75 | - * @since 0.9.6 | |
| 76 | - * | |
| 77 | 68 | * @return array|null |
| 78 | 69 | */ |
| 79 | -function desktop_mode_core_notice_maintenance() { | |
| 70 | +function openstation_core_notice_maintenance() { | |
| 80 | 71 | $nag = isset( $GLOBALS['upgrading'] ); |
| 81 | 72 | |
| 82 | 73 | if ( ! $nag ) { |
| 83 | 74 | $failed = get_site_option( 'auto_core_update_failed' ); |
| @@ -93,9 +84,9 @@ | ||
| 93 | 84 | return null; |
| 94 | 85 | } |
| 95 | 86 | |
| 96 | 87 | $can = current_user_can( 'update_core' ); |
| 97 | - return desktop_mode_core_notice( | |
| 88 | + return openstation_core_notice( | |
| 98 | 89 | array( |
| 99 | 90 | 'id' => 'maintenance', |
| 100 | 91 | 'title' => __( 'WordPress Updates', 'desktop-mode' ), |
| 101 | 92 | 'message' => $can |
| @@ -109,13 +100,11 @@ | ||
| 109 | 100 | |
| 110 | 101 | /** |
| 111 | 102 | * Site is in recovery mode — mirrors `wp_recovery_mode_nag()`. |
| 112 | 103 | * |
| 113 | - * @since 0.9.6 | |
| 114 | - * | |
| 115 | 104 | * @return array|null |
| 116 | 105 | */ |
| 117 | -function desktop_mode_core_notice_recovery_mode() { | |
| 106 | +function openstation_core_notice_recovery_mode() { | |
| 118 | 107 | if ( ! function_exists( 'wp_is_recovery_mode' ) || ! wp_is_recovery_mode() ) { |
| 119 | 108 | return null; |
| 120 | 109 | } |
| 121 | 110 | |
| @@ -122,9 +111,9 @@ | ||
| 122 | 111 | $url = wp_login_url(); |
| 123 | 112 | $url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url ); |
| 124 | 113 | $url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION ); |
| 125 | 114 | |
| 126 | - return desktop_mode_core_notice( | |
| 115 | + return openstation_core_notice( | |
| 127 | 116 | array( |
| 128 | 117 | 'id' => 'recovery-mode', |
| 129 | 118 | 'title' => __( 'Recovery Mode', 'desktop-mode' ), |
| 130 | 119 | 'message' => __( 'You are in recovery mode. There may be an error with a theme or plugin.', 'desktop-mode' ), |
| @@ -137,18 +126,16 @@ | ||
| 137 | 126 | /** |
| 138 | 127 | * User is still on their auto-generated password — mirrors |
| 139 | 128 | * `default_password_nag()`. |
| 140 | 129 | * |
| 141 | - * @since 0.9.6 | |
| 142 | - * | |
| 143 | 130 | * @return array|null |
| 144 | 131 | */ |
| 145 | -function desktop_mode_core_notice_default_password() { | |
| 132 | +function openstation_core_notice_default_password() { | |
| 146 | 133 | if ( ! get_user_option( 'default_password_nag' ) ) { |
| 147 | 134 | return null; |
| 148 | 135 | } |
| 149 | 136 | |
| 150 | - return desktop_mode_core_notice( | |
| 137 | + return openstation_core_notice( | |
| 151 | 138 | array( |
| 152 | 139 | 'id' => 'default-password', |
| 153 | 140 | 'title' => __( 'Profile', 'desktop-mode' ), |
| 154 | 141 | 'message' => __( 'You are using an auto-generated password. Would you like to change it?', 'desktop-mode' ), |
| @@ -161,13 +148,11 @@ | ||
| 161 | 148 | /** |
| 162 | 149 | * Plugins force-deactivated on a WordPress upgrade — mirrors |
| 163 | 150 | * `deactivated_plugins_notice()`. |
| 164 | 151 | * |
| 165 | - * @since 0.9.6 | |
| 166 | - * | |
| 167 | 152 | * @return array|null |
| 168 | 153 | */ |
| 169 | -function desktop_mode_core_notice_deactivated_plugins() { | |
| 154 | +function openstation_core_notice_deactivated_plugins() { | |
| 170 | 155 | if ( ! current_user_can( 'activate_plugins' ) ) { |
| 171 | 156 | return null; |
| 172 | 157 | } |
| 173 | 158 | |
| @@ -185,9 +170,9 @@ | ||
| 185 | 170 | if ( ! $names ) { |
| 186 | 171 | return null; |
| 187 | 172 | } |
| 188 | 173 | |
| 189 | - return desktop_mode_core_notice( | |
| 174 | + return openstation_core_notice( | |
| 190 | 175 | array( |
| 191 | 176 | 'id' => 'deactivated-plugins', |
| 192 | 177 | 'title' => __( 'Plugins', 'desktop-mode' ), |
| 193 | 178 | 'message' => sprintf( |
| @@ -203,13 +188,11 @@ | ||
| 203 | 188 | |
| 204 | 189 | /** |
| 205 | 190 | * Plugins paused by recovery mode — mirrors `paused_plugins_notice()`. |
| 206 | 191 | * |
| 207 | - * @since 0.9.6 | |
| 208 | - * | |
| 209 | 192 | * @return array|null |
| 210 | 193 | */ |
| 211 | -function desktop_mode_core_notice_paused_plugins() { | |
| 194 | +function openstation_core_notice_paused_plugins() { | |
| 212 | 195 | if ( ! current_user_can( 'resume_plugins' ) || ! function_exists( 'wp_paused_plugins' ) ) { |
| 213 | 196 | return null; |
| 214 | 197 | } |
| 215 | 198 | |
| @@ -216,9 +199,9 @@ | ||
| 216 | 199 | if ( empty( wp_paused_plugins()->get_all() ) ) { |
| 217 | 200 | return null; |
| 218 | 201 | } |
| 219 | 202 | |
| 220 | - return desktop_mode_core_notice( | |
| 203 | + return openstation_core_notice( | |
| 221 | 204 | array( |
| 222 | 205 | 'id' => 'paused-plugins', |
| 223 | 206 | 'title' => __( 'Plugins', 'desktop-mode' ), |
| 224 | 207 | 'message' => __( 'One or more plugins failed to load properly.', 'desktop-mode' ), |
| @@ -230,13 +213,11 @@ | ||
| 230 | 213 | |
| 231 | 214 | /** |
| 232 | 215 | * Themes paused by recovery mode — mirrors `paused_themes_notice()`. |
| 233 | 216 | * |
| 234 | - * @since 0.9.6 | |
| 235 | - * | |
| 236 | 217 | * @return array|null |
| 237 | 218 | */ |
| 238 | -function desktop_mode_core_notice_paused_themes() { | |
| 219 | +function openstation_core_notice_paused_themes() { | |
| 239 | 220 | if ( ! current_user_can( 'resume_themes' ) || ! function_exists( 'wp_paused_themes' ) ) { |
| 240 | 221 | return null; |
| 241 | 222 | } |
| 242 | 223 | |
| @@ -243,9 +224,9 @@ | ||
| 243 | 224 | if ( empty( wp_paused_themes()->get_all() ) ) { |
| 244 | 225 | return null; |
| 245 | 226 | } |
| 246 | 227 | |
| 247 | - return desktop_mode_core_notice( | |
| 228 | + return openstation_core_notice( | |
| 248 | 229 | array( |
| 249 | 230 | 'id' => 'paused-themes', |
| 250 | 231 | 'title' => __( 'Themes', 'desktop-mode' ), |
| 251 | 232 | 'message' => __( 'One or more themes failed to load properly.', 'desktop-mode' ), |