Ejemplo n.º 1
0
function geoDistanceFromShortcode($attributes)
{
    recordGeoStats('distance');
    extract(shortcode_atts(array('address' => '1600 Pennsylvania Ave, Washington, DC 20500'), $attributes));
    $geoPosty = getGeoPosty();
    if (!is_array($geoPosty)) {
        return false;
    }
    $addressLatLon = geoGetAddressLocation($address);
    return getGeoDistance($geoPosty['Latitude'], $geoPosty['Longitude'], $addressLatLon['latitude'], $addressLatLon['longitude']);
}
Ejemplo n.º 2
0
 function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $instance['title'] = strip_tags($new_instance['title']);
     $instance['search'] = strip_tags($new_instance['search']);
     $instance['results'] = strip_tags($new_instance['results']);
     $instance['distancefrom'] = strip_tags($new_instance['distancefrom']);
     $instance['miles'] = strip_tags($new_instance['miles']);
     $instance['locationtype'] = strip_tags($new_instance['locationtype']);
     $instance['location'] = strip_tags($new_instance['location']);
     $instance['reverse'] = strip_tags($new_instance['reverse']);
     // preload the distance cache!
     if (!empty($instance['distancefrom'])) {
         geoGetAddressLocation($instance['distancefrom']);
     }
     return $instance;
 }
Ejemplo n.º 3
0
function geoDistanceFrom($address)
{
    $geoPosty = getGeoPosty();
    if (!is_array($geoPosty)) {
        return false;
    }
    $latlng = geoGetAddressLocation($address);
    return getGeoDistance($geoPosty['Latitude'], $geoPosty['Longitude'], $latlng['latitude'], $latlng['longitude']);
}