/** * Finds a file relative to the source file from a URL * @access public * @param $url * @return mixed */ public function find($url) { if ($url[0] == '/' or $url[0] == '\\') { $path = $_SERVER['DOCUMENT_ROOT'] . $url; if (!file_exists($path)) { $path = false; } } else { $Container = Scaffold_Container::getInstance(); $import_paths = $Container->options['import_paths']; array_unshift($import_paths, dirname($this->basepath)); foreach ($import_paths as $import_path) { $path = $import_path . DIRECTORY_SEPARATOR . $url; if (file_exists($path)) { break; } } if (!file_exists($path)) { $path = false; } } return $path; }
require_once SCAFFOLD_PATH . '/lib/Scaffold/Environment.php'; /** * Set timezone, just in case it isn't set. PHP 5.3+ * throws a tantrum if you try and use time() without * this being set. */ date_default_timezone_set('GMT'); /** * Automatically load any Scaffold Classes */ Scaffold_Environment::auto_load(); /** * Let Scaffold handle errors */ Scaffold_Environment::handle_errors(); /** * Set the view to use for errors and exceptions */ Scaffold_Environment::set_view(realpath(SCAFFOLD_PATH . '/views/error.php')); # Scaffold Config $config = $GLOBALS['ApplicationConfiguration']['compiler']['scaffold']['config']; # The container creates Scaffold objects $Container = Scaffold_Container::getInstance(SCAFFOLD_PATH, $config); # This is where the magic happens $Scaffold = $Container->build(); # Compile $Source = $Scaffold->getSource(null, $config); // Compiles the source object $Source = $Scaffold->compile($Source); // Use the result to render it to the browser. Hooray! $Scaffold->render($Source);