public static function send($content, $type = 'success', $nextAction = false) { if (self::$sent) { self::log("Cannot send response information - another response has already been sent at " . self::$stack . ".", YG_WARNING); return false; } if ($type == 'notice') { if ($nextAction) { echo json_encode(array("status" => $type, "content" => $content, "nextAction" => $nextAction)); } else { echo json_encode(array("status" => $type, "content" => $content)); } } else { echo json_encode(array("status" => $type, "content" => $content)); } self::$stack = self::getStack(); self::$sent = true; return true; }