From 6f00b28a1d9c7409c956a83866eac48a9493e83c Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Sat, 21 May 2011 17:10:29 +0000 Subject: branch/3.1: merged bugfixesfrom trunk/ up to r2880; correct svn:mergeinfo property --- framework/PradoBase.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'framework/PradoBase.php') 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; } /** -- cgit v1.2.3