@@ -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 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class LatLongField extends FieldGroup { |
| 4 | 4 | |
| 5 | - static $allowed_actions = array ( |
|
| 5 | + static $allowed_actions = array( |
|
| 6 | 6 | 'geocode' |
| 7 | 7 | ); |
| 8 | 8 | |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | // the item currently has no location |
| 105 | 105 | $attributes['data-useMapBounds'] = true; |
| 106 | 106 | } |
| 107 | - $content = '<div class="editableMapWrapper">' . $this->createTag( |
|
| 107 | + $content = '<div class="editableMapWrapper">'.$this->createTag( |
|
| 108 | 108 | "div", |
| 109 | 109 | $attributes |
| 110 | - ) . '</div>'; |
|
| 110 | + ).'</div>'; |
|
| 111 | 111 | |
| 112 | 112 | $this->FieldList()->push(new LiteralField('locationEditor', $content)); |
| 113 | 113 | |
@@ -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 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @return void |
| 204 | 204 | */ |
| 205 | 205 | |
| 206 | - public function __construct($googleMapKey='') { |
|
| 206 | + public function __construct($googleMapKey = '') { |
|
| 207 | 207 | $this->googleMapKey = $googleMapKey; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | * @return void |
| 263 | 263 | */ |
| 264 | 264 | |
| 265 | - public function setClusterer($useClusterer, $gridSize=50, $maxZoom=17, |
|
| 266 | - $clustererLibraryPath='/mappable/javascript/google/markerclusterer.js') { |
|
| 265 | + public function setClusterer($useClusterer, $gridSize = 50, $maxZoom = 17, |
|
| 266 | + $clustererLibraryPath = '/mappable/javascript/google/markerclusterer.js') { |
|
| 267 | 267 | $this->useClusterer = $useClusterer; |
| 268 | 268 | $this->gridSize = $gridSize; |
| 269 | 269 | $this->maxZoom = $maxZoom; |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | * @return void |
| 559 | 559 | */ |
| 560 | 560 | |
| 561 | - public function addMarkerByCoords($lat, $lng, $html='', $category='', $icon='') { |
|
| 561 | + public function addMarkerByCoords($lat, $lng, $html = '', $category = '', $icon = '') { |
|
| 562 | 562 | $m = array( |
| 563 | 563 | 'latitude' => $lat, |
| 564 | 564 | 'longitude' => $lng, |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | * @return void |
| 583 | 583 | */ |
| 584 | 584 | |
| 585 | - public function addMarkerByAddress($address, $content='', $category='', $icon='') { |
|
| 585 | + public function addMarkerByAddress($address, $content = '', $category = '', $icon = '') { |
|
| 586 | 586 | $point = $this->geocoding($address); |
| 587 | - if ($point!==null) { |
|
| 587 | + if ($point !== null) { |
|
| 588 | 588 | $this->addMarkerByCoords($point[2], $point[3], $content, $category, $icon); |
| 589 | 589 | } else { |
| 590 | 590 | // throw new Exception('Adress not found : '.$address); |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * @return void |
| 603 | 603 | */ |
| 604 | 604 | |
| 605 | - public function addArrayMarkerByCoords($coordtab, $category='', $icon='') { |
|
| 605 | + public function addArrayMarkerByCoords($coordtab, $category = '', $icon = '') { |
|
| 606 | 606 | foreach ($coordtab as $coord) { |
| 607 | 607 | $this->addMarkerByCoords($coord[0], $coord[1], $coord[2], $category, $icon); |
| 608 | 608 | } |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | * @return void |
| 685 | 685 | */ |
| 686 | 686 | |
| 687 | - public function addArrayMarkerByAddress($coordtab, $category='', $icon='') { |
|
| 687 | + public function addArrayMarkerByAddress($coordtab, $category = '', $icon = '') { |
|
| 688 | 688 | foreach ($coordtab as $coord) { |
| 689 | 689 | $this->addMarkerByAddress($coord[0], $coord[1], $category, $icon); |
| 690 | 690 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | * @return void |
| 702 | 702 | */ |
| 703 | 703 | |
| 704 | - public function addDirection($from, $to, $idpanel='') { |
|
| 704 | + public function addDirection($from, $to, $idpanel = '') { |
|
| 705 | 705 | $this->contentMarker .= 'addDirection("'.$from.'","'.$to.'","'.$idpanel.'");'; |
| 706 | 706 | } |
| 707 | 707 | |
@@ -765,9 +765,9 @@ discard block |
||
| 765 | 765 | $linesJson = stripslashes($this->jsonRemoveUnicodeSequences($this->lines)); |
| 766 | 766 | $kmlJson = stripslashes($this->jsonRemoveUnicodeSequences($this->kmlFiles)); |
| 767 | 767 | } else { |
| 768 | - $jsonMarkers = stripslashes(json_encode($this->markers,JSON_UNESCAPED_UNICODE)); |
|
| 769 | - $linesJson = stripslashes(json_encode($this->lines,JSON_UNESCAPED_UNICODE)); |
|
| 770 | - $kmlJson = stripslashes(json_encode($this->kmlFiles,JSON_UNESCAPED_UNICODE)); |
|
| 768 | + $jsonMarkers = stripslashes(json_encode($this->markers, JSON_UNESCAPED_UNICODE)); |
|
| 769 | + $linesJson = stripslashes(json_encode($this->lines, JSON_UNESCAPED_UNICODE)); |
|
| 770 | + $kmlJson = stripslashes(json_encode($this->kmlFiles, JSON_UNESCAPED_UNICODE)); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | |
@@ -777,8 +777,8 @@ discard block |
||
| 777 | 777 | $this->latLongCenter : $this->geocoding($this->center); |
| 778 | 778 | |
| 779 | 779 | // coordinates for centre depending on which method used |
| 780 | - if ($geocodeCentre[0]=="200") { // success |
|
| 781 | - $latlngCentre = array('lat'=>$geocodeCentre[2],'lng' => $geocodeCentre[3]); |
|
| 780 | + if ($geocodeCentre[0] == "200") { // success |
|
| 781 | + $latlngCentre = array('lat'=>$geocodeCentre[2], 'lng' => $geocodeCentre[3]); |
|
| 782 | 782 | } else { // Paris |
| 783 | 783 | $latlngCentre = array('lat'=>48.8792, 'lng' => 2.34778); |
| 784 | 784 | } |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | return $result; |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - function processTemplateHTML($templateName, $templateVariables = null ) { |
|
| 873 | + function processTemplateHTML($templateName, $templateVariables = null) { |
|
| 874 | 874 | if (!$templateVariables) { |
| 875 | 875 | $templateVariables = new ArrayList(); |
| 876 | 876 | } |
@@ -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 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @return void |
| 146 | 146 | */ |
| 147 | 147 | |
| 148 | - public function set_icon_size($iconWidth,$iconHeight) |
|
| 148 | + public function set_icon_size($iconWidth, $iconHeight) |
|
| 149 | 149 | { |
| 150 | 150 | self::$iconWidth = $iconWidth; |
| 151 | 151 | self::$iconHeight = $iconHeight; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return string |
| 208 | 208 | */ |
| 209 | 209 | public static function sanitize($content) { |
| 210 | - return addslashes(str_replace(array("\n","\r", "\t"), '' ,$content)); |
|
| 210 | + return addslashes(str_replace(array("\n", "\r", "\t"), '', $content)); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public static function get_map(SS_List $list, $optionalinfowindowtemplatevalues) { |
| 223 | 223 | $gmap = self::instance(); |
| 224 | - if($list) { |
|
| 224 | + if ($list) { |
|
| 225 | 225 | foreach ($list as $mappable) { |
| 226 | 226 | if (self::ChooseToAddDataobject($mappable)) { |
| 227 | 227 | $gmap->addMarkerAsObject($mappable, $optionalinfowindowtemplatevalues); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | private static function ChooseToAddDataobject(DataObject $do) { |
| 243 | 243 | $isMappable = $do->is_a('Mappable'); |
| 244 | 244 | |
| 245 | - foreach($do->getExtensionInstances() as $extension) { |
|
| 245 | + foreach ($do->getExtensionInstances() as $extension) { |
|
| 246 | 246 | $isMappable = $isMappable || $extension instanceof Mappable; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -250,6 +250,6 @@ discard block |
||
| 250 | 250 | ? $do->MapPinEdited |
| 251 | 251 | : true; |
| 252 | 252 | |
| 253 | - return $isMappable && $filterMapPinEdited ; |
|
| 253 | + return $isMappable && $filterMapPinEdited; |
|
| 254 | 254 | } |
| 255 | 255 | } |
@@ -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; |