Conditions | 5 |
Paths | 10 |
Total Lines | 25 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public static function create_map($width = 640, $height = 640, $locationsAndIcons = array()) |
||
20 | { |
||
21 | $link = 'https://maps.googleapis.com/maps/api/staticmap?'. |
||
22 | 'autoscale=2'. |
||
23 | '&size='.$width.'x'.$height. |
||
24 | '&type=roadmap'. |
||
25 | '&format=png'. |
||
26 | '&visual_refresh=true'; |
||
27 | $key = Config::inst()->get('GoogleMapSmarter', 'api_key'); |
||
28 | if ($key) { |
||
29 | $link .= '&key='.$key; |
||
30 | } |
||
31 | |||
32 | |||
33 | foreach ($locationsAndIcons as $locationAndIcon) { |
||
34 | $location = $locationAndIcon[0]; |
||
35 | $iconLink = isset($locationAndIcon[1]) ? urlencode(Director::absoluteURL($locationAndIcon[1])) : ''; |
||
36 | if ($iconLink) { |
||
37 | $link .= '&markers=icon:'.$iconLink.'%7Cshadow:true%7C'.$location; |
||
38 | } else { |
||
39 | $link .= '&markers=size:mid%7Ccolor:0xff0000%7Clabel:%7C'.$location; |
||
40 | } |
||
41 | } |
||
42 | return $link; |
||
43 | } |
||
44 | } |
||
45 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.