.replace(basePath, ""));
String protectedPath = YiiRefsHelper.getCurrentProtected(path);
protectedPath = protectedPath.replace(basePath, "");
String str = element.getText();
TextRange textRange = CommonHelper.getTextRange(element, str);
String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
int start = textRange.getStartOffset();
int len = textRange.getLength();
if (!uri.endsWith(".tpl") && !uri.startsWith("smarty:")) {
uri += ".php";
}
VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
VirtualFile protectedPathDir = (!protectedPath.equals(""))
? baseDir.findFileByRelativePath(protectedPath) : null;
String filepath = viewPath + "/" + uri;
if (uri.matches("^//.+")) {
filepath = viewAbsolutePath + "/" + uri.replace("//", "");
}
VirtualFile viewfile = baseDir.findFileByRelativePath(filepath);
if (viewfile != null && appDir != null) {
PsiReference ref = new FileReference(
viewfile,
uri,
element,
new TextRange(start, start + len),
project,
protectedPathDir,
appDir);
return new PsiReference[]{ref};
}