api = isset($_GET['mailpoet-api']) ? true : false; $this->section = isset($_GET['section']) ? $_GET['section'] : false; $this->action = isset($_GET['action']) ? Helpers::underscoreToCamelCase($_GET['action']) : false; $this->request_payload = isset($_GET['request_payload']) ? unserialize(base64_decode($_GET['request_payload'])) : false; } function init() { if(!$this->api && !$this->section) return; $this->_checkAndCallMethod($this, $this->section, $terminate = true); } function queue() { try { $queue = new Daemon($this->request_payload); $this->_checkAndCallMethod($queue, $this->action); } catch(\Exception $e) { } } private function _checkAndCallMethod($class, $method, $terminate = false) { if(!method_exists($class, $method)) { if(!$terminate) return; header('HTTP/1.0 404 Not Found'); exit; } call_user_func( array( $class, $method ) ); } }