xref: /dokuwiki/lib/plugins/config/core/Setting/SettingNumericopt.php (revision 177d6836e2f75d0e404be9c566e61725852a1e07)
10a5b05ebSAndreas Gohr<?php
20a5b05ebSAndreas Gohr
30a5b05ebSAndreas Gohrnamespace dokuwiki\plugin\config\core\Setting;
40a5b05ebSAndreas Gohr
50a5b05ebSAndreas Gohr/**
60a5b05ebSAndreas Gohr * Class setting_numericopt
70a5b05ebSAndreas Gohr */
88c7c53b0SAndreas Gohrclass SettingNumericopt extends SettingNumeric
98c7c53b0SAndreas Gohr{
100a5b05ebSAndreas Gohr    // just allow an empty config
11467c1427SAndreas Gohr    protected $pattern = '/^(|[-]?\d+(?:[-+*]\d+)*)$/';
120a5b05ebSAndreas Gohr
130a5b05ebSAndreas Gohr    /**
140a5b05ebSAndreas Gohr     * @inheritdoc
150a5b05ebSAndreas Gohr     * Empty string is valid for numericopt
160a5b05ebSAndreas Gohr     */
17*d868eb89SAndreas Gohr    public function update($input)
18*d868eb89SAndreas Gohr    {
190a5b05ebSAndreas Gohr        if ($input === '') {
20f37fd93eSAndreas Gohr            if ($input == $this->local) return false;
21f37fd93eSAndreas Gohr            $this->local = $input;
220a5b05ebSAndreas Gohr            return true;
230a5b05ebSAndreas Gohr        }
240a5b05ebSAndreas Gohr
250a5b05ebSAndreas Gohr        return parent::update($input);
260a5b05ebSAndreas Gohr    }
270a5b05ebSAndreas Gohr}
28