PluginProbe
Extendify / 0.9.3
Extendify v0.9.3
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / app / Library / SiteSettings.php

SiteSettings.php in Extendify 0.9.3, at app/Library/SiteSettings.php

73 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Helper class for interacting with the user
4 */
5
6 namespace Extendify\Library;
7
8 /**
9 * Helper class for interacting with the user
10 */
11 class SiteSettings
12 {
13
14 /**
15 * SiteSettings option_name - For historical reasons do not change.
16 *
17 * @var string
18 */
19 protected $key = 'extendifysdk_sitesettings';
20
21 /**
22 * SiteSettings default value
23 *
24 * @var Json
25 */
26 protected $default = '{"state":{"enabled":true}}';
27
28 /**
29 * The class instance.
30 *
31 * @var $instance
32 */
33 protected static $instance = null;
34
35 /**
36 * Returns Setting
37 * Use it like Setting::data()
38 *
39 * @return mixed - Setting Data
40 */
41 private function dataHandler()
42 {
43 return \get_option($this->key, $this->default);
44 }
45
46 /**
47 * Returns Setting Key
48 * Use it like Setting::key()
49 *
50 * @return string - Setting key
51 */
52 private function keyHandler()
53 {
54 return $this->key;
55 }
56
57 /**
58 * Use it like Setting::method() e.g. Setting::data()
59 *
60 * @param string $name - The name of the method to call.
61 * @param array $arguments - The arguments to pass in.
62 *
63 * @return mixed
64 */
65 public static function __callStatic($name, array $arguments)
66 {
67 $name = "{$name}Handler";
68 self::$instance = new static();
69 $r = self::$instance;
70 return $r->$name(...$arguments);
71 }
72 }
73