PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.8
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.8
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 0.8.6 All 33 releases
desktop-mode / includes / framework / app / standalone / class-settings.php

class-settings.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.8, at includes/framework/app/standalone/class-settings.php

53 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OpenStation App Framework — standalone Settings adapter.
4 *
5 * Two plain arrays. The host seeds them; apps read them.
6 *
7 * @package OpenStation
8 */
9
10 namespace OpenStation\App\Standalone;
11
12 use OpenStation\App\Contracts\Settings as SettingsContract;
13
14 // Direct access, unless a standalone host is booting on bare PHP.
15 if ( ! defined( 'ABSPATH' ) ) {
16 defined( 'OPENSTATION_STANDALONE' ) || exit;
17 }
18
19 /**
20 * Array-backed settings.
21 */
22 final class Settings implements SettingsContract {
23
24 /**
25 * @var array<string,mixed>
26 */
27 private $preferences;
28
29 /**
30 * @var array<string,mixed>
31 */
32 private $options;
33
34 /**
35 * @param array<string,mixed> $preferences Per-user preferences.
36 * @param array<string,mixed> $options Site options.
37 */
38 public function __construct( array $preferences = array(), array $options = array() ) {
39 $this->preferences = $preferences;
40 $this->options = $options;
41 }
42
43 /** {@inheritDoc} */
44 public function user_preference( $key, $fallback = null ) {
45 return array_key_exists( $key, $this->preferences ) ? $this->preferences[ $key ] : $fallback;
46 }
47
48 /** {@inheritDoc} */
49 public function site_option( $key, $fallback = null ) {
50 return array_key_exists( $key, $this->options ) ? $this->options[ $key ] : $fallback;
51 }
52 }
53