@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | $location = $this->objFromFixture('Location', 'dynamic'); |
| 8 | 8 | |
| 9 | - $coords = ((int)$location->Lat != 0 && (int)$location->Lng != 0) ? 'true' : 'false'; |
|
| 9 | + $coords = ((int) $location->Lat != 0 && (int) $location->Lng != 0) ? 'true' : 'false'; |
|
| 10 | 10 | |
| 11 | 11 | $this->assertEquals($coords, $location->getCoords()); |
| 12 | 12 | } |
@@ -189,7 +189,7 @@ |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * @return bool|string |
|
| 192 | + * @return string|false |
|
| 193 | 193 | */ |
| 194 | 194 | public function EmailAddress() |
| 195 | 195 | { |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | * @param array $filterAny |
| 90 | 90 | * @param array $exclude |
| 91 | 91 | * @param null|callable $callback |
| 92 | - * @return DataList|ArrayList |
|
| 92 | + * @return DataList |
|
| 93 | 93 | */ |
| 94 | 94 | public static function get_locations( |
| 95 | 95 | $filter = [], |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | Requirements::css('locator/css/map.css'); |
| 249 | 249 | Requirements::javascript('framework/thirdparty/jquery/jquery.js'); |
| 250 | - Requirements::javascript('https://maps.google.com/maps/api/js?key=' . $key); |
|
| 250 | + Requirements::javascript('https://maps.google.com/maps/api/js?key='.$key); |
|
| 251 | 251 | Requirements::javascript('locator/thirdparty/jquery-store-locator-plugin/assets/js/libs/handlebars.min.js'); |
| 252 | 252 | Requirements::javascript('locator/thirdparty/jquery-store-locator-plugin/assets/js/plugins/storeLocator/jquery.storelocator.js'); |
| 253 | 253 | |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | if ($limit < 1) $limit = -1; |
| 266 | 266 | if ($this->data()->AutoGeocode) { |
| 267 | 267 | $load = $featuredInList || $defaultCoords != '' || $isChrome |
| 268 | - ? 'autoGeocode: false, fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,' |
|
| 268 | + ? 'autoGeocode: false, fullMapStart: true, storeLimit: '.$limit.', maxDistance: true,' |
|
| 269 | 269 | : 'autoGeocode: true, fullMapStart: false,'; |
| 270 | 270 | } else { |
| 271 | - $load = 'autoGeocode: false, fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,'; |
|
| 271 | + $load = 'autoGeocode: false, fullMapStart: true, storeLimit: '.$limit.', maxDistance: true,'; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $listTemplatePath = Config::inst()->get('Locator_Controller', 'list_template_path'); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | unset($vars['url']); |
| 285 | 285 | $url = ''; |
| 286 | 286 | if (count($vars)) { |
| 287 | - $url .= '?' . http_build_query($vars); |
|
| 287 | + $url .= '?'.http_build_query($vars); |
|
| 288 | 288 | } |
| 289 | 289 | $link = Controller::join_links($this->AbsoluteLink(), 'xml.xml', $url); |
| 290 | 290 | $link = Controller::join_links($this->Link(), 'xml.xml', $url); |
@@ -297,19 +297,19 @@ discard block |
||
| 297 | 297 | Requirements::customScript(" |
| 298 | 298 | $(function(){ |
| 299 | 299 | $('#map-container').storeLocator({ |
| 300 | - " . $load . " |
|
| 301 | - dataLocation: '" . $link . "', |
|
| 302 | - listTemplatePath: '" . $listTemplatePath . "', |
|
| 303 | - infowindowTemplatePath: '" . $infowindowTemplatePath . "', |
|
| 300 | + " . $load." |
|
| 301 | + dataLocation: '" . $link."', |
|
| 302 | + listTemplatePath: '" . $listTemplatePath."', |
|
| 303 | + infowindowTemplatePath: '" . $infowindowTemplatePath."', |
|
| 304 | 304 | originMarker: true, |
| 305 | - //" . $modal . ", |
|
| 306 | - " . $featured . ", |
|
| 305 | + //" . $modal.", |
|
| 306 | + " . $featured.", |
|
| 307 | 307 | slideMap: false, |
| 308 | 308 | distanceAlert: -1, |
| 309 | - " . $kilometer . ", |
|
| 310 | - " . $defaultCoords . " |
|
| 311 | - mapID: '" . $map_id . "', |
|
| 312 | - locationList: '" . $list_class . "', |
|
| 309 | + " . $kilometer.", |
|
| 310 | + " . $defaultCoords." |
|
| 311 | + mapID: '" . $map_id."', |
|
| 312 | + locationList: '" . $list_class."', |
|
| 313 | 313 | mapSettings: { |
| 314 | 314 | zoom: 12, |
| 315 | 315 | mapTypeId: google.maps.MapTypeId.ROADMAP, |
@@ -414,8 +414,8 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if (Config::inst()->get('LocatorForm', 'show_radius')) { |
| 417 | - if ($radius = (int)$request->getVar('Radius')) { |
|
| 418 | - $locations = $locations->filterByCallback(function ($location) use (&$radius) { |
|
| 417 | + if ($radius = (int) $request->getVar('Radius')) { |
|
| 418 | + $locations = $locations->filterByCallback(function($location) use (&$radius) { |
|
| 419 | 419 | return $location->distance <= $radius; |
| 420 | 420 | }); |
| 421 | 421 | } |
@@ -262,7 +262,9 @@ |
||
| 262 | 262 | // map config based on user input in Settings tab |
| 263 | 263 | // AutoGeocode or Full Map |
| 264 | 264 | $limit = Config::inst()->get('Locator_Controller', 'limit'); |
| 265 | - if ($limit < 1) $limit = -1; |
|
| 265 | + if ($limit < 1) { |
|
| 266 | + $limit = -1; |
|
| 267 | + } |
|
| 266 | 268 | if ($this->data()->AutoGeocode) { |
| 267 | 269 | $load = $featuredInList || $defaultCoords != '' || $isChrome |
| 268 | 270 | ? 'autoGeocode: false, fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,' |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | /** |
| 6 | 6 | * @param SQLQuery $query |
| 7 | 7 | */ |
| 8 | - public function augmentSQL(SQLQuery &$query) |
|
| 8 | + public function augmentSQL(SQLQuery & $query) |
|
| 9 | 9 | { |
| 10 | 10 | $address = Controller::curr()->getRequest()->getVar('Address'); |
| 11 | 11 | if ($this->owner->hasMethod('updateAddressValue')) { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $query |
| 21 | 21 | ->addSelect(array( |
| 22 | - '( 3959 * acos( cos( radians(' . $Lat . ') ) * cos( radians( `Lat` ) ) * cos( radians( `Lng` ) - radians(' . $Lng . ') ) + sin( radians(' . $Lat . ') ) * sin( radians( `Lat` ) ) ) ) AS distance', |
|
| 22 | + '( 3959 * acos( cos( radians('.$Lat.') ) * cos( radians( `Lat` ) ) * cos( radians( `Lng` ) - radians('.$Lng.') ) + sin( radians('.$Lat.') ) * sin( radians( `Lat` ) ) ) ) AS distance', |
|
| 23 | 23 | )); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -28,9 +28,9 @@ |
||
| 28 | 28 | * @var array |
| 29 | 29 | */ |
| 30 | 30 | public $relationCallbacks = array( |
| 31 | - 'Category.Name' => array( |
|
| 32 | - 'relationname' => 'Category', |
|
| 33 | - 'callback' => 'getCategoryByName', |
|
| 31 | + 'Category.Name' => array( |
|
| 32 | + 'relationname' => 'Category', |
|
| 33 | + 'callback' => 'getCategoryByName', |
|
| 34 | 34 | ), |
| 35 | 35 | ); |
| 36 | 36 | |
@@ -74,7 +74,9 @@ |
||
| 74 | 74 | { |
| 75 | 75 | $validator = parent::getValidator(); |
| 76 | 76 | if (empty($validator)) { |
| 77 | - if (!$this->validator instanceof RequiredFields) $this->setValidator(RequiredFields::create('Address')); |
|
| 77 | + if (!$this->validator instanceof RequiredFields) { |
|
| 78 | + $this->setValidator(RequiredFields::create('Address')); |
|
| 79 | + } |
|
| 78 | 80 | $validator = $this->validator; |
| 79 | 81 | } |
| 80 | 82 | $this->extend('updateRequiredFields', $validator); |