00001 <?php
00002
00011 class PHPTAL_SourceResolver
00012 {
00036 function
resolve($path, $repository=
false, $callerPath=
false)
00037 {
00038
00039 $pathes = array($
path);
00040
00041
if ($callerPath) {
00042 $pathes[] = dirname($callerPath) . PHPTAL_PATH_SEP . $path;
00043 }
00044
00045
if ($repository) {
00046 $pathes[] = $repository . PHPTAL_PATH_SEP . $path;
00047 }
00048
00049
if (defined('PHPTAL_REPOSITORY')) {
00050 $pathes[] = PHPTAL_REPOSITORY . PHPTAL_PATH_SEP . $path;
00051 }
00052 foreach ($pathes as $ftest) {
00053
if (file_exists($ftest)) {
00054 $realpath = realpath($ftest);
00055 $locator =
new PHPTAL_SourceLocator($realpath);
00056
return $locator;
00057 }
00058 }
00059
return false;
00060 }
00061 }
00062
00063 ?>