Пример #1
0
 public function display()
 {
     $this->requireSettings();
     $responsecode = 200;
     if ($this->data['errorcode'] > 0) {
         $responsecode = $this->data['errorcode'];
     } elseif ($this->data['statuscode'] > 0) {
         $responsecode = $this->data['statuscode'];
     } elseif ($this->data['errornumber'] > 0) {
         $responsecode = $this->data['errornumber'];
     }
     $displaydata = $this->prepareResponseStructure();
     if ($responsecode != 200) {
         $http = new HTTP();
         $message = $http->getMessageForCode($responsecode);
         header("HTTP/1.0 " . $responsecode . " " . $message);
     }
     header('Content-Type: application/json; charset=utf-8');
     echo json_encode($displaydata);
     return true;
 }
Пример #2
0
 public function display()
 {
     $html = $this->getHTML();
     if (!$this->options['headerssent']) {
         if ($this->options['statuscode'] > 0 && $this->options['statuscode'] != 200) {
             $http = new HTTP();
             $message = $http->getMessageForCode($this->options['statuscode']);
             header("HTTP/1.0 " . $this->options['statuscode'] . " " . $message);
         }
         header('Content-Type: text/html; charset=utf-8');
     }
     echo $html;
     return true;
 }