У меня в app_openweather.class.php такой код:
Код: Выделить всё
/**
* Get weather icon
* @param string $image weather icon name
* @return string
*/
private static function getWeatherIcon($image)
{
if ($image == '') retrun;
$fileName = $image . '.png';
$urlIcon = "http://openweathermap.org/img/w/" . $fileName;
if(gg('ow_setting.ow_imagecache') == 'on')
{
$filePath = ROOT.'cached' . DIRECTORY_SEPARATOR . 'openweather' . DIRECTORY_SEPARATOR . 'image';
if (!is_dir($filePath))
{
@mkdir(ROOT . 'cached', 0777);
@mkdir(ROOT . 'cached' . DIRECTORY_SEPARATOR . 'openweather', 0777);
@mkdir($filePath, 0777);
}
if (!file_exists($filePath . DIRECTORY_SEPARATOR . $fileName))
{
$contents = file_get_contents($urlIcon);
if ($contents)
{
SaveFile($filePath . DIRECTORY_SEPARATOR . $fileName, $contents);
}
}
$urlIcon = ROOTHTML . "cached/openweather/image/" . $fileName;
}
return $urlIcon;
}