58 | | foreach($data as $line) { |
59 | | if(strpos($line, 'this.sw') === false) |
60 | | continue; |
61 | | if(strpos($line, 'swTempCel') !== false) |
62 | | continue; |
63 | | |
64 | | $line = trim($line); |
65 | | list($name, $value) = explode(' = "', $line); |
66 | | $name = substr($name, 7); |
67 | | $value = substr($value, 0, strlen($value) - 2); |
68 | | |
69 | | switch ($name) { |
70 | | case 'City': $this->city = $value; break; |
71 | | case 'SubDiv': $this->subdiv = $value; break; |
72 | | case 'Country': $this->country = $value; break; |
73 | | case 'Region': $this->region = $value; break; |
74 | | case 'Temp': $this->Temperature = $value; break; |
75 | | case 'CIcon': $this->CIcon = $value; break; |
76 | | case 'WindS': $this->WindSpeed = $value; break; |
77 | | case 'WindD': $this->WindDirection = $value; break; |
78 | | case 'Baro': $this->BarometricPressure = $value; break; |
79 | | case 'Humid': $this->Humidity = $value; break; |
80 | | case 'Real': $this->Real = $value; break; |
81 | | case 'UV': $this->UV = $value; break; |
82 | | case 'Vis': $this->Visibility = $value; break; |
83 | | case 'LastUp': $this->LastUpdated = $value; break; |
84 | | case 'ConText': $this->ConText = $value; break; |
85 | | case 'Fore': $this->Forecast = $this->readForecast($value); break; |
86 | | default: /* Weird, unknown type */ break; |
87 | | } |
88 | | } |
| 70 | $this->LastUpdated=$this->in("<lsup>","</lsup>",$data); |
| 71 | $dnaminfo = $this->in("<dnam>","</dnam>",$data); |
| 72 | $sep = strpos($dnaminfo, ','); |
| 73 | if($sep != false) { |
| 74 | $this->city = substr($dnaminfo, 0, $sep); |
| 75 | $this->subdiv = substr($dnaminfo, $sep + 1, strlen($dnaminfo) - $sep - 1); |
| 76 | $this->country = " "; |
| 77 | $this->region = " "; |
| 78 | } |
| 79 | $this->Condition=$this->in("<t>","</t>",$data); |
| 80 | $this->Temperature=$this->in("<tmp>","</tmp>",$data); |
| 81 | $this->Real=$this->in("<flik>","</flik>",$data); |
| 82 | $barinfo = $this->in("<bar>","</bar>",$data); |
| 83 | $this->BarometricPressure=$this->in("<r>","</r>",$barinfo); |
| 84 | $windinfo = $this->in("<wind>","</wind>",$data); |
| 85 | $this->WindSpeed = $this->in("<s>","</s>",$windinfo); |
| 86 | $this->WindDirection = $this->in("<t>","</t>",$windinfo); |
| 87 | $this->Humidity = $this->in("<hmid>","</hmid>",$data); |
| 88 | $this->Visibility = $this->Humidity; |
| 89 | $this->Visibility = $this->in("<vis>","</vis>",$data); |
| 90 | $uvinfo = $this->in("<uv>","</uv>",$data); |
| 91 | $this->UV = $this->in("<i>","</i>",$uvinfo); |
| 92 | $this->CIcon = $this->in("<icon>","</icon>", $data); |
| 93 | $condinfo = $this->in("<cc>","<bar>",$data); |
| 94 | $this->ConText = $this->in("<t>","</t>",$condinfo); |
| 95 | $this->Forecast = $this->readForecast($data); |
145 | | $dayofweek = $data[$i] - 1; |
146 | | $forecast = new Forecast($data[5 + $i],$dayofweek); |
147 | | $forecast->dayofweek = $dayofweek; |
148 | | list($forecast->DescImage,$forecast->DescText) = $Weather_Types[$data[15 + $i]]; |
149 | | $forecast->DescImage = (strlen($forecast->DescImage) > 0) ? $forecast->DescImage : 'unknown.png'; |
150 | | $forecast->DescText = (strlen($forecast->DescText) > 0) ? $forecast->DescText : t('Unknown') . ' (' . $data[15+$i] . ')'; |
| 153 | $data1 = $this->in("<day d=\"".$i,"</day>",$data); |
| 154 | $forecast = new Forecast($this->LastUp,$i); |
| 155 | $forecast->dayofweek = $i; |
| 156 | |
| 157 | $fc = $this->in("<part p=\"d","</part>",$data1); |
| 158 | $forecast->DescText = $this->in("<t>","</t>",$fc); |
| 159 | $forecast->DescImage = 'unknown.png'; |
| 160 | |
| 161 | // list($forecast->DescImage,$forecast->DescText) = $Weather_Types[$data[15 + $i]]; |
| 162 | $forecast->HighTemperature = $this->in("<hi>","</hi>",$data1); |
| 163 | $forecast->LowTemperature = $this->in("<low>","</low>",$data1); |
| 164 | |