public function testListCombinedWithText() { $text = <<<TESTLIST * foo * bar baz TESTLIST; $this->assertEquals('<p><ul><li>foo</li><li>bar</li></ul>baz</p>', $this->_markup->render($text)); }
/** * Set the renderer's encoding * * @param string $encoding * * @return void */ public static function setEncoding($encoding) { self::$_encoding = $encoding; }
/** * Execute a single replace token * * @param Zend_Markup_Token $token * @param array $markup * @return string */ protected function _executeSingleReplace(Zend_Markup_Token $token, $markup) { if (isset($markup['tag'])) { if (!isset($markup['attributes'])) { $markup['attributes'] = array(); } $attrs = self::renderAttributes($token, $markup['attributes']); return "<{$markup['tag']}{$attrs} />"; } return parent::_executeSingleReplace($token, $markup); }
public function testXssInImgAndUrl() { $this->assertEquals('<a href="http://google.com/"<script>alert(1)</script>">...</a>', $this->_markup->render('[url=\'http://google.com/"<script>alert(1)</script>\']...[/url]')); $this->assertEquals('<img src="http://google.com/&quot;&lt;script&gt;alert(1)&lt;/script&gt;" alt="/script&gt;" />', $this->_markup->render('[img]http://google.com/"<script>alert(1)</script>[/img]')); }
/** * Set the renderer's encoding * * @param string $encoding * * @return Zend_Markup_Renderer_RendererAbstract */ public static function setEncoding($encoding) { self::$_encoding = $encoding; return $this; }
/** * Execute a single replace token * * @param Zend_Markup_Token $token * @param array $tag * @return string */ protected function _executeSingleReplace(Zend_Markup_Token $token, $tag) { if (!isset($tag['replace'])) { $tag['replace'] = ''; } if (!isset($tag['start'])) { return $this->_render($token); } return parent::_executeReplace($token, $tag); }