|
|
|
@ -31,7 +31,7 @@ class HtmlEditor extends HTML_QuickForm_textarea |
|
|
|
$config = [] |
|
|
|
$config = [] |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (empty($name)) { |
|
|
|
if (empty($name)) { |
|
|
|
return false; |
|
|
|
throw new \Exception('Name is required'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
parent::__construct($name, $elementLabel, $attributes); |
|
|
|
parent::__construct($name, $elementLabel, $attributes); |
|
|
|
@ -54,9 +54,9 @@ class HtmlEditor extends HTML_QuickForm_textarea |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function toHtml() |
|
|
|
public function toHtml() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$value = Security::remove_XSS($this->getValue()); |
|
|
|
|
|
|
|
if ($this->editor) { |
|
|
|
if ($this->editor) { |
|
|
|
if ($this->editor->getConfigAttribute('fullPage')) { |
|
|
|
if ($this->editor->getConfigAttribute('fullPage')) { |
|
|
|
|
|
|
|
$value = $this->getValue(); |
|
|
|
if (strlen(trim($value)) == 0) { |
|
|
|
if (strlen(trim($value)) == 0) { |
|
|
|
// TODO: To be considered whether here to add |
|
|
|
// TODO: To be considered whether here to add |
|
|
|
// language and character set declarations. |
|
|
|
// language and character set declarations. |
|
|
|
@ -70,10 +70,9 @@ class HtmlEditor extends HTML_QuickForm_textarea |
|
|
|
return $this->getFrozenHtml(); |
|
|
|
return $this->getFrozenHtml(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$styleCss = $this->editor->getConfigAttribute('style'); |
|
|
|
$styleCss = $this->editor->getConfigAttribute('style'); |
|
|
|
|
|
|
|
$style = false; |
|
|
|
if ($styleCss) { |
|
|
|
if ($styleCss) { |
|
|
|
$style = true; |
|
|
|
$style = true; |
|
|
|
} else { |
|
|
|
|
|
|
|
$style = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->buildEditor($style); |
|
|
|
return $this->buildEditor($style); |
|
|
|
@ -87,7 +86,7 @@ class HtmlEditor extends HTML_QuickForm_textarea |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getFrozenHtml() |
|
|
|
public function getFrozenHtml() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return $this->getValue(); |
|
|
|
return $this->getCleanValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -99,9 +98,9 @@ class HtmlEditor extends HTML_QuickForm_textarea |
|
|
|
{ |
|
|
|
{ |
|
|
|
$result = ''; |
|
|
|
$result = ''; |
|
|
|
if ($this->editor) { |
|
|
|
if ($this->editor) { |
|
|
|
$this->editor->value = Security::remove_XSS($this->getValue()); |
|
|
|
$this->editor->value = $this->getCleanValue(); |
|
|
|
$this->editor->setName($this->getName()); |
|
|
|
$this->editor->setName($this->getName()); |
|
|
|
if ($style == true) { |
|
|
|
if ($style === true) { |
|
|
|
$result = $this->editor->createHtmlStyle(); |
|
|
|
$result = $this->editor->createHtmlStyle(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$result = $this->editor->createHtml(); |
|
|
|
$result = $this->editor->createHtml(); |
|
|
|
|