diff options
| author | pantsucat <contact@pantsu.cat> | 2015-09-17 15:12:51 +0200 |
|---|---|---|
| committer | pantsucat <contact@pantsu.cat> | 2015-09-17 15:12:51 +0200 |
| commit | 1411bce1dc13bf6fea66b5899ba29d50d5c53bb0 (patch) | |
| tree | 9250c2dbfa29930ff3fade33dacadc2839c98177 /static/classes/Response.class.php | |
| parent | 55fb54d3cdef2220d4208e614201311b0a2bb322 (diff) | |
Add html response class
Diffstat (limited to 'static/classes/Response.class.php')
| -rwxr-xr-x | static/classes/Response.class.php | 23 |
1 files changed, 23 insertions, 0 deletions
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 .= "<a href=\"".$file['url']."\">".$file['url']."</a><br>"; + } + + return $result; + } private static function json_error($code, $description) { |
