xref: /dokuwiki/lib/plugins/config/core/Setting/SettingImConvert.php (revision d4f83172d9533c4d84f450fe22ef630816b21d75)
10a5b05ebSAndreas Gohr<?php
20a5b05ebSAndreas Gohr
30a5b05ebSAndreas Gohrnamespace dokuwiki\plugin\config\core\Setting;
40a5b05ebSAndreas Gohr
50a5b05ebSAndreas Gohr/**
60a5b05ebSAndreas Gohr * Class setting_im_convert
70a5b05ebSAndreas Gohr */
88c7c53b0SAndreas Gohrclass SettingImConvert extends SettingString
98c7c53b0SAndreas Gohr{
100a5b05ebSAndreas Gohr    /** @inheritdoc */
11*d868eb89SAndreas Gohr    public function update($input)
12*d868eb89SAndreas Gohr    {
130a5b05ebSAndreas Gohr        if ($this->isProtected()) return false;
140a5b05ebSAndreas Gohr
150a5b05ebSAndreas Gohr        $input = trim($input);
160a5b05ebSAndreas Gohr
170a5b05ebSAndreas Gohr        $value = is_null($this->local) ? $this->default : $this->local;
180a5b05ebSAndreas Gohr        if ($value == $input) return false;
190a5b05ebSAndreas Gohr
200a5b05ebSAndreas Gohr        if ($input && !file_exists($input)) {
210a5b05ebSAndreas Gohr            $this->error = true;
220a5b05ebSAndreas Gohr            $this->input = $input;
230a5b05ebSAndreas Gohr            return false;
240a5b05ebSAndreas Gohr        }
250a5b05ebSAndreas Gohr
260a5b05ebSAndreas Gohr        $this->local = $input;
270a5b05ebSAndreas Gohr        return true;
280a5b05ebSAndreas Gohr    }
290a5b05ebSAndreas Gohr}
30