mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge pull request #4619 from Nicofuma/ticket/14962
[ticket/14962] Introduces a new helper to check emptyness of bbcode texts
This commit is contained in:
@@ -136,4 +136,17 @@ class utils implements \phpbb\textformatter\utils_interface
|
||||
{
|
||||
return \s9e\TextFormatter\Unparser::unparse($xml);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function is_empty($text)
|
||||
{
|
||||
if ($text === null || $text === '')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return trim($this->unparse($text)) === '';
|
||||
}
|
||||
}
|
||||
|
@@ -62,10 +62,18 @@ interface utils_interface
|
||||
public function remove_bbcode($text, $bbcode_name, $depth = 0);
|
||||
|
||||
/**
|
||||
* Return a parsed text to its original form
|
||||
*
|
||||
* @param string $text Parsed text
|
||||
* @return string Original plain text
|
||||
*/
|
||||
* Return a parsed text to its original form
|
||||
*
|
||||
* @param string $text Parsed text
|
||||
* @return string Original plain text
|
||||
*/
|
||||
public function unparse($text);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public function is_empty($text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user