[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/plugins/config/core/Setting/ -> SettingString.php (source)

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