/** * Prefixes with PHPWIKI_DIR and slashify. * For example to unify with * require_once dirname(__FILE__).'/lib/file.php' * require_once 'lib/file.php' loading style. * Doesn't expand "~" or symlinks yet. truename would be perfect. * * NormalizeLocalFileName("lib/config.php") => /home/user/phpwiki/lib/config.php */ function NormalizeLocalFileName($file) { static $finder; if (!isset($finder)) { $finder = new FileFinder(); } // remove "/lib" from dirname(__FILE__) if ($finder->_is_abs($file)) { return $finder->slashifyPath($file); } else { if (defined("PHPWIKI_DIR")) { $wikidir = PHPWIKI_DIR; } else { $wikidir = preg_replace('/.lib$/', '', dirname(__FILE__)); } $wikidir = $finder->_strip_last_pathchar($wikidir); $pathsep = $finder->_use_path_separator($wikidir); return $finder->slashifyPath($wikidir . $pathsep . $file); // return PHPWIKI_DIR . "/" . $file; } }