lqVxSqV mqVxSqV=#qV 8ŤqV`0hV^!|p dns_get_mxq@k~V ;xPk~V1V0qVqVk~V ;x mqV@֏qVlqVxSqV 0fVxgetmxrr!k~Vl~Vk~V9V0qVqVk~V ;x mqV@֏qVlqVxSqV`@ؚVo‚|net_get_interfaces{m~V ;xk~VAV؆qVqV0(V0gVY|ftok`k~V ;xk~VIV؅qVqVpؘV$qV@lqV@0bVShrtime`k~V ;x k~VQV܆qVqVPVlqV 8ŤqV0k~V@k~Vk~VYV@qVqVppxbV@KwqV@NRqV 8ŤqV0k~V ;xk~VaVqVqVph`VD$qV@NRqV 8ŤqV0cV ygetmyuid`k~V ;x0k~ViV`qVqV0heV0nVxgetmygid`k~V ;x k~VqVqVqV0oV0oVygetmypid`k~V ;xk~VyV qVqV0HoV0lV:QNp getmyinode`k~V ;xk~VVpqVqV0XlV0mV=Np getlastmod`k~V ;xk~VVqVqV0hmV@k~Vk~Vk~VVڅqVqVPphaV@KwqV@NRqV 8ŤqV`k~V ;xk~VV݅qVqVp8kVD$qV@NRqV 8ŤqV0jV9popenlog `k~V ;xk~VVHqVqVk~V ;x@qV@ */ public function getPrettyKey($url = true) { $out = str_replace(Configuration::KEYMARKER, "»", $this->key); if ($url && !strstr($out, '»')) {//provide no urls for plugins, etc. if ($out == 'start') { // exception, because this config name is clashing with our actual start page return '' . $out . ''; } else { return '' . $out . ''; } } return $out; } /** * Returns setting key as an array key separator * * This is used to create form output * * @return string key */ public function getArrayKey() { return str_replace(Configuration::KEYMARKER, "']['", $this->key); } /** * What type of configuration is this * * Returns one of * * 'plugin' for plugin configuration * 'template' for template configuration * 'dokuwiki' for core configuration * * @return string */ public function getType() { if (str_starts_with($this->getKey(), 'plugin' . Configuration::KEYMARKER)) { return 'plugin'; } elseif (str_starts_with($this->getKey(), 'tpl' . Configuration::KEYMARKER)) { return 'template'; } else { return 'dokuwiki'; } } /** * Build html for label and input of setting * * @param \admin_plugin_config $plugin object of config plugin * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ public function html(\admin_plugin_config $plugin, $echo = false) { $disable = ''; if ($this->isProtected()) { $value = $this->protected; $disable = 'disabled="disabled"'; } elseif ($echo && $this->error) { $value = $this->input; } else { $value = is_null($this->local) ? $this->default : $this->local; } $key = htmlspecialchars($this->key); $value = formText($value); $label = ''; $input = ''; return [$label, $input]; } /** * Should the current local value be saved? * * @see out() to run when this returns true * @return bool */ public function shouldBeSaved() { if ($this->isProtected()) return false; if ($this->local === null) return false; if ($this->default == $this->local) return false; return true; } /** * Escaping * * @param string $string * @return string */ protected function escape($string) { $tr = ["\\" => '\\\\', "'" => '\\\'']; return "'" . strtr(cleanText($string), $tr) . "'"; } /** * Generate string to save local setting value to file according to $fmt * * @see shouldBeSaved() to check if this should be called * @param string $var name of variable * @param string $fmt save format * @return string */ public function out($var, $fmt = 'php') { if ($fmt != 'php') return ''; if (is_array($this->local)) { $value = 'array(' . implode(', ', array_map([$this, 'escape'], $this->local)) . ')'; } else { $value = $this->escape($this->local); } $out = '$' . $var . "['" . $this->getArrayKey() . "'] = $value;\n"; return $out; } /** * Returns the localized prompt * * @param \admin_plugin_config $plugin object of config plugin * @return string text */ public function prompt(\admin_plugin_config $plugin) { $prompt = $plugin->getLang($this->key); if (!$prompt) $prompt = htmlspecialchars(str_replace(['____', '_'], ' ', $this->key)); return $prompt; } /** * Is setting protected * * @return bool */ public function isProtected() { return !is_null($this->protected); } /** * Is setting the default? * * @return bool */ public function isDefault() { return !$this->isProtected() && is_null($this->local); } /** * Has an error? * * @return bool */ public function hasError() { return $this->error; } /** * Returns caution * * @return false|string caution string, otherwise false for invalid caution */ public function caution() { if (empty($this->caution)) return false; if (!in_array($this->caution, Setting::$validCautions)) { throw new \RuntimeException( 'Invalid caution string (' . $this->caution . ') in metadata for setting "' . $this->key . '"' ); } return $this->caution; } }