summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/config/core/Setting/SettingNumericopt.php
blob: a486e187fc6ef86d18042b355f6b90e52964e318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace dokuwiki\plugin\config\core\Setting;

/**
 * Class setting_numericopt
 */
class SettingNumericopt extends SettingNumeric {
    // just allow an empty config
    protected $pattern = '/^(|[-]?[0-9]+(?:[-+*][0-9]+)*)$/';

    /**
     * @inheritdoc
     * Empty string is valid for numericopt
     */
    public function update($input) {
        if($input === '') {
            if($input == $this->local) return false;
            $this->local = $input;
            return true;
        }

        return parent::update($input);
    }
}