Skip to content

Instantly share code, notes, and snippets.

/gist:4442970

Created Jan 3, 2013
Embed
What would you like to do?
public static function getPathOfAlias($alias)
{
if(isset(self::$_aliases[$alias]))
return self::$_aliases[$alias];
else if(($pos=strpos($alias,'.'))!==false)
{
$rootAlias=substr($alias,0,$pos);
if(isset(self::$_aliases[$rootAlias]))
return self::$_aliases[$alias]=rtrim(self::$_aliases[$rootAlias].DIRECTORY_SEPARATOR.str_replace('.',DIRECTORY_SEPARATOR,substr($alias,$pos+1)),'*'.DIRECTORY_SEPARATOR);
else if(self::$_app instanceof CWebApplication)
{
if(self::$_app->findModule($rootAlias)!==null)
return self::getPathOfAlias($alias);
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment