@@ -103,9 +103,9 @@ |
||
103 | 103 | $parent_def = $definition->info_parent_def; |
104 | 104 | $stack = array( |
105 | 105 | array($top_node, |
106 | - $parent_def->descendants_are_inline, |
|
107 | - $parent_def->excludes, // exclusions |
|
108 | - 0) |
|
106 | + $parent_def->descendants_are_inline, |
|
107 | + $parent_def->excludes, // exclusions |
|
108 | + 0) |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | while (!empty($stack)) { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $context->register('IsInline', $is_inline); |
62 | 62 | |
63 | 63 | // setup error collector |
64 | - $e =& $context->get('ErrorCollector', true); |
|
64 | + $e = & $context->get('ErrorCollector', true); |
|
65 | 65 | |
66 | 66 | //####################################################################// |
67 | 67 | // Loop initialization |
@@ -128,19 +128,25 @@ discard block |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | }; |
131 | - if ($go) continue; |
|
131 | + if ($go) { |
|
132 | + continue; |
|
133 | + } |
|
132 | 134 | list($token, $d) = $node->toTokenPair(); |
133 | 135 | // base case |
134 | 136 | if ($excludes_enabled && isset($excludes[$node->name])) { |
135 | 137 | $node->dead = true; |
136 | - if ($e) $e->send(E_ERROR, 'Strategy_FixNesting: Node excluded'); |
|
138 | + if ($e) { |
|
139 | + $e->send(E_ERROR, 'Strategy_FixNesting: Node excluded'); |
|
140 | + } |
|
137 | 141 | } else { |
138 | 142 | // XXX I suppose it would be slightly more efficient to |
139 | 143 | // avoid the allocation here and have children |
140 | 144 | // strategies handle it |
141 | 145 | $children = array(); |
142 | 146 | foreach ($node->children as $child) { |
143 | - if (!$child->dead) $children[] = $child; |
|
147 | + if (!$child->dead) { |
|
148 | + $children[] = $child; |
|
149 | + } |
|
144 | 150 | } |
145 | 151 | $result = $def->child->validateChildren($children, $config, $context); |
146 | 152 | if ($result === true) { |
@@ -148,7 +154,9 @@ discard block |
||
148 | 154 | $node->children = $children; |
149 | 155 | } elseif ($result === false) { |
150 | 156 | $node->dead = true; |
151 | - if ($e) $e->send(E_ERROR, 'Strategy_FixNesting: Node removed'); |
|
157 | + if ($e) { |
|
158 | + $e->send(E_ERROR, 'Strategy_FixNesting: Node removed'); |
|
159 | + } |
|
152 | 160 | } else { |
153 | 161 | $node->children = $result; |
154 | 162 | if ($e) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | $e = false; |
57 | 57 | if ($config->get('Core.CollectErrors')) { |
58 | - $e =& $context->get('ErrorCollector'); |
|
58 | + $e = & $context->get('ErrorCollector'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | foreach ($tokens as $token) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function setup() |
76 | 76 | { |
77 | 77 | $this->validator = new HTMLPurifier_AttrDef_Lang(); |
78 | - $this->dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier'; |
|
78 | + $this->dir = HTMLPURIFIER_PREFIX.'/HTMLPurifier'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | if ($code == 'en') { |
108 | 108 | $lang = new HTMLPurifier_Language($config, $context); |
109 | 109 | } else { |
110 | - $class = 'HTMLPurifier_Language_' . $pcode; |
|
111 | - $file = $this->dir . '/Language/classes/' . $code . '.php'; |
|
110 | + $class = 'HTMLPurifier_Language_'.$pcode; |
|
111 | + $file = $this->dir.'/Language/classes/'.$code.'.php'; |
|
112 | 112 | if (file_exists($file) || class_exists($class, false)) { |
113 | 113 | $lang = new $class($config, $context); |
114 | 114 | } else { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | // generate filename |
156 | - $filename = $this->dir . '/Language/messages/' . $code . '.php'; |
|
156 | + $filename = $this->dir.'/Language/messages/'.$code.'.php'; |
|
157 | 157 | |
158 | 158 | // default fallback : may be overwritten by the ensuing include |
159 | 159 | $fallback = ($code != 'en') ? 'en' : false; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // load primary localisation |
162 | 162 | if (!file_exists($filename)) { |
163 | 163 | // skip the include: will rely solely on fallback |
164 | - $filename = $this->dir . '/Language/messages/en.php'; |
|
164 | + $filename = $this->dir.'/Language/messages/en.php'; |
|
165 | 165 | $cache = array(); |
166 | 166 | } else { |
167 | 167 | include $filename; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // infinite recursion guard |
175 | 175 | if (isset($languages_seen[$code])) { |
176 | 176 | trigger_error( |
177 | - 'Circular fallback reference in language ' . |
|
177 | + 'Circular fallback reference in language '. |
|
178 | 178 | $code, |
179 | 179 | E_USER_ERROR |
180 | 180 | ); |
@@ -31,11 +31,11 @@ |
||
31 | 31 | // Note that ["<>] are an addition to the RFC's recommended |
32 | 32 | // characters, because they represent external delimeters. |
33 | 33 | $r_URI = '!'. |
34 | - '(([a-zA-Z0-9\.\+\-]+):)?'. // 2. Scheme |
|
35 | - '(//([^/?#"<>]*))?'. // 4. Authority |
|
36 | - '([^?#"<>]*)'. // 5. Path |
|
37 | - '(\?([^#"<>]*))?'. // 7. Query |
|
38 | - '(#([^"<>]*))?'. // 8. Fragment |
|
34 | + '(([a-zA-Z0-9\.\+\-]+):)?'.// 2. Scheme |
|
35 | + '(//([^/?#"<>]*))?'.// 4. Authority |
|
36 | + '([^?#"<>]*)'.// 5. Path |
|
37 | + '(\?([^#"<>]*))?'.// 7. Query |
|
38 | + '(#([^"<>]*))?'.// 8. Fragment |
|
39 | 39 | '!'; |
40 | 40 | |
41 | 41 | $matches = array(); |
@@ -41,7 +41,10 @@ |
||
41 | 41 | $matches = array(); |
42 | 42 | $result = preg_match($r_URI, $uri, $matches); |
43 | 43 | |
44 | - if (!$result) return false; // *really* invalid URI |
|
44 | + if (!$result) { |
|
45 | + return false; |
|
46 | + } |
|
47 | + // *really* invalid URI |
|
45 | 48 | |
46 | 49 | // seperate out parts |
47 | 50 | $scheme = !empty($matches[1]) ? $matches[2] : null; |
@@ -113,7 +113,7 @@ |
||
113 | 113 | $uri->port = null; |
114 | 114 | $uri->fragment = null; |
115 | 115 | $uri->query = null; |
116 | - $uri->path = "$content_type;base64," . base64_encode($raw_data); |
|
116 | + $uri->path = "$content_type;base64,".base64_encode($raw_data); |
|
117 | 117 | return true; |
118 | 118 | } |
119 | 119 |
@@ -41,12 +41,12 @@ |
||
41 | 41 | list($key, $typecode) = explode('=', $type, 2); |
42 | 42 | if ($key !== 'type') { |
43 | 43 | // invalid key, tack it back on encoded |
44 | - $uri->path .= '%3B' . $type; |
|
44 | + $uri->path .= '%3B'.$type; |
|
45 | 45 | } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') { |
46 | 46 | $type_ret = ";type=$typecode"; |
47 | 47 | } |
48 | 48 | } else { |
49 | - $uri->path .= '%3B' . $type; |
|
49 | + $uri->path .= '%3B'.$type; |
|
50 | 50 | } |
51 | 51 | $uri->path = str_replace(';', '%3B', $uri->path); |
52 | 52 | $uri->path .= $type_ret; |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | return $var; |
32 | 32 | case self::INT: |
33 | 33 | if (is_string($var) && ctype_digit($var)) { |
34 | - $var = (int)$var; |
|
34 | + $var = (int) $var; |
|
35 | 35 | } |
36 | 36 | return $var; |
37 | 37 | case self::FLOAT: |
38 | 38 | if ((is_string($var) && is_numeric($var)) || is_int($var)) { |
39 | - $var = (float)$var; |
|
39 | + $var = (float) $var; |
|
40 | 40 | } |
41 | 41 | return $var; |
42 | 42 | case self::BOOL: |
43 | 43 | if (is_int($var) && ($var === 0 || $var === 1)) { |
44 | - $var = (bool)$var; |
|
44 | + $var = (bool) $var; |
|
45 | 45 | } elseif (is_string($var)) { |
46 | 46 | if ($var == 'on' || $var == 'true' || $var == '1') { |
47 | 47 | $var = true; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach ($var as $key => $value) { |
112 | 112 | if ($value !== true) { |
113 | 113 | trigger_error( |
114 | - "Lookup array has non-true value at key '$key'; " . |
|
114 | + "Lookup array has non-true value at key '$key'; ". |
|
115 | 115 | "maybe your input array was not indexed numerically", |
116 | 116 | E_USER_WARNING |
117 | 117 | ); |
@@ -195,7 +195,7 @@ |
||
195 | 195 | } |
196 | 196 | continue; |
197 | 197 | } |
198 | - $subst['$' . $i] = $value; |
|
198 | + $subst['$'.$i] = $value; |
|
199 | 199 | } |
200 | 200 | return strtr($raw, $subst); |
201 | 201 | } |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | |
62 | 62 | // handle color transform |
63 | 63 | if (isset($attr['color'])) { |
64 | - $prepend_style .= 'color:' . $attr['color'] . ';'; |
|
64 | + $prepend_style .= 'color:'.$attr['color'].';'; |
|
65 | 65 | unset($attr['color']); |
66 | 66 | } |
67 | 67 | |
68 | 68 | // handle face transform |
69 | 69 | if (isset($attr['face'])) { |
70 | - $prepend_style .= 'font-family:' . $attr['face'] . ';'; |
|
70 | + $prepend_style .= 'font-family:'.$attr['face'].';'; |
|
71 | 71 | unset($attr['face']); |
72 | 72 | } |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | // normalize large numbers |
77 | 77 | if ($attr['size'] !== '') { |
78 | 78 | if ($attr['size']{0} == '+' || $attr['size']{0} == '-') { |
79 | - $size = (int)$attr['size']; |
|
79 | + $size = (int) $attr['size']; |
|
80 | 80 | if ($size < -2) { |
81 | 81 | $attr['size'] = '-2'; |
82 | 82 | } |
@@ -84,23 +84,22 @@ discard block |
||
84 | 84 | $attr['size'] = '+4'; |
85 | 85 | } |
86 | 86 | } else { |
87 | - $size = (int)$attr['size']; |
|
87 | + $size = (int) $attr['size']; |
|
88 | 88 | if ($size > 7) { |
89 | 89 | $attr['size'] = '7'; |
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | 93 | if (isset($this->_size_lookup[$attr['size']])) { |
94 | - $prepend_style .= 'font-size:' . |
|
95 | - $this->_size_lookup[$attr['size']] . ';'; |
|
94 | + $prepend_style .= 'font-size:'. |
|
95 | + $this->_size_lookup[$attr['size']].';'; |
|
96 | 96 | } |
97 | 97 | unset($attr['size']); |
98 | 98 | } |
99 | 99 | |
100 | 100 | if ($prepend_style) { |
101 | 101 | $attr['style'] = isset($attr['style']) ? |
102 | - $prepend_style . $attr['style'] : |
|
103 | - $prepend_style; |
|
102 | + $prepend_style.$attr['style'] : $prepend_style; |
|
104 | 103 | } |
105 | 104 | |
106 | 105 | $new_tag = clone $tag; |