Merge pull request #1305 from denisdulici/master

Fixed special chars in notifications
This commit is contained in:
Denis Duliçi 2020-02-27 09:57:04 +03:00 committed by GitHub
commit 6c748501e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View File

@ -57,7 +57,10 @@ abstract class Notification extends BaseNotification
public function replaceTags($content) public function replaceTags($content)
{ {
return preg_replace($this->getTagsPattern(), $this->getTagsReplacement(), $content); $pattern = $this->getTagsPattern();
$replacement = $this->applyQuote($this->getTagsReplacement());
return $this->revertQuote(preg_replace($pattern, $replacement, $content));
} }
public function getTagsPattern() public function getTagsPattern()
@ -70,4 +73,30 @@ abstract class Notification extends BaseNotification
return $pattern; return $pattern;
} }
public function getTags()
{
return [];
}
public function getTagsReplacement()
{
return [];
}
public function applyQuote($vars)
{
$new_vars = [];
foreach ($vars as $var) {
$new_vars[] = preg_quote($var);
}
return $new_vars;
}
public function revertQuote($content)
{
return str_replace('\\', '', $content);
}
} }

View File

@ -81,7 +81,7 @@ return [
| |
*/ */
'override' => [ 'override' => [
], ],
/* /*