use of lucee.runtime.tag.CFTag in project Lucee by lucee.
the class GetBaseTagData method getParentCFTag.
public static CFTag getParentCFTag(Tag tag, String trgTagName, int minLevel) {
String pureName = trgTagName;
int level = 0;
CFTag cfTag;
while (tag != null) {
if (tag instanceof CFTag && minLevel <= (level++)) {
cfTag = (CFTag) tag;
if (cfTag instanceof CFTagCore) {
CFTagCore tc = (CFTagCore) cfTag;
if ((tc.getName() + "").equalsIgnoreCase(pureName))
return cfTag;
if (StringUtil.startsWithIgnoreCase(pureName, "cf")) {
pureName = pureName.substring(2);
}
if ((tc.getName() + "").equalsIgnoreCase(pureName))
return cfTag;
} else if (cfTag.getAppendix().equalsIgnoreCase(pureName)) {
return cfTag;
} else if (StringUtil.startsWithIgnoreCase(pureName, "cf_")) {
pureName = pureName.substring(3);
if (cfTag.getAppendix().equalsIgnoreCase(pureName))
return cfTag;
}
}
tag = tag.getParent();
}
return null;
}