data = $data; } static function setError ($domain, $code, $message) { if (!isset (self::$reply->error)) { $error = new JsonError (); $error->domain = $domain; $error->code = $code; $error->message = $message; self::$reply->error = $error; } } static function addWarning ($str) { self::$reply->warnings[] = $str; } static function errorHandler ($domain, $code, $message) { self::setError ($domain, $code, $message); } static function sendReply () { switch (self::$encoding) { case self::ENCODING_HTML: if (self::$reply->error != NULL) print (self::$reply->error->message); else print (self::$reply->data); break; default: header ('Content-Type: application/json;charset=utf-8'); print ('(' . json_encode (self::$reply) . ')'); } } } ?>