- Refactors API
- Updates existing classes to use the refactored API methods
This commit is contained in:
16
lib/API/Endpoints/Queue.php
Normal file
16
lib/API/Endpoints/Queue.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace MailPoet\API\Endpoints;
|
||||
|
||||
use MailPoet\Cron\Daemon;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Queue {
|
||||
const ENDPOINT = 'queue';
|
||||
const ACTION_RUN = 'run';
|
||||
|
||||
static function run($data) {
|
||||
$queue = new Daemon($data);
|
||||
$queue->run();
|
||||
}
|
||||
}
|
22
lib/API/Endpoints/Subscription.php
Normal file
22
lib/API/Endpoints/Subscription.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace MailPoet\API\Endpoints;
|
||||
|
||||
use MailPoet\Subscription as UserSubscription;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Subscription {
|
||||
const ENDPOINT = 'subscription';
|
||||
|
||||
static function confirm($data) {
|
||||
$subscription = new UserSubscription\Pages('confirm', $data);
|
||||
}
|
||||
|
||||
static function manage($data) {
|
||||
$subscription = new UserSubscription\Pages('manage', $data);
|
||||
}
|
||||
|
||||
static function unsubscribe($data) {
|
||||
$subscription = new UserSubscription\Pages('unsubscribe', $data);
|
||||
}
|
||||
}
|
23
lib/API/Endpoints/Track.php
Normal file
23
lib/API/Endpoints/Track.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace MailPoet\API\Endpoints;
|
||||
|
||||
use MailPoet\Statistics\Track\Clicks;
|
||||
use MailPoet\Statistics\Track\Opens;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Track {
|
||||
const ENDPOINT = 'track';
|
||||
const ACTION_CLICK = 'click';
|
||||
const ACTION_OPEN = 'open';
|
||||
|
||||
static function click($data) {
|
||||
$clicks = new Clicks($data);
|
||||
$clicks->track();
|
||||
}
|
||||
|
||||
static function open($data) {
|
||||
$opens = new Opens($data);
|
||||
$opens->track();
|
||||
}
|
||||
}
|
16
lib/API/Endpoints/ViewInBrowser.php
Normal file
16
lib/API/Endpoints/ViewInBrowser.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace MailPoet\API\Endpoints;
|
||||
|
||||
use MailPoet\Newsletter\ViewInBrowser as NewsletterViewInBrowser;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class ViewInBrowser {
|
||||
const ENDPOINT = 'view_in_browser';
|
||||
const ACTION_VIEW = 'view';
|
||||
|
||||
static function view($data) {
|
||||
$viewer = new NewsletterViewInBrowser($data);
|
||||
$viewer->view();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user