@@ -235,7 +235,9 @@ discard block |
||
235 | 235 | * @return bool |
236 | 236 | */ |
237 | 237 | public function save() { |
238 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
238 | + if(!$this->provider) { |
|
239 | + throw new \Exception('The task has not been initialised with a provider.'); |
|
240 | + } |
|
239 | 241 | return $this->provider->updateTask($this); |
240 | 242 | } |
241 | 243 | |
@@ -245,8 +247,9 @@ discard block |
||
245 | 247 | */ |
246 | 248 | public function execute(){ |
247 | 249 | |
248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
249 | - $this->is_running = false; |
|
250 | + if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) { |
|
251 | + $this->is_running = false; |
|
252 | + } |
|
250 | 253 | |
251 | 254 | if(!$this->is_running){ |
252 | 255 | $this->last_result = false; |
@@ -259,7 +262,9 @@ discard block |
||
259 | 262 | $this->last_updated = new \DateTime(); |
260 | 263 | if($this->nb_occurrences > 0){ |
261 | 264 | $this->nb_occurrences--; |
262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
265 | + if($this->nb_occurrences == 0) { |
|
266 | + $this->is_enabled = false; |
|
267 | + } |
|
263 | 268 | } |
264 | 269 | } |
265 | 270 | $this->is_running = false; |
@@ -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,8 +348,7 @@ 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 | - else { |
|
351 | + } else { |
|
355 | 352 | $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData()); |
356 | 353 | } |
357 | 354 | } |
@@ -145,14 +145,15 @@ discard block |
||
145 | 145 | $this->provider->setGeoAnalysisStatus($ga, $status); |
146 | 146 | $res['status'] = $status; |
147 | 147 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
148 | - } |
|
149 | - catch (\Exception $ex) { |
|
148 | + } catch (\Exception $ex) { |
|
150 | 149 | $res['error'] = $ex->getMessage(); |
151 | 150 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
152 | 151 | } |
153 | 152 | |
154 | 153 | $controller->pageHeader(); |
155 | - if($res['error']) http_response_code(500); |
|
154 | + if($res['error']) { |
|
155 | + http_response_code(500); |
|
156 | + } |
|
156 | 157 | |
157 | 158 | $controller->encode($res); |
158 | 159 | } |
@@ -178,14 +179,15 @@ discard block |
||
178 | 179 | try{ |
179 | 180 | $this->provider->deleteGeoAnalysis($ga); |
180 | 181 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
181 | - } |
|
182 | - catch (\Exception $ex) { |
|
182 | + } catch (\Exception $ex) { |
|
183 | 183 | $res['error'] = $ex->getMessage(); |
184 | 184 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
185 | 185 | } |
186 | 186 | |
187 | 187 | $controller->pageHeader(); |
188 | - if($res['error']) http_response_code(500); |
|
188 | + if($res['error']) { |
|
189 | + http_response_code(500); |
|
190 | + } |
|
189 | 191 | |
190 | 192 | $controller->encode($res); |
191 | 193 | } |
@@ -240,7 +242,9 @@ discard block |
||
240 | 242 | |
241 | 243 | $nb_found = $placesGeneralResults['knownsum']; |
242 | 244 | $nb_other = 0; |
243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
245 | + if(isset($placesGeneralResults['other'])) { |
|
246 | + $nb_other =$placesGeneralResults['other']; |
|
247 | + } |
|
244 | 248 | $nb_unknown = $placesGeneralResults['unknown']; |
245 | 249 | |
246 | 250 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -260,11 +264,12 @@ discard block |
||
260 | 264 | if($level_map >= 0 && $level_map < count($levelvalues)) { |
261 | 265 | $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
262 | 266 | if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
263 | - } |
|
264 | - else { |
|
267 | + } else { |
|
265 | 268 | $levelref = $levelvalues[0]; |
266 | 269 | } |
267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
270 | + if(isset($places_mappings[$levelref])) { |
|
271 | + $levelref = $places_mappings[$levelref]; |
|
272 | + } |
|
268 | 273 | if(isset($results_by_subdivs[$levelref])) { |
269 | 274 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
270 | 275 | $count_subd += $count; |
@@ -281,8 +286,7 @@ discard block |
||
281 | 286 | $data->set('results_by_subdivisions', $results_by_subdivs); |
282 | 287 | |
283 | 288 | $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
284 | - } |
|
285 | - else { |
|
289 | + } else { |
|
286 | 290 | $results = $placesGeneralResults['places']; |
287 | 291 | arsort($results); |
288 | 292 | $data->set('results', $results); |
@@ -290,8 +294,7 @@ discard block |
||
290 | 294 | |
291 | 295 | $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
292 | 296 | } |
293 | - } |
|
294 | - else { |
|
297 | + } else { |
|
295 | 298 | $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
296 | 299 | } |
297 | 300 | return $html; |
@@ -325,9 +328,15 @@ discard block |
||
325 | 328 | $sum = 0; |
326 | 329 | $other = 0; |
327 | 330 | $unknown = 0; |
328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
331 | + if(isset($genData['sum'])) { |
|
332 | + $sum = $genData['sum']; |
|
333 | + } |
|
334 | + if(isset($genData['other'])) { |
|
335 | + $other = $genData['other']; |
|
336 | + } |
|
337 | + if(isset($genData['unknown'])) { |
|
338 | + $unknown = $genData['unknown']; |
|
339 | + } |
|
331 | 340 | |
332 | 341 | if($sum > 0) { |
333 | 342 | $results_by_gen[$gen]['sum'] = $sum; |
@@ -345,8 +354,7 @@ discard block |
||
345 | 354 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
346 | 355 | } |
347 | 356 | } |
348 | - } |
|
349 | - else { |
|
357 | + } else { |
|
350 | 358 | $tmp = $genData['places']; |
351 | 359 | if($other > 0) { |
352 | 360 | $tmp = array_slice($tmp, 0, 5, true); |
@@ -362,8 +370,7 @@ discard block |
||
362 | 370 | |
363 | 371 | $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
364 | 372 | |
365 | - } |
|
366 | - else { |
|
373 | + } else { |
|
367 | 374 | $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
368 | 375 | } |
369 | 376 | return $html; |
@@ -66,7 +66,9 @@ |
||
66 | 66 | global $WT_TREE; |
67 | 67 | |
68 | 68 | $action = Filter::post('action'); |
69 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
69 | + if($action == 'update' && Filter::checkCsrf()) { |
|
70 | + $this->update(); |
|
71 | + } |
|
70 | 72 | |
71 | 73 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
72 | 74 | $ctrl = new PageController(); |
@@ -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; |
@@ -159,7 +159,9 @@ discard block |
||
159 | 159 | public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
160 | 160 | $html = ''; |
161 | 161 | $tag = 'em'; |
162 | - if($isStrong) $tag = 'strong'; |
|
162 | + if($isStrong) { |
|
163 | + $tag = 'strong'; |
|
164 | + } |
|
163 | 165 | if($individual && $individual->canShow()){ |
164 | 166 | $dindi = new Individual($individual); |
165 | 167 | $html = $individual->getSexImage(); |
@@ -173,8 +175,7 @@ discard block |
||
173 | 175 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
174 | 176 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10).'</em></small></span>'; |
175 | 177 | $html .= '</a>'; |
176 | - } |
|
177 | - else { |
|
178 | + } else { |
|
178 | 179 | $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
179 | 180 | } |
180 | 181 | return $html; |
@@ -194,8 +195,7 @@ discard block |
||
194 | 195 | $date = $fact->getDate(); |
195 | 196 | if($date->isOK()){ |
196 | 197 | $html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
197 | - } |
|
198 | - else{ |
|
198 | + } else{ |
|
199 | 199 | // 1 DEAT Y with no DATE => print YES |
200 | 200 | // 1 BIRT 2 SOUR @S1@ => print YES |
201 | 201 | // 1 DEAT N is not allowed |
@@ -219,7 +219,9 @@ discard block |
||
219 | 219 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
220 | 220 | $html=''; |
221 | 221 | |
222 | - if ($fact === null) return $html; |
|
222 | + if ($fact === null) { |
|
223 | + return $html; |
|
224 | + } |
|
223 | 225 | $place = $fact->getPlace(); |
224 | 226 | if($place){ |
225 | 227 | $dplace = new Place($place); |
@@ -337,7 +339,9 @@ discard block |
||
337 | 339 | default: |
338 | 340 | break; |
339 | 341 | } |
340 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
342 | + if($image && $title) { |
|
343 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
344 | + } |
|
341 | 345 | break; |
342 | 346 | default: |
343 | 347 | break; |