15 public $levels = array(0 =>
'none',
'light',
'medium',
'heavy');
50 $level = $config->get(
'HTML.TidyLevel');
54 $add_fixes = $config->get(
'HTML.TidyAdd');
55 $remove_fixes = $config->get(
'HTML.TidyRemove');
57 foreach ($fixes as
$name => $fix) {
59 if (isset($remove_fixes[
$name]) ||
60 (!isset($add_fixes[$name]) && !isset($fixes_lookup[$name]))) {
77 if ($level == $this->levels[0]) {
80 $activated_levels = array();
81 for ($i = 1, $c = count($this->levels); $i < $c; $i++) {
82 $activated_levels[] = $this->levels[$i];
83 if ($this->levels[$i] == $level) {
89 'Tidy level ' . htmlspecialchars($level) .
' not recognized',
95 foreach ($activated_levels as $level) {
96 foreach ($this->fixesForLevel[$level] as $fix) {
111 if (!isset($this->defaultLevel)) {
114 if (!isset($this->fixesForLevel[$this->defaultLevel])) {
116 'Default level ' . $this->defaultLevel .
' does not exist',
131 foreach ($fixes as
$name => $fix) {
135 case 'attr_transform_pre':
136 case 'attr_transform_post':
137 $attr = $params[
'attr'];
138 if (isset($params[
'element'])) {
139 $element = $params[
'element'];
140 if (empty($this->info[$element])) {
143 $e = $this->info[$element];
146 $type =
"info_$type";
154 case 'tag_transform':
155 $this->info_tag_transform[$params[
'element']] = $fix;
158 case 'content_model_type':
159 $element = $params[
'element'];
160 if (empty($this->info[$element])) {
163 $e = $this->info[$element];
168 trigger_error(
"Fix type $type not supported", E_USER_ERROR);
185 $property = $attr = null;
186 if (strpos(
$name,
'#') !==
false) {
189 if (strpos(
$name,
'@') !==
false) {
196 $params[
'element'] =
$name;
198 if (!is_null($attr)) {
199 $params[
'attr'] = $attr;
203 if (!is_null($attr)) {
204 if (is_null($property)) {
207 $type =
'attr_transform_' . $property;
208 return array($type, $params);
212 if (is_null($property)) {
213 return array(
'tag_transform', $params);
216 return array($property, $params);