--- a/include/common-geo.inc.php +++ b/include/common-geo.inc.php @@ -3,64 +3,66 @@ /* * Copyright 2010,2011 Alexander Sadleir - Licensed under the Apache License, Version 2.0 (the "License"); + Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, + distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',') -$suburbs = explode(",", "Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla"); +$suburbs = explode(',', 'Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O\'Connor,O\'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla'); function staticmap($mapPoints, $collapsible = true, $twotone = false, $path = false, $numbered = false) { - $markers = ""; + $markers = ''; $height = 300; $width = $height; $index = 0; if (sizeof($mapPoints) < 1) - return "map error"; + return 'map error'; if (sizeof($mapPoints) === 1) { - $markers = "markers={$mapPoints[0][0]},{$mapPoints[0][1]}"; + $markers = 'markers={$mapPoints[0][0]},{$mapPoints[0][1]}'; } else { if (!$numbered) { - $markers = "markers="; + $markers = 'markers='; } if ($path) { - $markers.= "markers={$mapPoints[0][0]},{$mapPoints[0][1]}&path="; + $markers.= 'markers={$mapPoints[0][0]},{$mapPoints[0][1]}&path='; } foreach ($mapPoints as $index => $mapPoint) { if ($twotone && $index == 0) { - $markers = "markerd=color:red|".$mapPoint[0] . "," . $mapPoint[1]."&markers="; + $markers = 'markerd=color:red|' . $mapPoint[0] . ',' . $mapPoint[1] . '&markers='; } else { if ($numbered) { $label = ($index > 9 ? 9 : $index); - $markers.= "markers=label:$label|" . $mapPoint[0] . "," . $mapPoint[1]; + $markers.= 'markers=label:' . $label . '|' . $mapPoint[0] . ',' . $mapPoint[1]; if ($index + 1 != sizeof($mapPoints)) { - $markers.= "&"; + $markers.= '&'; } } else { - $markers.= $mapPoint[0] . "," . $mapPoint[1]; + $markers.= $mapPoint[0] . ',' . $mapPoint[1]; if ($index + 1 != sizeof($mapPoints)) { - $markers.= "|"; + $markers.= '|'; } } $index++; } } } - $output = ""; + $output = ''; if ($collapsible) $output.= '

Open Map...

'; - if (isIOSDevice()) $output.= 'map of stop location'; - else $output.= 'map of stop location'; - + if (isIOSDevice()) + $output.= 'map of stop location'; + else + $output.= 'map of stop location'; + if ($collapsible) $output.= '
'; return $output; @@ -82,7 +84,7 @@ if ($km < 1) return floor($km * 1000); else - return round($km, 2) . "k"; + return round($km, 2) . 'k'; } else return floor($km * 1000); @@ -151,19 +153,19 @@ function geocode($query, $giveOptions) { global $cloudmadeAPIkey; - $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=" . urlencode($query) . "&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true"; + $url = 'http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=' . urlencode($query) . '&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true'; $contents = json_decode(getPage($url)); if ($giveOptions) return $contents->features; elseif (isset($contents->features[0]->centroid)) - return $contents->features[0]->centroid->coordinates[0] . "," . $contents->features[0]->centroid->coordinates[1]; + return $contents->features[0]->centroid->coordinates[0] . ',' . $contents->features[0]->centroid->coordinates[1]; else - return ""; + return ''; } function reverseGeocode($lat, $lng) { global $cloudmadeAPIkey; - $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=" . $lat . "," . $lng . "&distance=closest&object_type=road"; + $url = 'http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=' . $lat . ',' . $lng . '&distance=closest&object_type=road'; $contents = json_decode(getPage($url)); return $contents->features[0]->properties->name; }