23 $definition =
$config->getHTMLDefinition();
24 $e =& $context->get(
'ErrorCollector',
true);
27 $ok =& $context->get(
'IDAccumulator',
true);
30 $context->register(
'IDAccumulator', $id_accumulator);
34 $current_token =& $context->get(
'CurrentToken',
true);
35 if (!$current_token) $context->register(
'CurrentToken', $token);
44 $d_defs = $definition->info_global_attr;
51 foreach ($definition->info_attr_transform_pre as $transform) {
52 $attr = $transform->transform($o = $attr,
$config, $context);
54 if ($attr != $o) $e->send(E_NOTICE,
'AttrValidator: Attributes transformed', $o, $attr);
60 foreach ($definition->info[$token->name]->attr_transform_pre as $transform) {
61 $attr = $transform->transform($o = $attr,
$config, $context);
63 if ($attr != $o) $e->send(E_NOTICE,
'AttrValidator: Attributes transformed', $o, $attr);
70 $defs = $definition->info[$token->name]->attr;
73 $context->register(
'CurrentAttr', $attr_key);
77 foreach ($attr as $attr_key => $value) {
80 if ( isset($defs[$attr_key]) ) {
82 if ($defs[$attr_key] ===
false) {
91 $result = $defs[$attr_key]->validate(
95 } elseif ( isset($d_defs[$attr_key]) ) {
98 $result = $d_defs[$attr_key]->validate(
107 if ($result ===
false || $result === null) {
110 if ($e) $e->send(E_ERROR,
'AttrValidator: Attribute removed');
113 unset($attr[$attr_key]);
114 } elseif (is_string($result)) {
120 $attr[$attr_key] = $result;
132 $context->destroy(
'CurrentAttr');
137 foreach ($definition->info_attr_transform_post as $transform) {
138 $attr = $transform->transform($o = $attr,
$config, $context);
140 if ($attr != $o) $e->send(E_NOTICE,
'AttrValidator: Attributes transformed', $o, $attr);
145 foreach ($definition->info[$token->name]->attr_transform_post as $transform) {
146 $attr = $transform->transform($o = $attr,
$config, $context);
148 if ($attr != $o) $e->send(E_NOTICE,
'AttrValidator: Attributes transformed', $o, $attr);
152 $token->attr = $attr;
155 if (!$current_token) $context->destroy(
'CurrentToken');