use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_list_handlers.
public static Memory ob_list_handlers(Environment env) {
ArrayMemory result = new ArrayMemory();
OutputBuffer peek = env.peekOutputBuffer();
ArrayList<OutputBuffer> list = new ArrayList<OutputBuffer>();
while (peek != null && !peek.isRoot()) {
list.add(0, peek);
peek = peek.getParentOutput();
}
for (OutputBuffer e : list) {
result.refOfPush().assign(e.getName());
}
return result.toConstant();
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_clean.
public static boolean ob_clean(Environment env, TraceInfo trace) throws Throwable {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null && !buffer.isRoot()) {
buffer.setTrace(trace);
buffer.clean();
return true;
} else {
env.error(trace, ErrorType.E_NOTICE, "ob_clean(): failed to delete buffer. No buffer to delete");
return false;
}
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_end_clean.
public static boolean ob_end_clean(Environment env, TraceInfo trace) throws Throwable {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null && !buffer.isRoot()) {
buffer.setTrace(trace);
buffer.setStatus(OutputBuffer.HANDLER_FINAL);
buffer.clean();
env.popOutputBuffer();
return true;
} else {
env.error(trace, ErrorType.E_NOTICE, "ob_end_clean(): failed to delete buffer. No buffer to delete");
return false;
}
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_get_clean.
public static Memory ob_get_clean(Environment env, TraceInfo trace) throws Throwable {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null && !buffer.isRoot()) {
Memory result = buffer.getContents();
buffer.setTrace(trace);
buffer.clean();
return result;
} else {
//env.error(trace, ErrorType.E_NOTICE, "ob_get_clean(): failed to delete and clean buffer. No buffer to delete or clean");
return Memory.FALSE;
}
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_start.
public static Memory ob_start(Environment env, TraceInfo trace, Memory outputCallback, Memory _chunkSize, Memory erase) {
Invoker invoker;
if (!outputCallback.isNull()) {
invoker = expectingCallback(env, trace, 1, outputCallback);
if (invoker == null)
return Memory.FALSE;
invoker.check("ob_start", trace);
}
switch(_chunkSize.getRealType()) {
case ARRAY:
case STRING:
case OBJECT:
env.warning(trace, "ob_start() expects parameter 2 to be long, " + _chunkSize.getRealType().toString() + " given");
return Memory.NULL;
}
switch(erase.getRealType()) {
case ARRAY:
case STRING:
case OBJECT:
env.warning(trace, "ob_start() expects parameter 3 to be long, " + erase.getRealType().toString() + " given");
return Memory.NULL;
}
int chunkSize = _chunkSize.toInteger();
if (chunkSize < 0)
chunkSize = 0;
if (chunkSize < 0) {
env.warning(trace, "ob_start(): chunk_size must be grater or equal than zero");
return Memory.FALSE;
}
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null && buffer.isLock())
env.error(trace, "ob_start(): Cannot use output buffering in output buffering display handlers");
env.pushOutputBuffer(outputCallback, chunkSize, erase.toBoolean());
return Memory.TRUE;
}
Aggregations