29 $this->locale =&
$context->get(
'Locale');
31 $this->_current =& $this->_stacks[0];
32 $this->errors =& $this->_stacks[0];
45 if (func_num_args() > 2) {
46 $args = func_get_args();
51 $token = $this->context->get(
'CurrentToken',
true);
52 $line =
$token ?
$token->line : $this->context->get(
'CurrentLine',
true);
53 $col =
$token ?
$token->col : $this->context->get(
'CurrentCol',
true);
54 $attr = $this->context->get(
'CurrentAttr',
true);
59 $args[
'CurrentToken'] =
$token;
61 if (!is_null($attr)) {
62 $subst[
'$CurrentAttr.Name'] = $attr;
63 if (isset(
$token->attr[$attr])) $subst[
'$CurrentAttr.Value'] =
$token->attr[$attr];
67 $msg = $this->locale->getMessage(
$msg);
69 $msg = $this->locale->formatMessage(
$msg, $args);
72 if (!empty($subst))
$msg = strtr(
$msg, $subst);
76 self::LINENO => $line,
77 self::SEVERITY => $severity,
78 self::MESSAGE =>
$msg,
79 self::CHILDREN => array()
81 $this->_current[] =
$error;
93 if (is_int($line) && is_int($col)) {
94 if (isset($this->lines[$line][$col])) {
95 $struct = $this->lines[$line][$col];
97 $struct = $this->lines[$line][$col] = $new_struct;
100 ksort($this->lines[$line], SORT_NUMERIC);
102 if (isset($this->lines[-1])) {
103 $struct = $this->lines[-1];
105 $struct = $this->lines[-1] = $new_struct;
108 ksort($this->lines, SORT_NUMERIC);
113 if (!$struct->value) {
114 $struct->value = array($attr,
'PUT VALUE HERE');
117 if (!empty($cssprop)) {
119 if (!$struct->value) {
121 $struct->value = array($cssprop,
'PUT VALUE HERE');
126 $struct->addError($severity,
$msg);
153 foreach ($this->lines as $line => $col_array) {
154 if ($line == -1)
continue;
155 foreach ($col_array as $col => $struct) {
159 if (isset($this->lines[-1])) {
164 return '<p>' . $this->locale->getMessage(
'ErrorCollector: No errors') .
'</p>';
166 return '<ul><li>' . implode(
'</li><li>',
$ret) .
'</li></ul>';
172 $stack = array($struct);
173 $context_stack = array(array());
174 while ($current = array_pop($stack)) {
175 $context = array_pop($context_stack);
176 foreach ($current->errors as
$error) {
181 $error = $this->locale->getErrorName($severity);
182 $string .=
"<span class=\"error e$severity\"><strong>$error</strong></span> ";
183 if (!is_null($line) && !is_null($col)) {
184 $string .=
"<em class=\"location\">Line $line, Column $col: </em> ";
186 $string .=
'<em class="location">End of Document: </em> ';
188 $string .=
'<strong class="description">' . $this->generator->escape(
$msg) .
'</strong> ';
197 foreach ($current->children as
$type => $array) {
199 $stack = array_merge($stack, array_reverse($array,
true));
200 for (
$i = count($array);
$i > 0;
$i--) {