Add space between if and ‘(‘
[MAILPOET-1791]
This commit is contained in:
@ -8,7 +8,7 @@ use MailPoet\Util\Helpers;
|
||||
use MailPoet\Util\Security;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class API {
|
||||
private $_request_api_version;
|
||||
@ -26,7 +26,7 @@ class API {
|
||||
|
||||
/** @var AccessControl */
|
||||
private $access_control;
|
||||
|
||||
|
||||
/** @var WPFunctions */
|
||||
private $wp;
|
||||
|
||||
@ -84,7 +84,7 @@ class API {
|
||||
$this->_request_method === 'subscribe'
|
||||
);
|
||||
|
||||
if(!$ignoreToken && $this->checkToken() === false) {
|
||||
if (!$ignoreToken && $this->checkToken() === false) {
|
||||
$error_message = __("Sorry, but we couldn't connect to the MailPoet server. Please refresh the web page and try again.", 'mailpoet');
|
||||
$error_response = $this->createErrorResponse(Error::UNAUTHORIZED, $error_message, Response::STATUS_UNAUTHORIZED);
|
||||
return $error_response->send();
|
||||
@ -111,7 +111,7 @@ class API {
|
||||
? trim($data['token'])
|
||||
: null;
|
||||
|
||||
if(!$this->_request_endpoint || !$this->_request_method || !$this->_request_api_version) {
|
||||
if (!$this->_request_endpoint || !$this->_request_method || !$this->_request_api_version) {
|
||||
$error_message = __('Invalid API request.', 'mailpoet');
|
||||
$error_response = $this->createErrorResponse(Error::BAD_REQUEST, $error_message, Response::STATUS_BAD_REQUEST);
|
||||
return $error_response;
|
||||
@ -122,7 +122,7 @@ class API {
|
||||
$namespace,
|
||||
ucfirst($this->_request_endpoint)
|
||||
);
|
||||
if($this->container->has($endpoint_class)) {
|
||||
if ($this->container->has($endpoint_class)) {
|
||||
$this->_request_endpoint_class = $endpoint_class;
|
||||
break;
|
||||
}
|
||||
@ -132,7 +132,7 @@ class API {
|
||||
: array();
|
||||
|
||||
// remove reserved keywords from data
|
||||
if(is_array($this->_request_data) && !empty($this->_request_data)) {
|
||||
if (is_array($this->_request_data) && !empty($this->_request_data)) {
|
||||
// filter out reserved keywords from data
|
||||
$reserved_keywords = array(
|
||||
'token',
|
||||
@ -152,20 +152,20 @@ class API {
|
||||
|
||||
function processRoute() {
|
||||
try {
|
||||
if(empty($this->_request_endpoint_class) ||
|
||||
if (empty($this->_request_endpoint_class) ||
|
||||
!$this->container->has($this->_request_endpoint_class)
|
||||
) {
|
||||
throw new \Exception(__('Invalid API endpoint.', 'mailpoet'));
|
||||
}
|
||||
|
||||
$endpoint = $this->container->get($this->_request_endpoint_class);
|
||||
if(!method_exists($endpoint, $this->_request_method)) {
|
||||
if (!method_exists($endpoint, $this->_request_method)) {
|
||||
throw new \Exception(__('Invalid API endpoint method.', 'mailpoet'));
|
||||
}
|
||||
|
||||
// check the accessibility of the requested endpoint's action
|
||||
// by default, an endpoint's action is considered "private"
|
||||
if(!$this->validatePermissions($this->_request_method, $endpoint->permissions)) {
|
||||
if (!$this->validatePermissions($this->_request_method, $endpoint->permissions)) {
|
||||
$error_message = __('You do not have the required permissions.', 'mailpoet');
|
||||
$error_response = $this->createErrorResponse(Error::FORBIDDEN, $error_message, Response::STATUS_FORBIDDEN);
|
||||
return $error_response;
|
||||
@ -203,7 +203,7 @@ class API {
|
||||
}
|
||||
|
||||
function addEndpointNamespace($namespace, $version) {
|
||||
if(!empty($this->_endpoint_namespaces[$version][$namespace])) return;
|
||||
if (!empty($this->_endpoint_namespaces[$version][$namespace])) return;
|
||||
$this->_endpoint_namespaces[$version][] = $namespace;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user