public function configPath($name, $array, $object) { if (!array_key_exists("child", $array)) { return; } foreach (Amslib_Array::valid($array["child"]) as $c) { $v = Amslib_Plugin::expandPath($c["value"]); if ($c["tag"] == "include") { Amslib::addIncludePath(Amslib_File::absolute($v)); } else { Amslib_Website::setPath($c["tag"], $v); switch ($c["tag"]) { case "plugin": Amslib_Plugin_Manager::addLocation($v); break; case "docroot": Amslib_File::documentRoot($v); break; } } } }
function TestOfAmslibStringLchop() { $this->caseTitle('Amslib_String::lchop'); $test = 'C:/Sites/crm-test/vendor/index.php'; $this->log($test); $documentRoot = $_SERVER['DOCUMENT_ROOT']; $result = Amslib_String::lchop($test, $documentRoot); $this->log($result); $this->assertFalse(strpos($result, $documentRoot) === 0); $test = "/Sites/crm-test/vendor/index.php"; $this->log($test); $documentRoot = Amslib_File::documentRoot($test); $result = Amslib_String::lchop($test, Amslib_File::documentRoot($test)); $this->log($result); $this->assertFalse(strpos($result, $documentRoot) === 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); }