Completed
Pull Request — 2.0 (#148)
by Jason
06:16
created
tests/LocationTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
code/objects/Location.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@
 block discarded – undo
189 189
     }
190 190
 
191 191
     /**
192
-     * @return bool|string
192
+     * @return string|false
193 193
      */
194 194
     public function EmailAddress()
195 195
     {
Please login to merge, or discard this patch.
code/pages/Locator.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
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 = [],
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,9 @@
 block discarded – undo
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,'
Please login to merge, or discard this patch.
code/extensions/DistanceDataExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
code/bulkloader/LocationCsvBulkLoader.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
code/form/LocatorForm.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.