mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-23 09:07:43 +02:00
[ticket/16630] Restore clean_formatting()'s behaviour
PHPBB3-16630
This commit is contained in:
parent
39c3a6c3e5
commit
8a8893fbd3
phpBB
tests/text_formatter/s9e
@ -532,7 +532,7 @@ function strip_bbcode(&$text, $uid = '')
|
||||
|
||||
if (preg_match('#^<[rt][ >]#', $text))
|
||||
{
|
||||
$text = $phpbb_container->get('text_formatter.utils')->clean_formatting($text);
|
||||
$text = utf8_htmlspecialchars($phpbb_container->get('text_formatter.utils')->clean_formatting($text));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -15,6 +15,9 @@ namespace phpbb\textformatter\s9e;
|
||||
|
||||
/**
|
||||
* Text manipulation utilities
|
||||
*
|
||||
* In this implementation, "plain text" refers to regular text as it would be inputted by a user.
|
||||
* "Parsed text" is XML suitable to be reinserted into the database.
|
||||
*/
|
||||
class utils implements \phpbb\textformatter\utils_interface
|
||||
{
|
||||
@ -31,7 +34,7 @@ class utils implements \phpbb\textformatter\utils_interface
|
||||
// Insert a space before <s> and <e> then remove formatting
|
||||
$xml = preg_replace('#<[es]>#', ' $0', $xml);
|
||||
|
||||
return utf8_htmlspecialchars(\s9e\TextFormatter\Utils::removeFormatting($xml));
|
||||
return \s9e\TextFormatter\Utils::removeFormatting($xml);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,10 @@ namespace phpbb\textformatter;
|
||||
|
||||
/**
|
||||
* Used to manipulate a parsed text
|
||||
*
|
||||
* In this interface, "plain text" refers to regular text as it would be inputted by a user.
|
||||
* "Parsed text" refers to whichever form is returned by the implementation after parsing, which
|
||||
* should be suitable to be reinserted into the database.
|
||||
*/
|
||||
interface utils_interface
|
||||
{
|
||||
@ -73,7 +77,7 @@ interface utils_interface
|
||||
* Return whether or not a parsed text represent an empty text.
|
||||
*
|
||||
* @param string $text Parsed text
|
||||
* @return bool Tue if the original text is empty
|
||||
* @return bool True if the original text is empty
|
||||
*/
|
||||
public function is_empty($text);
|
||||
}
|
||||
|
@ -60,13 +60,17 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case
|
||||
'<t>Plain text</t>',
|
||||
'Plain text'
|
||||
),
|
||||
array(
|
||||
'<t>Plain & boring</t>',
|
||||
'Plain & boring'
|
||||
),
|
||||
array(
|
||||
"<t>Multi<br/>\nline</t>",
|
||||
"Multi\nline"
|
||||
),
|
||||
array(
|
||||
'<r><B><s>[b]</s>bold<e>[/b]</e></B></r>',
|
||||
' bold '
|
||||
'<r><B><s>[b]</s>bold<e>[/b]</e></B> & <I><s>[i]</s>italic<e>[/i]</e></I></r>',
|
||||
' bold & italic '
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user