@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $decorator = $this->copy(); |
30 | 30 | // reference is necessary for mocks in PHP 4 |
31 | - $decorator->cache =& $cache; |
|
31 | + $decorator->cache = & $cache; |
|
32 | 32 | $decorator->type = $cache->type; |
33 | 33 | return $decorator; |
34 | 34 | } |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | if (empty($filename)) { |
102 | 102 | continue; |
103 | 103 | } |
104 | - if ($filename[0] === '.') { |
|
104 | + if ($filename[ 0 ] === '.') { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | - unlink($dir . '/' . $filename); |
|
107 | + unlink($dir.'/'.$filename); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | if (empty($filename)) { |
124 | 124 | continue; |
125 | 125 | } |
126 | - if ($filename[0] === '.') { |
|
126 | + if ($filename[ 0 ] === '.') { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | $key = substr($filename, 0, strlen($filename) - 4); |
130 | 130 | if ($this->isOld($key, $config)) { |
131 | - unlink($dir . '/' . $filename); |
|
131 | + unlink($dir.'/'.$filename); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function generateFilePath($config) |
144 | 144 | { |
145 | 145 | $key = $this->generateKey($config); |
146 | - return $this->generateDirectoryPath($config) . '/' . $key . '.ser'; |
|
146 | + return $this->generateDirectoryPath($config).'/'.$key.'.ser'; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public function generateDirectoryPath($config) |
157 | 157 | { |
158 | 158 | $base = $this->generateBaseDirectoryPath($config); |
159 | - return $base . '/' . $this->type; |
|
159 | + return $base.'/'.$this->type; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function generateBaseDirectoryPath($config) |
170 | 170 | { |
171 | 171 | $base = $config->get('Cache.SerializerPath'); |
172 | - $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base; |
|
172 | + $base = is_null($base) ? HTMLPURIFIER_PREFIX.'/HTMLPurifier/DefinitionCache/Serializer' : $base; |
|
173 | 173 | return $base; |
174 | 174 | } |
175 | 175 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $base = $this->generateBaseDirectoryPath($config); |
212 | 212 | if (!is_dir($base)) { |
213 | 213 | trigger_error( |
214 | - 'Base directory ' . $base . ' does not exist, |
|
214 | + 'Base directory '.$base.' does not exist, |
|
215 | 215 | please create or change using %Cache.SerializerPath', |
216 | 216 | E_USER_WARNING |
217 | 217 | ); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | mkdir($directory, $chmod); |
223 | 223 | if (!$this->_testPermissions($directory, $chmod)) { |
224 | 224 | trigger_error( |
225 | - 'Base directory ' . $base . ' does not exist, |
|
225 | + 'Base directory '.$base.' does not exist, |
|
226 | 226 | please create or change using %Cache.SerializerPath', |
227 | 227 | E_USER_WARNING |
228 | 228 | ); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | // generally, you'll want to handle this beforehand |
252 | 252 | // so a more specific error message can be given |
253 | 253 | trigger_error( |
254 | - 'Directory ' . $dir . ' does not exist', |
|
254 | + 'Directory '.$dir.' does not exist', |
|
255 | 255 | E_USER_WARNING |
256 | 256 | ); |
257 | 257 | return false; |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | $chmod = $chmod | 0777; |
273 | 273 | } |
274 | 274 | trigger_error( |
275 | - 'Directory ' . $dir . ' not writable, ' . |
|
276 | - 'please chmod to ' . decoct($chmod), |
|
275 | + 'Directory '.$dir.' not writable, '. |
|
276 | + 'please chmod to '.decoct($chmod), |
|
277 | 277 | E_USER_WARNING |
278 | 278 | ); |
279 | 279 | } else { |
280 | 280 | // generic error message |
281 | 281 | trigger_error( |
282 | - 'Directory ' . $dir . ' not writable, ' . |
|
282 | + 'Directory '.$dir.' not writable, '. |
|
283 | 283 | 'please alter file permissions', |
284 | 284 | E_USER_WARNING |
285 | 285 | ); |
@@ -28,56 +28,56 @@ |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | // process primary subtag : $subtags[0] |
31 | - $length = strlen($subtags[0]); |
|
31 | + $length = strlen($subtags[ 0 ]); |
|
32 | 32 | switch ($length) { |
33 | 33 | case 0: |
34 | 34 | return false; |
35 | 35 | case 1: |
36 | - if (!($subtags[0] == 'x' || $subtags[0] == 'i')) { |
|
36 | + if (!($subtags[ 0 ] == 'x' || $subtags[ 0 ] == 'i')) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | break; |
40 | 40 | case 2: |
41 | 41 | case 3: |
42 | - if (!ctype_alpha($subtags[0])) { |
|
42 | + if (!ctype_alpha($subtags[ 0 ])) { |
|
43 | 43 | return false; |
44 | - } elseif (!ctype_lower($subtags[0])) { |
|
45 | - $subtags[0] = strtolower($subtags[0]); |
|
44 | + } elseif (!ctype_lower($subtags[ 0 ])) { |
|
45 | + $subtags[ 0 ] = strtolower($subtags[ 0 ]); |
|
46 | 46 | } |
47 | 47 | break; |
48 | 48 | default: |
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
52 | - $new_string = $subtags[0]; |
|
52 | + $new_string = $subtags[ 0 ]; |
|
53 | 53 | if ($num_subtags == 1) { |
54 | 54 | return $new_string; |
55 | 55 | } |
56 | 56 | |
57 | 57 | // process second subtag : $subtags[1] |
58 | - $length = strlen($subtags[1]); |
|
59 | - if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) { |
|
58 | + $length = strlen($subtags[ 1 ]); |
|
59 | + if ($length == 0 || ($length == 1 && $subtags[ 1 ] != 'x') || $length > 8 || !ctype_alnum($subtags[ 1 ])) { |
|
60 | 60 | return $new_string; |
61 | 61 | } |
62 | - if (!ctype_lower($subtags[1])) { |
|
63 | - $subtags[1] = strtolower($subtags[1]); |
|
62 | + if (!ctype_lower($subtags[ 1 ])) { |
|
63 | + $subtags[ 1 ] = strtolower($subtags[ 1 ]); |
|
64 | 64 | } |
65 | 65 | |
66 | - $new_string .= '-' . $subtags[1]; |
|
66 | + $new_string .= '-'.$subtags[ 1 ]; |
|
67 | 67 | if ($num_subtags == 2) { |
68 | 68 | return $new_string; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // process all other subtags, index 2 and up |
72 | 72 | for ($i = 2; $i < $num_subtags; $i++) { |
73 | - $length = strlen($subtags[$i]); |
|
74 | - if ($length == 0 || $length > 8 || !ctype_alnum($subtags[$i])) { |
|
73 | + $length = strlen($subtags[ $i ]); |
|
74 | + if ($length == 0 || $length > 8 || !ctype_alnum($subtags[ $i ])) { |
|
75 | 75 | return $new_string; |
76 | 76 | } |
77 | - if (!ctype_lower($subtags[$i])) { |
|
78 | - $subtags[$i] = strtolower($subtags[$i]); |
|
77 | + if (!ctype_lower($subtags[ $i ])) { |
|
78 | + $subtags[ $i ] = strtolower($subtags[ $i ]); |
|
79 | 79 | } |
80 | - $new_string .= '-' . $subtags[$i]; |
|
80 | + $new_string .= '-'.$subtags[ $i ]; |
|
81 | 81 | } |
82 | 82 | return $new_string; |
83 | 83 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | public function __construct($config) |
21 | 21 | { |
22 | 22 | $def = $config->getCSSDefinition(); |
23 | - $this->info['list-style-type'] = $def->info['list-style-type']; |
|
24 | - $this->info['list-style-position'] = $def->info['list-style-position']; |
|
25 | - $this->info['list-style-image'] = $def->info['list-style-image']; |
|
23 | + $this->info[ 'list-style-type' ] = $def->info[ 'list-style-type' ]; |
|
24 | + $this->info[ 'list-style-position' ] = $def->info[ 'list-style-position' ]; |
|
25 | + $this->info[ 'list-style-image' ] = $def->info[ 'list-style-image' ]; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $bits = explode(' ', strtolower($string)); // bits to process |
44 | 44 | |
45 | 45 | $caught = array(); |
46 | - $caught['type'] = false; |
|
47 | - $caught['position'] = false; |
|
48 | - $caught['image'] = false; |
|
46 | + $caught[ 'type' ] = false; |
|
47 | + $caught[ 'position' ] = false; |
|
48 | + $caught[ 'image' ] = false; |
|
49 | 49 | |
50 | 50 | $i = 0; // number of catches |
51 | 51 | $none = false; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($status !== false) { |
62 | 62 | continue; |
63 | 63 | } |
64 | - $r = $this->info['list-style-' . $key]->validate($bit, $config, $context); |
|
64 | + $r = $this->info[ 'list-style-'.$key ]->validate($bit, $config, $context); |
|
65 | 65 | if ($r === false) { |
66 | 66 | continue; |
67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | continue; |
76 | 76 | } |
77 | 77 | } |
78 | - $caught[$key] = $r; |
|
78 | + $caught[ $key ] = $r; |
|
79 | 79 | $i++; |
80 | 80 | break; |
81 | 81 | } |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | $ret = array(); |
89 | 89 | |
90 | 90 | // construct type |
91 | - if ($caught['type']) { |
|
92 | - $ret[] = $caught['type']; |
|
91 | + if ($caught[ 'type' ]) { |
|
92 | + $ret[ ] = $caught[ 'type' ]; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // construct image |
96 | - if ($caught['image']) { |
|
97 | - $ret[] = $caught['image']; |
|
96 | + if ($caught[ 'image' ]) { |
|
97 | + $ret[ ] = $caught[ 'image' ]; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // construct position |
101 | - if ($caught['position']) { |
|
102 | - $ret[] = $caught['position']; |
|
101 | + if ($caught[ 'position' ]) { |
|
102 | + $ret[ ] = $caught[ 'position' ]; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if (empty($ret)) { |
@@ -31,8 +31,8 @@ |
||
31 | 31 | $parts = explode(' ', $string); |
32 | 32 | $final = ''; |
33 | 33 | foreach ($parts as $part) { |
34 | - if (isset($allowed_values[$part])) { |
|
35 | - $final .= $part . ' '; |
|
34 | + if (isset($allowed_values[ $part ])) { |
|
35 | + $final .= $part.' '; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | $final = rtrim($final); |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | // match a generic name |
75 | - if (isset($generic_names[$font])) { |
|
76 | - if ($allowed_fonts === null || isset($allowed_fonts[$font])) { |
|
77 | - $final .= $font . ', '; |
|
75 | + if (isset($generic_names[ $font ])) { |
|
76 | + if ($allowed_fonts === null || isset($allowed_fonts[ $font ])) { |
|
77 | + $final .= $font.', '; |
|
78 | 78 | } |
79 | 79 | continue; |
80 | 80 | } |
81 | 81 | // match a quoted name |
82 | - if ($font[0] === '"' || $font[0] === "'") { |
|
82 | + if ($font[ 0 ] === '"' || $font[ 0 ] === "'") { |
|
83 | 83 | $length = strlen($font); |
84 | 84 | if ($length <= 2) { |
85 | 85 | continue; |
86 | 86 | } |
87 | - $quote = $font[0]; |
|
88 | - if ($font[$length - 1] !== $quote) { |
|
87 | + $quote = $font[ 0 ]; |
|
88 | + if ($font[ $length - 1 ] !== $quote) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | $font = substr($font, 1, $length - 2); |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | |
96 | 96 | // $font is a pure representation of the font name |
97 | 97 | |
98 | - if ($allowed_fonts !== null && !isset($allowed_fonts[$font])) { |
|
98 | + if ($allowed_fonts !== null && !isset($allowed_fonts[ $font ])) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
102 | 102 | if (ctype_alnum($font) && $font !== '') { |
103 | 103 | // very simple font, allow it in unharmed |
104 | - $final .= $font . ', '; |
|
104 | + $final .= $font.', '; |
|
105 | 105 | continue; |
106 | 106 | } |
107 | 107 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | if ($result === false) { |
21 | 21 | return $result; |
22 | 22 | } |
23 | - $float = (float)$result; |
|
23 | + $float = (float) $result; |
|
24 | 24 | if ($float < 0.0) { |
25 | 25 | $result = '0'; |
26 | 26 | } |
@@ -52,12 +52,12 @@ |
||
52 | 52 | $length = count($parts); |
53 | 53 | $final = ''; |
54 | 54 | for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) { |
55 | - if (ctype_space($parts[$i])) { |
|
55 | + if (ctype_space($parts[ $i ])) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | - $result = $this->single->validate($parts[$i], $config, $context); |
|
58 | + $result = $this->single->validate($parts[ $i ], $config, $context); |
|
59 | 59 | if ($result !== false) { |
60 | - $final .= $result . ' '; |
|
60 | + $final .= $result.' '; |
|
61 | 61 | $num++; |
62 | 62 | } |
63 | 63 | } |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | public function __construct($config) |
21 | 21 | { |
22 | 22 | $def = $config->getCSSDefinition(); |
23 | - $this->info['background-color'] = $def->info['background-color']; |
|
24 | - $this->info['background-image'] = $def->info['background-image']; |
|
25 | - $this->info['background-repeat'] = $def->info['background-repeat']; |
|
26 | - $this->info['background-attachment'] = $def->info['background-attachment']; |
|
27 | - $this->info['background-position'] = $def->info['background-position']; |
|
23 | + $this->info[ 'background-color' ] = $def->info[ 'background-color' ]; |
|
24 | + $this->info[ 'background-image' ] = $def->info[ 'background-image' ]; |
|
25 | + $this->info[ 'background-repeat' ] = $def->info[ 'background-repeat' ]; |
|
26 | + $this->info[ 'background-attachment' ] = $def->info[ 'background-attachment' ]; |
|
27 | + $this->info[ 'background-position' ] = $def->info[ 'background-position' ]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $bits = explode(' ', $string); // bits to process |
49 | 49 | |
50 | 50 | $caught = array(); |
51 | - $caught['color'] = false; |
|
52 | - $caught['image'] = false; |
|
53 | - $caught['repeat'] = false; |
|
54 | - $caught['attachment'] = false; |
|
55 | - $caught['position'] = false; |
|
51 | + $caught[ 'color' ] = false; |
|
52 | + $caught[ 'image' ] = false; |
|
53 | + $caught[ 'repeat' ] = false; |
|
54 | + $caught[ 'attachment' ] = false; |
|
55 | + $caught[ 'position' ] = false; |
|
56 | 56 | |
57 | 57 | $i = 0; // number of catches |
58 | 58 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($status !== false) { |
66 | 66 | continue; |
67 | 67 | } |
68 | - $r = $this->info['background-' . $key]->validate($bit, $config, $context); |
|
68 | + $r = $this->info[ 'background-'.$key ]->validate($bit, $config, $context); |
|
69 | 69 | } else { |
70 | 70 | $r = $bit; |
71 | 71 | } |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | if ($key == 'position') { |
76 | - if ($caught[$key] === false) { |
|
77 | - $caught[$key] = ''; |
|
76 | + if ($caught[ $key ] === false) { |
|
77 | + $caught[ $key ] = ''; |
|
78 | 78 | } |
79 | - $caught[$key] .= $r . ' '; |
|
79 | + $caught[ $key ] .= $r.' '; |
|
80 | 80 | } else { |
81 | - $caught[$key] = $r; |
|
81 | + $caught[ $key ] = $r; |
|
82 | 82 | } |
83 | 83 | $i++; |
84 | 84 | break; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | if (!$i) { |
89 | 89 | return false; |
90 | 90 | } |
91 | - if ($caught['position'] !== false) { |
|
92 | - $caught['position'] = $this->info['background-position']-> |
|
93 | - validate($caught['position'], $config, $context); |
|
91 | + if ($caught[ 'position' ] !== false) { |
|
92 | + $caught[ 'position' ] = $this->info[ 'background-position' ]-> |
|
93 | + validate($caught[ 'position' ], $config, $context); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $ret = array(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if ($value === false) { |
99 | 99 | continue; |
100 | 100 | } |
101 | - $ret[] = $value; |
|
101 | + $ret[ ] = $value; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if (empty($ret)) { |