SettingString.php 976 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace dokuwiki\plugin\config\core\Setting;
  3. /**
  4. * Class setting_string
  5. */
  6. class SettingString extends Setting {
  7. /** @inheritdoc */
  8. public function html(\admin_plugin_config $plugin, $echo = false) {
  9. $disable = '';
  10. if($this->isProtected()) {
  11. $value = $this->protected;
  12. $disable = 'disabled="disabled"';
  13. } else {
  14. if($echo && $this->error) {
  15. $value = $this->input;
  16. } else {
  17. $value = is_null($this->local) ? $this->default : $this->local;
  18. }
  19. }
  20. $key = htmlspecialchars($this->key);
  21. $value = htmlspecialchars($value);
  22. $label = '<label for="config___' . $key . '">' . $this->prompt($plugin) . '</label>';
  23. $input = '<input id="config___' . $key . '" name="config[' . $key .
  24. ']" type="text" class="edit" value="' . $value . '" ' . $disable . '/>';
  25. return array($label, $input);
  26. }
  27. }