@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'parsed_url' => parse_url($url), |
| 45 | 45 | 'status' => $response->getStatusCode(), |
| 46 | 46 | 'headers' => $response->getHeaders(), |
| 47 | - 'page_speed' => number_format(( microtime(true) - $started_on), 4), |
|
| 47 | + 'page_speed' => number_format((microtime(true) - $started_on), 4), |
|
| 48 | 48 | 'content' => $response->getBody()->getContents() |
| 49 | 49 | ]; |
| 50 | 50 | |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $i++; |
| 116 | 116 | |
| 117 | - if($i >= 25) |
|
| 117 | + if ($i >= 25) |
|
| 118 | 118 | break; |
| 119 | 119 | |
| 120 | 120 | $status = $this->Request($link)->getStatusCode(); |
| 121 | 121 | |
| 122 | - if(substr($status,0,1) > 3 && $status != 999) |
|
| 122 | + if (substr($status, 0, 1) > 3 && $status != 999) |
|
| 123 | 123 | $scan['errors']["HTTP {$status}"][] = $link; |
| 124 | 124 | else |
| 125 | 125 | $scan['passed']["HTTP {$status}"][] = $link; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | foreach ($header as $item) |
| 145 | 145 | { |
| 146 | - if(strpos(mb_strtolower($item),'cache') !== false) |
|
| 146 | + if (strpos(mb_strtolower($item), 'cache') !== false) |
|
| 147 | 147 | { |
| 148 | 148 | $output['headers'][] = $item; |
| 149 | 149 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | foreach ($xpath->query('//comment()') as $comment) |
| 158 | 158 | { |
| 159 | - if(strpos(mb_strtolower($comment->textContent),'cache') !== false) |
|
| 159 | + if (strpos(mb_strtolower($comment->textContent), 'cache') !== false) |
|
| 160 | 160 | { |
| 161 | 161 | $output['html'][] = '<!-- '.trim($comment->textContent).' //-->'; |
| 162 | 162 | } |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | $output = array(); |
| 177 | 177 | $links = $this->helpers->GetAttributes($dom, 'link', 'rel'); |
| 178 | 178 | |
| 179 | - foreach($links as $item) |
|
| 179 | + foreach ($links as $item) |
|
| 180 | 180 | { |
| 181 | - if($item == 'canonical') |
|
| 181 | + if ($item == 'canonical') |
|
| 182 | 182 | { |
| 183 | 183 | $output[] = $item; |
| 184 | 184 | } |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | foreach ($this->data['headers'] as $key => $header) |
| 201 | 201 | { |
| 202 | - if($key == 'Content-Type') |
|
| 202 | + if ($key == 'Content-Type') |
|
| 203 | 203 | { |
| 204 | - $output = explode('=', explode(';',$header[0])[1])[1]; |
|
| 204 | + $output = explode('=', explode(';', $header[0])[1])[1]; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | return $this->Output($output, __FUNCTION__); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function DeprecatedHTML() |
| 254 | 254 | { |
| 255 | - $dom = $this->DOMDocument(); |
|
| 255 | + $dom = $this->DOMDocument(); |
|
| 256 | 256 | $dom->loadHTML($this->data['content']); |
| 257 | 257 | |
| 258 | 258 | $deprecated_tags = array( |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | foreach ($deprecated_tags as $tag) |
| 279 | 279 | { |
| 280 | - $tags = $dom->getElementsByTagName($tag); |
|
| 280 | + $tags = $dom->getElementsByTagName($tag); |
|
| 281 | 281 | |
| 282 | - if($tags->length > 0) |
|
| 282 | + if ($tags->length > 0) |
|
| 283 | 283 | { |
| 284 | 284 | $output[$tag] = $tags->length; |
| 285 | 285 | } |
@@ -295,11 +295,11 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function DomainLength() |
| 297 | 297 | { |
| 298 | - $domain = explode('.',$this->data['parsed_url']['host']); |
|
| 298 | + $domain = explode('.', $this->data['parsed_url']['host']); |
|
| 299 | 299 | |
| 300 | 300 | array_pop($domain); |
| 301 | 301 | |
| 302 | - $domain = implode('.',$domain); |
|
| 302 | + $domain = implode('.', $domain); |
|
| 303 | 303 | |
| 304 | 304 | return $this->Output(strlen($domain), __FUNCTION__); |
| 305 | 305 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $ico = "{$this->data['parsed_url']['scheme']}://{$this->data['parsed_url']['host']}/favicon.ico"; |
| 315 | 315 | $link = ''; |
| 316 | 316 | |
| 317 | - if($this->Request($ico)->getStatusCode() === 200) |
|
| 317 | + if ($this->Request($ico)->getStatusCode() === 200) |
|
| 318 | 318 | { |
| 319 | 319 | $link = $ico; |
| 320 | 320 | } else { |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | foreach ($tags as $tag) |
| 329 | 329 | { |
| 330 | - if($tag->getAttribute('rel') == 'shortcut icon' OR $tag->getAttribute('rel') == 'icon') |
|
| 330 | + if ($tag->getAttribute('rel') == 'shortcut icon' OR $tag->getAttribute('rel') == 'icon') |
|
| 331 | 331 | { |
| 332 | 332 | $fav = $tag->getAttribute('href'); |
| 333 | 333 | break; |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | if (!filter_var($fav, FILTER_VALIDATE_URL) === false && $this->Request($fav)->getStatusCode() == 200) |
| 338 | 338 | { |
| 339 | 339 | $link = $fav; |
| 340 | - } else if($this->Request($this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav)->getStatusCode() == 200) |
|
| 340 | + } else if ($this->Request($this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav)->getStatusCode() == 200) |
|
| 341 | 341 | { |
| 342 | 342 | $link = $this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav; |
| 343 | - } else if($this->Request($_GET['value'].'/'.$fav)->getStatusCode() == 200) |
|
| 343 | + } else if ($this->Request($_GET['value'].'/'.$fav)->getStatusCode() == 200) |
|
| 344 | 344 | { |
| 345 | 345 | $link = $_GET['value'].'/'.$fav; |
| 346 | 346 | } else { |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $output['frameset'][] = null; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $tags = $dom->getElementsByTagName('frame'); |
|
| 372 | + $tags = $dom->getElementsByTagName('frame'); |
|
| 373 | 373 | foreach ($tags as $tag) |
| 374 | 374 | { |
| 375 | 375 | $output['frame'][] = null; |
@@ -396,26 +396,26 @@ discard block |
||
| 396 | 396 | $tags = $dom->getElementsByTagName('script'); |
| 397 | 397 | foreach ($tags as $tag) |
| 398 | 398 | { |
| 399 | - if($tag->getAttribute('src')) |
|
| 399 | + if ($tag->getAttribute('src')) |
|
| 400 | 400 | { |
| 401 | 401 | if (0 === strpos($tag->getAttribute('src'), '//')) |
| 402 | 402 | { |
| 403 | - $href = $this->data['parsed_url']['scheme'] . ':'.$tag->getAttribute('src'); |
|
| 403 | + $href = $this->data['parsed_url']['scheme'].':'.$tag->getAttribute('src'); |
|
| 404 | 404 | } else if (0 !== strpos($tag->getAttribute('src'), 'http')) |
| 405 | 405 | { |
| 406 | - $path = '/' . ltrim($tag->getAttribute('src'), '/'); |
|
| 407 | - $href = $this->data['parsed_url']['scheme'] . '://'; |
|
| 406 | + $path = '/'.ltrim($tag->getAttribute('src'), '/'); |
|
| 407 | + $href = $this->data['parsed_url']['scheme'].'://'; |
|
| 408 | 408 | |
| 409 | 409 | if (isset($this->data['parsed_url']['user']) && isset($this->data['parsed_url']['pass'])) |
| 410 | 410 | { |
| 411 | - $href .= $this->data['parsed_url']['user'] . ':' . $this->data['parsed_url']['pass'] . '@'; |
|
| 411 | + $href .= $this->data['parsed_url']['user'].':'.$this->data['parsed_url']['pass'].'@'; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | $href .= $this->data['parsed_url']['host']; |
| 415 | 415 | |
| 416 | 416 | if (isset($this->data['parsed_url']['port'])) |
| 417 | 417 | { |
| 418 | - $href .= ':' . $this->data['parsed_url']['port']; |
|
| 418 | + $href .= ':'.$this->data['parsed_url']['port']; |
|
| 419 | 419 | } |
| 420 | 420 | $href .= $path; |
| 421 | 421 | } else { |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - $ua_regex = "/UA-[0-9]{5,}-[0-9]{1,}/"; |
|
| 431 | + $ua_regex = "/UA-[0-9]{5,}-[0-9]{1,}/"; |
|
| 432 | 432 | |
| 433 | 433 | preg_match_all($ua_regex, $script, $ua_id); |
| 434 | 434 | |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | public function ImageAlt() |
| 496 | 496 | { |
| 497 | - $dom = $this->DOMDocument(); |
|
| 497 | + $dom = $this->DOMDocument(); |
|
| 498 | 498 | $dom->loadHTML($this->data['content']); |
| 499 | 499 | |
| 500 | 500 | $tags = $dom->getElementsByTagName('img'); |
| 501 | 501 | $images = array(); |
| 502 | 502 | $errors = array(); |
| 503 | 503 | |
| 504 | - foreach($tags as $item) |
|
| 504 | + foreach ($tags as $item) |
|
| 505 | 505 | { |
| 506 | 506 | $src = $item->getAttribute('src'); |
| 507 | 507 | $alt = $item->getAttribute('alt'); |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | 'alt' => $alt |
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | - if($alt == '') |
|
| 514 | + if ($alt == '') |
|
| 515 | 515 | { |
| 516 | 516 | $link = $src; |
| 517 | 517 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - $output = array( |
|
| 522 | + $output = array( |
|
| 523 | 523 | 'images' => $images, |
| 524 | 524 | 'without_alt' => $errors |
| 525 | 525 | ); |
@@ -540,35 +540,35 @@ discard block |
||
| 540 | 540 | $tags = $dom->getElementsByTagName('a'); |
| 541 | 541 | $output = array(); |
| 542 | 542 | |
| 543 | - foreach($tags as $item) |
|
| 543 | + foreach ($tags as $item) |
|
| 544 | 544 | { |
| 545 | 545 | $link = $item->getAttribute('href'); |
| 546 | 546 | |
| 547 | - if($link != '' && strpos($link,'#') !== 0) |
|
| 547 | + if ($link != '' && strpos($link, '#') !== 0) |
|
| 548 | 548 | { |
| 549 | 549 | $link = parse_url($link); |
| 550 | 550 | |
| 551 | - if(!isset($link['scheme'])) |
|
| 551 | + if (!isset($link['scheme'])) |
|
| 552 | 552 | { |
| 553 | 553 | $link['scheme'] = $this->data['parsed_url']['scheme']; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - if(!isset($link['host'])) |
|
| 556 | + if (!isset($link['host'])) |
|
| 557 | 557 | { |
| 558 | 558 | $link['host'] = $this->data['parsed_url']['host']; |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if(!isset($link['path'])) |
|
| 561 | + if (!isset($link['path'])) |
|
| 562 | 562 | { |
| 563 | 563 | $link['path'] = ''; |
| 564 | 564 | } else { |
| 565 | - if(strpos($link['path'],'/') === false) |
|
| 565 | + if (strpos($link['path'], '/') === false) |
|
| 566 | 566 | { |
| 567 | 567 | $link['path'] = '/'.$link['path']; |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - if(!isset($link['query'])) |
|
| 571 | + if (!isset($link['query'])) |
|
| 572 | 572 | { |
| 573 | 573 | $link['query'] = ''; |
| 574 | 574 | } else { |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | $tags = $dom->getElementsByTagName('style'); |
| 604 | 604 | $output = array(); |
| 605 | 605 | |
| 606 | - foreach($tags as $item) |
|
| 606 | + foreach ($tags as $item) |
|
| 607 | 607 | { |
| 608 | 608 | $output[] = $this->helpers->Whitespace($item->textContent); |
| 609 | 609 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | foreach ($tags as $tag) |
| 626 | 626 | { |
| 627 | 627 | $content = $tag->getAttribute('content'); |
| 628 | - if(strtolower($tag->getAttribute('name')) == 'description' && strlen($content) > 0) |
|
| 628 | + if (strtolower($tag->getAttribute('name')) == 'description' && strlen($content) > 0) |
|
| 629 | 629 | { |
| 630 | 630 | $output = $content; |
| 631 | 631 | } |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | $output = ''; |
| 648 | 648 | foreach ($tags as $tag) |
| 649 | 649 | { |
| 650 | - if(isset($tag->nodeValue) && strlen($tag->nodeValue) > 0) |
|
| 650 | + if (isset($tag->nodeValue) && strlen($tag->nodeValue) > 0) |
|
| 651 | 651 | { |
| 652 | 652 | $output = $tag->nodeValue; |
| 653 | 653 | } |
@@ -672,13 +672,13 @@ discard block |
||
| 672 | 672 | $output = array(); |
| 673 | 673 | foreach ($tags as $tag) |
| 674 | 674 | { |
| 675 | - if($tag->getAttribute('name') == 'robots') |
|
| 675 | + if ($tag->getAttribute('name') == 'robots') |
|
| 676 | 676 | { |
| 677 | 677 | $output[] = $tag->getAttribute('content'); |
| 678 | 678 | } |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - return $this->Output(in_array('nofollow',$output), __FUNCTION__); |
|
| 681 | + return $this->Output(in_array('nofollow', $output), __FUNCTION__); |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /** |
@@ -695,13 +695,13 @@ discard block |
||
| 695 | 695 | $output = array(); |
| 696 | 696 | foreach ($tags as $tag) |
| 697 | 697 | { |
| 698 | - if($tag->getAttribute('name') == 'robots') |
|
| 698 | + if ($tag->getAttribute('name') == 'robots') |
|
| 699 | 699 | { |
| 700 | 700 | $output[] = $tag->getAttribute('content'); |
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - return $this->Output(in_array('noindex',$output), __FUNCTION__); |
|
| 704 | + return $this->Output(in_array('noindex', $output), __FUNCTION__); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /** |
@@ -720,35 +720,35 @@ discard block |
||
| 720 | 720 | 'img' => array() |
| 721 | 721 | ); |
| 722 | 722 | |
| 723 | - $tags = $dom->getElementsByTagName('link'); |
|
| 723 | + $tags = $dom->getElementsByTagName('link'); |
|
| 724 | 724 | foreach ($tags as $tag) |
| 725 | 725 | { |
| 726 | - if($tag->getAttribute('type') == 'text/css' OR $tag->getAttribute('rel') == 'stylesheet') |
|
| 726 | + if ($tag->getAttribute('type') == 'text/css' OR $tag->getAttribute('rel') == 'stylesheet') |
|
| 727 | 727 | { |
| 728 | 728 | $output['css'][] = $tag->getAttribute('href'); |
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | - $output['css'] = array_unique($output['css']); |
|
| 731 | + $output['css'] = array_unique($output['css']); |
|
| 732 | 732 | |
| 733 | - $tags = $dom->getElementsByTagName('script'); |
|
| 733 | + $tags = $dom->getElementsByTagName('script'); |
|
| 734 | 734 | foreach ($tags as $tag) |
| 735 | 735 | { |
| 736 | - if($tag->getAttribute('src') != '') |
|
| 736 | + if ($tag->getAttribute('src') != '') |
|
| 737 | 737 | { |
| 738 | 738 | $output['script'][] = $tag->getAttribute('src'); |
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | $output['script'] = array_unique($output['script']); |
| 742 | 742 | |
| 743 | - $tags = $dom->getElementsByTagName('img'); |
|
| 743 | + $tags = $dom->getElementsByTagName('img'); |
|
| 744 | 744 | foreach ($tags as $tag) |
| 745 | 745 | { |
| 746 | - if($tag->getAttribute('src') != '') |
|
| 746 | + if ($tag->getAttribute('src') != '') |
|
| 747 | 747 | { |
| 748 | 748 | $output['img'][] = $tag->getAttribute('src'); |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | - $output['img'] = array_unique($output['img']); |
|
| 751 | + $output['img'] = array_unique($output['img']); |
|
| 752 | 752 | |
| 753 | 753 | return $this->Output($output, __FUNCTION__); |
| 754 | 754 | } |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | $script = $dom->getElementsByTagName('script'); |
| 777 | 777 | $remove = array(); |
| 778 | 778 | |
| 779 | - foreach($script as $item) |
|
| 779 | + foreach ($script as $item) |
|
| 780 | 780 | { |
| 781 | 781 | $remove[] = $item; |
| 782 | 782 | } |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | $style = $dom->getElementsByTagName('style'); |
| 789 | 789 | $remove = array(); |
| 790 | 790 | |
| 791 | - foreach($style as $item) |
|
| 791 | + foreach ($style as $item) |
|
| 792 | 792 | { |
| 793 | 793 | $remove[] = $item; |
| 794 | 794 | } |
@@ -800,15 +800,15 @@ discard block |
||
| 800 | 800 | |
| 801 | 801 | $page = $dom->saveHTML(); |
| 802 | 802 | $page = trim(preg_replace('/<[^>]*>/', ' ', $page)); |
| 803 | - $page = preg_replace('/\s+/', ' ',$page); |
|
| 804 | - $page = explode(' ',$page); |
|
| 803 | + $page = preg_replace('/\s+/', ' ', $page); |
|
| 804 | + $page = explode(' ', $page); |
|
| 805 | 805 | |
| 806 | 806 | $output = array(); |
| 807 | 807 | foreach ($page as $item) |
| 808 | 808 | { |
| 809 | 809 | $item = trim($item); |
| 810 | 810 | |
| 811 | - if($item != '' && strpos($item,'@') !== false) |
|
| 811 | + if ($item != '' && strpos($item, '@') !== false) |
|
| 812 | 812 | { |
| 813 | 813 | if (!filter_var($item, FILTER_VALIDATE_EMAIL) === false) { |
| 814 | 814 | $output[] = $item; |
@@ -830,11 +830,11 @@ discard block |
||
| 830 | 830 | { |
| 831 | 831 | $output = array(); |
| 832 | 832 | |
| 833 | - $output['actual'] = round(strlen($this->data['content']) / 1024,2); |
|
| 833 | + $output['actual'] = round(strlen($this->data['content']) / 1024, 2); |
|
| 834 | 834 | $output['possible'] = gzcompress($this->data['content'], 9); |
| 835 | - $output['possible'] = round(strlen($output['possible']) / 1024,2); |
|
| 836 | - $output['percentage'] = round((($output['possible'] * 100) / $output['actual']),2); |
|
| 837 | - $output['difference'] = round($output['actual'] - $output['possible'],2); |
|
| 835 | + $output['possible'] = round(strlen($output['possible']) / 1024, 2); |
|
| 836 | + $output['percentage'] = round((($output['possible'] * 100) / $output['actual']), 2); |
|
| 837 | + $output['difference'] = round($output['actual'] - $output['possible'], 2); |
|
| 838 | 838 | |
| 839 | 839 | return $this->Output($output, __FUNCTION__); |
| 840 | 840 | } |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | { |
| 849 | 849 | $output = $this->Request("{$this->data['parsed_url']['scheme']}://{$this->data['parsed_url']['host']}/robots.txt"); |
| 850 | 850 | |
| 851 | - if($output->getStatusCode() === 200) |
|
| 851 | + if ($output->getStatusCode() === 200) |
|
| 852 | 852 | { |
| 853 | 853 | $output = $output->getBody()->getContents(); |
| 854 | 854 | } else { |