diff --git a/application/controllers/front/page.php b/application/controllers/front/page.php index 48fd849..cffeff0 100644 --- a/application/controllers/front/page.php +++ b/application/controllers/front/page.php @@ -68,49 +68,15 @@ class Page_Controller extends Base_Front_Controller $this->view->meta_keywords = $page->meta_keywords; } - $gmap = new Gmap('gmap', array - ( - #'ScrollWheelZoom' => true, - 'DoubleClickZoom' => true, - 'ContinuousZoom' => true, - #'InfoWindow' => true, - )); - $center = Kohana::config('application.gmaps.center'); - // Set the map center point - $gmap->center($center['lat'], $center['lon'], $center['zoom'])->controls('small'); - - // Add a custom marker icon -/* $gmap->add_icon('tinyIcon', array - ( - 'image' => 'http://labs.google.com/ridefinder/images/mm_20_red.png', - 'shadow' => 'http://labs.google.com/ridefinder/images/mm_20_shadow.png', - 'iconSize' => array('12', '20'), - 'shadowSize' => array('22', '20'), - 'iconAnchor' => array('6', '20'), - 'infoWindowAnchor' => array('6', '20') - )); -*/ - $gmap->add_icon('markerIcon', array - ( - 'image' => 'http://www.google.com/intl/en_ALL/mapfiles/marker.png', - 'shadow' => 'http://www.google.com/intl/en_ALL/mapfiles/shadow50.png', - 'iconSize' => array('20', '34'), - 'shadowSize' => array('37', '34'), - 'iconAnchor' => array('10', '34'), - 'infoWindowAnchor' => array('10', '34') - )); - $marker = Kohana::config('application.gmaps.marker'); - // Add a new marker - $gmap->add_marker($marker['lat'], $marker['lon'], $marker['html'], array('icon' => 'markerIcon', 'title' => $marker['title'])); $page_view->page = $page; + $page_view->map_center = $center; + $page_view->map_marker = $marker; $this->view->content = $page_view; - $this->view->api_url = Gmap::api_url(); - $this->view->gmap = $gmap->render(); $this->view->message = $this->session->get('message'); $this->view->render(true); } -} \ No newline at end of file +} diff --git a/application/views/front/page_contact.php b/application/views/front/page_contact.php index e72c877..7f1f082 100644 --- a/application/views/front/page_contact.php +++ b/application/views/front/page_contact.php @@ -4,6 +4,27 @@
content ?>
-
mapa
+ $map_query, + 'll' => $map_query, + 'z' => $map_zoom, + 'output' => 'embed', + )); + ?> +
diff --git a/css/default.css b/css/default.css index 0628c85..1bbcfc4 100644 --- a/css/default.css +++ b/css/default.css @@ -285,6 +285,8 @@ bottom: 5px; #gmap { width: 500px; height: 400px; + border: 0; + display: block; overflow: hidden; color: #000; } @@ -327,4 +329,4 @@ bottom: 5px; #created a { color: #eee; -} \ No newline at end of file +} diff --git a/system/helpers/valid.php b/system/helpers/valid.php index 8a3583b..a6a6744 100644 --- a/system/helpers/valid.php +++ b/system/helpers/valid.php @@ -75,9 +75,28 @@ class valid_Core { * @param string URL * @return boolean */ - public static function url($url) + public static function url($url, $scheme = NULL) { - return (bool) filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED); + if ( ! is_string($url) OR $url === '') + return FALSE; + + $parts = @parse_url($url); + + if ( ! is_array($parts) OR empty($parts['scheme']) OR empty($parts['host'])) + return FALSE; + + if ( ! preg_match('/^[a-z][a-z0-9+.-]*$/iD', $parts['scheme'])) + return FALSE; + + if ($scheme !== NULL) + { + $url_scheme = strtolower($parts['scheme']); + $schemes = array_map('strtolower', (array) $scheme); + + return in_array($url_scheme, $schemes, TRUE); + } + + return TRUE; } /** @@ -335,4 +354,4 @@ class valid_Core { return (bool) preg_match($pattern, (string) $str); } -} // End valid \ No newline at end of file +} // End valid