Add escaping for known shortcodes when rendered in form textarea's value

[MAILPOET-5243]
This commit is contained in:
Rostislav Wolny
2023-04-19 15:14:07 +02:00
committed by Aschepikov
parent fb2c839fad
commit e62a3ee5b5
5 changed files with 31 additions and 1 deletions

View File

@@ -258,6 +258,15 @@ class BlockRendererHelper {
return join(' ', $modifiers);
}
public function escapeShortCodes(?string $value): ?string {
if ($value === null) {
return null;
}
return preg_replace_callback('/' . $this->wp->getShortcodeRegex() . '/s', function ($matches) {
return str_replace(['[', ']'], ['[', ']'], $matches[0]);
}, $value);
}
private function translateValidationErrorMessage(string $validate): string {
switch ($validate) {
case 'email':