securityCheck(); $class = ucfirst($_POST['endpoint']); $endpoint = __NAMESPACE__ . "\\" . $class; $method = $_POST['method']; $data = isset($_POST['data']) ? $_POST['data'] : array(); $endpoint = new $endpoint(); $endpoint->$method($data); } function setToken() { $global = '"; echo $global; } function securityCheck() { if (!current_user_can('manage_options')) {die();} if (!wp_verify_nonce($_POST['token'], 'mailpoet_token')) {die();} } }