Exemplo n.º 1
0
function curweather_network_mod_init(&$fk_app, &$b)
{
    if (!intval(get_pconfig(local_user(), 'curweather', 'curweather_enable'))) {
        return;
    }
    $fk_app->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
    // the getweather file does all the work here
    // the $rpt value is needed for location
    // which getweather uses to fetch the weather data for weather and temp
    $rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc');
    $wxdata = GetWeather::get($rpt);
    $temp = $wxdata['TEMPERATURE_STRING'];
    $weather = $wxdata['WEATHER'];
    $rhumid = $wxdata['RELATIVE_HUMIDITY'];
    $pressure = $wxdata['PRESSURE_STRING'];
    $wind = $wxdata['WIND_STRING'];
    $curweather = '<div id="curweather-network" class="widget">
                <div class="title tool">
                <h4>' . t("Current Weather") . '</h4></div>';
    $curweather .= "Weather: {$weather}<br />\n                 Temperature: {$temp}<br />\n\t\t Relative Humidity: {$rhumid}<br />\n\t\t Pressure: {$pressure}<br />\n\t\t Wind: {$wind}";
    $curweather .= '</div><div class="clear"></div>';
    $fk_app->page['aside'] = $curweather . $fk_app->page['aside'];
}
Exemplo n.º 2
0
 function endElement($parser, $name)
 {
     self::$wxdata[self::$itemname] = self::$itemdata;
     self::$itemdata = "";
 }
Exemplo n.º 3
0
<?php

function error($msg)
{
    return '<span style="font-size:10px;font-weight:normal;">' . $msg . '</span>';
}
$city = isset($_GET['loc']) ? $_GET['loc'] : '';
$deg = isset($_GET['deg']) ? $_GET['deg'] : 'c';
if (empty($city) || stristr($deg, 'DEGREE') || stristr($city, 'location')) {
    $out = error('read the readme!');
} else {
    require './get_weather.php';
    $api = new GetWeather($city, $deg);
    $res = $api->get_degree();
    if (empty($res)) {
        $out = error('ur doin somthn wrng');
    } else {
        file_put_contents($api->cache, $res);
        $out = $res . '&deg;';
    }
}
// Extra Options:
$refresh = isset($_GET['refresh']) && $_GET['refresh'] >= 60 * 30 ? $_GET['refresh'] : 60 * 30;
$ext_stylesheet = isset($_GET['style']) ? $_GET['style'] : '';
$font = isset($_GET['font']) ? $_GET['font'] : 'Helvetica Neue';
$font_color = isset($_GET['color']) ? $_GET['color'] : 'fff';
$font_size = isset($_GET['size']) ? $_GET['size'] : '20';
$opacity = isset($_GET['opacity']) ? $_GET['opacity'] : '1';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Exemplo n.º 4
0
 <?php 
require_once 'getweather.php';
$rpt = "KHVN";
$wxdata = GetWeather::get($rpt);
var_dump($rpt, $wxdata);