static function textarea($name, $rows, $cols, $attrs = null, $content = null)
 {
     $name = htmlspecialchars($name, ENT_QUOTES, 'utf-8');
     $rows = intval($rows);
     $cols = intval($cols);
     $return = '<div id="dokuwiki_toolbar">' . dokuwiki_TextFormatter::getDokuWikiToolbar($attrs['id']) . '</div>';
     $return .= "<textarea name=\"{$name}\" cols=\"{$cols}\" rows=\"{$rows}\" ";
     if (is_array($attrs)) {
         $return .= join_attrs($attrs);
     }
     $return .= '>';
     if (!is_null($content)) {
         $return .= htmlspecialchars($content, ENT_QUOTES, 'utf-8');
     }
     $return .= '</textarea>';
     return $return;
 }
Exemple #2
0
 public static function textarea($name, $rows, $cols, $attrs = null, $content = null)
 {
     global $conf;
     if (@in_array('textarea', get_class_methods($conf['general']['syntax_plugin'] . '_TextFormatter'))) {
         return call_user_func(array($conf['general']['syntax_plugin'] . '_TextFormatter', 'textarea'), $name, $rows, $cols, $attrs, $content);
     }
     $name = htmlspecialchars($name, ENT_QUOTES, 'utf-8');
     $return = sprintf('<textarea name="%s" cols="%d" rows="%d"', $name, $cols, $rows);
     if (is_array($attrs) && count($attrs)) {
         $return .= join_attrs($attrs);
     }
     $return .= '>';
     if (is_string($content) && strlen($content)) {
         $return .= htmlspecialchars($content, ENT_QUOTES, 'utf-8');
     }
     $return .= '</textarea>';
     //Activate CkEditor on TextAreas.
     $return .= "<script>\n                        CKEDITOR.replace( '" . $name . "', { entities: true, entities_latin: false, entities_processNumerical: false } );\n                    </script>";
     return $return;
 }
 public static function textarea($name, $rows, $cols, $attrs = null, $content = null)
 {
     global $conf;
     if (@in_array('textarea', get_class_methods($conf['general']['syntax_plugin'] . '_TextFormatter'))) {
         return call_user_func(array($conf['general']['syntax_plugin'] . '_TextFormatter', 'textarea'), $name, $rows, $cols, $attrs, $content);
     }
     $name = htmlspecialchars($name, ENT_QUOTES, 'utf-8');
     $return = sprintf('<textarea name="%s" cols="%d" rows="%d"', $name, $cols, $rows);
     if (is_array($attrs) && count($attrs)) {
         $return .= join_attrs($attrs);
     }
     $return .= '>';
     if (is_string($content) && strlen($content)) {
         $return .= htmlspecialchars($content, ENT_QUOTES, 'utf-8');
     }
     $return .= '</textarea>';
     return $return;
 }
Exemple #4
0
 /**
  * Returns (safe) HTML which displays a field to edit a value
  * @access public
  * @param bool $use_default use default field value or not
  * @param bool $lock lock the field depending on the users perms ornot
  * @param array $task task data
  * @param array $add_options add options to the select?
  * @param array $attrs add attributes to the select
  * @return string
  */
 function edit($use_default = true, $lock = false, $task = array(), $add_options = array(), $attrs = array(), $prefix = '')
 {
     global $user, $proj;
     if ($use_default) {
         $task['field' . $this->id] = $this->prefs['default_value'];
     } else {
         if (!isset($task['field' . $this->id])) {
             $task['field' . $this->id] = '';
         }
     }
     // determine whether or not to lock inputs
     $lock = $lock && $this->prefs['force_default'] && (count($task) > 3 && !$user->can_edit_task($task) || !$user->perms('modify_all_tasks'));
     $html = '';
     switch ($this->prefs['field_type']) {
         case FIELD_LIST:
             if (!$this->prefs['list_id']) {
                 return '';
             }
             $html .= sprintf('<select id="%sfield%d" name="%sfield%d%s" %s ', $prefix, $this->id, $prefix, $this->id, isset($attrs['multiple']) ? '[]' : '', join_attrs($attrs));
             $html .= tpl_disableif($lock) . '>';
             $html .= tpl_options(array_merge($add_options, $proj->get_list($this->prefs, $task['field' . $this->id])), Req::val('field' . $this->id, $task['field' . $this->id]));
             $html .= '</select>';
             break;
         case FIELD_DATE:
             $attrs = array();
             if ($lock) {
                 $attrs = array('readonly' => 'readonly');
             }
             $html .= tpl_datepicker($prefix . 'field' . $this->id, '', Req::val('field' . $this->id, $task['field' . $this->id]), $attrs);
             break;
         case FIELD_TEXT:
             $html .= sprintf('<input type="text" class="text" id="%sfield%d" name="%sfield%d" value="%s"/>', $prefix, $this->id, $prefix, $this->id, Filters::noXSS(Req::val('field' . $this->id, $task['field' . $this->id])));
             break;
         case FIELD_USER:
             $html .= tpl_userselect($prefix . 'field' . $this->id, Req::val('field' . $this->id, $task['field' . $this->id]));
             break;
     }
     return $html;
 }
 function textarea($name, $rows, $cols, $attrs = null, $content = null, $plugins = array())
 {
     global $page, $proj, $user;
     $name = Filters::noXSS($name);
     $return = sprintf('<textarea name="%s" id="%s" cols="%s" rows="%s" ', $name, $name, intval($cols), intval($rows));
     if (is_array($attrs) && count($attrs)) {
         $return .= join_attrs($attrs);
     }
     $return .= '>';
     if (is_string($content) && strlen($content)) {
         $return .= Filters::noXSS($content);
     }
     $return .= '</textarea>';
     // does the user have any personal preference?
     if (!count($plugins) && !$user->isAnon()) {
         $plugins = explode(' ', $user->infos['syntax_plugins']);
     }
     // [BC] if no plugins are set, we assume a project's default plugins
     if (!count($plugins)) {
         $plugins = explode(' ', $proj->prefs['syntax_plugins']);
     }
     return str_replace('%id', $name, $this->htmlbefore . $page->fetch('pluginoptions.tpl', 'plugins', $plugins)) . $return . str_replace('%id', $name, $this->htmlafter);
 }
Exemple #6
0
function tpl_checkbox($name, $checked = false, $id = null, $value = 1, $attr = null, $type = 'checkbox')
{
    $name = Filters::noXSS($name);
    $value = Filters::noXSS($value);
    $html = '<input type="' . $type . '" name="' . $name . '" value="' . $value . '" ';
    if (is_string($id)) {
        $html .= 'id="' . Filters::noXSS($id) . '" ';
    }
    if ($checked == true) {
        $html .= 'checked="checked" ';
    }
    // do not call join_attrs if $attr is null or nothing..
    return ($attr ? $html . join_attrs($attr) : $html) . '/>';
}