| @@ -3,10 +3,9 @@ | ||
| 3 | 3 | * Reports a pending WordPress core update to the shell as the `coreUpdate` |
| 4 | 4 | * config value. The shell resolves the release art and renders the |
| 5 | 5 | * notification client-side (see `src/update-notice.ts`). |
| 6 | 6 | * |
| 7 | - * @since 0.9.4 | |
| 8 | - * @package DesktopMode | |
| 7 | + * @package OpenStation | |
| 9 | 8 | */ |
| 10 | 9 | |
| 11 | 10 | defined( 'ABSPATH' ) || exit; |
| 12 | 11 | |
| @@ -13,15 +12,13 @@ | ||
| 13 | 12 | /** |
| 14 | 13 | * Whether `$available` is a new major (X.Y branch) relative to `$installed` |
| 15 | 14 | * — `6.9.2 -> 7.0` is major, `7.0 -> 7.0.2` is not. |
| 16 | 15 | * |
| 17 | - * @since 0.9.4 | |
| 18 | - * | |
| 19 | 16 | * @param string $installed Installed version. |
| 20 | 17 | * @param string $available Available version. |
| 21 | 18 | * @return bool |
| 22 | 19 | */ |
| 23 | -function desktop_mode_is_major_update( $installed, $available ) { | |
| 20 | +function openstation_is_major_update( $installed, $available ) { | |
| 24 | 21 | $branch = static function ( $v ) { |
| 25 | 22 | $p = explode( '.', (string) $v ); |
| 26 | 23 | return ( isset( $p[0] ) ? $p[0] : '0' ) . '.' . ( isset( $p[1] ) ? $p[1] : '0' ); |
| 27 | 24 | }; |
| @@ -30,14 +27,12 @@ | ||
| 30 | 27 | |
| 31 | 28 | /** |
| 32 | 29 | * The X.Y branch for a version (`7.0.2` -> `7.0`). |
| 33 | 30 | * |
| 34 | - * @since 0.9.4 | |
| 35 | - * | |
| 36 | 31 | * @param string $version Version string. |
| 37 | 32 | * @return string |
| 38 | 33 | */ |
| 39 | -function desktop_mode_release_branch( $version ) { | |
| 34 | +function openstation_release_branch( $version ) { | |
| 40 | 35 | $p = explode( '.', (string) $version ); |
| 41 | 36 | return ( isset( $p[0] ) ? $p[0] : '0' ) . '.' . ( isset( $p[1] ) ? $p[1] : '0' ); |
| 42 | 37 | } |
| 43 | 38 | |
| @@ -48,13 +43,11 @@ | ||
| 48 | 43 | * `version` is the branch when crossing into a new major (the codename is |
| 49 | 44 | * added client-side), else the exact version; `available` is the exact |
| 50 | 45 | * version (the dismissal key); `crossing` flags a new major. |
| 51 | 46 | * |
| 52 | - * @since 0.9.4 | |
| 53 | - * | |
| 54 | 47 | * @return array{version:string,available:string,branch:string,url:string,crossing:bool}|null |
| 55 | 48 | */ |
| 56 | -function desktop_mode_get_core_update() { | |
| 49 | +function openstation_get_core_update() { | |
| 57 | 50 | if ( ! current_user_can( 'update_core' ) ) { |
| 58 | 51 | return null; |
| 59 | 52 | } |
| 60 | 53 | |
| @@ -78,18 +71,16 @@ | ||
| 78 | 71 | /** |
| 79 | 72 | * Whether to show the desktop core-update notification. Return false |
| 80 | 73 | * to hide it. |
| 81 | 74 | * |
| 82 | - * @since 0.9.4 | |
| 83 | - * | |
| 84 | 75 | * @param bool $show Default true. |
| 85 | 76 | */ |
| 86 | - if ( ! apply_filters( 'desktop_mode_show_core_update_notice', true ) ) { | |
| 77 | + if ( ! apply_filters( 'openstation_show_core_update_notice', true ) ) { | |
| 87 | 78 | return null; |
| 88 | 79 | } |
| 89 | 80 | |
| 90 | - $branch = desktop_mode_release_branch( $available ); | |
| 91 | - $crossing = desktop_mode_is_major_update( get_bloginfo( 'version' ), $available ); | |
| 81 | + $branch = openstation_release_branch( $available ); | |
| 82 | + $crossing = openstation_is_major_update( get_bloginfo( 'version' ), $available ); | |
| 92 | 83 | |
| 93 | 84 | return array( |
| 94 | 85 | 'version' => $crossing ? $branch : $available, |
| 95 | 86 | 'available' => $available, |