public final function getCSSAndJSDependencies($appendTemplateDefaultPublicDirectory = true)
 {
     $values = array();
     foreach ($this->CSS as $value) {
         $url = strpos($value, "http://") > -1 || strpos($value, "https://") > -1 ? $value : Engine::getRemoteDir($appendTemplateDefaultPublicDirectory ? $this->getLocalDir() . '/public/' . $value : $value);
         array_push($values, "<link href='" . $url . "' rel='stylesheet' type='text/css'/>");
     }
     foreach ($this->JS as $value) {
         $url = strpos($value, "http:") > -1 || strpos($value, "https://") > -1 ? $value : Engine::getRemoteDir($appendTemplateDefaultPublicDirectory ? $this->getLocalDir() . '/public/' . $value : $value);
         array_push($values, "<script src='" . $url . "'></script>");
     }
     return $values;
 }
 public function test_getRemoteDir()
 {
     /*
     	This unit test is against the filepath of the engine.
     	This is so that the function gives us a relative URL 
     	rather than a filepath, this then allows us to transform
     	paths such as CSS etc to their correct local on a website.
     	With the assistance of getRemoteAbsolutePath, we can get 
     	the server address and also the virtualhost address if there
     	is one. (e.g. Cardiff Uni project server use your email username,
     	in other words, mine is /JamesM27 on the project.cs.cf.ac.uk domain
     	however, without this fix, apache treats the folder as root, i.e. "/").
     */
     //Remove the unit test folder for our actual document path
     $_SERVER['DOCUMENT_ROOT'] = realpath(__DIR__ . '../');
     //Pretend we are a web server running index.php to set our environment
     $_SERVER["PHP_SELF"] = "/index.php";
     $this->assertEquals("/", Engine::getRemoteDir("/"));
     //Test against a realworld scenario, i.e. our actual file path.
     $this->assertEquals("/home", Engine::getRemoteDir(__DIR__ . "/home"));
 }
 public function onSubmit()
 {
     rename(TEMP_CONFIG_FILE, CONFIG_FILE);
     $this->sendStatus(false, Engine::getRemoteDir($_SERVER['REQUEST_URI']));
 }