@@ -31,11 +31,16 @@ |
||
31 | 31 | $nb_levels = count($parent); |
32 | 32 | for ($i=0; $i < $nb_levels; $i++) { |
33 | 33 | $parent[$i] = trim($parent[$i]); |
34 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
34 | + if (empty($parent[$i])) { |
|
35 | + $parent[$i]='unknown'; |
|
36 | + } |
|
37 | + // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | 38 | $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
36 | 39 | ->execute(array($i, $place_id, $parent[$i])) |
37 | 40 | ->fetchOne(); |
38 | - if (empty($pl_id)) break; |
|
41 | + if (empty($pl_id)) { |
|
42 | + break; |
|
43 | + } |
|
39 | 44 | $place_id = $pl_id; |
40 | 45 | } |
41 | 46 | return $place_id; |
@@ -45,7 +45,9 @@ |
||
45 | 45 | public function render() { |
46 | 46 | global $controller; |
47 | 47 | |
48 | - if(!$this->ctrl) throw new \Exception('Controller not initialised'); |
|
48 | + if(!$this->ctrl) { |
|
49 | + throw new \Exception('Controller not initialised'); |
|
50 | + } |
|
49 | 51 | |
50 | 52 | $controller = $this->ctrl; |
51 | 53 | $this->ctrl->pageHeader(); |
@@ -61,7 +61,9 @@ |
||
61 | 61 | */ |
62 | 62 | public function index() { |
63 | 63 | $action = Filter::post('action'); |
64 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
64 | + if($action == 'update' && Filter::checkCsrf()) { |
|
65 | + $this->update(); |
|
66 | + } |
|
65 | 67 | |
66 | 68 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
67 | 69 | $ctrl = new PageController(); |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | $array_hook = explode('#', $ihook); |
48 | 48 | //Update status |
49 | 49 | $new_status= Filter::postBool('status-' . $params['id']); |
50 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | + if(in_array($array_hook[0], $module_names)) { |
|
51 | + $new_status = false; |
|
52 | + } |
|
51 | 53 | $previous_status = $params['status']; |
52 | 54 | if ($new_status !== null) { |
53 | 55 | $new_status= $new_status ? 'enabled' : 'disabled'; |
@@ -92,7 +94,9 @@ discard block |
||
92 | 94 | HookProvider::getInstance()->updateHooks(); |
93 | 95 | |
94 | 96 | $action = Filter::post('action'); |
95 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
97 | + if($action == 'update' && Filter::checkCsrf()) { |
|
98 | + $this->update(); |
|
99 | + } |
|
96 | 100 | |
97 | 101 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
98 | 102 | $ctrl = new PageController(); |
@@ -160,7 +160,9 @@ discard block |
||
160 | 160 | public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
163 | + if($isStrong) { |
|
164 | + $tag = 'strong'; |
|
165 | + } |
|
164 | 166 | if($individual && $individual->canShow()){ |
165 | 167 | $dindi = new Individual($individual); |
166 | 168 | $html = $individual->getSexImage(); |
@@ -174,8 +176,7 @@ discard block |
||
174 | 176 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
175 | 177 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10).'</em></small></span>'; |
176 | 178 | $html .= '</a>'; |
177 | - } |
|
178 | - else { |
|
179 | + } else { |
|
179 | 180 | $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
180 | 181 | } |
181 | 182 | return $html; |
@@ -193,8 +194,7 @@ discard block |
||
193 | 194 | $date = $fact->getDate(); |
194 | 195 | if($date->isOK()){ |
195 | 196 | $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
196 | - } |
|
197 | - else{ |
|
197 | + } else{ |
|
198 | 198 | // 1 DEAT Y with no DATE => print YES |
199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
200 | 200 | // 1 DEAT N is not allowed |
@@ -218,7 +218,9 @@ discard block |
||
218 | 218 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
219 | 219 | $html=''; |
220 | 220 | |
221 | - if ($fact === null) return $html; |
|
221 | + if ($fact === null) { |
|
222 | + return $html; |
|
223 | + } |
|
222 | 224 | $place = $fact->getPlace(); |
223 | 225 | if($place){ |
224 | 226 | $dplace = new Place($place); |
@@ -336,7 +338,9 @@ discard block |
||
336 | 338 | default: |
337 | 339 | break; |
338 | 340 | } |
339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
341 | + if($image && $title) { |
|
342 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
343 | + } |
|
340 | 344 | break; |
341 | 345 | default: |
342 | 346 | break; |
@@ -167,8 +167,7 @@ discard block |
||
167 | 167 | $ga = $this->getGeoAnalysis($id, false); |
168 | 168 | |
169 | 169 | Database::commit(); |
170 | - } |
|
171 | - catch(\Exception $ex) { |
|
170 | + } catch(\Exception $ex) { |
|
172 | 171 | Database::rollback(); |
173 | 172 | $ga = null; |
174 | 173 | Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage()); |
@@ -210,8 +209,7 @@ discard block |
||
210 | 209 | $ga = $this->getGeoAnalysis($ga->getId(), false); |
211 | 210 | |
212 | 211 | Database::commit(); |
213 | - } |
|
214 | - catch(\Exception $ex) { |
|
212 | + } catch(\Exception $ex) { |
|
215 | 213 | Database::rollback(); |
216 | 214 | Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage()); |
217 | 215 | $ga = null; |
@@ -350,11 +348,9 @@ discard block |
||
350 | 348 | if(!$this->place_hierarchy) { |
351 | 349 | if($place_structure = $this->getPlacesHierarchyFromHeader()) { |
352 | 350 | $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure); |
353 | - } |
|
354 | - elseif ($place_structure = $this->getPlacesHierarchyFromData()){ |
|
351 | + } elseif ($place_structure = $this->getPlacesHierarchyFromData()){ |
|
355 | 352 | $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $place_structure); |
356 | - } |
|
357 | - else { |
|
353 | + } else { |
|
358 | 354 | $this->place_hierarchy = array('type' => 'none', 'hierarchy' => null); |
359 | 355 | } |
360 | 356 | } |
@@ -418,14 +414,15 @@ discard block |
||
418 | 414 | if($parts > $max_level) { |
419 | 415 | $max_level = $parts; |
420 | 416 | $places_with_high_level = array($place); |
421 | - } |
|
422 | - else if ($parts == $max_level) { |
|
417 | + } else if ($parts == $max_level) { |
|
423 | 418 | $places_with_high_level[] = $place; |
424 | 419 | } |
425 | 420 | } |
426 | 421 | |
427 | 422 | // If empty array, then return null |
428 | - if($max_level == 0) return null; |
|
423 | + if($max_level == 0) { |
|
424 | + return null; |
|
425 | + } |
|
429 | 426 | |
430 | 427 | // Else, return the first alphabetical element -- cannot return random to ensure always the same example if used |
431 | 428 | usort($places_with_high_level, array('Fisharebest\\Webtrees\\I18N', 'strcasecmp')); |
@@ -78,7 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | $other_trees = array(); |
80 | 80 | foreach (Tree::getAll() as $tree) { |
81 | - if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree; |
|
81 | + if($tree->getTreeId() != $wt_tree->getTreeId()) { |
|
82 | + $other_trees[] = $tree; |
|
83 | + } |
|
82 | 84 | } |
83 | 85 | $data->set('other_trees', $other_trees); |
84 | 86 | |
@@ -177,7 +179,9 @@ discard block |
||
177 | 179 | |
178 | 180 | // Generate an AJAX/JSON response for datatables to load a block of rows |
179 | 181 | $search = Filter::postArray('search'); |
180 | - if($search) $search = $search['value']; |
|
182 | + if($search) { |
|
183 | + $search = $search['value']; |
|
184 | + } |
|
181 | 185 | $start = Filter::postInteger('start'); |
182 | 186 | $length = Filter::postInteger('length'); |
183 | 187 | $order = Filter::postArray('order'); |
@@ -263,8 +267,7 @@ discard block |
||
263 | 267 | $datum[7] .= $top_level; |
264 | 268 | } |
265 | 269 | $datum[7] .= '</span>'; |
266 | - } |
|
267 | - else { |
|
270 | + } else { |
|
268 | 271 | $datum[6] = I18N::translate('Error when loading map.'); |
269 | 272 | } |
270 | 273 | } |
@@ -339,8 +342,7 @@ discard block |
||
339 | 342 | if($use_map) { |
340 | 343 | $options->setMap(new OutlineMap($map_file)); |
341 | 344 | $options->setMapLevel($map_top_level + 1); |
342 | - } |
|
343 | - else { |
|
345 | + } else { |
|
344 | 346 | $options->setMap(null); |
345 | 347 | } |
346 | 348 | } |
@@ -351,8 +353,7 @@ discard block |
||
351 | 353 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.'); |
352 | 354 | $ga = $res; |
353 | 355 | $success = true; |
354 | - } |
|
355 | - else { |
|
356 | + } else { |
|
356 | 357 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
357 | 358 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
358 | 359 | } |
@@ -370,8 +371,7 @@ discard block |
||
370 | 371 | FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success'); |
371 | 372 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.'); |
372 | 373 | $success = true; |
373 | - } |
|
374 | - else { |
|
374 | + } else { |
|
375 | 375 | FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger'); |
376 | 376 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.'); |
377 | 377 | } |
@@ -381,8 +381,7 @@ discard block |
||
381 | 381 | if(!$success) { |
382 | 382 | if($ga) { |
383 | 383 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl(); |
384 | - } |
|
385 | - else { |
|
384 | + } else { |
|
386 | 385 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl(); |
387 | 386 | } |
388 | 387 | } |
@@ -439,7 +438,9 @@ discard block |
||
439 | 438 | $data->set('map_list', $map_list); |
440 | 439 | |
441 | 440 | $gen_details = array(0 => I18N::translate('All')); |
442 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
441 | + for($i = 1; $i <= 10 ; $i++) { |
|
442 | + $gen_details[$i] = $i; |
|
443 | + } |
|
443 | 444 | $data->set('generation_details', $gen_details); |
444 | 445 | |
445 | 446 | ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
@@ -104,8 +104,7 @@ |
||
104 | 104 | |
105 | 105 | if(file_exists($css_file)) { |
106 | 106 | return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
107 | - } |
|
108 | - else { |
|
107 | + } else { |
|
109 | 108 | return $this->assetUrl('css/default.min.css'); |
110 | 109 | } |
111 | 110 | } |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
58 | 58 | if($ct2>0){ |
59 | 59 | $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
60 | - } |
|
61 | - else{ |
|
60 | + } else{ |
|
62 | 61 | $this->titles[$titlefact->getValue()][]=''; |
63 | 62 | } |
64 | 63 | } |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
91 | 90 | if($perc){ |
92 | 91 | return array ($bplace, 1); |
93 | - } |
|
94 | - else{ |
|
92 | + } else{ |
|
95 | 93 | return $bplace; |
96 | 94 | } |
97 | 95 | } |