@@ -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 | } |
@@ -40,29 +40,29 @@ discard block |
||
40 | 40 | { |
41 | 41 | // If we add support for other objects, we'll need to alter the |
42 | 42 | // transforms. |
43 | - switch ($attr['name']) { |
|
43 | + switch ($attr[ 'name' ]) { |
|
44 | 44 | // application/x-shockwave-flash |
45 | 45 | // Keep this synchronized with Injector/SafeObject.php |
46 | 46 | case 'allowScriptAccess': |
47 | - $attr['value'] = 'never'; |
|
47 | + $attr[ 'value' ] = 'never'; |
|
48 | 48 | break; |
49 | 49 | case 'allowNetworking': |
50 | - $attr['value'] = 'internal'; |
|
50 | + $attr[ 'value' ] = 'internal'; |
|
51 | 51 | break; |
52 | 52 | case 'allowFullScreen': |
53 | 53 | if ($config->get('HTML.FlashAllowFullScreen')) { |
54 | - $attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false'; |
|
54 | + $attr[ 'value' ] = ($attr[ 'value' ] == 'true') ? 'true' : 'false'; |
|
55 | 55 | } else { |
56 | - $attr['value'] = 'false'; |
|
56 | + $attr[ 'value' ] = 'false'; |
|
57 | 57 | } |
58 | 58 | break; |
59 | 59 | case 'wmode': |
60 | - $attr['value'] = $this->wmode->validate($attr['value'], $config, $context); |
|
60 | + $attr[ 'value' ] = $this->wmode->validate($attr[ 'value' ], $config, $context); |
|
61 | 61 | break; |
62 | 62 | case 'movie': |
63 | 63 | case 'src': |
64 | - $attr['name'] = "movie"; |
|
65 | - $attr['value'] = $this->uri->validate($attr['value'], $config, $context); |
|
64 | + $attr[ 'name' ] = "movie"; |
|
65 | + $attr[ 'value' ] = $this->uri->validate($attr[ 'value' ], $config, $context); |
|
66 | 66 | break; |
67 | 67 | case 'flashvars': |
68 | 68 | // we're going to allow arbitrary inputs to the SWF, on |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | break; |
71 | 71 | // add other cases to support other param name/value pairs |
72 | 72 | default: |
73 | - $attr['name'] = $attr['value'] = null; |
|
73 | + $attr[ 'name' ] = $attr[ 'value' ] = null; |
|
74 | 74 | } |
75 | 75 | return $attr; |
76 | 76 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | */ |
14 | 14 | public function transform($attr, $config, $context) |
15 | 15 | { |
16 | - if (!isset($attr['type'])) { |
|
17 | - $attr['type'] = 'text/javascript'; |
|
16 | + if (!isset($attr[ 'type' ])) { |
|
17 | + $attr[ 'type' ] = 'text/javascript'; |
|
18 | 18 | } |
19 | 19 | return $attr; |
20 | 20 | } |
@@ -26,23 +26,23 @@ |
||
26 | 26 | */ |
27 | 27 | public function transform($attr, $config, $context) |
28 | 28 | { |
29 | - if (!isset($attr['href'])) { |
|
29 | + if (!isset($attr[ 'href' ])) { |
|
30 | 30 | return $attr; |
31 | 31 | } |
32 | 32 | |
33 | 33 | // XXX Kind of inefficient |
34 | - $url = $this->parser->parse($attr['href']); |
|
34 | + $url = $this->parser->parse($attr[ 'href' ]); |
|
35 | 35 | $scheme = $url->getSchemeObj($config, $context); |
36 | 36 | |
37 | 37 | if ($scheme->browsable && !$url->isLocal($config, $context)) { |
38 | - if (isset($attr['rel'])) { |
|
39 | - $rels = explode(' ', $attr['rel']); |
|
38 | + if (isset($attr[ 'rel' ])) { |
|
39 | + $rels = explode(' ', $attr[ 'rel' ]); |
|
40 | 40 | if (!in_array('nofollow', $rels)) { |
41 | - $rels[] = 'nofollow'; |
|
41 | + $rels[ ] = 'nofollow'; |
|
42 | 42 | } |
43 | - $attr['rel'] = implode(' ', $rels); |
|
43 | + $attr[ 'rel' ] = implode(' ', $rels); |
|
44 | 44 | } else { |
45 | - $attr['rel'] = 'nofollow'; |
|
45 | + $attr[ 'rel' ] = 'nofollow'; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | return $attr; |