ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_Context Class Reference

Registry object that contains information about the current context. More...

+ Collaboration diagram for HTMLPurifier_Context:

Public Member Functions

 register ($name, &$ref)
 Registers a variable into the context.
get ($name, $ignore_error=false)
 Retrieves a variable reference from the context.
 destroy ($name)
 Destorys a variable in the context.
 exists ($name)
 Checks whether or not the variable exists.
 loadArray ($context_array)
 Loads a series of variables from an associative array.

Private Attributes

 $_storage = array()
 Private array that stores the references.

Detailed Description

Registry object that contains information about the current context.

Warning
Is a bit buggy when variables are set to null: it thinks they don't exist! So use false instead, please.
Note
Since the variables Context deals with may not be objects, references are very important here! Do not remove!

Definition at line 10 of file Context.php.

Member Function Documentation

HTMLPurifier_Context::destroy (   $name)

Destorys a variable in the context.

Parameters
$nameString name

Definition at line 53 of file Context.php.

References $name.

{
if (!isset($this->_storage[$name])) {
trigger_error("Attempted to destroy non-existent variable $name",
E_USER_ERROR);
return;
}
unset($this->_storage[$name]);
}
HTMLPurifier_Context::exists (   $name)

Checks whether or not the variable exists.

Parameters
$nameString name

Definition at line 66 of file Context.php.

References $name.

{
return isset($this->_storage[$name]);
}
& HTMLPurifier_Context::get (   $name,
  $ignore_error = false 
)

Retrieves a variable reference from the context.

Parameters
$nameString name
$ignore_errorBoolean whether or not to ignore error

Definition at line 37 of file Context.php.

References $name.

{
if (!isset($this->_storage[$name])) {
if (!$ignore_error) {
trigger_error("Attempted to retrieve non-existent variable $name",
E_USER_ERROR);
}
$var = null; // so we can return by reference
return $var;
}
return $this->_storage[$name];
}
HTMLPurifier_Context::loadArray (   $context_array)

Loads a series of variables from an associative array.

Parameters
$context_arrayAssoc array of variables to load

Definition at line 74 of file Context.php.

References $key.

{
foreach ($context_array as $key => $discard) {
$this->register($key, $context_array[$key]);
}
}
HTMLPurifier_Context::register (   $name,
$ref 
)

Registers a variable into the context.

Parameters
$nameString name
$refReference to variable to be registered

Definition at line 23 of file Context.php.

References $name.

{
if (isset($this->_storage[$name])) {
trigger_error("Name $name produces collision, cannot re-register",
E_USER_ERROR);
return;
}
$this->_storage[$name] =& $ref;
}

Field Documentation

HTMLPurifier_Context::$_storage = array()
private

Private array that stores the references.

Definition at line 16 of file Context.php.


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