Completed
Pull Request — 2.0 (#165)
by
unknown
07:10
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   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -248,7 +248,9 @@
 block discarded – undo
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');
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.