- Adds new "ping" cron daemon router endpoint

- Removes the requirement to have data payload for router requests
This commit is contained in:
Vlad
2017-01-08 20:46:24 -05:00
parent aa0078e5e4
commit a6b00e1ba7
7 changed files with 88 additions and 37 deletions

View File

@@ -57,14 +57,15 @@ class Router {
return rtrim(base64_encode(json_encode($data)), '=');
}
static function buildRequest($endpoint, $action, $data) {
$data = self::encodeRequestData($data);
static function buildRequest($endpoint, $action, $data = false) {
$params = array(
self::NAME => '',
'endpoint' => $endpoint,
'action' => $action,
'data' => $data
);
if($data) {
$params['data'] = self::encodeRequestData($data);
}
return add_query_arg($params, home_url());
}