@@ -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,14 +492,14 @@ discard block |
||
| 492 | 492 | */ |
| 493 | 493 | public function ImageAlt() |
| 494 | 494 | { |
| 495 | - $dom = $this->DOMDocument(); |
|
| 495 | + $dom = $this->DOMDocument(); |
|
| 496 | 496 | $dom->loadHTML($this->data['content']); |
| 497 | 497 | |
| 498 | 498 | $tags = $dom->getElementsByTagName('img'); |
| 499 | 499 | $images = array(); |
| 500 | 500 | $errors = array(); |
| 501 | 501 | |
| 502 | - foreach($tags as $item) |
|
| 502 | + foreach ($tags as $item) |
|
| 503 | 503 | { |
| 504 | 504 | $src = $item->getAttribute('src'); |
| 505 | 505 | $alt = $item->getAttribute('alt'); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | 'alt' => $alt |
| 510 | 510 | ); |
| 511 | 511 | |
| 512 | - if($alt == '') |
|
| 512 | + if ($alt == '') |
|
| 513 | 513 | { |
| 514 | 514 | $link = $src; |
| 515 | 515 | |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - $output = array( |
|
| 520 | + $output = array( |
|
| 521 | 521 | 'images' => $images, |
| 522 | 522 | 'without_alt' => $errors |
| 523 | 523 | ); |
@@ -538,35 +538,35 @@ discard block |
||
| 538 | 538 | $tags = $dom->getElementsByTagName('a'); |
| 539 | 539 | $output = array(); |
| 540 | 540 | |
| 541 | - foreach($tags as $item) |
|
| 541 | + foreach ($tags as $item) |
|
| 542 | 542 | { |
| 543 | 543 | $link = $item->getAttribute('href'); |
| 544 | 544 | |
| 545 | - if($link != '' && strpos($link,'#') !== 0) |
|
| 545 | + if ($link != '' && strpos($link, '#') !== 0) |
|
| 546 | 546 | { |
| 547 | 547 | $link = parse_url($link); |
| 548 | 548 | |
| 549 | - if(!isset($link['scheme'])) |
|
| 549 | + if (!isset($link['scheme'])) |
|
| 550 | 550 | { |
| 551 | 551 | $link['scheme'] = $this->data['parsed_url']['scheme']; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if(!isset($link['host'])) |
|
| 554 | + if (!isset($link['host'])) |
|
| 555 | 555 | { |
| 556 | 556 | $link['host'] = $this->data['parsed_url']['host']; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if(!isset($link['path'])) |
|
| 559 | + if (!isset($link['path'])) |
|
| 560 | 560 | { |
| 561 | 561 | $link['path'] = ''; |
| 562 | 562 | } else { |
| 563 | - if(strpos($link['path'],'/') === false) |
|
| 563 | + if (strpos($link['path'], '/') === false) |
|
| 564 | 564 | { |
| 565 | 565 | $link['path'] = '/'.$link['path']; |
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - if(!isset($link['query'])) |
|
| 569 | + if (!isset($link['query'])) |
|
| 570 | 570 | { |
| 571 | 571 | $link['query'] = ''; |
| 572 | 572 | } else { |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | $tags = $dom->getElementsByTagName('style'); |
| 602 | 602 | $output = array(); |
| 603 | 603 | |
| 604 | - foreach($tags as $item) |
|
| 604 | + foreach ($tags as $item) |
|
| 605 | 605 | { |
| 606 | 606 | $output[] = $this->helpers->Whitespace($item->textContent); |
| 607 | 607 | } |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | foreach ($tags as $tag) |
| 624 | 624 | { |
| 625 | 625 | $content = $tag->getAttribute('content'); |
| 626 | - if(strtolower($tag->getAttribute('name')) == 'description' && strlen($content) > 0) |
|
| 626 | + if (strtolower($tag->getAttribute('name')) == 'description' && strlen($content) > 0) |
|
| 627 | 627 | { |
| 628 | 628 | $output = $content; |
| 629 | 629 | } |
@@ -641,11 +641,11 @@ discard block |
||
| 641 | 641 | { |
| 642 | 642 | $output = array(); |
| 643 | 643 | |
| 644 | - $output['actual'] = round(strlen($this->data['content']) / 1024,2); |
|
| 644 | + $output['actual'] = round(strlen($this->data['content']) / 1024, 2); |
|
| 645 | 645 | $output['possible'] = gzcompress($this->data['content'], 9); |
| 646 | - $output['possible'] = round(strlen($output['possible']) / 1024,2); |
|
| 647 | - $output['percentage'] = round((($output['possible'] * 100) / $output['actual']),2); |
|
| 648 | - $output['difference'] = round($output['actual'] - $output['possible'],2); |
|
| 646 | + $output['possible'] = round(strlen($output['possible']) / 1024, 2); |
|
| 647 | + $output['percentage'] = round((($output['possible'] * 100) / $output['actual']), 2); |
|
| 648 | + $output['difference'] = round($output['actual'] - $output['possible'], 2); |
|
| 649 | 649 | |
| 650 | 650 | return $this->Output($output, __FUNCTION__); |
| 651 | 651 | } |