예제 #1
0
 public static function dispatch()
 {
     require_once 'lib/rest.inc.php';
     $router = new OAuthRestRouter();
     if ($router->is_valid()) {
         $controller_class = ucfirst($router->controller) . "Controller";
         if (class_exists($controller_class)) {
             $controller = new $controller_class($router);
             $action = $router->action;
             $results = $controller->{$action}();
             $formatter = new OAuthRestFormatter($results);
             $formatter->send();
         } else {
             die(OAuthRestFormatter::sendResponse(404));
         }
     } else {
         die(OAuthRestFormatter::sendResponse(404));
     }
 }
예제 #2
0
 public function send()
 {
     OAuthRestFormatter::sendResponse(200, $this->to_s(), $this->content_type());
 }