1 | <?php |
||
3 | class MapUtil |
||
4 | { |
||
5 | |||
6 | /** |
||
7 | * @var string The Google Maps API key |
||
8 | */ |
||
9 | protected static $api_key; |
||
10 | |||
11 | /** |
||
12 | * @var int Number of active {@see GoogleMapsAPI} instances (for the HTML ID) |
||
13 | */ |
||
14 | protected static $instances = 0; |
||
15 | |||
16 | /** |
||
17 | * @var int The default width of a Google Map |
||
18 | */ |
||
19 | public static $map_width = '100%'; |
||
20 | |||
21 | /** |
||
22 | * @var int The default height of a Google Map |
||
23 | */ |
||
24 | public static $map_height = '400px'; |
||
25 | |||
26 | /** |
||
27 | * @var int Prefix for the div ID of the map |
||
28 | */ |
||
29 | public static $div_id = "google_map"; |
||
30 | |||
31 | /** |
||
32 | * @var boolean Automatic center/zoom for the map |
||
33 | */ |
||
34 | public static $automatic_center = true; |
||
35 | |||
36 | /** |
||
37 | * @var boolean Show the marker fields on the map |
||
38 | */ |
||
39 | public static $hide_marker = false; |
||
40 | |||
41 | |||
42 | |||
43 | |||
44 | /** |
||
45 | * @var boolean Show the marker fields on the map |
||
46 | */ |
||
47 | public static $map_type = 'google.maps.MapTypeId.ROADMAP'; |
||
48 | |||
49 | /** |
||
50 | * @var string $center Center of map (adress) |
||
51 | */ |
||
52 | public static $center = 'Paris, France'; |
||
53 | |||
54 | /* Signals whether at least one map has already been rendered */ |
||
55 | private static $map_already_rendered = false; |
||
56 | |||
57 | /* Whether or not to allow full screen */ |
||
58 | private static $allow_full_screen = null; |
||
59 | |||
60 | |||
61 | public static function reset() { |
||
74 | |||
75 | /** |
||
76 | * Set the API key for Google Maps |
||
77 | * |
||
78 | * @param string $key |
||
79 | */ |
||
80 | public static function set_api_key($key) { |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @param boolean $new_map_already_rendered |
||
87 | */ |
||
88 | public static function set_map_already_rendered($new_map_already_rendered) { |
||
91 | |||
92 | public static function get_map_already_rendered() { |
||
95 | |||
96 | /** |
||
97 | * Set the default size of the map |
||
98 | * |
||
99 | * @param int $width |
||
100 | * @param int $height |
||
101 | */ |
||
102 | public static function set_map_size($width, $height) { |
||
106 | |||
107 | /** |
||
108 | * FIXME - NOT USED? |
||
109 | * Set the type of the gmap |
||
110 | * |
||
111 | * @param string $mapType (can be 'google.maps.MapTypeId.ROADMAP', 'G_SATELLITE_MAP', |
||
112 | * 'G_HYBRID_MAP', 'G_PHYSICAL_MAP') |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | public static function set_map_type($mapType) { |
||
119 | |||
120 | /** |
||
121 | * Set the center of the gmap (an address, using text geocoder query) |
||
122 | * |
||
123 | * @param string $center GoogleMap center (an address) |
||
124 | * |
||
125 | * @return void |
||
126 | */ |
||
127 | public static function set_center($center) |
||
131 | |||
132 | /** |
||
133 | * Get a new GoogleMapAPI object and load it with the default settings |
||
134 | * |
||
135 | * @return MapAPI |
||
136 | */ |
||
137 | public static function instance() |
||
170 | |||
171 | |||
172 | /** |
||
173 | * Sanitize a string of HTML content for safe inclusion in the JavaScript |
||
174 | * for a Google Map |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | public static function sanitize($content) { |
||
181 | |||
182 | |||
183 | /** |
||
184 | * Creates a new {@link GoogleMapsAPI} object loaded with the default settings |
||
185 | * and places all of the items in a {@link SS_List} |
||
186 | * e.g. {@link DataList} or {@link ArrayList} on the map |
||
187 | * |
||
188 | * @param SS_List list of objects to display on a map |
||
189 | * @param array $infowindowtemplateparams Optional array of extra parameters to pass to the map info window |
||
190 | * @return MapAPI |
||
191 | */ |
||
192 | public static function get_map(SS_List $list, $infowindowtemplateparams) { |
||
202 | |||
203 | /** |
||
204 | * Determines if the current DataObject should be included to the map |
||
205 | * Checks if it has Mappable interface implemented |
||
206 | * If it has MapExtension included, the value of MapPinEdited is also checked |
||
207 | * |
||
208 | * @param DataObject $do |
||
209 | * @return bool |
||
210 | */ |
||
211 | private static function ChooseToAddDataobject(DataObject $do) { |
||
224 | } |
||
225 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.