/** Returns the module with the given name. */ public QuercusModule findModule(String name) { ModuleInfo moduleInfo = _modules.get(name); QuercusModule module = null; if (moduleInfo != null) module = moduleInfo.getModule(); else module = getModuleContext().findModule(name); if (module == null) throw new IllegalStateException(L.l("'{0}' is an unknown quercus module", name)); return module; }
/** Returns true if an extension is loaded. */ public Value getExtensionFuncs(String name) { ArrayValue value = null; for (ModuleInfo moduleInfo : _modules.values()) { Set<String> extensionSet = moduleInfo.getLoadedExtensions(); if (extensionSet.contains(name)) { for (String functionName : moduleInfo.getFunctions().keySet()) { if (value == null) value = new ArrayValueImpl(); value.put(functionName); } } } if (value != null) return value; else return BooleanValue.FALSE; }
protected void addModuleInfo(ModuleInfo info) { _modules.put(info.getName(), info); if (info.getModule() instanceof ModuleStartupListener) _moduleStartupListeners.add((ModuleStartupListener) info.getModule()); for (String ext : info.getLoadedExtensions()) { _extensionSet.add(ext); _extensionSetLowerCase.add(ext.toLowerCase(Locale.ENGLISH)); } Map<StringValue, Value> map; if (isUnicodeSemantics()) map = info.getUnicodeConstMap(); else map = info.getConstMap(); if (map != null) { for (Map.Entry<StringValue, Value> entry : map.entrySet()) { int id = getConstantId(entry.getKey()); _constantMap[id] = entry.getValue(); } } _iniDefinitions.addAll(info.getIniDefinitions()); for (Map.Entry<String, AbstractFunction> entry : info.getFunctions().entrySet()) { String funName = entry.getKey(); AbstractFunction fun = entry.getValue(); _funMap.put(funName, fun); _lowerFunMap.put(funName.toLowerCase(Locale.ENGLISH), fun); setFunction(funName, fun); } }