示例#1
1
 public function index()
 {
     $address = "692 Elgin St.";
     $city = "Newmarket";
     $province = "ON";
     $postal_code = "L3Y 3B4";
     $country = "Canada";
     $opt = array('address' => urlencode($address . ', ' . $city . ', ' . $province . ', ' . $postal_code . ', ' . $country), 'sensor' => 'false');
     // now simply call the function
     $result = getLatLng($opt);
     $lat = $result['lat'];
     $lon = $result['lon'];
     $address = $address . ', ' . $city . ', ' . $province . ', ' . $postal_code . ', ' . $country;
     return view('maps/index', compact('lat', 'lon', 'address'));
 }
示例#2
1
    //    $result = json_decode($result);
    //    displayForecast($result);
    return $result;
}
function getLatLng()
{
    $streetAddress = $_GET['streetAddress'];
    $city = $_GET['city'];
    $state = $_GET['state'];
    $urlstreetAdd = urlencode($streetAddress);
    $urlCity = urlencode($city);
    $geoCodingLink = "https://maps.googleapis.com/maps/api/geocode/xml?address=" . $urlstreetAdd . "," . $urlCity . "," . "{$state}";
    $geoCodeContent = simplexml_load_file($geoCodingLink);
    if ($geoCodeContent->status == "OK") {
        $lat = $geoCodeContent->result->geometry->location->lat;
        $lng = $geoCodeContent->result->geometry->location->lng;
        $result = getForecast($lat, $lng);
        return $result;
    } else {
        return 101;
        //invalid address
    }
}
if (isset($_GET['submit'])) {
    $result = getLatLng();
    if (!is_numeric($result)) {
        echo $result;
    } else {
        //process error
    }
}
示例#3
0
 $cluster = strtolower($get['cluster']) == 'no' ? 'false' : 'true';
 // default YES
 $show_overlay = strtolower($get['show_overlay']) == 'yes' ? 'true' : 'false';
 // default NO
 $overlay_title = $get['overlay_title'];
 // default Empty String ''
 $overlay_blurb = $get['overlay_blurb'];
 // default Empty String ''
 $overlay_content = $get['overlay_content'];
 // default Empty String ''
 $show_legend = strtolower($get['show_legend']) == 'yes' ? 'true' : 'false';
 // default NO
 $legend_content = $get['legend_content'];
 // default Empty String ''
 /* Marker Properties */
 $latlng = getLatLng($get['address']);
 if ($latlng) {
     $address = $get['address'];
     $latitude = $latlng['lat'];
     $longitude = $latlng['lng'];
     $description = isset($get['description']) ? $get['description'] : '';
     $marker_color = strtolower($get['marker_color']);
     $marker_style = strtolower($get['marker_style']);
     $get_direction = strtolower($get['get_direction']) == 'yes' ? 'true' : 'false';
     $bootstrap_popup = strtolower($get['use_infobox']) == 'yes' ? 'true' : 'false';
     $showlocation = strtolower($get['showlocation']) == 'yes' ? 'true' : 'false';
     $hide_label = strtolower($get['hide_label']) == 'no' ? 'false' : 'true';
     $mapId = createMap($user['id'], $height, $width, $zoom, $defaultopen, $showsidebar, 'true', $name, '[' . $latlng['lat'] . ',' . $latlng['lng'] . ']', $password, '[]');
     if ($mapId) {
         updateMap($mapId, $user['id'], 'cluster', $cluster);
         updateMap($mapId, $user['id'], 'show_overlay', $show_overlay);
<?php

$user = get_option('colabs_type_instagram');
$limit = get_option('colabs_piccount_instagram');
$tag = get_option('colabs_tag_instagram');
$address = get_option('colabs_address_instagram');
$getlatlang = getLatLng($address);
if (empty($limit)) {
    $limit = 10;
}
$nextMaxId = '';
$max_id = $nextMaxId;
$piccounter = 1;
$token = ColabsInstagram::getAccessToken();
if ($token) {
    if (!empty($getlatlang)) {
        $data = ColabsInstagram::getLocationBasedFeed($getlatlang);
    } else {
        if (empty($tag)) {
            $data = ColabsInstagram::getFeedByUserId($user, $max_id, $nextMaxId);
        } else {
            $data = ColabsInstagram::getFeedByTag($tag, $max_id, $nextMaxId);
        }
    }
    if (count($data) > 0) {
        if (get_option('colabs_random_instagram') == 'true') {
            shuffle($data);
        }
        foreach ($data as $obj) {
            if (intval($limit) > 0 && $piccounter > $limit) {
                break;
示例#5
0
    function get_gallery_images($attr = array())
    {
        global $omnigallery, $scinstagram, $post;
        static $instance = 0;
        $instance++;
        $attr = array_merge(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'width' => '150', 'height' => '150'), $attr);
        extract($attr);
        $id = intval($id);
        $type = get_option('sc_type_instagram');
        $limit = get_option('sc_piccount_instagram');
        $tag = get_option('sc_tag_instagram');
        $address = get_option('sc_address_instagram');
        $getlatlang = getLatLng($address);
        if (empty($limit)) {
            $limit = 10;
        }
        $nextMaxId = '';
        $max_id = $nextMaxId;
        $piccounter = 1;
        $token = SCInstagram::getAccessToken();
        $instagramOptions = SCInstagram::getInstance()->getOptions();
        $accessToken = SCInstagram::getInstance()->getAccessToken();
        $user = $instagramOptions['scinstagram_user_username'];
        $values = array('userid' => $user, 'tag' => $tag, 'piccount' => $limit);
        if (empty($tag)) {
            $user = $values['userid'];
            if (!is_numeric($values['userid']) && $type != 'popular' && $type != 'feed' && strlen($values['userid'])) {
                $user = SCInstagram::getUserIdByName($values['userid']);
            }
        }
        if (!empty($getlatlang)) {
            $data = SCInstagram::getLocationBasedFeed($getlatlang);
        } else {
            if (empty($tag)) {
                $data = SCInstagram::getFeedByUserId($user, $max_id, $nextMaxId);
            } else {
                $data = SCInstagram::getFeedByTag($tag, $max_id, $nextMaxId);
            }
        }
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
        $float = is_rtl() ? 'right' : 'left';
        $selector = "sc_gallery_instagram-{$instance}";
        $return = '';
        $size_class = sanitize_html_class($size);
        $return .= "\r\n\t\t<style type='text/css'>\r\n\t\t\t#{$selector} {\r\n\t\t\t\tmargin: auto;\r\n                display: block\r\n\t\t\t}\r\n\t\t\t#{$selector}:after {\r\n                width: 0;\r\n                height: 0;\r\n                clear: both;\r\n                content: ' ';\r\n                display: block;\r\n                overflow: hidden;\r\n                visibility: hidden;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-item {\r\n\t\t\t\tfloat: {$float};\r\n\t\t\t\tmargin-top: 10px;\r\n\t\t\t\ttext-align: center;\r\n\t\t\t\twidth: {$itemwidth}%;\r\n\t\t\t}\r\n\t\t\t#{$selector} img {\r\n\t\t\t\tborder: 2px solid #cfcfcf;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-caption {\r\n\t\t\t\tmargin-left: 0;\r\n\t\t\t}\r\n\t\t</style>";
        $return .= "<div id='{$selector}' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
        if (count($data) > 0) {
            if (get_option('sc_random_instagram') == 'true') {
                shuffle($data);
            }
            foreach ($data as $obj) {
                if (intval($limit) > 0 && $piccounter > $limit) {
                    break;
                }
                $return .= '
                <dl class="gallery-item">
                    <dt class="gallery-icon">
						<a href="' . $obj->images->standard_resolution->url . '" title="' . $obj->caption->text . '" rel="lightbox-" target="_blank">
                            <img src="' . $omnigallery->plugin_url . '/includes/timthumb.php?src=' . $obj->images->low_resolution->url . '&amp;w=' . $width . '&amp;h=' . $height . '&amp;zc=1&amp;q=90" alt="Instagram Gallery" class="sc-image" width="' . $width . '">
							<!--img src="' . $obj->images->low_resolution->url . '" alt="Instagram Gallery" class="sc-image ' . $size . '" width="' . $width . '" height="' . $height . '"-->
						</a>
                    </dt>
                </dl>';
                $piccounter++;
            }
        }
        $return .= '</div><!--/#gallery-->';
        //$return .= esc_attr( $instagramOptions['scinstagram_user_username'] ).' --- '.$accessToken.' --- '.$user;
        return $return;
    }
示例#6
0
     redirect(BASEURL . "app/map-edit.php?id=" . $mapId);
 } else {
     $user = getUserInfo();
     if (isset($_POST['name']) && isset($_POST['pk']) && isset($_POST['value'])) {
         $name = $_POST['name'];
         $value = $_POST['value'];
         $pk = $_POST['pk'];
         $pk = explode(',', $pk);
         if (count($pk) == 2) {
             // save request for Marker
             $maps_id = $pk[0];
             $markers_id = $pk[1];
             $nameArray = array("address", "description", "mcolor", "mstyle");
             if (in_array($name, $nameArray)) {
                 if ($name == "address") {
                     $latlng = getLatLng($value);
                     if (!$latlng) {
                         $error = "Invalid Address!";
                     } else {
                         updateMarker($maps_id, $markers_id, $user['id'], 'lat', $latlng['lat']);
                         updateMarker($maps_id, $markers_id, $user['id'], 'lng', $latlng['lng']);
                     }
                 }
                 updateMarker($maps_id, $markers_id, $user['id'], $name, $value);
             } else {
                 $error = "Invalid Data Sent";
             }
         } else {
             if (count($pk) == 1) {
                 // save request for Map
                 $maps_id = $pk[0];