From 37fedc656fbdeb36b098375201042eed4c7e7229 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 23 Mar 2015 21:34:49 +0100 Subject: [ticket/11768] Updated the text_formatter.s9e.utils service Made it use s9e\TextFormatter\Utils. Refactored some tests to make them more readable. PHPBB3-11768 --- phpBB/phpbb/textformatter/s9e/utils.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'phpBB/phpbb/textformatter') diff --git a/phpBB/phpbb/textformatter/s9e/utils.php b/phpBB/phpbb/textformatter/s9e/utils.php index df4ae4b9ec..29dcfcdf58 100644 --- a/phpBB/phpbb/textformatter/s9e/utils.php +++ b/phpBB/phpbb/textformatter/s9e/utils.php @@ -26,7 +26,7 @@ class utils implements \phpbb\textformatter\utils_interface // Insert a space before and then remove formatting $text = preg_replace('#<[es]>#', ' $0', $text); - return \s9e\TextFormatter\Unparser::removeFormatting($text); + return \s9e\TextFormatter\Utils::removeFormatting($text); } /** @@ -34,18 +34,7 @@ class utils implements \phpbb\textformatter\utils_interface */ public function remove_bbcode($text, $bbcode_name, $depth = 0) { - $dom = new \DOMDocument; - $dom->loadXML($text); - - $xpath = new \DOMXPath($dom); - $nodes = $xpath->query(str_repeat('//' . strtoupper($bbcode_name), 1 + $depth)); - - foreach ($nodes as $node) - { - $node->parentNode->removeChild($node); - } - - return $dom->saveXML($dom->documentElement); + return \s9e\TextFormatter\Utils::removeTag($text, strtoupper($bbcode_name), $depth); } /** @@ -53,7 +42,7 @@ class utils implements \phpbb\textformatter\utils_interface */ public function remove_formatting($text) { - return \s9e\TextFormatter\Unparser::removeFormatting($text); + return \s9e\TextFormatter\Utils::removeFormatting($text); } /** -- cgit v1.2.1