コード例 #1
0
 function display($station, $id)
 {
     //Set all errors on.
     error_reporting(E_ALL);
     ini_set('display_errors', '1');
     //Include the windguru classes
     include_once WP_PLUGIN_DIR . '/bytewindguru/windguru/windguru.inc.php';
     //Get forecast from windguru.
     $forecast = windguru_forecast($station, $id);
     //Update the default wg_images folder with actual location based on the plugins location with the site root.
     $new_path = plugins_url('/bytewindguru/windguru/wg_images');
     $forecast = str_replace('wg_images', $new_path, $forecast);
     //$debug = "Station:".$station." & ID: ".$id;
     return "<div id='windguru-" . $station . "' class='bytewindguru'>" . $forecast . "</div>";
     //.$debug;
 }
コード例 #2
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>WindGURU forecast TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="wg_images/wgstyle.css" type="text/css"/>
</head>
<body>
<?php 
error_reporting(E_ALL);
require_once 'windguru.inc.php';
// this will load the necessary classes
windguru_forecast(43, 'ad53f7d7f4');
windguru_forecast_cachetest();
// run the test
?>
</body>
</html>