weathermap |
Subversion Repositories: |
Rev 1 | Rev 85 | |
---|---|---|
Line 7... | Line 7... | |
|
| |
class WeatherMapDataSource_static extends WeatherMapDataSource { |
class WeatherMapDataSource_static extends WeatherMapDataSource { | |
|
| |
function Recognise($targetstring) |
function Recognise($targetstring) | |
{ |
{ | |
if( preg_match("/^static:(\d+\.?\d*[KMGT]*):(\d+\.?\d*[KMGT]*)$/",$targetstring,$matches) || |
if( preg_match("/^static:(\-?\d+\.?\d*[KMGT]?):(\-?\d+\.?\d*[KMGT]?)$/",$targetstring,$matches) || | |
preg_match("/^static:(\d+\.?\d*[KMGT]*)$/",$targetstring,$matches) ) |
preg_match("/^static:(\-?\d+\.?\d*[KMGT]?)$/",$targetstring,$matches) ) | |
{ |
{ | |
return TRUE; |
return TRUE; | |
} |
} | |
else |
else | |
{ |
{ | |
Line 20... | Line 20... | |
} |
} | |
} |
} | |
|
| |
function ReadData($targetstring, &$map, &$item) |
function ReadData($targetstring, &$map, &$item) | |
{ |
{ | |
$inbw=-1; |
$inbw = NULL; | |
$outbw=-1; |
$outbw = NULL; | |
$data_time=0; |
$data_time=0; | |
|
| |
if(preg_match("/^static:(\d+\.?\d*[KMGT]*):(\d+\.?\d*[KMGT]*)$/",$targetstring,$matches)) |
if(preg_match("/^static:(\-?\d+\.?\d*[KMGT]*):(\-?\d+\.?\d*[KMGT]*)$/",$targetstring,$matches)) | |
{ |
{ | |
$inbw = unformat_number($matches[1]); |
$inbw = unformat_number($matches[1]); | |
$outbw = unformat_number($matches[2]); |
$outbw = unformat_number($matches[2]); | |
$data_time = time(); |
$data_time = time(); | |
} |
} | |
|
| |
if(preg_match("/^static:(\d+\.?\d*[KMGT]*)$/",$targetstring,$matches)) |
if(preg_match("/^static:(\-?\d+\.?\d*[KMGT]*)$/",$targetstring,$matches)) | |
{ |
{ | |
$inbw = unformat_number($matches[1]); |
$inbw = unformat_number($matches[1]); | |
$outbw = unformat_number($matches[1]); |
$outbw = unformat_number($matches[1]); | |
$data_time = time(); |
$data_time = time(); | |
} |
} |