aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textformatter
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/textformatter')
-rw-r--r--phpBB/phpbb/textformatter/s9e/parser.php8
-rw-r--r--phpBB/phpbb/textformatter/s9e/renderer.php43
2 files changed, 7 insertions, 44 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php
index b7d0b2b90b..838c211e56 100644
--- a/phpBB/phpbb/textformatter/s9e/parser.php
+++ b/phpBB/phpbb/textformatter/s9e/parser.php
@@ -227,7 +227,13 @@ class parser implements \phpbb\textformatter\parser_interface
}
}
- return array_unique($errors);
+ // Deduplicate error messages. array_unique() only works on strings so we have to serialize
+ if (!empty($errors))
+ {
+ $errors = array_map('unserialize', array_unique(array_map('serialize', $errors)));
+ }
+
+ return $errors;
}
/**
diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php
index 8999f1d25f..51bc44f339 100644
--- a/phpBB/phpbb/textformatter/s9e/renderer.php
+++ b/phpBB/phpbb/textformatter/s9e/renderer.php
@@ -234,10 +234,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
}
$html = $this->renderer->render($xml);
- if (stripos($html, '<code') !== false)
- {
- $html = $this->replace_tabs_in_code($html);
- }
/**
* Modify a rendered text
@@ -254,45 +250,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
}
/**
- * Replace tabs in code elements
- *
- * @see bbcode::bbcode_second_pass_code()
- *
- * @param string $html Original HTML
- * @return string Modified HTML
- */
- protected function replace_tabs_in_code($html)
- {
- return preg_replace_callback(
- '((<code[^>]*>)(.*?)(</code>))is',
- function ($captures)
- {
- $code = $captures[2];
-
- $code = str_replace("\t", '&nbsp; &nbsp;', $code);
- $code = str_replace(' ', '&nbsp; ', $code);
- $code = str_replace(' ', ' &nbsp;', $code);
- $code = str_replace("\n ", "\n&nbsp;", $code);
-
- // keep space at the beginning
- if (!empty($code) && $code[0] == ' ')
- {
- $code = '&nbsp;' . substr($code, 1);
- }
-
- // remove newline at the beginning
- if (!empty($code) && $code[0] == "\n")
- {
- $code = substr($code, 1);
- }
-
- return $captures[1] . $code . $captures[3];
- },
- $html
- );
- }
-
- /**
* {@inheritdoc}
*/
public function set_smilies_path($path)