function testGetHTMLEscapesContent() { $field = new TextField('comment'); $content = '<strong>some markup in a text area</strong> & some more \'"'; $expected = '<strong>some markup in a text area</strong> & some more \'"'; $field->setValue($content); $html = $field->getHtml(); $this->assertContains($expected, $html); }
/** * Constructs a new TinyMCE field * @param string $name name of the field * @param mixed $defaultValue value for the initialization of the field * @param boolean $isDisabled flag to enable or disable the field * @return null */ public function __construct($name, $defaultValue = null, $isDisabled = false) { parent::__construct($name, $defaultValue, $isDisabled); $zibo = Zibo::getInstance(); $zibo->registerEventListener(Zibo::EVENT_PRE_RESPONSE, array($this, 'preResponse')); $this->tinymceParams = $zibo->getConfigValue(self::CONFIG_TINYMCE, array()); }
public function getHtml() { $html = parent::getHtml(); $id = $this->getId(); $ep = $this->getEmoticonParser(); if ($ep) { $emoticons = $ep->getEmoticons(); $toolbar = '<div id="' . $id . 'EmoticonToolbar" class="bbcodeToolbar">'; $images = array(); foreach ($emoticons as $emoticon => $image) { if (in_array($image, $images)) { continue; } $images[] = $image; $image = new Image($image); $image->setAttribute('alt', $emoticon); $image->setAttribute('title', $emoticon); $emoticon = addslashes($emoticon); $toolbar .= '<a href="#" onclick="return bbcodeAdd(\'' . $id . "', ' " . $emoticon . '\');">'; $toolbar .= $image->getHtml(); $toolbar .= '</a> '; } $toolbar .= '</div>'; $html = $toolbar . $html; } $toolbar = '<div id="' . $id . 'BBCodeToolbar" class="bbcodeToolbar">'; foreach ($this->bbcode as $code => $bbcode) { $open = $bbcode['open']; if (isset($bbcode['close'])) { $close = $bbcode['close']; } else { $close = false; } $image = new Image($bbcode['image']); $image->setAttribute('alt', $code); $image->setAttribute('title', $code); if (!$close) { $toolbar .= '<a href="#" onclick="return bbcodeAdd(\'' . $id . "', '" . $open . '\');">'; } else { $toolbar .= '<a href="#" onclick="return bbcodeAdd(\'' . $id . "', '" . $open . "', '" . $close . '\');">'; } $toolbar .= $image->getHtml(); $toolbar .= '</a> '; } $toolbar .= '</div>'; $html = $toolbar . $html; return $html; }