public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
if (!headers_sent()) { nocache_headers(); //max age TODO: header('Content-Type: text/javascript; charset=gb2312'); } require_once 'Client.php'; require_once 'Abstract.php'; require_once 'SDK.php'; require_once 'LocalServer.php'; require_once 'Exception.php'; if (!class_exists('Duoshuo_SDK')) { $response = array('code' => 30, 'errorMessage' => 'Duoshuo plugin hasn\'t been activated.'); echo json_encode($response); exit; } $plugin = Duoshuo_SDK::getInstance(); try { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $server = new Duoshuo_LocalServer($plugin); $input = $_POST; if (get_magic_quotes_gpc()) { foreach ($input as $key => $value) { $input[$key] = stripslashes($value); } } $server->dispatch($input); } } catch (Exception $e) { Duoshuo_LocalServer::sendException($e); exit; }