1 | <?php |
||
29 | class SettingsService { |
||
30 | |||
31 | private $userId; |
||
32 | private $config; |
||
33 | private $appName; |
||
34 | public $settings; |
||
35 | |||
36 | private $numeric_settings = array( |
||
37 | 'link_sharing_enabled', |
||
38 | |||
39 | ); |
||
40 | |||
41 | public function __construct($UserId, IConfig $config, $AppName) { |
||
51 | |||
52 | /** |
||
53 | * Get all app settings |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | public function getAppSettings() { |
||
60 | |||
61 | /** |
||
62 | * Get a app setting |
||
63 | * |
||
64 | * @param $key string |
||
65 | * @param null $default_value The default value if key does not exist |
||
66 | * @return mixed |
||
67 | */ |
||
68 | public function getAppSetting($key, $default_value = null) { |
||
76 | |||
77 | /** |
||
78 | * Set a app setting |
||
79 | * |
||
80 | * @param $key string Setting name |
||
81 | * @param $value mixed Value of the setting |
||
82 | */ |
||
83 | public function setAppSetting($key, $value) { |
||
87 | |||
88 | /** |
||
89 | * Set a user setting |
||
90 | * |
||
91 | * @param $key string Setting name |
||
92 | * @param $value mixed Value of the setting |
||
93 | */ |
||
94 | |||
95 | public function setUserSetting($key, $value) { |
||
98 | |||
99 | /** |
||
100 | * Check if an setting is enabled (value of 1) |
||
101 | * |
||
102 | * @param $setting |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function isEnabled($setting) { |
||
109 | } |