@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->view_bag = new ViewBag(); |
| 71 | 71 | $this->view_bag->set('generation', $this->generation); |
| 72 | 72 | $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
| 73 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 73 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 93 | 93 | |
| 94 | - if($this->view_bag->get('is_setup', false)) { |
|
| 94 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 95 | 95 | $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
| 96 | 96 | $this->view_bag->set('url_module', $this->module->getName()); |
| 97 | 97 | $this->view_bag->set('url_action', 'SosaList'); |
| 98 | 98 | $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
| 99 | 99 | $this->view_bag->set('min_gen', 1); |
| 100 | 100 | |
| 101 | - if($this->view_bag->get('has_sosa', false)) { |
|
| 101 | + if ($this->view_bag->get('has_sosa', false)) { |
|
| 102 | 102 | $controller->addInlineJavascript(' |
| 103 | 103 | jQuery("#sosalist-tabs").tabs(); |
| 104 | 104 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | "mod" : "'.$this->module->getName().'", |
| 110 | 110 | "mod_action": "SosaList@sosalist", |
| 111 | - "ged" : "' . $WT_TREE->getNameUrl(). '", |
|
| 111 | + "ged" : "' . $WT_TREE->getNameUrl().'", |
|
| 112 | 112 | "type" : "indi", |
| 113 | 113 | "gen" : "'.$this->generation.'" |
| 114 | 114 | }, |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | "mod" : "'.$this->module->getName().'", |
| 135 | 135 | "mod_action": "SosaList@sosalist", |
| 136 | - "ged" : "' . $WT_TREE->getNameUrl(). '", |
|
| 136 | + "ged" : "' . $WT_TREE->getNameUrl().'", |
|
| 137 | 137 | "type" : "fam", |
| 138 | 138 | "gen" : "'.$this->generation.'" |
| 139 | 139 | }, |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 174 | 174 | |
| 175 | - if($this->view_bag->get('is_setup', false)) { |
|
| 175 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 176 | 176 | $this->view_bag->set('url_module', $this->module->getName()); |
| 177 | 177 | $this->view_bag->set('url_action', 'SosaList@missing'); |
| 178 | 178 | $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
| 182 | 182 | $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
| 183 | 183 | |
| 184 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 184 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); |
|
| 185 | 185 | $this->view_bag->set('perc_sosa', $perc_sosa); |
| 186 | 186 | |
| 187 | - if($this->view_bag->get('has_missing', false)) { |
|
| 188 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 187 | + if ($this->view_bag->get('has_missing', false)) { |
|
| 188 | + $table_id = 'table-sosa-missing-'.Uuid::uuid4(); |
|
| 189 | 189 | $this->view_bag->set('table_id', $table_id); |
| 190 | 190 | |
| 191 | 191 | $controller |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; |
| 199 | 199 | |
| 200 | 200 | jQuery("#'.$table_id.'").dataTable( { |
| 201 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 201 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 202 | 202 | '.I18N::datatablesI18N().', |
| 203 | 203 | jQueryUI: true, |
| 204 | 204 | autoWidth:false, |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | pagingType: "full_numbers" |
| 230 | 230 | }); |
| 231 | 231 | |
| 232 | - jQuery("#' . $table_id . '") |
|
| 232 | + jQuery("#' . $table_id.'") |
|
| 233 | 233 | /* Filter buttons in table header */ |
| 234 | 234 | .on("click", "button[data-filter-column]", function() { |
| 235 | 235 | var btn = jQuery(this); |
| 236 | 236 | // De-activate the other buttons in this button group |
| 237 | 237 | btn.siblings().removeClass("ui-state-active"); |
| 238 | 238 | // Apply (or clear) this filter |
| 239 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 239 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 240 | 240 | if (btn.hasClass("ui-state-active")) { |
| 241 | 241 | btn.removeClass("ui-state-active"); |
| 242 | 242 | col.search("").draw(); |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | $unique_indis = array(); |
| 254 | 254 | $sum_missing_different = 0; |
| 255 | 255 | $sum_missing_different_without_hidden = 0; |
| 256 | - foreach($missing_list as $num => $missing_tab) { |
|
| 257 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 256 | + foreach ($missing_list as $num => $missing_tab) { |
|
| 257 | + if (isset($unique_indis[$missing_tab['indi']])) { |
|
| 258 | 258 | unset($missing_list[$num]); |
| 259 | 259 | continue; |
| 260 | 260 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $this->view_bag->set('missing_list', $missing_list); |
| 273 | 273 | $this->view_bag->set('missing_diff_count', $sum_missing_different); |
| 274 | 274 | $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
| 275 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 275 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); |
|
| 276 | 276 | $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $controller = new AjaxController(); |
| 291 | 291 | $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
| 292 | 292 | |
| 293 | - switch ($type){ |
|
| 293 | + switch ($type) { |
|
| 294 | 294 | case 'indi': |
| 295 | 295 | $this->renderSosaListIndi($controller); |
| 296 | 296 | break; |
@@ -313,9 +313,9 @@ discard block |
||
| 313 | 313 | $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
| 314 | 314 | $this->view_bag->set('has_sosa', false); |
| 315 | 315 | |
| 316 | - if(count($listSosa) > 0) { |
|
| 316 | + if (count($listSosa) > 0) { |
|
| 317 | 317 | $this->view_bag->set('has_sosa', true); |
| 318 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 318 | + $table_id = 'table-sosa-indi-'.Uuid::uuid4(); |
|
| 319 | 319 | $this->view_bag->set('table_id', $table_id); |
| 320 | 320 | |
| 321 | 321 | $controller |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; |
| 328 | 328 | |
| 329 | 329 | jQuery("#'.$table_id.'").dataTable( { |
| 330 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 331 | - ' . I18N::datatablesI18N() . ', |
|
| 330 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 331 | + ' . I18N::datatablesI18N().', |
|
| 332 | 332 | jQueryUI: true, |
| 333 | 333 | autoWidth: false, |
| 334 | 334 | processing: true, |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | pagingType: "full_numbers" |
| 365 | 365 | }); |
| 366 | 366 | |
| 367 | - jQuery("#' . $table_id . '") |
|
| 367 | + jQuery("#' . $table_id.'") |
|
| 368 | 368 | /* Hide/show parents */ |
| 369 | 369 | .on("click", ".btn-toggle-parents", function() { |
| 370 | 370 | jQuery(this).toggleClass("ui-state-active"); |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | /* Hide/show statistics */ |
| 374 | 374 | .on("click", ".btn-toggle-statistics", function() { |
| 375 | 375 | jQuery(this).toggleClass("ui-state-active"); |
| 376 | - jQuery("#indi_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 376 | + jQuery("#indi_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 377 | 377 | }) |
| 378 | 378 | /* Filter buttons in table header */ |
| 379 | 379 | .on("click", "button[data-filter-column]", function() { |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | // De-activate the other buttons in this button group |
| 382 | 382 | btn.siblings().removeClass("ui-state-active"); |
| 383 | 383 | // Apply (or clear) this filter |
| 384 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 384 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 385 | 385 | if (btn.hasClass("ui-state-active")) { |
| 386 | 386 | btn.removeClass("ui-state-active"); |
| 387 | 387 | col.search("").draw(); |
@@ -416,30 +416,30 @@ discard block |
||
| 416 | 416 | $nb_displayed = 0; |
| 417 | 417 | |
| 418 | 418 | Individual::load($WT_TREE, $listSosa); |
| 419 | - foreach($listSosa as $sosa => $pid) { |
|
| 419 | + foreach ($listSosa as $sosa => $pid) { |
|
| 420 | 420 | $person = Individual::getInstance($pid, $WT_TREE); |
| 421 | 421 | if (!$person || !$person->canShowName()) { |
| 422 | 422 | unset($listSosa[$sosa]); |
| 423 | 423 | continue; |
| 424 | 424 | } |
| 425 | 425 | $nb_displayed++; |
| 426 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 426 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
| 427 | 427 | if ( |
| 428 | 428 | FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
| 429 | 429 | !isset($unique_indis[$person->getXref()]) |
| 430 | 430 | ) { |
| 431 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 431 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | else { |
| 435 | - $birth_dates[0]=new Date(''); |
|
| 435 | + $birth_dates[0] = new Date(''); |
|
| 436 | 436 | } |
| 437 | 437 | if ($death_dates = $person->getAllDeathDates()) { |
| 438 | 438 | if ( |
| 439 | 439 | FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
| 440 | 440 | !isset($unique_indis[$person->getXref()]) |
| 441 | 441 | ) { |
| 442 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 442 | + $deat_by_decade[(int)($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | else { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $this->view_bag->set('sosa_list', $listSosa); |
| 456 | 456 | |
| 457 | 457 | $this->view_bag->set('sosa_count', count($listSosa)); |
| 458 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 458 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation - 1)); |
|
| 459 | 459 | $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
| 460 | 460 | |
| 461 | 461 | $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
@@ -475,12 +475,12 @@ discard block |
||
| 475 | 475 | protected function renderFamSosaListIndi(AjaxController $controller) { |
| 476 | 476 | global $WT_TREE; |
| 477 | 477 | |
| 478 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 478 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation); ; |
|
| 479 | 479 | $this->view_bag->set('has_sosa', false); |
| 480 | 480 | |
| 481 | - if(count($listFamSosa) > 0) { |
|
| 481 | + if (count($listFamSosa) > 0) { |
|
| 482 | 482 | $this->view_bag->set('has_sosa', true); |
| 483 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 483 | + $table_id = 'table-sosa-fam-'.Uuid::uuid4(); |
|
| 484 | 484 | $this->view_bag->set('table_id', $table_id); |
| 485 | 485 | |
| 486 | 486 | $controller |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; |
| 493 | 493 | |
| 494 | 494 | jQuery("#'.$table_id.'").dataTable( { |
| 495 | - dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 495 | + dom: \'<"H"<"filtersH_' . $table_id.'"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 496 | 496 | '.I18N::datatablesI18N(array(16, 32, 64, 128, -1)).', |
| 497 | 497 | jQueryUI: true, |
| 498 | 498 | autoWidth: false, |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | pagingType: "full_numbers" |
| 530 | 530 | }); |
| 531 | 531 | |
| 532 | - jQuery("#' . $table_id . '") |
|
| 532 | + jQuery("#' . $table_id.'") |
|
| 533 | 533 | /* Hide/show parents */ |
| 534 | 534 | .on("click", ".btn-toggle-parents", function() { |
| 535 | 535 | jQuery(this).toggleClass("ui-state-active"); |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | /* Hide/show statistics */ |
| 539 | 539 | .on("click", ".btn-toggle-statistics", function() { |
| 540 | 540 | jQuery(this).toggleClass("ui-state-active"); |
| 541 | - jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 541 | + jQuery("#fam_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 542 | 542 | }) |
| 543 | 543 | /* Filter buttons in table header */ |
| 544 | 544 | .on("click", "button[data-filter-column]", function() { |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | // De-activate the other buttons in this button group |
| 547 | 547 | btn.siblings().removeClass("ui-state-active"); |
| 548 | 548 | // Apply (or clear) this filter |
| 549 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 549 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 550 | 550 | if (btn.hasClass("ui-state-active")) { |
| 551 | 551 | btn.removeClass("ui-state-active"); |
| 552 | 552 | col.search("").draw(); |
@@ -566,29 +566,29 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | //-- init chart data |
| 568 | 568 | $marr_by_age = array(); |
| 569 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 569 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 570 | 570 | $marr_by_age[$age] = ''; |
| 571 | 571 | } |
| 572 | 572 | $birt_by_decade = array(); |
| 573 | 573 | $marr_by_decade = array(); |
| 574 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 574 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 575 | 575 | $birt_by_decade[$year] = ''; |
| 576 | 576 | $marr_by_decade[$year] = ''; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 579 | + foreach ($listFamSosa as $sosa => $fid) { |
|
| 580 | 580 | $sfamily = Family::getInstance($fid, $WT_TREE); |
| 581 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 581 | + if (!$sfamily || !$sfamily->canShow()) { |
|
| 582 | 582 | unset($sfamily[$sosa]); |
| 583 | 583 | continue; |
| 584 | 584 | } |
| 585 | - $mdate=$sfamily->getMarriageDate(); |
|
| 585 | + $mdate = $sfamily->getMarriageDate(); |
|
| 586 | 586 | |
| 587 | - if( ($husb = $sfamily->getHusband()) && |
|
| 587 | + if (($husb = $sfamily->getHusband()) && |
|
| 588 | 588 | ($hdate = $husb->getBirthDate()) && |
| 589 | 589 | $hdate->isOK() && $mdate->isOK()) { |
| 590 | 590 | if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
| 591 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 591 | + $birt_by_decade[(int)($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 592 | 592 | } |
| 593 | 593 | $hage = Date::getAge($hdate, $mdate, 0); |
| 594 | 594 | if ($hage >= 0 && $hage <= $max_age) { |
@@ -596,11 +596,11 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - if(($wife = $sfamily->getWife()) && |
|
| 600 | - ($wdate=$wife->getBirthDate()) && |
|
| 599 | + if (($wife = $sfamily->getWife()) && |
|
| 600 | + ($wdate = $wife->getBirthDate()) && |
|
| 601 | 601 | $wdate->isOK() && $mdate->isOK()) { |
| 602 | 602 | if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
| 603 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 603 | + $birt_by_decade[(int)($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 604 | 604 | } |
| 605 | 605 | $wage = Date::getAge($wdate, $mdate, 0); |
| 606 | 606 | if ($wage >= 0 && $wage <= $max_age) { |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
| 612 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 612 | + $marr_by_decade[(int)($mdate->gregorianYear() / 10) * 10] .= $husb->getSex().$wife->getSex(); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | $listFamSosa[$sosa] = $sfamily; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
| 29 | 29 | */ |
| 30 | - public function __construct(\Fisharebest\Webtrees\Place $place){ |
|
| 30 | + public function __construct(\Fisharebest\Webtrees\Place $place) { |
|
| 31 | 31 | $this->place = $place; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param \Fisharebest\Webtrees\Tree $tree |
| 40 | 40 | * @return \MyArtJaub\Webtrees\Place|null Instance of \MyArtJaub\Webtrees\Place, if relevant |
| 41 | 41 | */ |
| 42 | - public static function getIntance($place_str, Tree $tree){ |
|
| 42 | + public static function getIntance($place_str, Tree $tree) { |
|
| 43 | 43 | $dplace = null; |
| 44 | - if(is_string($place_str) && strlen($place_str) > 0){ |
|
| 44 | + if (is_string($place_str) && strlen($place_str) > 0) { |
|
| 45 | 45 | $dplace = new Place(new \Fisharebest\Webtrees\Place($place_str, $tree)); |
| 46 | 46 | } |
| 47 | 47 | return $dplace; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return \Fisharebest\Webtrees\Place Embedded place record |
| 54 | 54 | */ |
| 55 | - public function getDerivedPlace(){ |
|
| 55 | + public function getDerivedPlace() { |
|
| 56 | 56 | return $this->place; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @param bool $anchor Option to print a link to placelist |
| 66 | 66 | * @return string HTML code for formatted place |
| 67 | 67 | */ |
| 68 | - public function htmlFormattedName($format, $anchor = false){ |
|
| 69 | - $html=''; |
|
| 68 | + public function htmlFormattedName($format, $anchor = false) { |
|
| 69 | + $html = ''; |
|
| 70 | 70 | |
| 71 | 71 | $levels = array_map('trim', explode(',', $this->place->getGedcomName())); |
| 72 | 72 | $nbLevels = count($levels); |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | preg_match_all('/%[^%]/', $displayPlace, $matches); |
| 75 | 75 | foreach ($matches[0] as $match2) { |
| 76 | 76 | $index = str_replace('%', '', $match2); |
| 77 | - if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
|
| 78 | - $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
|
| 77 | + if (is_numeric($index) && $index > 0 && $index <= $nbLevels) { |
|
| 78 | + $displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace); |
|
| 79 | 79 | } |
| 80 | - else{ |
|
| 81 | - $displayPlace = str_replace($match2, '' , $displayPlace); |
|
| 80 | + else { |
|
| 81 | + $displayPlace = str_replace($match2, '', $displayPlace); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if ($anchor && !Auth::isSearchEngine()) { |
| 85 | - $html .='<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>'; |
|
| 85 | + $html .= '<a href="'.$this->place->getURL().'">'.$displayPlace.'</a>'; |
|
| 86 | 86 | } else { |
| 87 | 87 | $html .= $displayPlace; |
| 88 | 88 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @param string $gedcom |
| 31 | 31 | * @return NULL|\MyArtJaub\Webtrees\Family |
| 32 | 32 | */ |
| 33 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
| 33 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
| 34 | 34 | $dfam = null; |
| 35 | 35 | $fam = fw\Family::getInstance($xref, $tree, $gedcom); |
| 36 | - if($fam){ |
|
| 36 | + if ($fam) { |
|
| 37 | 37 | $dfam = new Family($fam); |
| 38 | 38 | } |
| 39 | 39 | return $dfam; |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return int Level of sources |
| 46 | 46 | * */ |
| 47 | - function isMarriageSourced(){ |
|
| 48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 47 | + function isMarriageSourced() { |
|
| 48 | + if ($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 49 | 49 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
| 50 | 50 | return $this->is_marriage_sourced; |
| 51 | 51 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | class Individual extends GedcomRecord { |
| 22 | 22 | |
| 23 | 23 | /** @var array|null List of titles the individal holds */ |
| 24 | - protected $titles=null; |
|
| 24 | + protected $titles = null; |
|
| 25 | 25 | |
| 26 | 26 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
| 27 | 27 | protected $unprotected_prim_surname = null; |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * @param null|string $gedcom |
| 44 | 44 | * @return null|Individual |
| 45 | 45 | */ |
| 46 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
| 46 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
| 47 | 47 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
| 48 | - if($indi){ |
|
| 48 | + if ($indi) { |
|
| 49 | 49 | return new Individual($indi); |
| 50 | 50 | } |
| 51 | 51 | return null; |
@@ -56,18 +56,18 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return array Array of titles |
| 58 | 58 | */ |
| 59 | - public function getTitles(){ |
|
| 60 | - if(is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
| 59 | + public function getTitles() { |
|
| 60 | + if (is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
| 61 | 61 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
| 62 | - $this->titles=array(); |
|
| 62 | + $this->titles = array(); |
|
| 63 | 63 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
| 64 | - foreach($titlefacts as $titlefact){ |
|
| 64 | + foreach ($titlefacts as $titlefact) { |
|
| 65 | 65 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
| 66 | - if($ct2>0){ |
|
| 67 | - $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
|
| 66 | + if ($ct2 > 0) { |
|
| 67 | + $this->titles[$match2[1][0]][] = trim($match2[2][0]); |
|
| 68 | 68 | } |
| 69 | - else{ |
|
| 70 | - $this->titles[$titlefact->getValue()][]=''; |
|
| 69 | + else { |
|
| 70 | + $this->titles[$titlefact->getValue()][] = ''; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | * @return string Primary surname |
| 82 | 82 | */ |
| 83 | 83 | public function getUnprotectedPrimarySurname() { |
| 84 | - if(!$this->unprotected_prim_surname){ |
|
| 85 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
| 84 | + if (!$this->unprotected_prim_surname) { |
|
| 85 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
| 86 | 86 | $this->unprotected_prim_surname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
| 87 | 87 | } |
| 88 | 88 | return $this->unprotected_prim_surname; |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | * @param boolean $perc Should the coefficient of reliability be returned |
| 95 | 95 | * @return string|array Estimated birth place if found, null otherwise |
| 96 | 96 | */ |
| 97 | - public function getEstimatedBirthPlace($perc=false){ |
|
| 98 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 99 | - if($perc){ |
|
| 100 | - return array ($bplace, 1); |
|
| 97 | + public function getEstimatedBirthPlace($perc = false) { |
|
| 98 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
| 99 | + if ($perc) { |
|
| 100 | + return array($bplace, 1); |
|
| 101 | 101 | } |
| 102 | - else{ |
|
| 102 | + else { |
|
| 103 | 103 | return $bplace; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param boolean $perc Should the coefficient of reliability be returned |
| 113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
| 114 | 114 | */ |
| 115 | - public function getSignificantPlace(){ |
|
| 116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 115 | + public function getSignificantPlace() { |
|
| 116 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
| 117 | 117 | return $bplace; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 126 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
| 127 | 127 | return $dplace; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 130 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | 131 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
| 132 | 132 | if ($rplace) { |
| 133 | 133 | return $rplace; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @return boolean Is the individual a Sosa ancestor |
| 145 | 145 | */ |
| 146 | - public function isSosa(){ |
|
| 146 | + public function isSosa() { |
|
| 147 | 147 | return count($this->getSosaNumbers()) > 0; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | * @uses \MyArtJaub\Webtrees\Functions\ModuleManager |
| 155 | 155 | * @return array List of Sosa numbers |
| 156 | 156 | */ |
| 157 | - public function getSosaNumbers(){ |
|
| 158 | - if($this->sosa === null) { |
|
| 157 | + public function getSosaNumbers() { |
|
| 158 | + if ($this->sosa === null) { |
|
| 159 | 159 | $provider = new SosaProvider($this->gedcomrecord->getTree()); |
| 160 | 160 | $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
| 161 | 161 | } |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @return int Level of sources |
| 169 | 169 | * */ |
| 170 | - public function isBirthSourced(){ |
|
| 171 | - if($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
| 170 | + public function isBirthSourced() { |
|
| 171 | + if ($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
| 172 | 172 | $this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT); |
| 173 | 173 | return $this->is_birth_sourced; |
| 174 | 174 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return int Level of sources |
| 180 | 180 | * */ |
| 181 | - public function isDeathSourced(){ |
|
| 182 | - if($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
| 181 | + public function isDeathSourced() { |
|
| 182 | + if ($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
| 183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
| 184 | 184 | return $this->is_death_sourced; |
| 185 | 185 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param string $file Filename containing the task object |
| 81 | 81 | * @param TaskProviderInterface $provider Provider for tasks |
| 82 | 82 | */ |
| 83 | - public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 83 | + public function __construct($file, TaskProviderInterface $provider = null) { |
|
| 84 | 84 | $this->name = trim(basename($file, '.php')); |
| 85 | 85 | $this->provider = $provider; |
| 86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return TaskProviderInterface |
| 92 | 92 | */ |
| 93 | - public function getProvider(){ |
|
| 93 | + public function getProvider() { |
|
| 94 | 94 | return $this->provider; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param TaskProviderInterface $provider |
| 101 | 101 | * @return self Enable method-chaining |
| 102 | 102 | */ |
| 103 | - public function setProvider(TaskProviderInterface $provider){ |
|
| 103 | + public function setProvider(TaskProviderInterface $provider) { |
|
| 104 | 104 | $this->provider = $provider; |
| 105 | 105 | return $this; |
| 106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
| 116 | 116 | * @param bool $is_running Indicates if the task is currently running |
| 117 | 117 | */ |
| 118 | - public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 118 | + public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running) { |
|
| 119 | 119 | $this->is_enabled = $is_enabled; |
| 120 | 120 | $this->last_updated = $last_updated; |
| 121 | 121 | $this->last_result = $last_result; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | - public function getName(){ |
|
| 132 | + public function getName() { |
|
| 133 | 133 | return $this->name; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return boolean True if enabled |
| 141 | 141 | */ |
| 142 | - public function isEnabled(){ |
|
| 142 | + public function isEnabled() { |
|
| 143 | 143 | return $this->is_enabled; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return \DateTime |
| 150 | 150 | */ |
| 151 | - public function getLastUpdated(){ |
|
| 151 | + public function getLastUpdated() { |
|
| 152 | 152 | return $this->last_updated; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @return bool |
| 159 | 159 | */ |
| 160 | - public function isLastRunSuccess(){ |
|
| 160 | + public function isLastRunSuccess() { |
|
| 161 | 161 | return $this->last_result; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @return int |
| 168 | 168 | */ |
| 169 | - public function getFrequency(){ |
|
| 169 | + public function getFrequency() { |
|
| 170 | 170 | return $this->frequency; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param int $frequency |
| 177 | 177 | * @return self Enable method-chaining |
| 178 | 178 | */ |
| 179 | - public function setFrequency($frequency){ |
|
| 179 | + public function setFrequency($frequency) { |
|
| 180 | 180 | $this->frequency = $frequency; |
| 181 | 181 | return $this; |
| 182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return int |
| 188 | 188 | */ |
| 189 | - public function getRemainingOccurrences(){ |
|
| 189 | + public function getRemainingOccurrences() { |
|
| 190 | 190 | return $this->nb_occurrences; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param int $nb_occur |
| 197 | 197 | * @return self Enable method-chaining |
| 198 | 198 | */ |
| 199 | - public function setRemainingOccurrences($nb_occur){ |
|
| 199 | + public function setRemainingOccurrences($nb_occur) { |
|
| 200 | 200 | $this->nb_occurrences = $nb_occur; |
| 201 | 201 | return $this; |
| 202 | 202 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return bool |
| 208 | 208 | */ |
| 209 | - public function isRunning(){ |
|
| 209 | + public function isRunning() { |
|
| 210 | 210 | return $this->is_running; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -235,7 +235,7 @@ 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) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | 239 | return $this->provider->updateTask($this); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,23 +243,23 @@ discard block |
||
| 243 | 243 | * Execute the task, default skeleton |
| 244 | 244 | * |
| 245 | 245 | */ |
| 246 | - public function execute(){ |
|
| 246 | + public function execute() { |
|
| 247 | 247 | |
| 248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 248 | + if ($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | 249 | $this->is_running = false; |
| 250 | 250 | |
| 251 | - if(!$this->is_running){ |
|
| 251 | + if (!$this->is_running) { |
|
| 252 | 252 | $this->last_result = false; |
| 253 | 253 | $this->is_running = true; |
| 254 | 254 | $this->save(); |
| 255 | 255 | |
| 256 | 256 | Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
| 257 | 257 | $this->last_result = $this->executeSteps(); |
| 258 | - if($this->last_result){ |
|
| 258 | + if ($this->last_result) { |
|
| 259 | 259 | $this->last_updated = new \DateTime(); |
| 260 | - if($this->nb_occurrences > 0){ |
|
| 260 | + if ($this->nb_occurrences > 0) { |
|
| 261 | 261 | $this->nb_occurrences--; |
| 262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 262 | + if ($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | $this->is_running = false; |
@@ -70,34 +70,34 @@ discard block |
||
| 70 | 70 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks() |
| 71 | 71 | */ |
| 72 | 72 | public function getPossibleHooks() { |
| 73 | - static $hooks=null; |
|
| 73 | + static $hooks = null; |
|
| 74 | 74 | if ($hooks === null) { |
| 75 | 75 | $hooks = array(); |
| 76 | - foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) { |
|
| 76 | + foreach (glob(WT_ROOT.WT_MODULES_DIR.'*/module.php') as $file) { |
|
| 77 | 77 | try { |
| 78 | 78 | $module = include $file; |
| 79 | - if($module instanceof HookSubscriberInterface){ |
|
| 79 | + if ($module instanceof HookSubscriberInterface) { |
|
| 80 | 80 | $subscribedhooks = $module->getSubscribedHooks(); |
| 81 | - if(is_array($subscribedhooks)){ |
|
| 82 | - foreach($subscribedhooks as $key => $value){ |
|
| 83 | - if(is_int($key)) { |
|
| 81 | + if (is_array($subscribedhooks)) { |
|
| 82 | + foreach ($subscribedhooks as $key => $value) { |
|
| 83 | + if (is_int($key)) { |
|
| 84 | 84 | $hook_item = $value; |
| 85 | 85 | $priority = self::DEFAULT_PRIORITY; |
| 86 | 86 | } |
| 87 | - else{ |
|
| 87 | + else { |
|
| 88 | 88 | $hook_item = explode('#', $key, 2); |
| 89 | 89 | $priority = $value; |
| 90 | 90 | } |
| 91 | - if($hook_item && count($hook_item) == 2){ |
|
| 91 | + if ($hook_item && count($hook_item) == 2) { |
|
| 92 | 92 | $hook_func = $hook_item[0]; |
| 93 | 93 | $hook_cont = $hook_item[1]; |
| 94 | 94 | } |
| 95 | - else{ |
|
| 95 | + else { |
|
| 96 | 96 | $hook_func = $hook_item[0]; |
| 97 | 97 | $hook_cont = 'all'; |
| 98 | 98 | } |
| 99 | - if(method_exists($module, $hook_func)){ |
|
| 100 | - $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority; |
|
| 99 | + if (method_exists($module, $hook_func)) { |
|
| 100 | + $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * {@inheritDoc} |
| 115 | 115 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getRawInstalledHooks() |
| 116 | 116 | */ |
| 117 | - public function getRawInstalledHooks(){ |
|
| 118 | - if(self::isModuleOperational()){ |
|
| 117 | + public function getRawInstalledHooks() { |
|
| 118 | + if (self::isModuleOperational()) { |
|
| 119 | 119 | return fw\Database::prepare( |
| 120 | 120 | "SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority, majh_status AS status". |
| 121 | 121 | " FROM `##maj_hooks`". |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | * {@inheritDoc} |
| 130 | 130 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getInstalledHooks() |
| 131 | 131 | */ |
| 132 | - public function getInstalledHooks(){ |
|
| 133 | - static $installedhooks =null; |
|
| 134 | - if($installedhooks===null){ |
|
| 135 | - $dbhooks=self::getRawInstalledHooks(); |
|
| 136 | - foreach($dbhooks as $dbhook){ |
|
| 132 | + public function getInstalledHooks() { |
|
| 133 | + static $installedhooks = null; |
|
| 134 | + if ($installedhooks === null) { |
|
| 135 | + $dbhooks = self::getRawInstalledHooks(); |
|
| 136 | + foreach ($dbhooks as $dbhook) { |
|
| 137 | 137 | $installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function updateHooks() { |
| 148 | 148 | |
| 149 | - if(Auth::isAdmin()){ |
|
| 149 | + if (Auth::isAdmin()) { |
|
| 150 | 150 | $ihooks = self::getInstalledHooks(); |
| 151 | 151 | $phooks = self::getPossibleHooks(); |
| 152 | 152 | |
| 153 | 153 | // Insert hooks not existing yet in the DB |
| 154 | - if($phooks !== null){ |
|
| 155 | - foreach($phooks as $phook => $priority){ |
|
| 154 | + if ($phooks !== null) { |
|
| 155 | + foreach ($phooks as $phook => $priority) { |
|
| 156 | 156 | $array_hook = explode('#', $phook); |
| 157 | - if($ihooks === null || !array_key_exists($phook, $ihooks)){ |
|
| 157 | + if ($ihooks === null || !array_key_exists($phook, $ihooks)) { |
|
| 158 | 158 | $chook = new Hook($array_hook[1], $array_hook[2]); |
| 159 | 159 | $chook->subscribe($array_hook[0]); |
| 160 | 160 | $chook->setPriority($array_hook[0], $priority); |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | //Remove hooks not existing any more in the file system |
| 166 | - if($ihooks !== null){ |
|
| 167 | - foreach($ihooks as $ihook => $status){ |
|
| 166 | + if ($ihooks !== null) { |
|
| 167 | + foreach ($ihooks as $ihook => $status) { |
|
| 168 | 168 | $array_hook = explode('#', $ihook); |
| 169 | - if($phooks === null || !array_key_exists($ihook, $phooks)){ |
|
| 169 | + if ($phooks === null || !array_key_exists($ihook, $phooks)) { |
|
| 170 | 170 | $chook = new Hook($array_hook[1], $array_hook[2]); |
| 171 | 171 | $chook->remove($array_hook[0]); |
| 172 | 172 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $hook_function_in Hook function to be subscribed or executed |
| 31 | 31 | * @param string $hook_context_in Hook context to be subscribed or executed |
| 32 | 32 | */ |
| 33 | - public function __construct($hook_function_in, $hook_context_in = 'all'){ |
|
| 33 | + public function __construct($hook_function_in, $hook_context_in = 'all') { |
|
| 34 | 34 | $this->hook_function = $hook_function_in; |
| 35 | 35 | $this->hook_context = $hook_context_in; |
| 36 | 36 | } |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param string $hsubscriber Name of the subscriber module |
| 48 | 48 | */ |
| 49 | - public function subscribe($hsubscriber){ |
|
| 50 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 49 | + public function subscribe($hsubscriber) { |
|
| 50 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 51 | 51 | $statement = fw\Database::prepare( |
| 52 | 52 | "INSERT IGNORE INTO `##maj_hooks` (majh_hook_function, majh_hook_context, majh_module_name)". |
| 53 | 53 | " VALUES (?, ?, ?)" |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * @param string $hsubscriber Name of the subscriber module |
| 62 | 62 | * @param int $priority Priority of execution |
| 63 | 63 | */ |
| 64 | - public function setPriority($hsubscriber, $priority){ |
|
| 65 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 64 | + public function setPriority($hsubscriber, $priority) { |
|
| 65 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 66 | 66 | fw\Database::prepare( |
| 67 | 67 | "UPDATE `##maj_hooks`". |
| 68 | 68 | " SET majh_module_priority=?". |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param string $hsubscriber Name of the subscriber module |
| 80 | 80 | */ |
| 81 | - public function enable($hsubscriber){ |
|
| 82 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 81 | + public function enable($hsubscriber) { |
|
| 82 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 83 | 83 | fw\Database::prepare( |
| 84 | 84 | "UPDATE `##maj_hooks`". |
| 85 | 85 | " SET majh_status='enabled'". |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @param string $hsubscriber Name of the subscriber module |
| 97 | 97 | */ |
| 98 | - public function disable($hsubscriber){ |
|
| 99 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 98 | + public function disable($hsubscriber) { |
|
| 99 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 100 | 100 | fw\Database::prepare( |
| 101 | 101 | "UPDATE `##maj_hooks`". |
| 102 | 102 | " SET majh_status='disabled'". |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @param string $hsubscriber Name of the subscriber module |
| 114 | 114 | */ |
| 115 | - public function remove($hsubscriber){ |
|
| 116 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 115 | + public function remove($hsubscriber) { |
|
| 116 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 117 | 117 | fw\Database::prepare( |
| 118 | 118 | "DELETE FROM `##maj_hooks`". |
| 119 | 119 | " WHERE majh_hook_function=?". |
@@ -135,24 +135,24 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return array Results of the hook executions |
| 137 | 137 | */ |
| 138 | - public function execute(){ |
|
| 138 | + public function execute() { |
|
| 139 | 139 | $result = array(); |
| 140 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 140 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 141 | 141 | $params = func_get_args(); |
| 142 | 142 | $sqlquery = ''; |
| 143 | 143 | $sqlparams = array($this->hook_function); |
| 144 | - if($this->hook_context != 'all') { |
|
| 144 | + if ($this->hook_context != 'all') { |
|
| 145 | 145 | $sqlparams = array($this->hook_function, $this->hook_context); |
| 146 | 146 | $sqlquery = " OR majh_hook_context=?"; |
| 147 | 147 | } |
| 148 | - $module_names=fw\Database::prepare( |
|
| 148 | + $module_names = fw\Database::prepare( |
|
| 149 | 149 | "SELECT majh_module_name AS module, majh_module_priority AS priority FROM `##maj_hooks`". |
| 150 | 150 | " WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'". |
| 151 | 151 | " ORDER BY majh_module_priority ASC, module ASC" |
| 152 | 152 | )->execute($sqlparams)->fetchAssoc(); |
| 153 | 153 | asort($module_names); |
| 154 | 154 | foreach ($module_names as $module_name => $module_priority) { |
| 155 | - $module = include WT_ROOT . WT_MODULES_DIR . $module_name . '/module.php'; |
|
| 155 | + $module = include WT_ROOT.WT_MODULES_DIR.$module_name.'/module.php'; |
|
| 156 | 156 | $result[] = call_user_func_array(array($module, $this->hook_function), $params); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -164,15 +164,15 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @return int Number of active modules |
| 166 | 166 | */ |
| 167 | - public function getNumberActiveModules(){ |
|
| 168 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
| 167 | + public function getNumberActiveModules() { |
|
| 168 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
| 169 | 169 | $sqlquery = ''; |
| 170 | 170 | $sqlparams = array($this->hook_function); |
| 171 | - if($this->hook_context != 'all') { |
|
| 171 | + if ($this->hook_context != 'all') { |
|
| 172 | 172 | $sqlparams = array($this->hook_function, $this->hook_context); |
| 173 | 173 | $sqlquery = " OR majh_hook_context=?"; |
| 174 | 174 | } |
| 175 | - $module_names=fw\Database::prepare( |
|
| 175 | + $module_names = fw\Database::prepare( |
|
| 176 | 176 | "SELECT majh_module_name AS modules FROM `##maj_hooks`". |
| 177 | 177 | " WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'" |
| 178 | 178 | )->execute($sqlparams)->fetchOneColumn(); |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return bool True is active modules exist, false otherwise |
| 188 | 188 | */ |
| 189 | - public function hasAnyActiveModule(){ |
|
| 190 | - return ($this->getNumberActiveModules()>0); |
|
| 189 | + public function hasAnyActiveModule() { |
|
| 190 | + return ($this->getNumberActiveModules() > 0); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param \Fisharebest\Webtrees\Controller\IndividualController $ctrl_individual_in The Individual Controller to extend |
| 34 | 34 | */ |
| 35 | - public function __construct(fw\Controller\IndividualController $ctrl_individual_in){ |
|
| 35 | + public function __construct(fw\Controller\IndividualController $ctrl_individual_in) { |
|
| 36 | 36 | $this->ctrl_individual = $ctrl_individual_in; |
| 37 | 37 | $this->dindi = new mw\Individual($this->ctrl_individual->getSignificantIndividual()); |
| 38 | 38 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
| 45 | 45 | */ |
| 46 | - public function printHeaderExtensions(){ |
|
| 46 | + public function printHeaderExtensions() { |
|
| 47 | 47 | $hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft'); |
| 48 | 48 | $hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight'); |
| 49 | 49 | $hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | echo '<div id="indi_perso_header">', |
| 53 | 53 | '<div id="indi_perso_header_left">'; |
| 54 | 54 | foreach ($hook_extend_indi_header_left as $div) { |
| 55 | - if(count($div)==2){ |
|
| 55 | + if (count($div) == 2) { |
|
| 56 | 56 | echo '<div id="', $div[0], '" class="indi_perso_header_left_div">', |
| 57 | 57 | $div[1], '</div>'; |
| 58 | 58 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | echo '</div>', |
| 61 | 61 | '<div id="indi_perso_header_right">'; |
| 62 | 62 | foreach ($hook_extend_indi_header_right as $div) { |
| 63 | - if(count($div)==2){ |
|
| 63 | + if (count($div) == 2) { |
|
| 64 | 64 | echo '<div id="', $div[0], '" class="indi_perso_header_right_div">', |
| 65 | 65 | $div[1], '</div>'; |
| 66 | 66 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
| 77 | 77 | */ |
| 78 | - public function printHeaderExtraIcons(){ |
|
| 78 | + public function printHeaderExtraIcons() { |
|
| 79 | 79 | $hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons'); |
| 80 | 80 | $hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual); |
| 81 | 81 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency() |
| 43 | 43 | */ |
| 44 | 44 | public function getDefaultFrequency() { |
| 45 | - return 10080; // = 1 week = 7 * 24 * 60 min |
|
| 45 | + return 10080; // = 1 week = 7 * 24 * 60 min |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | // Get the number of days to take into account, either last 7 days or since last check |
| 57 | 57 | $interval_sincelast = 0; |
| 58 | - if($this->last_updated){ |
|
| 58 | + if ($this->last_updated) { |
|
| 59 | 59 | $tmpInt = $this->last_updated->diff(new \DateTime('now'), true); |
| 60 | - $interval_sincelast = ( $tmpInt->days * 24 + $tmpInt->h ) * 60 + $tmpInt->i; |
|
| 60 | + $interval_sincelast = ($tmpInt->days * 24 + $tmpInt->h) * 60 + $tmpInt->i; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $interval = max($this->frequency, $interval_sincelast); |
@@ -66,17 +66,17 @@ discard block |
||
| 66 | 66 | // Check for updates |
| 67 | 67 | $latest_version_txt = Functions::fetchLatestVersion(); |
| 68 | 68 | if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
| 69 | - list($latest_version, , $download_url) = explode('|', $latest_version_txt); |
|
| 69 | + list($latest_version,, $download_url) = explode('|', $latest_version_txt); |
|
| 70 | 70 | } else { |
| 71 | 71 | // Cannot determine the latest version |
| 72 | - list($latest_version, , $download_url) = explode('|', '||'); |
|
| 72 | + list($latest_version,, $download_url) = explode('|', '||'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Users statistics |
| 76 | 76 | $warnusers = 0; |
| 77 | 77 | $nverusers = 0; |
| 78 | 78 | $applusers = 0; |
| 79 | - foreach(User::all() as $user) { |
|
| 79 | + foreach (User::all() as $user) { |
|
| 80 | 80 | if (((date("U") - (int)$user->getPreference('reg_timestamp')) > 604800) && !$user->getPreference('verified')) { |
| 81 | 81 | $warnusers++; |
| 82 | 82 | } |
@@ -90,20 +90,20 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | // Tree specifics checks |
| 92 | 92 | $one_tree_done = false; |
| 93 | - foreach(Tree::getAll() as $tree){ |
|
| 93 | + foreach (Tree::getAll() as $tree) { |
|
| 94 | 94 | $isTreeEnabled = $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED'); |
| 95 | - if((is_null($isTreeEnabled) || $isTreeEnabled) && $webmaster = User::find($tree->getPreference('WEBMASTER_USER_ID'))){ |
|
| 95 | + if ((is_null($isTreeEnabled) || $isTreeEnabled) && $webmaster = User::find($tree->getPreference('WEBMASTER_USER_ID'))) { |
|
| 96 | 96 | I18N::init($webmaster->getPreference('language')); |
| 97 | 97 | |
| 98 | 98 | $subject = I18N::translate('Health Check Report').' - '.I18N::translate('Tree %s', $tree->getTitle()); |
| 99 | 99 | $message = |
| 100 | - I18N::translate('Health Check Report for the last %d days', $nbdays). Mail::EOL. Mail::EOL. |
|
| 100 | + I18N::translate('Health Check Report for the last %d days', $nbdays).Mail::EOL.Mail::EOL. |
|
| 101 | 101 | I18N::translate('Tree %s', $tree->getTitle()).Mail::EOL. |
| 102 | 102 | '=========================================='.Mail::EOL.Mail::EOL; |
| 103 | 103 | |
| 104 | 104 | // News |
| 105 | 105 | $message_version = ''; |
| 106 | - if($latest_version && version_compare(WT_VERSION, $latest_version)<0){ |
|
| 106 | + if ($latest_version && version_compare(WT_VERSION, $latest_version) < 0) { |
|
| 107 | 107 | $message_version = I18N::translate('News').Mail::EOL. |
| 108 | 108 | '-------------'.Mail::EOL. |
| 109 | 109 | I18N::translate('A new version of *webtrees* is available: %s. Upgrade as soon as possible.', $latest_version).Mail::EOL. |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | I18N::translate('Not verified by the user')."\t\t".$applusers.Mail::EOL. |
| 120 | 120 | I18N::translate('Not approved by an administrator')."\t".$nverusers.Mail::EOL. |
| 121 | 121 | Mail::EOL; |
| 122 | - $message .= $message_users; |
|
| 122 | + $message .= $message_users; |
|
| 123 | 123 | |
| 124 | 124 | // Statistics tree: |
| 125 | 125 | $stats = new Stats($tree); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | ' AND log_time >= DATE_ADD( NOW(), INTERVAL - :nb_days DAY)'. |
| 160 | 160 | ' GROUP BY log_message, gedcom_id'. |
| 161 | 161 | ' ORDER BY lastoccurred DESC'; |
| 162 | - $errors=Database::prepare($sql)->execute(array( |
|
| 162 | + $errors = Database::prepare($sql)->execute(array( |
|
| 163 | 163 | 'log_type' => Log::TYPE_ERROR, |
| 164 | 164 | 'gedcom_id' => $tree->getTreeId(), |
| 165 | 165 | 'nb_days' => $nbdays |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $tmp_message .= str_replace("\n", "\n\t\t\t\t\t\t", $error->log_message).Mail::EOL; |
| 176 | 176 | $nb_errors += $error->nblogs; |
| 177 | 177 | } |
| 178 | - if($nb_errors > 0){ |
|
| 178 | + if ($nb_errors > 0) { |
|
| 179 | 179 | $message .= I18N::translate('Errors [%d]', $nb_errors).Mail::EOL. |
| 180 | 180 | '-------------'.Mail::EOL. |
| 181 | 181 | WT_BASE_URL.'admin_site_logs.php'.Mail::EOL. |
@@ -186,12 +186,12 @@ discard block |
||
| 186 | 186 | str_repeat('-', $nb_char_count_title)."\t".str_repeat('-', $nb_char_type)."\t".str_repeat('-', 20)."\t".str_repeat('-', strlen(I18N::translate('Error'))).Mail::EOL. |
| 187 | 187 | $tmp_message.Mail::EOL; |
| 188 | 188 | } |
| 189 | - else{ |
|
| 189 | + else { |
|
| 190 | 190 | $message .= I18N::translate('No errors', $nb_errors).Mail::EOL.Mail::EOL; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $tmpres = true; |
| 194 | - if($webmaster->getPreference('contactmethod') !== 'messaging' |
|
| 194 | + if ($webmaster->getPreference('contactmethod') !== 'messaging' |
|
| 195 | 195 | && $webmaster->getPreference('contactmethod') !== 'none') { |
| 196 | 196 | $tmpres = Mail::systemMessage($tree, $webmaster, $subject, $message); |
| 197 | 197 | } |
@@ -213,24 +213,24 @@ discard block |
||
| 213 | 213 | $html = ' |
| 214 | 214 | <div class="form-group"> |
| 215 | 215 | <label class="control-label col-sm-3"> '. |
| 216 | - I18N::translate('Enable healthcheck emails for') . |
|
| 216 | + I18N::translate('Enable healthcheck emails for'). |
|
| 217 | 217 | '</label> |
| 218 | 218 | <div class="col-sm-9">'; |
| 219 | 219 | |
| 220 | - foreach(Tree::getAll() as $tree){ |
|
| 221 | - if(Auth::isManager($tree)){ |
|
| 220 | + foreach (Tree::getAll() as $tree) { |
|
| 221 | + if (Auth::isManager($tree)) { |
|
| 222 | 222 | $html .= '<div class="form-group row"> |
| 223 | 223 | <span class="col-sm-3 control-label">' . |
| 224 | - $tree->getTitle() . |
|
| 224 | + $tree->getTitle(). |
|
| 225 | 225 | '</span> |
| 226 | 226 | <div class="col-sm-2">'; |
| 227 | - $html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"'); |
|
| 227 | + $html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_'.$tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"'); |
|
| 228 | 228 | $html .= '</div></div>'; |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $html .= ' <p class="small text-muted">'. |
| 233 | - I18N::translate('Enable the health check emails for each of the selected trees.') . |
|
| 233 | + I18N::translate('Enable the health check emails for each of the selected trees.'). |
|
| 234 | 234 | '</p> |
| 235 | 235 | </div> |
| 236 | 236 | </div>'; |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function saveConfig() { |
| 246 | 246 | try { |
| 247 | - foreach(Tree::getAll() as $tree){ |
|
| 248 | - if(Auth::isManager($tree)){ |
|
| 249 | - $tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), 0, 1); |
|
| 247 | + foreach (Tree::getAll() as $tree) { |
|
| 248 | + if (Auth::isManager($tree)) { |
|
| 249 | + $tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_'.$tree->getTreeId(), 0, 1); |
|
| 250 | 250 | $tree->setPreference('MAJ_AT_'.$this->getName().'_ENABLED', $tree_enabled); |
| 251 | 251 | } |
| 252 | 252 | } |