google_maps.php

Gesponsorde koppelingen

PHP script bestanden

  1. google_maps.php

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following
# conditions are met:
#
#    * Redistributions of source code must retain the above copyright notice,
#      this list of conditions and the following disclaimer.
#    * Redistributions in binary form must reproduce the above copyright notice, this
#      list of conditions and the following disclaimer in the documentation and/or
#      other materials provided with the distribution.
#    * Neither the name of ReFri Software / Internet Publicion nor the names of its contributors
#      may be used to endorse or promote products derived from this software without
#     specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# google_maps.php
#
# Plugin for Horizon QCMS but it can be used as a stand alone class too.

# Author : Cynthia Fridsma <[email protected]>
# http://www.refrisoftware.com
# More info about HNQCMS : http://www.hnqcms.com

# Copyright (c) 2006, 2012 ReFri Software / Internet Publication
# All rights reserved.

# Date : December 22, 2012




class google_maps {


    private $display_language;
    private $my_street;
    private $my_house_number;
    private $my_city;
    private $my_country;
    private $dest_street;
    private $dest_house_number;
    private $dest_country;


    function
show_my_address ($display_language, $my_street, $my_house_number, $my_city, $my_country){
        
        $display_language = trim(addslashes(strip_tags($display_language)));
        
        // your address
        
        $my_street = strtolower(trim(addslashes(strip_tags($my_street))));
        $my_house_number = intval($my_house_number);
        $my_city = strtolower(trim(addslashes(strip_tags($my_city))));
        $my_country = strtolower(trim(addslashes(strip_tags($my_country))));
        
        
        $my_street = str_replace(" ", "+", $my_street);
        $my_house_number = str_replace(" ", "+", $my_house_number);
        $my_city = str_replace(" ", "+", $my_city);
        $my_country = str_replace(" ", "+", $my_country);
        
        $my_street .= "+" . $my_house_number;        
        
        // Create the Google Map URL
        
        $google_map = "https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=".$display_language;
        $google_map .= "&amp;geocode=&amp;q=".$my_street .",+".$my_city;
        $google_map .= ",+".$my_country."&amp;ie=UTF8&amp;hq=&amp;hnear=";
        $google_map.= $my_street .",+".$my_city.",+".$my_country ."&amp;t=m&amp;z=14&amp;&amp;output=embed";
        
        
        // Create the Google Map IFrame + link to full screen
        
        $iframe = '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$google_map.'"></iframe>';
        $iframe .= '<br /><a href="'. $google_map .'" target="_blank">View Full Screen</a><br />';
        return $this->show_my_address=$iframe;
        
        
        
    }

    function
get_directions ($display_language, $my_street, $my_house_number, $my_city, $my_country,  $dest_street, $dest_house_number,$dest_city,$dest_country ){
        
        $display_language = trim(addslashes(strip_tags($display_language)));
        
        // Address to travel from
        
        $my_street = strtolower(trim(addslashes(strip_tags($my_street))));
        $my_house_number = intval($my_house_number);
        $my_city = strtolower(trim(addslashes(strip_tags($my_city))));
        $my_country = strtolower(trim(addslashes(strip_tags($my_country))));
        
        
        $my_street = str_replace(" ", "+", $my_street);
        $my_house_number = str_replace(" ", "+", $my_house_number);
        $my_city = str_replace(" ", "+", $my_city);
        $my_country = str_replace(" ", "+", $my_country);
        
        $my_street .= "+" . $my_house_number;        
        
        // The destination address
        $dest_street = strtolower(trim(addslashes(strip_tags($dest_street))));
        $dest_house_number = intval($dest_house_number);
        $dest_city = strtolower(trim(addslashes(strip_tags($dest_city))));
        $dest_country = strtolower(trim(addslashes(strip_tags($dest_country))));
        
        $dest_street = str_replace(" ", "+", $dest_street);
        $dest_house_number = str_replace(" ", "+", $dest_house_number);
        $dest_city = str_replace(" ", "+", $dest_city);
        $dest_country = str_replace(" ", "+", $dest_country);
        
        $dest_street .= "+" . $dest_house_number;    
        
        $google_map = "https://maps.google.com/maps?saddr=";
        $google_map.= "+".$my_street.",+".$my_city.",+".$my_country."&amp;";
        $google_map .="daddr=".$dest_street.",+".$dest_city.",+".$dest_country."&amp;ie=UTF8&amp;t=m&amp;&amp;hl=".$display_language."&amp;output=embed";
        
        // Create the Google Map IFrame + link to the directions
        
        $iframe = '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$google_map.'"></iframe>';
        $iframe .= '<br /><a href="https://maps.google.com/maps?saddr='.$my_street.',+'. $my_city.',+'.$my_country.'&daddr='.$dest_street.',+'.$dest_city.',+'.$dest_country .'&ie=UTF8&t=m&amp;hl='.$display_language.'&" target="_blank">';
        $iframe .= 'Get directions</a><br />';
        return $this->show_my_address=$iframe;
        
    }
}

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.