jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [lib/] [datasources/] [WeatherMapDataSource_skeleton.php.txt] - Blame information for rev 138

 

Line No. Rev Author Line
185simandl<?php
2//
3// This is a sample 'empty' DS plugin, in case you want to make your own.
4// it's what the fping plugin looked like before I added the code in.
5//
6// Pluggable datasource for PHP Weathermap 0.9
7// - return a live ping result
8 
9// TARGET fping:ipaddress
10// TARGET fping:hostname
11 
12class WeatherMapDataSource_fping extends WeatherMapDataSource {
13 
14 function Init(&$map)
15 {
16 return(TRUE);
17 }
18 
19 
20 function Recognise($targetstring)
21 {
22 if(preg_match("/^ping:(\S+)$/",$targetstring,$matches))
23 {
24 return TRUE;
25 }
26 else
27 {
28 return FALSE;
29 }
30 }
31 
32 function ReadData($targetstring, &$map, &$item)
33 {
34 $data[IN] = NULL;
35 $data[OUT] = NULL;
36 $data_time = 0;
37 
38 if(preg_match("/^ping:(\S+)$/",$targetstring,$matches))
39 {
40 }
41 
42 debug ("FPing ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[IN]).",$data_time)\n");
43 
44 return( array($data[IN], $data[OUT], $data_time) );
45 }
46}
47 
48// vim:ts=4:sw=4:
49?>

Powered by WebSVN 2.2.1