Refactor search string escaping to a helper function
[MAILPOET-3077]
This commit is contained in:
committed by
Veljko V
parent
cd5079efda
commit
d026517ed9
@ -2,6 +2,7 @@
|
||||
|
||||
namespace MailPoet\Models;
|
||||
|
||||
use MailPoet\Util\Helpers;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
/**
|
||||
@ -88,7 +89,7 @@ class ScheduledTaskSubscriber extends Model {
|
||||
->select('subscribers.first_name', 'firstName');
|
||||
if (isset($data['search'])) {
|
||||
$search = trim($data['search']);
|
||||
$search = str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], $search); // escape for 'LIKE'
|
||||
$search = Helpers::escapeSearch($search);
|
||||
if (strlen($search) === 0) {
|
||||
return $query;
|
||||
}
|
||||
|
Reference in New Issue
Block a user