/** * method: __construct * * todo: write documentation */ public function __construct($name, $location, $config = NULL) { parent::__construct(); // unless I think of a reason to not do this, always initialise sessions @session_start(); // This is needed so non-routed-services will work without modification // NOTE: probably I shouldn't need to do this, I need to find a way to make this redundant Amslib_Router::initialise(); // NOTE: I think that this method is redundant and the system should do it for me // NOTE: I'm not sure whether this method is actually useful anymore, I think it's out of date maybe Amslib_Website::set(); $base = Amslib_Router::getBase(); Amslib_Website::setPath("amslib", Amslib::locate()); Amslib_Website::setPath("website", $base); Amslib_Website::setPath("website_ext", Amslib_Router_URL::externalURL($base)); Amslib_Website::setPath("host", Amslib_Router_URL::externalURL()); // NOTE: I don't think I want this __ADMIN__ parameter anymore Amslib_Website::setPath("admin", "__ADMIN__"); Amslib_Website::setPath("plugin", "__PLUGIN__"); Amslib_Website::setPath("docroot", Amslib_File::documentRoot()); $this->completionCallback = array(); // Set the name, location and config of the plugin that was found in the hard disk $this->setName($name); $this->setLocation($location); $this->setConfigSource($config); }
/** * method: exportRouterShared * * todo: write documentation */ public static function exportRouterShared($filter = NULL) { if (!in_array($filter, array("path", "service"))) { $filter = NULL; } // The raw data source before processing $data = array("domain" => Amslib_Router_URL::externalURL(self::$base), "cache" => self::$cache); // For each cache block, remove the javascript, stylesheet and any framework routes // For each src inside each cache block, prepend the domain to each url making them accessible remotely foreach ($data["cache"] as $k => &$r) { if ($filter != NULL && $r["type"] != $filter) { unset($data["cache"][$k]); continue; } unset($r["stylesheet"]); unset($r["javascript"]); unset($r["handler"]); foreach ($r["src"] as &$s) { // If the url already contains this, it's an absolute url, you can't possibly add // the domain to it, cause it already has one although I don't know if this will // fit all circumstances, perhaps these urls shouldn't be exported if (strpos($s, "http://") !== false) { continue; } $s = rtrim($data["domain"], "/") . $s; } if (strpos($k, "framework") || !self::getExportRestriction($r["group"])) { unset($data["cache"][$k]); } } return $data; }
/** * method: externalURL * * todo: write documentation */ public function externalURL($url = "") { return Amslib_Router_URL::externalURL($url); }