@Hide @Override public Map<StringValue,Value> getConstMap() { return CONST_MAP; }
@Hide public static int getRegexpCacheSize() { return _regexpCache.getCapacity(); }
@Hide public static String getEncoding(Env env) { Value encoding = env.getIni("mbstring.internal_encoding"); if (encoding.length() > 0) return encoding.toString(); else return env.getRuntimeEncoding(); }
@Hide public void startup(Env env) { if (env.getConfigVar("session.auto_start").toBoolean()) session_start(env); }
@Hide public static void setRegexpCacheSize(int size) { if (size < 0 || size == _regexpCache.getCapacity()) return; _regexpCache = new LruCache<StringValue, RegexpCacheItem>(size); _eregCache = new LruCache<StringValue, Ereg>(size); _eregiCache = new LruCache<StringValue, Eregi>(size); _unicodeEregCache = new LruCache<UnicodeEregKey, UnicodeEreg>(size); _unicodeEregiCache = new LruCache<UnicodeEregKey, UnicodeEregi>(size); _replacementCache = new LruCache<StringValue, ArrayList<Replacement>>(size); }
@Hide public void startup(Env env) { boolean isOutputBuffering = INI_OUTPUT_BUFFERING.getAsBoolean(env); StringValue handlerName = INI_OUTPUT_HANDLER.getAsStringValue(env); if (handlerName.length() > 0 && env.getFunction(handlerName) != null) { Callable callback = handlerName.toCallable(env, false); ob_start(env, callback, 0, true); } else if (isOutputBuffering) { ob_start(env, null, 0, true); } ob_implicit_flush(env, isOutputBuffering); }
@Hide public static BinaryStream openForAppend(Env env, StringValue filename, boolean isUseIncludePath) throws IOException { ProtocolWrapper wrapper = getProtocolWrapper(env, filename); if (wrapper != null) { long options = 0; if (isUseIncludePath) { options = StreamModule.STREAM_USE_PATH; } return wrapper.fopen(env, filename, env.createString("r"), LongValue.create(options)); } Path path = env.lookupPwd(filename); if (isUseIncludePath && path == null) { path = env.lookupInclude(filename); } if (path == null) { return null; } if (! env.isAllowUrlFopen() && isUrl(path)) { throw new IOException("remote urls not allowed"); } return new FileOutput(env, path, true); }