aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/json_response.php
diff options
context:
space:
mode:
authorCallum Macrae <callum@lynxphp.com>2011-08-24 12:25:54 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-03-31 02:09:14 +0200
commit7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0 (patch)
tree67de4f7f19dbde414388b731fb64751fb0092fe3 /phpBB/includes/json_response.php
parentc92b30d66cbb2839369c04172eb5ae9bacd27a16 (diff)
downloadforums-7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0.tar
forums-7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0.tar.gz
forums-7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0.tar.bz2
forums-7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0.tar.xz
forums-7a933bdb5ad4a9bc4877a7d4d516fa0b21d9e4c0.zip
[ticket/10328] Renamed the JSON class, also now using autoloading.
It is no longer static, and uses autoloading. It has also been renamed from JSON to phpbb_json_response. PHPBB3-10328
Diffstat (limited to 'phpBB/includes/json_response.php')
-rw-r--r--phpBB/includes/json_response.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/phpBB/includes/json_response.php b/phpBB/includes/json_response.php
new file mode 100644
index 0000000000..95d02e3c0e
--- /dev/null
+++ b/phpBB/includes/json_response.php
@@ -0,0 +1,42 @@
+<?php
+/**
+*
+* @package phpBB3
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* JSON class
+* @package phpBB3
+*/
+class phpbb_json_response
+{
+ /**
+ * Send the data to the client and exit the script.
+ *
+ * @param array $data Any additional data to send.
+ * @param bool $exit Will exit the script if true.
+ */
+ public function send($data, $exit = true)
+ {
+ header('Content-type: application/json');
+ echo json_encode($data);
+
+ if ($exit)
+ {
+ garbage_collection();
+ exit_handler();
+ }
+ }
+}