From 30de03241b5efd1c3f533347be12191aeb3e78a4 Mon Sep 17 00:00:00 2001 From: rojaro <> Date: Thu, 2 Sep 2010 15:55:55 +0000 Subject: fixed #285 --- 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 95ea7e23..55758bb6 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($_useBuffer && isset(self::$_usings[$namespace])) + return self::$_usings[$namespace]; + + if($_useBuffer && 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