mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 22:26:31 +02:00
PSR-2 reformatting PHPDoc corrections
With minor corrections. Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk> Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
committed by
Edward Z. Yang
parent
19eee14899
commit
fac747bdbd
@@ -4,7 +4,8 @@ class HTMLPurifier_Strategy_MakeWellFormed_EndInsertInjector extends HTMLPurifie
|
||||
{
|
||||
public $name = 'EndInsertInjector';
|
||||
public $needed = array('span');
|
||||
public function handleEnd(&$token) {
|
||||
public function handleEnd(&$token)
|
||||
{
|
||||
if ($token->name == 'div') return;
|
||||
$token = array(
|
||||
new HTMLPurifier_Token_Start('b'),
|
||||
|
@@ -2,35 +2,44 @@
|
||||
|
||||
class HTMLPurifier_Strategy_MakeWellFormed_EndInsertInjectorTest extends HTMLPurifier_StrategyHarness
|
||||
{
|
||||
function setUp() {
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->obj = new HTMLPurifier_Strategy_MakeWellFormed();
|
||||
$this->config->set('AutoFormat.Custom', array(
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_EndInsertInjector()
|
||||
));
|
||||
}
|
||||
function testEmpty() {
|
||||
public function testEmpty()
|
||||
{
|
||||
$this->assertResult('');
|
||||
}
|
||||
function testNormal() {
|
||||
public function testNormal()
|
||||
{
|
||||
$this->assertResult('<i>Foo</i>', '<i>Foo<b>Comment</b></i>');
|
||||
}
|
||||
function testEndOfDocumentProcessing() {
|
||||
public function testEndOfDocumentProcessing()
|
||||
{
|
||||
$this->assertResult('<i>Foo', '<i>Foo<b>Comment</b></i>');
|
||||
}
|
||||
function testDoubleEndOfDocumentProcessing() {
|
||||
public function testDoubleEndOfDocumentProcessing()
|
||||
{
|
||||
$this->assertResult('<i><i>Foo', '<i><i>Foo<b>Comment</b></i><b>Comment</b></i>');
|
||||
}
|
||||
function testEndOfNodeProcessing() {
|
||||
public function testEndOfNodeProcessing()
|
||||
{
|
||||
$this->assertResult('<div><i>Foo</div>asdf', '<div><i>Foo<b>Comment</b></i></div><i>asdf<b>Comment</b></i>');
|
||||
}
|
||||
function testEmptyToStartEndProcessing() {
|
||||
public function testEmptyToStartEndProcessing()
|
||||
{
|
||||
$this->assertResult('<i />', '<i><b>Comment</b></i>');
|
||||
}
|
||||
function testSpuriousEndTag() {
|
||||
public function testSpuriousEndTag()
|
||||
{
|
||||
$this->assertResult('</i>', '');
|
||||
}
|
||||
function testLessButStillSpuriousEndTag() {
|
||||
public function testLessButStillSpuriousEndTag()
|
||||
{
|
||||
$this->assertResult('<div></i></div>', '<div></div>');
|
||||
}
|
||||
}
|
||||
|
@@ -4,15 +4,18 @@ class HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector extends HTMLPurifie
|
||||
{
|
||||
public $name = 'EndRewindInjector';
|
||||
public $needed = array('span');
|
||||
public function handleElement(&$token) {
|
||||
public function handleElement(&$token)
|
||||
{
|
||||
if (isset($token->_InjectorTest_EndRewindInjector_delete)) {
|
||||
$token = false;
|
||||
}
|
||||
}
|
||||
public function handleText(&$token) {
|
||||
public function handleText(&$token)
|
||||
{
|
||||
$token = false;
|
||||
}
|
||||
public function handleEnd(&$token) {
|
||||
public function handleEnd(&$token)
|
||||
{
|
||||
$i = null;
|
||||
if (
|
||||
$this->backward($i, $prev) &&
|
||||
|
@@ -2,26 +2,32 @@
|
||||
|
||||
class HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjectorTest extends HTMLPurifier_StrategyHarness
|
||||
{
|
||||
function setUp() {
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->obj = new HTMLPurifier_Strategy_MakeWellFormed();
|
||||
$this->config->set('AutoFormat.Custom', array(
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector()
|
||||
));
|
||||
}
|
||||
function testBasic() {
|
||||
public function testBasic()
|
||||
{
|
||||
$this->assertResult('');
|
||||
}
|
||||
function testFunction() {
|
||||
public function testFunction()
|
||||
{
|
||||
$this->assertResult('<span>asdf</span>','');
|
||||
}
|
||||
function testFailedFunction() {
|
||||
public function testFailedFunction()
|
||||
{
|
||||
$this->assertResult('<span>asd<b>asdf</b>asdf</span>','<span><b></b></span>');
|
||||
}
|
||||
function testPadded() {
|
||||
public function testPadded()
|
||||
{
|
||||
$this->assertResult('<b></b><span>asdf</span><b></b>','<b></b><b></b>');
|
||||
}
|
||||
function testDoubled() {
|
||||
public function testDoubled()
|
||||
{
|
||||
$this->config->set('AutoFormat.Custom', array(
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector(),
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector(),
|
||||
|
@@ -4,7 +4,8 @@ class HTMLPurifier_Strategy_MakeWellFormed_SkipInjector extends HTMLPurifier_Inj
|
||||
{
|
||||
public $name = 'EndRewindInjector';
|
||||
public $needed = array('span');
|
||||
public function handleElement(&$token) {
|
||||
public function handleElement(&$token)
|
||||
{
|
||||
$token = array(clone $token, clone $token);
|
||||
}
|
||||
}
|
||||
|
@@ -2,20 +2,24 @@
|
||||
|
||||
class HTMLPurifier_Strategy_MakeWellFormed_SkipInjectorTest extends HTMLPurifier_StrategyHarness
|
||||
{
|
||||
function setUp() {
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->obj = new HTMLPurifier_Strategy_MakeWellFormed();
|
||||
$this->config->set('AutoFormat.Custom', array(
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_SkipInjector()
|
||||
));
|
||||
}
|
||||
function testEmpty() {
|
||||
public function testEmpty()
|
||||
{
|
||||
$this->assertResult('');
|
||||
}
|
||||
function testMultiply() {
|
||||
public function testMultiply()
|
||||
{
|
||||
$this->assertResult('<br />', '<br /><br />');
|
||||
}
|
||||
function testMultiplyMultiply() {
|
||||
public function testMultiplyMultiply()
|
||||
{
|
||||
$this->config->set('AutoFormat.Custom', array(
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_SkipInjector(),
|
||||
new HTMLPurifier_Strategy_MakeWellFormed_SkipInjector()
|
||||
|
Reference in New Issue
Block a user