예제 #1
0
 function widget($args, $instance)
 {
     global $posty_plugin_url;
     // $data = get_option('postyMap');
     extract($args, EXTR_SKIP);
     if (!empty($instance['distancefrom']) && $instance['miles'] > 1) {
         if ($instance['reverse'] && geoDistanceFrom($instance['distancefrom']) < $instance['miles']) {
             return false;
         } elseif (!$instance['reverse'] && geoDistanceFrom($instance['distancefrom']) > $instance['miles']) {
             return false;
         }
     }
     $locationTest = geoLocationContent($instance['locationtype'], $instance['location'], $instance['reverse']);
     if (!$locationTest) {
         return false;
     }
     recordGeoStats('w_googlemap');
     echo $args['before_widget'];
     echo $args['before_title'] . do_shortcode(stripslashes($instance['title'])) . $args['after_title'];
     echo geoGoogleMap($instance['width'], $instance['height'], $instance['search'], $instance['results']);
     echo $args['after_widget'];
 }
예제 #2
0
function geoGoogleMapShortcode($attributes)
{
    recordGeoStats('googlemap');
    extract(shortcode_atts(array('width' => '200', 'height' => '200', 'search' => '', 'results' => '0', 'miles' => '', 'distancefrom' => '', 'locationtype' => '', 'location' => '', 'reverse' => false), $attributes));
    if (!empty($distancefrom) && $miles > 1) {
        if ($reverse && geoDistanceFrom($distancefrom) < $miles) {
            return false;
        } elseif (!$reverse && geoDistanceFrom($distancefrom) > $miles) {
            return false;
        }
    }
    $locationTest = geoLocationContent($locationtype, $location, $reverse);
    if (!$locationTest) {
        return false;
    }
    return geoGoogleMap($width, $height, $search, $results);
}