Example #1
0
 public static function parseURL()
 {
     if (isset($_GET['deprecationDate'])) {
         self::$deprecationDate = $_GET['deprecationDate'];
         self::$root = "/api-" . self::$deprecationDate;
         unset($_GET['deprecationDate']);
     } else {
         self::$root = "/api";
     }
     $_url = trim($_GET['_url'], " \\/\\\t\n\r\v");
     if (!$_url) {
         PhlatMedia::write(self::getLinks());
     }
     list(self::$resource, self::$id, self::$subresource) = explode("/", $_url);
     unset($_GET['_url']);
     if (self::$subresource == 'collection' and self::$id) {
         Error::http(404, "A generic 'collection' subresource for " . self::$resource . " #" . self::$id . " does not exist.");
     }
     if (!self::$subresource and !is_numeric(self::$id)) {
         self::$subresource = self::$id;
     }
 }