From 1411bce1dc13bf6fea66b5899ba29d50d5c53bb0 Mon Sep 17 00:00:00 2001 From: pantsucat Date: Thu, 17 Sep 2015 23:12:51 +1000 Subject: Add html response class --- static/classes/Response.class.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'static/classes/Response.class.php') diff --git a/static/classes/Response.class.php b/static/classes/Response.class.php index 25121ce..9c22a30 100755 --- a/static/classes/Response.class.php +++ b/static/classes/Response.class.php @@ -12,6 +12,10 @@ class Response header('Content-Type: text/plain; charset=UTF-8'); $this->type = $response_type; break; + case 'html': + header('Content-Type: text/html;charset=utf-8'); + $this->type = 'html'; + break; default: header('Content-Type: application/json; charset=UTF-8'); $this->type = 'json'; @@ -30,6 +34,9 @@ class Response case 'gyazo': $response = $this->gyazo_error($code, $desc); break; + case 'html': + $response = $this->html_error($code, $desc); + break; default: $response = $this->json_error($code, $desc); break; @@ -44,6 +51,9 @@ class Response $response = null; switch ($this->type) { + case 'html': + $response = $this->html_success($files); + break; case 'csv': $response = $this->csv_success($files); break; @@ -86,6 +96,19 @@ class Response { return POMF_URL.$files[0]['url']; } + private static function html_error($code, $description) + { + return 'ERROR: ('.$code.') '.$description; + } + + private static function html_success($files) + { + foreach ($files as $file) { + $result .= "".$file['url']."
"; + } + + return $result; + } private static function json_error($code, $description) { -- cgit v1.2.3