diff options
author | ctrlaltca@gmail.com <> | 2011-05-21 17:10:29 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-05-21 17:10:29 +0000 |
commit | 6f00b28a1d9c7409c956a83866eac48a9493e83c (patch) | |
tree | fb3e14f0a527cf32d186932b13bd6ae9ed50a5c1 /framework/PradoBase.php | |
parent | 5a91b2a3328c8c15ce9dbed9a599ab87f9e8f112 (diff) |
branch/3.1: merged bugfixesfrom trunk/ up to r2880; correct svn:mergeinfo property
Diffstat (limited to 'framework/PradoBase.php')
-rw-r--r-- | framework/PradoBase.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 3a982ec5..222f492e 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -341,21 +341,24 @@ class PradoBase * @param string extension to be appended if the namespace refers to a file * @return string file path corresponding to the namespace, null if namespace is invalid */ - public static function getPathOfNamespace($namespace,$ext='') + public static function getPathOfNamespace($namespace, $ext='') { - if(isset(self::$_usings[$namespace])) - return self::$_usings[$namespace]; - else if(isset(self::$_aliases[$namespace])) - return self::$_aliases[$namespace]; - else + if(self::CLASS_FILE_EXT === $ext || empty($ext)) { - $segs=explode('.',$namespace); - $alias=array_shift($segs); - if(($file=array_pop($segs))!==null && ($root=self::getPathOfAlias($alias))!==null) - return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file==='*')?'':DIRECTORY_SEPARATOR.$file.$ext); - else - return null; + if(isset(self::$_usings[$namespace])) + return self::$_usings[$namespace]; + + if(isset(self::$_aliases[$namespace])) + return self::$_aliases[$namespace]; } + + $segs = explode('.',$namespace); + $alias = array_shift($segs); + + if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias))) + return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file === '*') ? '' : DIRECTORY_SEPARATOR.$file.$ext); + + return null; } /** |