From 663530fb34201b22c3f226fdfab26280173945db Mon Sep 17 00:00:00 2001 From: Vasily Naumkin Date: Thu, 21 Mar 2019 16:50:51 +0700 Subject: [PATCH] Fixed cfgSetAutoPregReplace I don't know why the order of parsing was changed, but now it is correct --- src/Jevix.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Jevix.php b/src/Jevix.php index a75ec22..1005ac1 100644 --- a/src/Jevix.php +++ b/src/Jevix.php @@ -764,14 +764,6 @@ public function parse($text, &$errors) } } - if (!empty($this->autoReplace)) { - $this->text = str_ireplace($this->autoReplace['from'], $this->autoReplace['to'], $this->text); - } - - if (!empty($replacements)) { - $this->text = str_replace(array_keys($replacements), $replacements, $this->text); - } - // Авто растановка BR? if ($this->isAutoBrMode) { $this->text = preg_replace('/(\r\n|\n\r|\n)?/ui', $this->nl, $this->text); @@ -789,6 +781,14 @@ public function parse($text, &$errors) $this->skipSpaces(); $this->anyThing($content); $errors = $this->errors; + + if (!empty($this->autoReplace)){ + $content = str_ireplace($this->autoReplace['from'], $this->autoReplace['to'], $content); + } + + if (!empty($replacements)) { + $content = str_replace(array_keys($replacements), $replacements, $content); + } return $content; }