PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 0.9.3
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v0.9.3
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
desktop-mode / includes / wallpapers.php

wallpapers.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 0.9.3, at includes/wallpapers.php

83 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Desktop Mode — Built-in wallpaper presets.
4 *
5 * The built-in wallpapers that ship with the plugin — five gradient /
6 * solid CSS presets plus the Animated WordPress Logo canvas wallpaper —
7 * each registered through the same public API third-party plugins use
8 * (`desktop_mode_register_wallpaper()`). Dogfooding the registration
9 * surface for the built-ins is how we discover whether the API is
10 * expressive enough for plugin authors — if we couldn't describe our
11 * own presets through it, the API is broken.
12 *
13 * Hooked on `init` priority 5 so the presets land in the registry
14 * before the shell config is built (shell render runs on
15 * `admin_enqueue_scripts`, which fires after `init`), and before any
16 * late third-party plugin that wants to react via the
17 * `desktop_mode_wallpaper_registered` action.
18 *
19 * @package WPDesktopMode
20 * @since 0.5.0
21 */
22
23 defined( 'ABSPATH' ) || exit;
24
25 /**
26 * Registers the built-in wallpapers: five gradient / solid CSS presets
27 * plus the Animated WordPress Logo canvas wallpaper.
28 *
29 * @since 0.5.0
30 */
31 function desktop_mode_register_builtin_wallpapers() {
32 $presets = array(
33 array(
34 'id' => 'dark',
35 'label' => __( 'Graphite', 'desktop-mode' ),
36 'value' => 'linear-gradient(135deg, #1d2327 0%, #2c3338 50%, #1d2327 100%)',
37 ),
38 array(
39 'id' => 'aurora',
40 'label' => __( 'Aurora', 'desktop-mode' ),
41 'value' => 'linear-gradient(135deg, #1a2980 0%, #26d0ce 100%)',
42 ),
43 array(
44 'id' => 'sunset',
45 'label' => __( 'Sunset', 'desktop-mode' ),
46 'value' => 'linear-gradient(135deg, #ff512f 0%, #dd2476 100%)',
47 ),
48 array(
49 'id' => 'forest',
50 'label' => __( 'Forest', 'desktop-mode' ),
51 'value' => 'linear-gradient(135deg, #134e5e 0%, #71b280 100%)',
52 ),
53 array(
54 'id' => 'mono',
55 'label' => __( 'Mono', 'desktop-mode' ),
56 'value' => '#1d2327',
57 ),
58 );
59
60 foreach ( $presets as $preset ) {
61 desktop_mode_register_wallpaper( $preset['id'], array(
62 'label' => $preset['label'],
63 'preview' => $preset['value'],
64 'value' => $preset['value'],
65 'type' => 'css',
66 ) );
67 }
68
69 // Animated WordPress Logo — built-in PixiJS canvas wallpaper.
70 // Moved out of `desktop.min.js` in 0.8.4. Same registration
71 // surface third-party canvas wallpapers use: `script` is an
72 // enqueued handle (registered in `includes/assets.php`); the
73 // shell's wallpaper sync injects its URL when the wallpaper
74 // def is needed (selected, or shown in the OS Settings picker).
75 desktop_mode_register_wallpaper( 'wp-animated-logo', array(
76 'label' => __( 'Animated WordPress Logo', 'desktop-mode' ),
77 'preview' => 'radial-gradient(circle at 50% 50%, #1e3a8a 0%, #0b0f25 100%)',
78 'type' => 'canvas',
79 'script' => 'desktop-mode-animated-logo-wallpaper',
80 ) );
81 }
82 add_action( 'init', 'desktop_mode_register_builtin_wallpapers', 5 );
83