public function get() { $breaker = null; if ($this->use_editor) { $text = PHPWS_Text::decodeText($this->value); return javascript('ckeditor', array('ID' => $this->id, 'NAME' => $this->name, 'VALUE' => $text)); } $value = preg_replace('/<br\\s?\\/?>(\\r\\n)?/', "\n", $this->value); if (ord(substr($value, 0, 1)) == 13) { $value = "\n" . $value; } if (isset($this->width)) { $style[] = 'width : ' . $this->width; } else { $dimensions[] = $this->getCols(true); } if (isset($this->height)) { $style[] = 'height : ' . $this->height; } else { $dimensions[] = $this->getRows(true); } if (isset($style)) { $dimensions[] = 'style="' . implode('; ', $style) . '"'; } if (!USE_BREAKER && !empty($this->_form->use_breaker)) { $check_name = sprintf('%s_breaker', $this->name); $checkbox = new Form_Checkbox($check_name); $checkbox->_form = $this->_form; $checkbox->setLabel(_('Break newlines')); $checkbox->setId($check_name); $breaker = sprintf('<div class="textarea-breaker">%s %s</div>', $checkbox->get(), $checkbox->getLabel(true, true)); } return $breaker . '<textarea ' . $this->getName(true) . $this->getTitle(true) . $this->getPlaceholder() . $this->getDisabled() . $this->getReadOnly() . implode(' ', $dimensions) . ' ' . $this->getData() . sprintf('>%s</textarea>', $value); }