@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | ->withQuery(''); |
19 | 19 | |
20 | 20 | if ($uriConfig = config()->offsetGet('uri')) { |
21 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
21 | + if ( ! empty($uriConfig['base'])) { |
|
22 | 22 | $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
23 | - $uriConfig[ 'base' ]); |
|
23 | + $uriConfig['base']); |
|
24 | 24 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
25 | 25 | } |
26 | 26 | } |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | ->withQuery(''); |
46 | 46 | |
47 | 47 | if ($uriConfig = config()->offsetGet('uri')) { |
48 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
48 | + if ( ! empty($uriConfig['base'])) { |
|
49 | 49 | $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
50 | - $uriConfig[ 'base' ]); |
|
50 | + $uriConfig['base']); |
|
51 | 51 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - if(isset($subdomain)) { |
|
55 | + if (isset($subdomain)) { |
|
56 | 56 | $uri = $uri->withSubDomain($subdomain); |
57 | 57 | } |
58 | 58 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $url = parse_url($uri); |
172 | 172 | |
173 | - if ( ! $url or ! isset($url[ 'scheme' ])) { |
|
173 | + if ( ! $url or ! isset($url['scheme'])) { |
|
174 | 174 | return (is_https() ? 'https://' : 'http://') . $uri; |
175 | 175 | } |
176 | 176 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | function redirect_url($uri = '', $method = 'auto', $code = null) |
199 | 199 | { |
200 | - if(is_array($uri)) { |
|
200 | + if (is_array($uri)) { |
|
201 | 201 | $uri = implode('/', $uri); |
202 | 202 | } |
203 | 203 | |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // IIS environment likely? Use 'refresh' for better compatibility |
209 | - if ($method === 'auto' && isset($_SERVER[ 'SERVER_SOFTWARE' ]) && strpos( |
|
210 | - $_SERVER[ 'SERVER_SOFTWARE' ], |
|
209 | + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos( |
|
210 | + $_SERVER['SERVER_SOFTWARE'], |
|
211 | 211 | 'Microsoft-IIS' |
212 | 212 | ) !== false |
213 | 213 | ) { |
214 | 214 | $method = 'refresh'; |
215 | 215 | } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) { |
216 | - if (isset($_SERVER[ 'SERVER_PROTOCOL' ], $_SERVER[ 'REQUEST_METHOD' ]) && $_SERVER[ 'SERVER_PROTOCOL' ] === 'HTTP/1.1') { |
|
217 | - $code = ($_SERVER[ 'REQUEST_METHOD' ] !== 'GET') |
|
216 | + if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') { |
|
217 | + $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
|
218 | 218 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
219 | 219 | : 307; |
220 | 220 | } else { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $source_code, $matches); |
57 | 57 | |
58 | - return str_replace($matches[ 0 ], $matches[ 1 ], $source_code); |
|
58 | + return str_replace($matches[0], $matches[1], $source_code); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | // ------------------------------------------------------------------------ |
@@ -106,46 +106,46 @@ discard block |
||
106 | 106 | if (strlen($allowed_tags) > 0) { |
107 | 107 | $k = explode('|', $allowed_tags); |
108 | 108 | for ($i = 0; $i < count($k); $i++) { |
109 | - $source_code = str_replace('<' . $k[ $i ], '[{(' . $k[ $i ], $source_code); |
|
110 | - $source_code = str_replace('</' . $k[ $i ], '[{(/' . $k[ $i ], $source_code); |
|
109 | + $source_code = str_replace('<' . $k[$i], '[{(' . $k[$i], $source_code); |
|
110 | + $source_code = str_replace('</' . $k[$i], '[{(/' . $k[$i], $source_code); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | //begin removal |
114 | 114 | //remove comment blocks |
115 | 115 | while (stripos($source_code, '<!--') > 0) { |
116 | - $pos[ 1 ] = stripos($source_code, '<!--'); |
|
117 | - $pos[ 2 ] = stripos($source_code, '-->', $pos[ 1 ]); |
|
118 | - $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 3; |
|
119 | - $x = substr($source_code, $pos[ 1 ], $len[ 1 ]); |
|
116 | + $pos[1] = stripos($source_code, '<!--'); |
|
117 | + $pos[2] = stripos($source_code, '-->', $pos[1]); |
|
118 | + $len[1] = $pos[2] - $pos[1] + 3; |
|
119 | + $x = substr($source_code, $pos[1], $len[1]); |
|
120 | 120 | $source_code = str_replace($x, '', $source_code); |
121 | 121 | } |
122 | 122 | //remove tags with content between them |
123 | 123 | if (strlen($disallowed_tags) > 0) { |
124 | 124 | $e = explode('|', $disallowed_tags); |
125 | 125 | for ($i = 0; $i < count($e); $i++) { |
126 | - while (stripos($source_code, '<' . $e[ $i ]) > 0) { |
|
127 | - $len[ 1 ] = strlen('<' . $e[ $i ]); |
|
128 | - $pos[ 1 ] = stripos($source_code, '<' . $e[ $i ]); |
|
129 | - $pos[ 2 ] = stripos($source_code, $e[ $i ] . '>', $pos[ 1 ] + $len[ 1 ]); |
|
130 | - $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ]; |
|
131 | - $x = substr($source_code, $pos[ 1 ], $len[ 2 ]); |
|
126 | + while (stripos($source_code, '<' . $e[$i]) > 0) { |
|
127 | + $len[1] = strlen('<' . $e[$i]); |
|
128 | + $pos[1] = stripos($source_code, '<' . $e[$i]); |
|
129 | + $pos[2] = stripos($source_code, $e[$i] . '>', $pos[1] + $len[1]); |
|
130 | + $len[2] = $pos[2] - $pos[1] + $len[1]; |
|
131 | + $x = substr($source_code, $pos[1], $len[2]); |
|
132 | 132 | $source_code = str_replace($x, '', $source_code); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | 136 | //remove remaining tags |
137 | 137 | while (stripos($source_code, '<') > 0) { |
138 | - $pos[ 1 ] = stripos($source_code, '<'); |
|
139 | - $pos[ 2 ] = stripos($source_code, '>', $pos[ 1 ]); |
|
140 | - $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1; |
|
141 | - $x = substr($source_code, $pos[ 1 ], $len[ 1 ]); |
|
138 | + $pos[1] = stripos($source_code, '<'); |
|
139 | + $pos[2] = stripos($source_code, '>', $pos[1]); |
|
140 | + $len[1] = $pos[2] - $pos[1] + 1; |
|
141 | + $x = substr($source_code, $pos[1], $len[1]); |
|
142 | 142 | $source_code = str_replace($x, '', $source_code); |
143 | 143 | } |
144 | 144 | //finalize keep tag |
145 | 145 | if (strlen($allowed_tags) > 0) { |
146 | 146 | for ($i = 0; $i < count($k); $i++) { |
147 | - $source_code = str_replace('[{(' . $k[ $i ], '<' . $k[ $i ], $source_code); |
|
148 | - $source_code = str_replace('[{(/' . $k[ $i ], '</' . $k[ $i ], $source_code); |
|
147 | + $source_code = str_replace('[{(' . $k[$i], '<' . $k[$i], $source_code); |
|
148 | + $source_code = str_replace('[{(/' . $k[$i], '</' . $k[$i], $source_code); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 |
@@ -30,18 +30,18 @@ |
||
30 | 30 | */ |
31 | 31 | function get_object_var($property, $object, $default = null) |
32 | 32 | { |
33 | - if(is_object($object)) { |
|
34 | - if(property_exists($object, $property)) { |
|
33 | + if (is_object($object)) { |
|
34 | + if (property_exists($object, $property)) { |
|
35 | 35 | return $object->{$property}; |
36 | - } elseif(method_exists($object, 'has')) { |
|
37 | - if($object->has($property)) { |
|
36 | + } elseif (method_exists($object, 'has')) { |
|
37 | + if ($object->has($property)) { |
|
38 | 38 | return $object->get($property); |
39 | 39 | } |
40 | - } elseif(method_exists($object, 'offsetExists')) { |
|
41 | - if($object->offsetExists($property)) { |
|
40 | + } elseif (method_exists($object, 'offsetExists')) { |
|
41 | + if ($object->offsetExists($property)) { |
|
42 | 42 | return $object->offsetGet($property); |
43 | 43 | } |
44 | - } elseif(isset($object->{$property})) { |
|
44 | + } elseif (isset($object->{$property})) { |
|
45 | 45 | return $object->{$property}; |
46 | 46 | } |
47 | 47 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | return $number . ($number % 100 >= 11 && $number % 100 <= 13 |
344 | 344 | ? 'th' |
345 | - : $suffixes[ $number % 10 ]); |
|
345 | + : $suffixes[$number % 10]); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
@@ -435,15 +435,15 @@ discard block |
||
435 | 435 | // Illegal function |
436 | 436 | $formula = preg_replace_callback( |
437 | 437 | '~\b[a-z]\w*\b~', |
438 | - function ($match) use ($function_map) { |
|
439 | - $function = $match[ 0 ]; |
|
440 | - if ( ! isset($function_map[ $function ])) { |
|
438 | + function($match) use ($function_map) { |
|
439 | + $function = $match[0]; |
|
440 | + if ( ! isset($function_map[$function])) { |
|
441 | 441 | trigger_error("Illegal function '{$match[0]}'", E_USER_ERROR); |
442 | 442 | |
443 | 443 | return ''; |
444 | 444 | } |
445 | 445 | |
446 | - return $function_map[ $function ]; |
|
446 | + return $function_map[$function]; |
|
447 | 447 | }, |
448 | 448 | $formula |
449 | 449 | ); |
@@ -39,8 +39,8 @@ |
||
39 | 39 | { |
40 | 40 | parent::__construct('blockquote'); |
41 | 41 | |
42 | - if (isset($attributes[ 'id' ])) { |
|
43 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
42 | + if (isset($attributes['id'])) { |
|
43 | + $this->entity->setEntityName($attributes['id']); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if (count($attributes)) { |
@@ -33,8 +33,8 @@ |
||
33 | 33 | { |
34 | 34 | parent::__construct('figcaption'); |
35 | 35 | |
36 | - if (isset($attributes[ 'id' ])) { |
|
37 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
36 | + if (isset($attributes['id'])) { |
|
37 | + $this->entity->setEntityName($attributes['id']); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if (count($attributes)) { |
@@ -33,8 +33,8 @@ |
||
33 | 33 | { |
34 | 34 | parent::__construct('ul'); |
35 | 35 | |
36 | - if (isset($attributes[ 'id' ])) { |
|
37 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
36 | + if (isset($attributes['id'])) { |
|
37 | + $this->entity->setEntityName($attributes['id']); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if (count($attributes)) { |
@@ -88,20 +88,20 @@ |
||
88 | 88 | $parseUrl = parse_url($node->childNodes->first()->getAttributeHref()); |
89 | 89 | $parseUrlQuery = []; |
90 | 90 | |
91 | - if (isset($parseUrl[ 'query' ])) { |
|
92 | - parse_str($parseUrl[ 'query' ], $parseUrlQuery); |
|
91 | + if (isset($parseUrl['query'])) { |
|
92 | + parse_str($parseUrl['query'], $parseUrlQuery); |
|
93 | 93 | } |
94 | 94 | |
95 | - if (isset($parseUrlQuery[ 'page' ])) { |
|
96 | - if (input()->get('page') === $parseUrlQuery[ 'page' ]) { |
|
95 | + if (isset($parseUrlQuery['page'])) { |
|
96 | + if (input()->get('page') === $parseUrlQuery['page']) { |
|
97 | 97 | $node->attributes->addAttributeClass('active'); |
98 | 98 | $node->childNodes->first()->attributes->addAttributeClass('active'); |
99 | 99 | } |
100 | 100 | } else { |
101 | 101 | $hrefUriSegments = []; |
102 | 102 | |
103 | - if (isset($parseUrl[ 'path' ])) { |
|
104 | - $hrefUriSegments = (new Uri\Segments($parseUrl[ 'path' ]))->getParts(); |
|
103 | + if (isset($parseUrl['path'])) { |
|
104 | + $hrefUriSegments = (new Uri\Segments($parseUrl['path']))->getParts(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $currentUriSegments = server_request()->getUri()->getSegments()->getParts(); |
@@ -33,8 +33,8 @@ |
||
33 | 33 | { |
34 | 34 | parent::__construct('dl'); |
35 | 35 | |
36 | - if (isset($attributes[ 'id' ])) { |
|
37 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
36 | + if (isset($attributes['id'])) { |
|
37 | + $this->entity->setEntityName($attributes['id']); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if (count($attributes)) { |