示例#1
0
文件: index.php 项目: edmonsur/mods
/**
 * Yahoo Weather page
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Dimitri Schreiber
 */
function YahooWeather($citykey = 'GMXX2254', $cityname = 'München', $correct = -60, $time_difference = 1)
{
    include "/modules/YahooWeather/YahooWeather.php";
    try {
        $weather = new YahooWeather($citykey, $correct, $time_difference);
    } catch (Exception $e) {
        echo "Caught exception: " . $e->getMessage();
        exit;
    }
    if (!empty($weather->forecast)) {
        $weekdays = array(l('sun', '_YahooWeather'), l('mon', '_YahooWeather'), l('tue', '_YahooWeather'), l('wed', '_YahooWeather'), l('thu', '_YahooWeather'), l('fri', '_YahooWeather'), l('sat', '_YahooWeather'));
        echo '<h2 class="desc">' . l('desc', '_YahooWeather') . '</h2>';
        echo '<h3 class="weather">Aktuelle Wetterlage in München am heutigen ' . $weekdays[date("w", $weather->forecast[0][date])] . ', ' . date("d.m.Y", $weather->forecast[0][date]) . '</h3>';
        echo '<div class="weather_image">
                <img class="zoom" src="' . $weather->url . '" title="' . $weather->convert_condition($weather->condition_code) . '" alt="' . $weather->convert_condition((int) $weather->condition_code) . '"><br>' . $weather->convert_condition($weather->condition_code) . '</div>';
        echo '<div class="weather_temperature">
                <span class="current_temperature">' . $weather->temp . ' °C</span><br>
				влажность: ' . $weather->humidity . '%</div>	';
        echo '<div class="weather_humidity">
                <span class="weather_label">давление: </span>' . sprintf("%d", $weather->pressure * 0.75006375541921) . ' мм.рт.ст., ' . $weather->get_rising() . '<br>
				<span class="weather_label">ветер: </span>' . sprintf("%d", $weather->wind_speed * 1000 / 3600) . ' м/с (' . $weather->wind_speed . ' км/ч), 
   ' . $weather->get_wind_direction() . '<br>
                <span class="weather_label">восход Солнца: </span>' . date("H:i", $weather->correct_minutes($weather->sunrise)) . ', закат: ', date("H:i", $weather->correct_minutes($weather->sunset)) . '</div>';
        echo '<h3 class="weather">Прогноз погоды  на 4 дня</h3>';
        echo '<div class="weather_forecasts">';
        for ($i = 1; $i <= 4; $i++) {
            echo '<div class="weather_forecast">

        <div class="weather_forecast_day"><strong>' . $weekdays[date("w", $weather->forecast[$i][date])] . '</strong><br>
		' . date("d.m.Y", $weather->forecast[$i][date]) . '</div>


        <div class="weather_forecast_image"><img class="zoom" src="modules/YahooWeather/images/' . $weather->forecast[$i][code] . '.png" title="' . $weather->convert_condition($weather->forecast[$i][code]) . '" alt="' . $weather->convert_condition($weather->forecast[$i][code]) . '"></div>
	
        <div class="weather_forecast_condition">' . l('forecast', '_YahooWeather') . '<br>
		' . $weather->convert_condition($weather->forecast[$i][code]) . '</div>
		
		<div class="weather_forecast_high">
            Макс.: ' . $weather->forecast[$i][high] . '°C<br>
			Мин.: ' . $weather->forecast[$i][low] . '°C        </div>



</div>';
        }
        echo '</div>';
    } else {
        echo '<div>Не найдено данных для кода "' . $citykey . '"</div>';
    }
    //echo "<pre>";print_r($weather);echo "</pre>";
}
示例#2
0
文件: wetter.php 项目: mp84/pool
<?php

include 'YahooWeather.class.php';
// create an instance of the class with L.A.'s WOEID
$weather = new YahooWeather(682994, 'c');
$temperature = $weather->getTemperature();
$city = $weather->getLocationCity();
$country = $weather->getLocationCountry();
//$weather->getForecastHigh(4);
//echo "It is now $temperature in $city, $country. ";
$condition = $weather->getForecastConditionCode(0);
//echo "<img src=\"../icons/wetter/" . $condition . ".png\" height=\"70\">";
$count = count($weather->weather_forecast);
//echo $count;
$var = <<<HTML
<div class="wetterAppletHeute">
\t<div class="wetterTag">
\t\tHeute
\t\t<hr/>
\t</div>
\t<div class="wetterIcon">
\t\t<img src="../icons/wetter/{$weather->getForecastConditionCode(0)}.png" height="70">
\t</div>
\t<div class="wetterGradHeute">
\t\t{$weather->getTemperature()}
\t</div>
\t<div class="wetterTextHeute">
\t\t{$weather->getDescription()} 
\t</div>
\t<div style=""></div>
\t<div class="wetterHighHeute">