| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Desktop Mode — Note Pad widget PHP registration. | |
| 3 | + * OpenStation — Note Pad widget PHP registration. | |
| 4 | 4 | * |
| 5 | 5 | * The composer surface for pinned notes: a pad of pastel paper on the |
| 6 | 6 | * widget column. The user writes on the top sheet and drags it out of |
| 7 | 7 | * the pad onto the wallpaper, where it becomes a pinned `wpd_note` |
| @@ -11,10 +11,9 @@ | ||
| 11 | 11 | * `includes/widgets/widget-starter.php`): register the script + style |
| 12 | 12 | * handles at `init@5`, announce the widget at `init@6`, eagerly |
| 13 | 13 | * enqueue only the CSS on shell pages. |
| 14 | 14 | * |
| 15 | - * @package WPDesktopMode | |
| 16 | - * @since 0.9.6 | |
| 15 | + * @package OpenStation | |
| 17 | 16 | */ |
| 18 | 17 | |
| 19 | 18 | defined( 'ABSPATH' ) || exit; |
| 20 | 19 | |
| @@ -19,71 +18,69 @@ | ||
| 19 | 18 | defined( 'ABSPATH' ) || exit; |
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * Register the JS bundle and CSS stylesheet handles. |
| 23 | - * | |
| 24 | - * @since 0.9.6 | |
| 25 | 22 | */ |
| 26 | -function desktop_mode_register_notes_widget_assets() { | |
| 27 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | |
| 28 | - $version = defined( 'DESKTOP_MODE_VERSION' ) ? DESKTOP_MODE_VERSION : '0'; | |
| 23 | +function openstation_register_notes_widget_assets() { | |
| 24 | + $suffix = openstation_asset_suffix(); | |
| 25 | + $version = defined( 'OPENSTATION_VERSION' ) ? OPENSTATION_VERSION : '0'; | |
| 29 | 26 | |
| 30 | - $js_path = DESKTOP_MODE_DIR . 'assets/js/widget-notes' . $suffix . '.js'; | |
| 31 | - $css_path = DESKTOP_MODE_DIR . 'assets/js/widget-notes' . $suffix . '.css'; | |
| 27 | + $js_path = OPENSTATION_DIR . 'assets/js/widget-notes' . $suffix . '.js'; | |
| 28 | + $css_path = OPENSTATION_DIR . 'assets/js/widget-notes' . $suffix . '.css'; | |
| 32 | 29 | |
| 30 | + // Depends on `os-files` because the pad's sheets wear the | |
| 31 | + // canonical `.os-file-tile` chrome while being dragged — anything | |
| 32 | + // that restyles a tile has to print after the file that declares | |
| 33 | + // one, whatever order the two handles were enqueued in. | |
| 33 | 34 | wp_register_style( |
| 34 | - 'desktop-mode-notes-widget', | |
| 35 | - DESKTOP_MODE_URL . 'assets/js/widget-notes' . $suffix . '.css', | |
| 36 | - array(), | |
| 35 | + 'os-notes-widget', | |
| 36 | + OPENSTATION_URL . 'assets/js/widget-notes' . $suffix . '.css', | |
| 37 | + array( 'os-files' ), | |
| 37 | 38 | file_exists( $css_path ) ? (string) filemtime( $css_path ) : $version |
| 38 | 39 | ); |
| 39 | 40 | |
| 40 | 41 | wp_register_script( |
| 41 | - 'desktop-mode-notes-widget', | |
| 42 | - DESKTOP_MODE_URL . 'assets/js/widget-notes' . $suffix . '.js', | |
| 42 | + 'os-notes-widget', | |
| 43 | + OPENSTATION_URL . 'assets/js/widget-notes' . $suffix . '.js', | |
| 43 | 44 | array(), |
| 44 | 45 | file_exists( $js_path ) ? (string) filemtime( $js_path ) : $version, |
| 45 | 46 | true |
| 46 | 47 | ); |
| 47 | 48 | } |
| 48 | -add_action( 'init', 'desktop_mode_register_notes_widget_assets', 5 ); | |
| 49 | +add_action( 'init', 'openstation_register_notes_widget_assets', 5 ); | |
| 49 | 50 | |
| 50 | 51 | /** |
| 51 | - * Eagerly enqueue the CSS on Desktop Mode shell pages. | |
| 52 | + * Eagerly enqueue the CSS on OpenStation shell pages. | |
| 52 | 53 | * |
| 53 | 54 | * The JS loads lazily (widget server-sync); the CSS must be present |
| 54 | 55 | * before first mount to avoid a flash of unstyled pad. |
| 55 | - * | |
| 56 | - * @since 0.9.6 | |
| 57 | 56 | */ |
| 58 | -function desktop_mode_enqueue_notes_widget_styles() { | |
| 59 | - if ( function_exists( 'desktop_mode_is_enabled' ) && ! desktop_mode_is_enabled() ) { | |
| 57 | +function openstation_enqueue_notes_widget_styles() { | |
| 58 | + if ( function_exists( 'openstation_is_enabled' ) && ! openstation_is_enabled() ) { | |
| 60 | 59 | return; |
| 61 | 60 | } |
| 62 | - if ( function_exists( 'desktop_mode_is_chromeless_request' ) && desktop_mode_is_chromeless_request() ) { | |
| 61 | + if ( function_exists( 'openstation_is_chromeless_request' ) && openstation_is_chromeless_request() ) { | |
| 63 | 62 | return; |
| 64 | 63 | } |
| 65 | - wp_enqueue_style( 'desktop-mode-notes-widget' ); | |
| 64 | + wp_enqueue_style( 'os-notes-widget' ); | |
| 66 | 65 | } |
| 67 | -add_action( 'admin_enqueue_scripts', 'desktop_mode_enqueue_notes_widget_styles', 20 ); | |
| 66 | +add_action( 'admin_enqueue_scripts', 'openstation_enqueue_notes_widget_styles', 20 ); | |
| 68 | 67 | |
| 69 | 68 | /** |
| 70 | - * Announce the widget to Desktop Mode. | |
| 71 | - * | |
| 72 | - * @since 0.9.6 | |
| 69 | + * Announce the widget to OpenStation. | |
| 73 | 70 | */ |
| 74 | -function desktop_mode_register_notes_widget() { | |
| 75 | - if ( ! function_exists( 'desktop_mode_register_widget' ) ) { | |
| 71 | +function openstation_register_notes_widget() { | |
| 72 | + if ( ! function_exists( 'openstation_register_widget' ) ) { | |
| 76 | 73 | return; |
| 77 | 74 | } |
| 78 | 75 | |
| 79 | - desktop_mode_register_widget( | |
| 76 | + openstation_register_widget( | |
| 80 | 77 | 'desktop-mode/notes', |
| 81 | 78 | array( |
| 82 | 79 | 'label' => __( 'Note Pad', 'desktop-mode' ), |
| 83 | 80 | 'description' => __( 'Write a note and drag it onto the desktop to pin it.', 'desktop-mode' ), |
| 84 | 81 | 'icon' => 'dashicons-sticky', |
| 85 | - 'script' => 'desktop-mode-notes-widget', | |
| 82 | + 'script' => 'os-notes-widget', | |
| 86 | 83 | 'movable' => true, |
| 87 | 84 | 'resizable' => true, |
| 88 | 85 | 'min_width' => 240, |
| 89 | 86 | 'min_height' => 300, |
| @@ -91,5 +88,5 @@ | ||
| 91 | 88 | 'default_height' => 360, |
| 92 | 89 | ) |
| 93 | 90 | ); |
| 94 | 91 | } |
| 95 | -add_action( 'init', 'desktop_mode_register_notes_widget', 6 ); | |
| 92 | +add_action( 'init', 'openstation_register_notes_widget', 6 ); | |