Remove WP\Functions::__ and other translate functions

Under the new sniffer rules, those functions produce errors and, when those methods
are used, the sniffer can not properly be applied.

[MAILPOET-4524]
This commit is contained in:
David Remer
2022-08-04 12:54:09 +03:00
committed by Veljko V
parent 0b2b211b08
commit b05e6d414c
156 changed files with 645 additions and 719 deletions

View File

@ -119,7 +119,7 @@ class Settings extends APIEndpoint {
return $this->badRequest(
[
APIError::BAD_REQUEST =>
WPFunctions::get()->__('You have not specified any settings to be saved.', 'mailpoet'),
__('You have not specified any settings to be saved.', 'mailpoet'),
]);
} else {
$oldSettings = $this->settings->getAll();
@ -178,7 +178,7 @@ class Settings extends APIEndpoint {
$address = $data['address'] ?? null;
if (!$address) {
return $this->badRequest([
APIError::BAD_REQUEST => WPFunctions::get()->__('No email address specified.', 'mailpoet'),
APIError::BAD_REQUEST => __('No email address specified.', 'mailpoet'),
]);
}
$address = trim($address);
@ -187,7 +187,7 @@ class Settings extends APIEndpoint {
$this->authorizedEmailsController->setFromEmailAddress($address);
} catch (\InvalidArgumentException $e) {
return $this->badRequest([
APIError::UNAUTHORIZED => WPFunctions::get()->__('Cant use this email yet! Please authorize it first.', 'mailpoet'),
APIError::UNAUTHORIZED => __('Cant use this email yet! Please authorize it first.', 'mailpoet'),
]);
}
@ -205,7 +205,7 @@ class Settings extends APIEndpoint {
if (!$emailAddress) {
return $this->badRequest([
APIError::BAD_REQUEST => WPFunctions::get()->__('No email address specified.', 'mailpoet'),
APIError::BAD_REQUEST => __('No email address specified.', 'mailpoet'),
]);
}
@ -222,7 +222,7 @@ class Settings extends APIEndpoint {
$response = ['status' => true];
} else {
return $this->badRequest([
APIError::BAD_REQUEST => WPFunctions::get()->__($e->getMessage(), 'mailpoet'),
APIError::BAD_REQUEST => __($e->getMessage(), 'mailpoet'),
]);
}
}
@ -235,7 +235,7 @@ class Settings extends APIEndpoint {
if (!$emailAddress) {
return $this->badRequest([
APIError::BAD_REQUEST => WPFunctions::get()->__('No email address specified.', 'mailpoet'),
APIError::BAD_REQUEST => __('No email address specified.', 'mailpoet'),
]);
}