@@ -25,28 +25,28 @@ discard block |
||
25 | 25 | // load extensions from the modules |
26 | 26 | foreach ($modules as $module) { |
27 | 27 | foreach ($module->attr_collections as $coll_i => $coll) { |
28 | - if (!isset($this->info[$coll_i])) { |
|
29 | - $this->info[$coll_i] = array(); |
|
28 | + if (!isset($this->info[ $coll_i ])) { |
|
29 | + $this->info[ $coll_i ] = array(); |
|
30 | 30 | } |
31 | 31 | foreach ($coll as $attr_i => $attr) { |
32 | - if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) { |
|
32 | + if ($attr_i === 0 && isset($this->info[ $coll_i ][ $attr_i ])) { |
|
33 | 33 | // merge in includes |
34 | - $this->info[$coll_i][$attr_i] = array_merge( |
|
35 | - $this->info[$coll_i][$attr_i], |
|
34 | + $this->info[ $coll_i ][ $attr_i ] = array_merge( |
|
35 | + $this->info[ $coll_i ][ $attr_i ], |
|
36 | 36 | $attr |
37 | 37 | ); |
38 | 38 | continue; |
39 | 39 | } |
40 | - $this->info[$coll_i][$attr_i] = $attr; |
|
40 | + $this->info[ $coll_i ][ $attr_i ] = $attr; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | // perform internal expansions and inclusions |
45 | 45 | foreach ($this->info as $name => $attr) { |
46 | 46 | // merge attribute collections that include others |
47 | - $this->performInclusions($this->info[$name]); |
|
47 | + $this->performInclusions($this->info[ $name ]); |
|
48 | 48 | // replace string identifiers with actual attribute objects |
49 | - $this->expandIdentifiers($this->info[$name], $attr_types); |
|
49 | + $this->expandIdentifiers($this->info[ $name ], $attr_types); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -57,33 +57,33 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function performInclusions(&$attr) |
59 | 59 | { |
60 | - if (!isset($attr[0])) { |
|
60 | + if (!isset($attr[ 0 ])) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | - $merge = $attr[0]; |
|
63 | + $merge = $attr[ 0 ]; |
|
64 | 64 | $seen = array(); // recursion guard |
65 | 65 | // loop through all the inclusions |
66 | - for ($i = 0; isset($merge[$i]); $i++) { |
|
67 | - if (isset($seen[$merge[$i]])) { |
|
66 | + for ($i = 0; isset($merge[ $i ]); $i++) { |
|
67 | + if (isset($seen[ $merge[ $i ] ])) { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | - $seen[$merge[$i]] = true; |
|
70 | + $seen[ $merge[ $i ] ] = true; |
|
71 | 71 | // foreach attribute of the inclusion, copy it over |
72 | - if (!isset($this->info[$merge[$i]])) { |
|
72 | + if (!isset($this->info[ $merge[ $i ] ])) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | - foreach ($this->info[$merge[$i]] as $key => $value) { |
|
76 | - if (isset($attr[$key])) { |
|
75 | + foreach ($this->info[ $merge[ $i ] ] as $key => $value) { |
|
76 | + if (isset($attr[ $key ])) { |
|
77 | 77 | continue; |
78 | 78 | } // also catches more inclusions |
79 | - $attr[$key] = $value; |
|
79 | + $attr[ $key ] = $value; |
|
80 | 80 | } |
81 | - if (isset($this->info[$merge[$i]][0])) { |
|
81 | + if (isset($this->info[ $merge[ $i ] ][ 0 ])) { |
|
82 | 82 | // recursion |
83 | - $merge = array_merge($merge, $this->info[$merge[$i]][0]); |
|
83 | + $merge = array_merge($merge, $this->info[ $merge[ $i ] ][ 0 ]); |
|
84 | 84 | } |
85 | 85 | } |
86 | - unset($attr[0]); |
|
86 | + unset($attr[ 0 ]); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -104,37 +104,37 @@ discard block |
||
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | |
107 | - if (isset($processed[$def_i])) { |
|
107 | + if (isset($processed[ $def_i ])) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | 111 | // determine whether or not attribute is required |
112 | 112 | if ($required = (strpos($def_i, '*') !== false)) { |
113 | 113 | // rename the definition |
114 | - unset($attr[$def_i]); |
|
114 | + unset($attr[ $def_i ]); |
|
115 | 115 | $def_i = trim($def_i, '*'); |
116 | - $attr[$def_i] = $def; |
|
116 | + $attr[ $def_i ] = $def; |
|
117 | 117 | } |
118 | 118 | |
119 | - $processed[$def_i] = true; |
|
119 | + $processed[ $def_i ] = true; |
|
120 | 120 | |
121 | 121 | // if we've already got a literal object, move on |
122 | 122 | if (is_object($def)) { |
123 | 123 | // preserve previous required |
124 | - $attr[$def_i]->required = ($required || $attr[$def_i]->required); |
|
124 | + $attr[ $def_i ]->required = ($required || $attr[ $def_i ]->required); |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($def === false) { |
129 | - unset($attr[$def_i]); |
|
129 | + unset($attr[ $def_i ]); |
|
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | |
133 | 133 | if ($t = $attr_types->get($def)) { |
134 | - $attr[$def_i] = $t; |
|
135 | - $attr[$def_i]->required = $required; |
|
134 | + $attr[ $def_i ] = $t; |
|
135 | + $attr[ $def_i ]->required = $required; |
|
136 | 136 | } else { |
137 | - unset($attr[$def_i]); |
|
137 | + unset($attr[ $def_i ]); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function add($id) |
37 | 37 | { |
38 | - if (isset($this->ids[$id])) { |
|
38 | + if (isset($this->ids[ $id ])) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | - return $this->ids[$id] = true; |
|
41 | + return $this->ids[ $id ] = true; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function load($array_of_ids) |
50 | 50 | { |
51 | 51 | foreach ($array_of_ids as $id) { |
52 | - $this->ids[$id] = true; |
|
52 | + $this->ids[ $id ] = true; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function offsetGet($index) |
24 | 24 | { |
25 | - $this->accessed[$index] = true; |
|
25 | + $this->accessed[ $index ] = true; |
|
26 | 26 | return parent::offsetGet($index); |
27 | 27 | } |
28 | 28 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->base = $def->base; |
30 | 30 | if (is_null($this->base)) { |
31 | 31 | trigger_error( |
32 | - 'URI.MakeAbsolute is being ignored due to lack of ' . |
|
32 | + 'URI.MakeAbsolute is being ignored due to lack of '. |
|
33 | 33 | 'value for URI.Base configuration', |
34 | 34 | E_USER_WARNING |
35 | 35 | ); |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | if ($uri->path === '') { |
84 | 84 | $uri->path = $this->base->path; |
85 | - } elseif ($uri->path[0] !== '/') { |
|
85 | + } elseif ($uri->path[ 0 ] !== '/') { |
|
86 | 86 | // relative path, needs more complicated processing |
87 | 87 | $stack = explode('/', $uri->path); |
88 | 88 | $new_stack = array_merge($this->basePathStack, $stack); |
89 | - if ($new_stack[0] !== '' && !is_null($this->base->host)) { |
|
89 | + if ($new_stack[ 0 ] !== '' && !is_null($this->base->host)) { |
|
90 | 90 | array_unshift($new_stack, ''); |
91 | 91 | } |
92 | 92 | $new_stack = $this->_collapseStack($new_stack); |
@@ -118,38 +118,38 @@ discard block |
||
118 | 118 | { |
119 | 119 | $result = array(); |
120 | 120 | $is_folder = false; |
121 | - for ($i = 0; isset($stack[$i]); $i++) { |
|
121 | + for ($i = 0; isset($stack[ $i ]); $i++) { |
|
122 | 122 | $is_folder = false; |
123 | 123 | // absorb an internally duplicated slash |
124 | - if ($stack[$i] == '' && $i && isset($stack[$i + 1])) { |
|
124 | + if ($stack[ $i ] == '' && $i && isset($stack[ $i + 1 ])) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | - if ($stack[$i] == '..') { |
|
127 | + if ($stack[ $i ] == '..') { |
|
128 | 128 | if (!empty($result)) { |
129 | 129 | $segment = array_pop($result); |
130 | 130 | if ($segment === '' && empty($result)) { |
131 | 131 | // error case: attempted to back out too far: |
132 | 132 | // restore the leading slash |
133 | - $result[] = ''; |
|
133 | + $result[ ] = ''; |
|
134 | 134 | } elseif ($segment === '..') { |
135 | - $result[] = '..'; // cannot remove .. with .. |
|
135 | + $result[ ] = '..'; // cannot remove .. with .. |
|
136 | 136 | } |
137 | 137 | } else { |
138 | 138 | // relative path, preserve the double-dots |
139 | - $result[] = '..'; |
|
139 | + $result[ ] = '..'; |
|
140 | 140 | } |
141 | 141 | $is_folder = true; |
142 | 142 | continue; |
143 | 143 | } |
144 | - if ($stack[$i] == '.') { |
|
144 | + if ($stack[ $i ] == '.') { |
|
145 | 145 | // silently absorb |
146 | 146 | $is_folder = true; |
147 | 147 | continue; |
148 | 148 | } |
149 | - $result[] = $stack[$i]; |
|
149 | + $result[ ] = $stack[ $i ]; |
|
150 | 150 | } |
151 | 151 | if ($is_folder) { |
152 | - $result[] = ''; |
|
152 | + $result[ ] = ''; |
|
153 | 153 | } |
154 | 154 | return $result; |
155 | 155 | } |
@@ -40,10 +40,10 @@ |
||
40 | 40 | } |
41 | 41 | $host_parts = array_reverse(explode('.', $uri->host)); |
42 | 42 | foreach ($this->ourHostParts as $i => $x) { |
43 | - if (!isset($host_parts[$i])) { |
|
43 | + if (!isset($host_parts[ $i ])) { |
|
44 | 44 | return false; |
45 | 45 | } |
46 | - if ($host_parts[$i] != $this->ourHostParts[$i]) { |
|
46 | + if ($host_parts[ $i ] != $this->ourHostParts[ $i ]) { |
|
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function prepare($config) |
45 | 45 | { |
46 | - $this->target = $config->get('URI.' . $this->name); |
|
46 | + $this->target = $config->get('URI.'.$this->name); |
|
47 | 47 | $this->parser = new HTMLPurifier_URIParser(); |
48 | 48 | $this->doEmbed = $config->get('URI.MungeResources'); |
49 | 49 | $this->secretKey = $config->get('URI.MungeSecretKey'); |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | { |
100 | 100 | $string = $uri->toString(); |
101 | 101 | // always available |
102 | - $this->replace['%s'] = $string; |
|
103 | - $this->replace['%r'] = $context->get('EmbeddedURI', true); |
|
102 | + $this->replace[ '%s' ] = $string; |
|
103 | + $this->replace[ '%r' ] = $context->get('EmbeddedURI', true); |
|
104 | 104 | $token = $context->get('CurrentToken', true); |
105 | - $this->replace['%n'] = $token ? $token->name : null; |
|
106 | - $this->replace['%m'] = $context->get('CurrentAttr', true); |
|
107 | - $this->replace['%p'] = $context->get('CurrentCSSProperty', true); |
|
105 | + $this->replace[ '%n' ] = $token ? $token->name : null; |
|
106 | + $this->replace[ '%m' ] = $context->get('CurrentAttr', true); |
|
107 | + $this->replace[ '%p' ] = $context->get('CurrentCSSProperty', true); |
|
108 | 108 | // not always available |
109 | 109 | if ($this->secretKey) { |
110 | - $this->replace['%t'] = hash_hmac("sha256", $string, $this->secretKey); |
|
110 | + $this->replace[ '%t' ] = hash_hmac("sha256", $string, $this->secretKey); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
@@ -32,8 +32,8 @@ |
||
32 | 32 | public function generateKey($config) |
33 | 33 | { |
34 | 34 | return $config->version . ',' . // possibly replace with function calls |
35 | - $config->getBatchSerial($this->type) . ',' . |
|
36 | - $config->get($this->type . '.DefinitionRev'); |
|
35 | + $config->getBatchSerial($this->type) . ',' . |
|
36 | + $config->get($this->type . '.DefinitionRev'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function generateKey($config) |
33 | 33 | { |
34 | - return $config->version . ',' . // possibly replace with function calls |
|
35 | - $config->getBatchSerial($this->type) . ',' . |
|
36 | - $config->get($this->type . '.DefinitionRev'); |
|
34 | + return $config->version.','.// possibly replace with function calls |
|
35 | + $config->getBatchSerial($this->type).','. |
|
36 | + $config->get($this->type.'.DefinitionRev'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | // versions match, ids match, check revision number |
58 | 58 | if ($hash == $config->getBatchSerial($this->type) && |
59 | - $revision < $config->get($this->type . '.DefinitionRev')) { |
|
59 | + $revision < $config->get($this->type.'.DefinitionRev')) { |
|
60 | 60 | return true; |
61 | 61 | } |
62 | 62 | return false; |
@@ -57,18 +57,18 @@ discard block |
||
57 | 57 | $dtd_system |
58 | 58 | ); |
59 | 59 | } |
60 | - $this->doctypes[$doctype->name] = $doctype; |
|
60 | + $this->doctypes[ $doctype->name ] = $doctype; |
|
61 | 61 | $name = $doctype->name; |
62 | 62 | // hookup aliases |
63 | 63 | foreach ($doctype->aliases as $alias) { |
64 | - if (isset($this->doctypes[$alias])) { |
|
64 | + if (isset($this->doctypes[ $alias ])) { |
|
65 | 65 | continue; |
66 | 66 | } |
67 | - $this->aliases[$alias] = $name; |
|
67 | + $this->aliases[ $alias ] = $name; |
|
68 | 68 | } |
69 | 69 | // remove old aliases |
70 | - if (isset($this->aliases[$name])) { |
|
71 | - unset($this->aliases[$name]); |
|
70 | + if (isset($this->aliases[ $name ])) { |
|
71 | + unset($this->aliases[ $name ]); |
|
72 | 72 | } |
73 | 73 | return $doctype; |
74 | 74 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function get($doctype) |
84 | 84 | { |
85 | - if (isset($this->aliases[$doctype])) { |
|
86 | - $doctype = $this->aliases[$doctype]; |
|
85 | + if (isset($this->aliases[ $doctype ])) { |
|
86 | + $doctype = $this->aliases[ $doctype ]; |
|
87 | 87 | } |
88 | - if (!isset($this->doctypes[$doctype])) { |
|
89 | - trigger_error('Doctype ' . htmlspecialchars($doctype) . ' does not exist', E_USER_ERROR); |
|
88 | + if (!isset($this->doctypes[ $doctype ])) { |
|
89 | + trigger_error('Doctype '.htmlspecialchars($doctype).' does not exist', E_USER_ERROR); |
|
90 | 90 | $anon = new HTMLPurifier_Doctype($doctype); |
91 | 91 | return $anon; |
92 | 92 | } |
93 | - return $this->doctypes[$doctype]; |
|
93 | + return $this->doctypes[ $doctype ]; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -29,8 +29,8 @@ |
||
29 | 29 | */ |
30 | 30 | protected function prependCSS(&$attr, $css) |
31 | 31 | { |
32 | - $attr['style'] = isset($attr['style']) ? $attr['style'] : ''; |
|
33 | - $attr['style'] = $css . $attr['style']; |
|
32 | + $attr[ 'style' ] = isset($attr[ 'style' ]) ? $attr[ 'style' ] : ''; |
|
33 | + $attr[ 'style' ] = $css.$attr[ 'style' ]; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 |