Registry object that contains information about the current context.  
 More...
|  | 
|  | register ($name, &$ref) | 
|  | Registers a variable into the context.  More... 
 | 
|  | 
| & | get ($name, $ignore_error=false) | 
|  | Retrieves a variable reference from the context.  More... 
 | 
|  | 
|  | destroy ($name) | 
|  | Destroys a variable in the context.  More... 
 | 
|  | 
|  | exists ($name) | 
|  | Checks whether or not the variable exists.  More... 
 | 
|  | 
|  | loadArray ($context_array) | 
|  | Loads a series of variables from an associative array.  More... 
 | 
|  | 
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.
◆ destroy()
      
        
          | HTMLPurifier_Context::destroy | ( |  | $name | ) |  | 
      
 
Destroys a variable in the context. 
- Parameters
- 
  
  
Definition at line 61 of file Context.php.
   62    {
   63        if (!array_key_exists($name, $this->_storage)) {
   64            trigger_error(
   65                "Attempted to destroy non-existent variable $name",
   66                E_USER_ERROR
   67            );
   68            return;
   69        }
   70        unset($this->_storage[$name]);
   71    }
 
 
◆ exists()
      
        
          | HTMLPurifier_Context::exists | ( |  | $name | ) |  | 
      
 
Checks whether or not the variable exists. 
- Parameters
- 
  
  
- Returns
- bool 
Definition at line 78 of file Context.php.
   79    {
   80        return array_key_exists($name, $this->_storage);
   81    }
 
 
◆ get()
      
        
          | & HTMLPurifier_Context::get | ( |  | $name, | 
        
          |  |  |  | $ignore_error = false | 
        
          |  | ) |  |  | 
      
 
Retrieves a variable reference from the context. 
- Parameters
- 
  
    | string | $name | String name |  | bool | $ignore_error | Boolean whether or not to ignore error |  
 
- Returns
- mixed 
Definition at line 42 of file Context.php.
   43    {
   44        if (!array_key_exists($name, $this->_storage)) {
   45            if (!$ignore_error) {
   46                trigger_error(
   47                    "Attempted to retrieve non-existent variable $name",
   48                    E_USER_ERROR
   49                );
   50            }
   51            $var = null; 
   52            return $var;
   53        }
   54        return $this->_storage[$name];
   55    }
 
 
◆ loadArray()
      
        
          | HTMLPurifier_Context::loadArray | ( |  | $context_array | ) |  | 
      
 
Loads a series of variables from an associative array. 
- Parameters
- 
  
    | array | $context_array | Assoc array of variables to load |  
 
Definition at line 87 of file Context.php.
   88    {
   89        foreach ($context_array as $key => $discard) {
   90            $this->register($key, $context_array[$key]);
   91        }
   92    }
 
 
◆ register()
      
        
          | HTMLPurifier_Context::register | ( |  | $name, | 
        
          |  |  | & | $ref | 
        
          |  | ) |  |  | 
      
 
Registers a variable into the context. 
- Parameters
- 
  
    | string | $name | String name |  | mixed | $ref | Reference to variable to be registered |  
 
Definition at line 24 of file Context.php.
   25    {
   26        if (array_key_exists($name, $this->_storage)) {
   27            trigger_error(
   28                "Name $name produces collision, cannot re-register",
   29                E_USER_ERROR
   30            );
   31            return;
   32        }
   33        $this->_storage[$name] =& $ref;
   34    }
 
 
◆ $_storage
  
  | 
        
          | HTMLPurifier_Context::$_storage = array() |  | private | 
 
Private array that stores the references. 
@type array 
Definition at line 17 of file Context.php.
 
 
The documentation for this class was generated from the following file:
- libs/composer/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Context.php