diff options
author | Thomas Lange <code@nerdmind.de> | 2018-09-09 23:48:02 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2018-09-09 23:48:02 +0200 |
commit | c830d9c54e829963105ad2118865f86da49f7979 (patch) | |
tree | 51b210a7cee5674607d56f55e76f64912d7326ec /core/functions.php | |
parent | 6083199afe1a8092db92f46cc8e1fd00187a527c (diff) | |
download | blog-c830d9c54e829963105ad2118865f86da49f7979.tar.gz blog-c830d9c54e829963105ad2118865f86da49f7979.tar.xz blog-c830d9c54e829963105ad2118865f86da49f7979.zip |
Correct regex replace strings
Diffstat (limited to 'core/functions.php')
-rw-r--r-- | core/functions.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/functions.php b/core/functions.php index 558acf2..1e786ed 100644 --- a/core/functions.php +++ b/core/functions.php @@ -184,7 +184,7 @@ function getEmoticons(): array { function parseEmoticons($string): string { foreach(getEmoticons() as $emoticon => $data) { $pattern = '#(^|\s)'.preg_quote($emoticon).'#'; - $replace = " <span title=\"{$data[1]}\">{$data[0]}</span>"; + $replace = "\\1<span title=\"{$data[1]}\">{$data[0]}</span>"; $string = preg_replace($pattern, $replace, $string); } @@ -222,7 +222,7 @@ function getUnicodeEmoticons(): array { function parseUnicodeEmoticons($string): string { foreach(getUnicodeEmoticons() as $emoticon => $explanation) { $pattern = '#(^|\s)'.preg_quote($emoticon).'#'; - $replace = " <span title=\"{$explanation}\">{$emoticon}</span>"; + $replace = "\\1<span title=\"{$explanation}\">{$emoticon}</span>"; $string = preg_replace($pattern, $replace, $string); } |