@@ -8,15 +8,15 @@ |
||
| 8 | 8 | |
| 9 | 9 | public static function parse_googlestreetview($arguments, $caption = null, $parser = null) { |
| 10 | 10 | // each of latitude, longitude and heading are required at a bare minimum |
| 11 | - if(!isset($arguments['latitude'])){ |
|
| 11 | + if (!isset($arguments['latitude'])) { |
|
| 12 | 12 | return ''; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - if(!isset($arguments['longitude'])){ |
|
| 15 | + if (!isset($arguments['longitude'])) { |
|
| 16 | 16 | return ''; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if(!isset($arguments['heading'])){ |
|
| 19 | + if (!isset($arguments['heading'])) { |
|
| 20 | 20 | return ''; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -7,11 +7,11 @@ |
||
| 7 | 7 | |
| 8 | 8 | public static function parse_googlemap($arguments, $caption = null, $parser = null) { |
| 9 | 9 | // each of latitude and longitude are required at a bare minimum |
| 10 | - if(!isset($arguments['latitude'])){ |
|
| 10 | + if (!isset($arguments['latitude'])) { |
|
| 11 | 11 | return ''; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - if(!isset($arguments['longitude'])){ |
|
| 14 | + if (!isset($arguments['longitude'])) { |
|
| 15 | 15 | return ''; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $gmap = MapUtil::get_map($this->owner, $this->MarkerTemplateValues); |
| 28 | 28 | $w = $width ? $width : MapUtil::$map_width; |
| 29 | 29 | $h = $height ? $height : MapUtil::$map_height; |
| 30 | - $gmap->setSize($w,$h); |
|
| 30 | + $gmap->setSize($w, $h); |
|
| 31 | 31 | return $gmap; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -15,19 +15,19 @@ discard block |
||
| 15 | 15 | // legacy handling for old parameters: $title, $heading, ... |
| 16 | 16 | // instead of new handling: $name, $title, $heading, ... |
| 17 | 17 | $args = func_get_args(); |
| 18 | - if(!isset($args[1]) || is_numeric($args[1])) { |
|
| 18 | + if (!isset($args[1]) || is_numeric($args[1])) { |
|
| 19 | 19 | $title = (isset($args[0])) ? $args[0] : null; |
| 20 | 20 | // Use "HeaderField(title)" as the default field name for a HeaderField; |
| 21 | 21 | // if it's just set to title then we risk causing accidental duplicate-field creation. |
| 22 | 22 | |
| 23 | 23 | // this means i18nized fields won't be easily accessible through fieldByName() |
| 24 | - $name = 'MapField' . $title; |
|
| 24 | + $name = 'MapField'.$title; |
|
| 25 | 25 | $headingLevel = (isset($args[1])) ? $args[1] : null; |
| 26 | 26 | $allowHTML = (isset($args[2])) ? $args[2] : null; |
| 27 | 27 | $form = (isset($args[3])) ? $args[3] : null; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($headingLevel) $this->headingLevel = $headingLevel; |
|
| 30 | + if ($headingLevel) $this->headingLevel = $headingLevel; |
|
| 31 | 31 | $this->allowHTML = $allowHTML; |
| 32 | 32 | parent::__construct($name, $title, null, $allowHTML, $form); |
| 33 | 33 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | Requirements::css('mappable/css/mapField.css'); |
| 54 | 54 | |
| 55 | - return '<div class="editableMap">' . $this->createTag( |
|
| 55 | + return '<div class="editableMap">'.$this->createTag( |
|
| 56 | 56 | "div", |
| 57 | 57 | $attributes |
| 58 | - ) . '</div>'; |
|
| 58 | + ).'</div>'; |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $gmap = MapUtil::get_map(new ArrayList(array($this->owner)), $this->MarkerTemplateValues); |
| 41 | 41 | $w = $width ? $width : MapUtil::$map_width; |
| 42 | 42 | $h = $height ? $height : MapUtil::$map_height; |
| 43 | - $gmap->setSize($w,$h); |
|
| 43 | + $gmap->setSize($w, $h); |
|
| 44 | 44 | $gmap->setZoom($zoom); |
| 45 | 45 | $gmap->setEnableAutomaticCenterZoom(false); |
| 46 | 46 | if ($this->owner->MapPinEdited) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $urlparts['markers'] = "icon:$pin|$lat,$lng"; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $src = htmlentities($apiurl . '?' . http_build_query($urlparts)); |
|
| 92 | + $src = htmlentities($apiurl.'?'.http_build_query($urlparts)); |
|
| 93 | 93 | return '<img src="'.$src.'" width="'.$w.'" height="'.$h.'" alt="'.$this->owner->Title.'" />'; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | 'MapPinIcon' => 'Image' |
| 19 | 19 | ); |
| 20 | 20 | |
| 21 | - static $defaults = array ( |
|
| 21 | + static $defaults = array( |
|
| 22 | 22 | 'Lat' =>0, |
| 23 | 23 | 'Lon' => 0, |
| 24 | 24 | 'Zoom' => 4, |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // add any KML map layers |
| 147 | 147 | if (Object::has_extension($this->owner->ClassName, 'MapLayerExtension')) { |
| 148 | - foreach($this->owner->MapLayers() as $layer) { |
|
| 148 | + foreach ($this->owner->MapLayers() as $layer) { |
|
| 149 | 149 | $map->addKML($layer->KmlFile()->getAbsoluteURL()); |
| 150 | 150 | // we have a layer, so turn on autozoom |
| 151 | 151 | $autozoom = true; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | // add points of interest taking into account the default icon of the layer as an override |
| 157 | 157 | if (Object::has_extension($this->owner->ClassName, 'PointsOfInterestLayerExtension')) { |
| 158 | - foreach($this->owner->PointsOfInterestLayers() as $layer) { |
|
| 158 | + foreach ($this->owner->PointsOfInterestLayers() as $layer) { |
|
| 159 | 159 | $layericon = $layer->DefaultIcon(); |
| 160 | 160 | if ($layericon->ID === 0) { |
| 161 | 161 | $layericon = null; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function testSetSize() { |
| 61 | 61 | $map = $this->getMap(); |
| 62 | - $map->setSize('432px','1234px'); |
|
| 62 | + $map->setSize('432px', '1234px'); |
|
| 63 | 63 | $html = $map->forTemplate(); |
| 64 | 64 | $this->assertContains('style="width:432px; height: 1234px;"', $html); |
| 65 | 65 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | public function testSetCenter() { |
| 111 | 111 | $map = $this->getMap(); |
| 112 | 112 | $map->setIncludeDownloadJavascript(true); |
| 113 | - $map->setCenter(-23.714,47.149); |
|
| 113 | + $map->setCenter(-23.714, 47.149); |
|
| 114 | 114 | $html = $map->forTemplate(); |
| 115 | 115 | echo $html; |
| 116 | 116 | $expected = "data-centre='{\"lat\":023.714,\"lng\":47.149}'"; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | public function testSetLatLongCenter() { |
| 122 | 122 | $map = $this->getMap(); |
| 123 | 123 | $map->setIncludeDownloadJavascript(true); |
| 124 | - $map->setLatLongCenter(-23.714,47.149); |
|
| 124 | + $map->setLatLongCenter(-23.714, 47.149); |
|
| 125 | 125 | $html = $map->forTemplate(); |
| 126 | 126 | echo $html; |
| 127 | 127 | $expected = "data-centre='{\"lat\":023.714,\"lng\":47.149}'"; |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | public function test_set_icon_size() { |
| 127 | - MapUtil::set_icon_size(14,37); |
|
| 127 | + MapUtil::set_icon_size(14, 37); |
|
| 128 | 128 | $html = $this->htmlForMap(); |
| 129 | 129 | $html = $this->htmlForMap(); |
| 130 | 130 | echo $html; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | $instance = $this->getInstance(); |
| 21 | 21 | $vals = array('TestKey' => 'TestVal'); |
| 22 | 22 | $instance->setMarkerTemplateValues($vals); |
| 23 | - $html = $instance->getRenderableMap(300,800,2)->forTemplate(); |
|
| 24 | - $expected = ''; |
|
| 23 | + $html = $instance->getRenderableMap(300, 800, 2)->forTemplate(); |
|
| 24 | + $expected = ''; |
|
| 25 | 25 | $this->assertEquals($expected, $html); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $instance = $this->getInstance(); |
| 32 | 32 | $instance->Lat = 13.84; |
| 33 | 33 | $instance->Lon = 100.52; |
| 34 | - $html = $instance->StaticMap(300,800); |
|
| 34 | + $html = $instance->StaticMap(300, 800); |
|
| 35 | 35 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 36 | 36 | . '13.84%2C100.52&markers=13.84%2C100.52' |
| 37 | 37 | . '&zoom=13&size=300x800&sensor=false&mapt' |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | $instance = $this->getInstance(); |
| 44 | 44 | $instance->Lat = 13.8188931; |
| 45 | 45 | $instance->Lon = 100.5005558; |
| 46 | - $html = $instance->StaticMap(300,800); |
|
| 46 | + $html = $instance->StaticMap(300, 800); |
|
| 47 | 47 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 48 | 48 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 49 | 49 | . '558&zoom=13&size=300x800&sensor=false&mapt' |
| 50 | 50 | . 'ype=roadmap" width="300" height="800" alt="" />'; |
| 51 | 51 | $this->assertEquals($expected, $html); |
| 52 | 52 | |
| 53 | - $html = $instance->StaticMap(310,810); |
|
| 53 | + $html = $instance->StaticMap(310, 810); |
|
| 54 | 54 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 55 | 55 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 56 | 56 | . '558&zoom=13&size=310x810&sensor=false&mapt' |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | $instance = $this->getInstance(); |
| 64 | 64 | $instance->Lat = 13.8188931; |
| 65 | 65 | $instance->Lon = 100.5005558; |
| 66 | - $html = $instance->StaticMap(300,800, null, 'satellite'); |
|
| 66 | + $html = $instance->StaticMap(300, 800, null, 'satellite'); |
|
| 67 | 67 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 68 | 68 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 69 | 69 | . '558&zoom=13&size=300x800&sensor=false&mapt' |
| 70 | 70 | . 'ype=satellite" width="300" height="800" alt="" />'; |
| 71 | 71 | $this->assertEquals($expected, $html); |
| 72 | 72 | |
| 73 | - $html = $instance->StaticMap(300,800,null, 'terrain'); |
|
| 73 | + $html = $instance->StaticMap(300, 800, null, 'terrain'); |
|
| 74 | 74 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 75 | 75 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 76 | 76 | . '558&zoom=13&size=300x800&sensor=false&mapt' |
| 77 | 77 | . 'ype=terrain" width="300" height="800" alt="" />'; |
| 78 | 78 | |
| 79 | - $html = $instance->StaticMap(300,800,null, 'hybrid'); |
|
| 79 | + $html = $instance->StaticMap(300, 800, null, 'hybrid'); |
|
| 80 | 80 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 81 | 81 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 82 | 82 | . '558&zoom=13&size=300x800&sensor=false&mapt' |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | public function testStaticMapVaryZoom() { |
| 89 | 89 | $instance = $this->getInstance(); |
| 90 | 90 | |
| 91 | - $html = $instance->StaticMap(300,800,2); |
|
| 91 | + $html = $instance->StaticMap(300, 800, 2); |
|
| 92 | 92 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 93 | 93 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 94 | 94 | . '558&zoom=2&size=300x800&sensor=false&mapt' |
| 95 | 95 | . 'ype=roadmap" width="300" height="800" alt="" />'; |
| 96 | 96 | $this->assertEquals($expected, $html); |
| 97 | 97 | |
| 98 | - $html = $instance->StaticMap(300,800,12); |
|
| 98 | + $html = $instance->StaticMap(300, 800, 12); |
|
| 99 | 99 | $expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
| 100 | 100 | . '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
| 101 | 101 | . '558&zoom=12&size=300x800&sensor=false&mapt' |