59        $this->locale    =& 
$context->get(
'Locale');
 
   61        $this->_current  =& $this->_stacks[0];
 
   62        $this->errors    =& $this->_stacks[0];
 
   70    public function send($severity, $msg)
 
   73        if (func_num_args() > 2) {
 
   74            $args = func_get_args();
 
   79        $token = $this->context->get(
'CurrentToken', 
true);
 
   80        $line  = $token ? $token->line : $this->context->get(
'CurrentLine', 
true);
 
   81        $col   = $token ? $token->col  : $this->context->get(
'CurrentCol', 
true);
 
   82        $attr  = $this->context->get(
'CurrentAttr', 
true);
 
   86        if (!is_null($token)) {
 
   87            $args[
'CurrentToken'] = $token;
 
   89        if (!is_null($attr)) {
 
   90            $subst[
'$CurrentAttr.Name'] = $attr;
 
   91            if (isset($token->attr[$attr])) {
 
   92                $subst[
'$CurrentAttr.Value'] = $token->attr[$attr];
 
   97            $msg = $this->locale->getMessage($msg);
 
   99            $msg = $this->locale->formatMessage($msg, $args);
 
  102        if (!empty($subst)) {
 
  103            $msg = strtr($msg, $subst);
 
  108            self::LINENO   => $line,
 
  109            self::SEVERITY => $severity,
 
  110            self::MESSAGE  => $msg,
 
  111            self::CHILDREN => array()
 
  113        $this->_current[] = 
$error;
 
  122            $new_struct->value = clone $token;
 
  124        if (is_int($line) && is_int($col)) {
 
  125            if (isset($this->lines[$line][$col])) {
 
  126                $struct = $this->lines[$line][$col];
 
  128                $struct = $this->lines[$line][$col] = $new_struct;
 
  131            ksort($this->lines[$line], SORT_NUMERIC);
 
  133            if (isset($this->lines[-1])) {
 
  134                $struct = $this->lines[-1];
 
  136                $struct = $this->lines[-1] = $new_struct;
 
  139        ksort($this->lines, SORT_NUMERIC);
 
  144            if (!$struct->value) {
 
  145                $struct->value = array($attr, 
'PUT VALUE HERE');
 
  148        if (!empty($cssprop)) {
 
  150            if (!$struct->value) {
 
  152                $struct->value = array($cssprop, 
'PUT VALUE HERE');
 
  157        $struct->addError($severity, $msg);
 
  186        foreach ($this->lines as $line => $col_array) {
 
  190            foreach ($col_array as $col => $struct) {
 
  194        if (isset($this->lines[-1])) {
 
  199            return '<p>' . $this->locale->getMessage(
'ErrorCollector: No errors') . 
'</p>';
 
  201            return '<ul><li>' . implode(
'</li><li>', 
$ret) . 
'</li></ul>';
 
  208        $stack = array($struct);
 
  209        $context_stack = array(array());
 
  210        while (
$current = array_pop($stack)) {
 
  211            $context = array_pop($context_stack);
 
  213                list($severity, $msg) = 
$error;
 
  217                $error = $this->locale->getErrorName($severity);
 
  218                $string .= 
"<span class=\"error e$severity\"><strong>$error</strong></span> ";
 
  219                if (!is_null($line) && !is_null($col)) {
 
  220                    $string .= 
"<em class=\"location\">Line $line, Column $col: </em> ";
 
  222                    $string .= 
'<em class="location">End of Document: </em> ';
 
  224                $string .= 
'<strong class="description">' . $this->generator->escape($msg) . 
'</strong> ';
 
  233            foreach (
$current->children as $array) {
 
  235                $stack = array_merge($stack, array_reverse($array, 
true));
 
  236                for (
$i = count($array); 
$i > 0; 
$i--) {
 
An exception for terminatinating execution or to throw for unit testing.
Error collection class that enables HTML Purifier to report HTML problems back to the user.
$locale
@type HTMLPurifier_Language
send($severity, $msg)
Sends an error message to the collector for later use.
$generator
@type HTMLPurifier_Generator
const LINENO
Identifiers for the returned error array.
getHTMLFormatted($config, $errors=null)
Default HTML formatting implementation for error messages.
_renderStruct(&$ret, $struct, $line=null, $col=null)
$context
@type HTMLPurifier_Context
getRaw()
Retrieves raw error data for custom formatter to use.
Records errors for particular segments of an HTML document such as tokens, attributes or CSS properti...
const TOKEN
Possible values for $children first-key.
Generates HTML from tokens.