use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class Environment method popOutputBuffer.
public OutputBuffer popOutputBuffer() throws Throwable {
Stack<OutputBuffer> outputBuffers = getOutputBuffers();
if (outputBuffers.empty())
return null;
if (outputBuffers.peek().isRoot())
return null;
OutputBuffer result = outputBuffers.pop();
result.close();
return result;
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_flush.
public static boolean ob_flush(Environment env, TraceInfo trace) throws Throwable {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null && !buffer.isRoot()) {
buffer.setTrace(trace);
buffer.flush();
return true;
} else {
env.error(trace, ErrorType.E_NOTICE, "ob_flush(): failed to flush buffer. No buffer to flush");
return false;
}
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_end_flush.
public static boolean ob_end_flush(Environment env, TraceInfo trace) throws Throwable {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null && !buffer.isRoot()) {
buffer.setTrace(trace);
buffer.flush();
env.popOutputBuffer();
return true;
} else {
env.error(trace, ErrorType.E_NOTICE, "ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush");
return false;
}
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_get_flush.
public static Memory ob_get_flush(Environment env, TraceInfo trace) throws Throwable {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer != null) {
if (buffer.isLock()) {
env.error(trace, "ob_get_flush(): Cannot use output buffering in output buffering display handlers");
return Memory.FALSE;
}
Memory result = buffer.getContents();
buffer.setTrace(trace);
buffer.flush();
return result;
} else {
env.error(trace, ErrorType.E_NOTICE, "ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush");
return Memory.FALSE;
}
}
use of php.runtime.output.OutputBuffer in project jphp by jphp-compiler.
the class OutputFunctions method ob_get_status.
public static Memory ob_get_status(Environment env, boolean fullStatus) {
if (fullStatus) {
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.add(_get_status(e));
}
return result;
} else {
OutputBuffer buffer = env.peekOutputBuffer();
if (buffer == null || buffer.isRoot())
return new ArrayMemory().toConstant();
return _get_status(buffer).toConstant();
}
}
Aggregations