]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
Merge develop into 1404_reworked_autocomplete
[friendica.git] / include / network.php
index 27459112d6a9cf2476d7c51c4e7ba537bc9c7623..5fd73bfef909cf0c52adf8a758594e84f19fff3f 100644 (file)
@@ -1286,3 +1286,18 @@ function short_link($url) {
        }
        return $slinky->short();
 }};
+
+/**
+ * @brief Encodes content to json
+ * 
+ * This function encodes an array to json format
+ * and adds an application/json HTTP header to the output.
+ * After finishing the process is getting killed.
+ * 
+ * @param array $x
+ */
+function json_return_and_die($x) {
+       header("content-type: application/json");
+       echo json_encode($x);
+       killme();
+}