28 public function validate($id, $config, $context) {
30 if (!$this->selector && !$config->get(
'Attr.EnableID'))
return false;
34 if ($id ===
'')
return false;
36 $prefix = $config->get(
'Attr.IDPrefix');
38 $prefix .= $config->get(
'Attr.IDPrefixLocal');
40 if (strpos($id, $prefix) !== 0) $id = $prefix . $id;
41 } elseif ($config->get(
'Attr.IDPrefixLocal') !==
'') {
42 trigger_error(
'%Attr.IDPrefixLocal cannot be used unless '.
43 '%Attr.IDPrefix is set', E_USER_WARNING);
46 if (!$this->selector) {
47 $id_accumulator =& $context->get(
'IDAccumulator');
48 if (isset($id_accumulator->ids[$id]))
return false;
53 if (ctype_alpha($id)) {
56 if (!ctype_alpha(@$id[0]))
return false;
64 $regexp = $config->get(
'Attr.IDBlacklistRegexp');
65 if ($regexp && preg_match($regexp, $id)) {
69 if (!$this->selector &&
$result) $id_accumulator->add($id);