From 54fe5e102e0c497fdbd16127a14a36fdf7697a59 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 8 Jun 2016 16:26:58 +0900 Subject: [PATCH] Allow id attributes starting with 'user_content_' --- common/framework/filters/htmlfilter.php | 3 ++- tests/unit/framework/filters/HTMLFilterTest.php | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/common/framework/filters/htmlfilter.php b/common/framework/filters/htmlfilter.php index dc6e6a7b6..0aa0f3dcf 100644 --- a/common/framework/filters/htmlfilter.php +++ b/common/framework/filters/htmlfilter.php @@ -106,7 +106,8 @@ class HTMLFilter // Customize the default configuration. $config->set('Attr.AllowedFrameTargets', array('_blank')); $config->set('Attr.DefaultImageAlt', ''); - $config->set('Attr.EnableID', false); + $config->set('Attr.EnableID', true); + $config->set('Attr.IDPrefix', 'user_content_'); $config->set('AutoFormat.AutoParagraph', false); $config->set('AutoFormat.DisplayLinkURI', false); $config->set('AutoFormat.Linkify', false); diff --git a/tests/unit/framework/filters/HTMLFilterTest.php b/tests/unit/framework/filters/HTMLFilterTest.php index f388118db..1e609cdce 100644 --- a/tests/unit/framework/filters/HTMLFilterTest.php +++ b/tests/unit/framework/filters/HTMLFilterTest.php @@ -105,7 +105,7 @@ class HTMLFilterTest extends \Codeception\TestCase\Test $target = ''; $this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source)); - $source = '' . + $source = '' . '' . '' . '' . @@ -153,11 +153,22 @@ class HTMLFilterTest extends \Codeception\TestCase\Test $this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source)); $source = '
'; - $target = '
'; + $target = '
'; $this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source)); $source = '
'; $target = '
'; $this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source)); } + + public function testHTMLFilterUserContentID() + { + $source = '

Hello World!

'; + $target = '

Hello World!

'; + $this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source)); + + $source = '

Hello World!

'; + $target = '

Hello World!

'; + $this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source)); + } }