fixed special chars in notifications

This commit is contained in:
denisdulici 2020-02-27 09:56:08 +03:00
parent b65a6c6dd6
commit 3f3478b90d

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);
}
} }