@@ -21,18 +21,18 @@ |
||
21 | 21 | */ |
22 | 22 | public function transform($attr, $config, $context) |
23 | 23 | { |
24 | - if (!isset($attr['name'])) { |
|
24 | + if (!isset($attr[ 'name' ])) { |
|
25 | 25 | return $attr; |
26 | 26 | } |
27 | - $name = $attr['name']; |
|
28 | - if (isset($attr['id']) && $attr['id'] === $name) { |
|
27 | + $name = $attr[ 'name' ]; |
|
28 | + if (isset($attr[ 'id' ]) && $attr[ 'id' ] === $name) { |
|
29 | 29 | return $attr; |
30 | 30 | } |
31 | 31 | $result = $this->idDef->validate($name, $config, $context); |
32 | 32 | if ($result === false) { |
33 | - unset($attr['name']); |
|
33 | + unset($attr[ 'name' ]); |
|
34 | 34 | } else { |
35 | - $attr['name'] = $result; |
|
35 | + $attr[ 'name' ] = $result; |
|
36 | 36 | } |
37 | 37 | return $attr; |
38 | 38 | } |
@@ -18,8 +18,8 @@ |
||
18 | 18 | */ |
19 | 19 | public function transform($attr, $config, $context) |
20 | 20 | { |
21 | - if (!isset($attr['type'])) { |
|
22 | - $attr['type'] = 'application/x-shockwave-flash'; |
|
21 | + if (!isset($attr[ 'type' ])) { |
|
22 | + $attr[ 'type' ] = 'application/x-shockwave-flash'; |
|
23 | 23 | } |
24 | 24 | return $attr; |
25 | 25 | } |
@@ -16,10 +16,10 @@ |
||
16 | 16 | */ |
17 | 17 | public function transform($attr, $config, $context) |
18 | 18 | { |
19 | - if (isset($attr['dir'])) { |
|
19 | + if (isset($attr[ 'dir' ])) { |
|
20 | 20 | return $attr; |
21 | 21 | } |
22 | - $attr['dir'] = $config->get('Attr.DefaultTextDir'); |
|
22 | + $attr[ 'dir' ] = $config->get('Attr.DefaultTextDir'); |
|
23 | 23 | return $attr; |
24 | 24 | } |
25 | 25 | } |
@@ -24,30 +24,30 @@ |
||
24 | 24 | */ |
25 | 25 | public function transform($attr, $config, $context) |
26 | 26 | { |
27 | - if (!isset($attr['type'])) { |
|
27 | + if (!isset($attr[ 'type' ])) { |
|
28 | 28 | $t = 'text'; |
29 | 29 | } else { |
30 | - $t = strtolower($attr['type']); |
|
30 | + $t = strtolower($attr[ 'type' ]); |
|
31 | 31 | } |
32 | - if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') { |
|
33 | - unset($attr['checked']); |
|
32 | + if (isset($attr[ 'checked' ]) && $t !== 'radio' && $t !== 'checkbox') { |
|
33 | + unset($attr[ 'checked' ]); |
|
34 | 34 | } |
35 | - if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') { |
|
36 | - unset($attr['maxlength']); |
|
35 | + if (isset($attr[ 'maxlength' ]) && $t !== 'text' && $t !== 'password') { |
|
36 | + unset($attr[ 'maxlength' ]); |
|
37 | 37 | } |
38 | - if (isset($attr['size']) && $t !== 'text' && $t !== 'password') { |
|
39 | - $result = $this->pixels->validate($attr['size'], $config, $context); |
|
38 | + if (isset($attr[ 'size' ]) && $t !== 'text' && $t !== 'password') { |
|
39 | + $result = $this->pixels->validate($attr[ 'size' ], $config, $context); |
|
40 | 40 | if ($result === false) { |
41 | - unset($attr['size']); |
|
41 | + unset($attr[ 'size' ]); |
|
42 | 42 | } else { |
43 | - $attr['size'] = $result; |
|
43 | + $attr[ 'size' ] = $result; |
|
44 | 44 | } |
45 | 45 | } |
46 | - if (isset($attr['src']) && $t !== 'image') { |
|
47 | - unset($attr['src']); |
|
46 | + if (isset($attr[ 'src' ]) && $t !== 'image') { |
|
47 | + unset($attr[ 'src' ]); |
|
48 | 48 | } |
49 | - if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) { |
|
50 | - $attr['value'] = ''; |
|
49 | + if (!isset($attr[ 'value' ]) && ($t === 'radio' || $t === 'checkbox')) { |
|
50 | + $attr[ 'value' ] = ''; |
|
51 | 51 | } |
52 | 52 | return $attr; |
53 | 53 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $this->attr = $attr; |
37 | 37 | $this->enumToCSS = $enum_to_css; |
38 | - $this->caseSensitive = (bool)$case_sensitive; |
|
38 | + $this->caseSensitive = (bool) $case_sensitive; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function transform($attr, $config, $context) |
48 | 48 | { |
49 | - if (!isset($attr[$this->attr])) { |
|
49 | + if (!isset($attr[ $this->attr ])) { |
|
50 | 50 | return $attr; |
51 | 51 | } |
52 | 52 | |
53 | - $value = trim($attr[$this->attr]); |
|
54 | - unset($attr[$this->attr]); |
|
53 | + $value = trim($attr[ $this->attr ]); |
|
54 | + unset($attr[ $this->attr ]); |
|
55 | 55 | |
56 | 56 | if (!$this->caseSensitive) { |
57 | 57 | $value = strtolower($value); |
58 | 58 | } |
59 | 59 | |
60 | - if (!isset($this->enumToCSS[$value])) { |
|
60 | + if (!isset($this->enumToCSS[ $value ])) { |
|
61 | 61 | return $attr; |
62 | 62 | } |
63 | - $this->prependCSS($attr, $this->enumToCSS[$value]); |
|
63 | + $this->prependCSS($attr, $this->enumToCSS[ $value ]); |
|
64 | 64 | return $attr; |
65 | 65 | } |
66 | 66 | } |
@@ -20,25 +20,25 @@ |
||
20 | 20 | public function transform($attr, $config, $context) |
21 | 21 | { |
22 | 22 | $src = true; |
23 | - if (!isset($attr['src'])) { |
|
23 | + if (!isset($attr[ 'src' ])) { |
|
24 | 24 | if ($config->get('Core.RemoveInvalidImg')) { |
25 | 25 | return $attr; |
26 | 26 | } |
27 | - $attr['src'] = $config->get('Attr.DefaultInvalidImage'); |
|
27 | + $attr[ 'src' ] = $config->get('Attr.DefaultInvalidImage'); |
|
28 | 28 | $src = false; |
29 | 29 | } |
30 | 30 | |
31 | - if (!isset($attr['alt'])) { |
|
31 | + if (!isset($attr[ 'alt' ])) { |
|
32 | 32 | if ($src) { |
33 | 33 | $alt = $config->get('Attr.DefaultImageAlt'); |
34 | 34 | if ($alt === null) { |
35 | 35 | // truncate if the alt is too long |
36 | - $attr['alt'] = substr(basename($attr['src']), 0, 40); |
|
36 | + $attr[ 'alt' ] = substr(basename($attr[ 'src' ]), 0, 40); |
|
37 | 37 | } else { |
38 | - $attr['alt'] = $alt; |
|
38 | + $attr[ 'alt' ] = $alt; |
|
39 | 39 | } |
40 | 40 | } else { |
41 | - $attr['alt'] = $config->get('Attr.DefaultInvalidImageAlt'); |
|
41 | + $attr[ 'alt' ] = $config->get('Attr.DefaultInvalidImageAlt'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | return $attr; |
@@ -30,14 +30,14 @@ |
||
30 | 30 | */ |
31 | 31 | public function transform($attr, $config, $context) |
32 | 32 | { |
33 | - if (!isset($attr[$this->name])) { |
|
33 | + if (!isset($attr[ $this->name ])) { |
|
34 | 34 | return $attr; |
35 | 35 | } |
36 | 36 | $length = $this->confiscateAttr($attr, $this->name); |
37 | 37 | if (ctype_digit($length)) { |
38 | 38 | $length .= 'px'; |
39 | 39 | } |
40 | - $this->prependCSS($attr, $this->cssName . ":$length;"); |
|
40 | + $this->prependCSS($attr, $this->cssName.":$length;"); |
|
41 | 41 | return $attr; |
42 | 42 | } |
43 | 43 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function transform($attr, $config, $context) |
15 | 15 | { |
16 | - if (!isset($attr['border'])) { |
|
16 | + if (!isset($attr[ 'border' ])) { |
|
17 | 17 | return $attr; |
18 | 18 | } |
19 | 19 | $border_width = $this->confiscateAttr($attr, 'border'); |
@@ -18,14 +18,14 @@ |
||
18 | 18 | if ($config->get('HTML.Attr.Name.UseCDATA')) { |
19 | 19 | return $attr; |
20 | 20 | } |
21 | - if (!isset($attr['name'])) { |
|
21 | + if (!isset($attr[ 'name' ])) { |
|
22 | 22 | return $attr; |
23 | 23 | } |
24 | 24 | $id = $this->confiscateAttr($attr, 'name'); |
25 | - if (isset($attr['id'])) { |
|
25 | + if (isset($attr[ 'id' ])) { |
|
26 | 26 | return $attr; |
27 | 27 | } |
28 | - $attr['id'] = $id; |
|
28 | + $attr[ 'id' ] = $id; |
|
29 | 29 | return $attr; |
30 | 30 | } |
31 | 31 | } |