| 1 |
<?php |
| 2 |
/** |
| 3 |
* OpenStation App Framework — Settings contract. |
| 4 |
* |
| 5 |
* Per-user preferences and site-wide options, read-only from an |
| 6 |
* app's point of view. Writes stay with the host: a window that |
| 7 |
* needs to persist something registers its own storage. |
| 8 |
* |
| 9 |
* @package OpenStation |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace OpenStation\App\Contracts; |
| 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 |
interface Settings { |
| 20 |
|
| 21 |
/** |
| 22 |
* A preference of the acting user — on WordPress, one key of the |
| 23 |
* OpenStation Preferences blob (`developerModeEnabled`, …). |
| 24 |
* |
| 25 |
* @param string $key Preference key. |
| 26 |
* @param mixed $fallback Returned when the key is unset. |
| 27 |
* @return mixed |
| 28 |
*/ |
| 29 |
public function user_preference( $key, $fallback = null ); |
| 30 |
|
| 31 |
/** |
| 32 |
* A site-wide option. |
| 33 |
* |
| 34 |
* @param string $key Option name. |
| 35 |
* @param mixed $fallback Returned when the option is unset. |
| 36 |
* @return mixed |
| 37 |
*/ |
| 38 |
public function site_option( $key, $fallback = null ); |
| 39 |
} |
| 40 |
|