use of lucee.runtime.tag.CFTagCore in project Lucee by lucee.
the class GetBaseTagList method getName.
private static String getName(PageContext pc, Tag tag) {
Class clazz = tag.getClass();
if (clazz == CFImportTag.class)
clazz = CFTag.class;
String className = clazz.getName();
TagLib[] tlds = ((ConfigImpl) pc.getConfig()).getTLDs(pc.getCurrentTemplateDialect());
TagLibTag tlt;
for (int i = 0; i < tlds.length; i++) {
// String ns = tlds[i].getNameSpaceAndSeparator();
Map tags = tlds[i].getTags();
Iterator it = tags.keySet().iterator();
while (it.hasNext()) {
tlt = (TagLibTag) tags.get(it.next());
if (tlt.getTagClassDefinition().isClassNameEqualTo(className)) {
// custm tag
if (tag instanceof AppendixTag) {
AppendixTag atag = (AppendixTag) tag;
if (atag.getAppendix() != null && !(tag instanceof Module)) {
return tlt.getFullName().toUpperCase() + atag.getAppendix().toUpperCase();
}
}
// built in cfc based custom tag
if (tag instanceof CFTagCore) {
if (((CFTagCore) tag).getName().equals(tlt.getAttribute("__name").getDefaultValue()))
return tlt.getFullName().toUpperCase();
continue;
}
return tlt.getFullName().toUpperCase();
}
}
}
return ListUtil.last(className, ".", true).toUpperCase();
}
use of lucee.runtime.tag.CFTagCore 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;
}
Aggregations