isProtected()) return false; $input = $this->fromString($input); $value = is_null($this->local) ? $this->default : $this->local; if($value == $input) return false; foreach($input as $item) { if($this->pattern && !preg_match($this->pattern, $item)) { $this->error = true; $this->input = $input; return false; } } $this->local = $input; return true; } /** * Escaping * * @param string $string * @return string */ protected function escape($string) { $tr = array("\\" => '\\\\', "'" => '\\\''); return "'" . strtr(cleanText($string), $tr) . "'"; } /** @inheritdoc */ public function out($var, $fmt = 'php') { if($fmt != 'php') return ''; $vals = array_map(array($this, 'escape'), $this->local); $out = '$' . $var . "['" . $this->getArrayKey() . "'] = array(" . join(', ', $vals) . ");\n"; return $out; } /** @inheritdoc */ public function html(\admin_plugin_config $plugin, $echo = false) { $disable = ''; if($this->isProtected()) { $value = $this->protected; $disable = 'disabled="disabled"'; } else { if($echo && $this->error) { $value = $this->input; } else { $value = is_null($this->local) ? $this->default : $this->local; } } $key = htmlspecialchars($this->key); $value = htmlspecialchars($this->fromArray($value)); $label = ''; $input = ''; return array($label, $input); } }