This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if(isset($venue->categories['0'])) | |
| { | |
| echo '<image class="icon" src="'.$venue->categories['0']->icon->prefix.'32.png"/>'; | |
| } | |
| else | |
| echo '<image class="icon" src="https://foursquare.com/img/categories/building/default_88.png"/>'; | |
| echo '<a href="'.$venue->canonicalUrl.'" target="_blank"/><b>'; | |
| echo $venue->name; | |
| echo "</b></a><br/>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $NominatimURL = 'http://open.mapquestapi.com/nominatim/v1/search.php?format=json'; | |
| $name = urlencode( '[Parks],'.$city.','.$state.',US' ); | |
| $address = urlencode( '1' ); | |
| $limit = urlencode( '7' ); | |
| $bound = urlencode( '1' ); | |
| $data = file_get_contents( "{$NominatimURL}&q={$name}&addressdetails={$address}&limit={$limit}&bounded={$bound}" ); | |
| $results = json_decode($data); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if (!$results->error && $results->total != '0'): ?> | |
| <?php $counter = 1 ;?> | |
| <?php foreach ($results as &$result): ?> | |
| park = new MQA.Poi({ | |
| lat:<?php echo $result->lat; ?>, lng:<?php echo $result->lon; ?>}); | |
| park.setRolloverContent('<?php echo $result->address->park;?>'); | |
| park.setInfoContentHTML('<?php echo $result->address->road;?>'); | |
| var icon=new MQA.Icon("http://open.mapquestapi.com/staticmap/geticon?uri=poi-bluegreen_3-<?php echo $counter++ ;?>.png",20,29); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if (!$results->error && $results->total != '0'): ?> | |
| <h3>Parks</h3> | |
| <div id="parkData"> | |
| <?php $counter = 1 ;?> | |
| <table> | |
| <tr><td><b>#</b></td><td width="150px"><b>Name</b></td><td width="175px"><b>Address</b></td><td width="100px"><b>Distance</b></td></tr> | |
| <?php foreach ($results as &$result): ?> | |
| <tr> | |
| <td><?php echo $counter++ ;?></td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function distanceFrom(points) { | |
| var lat1 = points.lat1; | |
| var radianLat1 = lat1 * (Math.PI / 180); | |
| var lng1 = points.lng1; | |
| var radianLng1 = lng1 * (Math.PI / 180); | |
| var lat2 = points.lat2; | |
| var radianLat2 = lat2 * (Math.PI / 180); | |
| var lng2 = points.lng2; | |
| var radianLng2 = lng2 * (Math.PI / 180); | |
| var earth_radius = 3959; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $regex = '/@((([^.]+)\.)+)([a-zA-Z]{3,}|[a-zA-Z.]{5,})/'; | |
| preg_match($regex, 'test@gmail.com', $matches); | |
| print_r($matches); | |
| preg_match($regex, 'test@google.co.uk', $matches); | |
| print_r($matches); |