@@ -41,7 +41,7 @@ |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | $import = $manual->import($manual_position); |
44 | - echo $manual->error."<br />\n"; |
|
44 | + echo $manual->error . "<br />\n"; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $user_position = new org_routamc_positioning_person($user); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | throw new midcom_error("Failed to get your current position."); |
79 | 79 | } |
80 | 80 | |
81 | -echo "<p>".sprintf('Your position is %s', org_routamc_positioning_utils::pretty_print_coordinates($coordinates['latitude'], $coordinates['longitude']))."</p>\n"; |
|
81 | +echo "<p>" . sprintf('Your position is %s', org_routamc_positioning_utils::pretty_print_coordinates($coordinates['latitude'], $coordinates['longitude'])) . "</p>\n"; |
|
82 | 82 | |
83 | 83 | $run_times = 1; |
84 | 84 | $run = 0; |
@@ -20,14 +20,12 @@ |
||
20 | 20 | { |
21 | 21 | printf('You\'re in %s, %s', $user_location['latitude'], $user_location['longitude']); |
22 | 22 | // Will print "You're in 60.2345, 25.00456" |
23 | -} |
|
24 | -else |
|
23 | +} else |
|
25 | 24 | { |
26 | 25 | if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') |
27 | 26 | { |
28 | 27 | echo "You're here"; |
29 | - } |
|
30 | - else |
|
28 | + } else |
|
31 | 29 | { |
32 | 30 | echo "No location found"; |
33 | 31 | } |
@@ -1,12 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | midcom::get()->header('Content-type: application/json'); |
3 | 3 | |
4 | -if ( isset($_POST['latitude']) |
|
4 | +if (isset($_POST['latitude']) |
|
5 | 5 | && isset($_POST['longitude'])) |
6 | 6 | { |
7 | 7 | // Updating user's location |
8 | - $location_array = array |
|
9 | - ( |
|
8 | + $location_array = array( |
|
10 | 9 | 'latitude' => (float) $_POST['latitude'], |
11 | 10 | 'longitude' => (float) $_POST['longitude'], |
12 | 11 | ); |
@@ -18,16 +18,13 @@ |
||
18 | 18 | { |
19 | 19 | // Exact enough |
20 | 20 | $location_array['accuracy'] = org_routamc_positioning_log_dba::ACCURACY_GPS; |
21 | - } |
|
22 | - elseif ($_POST['accuracy'] < 400) |
|
21 | + } elseif ($_POST['accuracy'] < 400) |
|
23 | 22 | { |
24 | 23 | $location_array['accuracy'] = org_routamc_positioning_log_dba::ACCURACY_STREET; |
25 | - } |
|
26 | - elseif ($_POST['accuracy'] < 5000) |
|
24 | + } elseif ($_POST['accuracy'] < 5000) |
|
27 | 25 | { |
28 | 26 | $location_array['accuracy'] = org_routamc_positioning_log_dba::ACCURACY_CITY; |
29 | - } |
|
30 | - else |
|
27 | + } else |
|
31 | 28 | { |
32 | 29 | // Fall back to "state level" |
33 | 30 | $location_array['accuracy'] = 50; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'modification date'=> 18, // date of last modification in yyyy-MM-dd format |
27 | 27 | ); |
28 | 28 | |
29 | -if ( array_key_exists('cities_file_path', $_POST) |
|
29 | +if (array_key_exists('cities_file_path', $_POST) |
|
30 | 30 | && file_exists($_POST['cities_file_path'])) |
31 | 31 | { |
32 | 32 | $features = explode(',', $_POST['featurecodes_to_import']); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $row++; |
48 | 48 | //if ($row > 1000) { break; } |
49 | 49 | |
50 | - if ( !isset($data[$fields_map['featurecode']]) |
|
50 | + if (!isset($data[$fields_map['featurecode']]) |
|
51 | 51 | || !in_array($data[$fields_map['featurecode']], $features)) |
52 | 52 | { |
53 | 53 | continue; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $new_city->alternatenames .= '|'; |
87 | 87 | } |
88 | 88 | |
89 | - if ( array_key_exists("{$new_city->country}:{$data[3]}:{$new_city->city}", $imported_cities) |
|
89 | + if (array_key_exists("{$new_city->country}:{$data[3]}:{$new_city->city}", $imported_cities) |
|
90 | 90 | || $row == 1) |
91 | 91 | { |
92 | 92 | // We have city by this name for the country already |
@@ -100,8 +100,7 @@ discard block |
||
100 | 100 | echo "<span style=\"color: #00cc00;\">Success,</span> "; |
101 | 101 | $imported_cities["{$new_city->country}:{$data[3]}:{$new_city->city}"] = true; |
102 | 102 | $cities_created++; |
103 | - } |
|
104 | - else |
|
103 | + } else |
|
105 | 104 | { |
106 | 105 | echo "<span style=\"color: #cc0000;\">FAILED</span>, "; |
107 | 106 | } |
@@ -110,8 +109,7 @@ discard block |
||
110 | 109 | } |
111 | 110 | |
112 | 111 | echo "<p>{$cities_created} cities imported.</p>\n"; |
113 | -} |
|
114 | -else |
|
112 | +} else |
|
115 | 113 | { |
116 | 114 | ?> |
117 | 115 | <h1>World Cities Database installation</h1> |
@@ -105,8 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | if (is_null($this->enabled_methods)) |
107 | 107 | { |
108 | - $this->enabled_methods = array |
|
109 | - ( |
|
108 | + $this->enabled_methods = array( |
|
110 | 109 | 'place', |
111 | 110 | 'map', |
112 | 111 | 'coordinates' |
@@ -138,8 +137,7 @@ discard block |
||
138 | 137 | $this->_get_country_list(); |
139 | 138 | $this->_init_widgets_js_options(); |
140 | 139 | |
141 | - $this->_allowed_xep_keys = array |
|
142 | - ( |
|
140 | + $this->_allowed_xep_keys = array( |
|
143 | 141 | 'area', |
144 | 142 | 'building', |
145 | 143 | 'description', |
@@ -164,11 +162,11 @@ discard block |
||
164 | 162 | $html = "<div id=\"{$this->_element_id}\" class=\"midcom_helper_datamanager2_widget_position\"><!-- widget starts -->\n"; |
165 | 163 | |
166 | 164 | $input_key = $this->_get_input_key("id"); |
167 | - $html .= "<input class=\"position_widget_id\" id=\"{$this->_element_id}_id\" name=\"".$input_key."\" type=\"hidden\" value=\"{$this->_element_id}\" />"; |
|
165 | + $html .= "<input class=\"position_widget_id\" id=\"{$this->_element_id}_id\" name=\"" . $input_key . "\" type=\"hidden\" value=\"{$this->_element_id}\" />"; |
|
168 | 166 | $input_key = $this->_get_input_key("backend_url"); |
169 | - $html .= "<input class=\"position_widget_backend_url\" id=\"{$this->_element_id}_backend_url\" name=\"".$input_key."\" type=\"hidden\" value=\"{$this->_handler_url}\" />"; |
|
167 | + $html .= "<input class=\"position_widget_backend_url\" id=\"{$this->_element_id}_backend_url\" name=\"" . $input_key . "\" type=\"hidden\" value=\"{$this->_handler_url}\" />"; |
|
170 | 168 | $input_key = $this->_get_input_key("backend_service"); |
171 | - $html .= "<input class=\"position_widget_backend_service\" id=\"{$this->_element_id}_backend_service\" name=\"".$input_key."\" type=\"hidden\" value=\"{$this->service}\" />"; |
|
169 | + $html .= "<input class=\"position_widget_backend_service\" id=\"{$this->_element_id}_backend_service\" name=\"" . $input_key . "\" type=\"hidden\" value=\"{$this->service}\" />"; |
|
172 | 170 | |
173 | 171 | $html .= " <ul>\n"; |
174 | 172 | |
@@ -178,8 +176,7 @@ discard block |
||
178 | 176 | } |
179 | 177 | |
180 | 178 | $html .= " </ul>\n"; |
181 | - $this->_widget_elements[] = $this->_form->createElement |
|
182 | - ( |
|
179 | + $this->_widget_elements[] = $this->_form->createElement( |
|
183 | 180 | 'static', |
184 | 181 | "{$this->_element_id}_static_widget_start", |
185 | 182 | '', |
@@ -193,16 +190,14 @@ discard block |
||
193 | 190 | } |
194 | 191 | |
195 | 192 | $html = "</div><!-- widget ends -->\n"; |
196 | - $this->_widget_elements[] = $this->_form->createElement |
|
197 | - ( |
|
193 | + $this->_widget_elements[] = $this->_form->createElement( |
|
198 | 194 | 'static', |
199 | 195 | "{$this->_element_id}_static_widget_end", |
200 | 196 | '', |
201 | 197 | $html |
202 | 198 | ); |
203 | 199 | |
204 | - $this->_main_group = $this->_form->addGroup |
|
205 | - ( |
|
200 | + $this->_main_group = $this->_form->addGroup( |
|
206 | 201 | $this->_widget_elements, |
207 | 202 | $this->name, |
208 | 203 | $this->_translate($this->_field['title']), |
@@ -218,7 +213,7 @@ discard block |
||
218 | 213 | { |
219 | 214 | $value = $value_input; |
220 | 215 | } |
221 | - if ( !$value |
|
216 | + if (!$value |
|
222 | 217 | && isset($this->input_defaults[$fieldname])) |
223 | 218 | { |
224 | 219 | $value = $this->input_defaults[$fieldname]; |
@@ -246,8 +241,7 @@ discard block |
||
246 | 241 | |
247 | 242 | $html .= "\n</div><!-- tab_content_place ends -->\n"; |
248 | 243 | |
249 | - $this->_widget_elements[] = $this->_form->createElement |
|
250 | - ( |
|
244 | + $this->_widget_elements[] = $this->_form->createElement( |
|
251 | 245 | 'static', |
252 | 246 | "{$this->_element_id}_static_place", |
253 | 247 | '', |
@@ -264,7 +258,7 @@ discard block |
||
264 | 258 | $input_key = $this->_get_input_key($fieldname); |
265 | 259 | $html = "<label for='{$this->_element_id}_input_place_{$fieldname}' id='{$this->_element_id}_input_place_{$fieldname}_label'>"; |
266 | 260 | $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string("xep_{$fieldname}", 'org.routamc.positioning') . "</span><span class=\"proposal\"></span>"; |
267 | - $html .= "<input size=\"40\" class=\"shorttext position_widget_input position_widget_input_place_{$fieldname}\" id=\"{$this->_element_id}_input_place_{$fieldname}\" name=\"".$input_key."\" type=\"text\" value=\"{$value}\" />"; |
|
261 | + $html .= "<input size=\"40\" class=\"shorttext position_widget_input position_widget_input_place_{$fieldname}\" id=\"{$this->_element_id}_input_place_{$fieldname}\" name=\"" . $input_key . "\" type=\"text\" value=\"{$value}\" />"; |
|
268 | 262 | $html .= "</label>"; |
269 | 263 | return $html; |
270 | 264 | } |
@@ -284,13 +278,13 @@ discard block |
||
284 | 278 | } |
285 | 279 | } |
286 | 280 | |
287 | - if ( !$city_id |
|
281 | + if (!$city_id |
|
288 | 282 | && isset($this->input_defaults['city']) |
289 | 283 | && is_numeric($this->input_defaults['city'])) |
290 | 284 | { |
291 | 285 | $city_id = $this->input_defaults['city']; |
292 | 286 | } |
293 | - if ( !$city_name |
|
287 | + if (!$city_name |
|
294 | 288 | && isset($this->input_defaults['city']) |
295 | 289 | && is_string($this->input_defaults['city'])) |
296 | 290 | { |
@@ -304,7 +298,7 @@ discard block |
||
304 | 298 | $city = new org_routamc_positioning_city_dba($city_id); |
305 | 299 | $city_name = $city->city; |
306 | 300 | } |
307 | - catch (midcom_error $e){} |
|
301 | + catch (midcom_error $e) {} |
|
308 | 302 | } |
309 | 303 | return $city_name; |
310 | 304 | } |
@@ -316,7 +310,7 @@ discard block |
||
316 | 310 | |
317 | 311 | foreach ($this->_allowed_xep_keys as $xep_key) |
318 | 312 | { |
319 | - if ( !in_array($xep_key, $this->use_xep_keys) |
|
313 | + if (!in_array($xep_key, $this->use_xep_keys) |
|
320 | 314 | || !midcom::get()->dbfactory->property_exists($this->_type->location, $xep_key) |
321 | 315 | || in_array($xep_key, $inserted_xep_keys)) |
322 | 316 | { |
@@ -342,8 +336,7 @@ discard block |
||
342 | 336 | |
343 | 337 | $html .= "\n</div><!-- tab_content_map ends -->\n"; |
344 | 338 | |
345 | - $this->_widget_elements[] = $this->_form->createElement |
|
346 | - ( |
|
339 | + $this->_widget_elements[] = $this->_form->createElement( |
|
347 | 340 | 'static', |
348 | 341 | "{$this->_element_id}_static_map", |
349 | 342 | '', |
@@ -381,19 +374,18 @@ discard block |
||
381 | 374 | $input_key = $this->_get_input_key("latitude"); |
382 | 375 | $html .= "<label for='{$this->_element_id}_input_coordinates_latitude' id='{$this->_element_id}_input_coordinates_latitude_label'>"; |
383 | 376 | $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string('latitude', 'org.routamc.positioning') . "</span>"; |
384 | - $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_latitude\" id=\"{$this->_element_id}_input_coordinates_latitude\" name=\"".$input_key."\" type=\"text\" value=\"{$lat}\" />"; |
|
377 | + $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_latitude\" id=\"{$this->_element_id}_input_coordinates_latitude\" name=\"" . $input_key . "\" type=\"text\" value=\"{$lat}\" />"; |
|
385 | 378 | $html .= "</label>"; |
386 | 379 | |
387 | 380 | $input_key = $this->_get_input_key("longitude"); |
388 | 381 | $html .= "<label for='{$this->_element_id}_input_coordinates_longitude' id='{$this->_element_id}_input_coordinates_longitude_label'>"; |
389 | 382 | $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string('longitude', 'org.routamc.positioning') . "</span>"; |
390 | - $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_longitude\" id=\"{$this->_element_id}_input_coordinates_longitude\" name=\"".$input_key."\" type=\"text\" value=\"{$lon}\" />"; |
|
383 | + $html .= "<input size=\"20\" class=\"shorttext position_widget_input position_widget_input_coordinates_longitude\" id=\"{$this->_element_id}_input_coordinates_longitude\" name=\"" . $input_key . "\" type=\"text\" value=\"{$lon}\" />"; |
|
391 | 384 | $html .= "</label>"; |
392 | 385 | |
393 | 386 | $html .= "\n</div><!-- tab_content_coordinates ends -->\n"; |
394 | 387 | |
395 | - $this->_widget_elements[] = $this->_form->createElement |
|
396 | - ( |
|
388 | + $this->_widget_elements[] = $this->_form->createElement( |
|
397 | 389 | 'static', |
398 | 390 | "{$this->_element_id}_static_coordinates", |
399 | 391 | '', |
@@ -403,8 +395,7 @@ discard block |
||
403 | 395 | |
404 | 396 | public function _get_country_list() |
405 | 397 | { |
406 | - $this->_countrylist = array |
|
407 | - ( |
|
398 | + $this->_countrylist = array( |
|
408 | 399 | '' => midcom::get()->i18n->get_string('select your country', 'org.routamc.positioning'), |
409 | 400 | ); |
410 | 401 | |
@@ -424,11 +415,11 @@ discard block |
||
424 | 415 | } |
425 | 416 | } |
426 | 417 | |
427 | - public function _render_country_list($current='') |
|
418 | + public function _render_country_list($current = '') |
|
428 | 419 | { |
429 | 420 | $html = ''; |
430 | 421 | |
431 | - if ( empty($this->_countrylist) |
|
422 | + if (empty($this->_countrylist) |
|
432 | 423 | || count($this->_countrylist) == 1) |
433 | 424 | { |
434 | 425 | return $html; |
@@ -437,7 +428,7 @@ discard block |
||
437 | 428 | $input_key = $this->_get_input_key("country"); |
438 | 429 | $html .= "<label for='{$this->_element_id}_input_place_country' id='{$this->_element_id}_input_place_country_label'>"; |
439 | 430 | $html .= "<span class=\"field_text\">" . midcom::get()->i18n->get_string('xep_country', 'org.routamc.positioning') . "</span>"; |
440 | - $html .= "<select class=\"dropdown position_widget_input position_widget_input_place_country\" id=\"{$this->_element_id}_input_place_country\" name=\"".$input_key."\">"; |
|
431 | + $html .= "<select class=\"dropdown position_widget_input position_widget_input_place_country\" id=\"{$this->_element_id}_input_place_country\" name=\"" . $input_key . "\">"; |
|
441 | 432 | |
442 | 433 | foreach ($this->_countrylist as $code => $name) |
443 | 434 | { |
@@ -460,19 +451,19 @@ discard block |
||
460 | 451 | $this->js_options['maxRows'] = 20; |
461 | 452 | $this->js_options['radius'] = 5; |
462 | 453 | |
463 | - if ( !is_null($this->js_maxRows) |
|
454 | + if (!is_null($this->js_maxRows) |
|
464 | 455 | && $this->js_maxRows > 0) |
465 | 456 | { |
466 | 457 | $this->js_options['maxRows'] = $this->js_maxRows; |
467 | 458 | } |
468 | - if ( !is_null($this->js_radius) |
|
459 | + if (!is_null($this->js_radius) |
|
469 | 460 | && $this->js_radius > 0) |
470 | 461 | { |
471 | 462 | $this->js_options['radius'] = $this->js_radius; |
472 | 463 | } |
473 | 464 | |
474 | 465 | $this->js_options_str = "{ "; |
475 | - if (! empty($this->js_options)) |
|
466 | + if (!empty($this->js_options)) |
|
476 | 467 | { |
477 | 468 | $opt_cnt = count($this->js_options); |
478 | 469 | $i = 0; |
@@ -523,8 +514,7 @@ discard block |
||
523 | 514 | midcom::get()->head->add_jquery_state_script($script); |
524 | 515 | } |
525 | 516 | |
526 | - return Array |
|
527 | - ( |
|
517 | + return Array( |
|
528 | 518 | $this->_get_input_key("country") => $this->_type->location->country, |
529 | 519 | $this->_get_input_key("city") => $city_name, |
530 | 520 | $this->_get_input_key("street") => $this->_type->location->street, |
@@ -542,12 +532,12 @@ discard block |
||
542 | 532 | } |
543 | 533 | $city_id = 0; |
544 | 534 | $city = org_routamc_positioning_city_dba::get_by_name($city_name); |
545 | - if ( $city |
|
535 | + if ($city |
|
546 | 536 | && $city->id) |
547 | 537 | { |
548 | 538 | $city_id = $city->id; |
549 | 539 | } |
550 | - else if (! empty($results)) |
|
540 | + else if (!empty($results)) |
|
551 | 541 | { |
552 | 542 | $city = new org_routamc_positioning_city_dba(); |
553 | 543 | $city->city = $city_name; |
@@ -572,7 +562,7 @@ discard block |
||
572 | 562 | { |
573 | 563 | $city->longitude = $lon; |
574 | 564 | } |
575 | - if (! $city->create()) |
|
565 | + if (!$city->create()) |
|
576 | 566 | { |
577 | 567 | debug_add("Cannot save new city '{$city_name}'"); |
578 | 568 | } |
@@ -585,7 +575,7 @@ discard block |
||
585 | 575 | |
586 | 576 | private function _get_input_key($input_name) |
587 | 577 | { |
588 | - return $this->_element_id . "_input[".$input_name."]"; |
|
578 | + return $this->_element_id . "_input[" . $input_name . "]"; |
|
589 | 579 | } |
590 | 580 | |
591 | 581 | private function _get_input($input_name, $data) |
@@ -634,7 +624,7 @@ discard block |
||
634 | 624 | |
635 | 625 | foreach ($this->_allowed_xep_keys as $xep_key) |
636 | 626 | { |
637 | - if ( !in_array($xep_key, $this->use_xep_keys) |
|
627 | + if (!in_array($xep_key, $this->use_xep_keys) |
|
638 | 628 | || !midcom::get()->dbfactory->property_exists($this->_type->location, $xep_key)) |
639 | 629 | { |
640 | 630 | continue; |
@@ -303,8 +303,7 @@ discard block |
||
303 | 303 | { |
304 | 304 | $city = new org_routamc_positioning_city_dba($city_id); |
305 | 305 | $city_name = $city->city; |
306 | - } |
|
307 | - catch (midcom_error $e){} |
|
306 | + } catch (midcom_error $e){} |
|
308 | 307 | } |
309 | 308 | return $city_name; |
310 | 309 | } |
@@ -495,8 +494,7 @@ discard block |
||
495 | 494 | { |
496 | 495 | $city = new org_routamc_positioning_city_dba($this->_type->location->city); |
497 | 496 | $city_name = $city->city; |
498 | - } |
|
499 | - catch (midcom_error $e) |
|
497 | + } catch (midcom_error $e) |
|
500 | 498 | { |
501 | 499 | $city_name = ''; |
502 | 500 | } |
@@ -546,8 +544,7 @@ discard block |
||
546 | 544 | && $city->id) |
547 | 545 | { |
548 | 546 | $city_id = $city->id; |
549 | - } |
|
550 | - else if (! empty($results)) |
|
547 | + } else if (! empty($results)) |
|
551 | 548 | { |
552 | 549 | $city = new org_routamc_positioning_city_dba(); |
553 | 550 | $city->city = $city_name; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function convert_to_storage() |
56 | 56 | { |
57 | - if ( !$this->storage |
|
57 | + if (!$this->storage |
|
58 | 58 | || !$this->storage->object) |
59 | 59 | { |
60 | 60 | return ''; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | return ''; |
77 | 77 | } |
78 | 78 | |
79 | - public function convert_from_csv ($source) |
|
79 | + public function convert_from_csv($source) |
|
80 | 80 | { |
81 | 81 | // TODO: Not yet supported |
82 | 82 | return ''; |
@@ -81,8 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | throw new midcom_error(midcom_connection::get_error_string()); |
83 | 83 | } |
84 | - } |
|
85 | - else |
|
84 | + } else |
|
86 | 85 | { |
87 | 86 | $nodes = $object_qb->execute(); |
88 | 87 | $node = $nodes[0]; |
@@ -51,14 +51,13 @@ |
||
51 | 51 | $json = substr($json, 10, -1); |
52 | 52 | $geocoded = json_decode($json); |
53 | 53 | |
54 | - if ( !$geocoded->geoplugin_latitude |
|
54 | + if (!$geocoded->geoplugin_latitude |
|
55 | 55 | || !$geocoded->geoplugin_longitude) |
56 | 56 | { |
57 | 57 | throw new RuntimeException("GeoPlugin did not return coordinates for IP"); |
58 | 58 | } |
59 | 59 | |
60 | - $location = array |
|
61 | - ( |
|
60 | + $location = array( |
|
62 | 61 | 'latitude' => (float) $geocoded->geoplugin_latitude, |
63 | 62 | 'longitude' => (float) $geocoded->geoplugin_longitude, |
64 | 63 | ); |
@@ -24,12 +24,11 @@ discard block |
||
24 | 24 | { |
25 | 25 | $results = array(); |
26 | 26 | |
27 | - $parameters = array |
|
28 | - ( |
|
27 | + $parameters = array( |
|
29 | 28 | 'maxRows' => 1, |
30 | 29 | ); |
31 | 30 | |
32 | - if (! empty($options)) |
|
31 | + if (!empty($options)) |
|
33 | 32 | { |
34 | 33 | foreach ($options as $key => $value) |
35 | 34 | { |
@@ -87,12 +86,10 @@ discard block |
||
87 | 86 | |
88 | 87 | foreach ($matches as $city_entry) |
89 | 88 | { |
90 | - $results[] = array |
|
91 | - ( |
|
89 | + $results[] = array( |
|
92 | 90 | 'latitude' => $city_entry->latitude, |
93 | 91 | 'longitude' => $city_entry->longitude, |
94 | - 'distance' => array |
|
95 | - ( |
|
92 | + 'distance' => array( |
|
96 | 93 | 'meters' => 0, |
97 | 94 | 'bearing' => null, |
98 | 95 | ), |
@@ -113,16 +110,15 @@ discard block |
||
113 | 110 | * @param array $options |
114 | 111 | * @return Array containing geocoded information |
115 | 112 | */ |
116 | - function reverse_geocode($coordinates, $options=array()) |
|
113 | + function reverse_geocode($coordinates, $options = array()) |
|
117 | 114 | { |
118 | 115 | $results = array(); |
119 | 116 | |
120 | - $parameters = array |
|
121 | - ( |
|
117 | + $parameters = array( |
|
122 | 118 | 'maxRows' => 1, |
123 | 119 | ); |
124 | 120 | |
125 | - if (! empty($options)) |
|
121 | + if (!empty($options)) |
|
126 | 122 | { |
127 | 123 | foreach ($options as $key => $value) |
128 | 124 | { |
@@ -133,7 +129,7 @@ discard block |
||
133 | 129 | } |
134 | 130 | } |
135 | 131 | |
136 | - if ( !isset($coordinates['latitude']) |
|
132 | + if (!isset($coordinates['latitude']) |
|
137 | 133 | && !isset($coordinates['longitude'])) |
138 | 134 | { |
139 | 135 | $this->error = 'POSITIONING_MISSING_ATTRIBUTES'; |
@@ -150,18 +146,16 @@ discard block |
||
150 | 146 | |
151 | 147 | foreach ($closest as $city) |
152 | 148 | { |
153 | - $city_coordinates = array |
|
154 | - ( |
|
149 | + $city_coordinates = array( |
|
155 | 150 | 'latitude' => $city->latitude, |
156 | 151 | 'longitude' => $city->longitude, |
157 | 152 | ); |
158 | 153 | |
159 | 154 | $position = array(); |
160 | - $position['latitude' ] = $city->latitude; |
|
161 | - $position['longitude' ] = $city->longitude; |
|
162 | - $position['distance'] = array |
|
163 | - ( |
|
164 | - 'meters' => round( org_routamc_positioning_utils::get_distance($coordinates, $city_coordinates) * 1000 ), |
|
155 | + $position['latitude'] = $city->latitude; |
|
156 | + $position['longitude'] = $city->longitude; |
|
157 | + $position['distance'] = array( |
|
158 | + 'meters' => round(org_routamc_positioning_utils::get_distance($coordinates, $city_coordinates) * 1000), |
|
165 | 159 | 'bearing' => org_routamc_positioning_utils::get_bearing($coordinates, $city_coordinates), |
166 | 160 | ); |
167 | 161 | $position['city'] = $city->city; |