aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins/config/core/Setting/SettingNumericopt.php
blob: 117e3920a8a80715de2e7759039dc94d753e8924 (plain) (blame)
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
26
27
<?php

namespace dokuwiki\plugin\config\core\Setting;

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

    /**
     * @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);
    }
}