public static function handleRequest($handle = false) { $pathStack = Site::$requestPath; if ($pathStack[0] == 'json') { static::$responseMode = array_shift($pathStack); } if (!$handle) { $handle = array_shift($pathStack); } // administrative actions if ($handle == '!autoreserve') { return static::handleAutoReserveRequest(); } // route handle if ($GlobalHandle = GlobalHandle::getByHandle($handle)) { if (static::$responseMode == 'html') { if ($GlobalHandle->Type == 'Alias') { Router::redirectViewRecord($GlobalHandle->Context, static::getPath()); } else { return static::throwNotFoundError(); } } else { return static::respond('handle', array('success' => true, 'data' => $GlobalHandle)); } } else { return static::throwNotFoundError(); } }