@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | { |
113 | 113 | $i++; |
114 | 114 | |
115 | - if($i >= 25) |
|
115 | + if ($i >= 25) |
|
116 | 116 | break; |
117 | 117 | |
118 | 118 | $status = $this->Request($link)->getStatusCode(); |
119 | 119 | |
120 | - if(substr($status,0,1) > 3 && $status != 999) |
|
120 | + if (substr($status, 0, 1) > 3 && $status != 999) |
|
121 | 121 | $scan['errors']["HTTP {$status}"][] = $link; |
122 | 122 | else |
123 | 123 | $scan['passed']["HTTP {$status}"][] = $link; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | foreach ($header as $item) |
143 | 143 | { |
144 | - if(strpos(mb_strtolower($item),'cache') !== false) |
|
144 | + if (strpos(mb_strtolower($item), 'cache') !== false) |
|
145 | 145 | { |
146 | 146 | $output['headers'][] = $item; |
147 | 147 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | foreach ($xpath->query('//comment()') as $comment) |
156 | 156 | { |
157 | - if(strpos(mb_strtolower($comment->textContent),'cache') !== false) |
|
157 | + if (strpos(mb_strtolower($comment->textContent), 'cache') !== false) |
|
158 | 158 | { |
159 | 159 | $output['html'][] = '<!-- '.trim($comment->textContent).' //-->'; |
160 | 160 | } |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | $output = array(); |
175 | 175 | $links = $this->helpers->GetAttributes($dom, 'link', 'rel'); |
176 | 176 | |
177 | - foreach($links as $item) |
|
177 | + foreach ($links as $item) |
|
178 | 178 | { |
179 | - if($item == 'canonical') |
|
179 | + if ($item == 'canonical') |
|
180 | 180 | { |
181 | 181 | $output[] = $item; |
182 | 182 | } |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | |
198 | 198 | foreach ($this->data['headers'] as $key => $header) |
199 | 199 | { |
200 | - if($key == 'Content-Type') |
|
200 | + if ($key == 'Content-Type') |
|
201 | 201 | { |
202 | - $output = explode('=', explode(';',$header[0])[1])[1]; |
|
202 | + $output = explode('=', explode(';', $header[0])[1])[1]; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | return $this->Output($output, __FUNCTION__); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function DeprecatedHTML() |
252 | 252 | { |
253 | - $dom = $this->DOMDocument(); |
|
253 | + $dom = $this->DOMDocument(); |
|
254 | 254 | $dom->loadHTML($this->data['content']); |
255 | 255 | |
256 | 256 | $deprecated_tags = array( |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | |
276 | 276 | foreach ($deprecated_tags as $tag) |
277 | 277 | { |
278 | - $tags = $dom->getElementsByTagName($tag); |
|
278 | + $tags = $dom->getElementsByTagName($tag); |
|
279 | 279 | |
280 | - if($tags->length > 0) |
|
280 | + if ($tags->length > 0) |
|
281 | 281 | { |
282 | 282 | $output[$tag] = $tags->length; |
283 | 283 | } |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function DomainLength() |
295 | 295 | { |
296 | - $domain = explode('.',$this->data['parsed_url']['host']); |
|
296 | + $domain = explode('.', $this->data['parsed_url']['host']); |
|
297 | 297 | |
298 | 298 | array_pop($domain); |
299 | 299 | |
300 | - $domain = implode('.',$domain); |
|
300 | + $domain = implode('.', $domain); |
|
301 | 301 | |
302 | 302 | return $this->Output(strlen($domain), __FUNCTION__); |
303 | 303 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $ico = "{$this->data['parsed_url']['scheme']}://{$this->data['parsed_url']['host']}/favicon.ico"; |
313 | 313 | $link = ''; |
314 | 314 | |
315 | - if($this->Request($ico)->getStatusCode() === 200) |
|
315 | + if ($this->Request($ico)->getStatusCode() === 200) |
|
316 | 316 | { |
317 | 317 | $link = $ico; |
318 | 318 | } else { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | foreach ($tags as $tag) |
327 | 327 | { |
328 | - if($tag->getAttribute('rel') == 'shortcut icon' OR $tag->getAttribute('rel') == 'icon') |
|
328 | + if ($tag->getAttribute('rel') == 'shortcut icon' OR $tag->getAttribute('rel') == 'icon') |
|
329 | 329 | { |
330 | 330 | $fav = $tag->getAttribute('href'); |
331 | 331 | break; |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | if (!filter_var($fav, FILTER_VALIDATE_URL) === false && $this->Request($fav)->getStatusCode() == 200) |
336 | 336 | { |
337 | 337 | $link = $fav; |
338 | - } else if($this->Request($this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav)->getStatusCode() == 200) |
|
338 | + } else if ($this->Request($this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav)->getStatusCode() == 200) |
|
339 | 339 | { |
340 | 340 | $link = $this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav; |
341 | - } else if($this->Request($_GET['value'].'/'.$fav)->getStatusCode() == 200) |
|
341 | + } else if ($this->Request($_GET['value'].'/'.$fav)->getStatusCode() == 200) |
|
342 | 342 | { |
343 | 343 | $link = $_GET['value'].'/'.$fav; |
344 | 344 | } else { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $output['frameset'][] = null; |
368 | 368 | } |
369 | 369 | |
370 | - $tags = $dom->getElementsByTagName('frame'); |
|
370 | + $tags = $dom->getElementsByTagName('frame'); |
|
371 | 371 | foreach ($tags as $tag) |
372 | 372 | { |
373 | 373 | $output['frame'][] = null; |
@@ -394,26 +394,26 @@ discard block |
||
394 | 394 | $tags = $dom->getElementsByTagName('script'); |
395 | 395 | foreach ($tags as $tag) |
396 | 396 | { |
397 | - if($tag->getAttribute('src')) |
|
397 | + if ($tag->getAttribute('src')) |
|
398 | 398 | { |
399 | 399 | if (0 === strpos($tag->getAttribute('src'), '//')) |
400 | 400 | { |
401 | - $href = $this->data['parsed_url']['scheme'] . ':'.$tag->getAttribute('src'); |
|
401 | + $href = $this->data['parsed_url']['scheme'].':'.$tag->getAttribute('src'); |
|
402 | 402 | } else if (0 !== strpos($tag->getAttribute('src'), 'http')) |
403 | 403 | { |
404 | - $path = '/' . ltrim($tag->getAttribute('src'), '/'); |
|
405 | - $href = $this->data['parsed_url']['scheme'] . '://'; |
|
404 | + $path = '/'.ltrim($tag->getAttribute('src'), '/'); |
|
405 | + $href = $this->data['parsed_url']['scheme'].'://'; |
|
406 | 406 | |
407 | 407 | if (isset($this->data['parsed_url']['user']) && isset($this->data['parsed_url']['pass'])) |
408 | 408 | { |
409 | - $href .= $this->data['parsed_url']['user'] . ':' . $this->data['parsed_url']['pass'] . '@'; |
|
409 | + $href .= $this->data['parsed_url']['user'].':'.$this->data['parsed_url']['pass'].'@'; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | $href .= $this->data['parsed_url']['host']; |
413 | 413 | |
414 | 414 | if (isset($this->data['parsed_url']['port'])) |
415 | 415 | { |
416 | - $href .= ':' . $this->data['parsed_url']['port']; |
|
416 | + $href .= ':'.$this->data['parsed_url']['port']; |
|
417 | 417 | } |
418 | 418 | $href .= $path; |
419 | 419 | } else { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
429 | - $ua_regex = "/UA-[0-9]{5,}-[0-9]{1,}/"; |
|
429 | + $ua_regex = "/UA-[0-9]{5,}-[0-9]{1,}/"; |
|
430 | 430 | |
431 | 431 | preg_match_all($ua_regex, $script, $ua_id); |
432 | 432 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | */ |
493 | 493 | public function PageCompression() |
494 | 494 | { |
495 | - $output['actual'] = round(strlen($this->data['content']) / 1024,2); |
|
495 | + $output['actual'] = round(strlen($this->data['content']) / 1024, 2); |
|
496 | 496 | $output['possible'] = gzcompress($this->data['content'], 9); |
497 | - $output['possible'] = round(strlen($output['possible']) / 1024,2); |
|
498 | - $output['percentage'] = round((($output['possible'] * 100) / $output['actual']),2); |
|
499 | - $output['difference'] = round($output['actual'] - $output['possible'],2); |
|
497 | + $output['possible'] = round(strlen($output['possible']) / 1024, 2); |
|
498 | + $output['percentage'] = round((($output['possible'] * 100) / $output['actual']), 2); |
|
499 | + $output['difference'] = round($output['actual'] - $output['possible'], 2); |
|
500 | 500 | |
501 | 501 | return $this->Output($output, __FUNCTION__); |
502 | 502 | } |
@@ -112,15 +112,17 @@ |
||
112 | 112 | { |
113 | 113 | $i++; |
114 | 114 | |
115 | - if($i >= 25) |
|
116 | - break; |
|
115 | + if($i >= 25) { |
|
116 | + break; |
|
117 | + } |
|
117 | 118 | |
118 | 119 | $status = $this->Request($link)->getStatusCode(); |
119 | 120 | |
120 | - if(substr($status,0,1) > 3 && $status != 999) |
|
121 | - $scan['errors']["HTTP {$status}"][] = $link; |
|
122 | - else |
|
123 | - $scan['passed']["HTTP {$status}"][] = $link; |
|
121 | + if(substr($status,0,1) > 3 && $status != 999) { |
|
122 | + $scan['errors']["HTTP {$status}"][] = $link; |
|
123 | + } else { |
|
124 | + $scan['passed']["HTTP {$status}"][] = $link; |
|
125 | + } |
|
124 | 126 | } |
125 | 127 | return $this->Output([ |
126 | 128 | 'links' => $links, |
@@ -28,37 +28,37 @@ discard block |
||
28 | 28 | $tags = $dom->getElementsByTagName('a'); |
29 | 29 | $links = array(); |
30 | 30 | |
31 | - if($tags->length) |
|
31 | + if ($tags->length) |
|
32 | 32 | { |
33 | - foreach($tags as $item) |
|
33 | + foreach ($tags as $item) |
|
34 | 34 | { |
35 | 35 | $link = $item->getAttribute('href'); |
36 | 36 | |
37 | - if($link != '' && strpos($link,'#') !== 0 && strpos(strtolower($link),'javascript:') !== 0) |
|
37 | + if ($link != '' && strpos($link, '#') !== 0 && strpos(strtolower($link), 'javascript:') !== 0) |
|
38 | 38 | { |
39 | 39 | $link = parse_url($link); |
40 | 40 | |
41 | - if(!isset($link['scheme'])) |
|
41 | + if (!isset($link['scheme'])) |
|
42 | 42 | { |
43 | 43 | $link['scheme'] = $this->data['parsed_url']['scheme']; |
44 | 44 | } |
45 | 45 | |
46 | - if(!isset($link['host'])) |
|
46 | + if (!isset($link['host'])) |
|
47 | 47 | { |
48 | 48 | $link['host'] = $this->data['parsed_url']['host']; |
49 | 49 | } |
50 | 50 | |
51 | - if(!isset($link['path'])) |
|
51 | + if (!isset($link['path'])) |
|
52 | 52 | { |
53 | 53 | $link['path'] = ''; |
54 | 54 | } else { |
55 | - if(strpos($link['path'],'/') !== 0) |
|
55 | + if (strpos($link['path'], '/') !== 0) |
|
56 | 56 | { |
57 | 57 | $link['path'] = '/'.$link['path']; |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - if(!isset($link['query'])) |
|
61 | + if (!isset($link['query'])) |
|
62 | 62 | { |
63 | 63 | $link['query'] = ''; |
64 | 64 | } else { |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $tags = $dom->getElementsByTagName($tag); |
87 | 87 | $links = array(); |
88 | 88 | |
89 | - if($tags->length) |
|
89 | + if ($tags->length) |
|
90 | 90 | { |
91 | - foreach($tags as $item) |
|
91 | + foreach ($tags as $item) |
|
92 | 92 | { |
93 | 93 | $links[] = $item->getAttribute($attr); |
94 | 94 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | protected function Request($url) |
15 | 15 | { |
16 | - $guzzle = new Client; |
|
16 | + $guzzle = new Client; |
|
17 | 17 | |
18 | 18 | return $guzzle->get($url, ['http_errors' => false]); |
19 | 19 | } |