function lower($str){
return strtolower($str);
}
function convert($str){
$str=str_replace(" ","_",$str);
return $str;
}
function revert($str){
$str=str_replace("_"," ",$str);
return $str;
}
function RemoveExtSpaces($str){
while (sizeof ($array=explode (" ",$str)) != 1){
// use one space for the glue
$str = implode (" ",$array);
}
return trim($str);
}
//$str=" Hello mr boy go ";
//$str_ch=RemoveExtSpaces($str);
//echo convert($str_ch);
function getWeather($city) {
echo $requestAddress = "http://www.google.com/ig/api?weather=".str_replace("-", " ", $city)."&hl=en";
// Downloads weather data based on location - I used my zip code.
$xml_str = @file_get_contents($requestAddress,0);
// Parses XML
$xml = new SimplexmlElement($xml_str);
// Loops XML
$count = 0;
if(isset($xml)){
foreach($xml->weather as $item) {
foreach($item->forecast_conditions as $new) {
?>
}
}
}
?>
}
function getSubStr($string, $init, $length){
global $live;
$substr=substr($string,$init,$length);
$sql_related="select distinct Postal_Code from codes where Postal_Code like '".$substr."%' and Postal_Code<>'$string' limit 5";
$res_related=mysql_query($sql_related);
$row_num=mysql_num_rows($res_related);
while($row_related=mysql_fetch_array($res_related)){
if($row_num>1){
$data.="".$row_related[Postal_Code].", ";
$row_num=$row_num-1;
}
else{
$data.="".$row_related[Postal_Code]."";
}
}
return $data;
}
class timeZone
{
var $postalcode;
var $key;
function showTimeZone($postalcode,$key){
$url="http://www.worldweatheronline.com/feed/tz.ashx?key=$key&q=$postalcode&format=xml";
$xml=simplexml_load_file($url);
return $xml->time_zone->utcOffset;
}
# SOURCE
# http://www.worldweatheronline.com/time-zone-api.aspx
}
function search($country){
if($country=="canada"){
?>
}else
echo "no data";
}
function search_array_val($val){
$array=array("Postal Code"=>1, "City"=>2, "Province"=>3);
return $array[$val];
}
function search_array_val_rev($val){
$array=array("1"=>"Postal Code", "2"=>"City", "3"=>"Province");
return $array[$val];
}
function page_like(){
global $live;
?>
return true;
}
function getaddress($lat,$lng)
{
$url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng).'&sensor=false';
$json = @file_get_contents($url);
$data=json_decode($json);
$status = $data->status;
if($status=="OK")
return $data->results[0]->formatted_address;
else
return false;
}
?>
require_once 'include/Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
?>