예제 #1
0
 /**
  * 	method:	set
  *
  * 	todo: write documentation
  */
 public static function set($path = NULL)
 {
     if (self::$location !== NULL) {
         return self::$location;
     }
     $router_dir = NULL;
     if ($path == NULL) {
         self::$location = Amslib_Router::getBase();
     } else {
         //	Make sure the location has a slash at both front+back (ex: /location/, not /location or location/)
         self::$location = self::reduceSlashes("/" . Amslib_File::relative($path) . "/");
     }
     //	NOTE:	Special case having a single slash as the location to being a blank string
     //			the single slash causes lots of bugs and means you have to check everywhere
     //			for it's presence, whilst it doesnt really do anything, so better if you
     //			just eliminate it and put a blank string
     //	NOTE:	The reason is, if you str_replace($location,"",$something) and $location is /
     //			then you will nuke every path separator in your url, which is useless....
     if (self::$location == "/") {
         self::$location = "";
     }
     return self::$location;
 }
예제 #2
0
 /**
  * 	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);
 }