@@ -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 = [], |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | Requirements::css('locator/css/map.css'); |
| 237 | 237 | Requirements::javascript('framework/thirdparty/jquery/jquery.js'); |
| 238 | - Requirements::javascript('https://maps.google.com/maps/api/js?key=' . $key); |
|
| 238 | + Requirements::javascript('https://maps.google.com/maps/api/js?key='.$key); |
|
| 239 | 239 | Requirements::javascript('locator/thirdparty/jquery-store-locator-plugin/assets/js/libs/handlebars.min.js'); |
| 240 | 240 | Requirements::javascript('locator/thirdparty/jquery-store-locator-plugin/assets/js/plugins/storeLocator/jquery.storelocator.js'); |
| 241 | 241 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | // map config based on user input in Settings tab |
| 250 | 250 | $limit = Config::inst()->get('Locator_Controller', 'limit'); |
| 251 | 251 | if ($limit < 1) $limit = -1; |
| 252 | - $load = 'fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,'; |
|
| 252 | + $load = 'fullMapStart: true, storeLimit: '.$limit.', maxDistance: true,'; |
|
| 253 | 253 | |
| 254 | 254 | $listTemplatePath = Config::inst()->get('Locator_Controller', 'list_template_path'); |
| 255 | 255 | $infowindowTemplatePath = Config::inst()->get('Locator_Controller', 'info_window_template_path'); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | unset($vars['url']); |
| 262 | 262 | $url = ''; |
| 263 | 263 | if (count($vars)) { |
| 264 | - $url .= '?' . http_build_query($vars); |
|
| 264 | + $url .= '?'.http_build_query($vars); |
|
| 265 | 265 | } |
| 266 | 266 | $link = Controller::join_links($this->Link(), 'xml.xml', $url); |
| 267 | 267 | |
@@ -273,18 +273,18 @@ discard block |
||
| 273 | 273 | Requirements::customScript(" |
| 274 | 274 | $(function(){ |
| 275 | 275 | $('#map-container').storeLocator({ |
| 276 | - " . $load . " |
|
| 277 | - dataLocation: '" . $link . "', |
|
| 278 | - listTemplatePath: '" . $listTemplatePath . "', |
|
| 279 | - infowindowTemplatePath: '" . $infowindowTemplatePath . "', |
|
| 276 | + " . $load." |
|
| 277 | + dataLocation: '" . $link."', |
|
| 278 | + listTemplatePath: '" . $listTemplatePath."', |
|
| 279 | + infowindowTemplatePath: '" . $infowindowTemplatePath."', |
|
| 280 | 280 | originMarker: true, |
| 281 | - " . $featured . ", |
|
| 281 | + " . $featured.", |
|
| 282 | 282 | slideMap: false, |
| 283 | 283 | distanceAlert: -1, |
| 284 | - " . $kilometer . ", |
|
| 285 | - " . $defaultCoords . " |
|
| 286 | - mapID: '" . $map_id . "', |
|
| 287 | - locationList: '" . $list_class . "', |
|
| 284 | + " . $kilometer.", |
|
| 285 | + " . $defaultCoords." |
|
| 286 | + mapID: '" . $map_id."', |
|
| 287 | + locationList: '" . $list_class."', |
|
| 288 | 288 | mapSettings: { |
| 289 | 289 | zoom: 12, |
| 290 | 290 | mapTypeId: google.maps.MapTypeId.ROADMAP, |
@@ -389,8 +389,8 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if (Config::inst()->get('LocatorForm', 'show_radius')) { |
| 392 | - if ($radius = (int)$request->getVar('Radius')) { |
|
| 393 | - $locations = $locations->filterByCallback(function ($location) use (&$radius) { |
|
| 392 | + if ($radius = (int) $request->getVar('Radius')) { |
|
| 393 | + $locations = $locations->filterByCallback(function($location) use (&$radius) { |
|
| 394 | 394 | return $location->distance <= $radius; |
| 395 | 395 | }); |
| 396 | 396 | } |
@@ -248,7 +248,9 @@ |
||
| 248 | 248 | |
| 249 | 249 | // map config based on user input in Settings tab |
| 250 | 250 | $limit = Config::inst()->get('Locator_Controller', 'limit'); |
| 251 | - if ($limit < 1) $limit = -1; |
|
| 251 | + if ($limit < 1) { |
|
| 252 | + $limit = -1; |
|
| 253 | + } |
|
| 252 | 254 | $load = 'fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,'; |
| 253 | 255 | |
| 254 | 256 | $listTemplatePath = Config::inst()->get('Locator_Controller', 'list_template_path'); |
@@ -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); |