spunQ_OutputBuffer Class Reference

Wrapper around php's output buffering system. More...

List of all members.

Public Member Functions

 __construct ($callback=NULL)
 Constructor.
 addCallback ($callback)
 Adds another callback to be executed when the buffer is flushed.
 get ()
 Captures the output and returns the generated string.
 flush ()
 Flushes the output to stdout (to the browser in most cases).
 cancel ()
 Flushes buffer and throws away captured string.
 pause ()
 resume ($recursive=true)
 callback ($output)
 The callback that will be invoked by PHP when buffer is flushed.

Static Public Member Functions

static getInnerMostBuffer ()
static getOuterMostBuffer ()
static bypassAll ($output, $flush=true)

Public Attributes

const STATE_BUFFERING = 1
 The output buffer is capturing output.
const STATE_PAUSED = 2
 The output buffer has not been flushed, but is not capturing output.
const STATE_FINISHED = 4
 The buffer content has been retrieved.
const STATE_CANCELLED = 8
 The buffer content has been discarded.

Static Protected Attributes

static $rootBuffer = NULL
 The outer-most buffer.

Private Member Functions

 getPreviousBuffer ()

Private Attributes

 $lastObLevel
 Height of the output buffer stack at the time of object construction.
 $callbacks = array()
 Registered callbacks that will be executed when the buffer is flushed.
 $state = 1
 The current state of this buffer.
 $byPassedOutput = NULL
 Output that has been captured before being paused.
 $nextBuffer = NULL


Detailed Description

Wrapper around php's output buffering system.

See also:
http://php.net/ob_start

Definition at line 7 of file OutputBuffer.class.php.


Constructor & Destructor Documentation

spunQ_OutputBuffer::__construct ( callback = NULL  ) 

Constructor.

Takes any number of arguments, which will be treated just like the description of the first parameter suggests.

Parameters:
$callback A callback to be executed when the buffer is flushed. Might be any value spunQ_Callback::call() accepts.

Definition at line 104 of file OutputBuffer.class.php.


Member Function Documentation

spunQ_OutputBuffer::addCallback ( callback  ) 

Adds another callback to be executed when the buffer is flushed.

Parameters:
$callback A callback to be executed when the buffer is flushed. Might be any value spunQ_Callback::call() accepts.
Returns:
spunQ_OutputBuffer $this

Definition at line 133 of file OutputBuffer.class.php.

spunQ_OutputBuffer::callback ( output  ) 

The callback that will be invoked by PHP when buffer is flushed.

This function is not intended to be called by the developer, it has to be public for technical reasons.

Parameters:
$output The output that has been captured so far.
Returns:
string

Definition at line 314 of file OutputBuffer.class.php.

spunQ_OutputBuffer::cancel (  ) 

Flushes buffer and throws away captured string.

Returns:
spunQ_OutputBuffer $this

Definition at line 208 of file OutputBuffer.class.php.

spunQ_OutputBuffer::flush (  ) 

Flushes the output to stdout (to the browser in most cases).

Returns:
spunQ_OutputBuffer $this

Definition at line 175 of file OutputBuffer.class.php.

spunQ_OutputBuffer::get (  ) 

Captures the output and returns the generated string.

Returns:
string

Definition at line 142 of file OutputBuffer.class.php.


Member Data Documentation

spunQ_OutputBuffer::$byPassedOutput = NULL [private]

Output that has been captured before being paused.

Type:
string? This contains the content of the paused buffer, ready to be re-inserted as soon as the buffer is resumed.

Definition at line 93 of file OutputBuffer.class.php.

spunQ_OutputBuffer::$callbacks = array() [private]

Registered callbacks that will be executed when the buffer is flushed.

Type:
array<callback> Contains values recognized by spunQ_Callback::call()

Definition at line 79 of file OutputBuffer.class.php.

spunQ_OutputBuffer::$lastObLevel [private]

Height of the output buffer stack at the time of object construction.

The constructor will set this value to ob_get_level().

See also:
http:://php.net/ob_get_level
Type:
integer

Definition at line 72 of file OutputBuffer.class.php.

spunQ_OutputBuffer::$rootBuffer = NULL [static, protected]

The outer-most buffer.

Type:
spunQ_OutputBuffer? NULL if no buffer has been created yet.
Todo:
improve documentation.

Definition at line 34 of file OutputBuffer.class.php.

spunQ_OutputBuffer::$state = 1 [private]

The current state of this buffer.

Either of the STATE_* constants.

Type:
integer

Definition at line 86 of file OutputBuffer.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:43 2011 for spunQ3 by  doxygen 1.5.9