Added API/Endpoint abstract class
- (re)Added Endpoints folder to both API and Router - fixed syntax in namespaces - xhr.responseJSON is returned to the fail() - fixed Router endpoints (view in browser, cron,...)
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
namespace MailPoet\Router;
|
||||
|
||||
use MailPoet\Util\Helpers;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
@ -28,13 +27,14 @@ class Front {
|
||||
}
|
||||
|
||||
function init() {
|
||||
$endpoint = ucfirst($this->endpoint);
|
||||
$class = __NAMESPACE__ . "\\Endpoints\\" . ucfirst($this->endpoint);
|
||||
|
||||
if(!$this->api_request) return;
|
||||
if(!$this->endpoint || !class_exists($endpoint)) {
|
||||
if(!$this->endpoint || !class_exists($class)) {
|
||||
self::terminateRequest(self::RESPONSE_ERROR, __('Invalid Router endpoint.'));
|
||||
}
|
||||
$this->callEndpoint(
|
||||
$endpoint,
|
||||
$class,
|
||||
$this->action,
|
||||
$this->data
|
||||
);
|
||||
|
Reference in New Issue
Block a user