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:
@ -24,7 +24,6 @@ use MailPoet\Subscribers\SubscribersRepository;
|
||||
use MailPoet\Subscribers\SubscriberSubscribeController;
|
||||
use MailPoet\UnexpectedValueException;
|
||||
use MailPoet\Util\Helpers;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class Subscribers extends APIEndpoint {
|
||||
const SUBSCRIPTION_LIMIT_COOLDOWN = 60;
|
||||
@ -87,7 +86,7 @@ class Subscribers extends APIEndpoint {
|
||||
$subscriber = $this->getSubscriber($data);
|
||||
if (!$subscriber instanceof SubscriberEntity) {
|
||||
return $this->errorResponse([
|
||||
APIError::NOT_FOUND => WPFunctions::get()->__('This subscriber does not exist.', 'mailpoet'),
|
||||
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
$result = $this->subscribersResponseBuilder->build($subscriber);
|
||||
@ -181,7 +180,7 @@ class Subscribers extends APIEndpoint {
|
||||
);
|
||||
} else {
|
||||
return $this->errorResponse([
|
||||
APIError::NOT_FOUND => WPFunctions::get()->__('This subscriber does not exist.', 'mailpoet'),
|
||||
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -197,7 +196,7 @@ class Subscribers extends APIEndpoint {
|
||||
);
|
||||
} else {
|
||||
return $this->errorResponse([
|
||||
APIError::NOT_FOUND => WPFunctions::get()->__('This subscriber does not exist.', 'mailpoet'),
|
||||
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -209,7 +208,7 @@ class Subscribers extends APIEndpoint {
|
||||
return $this->successResponse(null, ['count' => $count]);
|
||||
} else {
|
||||
return $this->errorResponse([
|
||||
APIError::NOT_FOUND => WPFunctions::get()->__('This subscriber does not exist.', 'mailpoet'),
|
||||
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -239,7 +238,7 @@ class Subscribers extends APIEndpoint {
|
||||
}
|
||||
} else {
|
||||
return $this->errorResponse([
|
||||
APIError::NOT_FOUND => WPFunctions::get()->__('This subscriber does not exist.', 'mailpoet'),
|
||||
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -254,7 +253,7 @@ class Subscribers extends APIEndpoint {
|
||||
$segment = $this->getSegment($data);
|
||||
if (!$segment) {
|
||||
return $this->errorResponse([
|
||||
APIError::NOT_FOUND => WPFunctions::get()->__('This segment does not exist.', 'mailpoet'),
|
||||
APIError::NOT_FOUND => __('This segment does not exist.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -308,11 +307,11 @@ class Subscribers extends APIEndpoint {
|
||||
private function getErrorMessage(ValidationException $exception): string {
|
||||
$exceptionMessage = $exception->getMessage();
|
||||
if (strpos($exceptionMessage, 'This value should not be blank.') !== false) {
|
||||
return WPFunctions::get()->__('Please enter your email address', 'mailpoet');
|
||||
return __('Please enter your email address', 'mailpoet');
|
||||
} elseif (strpos($exceptionMessage, 'This value is not a valid email address.') !== false) {
|
||||
return WPFunctions::get()->__('Your email address is invalid!', 'mailpoet');
|
||||
return __('Your email address is invalid!', 'mailpoet');
|
||||
}
|
||||
|
||||
return WPFunctions::get()->__('Unexpected error.', 'mailpoet');
|
||||
return __('Unexpected error.', 'mailpoet');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user