Refactor search string escaping to a helper function

[MAILPOET-3077]
This commit is contained in:
Rostislav Wolny
2020-09-24 15:14:28 +02:00
committed by Veljko V
parent cd5079efda
commit d026517ed9
5 changed files with 21 additions and 8 deletions

View File

@@ -98,4 +98,8 @@ class Helpers {
return trim($value);
return $value;
}
public static function escapeSearch(string $search): string {
return str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], trim($search)); // escape for 'LIKE'
}
}