@@ -23,16 +23,16 @@ |
||
23 | 23 | $validateIP = new Models\ValidateIP; |
24 | 24 | $test = $validateIP->validate($ipNumber); |
25 | 25 | if ($test[0]) { |
26 | - $location = $getJson->cUrl($ipstack["url"]. $ipNumber. '?access_key='. $ipstack["key"]); |
|
26 | + $location = $getJson->cUrl($ipstack["url"].$ipNumber.'?access_key='.$ipstack["key"]); |
|
27 | 27 | $location = json_decode($location, true); |
28 | 28 | $latitude = $location["latitude"]; |
29 | 29 | $longitude = $location["longitude"]; |
30 | 30 | $location = [$location["city"], $latitude, $longitude]; |
31 | 31 | } else { |
32 | - $search = array('å','ä','ö'); |
|
33 | - $replace = array('a','a','o'); |
|
32 | + $search = array('å', 'ä', 'ö'); |
|
33 | + $replace = array('a', 'a', 'o'); |
|
34 | 34 | $ipNumber = str_replace($search, $replace, $ipNumber); |
35 | - $location = $getJson->cUrl($mapquest["url"]. $mapquest["key"]. $mapquest["extra"]. $ipNumber); |
|
35 | + $location = $getJson->cUrl($mapquest["url"].$mapquest["key"].$mapquest["extra"].$ipNumber); |
|
36 | 36 | $location = json_decode($location, true); |
37 | 37 | $latitude = $location["results"][0]["locations"][0]["latLng"]["lat"]; |
38 | 38 | $longitude = $location["results"][0]["locations"][0]["latLng"]["lng"]; |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | $api = $this->di->get("ipstack"); |
19 | 19 | $ipstack = $api["config"]; |
20 | 20 | $getipInfo = new Models\Curl; |
21 | - $extra = "&fields=ip"; |
|
22 | - $userIp = $getipInfo->cUrl($ipstack["url"]. "check". '?access_key='. $ipstack["key"]. $extra); |
|
21 | + $extra = "&fields=ip"; |
|
22 | + $userIp = $getipInfo->cUrl($ipstack["url"]."check".'?access_key='.$ipstack["key"].$extra); |
|
23 | 23 | $apiResult = json_decode($userIp, true); |
24 | 24 | |
25 | 25 | $session->set("userIp", $apiResult["ip"]); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $extra = "?lang=sv&units=auto"; |
76 | 76 | $mapDiv = $map->getMap($latitude, $longitude); |
77 | - $weatherJson = $getJson->cUrl($darksky["url"]. $darksky["key"]. "/". $latitude. ",". $longitude. $extra); |
|
77 | + $weatherJson = $getJson->cUrl($darksky["url"].$darksky["key"]."/".$latitude.",".$longitude.$extra); |
|
78 | 78 | |
79 | 79 | $weather = json_decode($weatherJson, true); |
80 | 80 | $page->add("weather/weather", [ |
@@ -106,21 +106,21 @@ discard block |
||
106 | 106 | $ipNumber = $request->getGet("ip"); |
107 | 107 | $test = $validateIP->validate($ipNumber); |
108 | 108 | if ($test[0]) { |
109 | - $location = $getJson->cUrl($ipstack["url"]. $ipNumber. '?access_key='. $ipstack["key"]); |
|
109 | + $location = $getJson->cUrl($ipstack["url"].$ipNumber.'?access_key='.$ipstack["key"]); |
|
110 | 110 | $location = json_decode($location, true); |
111 | 111 | $latitude = $location["latitude"]; |
112 | 112 | $longitude = $location["longitude"]; |
113 | 113 | $location = [$location["city"], $latitude, $longitude]; |
114 | 114 | } else { |
115 | - $search = array('å','ä','ö'); |
|
116 | - $replace = array('a','a','o'); |
|
115 | + $search = array('å', 'ä', 'ö'); |
|
116 | + $replace = array('a', 'a', 'o'); |
|
117 | 117 | $ipNumber = str_replace($search, $replace, $ipNumber); |
118 | 118 | $location = $getJson->cUrl("http://www.mapquestapi.com/geocoding/v1/address?key=HVd7TbTeHvGGiGF14rSntAMMq3VDSAtT&location=".$ipNumber); |
119 | 119 | $location = json_decode($location, true); |
120 | 120 | |
121 | 121 | $latitude = $location["results"][0]["locations"][0]["latLng"]["lat"]; |
122 | 122 | $longitude = $location["results"][0]["locations"][0]["latLng"]["lng"]; |
123 | - $location = $getJson->cUrl("http://www.mapquestapi.com/geocoding/v1/reverse?key=HVd7TbTeHvGGiGF14rSntAMMq3VDSAtT&location=".$latitude. ",". $longitude); |
|
123 | + $location = $getJson->cUrl("http://www.mapquestapi.com/geocoding/v1/reverse?key=HVd7TbTeHvGGiGF14rSntAMMq3VDSAtT&location=".$latitude.",".$longitude); |
|
124 | 124 | $location = json_decode($location, true); |
125 | 125 | $city = $location["results"][0]["locations"][0]["adminArea5"] ?? "Ingen ort"; |
126 | 126 | $location = [$city, $latitude, $longitude]; |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | $url = []; |
129 | 129 | $extra = "?lang=sv&units=auto"; |
130 | 130 | $time = time() - (30 * 24 * 60 * 60); |
131 | - for ($i=0; $i < 31; $i++) { |
|
132 | - $time = time() - ($i * 24 * 60 * 60); |
|
133 | - array_push($url, $darksky["url"]. $darksky["key"]. "/". $latitude. ",". $longitude. ",". $time. $extra); |
|
131 | + for ($i = 0; $i < 31; $i++) { |
|
132 | + $time = time() - ($i * 24 * 60 * 60); |
|
133 | + array_push($url, $darksky["url"].$darksky["key"]."/".$latitude.",".$longitude.",".$time.$extra); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | 137 | $mapDiv = $map->getMap($latitude, $longitude); |
138 | 138 | $weatherJson = $getJson->cUrlMulti($url); |
139 | 139 | $weather = []; |
140 | - for ($i=0; $i < count($weatherJson); $i++) { |
|
140 | + for ($i = 0; $i < count($weatherJson); $i++) { |
|
141 | 141 | array_push($weather, json_decode($weatherJson[$i], true)); |
142 | 142 | } |
143 | 143 |