public static function searchFile($filename, $path, $mode = 'nano') { // try the file as specified $path = $path . $filename; // print "<br>(trying specified $path)"; if ($hash = One_Script_Cache::get($path)) { return array(true, $hash, $path); } if (file_exists($path)) { return self::loadFileContents($path, $mode); } // not found, walk the search sequence -- DEPRECATED /* $sequence = self::$nsLoadPath; if ($sequence) foreach ($sequence as $pathTemplate) { $place = One_Locator::locateUsing($path,$pathTemplate); if ($hash = One_Script_Cache::inCache( $place )) return array( true, $hash, $place ); return self::loadFileContents( $place, $mode ); } */ $place = One_Locator::locateUsing($path, self::currentSearchPattern()); if ($place !== null) { if ($hash = One_Script_Cache::inCache($place)) { return array(true, $hash, $place); } return self::loadFileContents($place, $mode); } self::$error = "One_Script_Factory error : could not locate '{$filename}' in '{$path}'"; return false; }
public function parse($load, $filename, $path = "") { list($cached, $codeOrPath, $actualPath) = $load; if ($cached) { // echo ' (in cache)'; if ($codeOrPath instanceof One_Script_Node_Root) { $this->rootNode = $codeOrPath; } else { $this->rootNode = One_Script_Cache::get($codeOrPath); } } else { // echo ' (NOT in cache )'; $parser = new One_Script_Parser($this); $this->rootNode = $parser->parse($codeOrPath, $filename, $path, $actualPath); One_Script_Cache::cache($actualPath, $this->rootNode); } if ($this->rootNode->isError()) { $this->error = $this->rootNode->error; } }