Validates the attributes of a token, mutating it as necessary.
{
$definition = $config->getHTMLDefinition();
$e =& $context->get('ErrorCollector', true);
$ok =& $context->get(
'IDAccumulator',
true);
$context->register('IDAccumulator', $id_accumulator);
}
$current_token =& $context->get('CurrentToken', true);
if (!$current_token) {
$context->register('CurrentToken', $token);
}
) {
return;
}
$d_defs = $definition->info_global_attr;
$attr = $token->attr;
foreach ($definition->info_attr_transform_pre as $transform) {
$attr = $transform->transform($o = $attr, $config, $context);
if ($e) {
if ($attr != $o) {
$e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
}
}
}
foreach ($definition->info[$token->name]->attr_transform_pre as $transform) {
$attr = $transform->transform($o = $attr, $config, $context);
if ($e) {
if ($attr != $o) {
$e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
}
}
}
$defs = $definition->info[$token->name]->attr;
$attr_key = false;
$context->register('CurrentAttr', $attr_key);
foreach ($attr as $attr_key => $value) {
if (isset($defs[$attr_key])) {
if ($defs[$attr_key] === false) {
} else {
$result = $defs[$attr_key]->validate(
$value,
$config,
$context
);
}
} elseif (isset($d_defs[$attr_key])) {
$result = $d_defs[$attr_key]->validate(
$value,
$config,
$context
);
} else {
}
if ($e) {
$e->send(E_ERROR, 'AttrValidator: Attribute removed');
}
unset($attr[$attr_key]);
} else {
}
}
$context->destroy('CurrentAttr');
foreach ($definition->info_attr_transform_post as $transform) {
$attr = $transform->transform($o = $attr, $config, $context);
if ($e) {
if ($attr != $o) {
$e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
}
}
}
foreach ($definition->info[$token->name]->attr_transform_post as $transform) {
$attr = $transform->transform($o = $attr, $config, $context);
if ($e) {
if ($attr != $o) {
$e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
}
}
}
$token->attr = $attr;
if (!$current_token) {
$context->destroy('CurrentToken');
}
}