Beispiel #1
0
	function testWeather($location,&$params) {
    	 $w = new googleWeather();
       	 $w->enable_cache = $params->get("enable_cache",1);
       	 $w->cache_path = JPATH_CACHE;
       	 $ar_data = $w->get_weather_data($location);
       	 var_dump($ar_data);
	}
 function getContent($intEntryId, $arrInputfield, $arrTranslationStatus)
 {
     global $objDatabase, $_LANGID;
     $intId = intval($arrInputfield['id']);
     $objInputfieldValue = $objDatabase->Execute("\n            SELECT\n                `value`\n            FROM\n                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_inputfields\n            WHERE\n                field_id=" . $intId . "\n            AND\n                entry_id=" . $intEntryId . "\n            LIMIT 1\n        ");
     $strValue = strip_tags($objInputfieldValue->fields['value']);
     if (!empty($strValue)) {
         $objGoogleWeather = new \googleWeather();
         $objGoogleWeather->setWeatherLanguage($_LANGID);
         $objGoogleWeather->setWeatherLocation($strValue);
         $objGoogleWeather->setWeatherForecastDays(4);
         $objGoogleWeather->setWeatherShowTitle(false);
         $arrContent['TXT_' . $this->moduleLangVar . '_INPUTFIELD_NAME'] = htmlspecialchars($arrInputfield['name'][0], ENT_QUOTES, CONTREXX_CHARSET);
         $arrContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'] = $objGoogleWeather->getWeather();
     } else {
         $arrContent = null;
     }
     return $arrContent;
 }
Beispiel #3
0
<?

	// This is just an example usage for the Google_Weather class.
	
	require_once('lib/googleWeather.php');
	
	$gw = new googleWeather();
	$gw->place = "berlin, germany";
	$gw->locale = "de";
	$test = $gw->get_weather();
?>	
<p>
<? echo '<img src="'.$test['current']['icon'].'">'; ?>
</p>
<p>
<? echo $test['current']['condition']; ?>
</p>
<p>
<? echo $test['current']['temp_celsius']; ?>
</p>