mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Improved line-breaks handling and added test.
This commit is contained in:
@@ -2463,6 +2463,7 @@ class e_parse extends e_parser
|
|||||||
if($this->isHtml($text) === true) // strip any html.
|
if($this->isHtml($text) === true) // strip any html.
|
||||||
{
|
{
|
||||||
$text = $this->toHTML($text,true);
|
$text = $this->toHTML($text,true);
|
||||||
|
$text = str_replace("\n","",$text); // clean-out line-breaks.
|
||||||
$text = str_ireplace( array("<br>","<br />","<br/>"), "\n", $text);
|
$text = str_ireplace( array("<br>","<br />","<br/>"), "\n", $text);
|
||||||
$text = strip_tags($text);
|
$text = strip_tags($text);
|
||||||
}
|
}
|
||||||
|
@@ -498,6 +498,7 @@ TMP;
|
|||||||
0 => array('html'=>"<h1><a href='#'>My Caption</a></h1>", 'expected' => 'My Caption'),
|
0 => array('html'=>"<h1><a href='#'>My Caption</a></h1>", 'expected' => 'My Caption'),
|
||||||
1 => array('html'=>"<div><h1><a href='#'>My Caption</a></h1></div>", 'expected' => 'My Caption'),
|
1 => array('html'=>"<div><h1><a href='#'>My Caption</a></h1></div>", 'expected' => 'My Caption'),
|
||||||
2 => array('html'=>'Line 1<br />Line 2<br />Line 3<br />', 'expected'=> "Line 1\nLine 2\nLine 3\n"),
|
2 => array('html'=>'Line 1<br />Line 2<br />Line 3<br />', 'expected'=> "Line 1\nLine 2\nLine 3\n"),
|
||||||
|
3 => array('html'=>"Line 1<br />\nLine 2<br />\nLine 3<br />", 'expected'=> "Line 1\nLine 2\nLine 3\n"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user