/**
  * <p>Creates an instance of OpenWeatherMapCity.</p>
  *
  */
 function __construct()
 {
     $filePath = Config::get('storage.openweathermapcity.uri');
     if (is_file($filePath) && pathinfo($filePath, PATHINFO_EXTENSION) == 'txt' && is_readable($filePath)) {
         $this->_source = $filePath;
     }
 }
 /**
  * <p>Action: "MainController/location"</p>
  * 
  * @param string $query
  * @return void
  * @access public
  */
 public function location($query = '')
 {
     if (Request::isAjax()) {
         if (strlen($query) > 3 && preg_match('/^[A-z]+$/', $query)) {
             $file_path = Config::get('storage.openweathermapcity.uri');
             $openWeatherMapCity = parent::model('OpenWeatherMapCity', $file_path);
             $query = str_replace('_', ' ', $query);
             $openWeatherMapCity->search($query, 21);
             parent::view('components/search-results', $openWeatherMapCity->getResults());
             unset($openWeatherMapCity, $file_path);
         }
     }
 }
Exemplo n.º 3
0
 /**
  * <p<Creates an instance of TelizeAPI</p>
  *
  */
 public function __construct()
 {
     $this->_url = Config::get('api.telize.url');
 }
 /**
  * <p>Makes a call to "OpenWeatherMapAPI" for retrieving six Daily Weather Forecast for six days using additional parameters.</p>
  *
  * @param array $params
  * @return void
  * @access public
  */
 public function requestForecast($params = [])
 {
     $this->_url = Config::get('api.openweathermap.forecast.url');
     $this->_cache = Config::get('api.openweathermap.forecast.cache');
     $this->requestData($params);
 }