2007-03-29 23:19:53 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pre-transform that changes deprecated name attribute to ID if necessary
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-01-05 00:10:43 +00:00
|
|
|
public function transform($attr, $config, $context) {
|
2007-03-29 23:19:53 +00:00
|
|
|
if (!isset($attr['name'])) return $attr;
|
2007-05-05 02:25:55 +00:00
|
|
|
$id = $this->confiscateAttr($attr, 'name');
|
|
|
|
if ( isset($attr['id'])) return $attr;
|
|
|
|
$attr['id'] = $id;
|
2007-03-29 23:19:53 +00:00
|
|
|
return $attr;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-03-29 23:19:53 +00:00
|
|
|
}
|
|
|
|
|