@@ -33,37 +33,37 @@ discard block |
||
33 | 33 | $tags = $dom->getElementsByTagName('a'); |
34 | 34 | $links = array(); |
35 | 35 | |
36 | - if($tags->length) |
|
36 | + if ($tags->length) |
|
37 | 37 | { |
38 | - foreach($tags as $item) |
|
38 | + foreach ($tags as $item) |
|
39 | 39 | { |
40 | 40 | $link = $item->getAttribute('href'); |
41 | 41 | |
42 | - if($link != '' && strpos($link,'#') !== 0 && strpos(strtolower($link),'javascript:') !== 0) |
|
42 | + if ($link != '' && strpos($link, '#') !== 0 && strpos(strtolower($link), 'javascript:') !== 0) |
|
43 | 43 | { |
44 | 44 | $link = parse_url($link); |
45 | 45 | |
46 | - if(!isset($link['scheme'])) |
|
46 | + if (!isset($link['scheme'])) |
|
47 | 47 | { |
48 | 48 | $link['scheme'] = $this->data['parsed_url']['scheme']; |
49 | 49 | } |
50 | 50 | |
51 | - if(!isset($link['host'])) |
|
51 | + if (!isset($link['host'])) |
|
52 | 52 | { |
53 | 53 | $link['host'] = $this->data['parsed_url']['host']; |
54 | 54 | } |
55 | 55 | |
56 | - if(!isset($link['path'])) |
|
56 | + if (!isset($link['path'])) |
|
57 | 57 | { |
58 | 58 | $link['path'] = ''; |
59 | 59 | } else { |
60 | - if(strpos($link['path'],'/') !== 0) |
|
60 | + if (strpos($link['path'], '/') !== 0) |
|
61 | 61 | { |
62 | 62 | $link['path'] = '/'.$link['path']; |
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - if(!isset($link['query'])) |
|
66 | + if (!isset($link['query'])) |
|
67 | 67 | { |
68 | 68 | $link['query'] = ''; |
69 | 69 | } else { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function GetHosts($links = []) |
100 | 100 | { |
101 | - if(is_array($links) && count($links) > 0) |
|
101 | + if (is_array($links) && count($links) > 0) |
|
102 | 102 | { |
103 | 103 | $this->links = $links; |
104 | 104 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $parse = parse_url($link); |
111 | 111 | |
112 | - if(isset($parse['host']) && !in_array($parse['host'], $hosts)) |
|
112 | + if (isset($parse['host']) && !in_array($parse['host'], $hosts)) |
|
113 | 113 | { |
114 | 114 | $hosts[] = $parse['host']; |
115 | 115 | } |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | $tags = $dom->getElementsByTagName($tag); |
132 | 132 | $links = array(); |
133 | 133 | |
134 | - if($tags->length) |
|
134 | + if ($tags->length) |
|
135 | 135 | { |
136 | - foreach($tags as $item) |
|
136 | + foreach ($tags as $item) |
|
137 | 137 | { |
138 | 138 | $links[] = $item->getAttribute($attr); |
139 | 139 | } |