コード例 #1
0
ファイル: Openweathermap.php プロジェクト: n0rthface/Runalyze
 /**
  * Load conditions for location
  * @param Location $Location
  */
 public function loadForecast(Location $Location)
 {
     $this->Result = array();
     if ($Location->isOld() && $Location->hasLocationName()) {
         $this->setFromURL(self::URL_HISTORY . '/city?q=' . $Location->name() . '&start=' . $Location->time() . '&cnt=1');
     }
     if (empty($this->Result)) {
         if ($Location->hasPosition()) {
             $this->setFromURL(self::URL . '?lat=' . $Location->lat() . '&lon=' . $Location->lon());
         } elseif ($Location->hasLocationName()) {
             $this->setFromURL(self::URL . '?q=' . $Location->name(), $this->cacheKey($Location->name()));
         }
     }
 }
コード例 #2
0
ファイル: Openweathermap.php プロジェクト: aschix/Runalyze
 /**
  * Load conditions for location
  * @param Location $Location
  */
 public function loadForecast(Location $Location)
 {
     $this->Result = array();
     if ($Location->isOld() && $Location->hasLocationName()) {
         // Historical data needs a paid account (150$/month)
         // @see http://openweathermap.org/price
         //$this->setFromURL( self::URL_HISTORY.'/city?q='.$Location->name().'&start='.$Location->time().'&cnt=1' );
     }
     if (empty($this->Result)) {
         if ($Location->hasPosition()) {
             $this->setFromURL(self::URL . '?lat=' . $Location->lat() . '&lon=' . $Location->lon());
         } elseif ($Location->hasLocationName()) {
             $this->setFromURL(self::URL . '?q=' . $Location->name(), $this->cacheKey($Location->name()));
         }
     }
 }