1 | <?php |
||
8 | class SettingOnoff extends SettingNumeric { |
||
9 | |||
10 | /** |
||
11 | * We treat the strings 'false' and 'off' as false |
||
12 | * @inheritdoc |
||
13 | */ |
||
14 | protected function cleanValue($value) { |
||
15 | if($value === null) return null; |
||
16 | |||
17 | if(is_string($value)) { |
||
18 | if(strtolower($value) === 'false') return 0; |
||
19 | if(strtolower($value) === 'off') return 0; |
||
20 | if(trim($value) === '') return 0; |
||
21 | } |
||
22 | |||
23 | return (int) (bool) $value; |
||
24 | } |
||
25 | |||
26 | /** @inheritdoc */ |
||
27 | public function html(\admin_plugin_config $plugin, $echo = false) { |
||
45 | |||
46 | /** @inheritdoc */ |
||
47 | public function update($input) { |
||
57 | } |
||
58 |