diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-05-30 19:13:51 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-05-30 23:29:57 +0100 |
| commit | cbc1590a8c715aa2d88bd745610b899587bd9563 (patch) | |
| tree | 8411c52737b981c7eff37ffcdd083902cb769141 /app/Controller | |
| parent | ffd703ea1e658c7dcb5e5f1f9ef137a420f2d167 (diff) | |
| download | webtrees-cbc1590a8c715aa2d88bd745610b899587bd9563.tar.gz webtrees-cbc1590a8c715aa2d88bd745610b899587bd9563.tar.bz2 webtrees-cbc1590a8c715aa2d88bd745610b899587bd9563.zip | |
Code style
Diffstat (limited to 'app/Controller')
23 files changed, 199 insertions, 209 deletions
diff --git a/app/Controller/AdvancedSearchController.php b/app/Controller/AdvancedSearchController.php index 059a3fa7cd..351631f199 100644 --- a/app/Controller/AdvancedSearchController.php +++ b/app/Controller/AdvancedSearchController.php @@ -20,10 +20,10 @@ namespace Fisharebest\Webtrees; * Class AdvancedSearchController - Controller for the advanced search page */ class AdvancedSearchController extends SearchController { - public $fields = array(); - public $values = array(); + public $fields = array(); + public $values = array(); public $plusminus = array(); - public $errors = array(); + public $errors = array(); /** * Startup activity @@ -136,6 +136,7 @@ class AdvancedSearchController extends SearchController { $fields[$field] = strip_tags(GedcomTag::GetLabel($field)); // Custom tags have error markup } uksort($fields, __NAMESPACE__ . '\AdvancedSearchController::tagSort'); + return $fields; } @@ -150,7 +151,7 @@ class AdvancedSearchController extends SearchController { public static function tagSort($x, $y) { list($x1) = explode(':', $x . ':'); list($y1) = explode(':', $y . ':'); - $tmp = I18N::strcasecmp(GedcomTag::getLabel($x1), GedcomTag::getLabel($y1)); + $tmp = I18N::strcasecmp(GedcomTag::getLabel($x1), GedcomTag::getLabel($y1)); if ($tmp) { return $tmp; } else { @@ -159,7 +160,7 @@ class AdvancedSearchController extends SearchController { } /** - * @param integer $i + * @param int $i * * @return string */ @@ -168,11 +169,12 @@ class AdvancedSearchController extends SearchController { if (isset($this->values[$i])) { $val = $this->values[$i]; } + return $val; } /** - * @param integer $i + * @param int $i * * @return string */ @@ -188,7 +190,7 @@ class AdvancedSearchController extends SearchController { /** * @param string $field * - * @return integer + * @return int */ public function getIndex($field) { return array_search($field, $this->fields); @@ -207,12 +209,12 @@ class AdvancedSearchController extends SearchController { * Set the field order */ private function reorderFields() { - $i = 0; + $i = 0; $newfields = array(); $newvalues = array(); - $newplus = array(); - $rels = array(); - foreach ($this->fields as $j=>$field) { + $newplus = array(); + $rels = array(); + foreach ($this->fields as $j => $field) { if (strpos($this->fields[$j], "FAMC:HUSB:NAME") === 0 || strpos($this->fields[$j], "FAMC:WIFE:NAME") === 0) { $rels[$this->fields[$j]] = $this->values[$j]; continue; @@ -226,10 +228,10 @@ class AdvancedSearchController extends SearchController { } $i++; } - $this->fields = $newfields; - $this->values = $newvalues; + $this->fields = $newfields; + $this->values = $newvalues; $this->plusminus = $newplus; - foreach ($rels as $field=>$value) { + foreach ($rels as $field => $value) { $this->fields[] = $field; $this->values[] = $value; } @@ -237,14 +239,12 @@ class AdvancedSearchController extends SearchController { /** * Perform the search - * - * @return void */ private function advancedSearch() { global $WT_TREE; $this->myindilist = array(); - $fct = count($this->fields); + $fct = count($this->fields); if (!array_filter($this->values)) { return; } @@ -262,7 +262,7 @@ class AdvancedSearchController extends SearchController { $fam_date = false; $indi_plac = false; $fam_plac = false; - foreach ($this->fields as $n=>$field) { + foreach ($this->fields as $n => $field) { if ($this->values[$n]) { if (substr($field, 0, 14) == 'FAMC:HUSB:NAME') { $father_name = true; @@ -272,14 +272,14 @@ class AdvancedSearchController extends SearchController { $indi_name = true; } elseif (strpos($field, ':DATE') !== false) { if (substr($field, 0, 4) == 'FAMS') { - $fam_date = true; + $fam_date = true; $spouse_family = true; } else { $indi_date = true; } } elseif (strpos($field, ':PLAC') !== false) { if (substr($field, 0, 4) == 'FAMS') { - $fam_plac = true; + $fam_plac = true; $spouse_family = true; } else { $indi_plac = true; @@ -375,7 +375,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::russell($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "i_n.n_soundex_givn_std LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -391,7 +391,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::daitchMokotoff($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "i_n.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -422,7 +422,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::russell($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "i_n.n_soundex_surn_std LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -438,7 +438,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::daitchMokotoff($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "i_n.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -524,7 +524,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::russell($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "{$table}.n_soundex_givn_std LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -540,7 +540,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::daitchMokotoff($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "{$table}.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -571,7 +571,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::russell($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "{$table}.n_soundex_surn_std LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -587,7 +587,7 @@ class AdvancedSearchController extends SearchController { $sdx = Soundex::daitchMokotoff($value); if ($sdx) { $sdx = explode(':', $sdx); - foreach ($sdx as $k=>$v) { + foreach ($sdx as $k => $v) { $sdx[$k] = "{$table}.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')"; $bind[] = $v; } @@ -617,7 +617,7 @@ class AdvancedSearchController extends SearchController { foreach ($rows as $row) { $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); // Check for XXXX:PLAC fields, which were only partially matched by SQL - foreach ($this->fields as $n=>$field) { + foreach ($this->fields as $n => $field) { if ($this->values[$n] && preg_match('/^(' . WT_REGEX_TAG . '):PLAC$/', $field, $match)) { if (!preg_match('/\n1 ' . $match[1] . '(\n[2-9].*)*\n2 PLAC .*' . preg_quote($this->values[$n], '/') . '/i', $person->getGedcom())) { continue 2; diff --git a/app/Controller/AjaxController.php b/app/Controller/AjaxController.php index b8f436bdf8..2f9475d15b 100644 --- a/app/Controller/AjaxController.php +++ b/app/Controller/AjaxController.php @@ -20,7 +20,6 @@ namespace Fisharebest\Webtrees; * Class AjaxController - Base controller for all popup pages */ class AjaxController extends BaseController { - /** * @return $this */ @@ -34,7 +33,6 @@ class AjaxController extends BaseController { } /** - * @return void */ public function pageFooter() { // Ajax responses may have Javascript @@ -44,7 +42,7 @@ class AjaxController extends BaseController { /** * Restrict access. * - * @param boolean $condition + * @param bool $condition * * @return $this */ diff --git a/app/Controller/AncestryController.php b/app/Controller/AncestryController.php index 9a260827fe..2de95d9702 100644 --- a/app/Controller/AncestryController.php +++ b/app/Controller/AncestryController.php @@ -20,14 +20,13 @@ namespace Fisharebest\Webtrees; * Class AncestryController - Controller for the ancestry chart */ class AncestryController extends ChartController { - - /** @var integer Show boxes for cousins */ + /** @var int Show boxes for cousins */ public $show_cousins; - /** @var integer Determines style of chart */ + /** @var int Determines style of chart */ public $chart_style; - /** @var integer Number of generations to display */ + /** @var int Number of generations to display */ public $generations; /** @@ -57,8 +56,8 @@ class AncestryController extends ChartController { * print a child ascendancy * * @param Individual $individual - * @param integer $sosa child sosa number - * @param integer $depth the ascendancy depth to show + * @param int $sosa child sosa number + * @param int $depth the ascendancy depth to show */ public function printChildAscendancy(Individual $individual, $sosa, $depth) { echo '<li>'; diff --git a/app/Controller/BaseController.php b/app/Controller/BaseController.php index 1474739107..7d1497b35d 100644 --- a/app/Controller/BaseController.php +++ b/app/Controller/BaseController.php @@ -21,9 +21,9 @@ namespace Fisharebest\Webtrees; */ class BaseController { // The controller accumulates Javascript (inline and external), and renders it in the footer - const JS_PRIORITY_HIGH = 0; - const JS_PRIORITY_NORMAL = 1; - const JS_PRIORITY_LOW = 2; + const JS_PRIORITY_HIGH = 0; + const JS_PRIORITY_NORMAL = 1; + const JS_PRIORITY_LOW = 2; private $inline_javascript = array( self::JS_PRIORITY_HIGH => array(), self::JS_PRIORITY_NORMAL => array(), @@ -67,13 +67,13 @@ class BaseController { * NOTE: there is no need to use "jQuery(document).ready(function(){...})", etc. * as this Javascript won’t be inserted until the very end of the page. * - * @param string $script - * @param integer $priority + * @param string $script + * @param int $priority * * @return $this */ public function addInlineJavascript($script, $priority = self::JS_PRIORITY_NORMAL) { - $tmp = & $this->inline_javascript[$priority]; + $tmp = &$this->inline_javascript[$priority]; $tmp[] = $script; return $this; @@ -136,8 +136,6 @@ class BaseController { /** * Print the page footer, using the theme - * - * @return void */ public function pageFooter() { if (WT_DEBUG_SQL) { diff --git a/app/Controller/BranchesController.php b/app/Controller/BranchesController.php index ea72eb185b..f29e28d72f 100644 --- a/app/Controller/BranchesController.php +++ b/app/Controller/BranchesController.php @@ -23,10 +23,10 @@ class BranchesController extends PageController { /** @var string Generate the branches for this surname */ private $surname; - /** @var boolean Whether to use Standard phonetic matching */ + /** @var bool Whether to use Standard phonetic matching */ private $soundex_std; - /** @var boolean Whether to use Daitch-Mokotov phonetic matching */ + /** @var bool Whether to use Daitch-Mokotov phonetic matching */ private $soundex_dm; /** @var Individual[] Everyone with the selected surname */ @@ -72,7 +72,7 @@ class BranchesController extends PageController { /** * Should we use Standard phonetic matching * - * @return boolean + * @return bool */ public function getSoundexStd() { return $this->soundex_std; @@ -81,7 +81,7 @@ class BranchesController extends PageController { /** * Should we use Daitch-Mokotov phonetic matching * - * @return boolean + * @return bool */ public function getSoundexDm() { return $this->soundex_dm; @@ -133,7 +133,7 @@ class BranchesController extends PageController { * Load the ancestors of an individual, so we can highlight them in the list * * @param Individual $ancestor - * @param integer $sosa + * @param int $sosa */ private function loadAncestors(Individual $ancestor, $sosa) { if ($ancestor) { @@ -271,7 +271,7 @@ class BranchesController extends PageController { /** * Convert a SOSA number into a generation number. e.g. 8 = great-grandfather = 3 generations * - * @param integer $sosa + * @param int $sosa * * @return string */ diff --git a/app/Controller/ChartController.php b/app/Controller/ChartController.php index 028d95dffd..c645c01b03 100644 --- a/app/Controller/ChartController.php +++ b/app/Controller/ChartController.php @@ -23,7 +23,7 @@ class ChartController extends PageController { /** @var Individual Who is chart about? */ public $root; - /** @var boolean determines the detail shown in the personbox */ + /** @var bool determines the detail shown in the personbox */ private $show_full; /** @var string An error message, in case we cannot construct the chart */ @@ -41,7 +41,7 @@ class ChartController extends PageController { parent::__construct(); - $rootid = Filter::get('rootid', WT_REGEX_XREF); + $rootid = Filter::get('rootid', WT_REGEX_XREF); $this->root = Individual::getInstance($rootid, $WT_TREE); if (!$this->root) { // Missing root individual? Show the chart for someone. @@ -83,22 +83,22 @@ class ChartController extends PageController { /** * Find the direct-line ancestors of an individual. Array indexes are SOSA numbers. * - * @param integer $generations + * @param int $generations * * @return Individual[] */ public function sosaAncestors($generations) { $ancestors = array( - 1 => $this->root + 1 => $this->root, ); // Subtract one generation, as this algorithm includes parents. $max = pow(2, $generations - 1); for ($i = 1; $i < $max; $i++) { - $ancestors[$i * 2] = null; + $ancestors[$i * 2] = null; $ancestors[$i * 2 + 1] = null; - $person = $ancestors[$i]; + $person = $ancestors[$i]; if ($person) { $family = $person->getPrimaryChildFamily(); if ($family) { @@ -117,6 +117,7 @@ class ChartController extends PageController { /** * Function showFull + * * @return bool */ public function showFull() { @@ -125,6 +126,7 @@ class ChartController extends PageController { /** * Function boxDimensions + * * @return \stdClass */ public function getBoxDimensions() { diff --git a/app/Controller/CompactController.php b/app/Controller/CompactController.php index a27a38991b..19713bb725 100644 --- a/app/Controller/CompactController.php +++ b/app/Controller/CompactController.php @@ -47,7 +47,7 @@ class CompactController extends ChartController { } /** - * @param integer $n + * @param int $n * * @return string */ @@ -55,7 +55,7 @@ class CompactController extends ChartController { $indi = $this->treeid[$n]; if ($indi && $indi->canShowName()) { - $name = $indi->getFullName(); + $name = $indi->getFullName(); $addname = $indi->getAddName(); if ($this->show_thumbs && $indi->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { @@ -98,8 +98,8 @@ class CompactController extends ChartController { } /** - * @param integer $n - * @param string $arrow_dir + * @param int $n + * @param string $arrow_dir * * @return string */ @@ -117,7 +117,7 @@ class CompactController extends ChartController { if ($indi) { $title = I18N::translate('Compact tree of %s', $indi->getFullName()); - $text = '<a class="icon-' . $arrow_dir . 'arrow" title="' . strip_tags($title) . '" href="?rootid=' . $indi->getXref(); + $text = '<a class="icon-' . $arrow_dir . 'arrow" title="' . strip_tags($title) . '" href="?rootid=' . $indi->getXref(); if ($this->show_thumbs) { $text .= "&show_thumbs=" . $this->show_thumbs; } diff --git a/app/Controller/DescendancyController.php b/app/Controller/DescendancyController.php index 4a634d8892..94065084d3 100644 --- a/app/Controller/DescendancyController.php +++ b/app/Controller/DescendancyController.php @@ -22,14 +22,13 @@ use Rhumsaa\Uuid\Uuid; * Class DescendancyController - Controller for the descendancy chart */ class DescendancyController extends ChartController { - - /** @var integer Show boxes for cousins */ + /** @var int Show boxes for cousins */ public $show_cousins; - /** @var integer Determines style of chart */ + /** @var int Determines style of chart */ public $chart_style; - /** @var integer Number of generations to display */ + /** @var int Number of generations to display */ public $generations; // d'Aboville numbering system [ http://www.saintclair.org/numbers/numdob.html ] @@ -62,11 +61,9 @@ class DescendancyController extends ChartController { * Print a child family * * @param Individual $person - * @param integer $depth the descendancy depth to show + * @param int $depth the descendancy depth to show * @param string $label * @param string $gpid - * - * @return void */ public function printChildFamily(Individual $person, $depth, $label = '1.', $gpid = '') { @@ -86,9 +83,7 @@ class DescendancyController extends ChartController { * print a child descendancy * * @param Individual $person - * @param integer $depth the descendancy depth to show - * - * @return void + * @param int $depth the descendancy depth to show */ public function printChildDescendancy(Individual $person, $depth) { echo "<li>"; @@ -124,7 +119,7 @@ class DescendancyController extends ChartController { } $this->dabo_num[$level]++; $this->dabo_num[$level + 1] = 0; - $this->dabo_sex[$level] = $person->getSex(); + $this->dabo_sex[$level] = $person->getSex(); for ($i = 0; $i <= $level; $i++) { $isf = $this->dabo_sex[$i]; if ($isf === 'M') { @@ -154,9 +149,7 @@ class DescendancyController extends ChartController { * * @param Individual $person * @param Family $family - * @param integer $depth the descendancy depth to show - * - * @return void + * @param int $depth the descendancy depth to show */ private function printFamilyDescendancy(Individual $person, Family $family, $depth) { $uid = Uuid::uuid4(); // create a unique ID @@ -226,7 +219,7 @@ class DescendancyController extends ChartController { * Find all the individuals that are descended from an individual. * * @param Individual $person - * @param integer $n + * @param int $n * @param Individual[] $array * * @return Individual[] @@ -245,6 +238,7 @@ class DescendancyController extends ChartController { $array = $this->individualDescendancy($child, $n - 1, $array); } } + return $array; } @@ -252,7 +246,7 @@ class DescendancyController extends ChartController { * Find all the families that are descended from an individual. * * @param Individual $person - * @param integer $n + * @param int $n * @param Family[] $array * * @return Family[] @@ -267,6 +261,7 @@ class DescendancyController extends ChartController { $array = $this->familyDescendancy($child, $n - 1, $array); } } + return $array; } } diff --git a/app/Controller/FamilyBookController.php b/app/Controller/FamilyBookController.php index 5b59cafbf9..24e0a8f45b 100644 --- a/app/Controller/FamilyBookController.php +++ b/app/Controller/FamilyBookController.php @@ -20,19 +20,19 @@ namespace Fisharebest\Webtrees; * Class FamilyBookController - Controller for the familybook chart */ class FamilyBookController extends ChartController { - /** @var integer Whether to show spouse details */ + /** @var int Whether to show spouse details */ public $show_spouse; - /** @var integer Number of descendancy generations to show */ + /** @var int Number of descendancy generations to show */ public $descent; - /** @var integer Number of ascendancy generations to show */ + /** @var int Number of ascendancy generations to show */ public $generations; - /** @var integer Number of descendancy generations that exist */ + /** @var int Number of descendancy generations that exist */ private $dgenerations; - /** @var integer Half height of personbox */ + /** @var int Half height of personbox */ public $bhalfheight; /** @@ -69,9 +69,9 @@ class FamilyBookController extends ChartController { * Prints descendency of passed in person * * @param Individual|null $person - * @param integer $generation + * @param int $generation * - * @return integer + * @return int */ private function printDescendency(Individual $person = null, $generation) { @@ -178,7 +178,7 @@ class FamilyBookController extends ChartController { * Prints pedigree of the person passed in * * @param Individual $person - * @param integer $count + * @param int $count */ private function printPersonPedigree($person, $count) { if ($count >= $this->generations) { @@ -306,10 +306,10 @@ class FamilyBookController extends ChartController { /** * Calculates number of generations a person has * - * @param string $pid - * @param integer $depth + * @param string $pid + * @param int $depth * - * @return integer + * @return int */ private function maxDescendencyGenerations($pid, $depth) { global $WT_TREE; @@ -343,8 +343,6 @@ class FamilyBookController extends ChartController { /** * Print empty box - * - * @return void */ private function printEmptyBox() { @@ -355,7 +353,7 @@ class FamilyBookController extends ChartController { * Print a “Family Book” for an individual * * @param Individual $person - * @param integer $descent_steps + * @param int $descent_steps */ public function printFamilyBook(Individual $person, $descent_steps) { if ($descent_steps == 0 || !$person->canShowName()) { diff --git a/app/Controller/FamilyController.php b/app/Controller/FamilyController.php index f5c4ea51ac..fc7c424b8f 100644 --- a/app/Controller/FamilyController.php +++ b/app/Controller/FamilyController.php @@ -47,6 +47,7 @@ class FamilyController extends GedcomRecordController { return $individual; } } + return parent::getSignificantIndividual(); } @@ -60,6 +61,7 @@ class FamilyController extends GedcomRecordController { if ($this->record) { return $this->record; } + return parent::getSignificantFamily(); } @@ -73,6 +75,7 @@ class FamilyController extends GedcomRecordController { foreach ($matches[1] as &$match) { $match = 'pids%5B%5D=' . $match; } + return implode('&', $matches[1]); } @@ -150,6 +153,7 @@ class FamilyController extends GedcomRecordController { public function getSignificantSurname() { if ($this->record && $this->record->getHusband()) { list($surn) = explode(',', $this->record->getHusband()->getSortname()); + return $surn; } else { return ''; diff --git a/app/Controller/FanchartController.php b/app/Controller/FanchartController.php index 62bca2d628..05ca297ec4 100644 --- a/app/Controller/FanchartController.php +++ b/app/Controller/FanchartController.php @@ -20,13 +20,13 @@ namespace Fisharebest\Webtrees; * Class FanchartController Controller for the fan chart */ class FanchartController extends ChartController { - /** @var integer Style of fanchart */ + /** @var int Style of fanchart */ public $fan_style; - /** @var integer Width of fanchart (a percentage) */ + /** @var int Width of fanchart (a percentage) */ public $fan_width; - /** @var integer Number of generations to display */ + /** @var int Number of generations to display */ public $generations; /** @@ -70,8 +70,8 @@ class FanchartController extends ChartController { /** * split and center text by lines * - * @param string $data input string - * @param integer $maxlen max length of each line + * @param string $data input string + * @param int $maxlen max length of each line * * @return string $text output string */ @@ -85,12 +85,13 @@ class FanchartController extends ChartController { foreach ($lines as $line) { $text .= $this->splitAlignText($line, $maxlen) . "\n"; } + return $text; } // process current line word by word $split = explode(' ', $data); - $text = ''; - $line = ''; + $text = ''; + $line = ''; // do not split hebrew line $found = false; @@ -103,7 +104,7 @@ class FanchartController extends ChartController { $line = $data; } else { foreach ($split as $word) { - $len = strlen($line); + $len = strlen($line); $wlen = strlen($word); if (($len + $wlen) < $maxlen) { if (!empty($line)) { @@ -126,7 +127,7 @@ class FanchartController extends ChartController { if (in_array(ord($line{0}), $RTLOrd)) { $len /= 2; } - $p = max(0, (int) (($maxlen - $len) / 2)); + $p = max(0, (int) (($maxlen - $len) / 2)); $line = str_repeat(' ', $p) . $line; // center alignment using spaces $text .= $line; } @@ -154,7 +155,7 @@ class FanchartController extends ChartController { $treesize = count($treeid) + 1; // generations count - $gen = log($treesize) / log(2) - 1; + $gen = log($treesize) / log(2) - 1; $sosa = $treesize - 1; // fan size @@ -163,11 +164,11 @@ class FanchartController extends ChartController { } $fandeg = min($fandeg, 360); $fandeg = max($fandeg, 90); - $cx = $fanw / 2 - 1; // center x - $cy = $cx; // center y - $rx = $fanw - 1; - $rw = $fanw / ($gen + 1); - $fanh = $fanw; // fan height + $cx = $fanw / 2 - 1; // center x + $cy = $cx; // center y + $rx = $fanw - 1; + $rw = $fanw / ($gen + 1); + $fanh = $fanw; // fan height if ($fandeg == 180) { $fanh = round($fanh * ($gen + 1) / ($gen * 2)); } diff --git a/app/Controller/HourglassController.php b/app/Controller/HourglassController.php index 21ee3ded19..3200f431bc 100644 --- a/app/Controller/HourglassController.php +++ b/app/Controller/HourglassController.php @@ -20,37 +20,36 @@ namespace Fisharebest\Webtrees; * Class HourglassController - Controller for the hourglass chart */ class HourglassController extends ChartController { - - /** @var integer Whether to show spouse details */ + /** @var int Whether to show spouse details */ public $show_spouse; - /** @var integer Number of ascendancy generations to show */ + /** @var int Number of ascendancy generations to show */ public $generations; - /** @var integer Number of descendancy generations that exist */ + /** @var int Number of descendancy generations that exist */ private $dgenerations; - /** @var integer Half height of personbox */ + /** @var int Half height of personbox */ public $bhalfheight; // Left and right get reversed on RTL pages private $left_arrow; private $right_arrow; - /** @var boolean Can the Javascript be loaded by the controller */ + /** @var bool Can the Javascript be loaded by the controller */ private $canLoadJS; - const LINK = "<a class='%s' href='%s' data-parms='%s-%s-%s'></a>"; + const LINK = "<a class='%s' href='%s' data-parms='%s-%s-%s'></a>"; const SWITCH_LINK = "<a href='hourglass.php?rootid=%s&show_spouse=%s&show_full=%s&generations=%s' class='name1'>%s</a>"; /** - * @param string $rootid - * @param integer $show_full - * @param boolean $loadJS + * @param string $rootid + * @param int $show_full + * @param bool $loadJS */ public function __construct($rootid = '', $show_full = 1, $loadJS = true) { global $WT_TREE; - + parent::__construct($show_full); // Extract parameters from @@ -61,10 +60,10 @@ class HourglassController extends ChartController { //-- flip the arrows for RTL languages if (I18N::direction() === 'ltr') { - $this->left_arrow = 'icon-larrow'; + $this->left_arrow = 'icon-larrow'; $this->right_arrow = 'icon-rarrow'; } else { - $this->left_arrow = 'icon-rarrow'; + $this->left_arrow = 'icon-rarrow'; $this->right_arrow = 'icon-larrow'; } @@ -83,7 +82,7 @@ class HourglassController extends ChartController { * Prints pedigree of the person passed in. Which is the descendancy * * @param Individual $person ID of person to print the pedigree for - * @param integer $count generation count, so it recursively calls itself + * @param int $count generation count, so it recursively calls itself */ public function printPersonPedigree(Individual $person, $count) { @@ -181,10 +180,10 @@ class HourglassController extends ChartController { * Prints descendency of passed in person * * @param Individual $person person to print descendency for - * @param integer $count count of generations to print - * @param boolean $showNav + * @param int $count count of generations to print + * @param bool $showNav * - * @return integer + * @return int */ public function printDescendency($person, $count, $showNav = true) { global $lastGenSecondFam; @@ -193,7 +192,7 @@ class HourglassController extends ChartController { return 0; } - $pid = $person->getXref(); + $pid = $person->getXref(); $tablealign = 'right'; $otablealign = 'left'; if (I18N::direction() === 'rtl') { @@ -211,9 +210,9 @@ class HourglassController extends ChartController { echo "<table id='table_$pid' class='hourglassChart' style='float:$tablealign'>"; echo '<tr>'; echo "<td style='text-align:$tablealign'>"; - $numkids = 0; + $numkids = 0; $families = $person->getSpouseFamilies(); - $famNum = 0; + $famNum = 0; $children = array(); if ($count < $this->dgenerations) { // Put all of the children in a common array @@ -229,7 +228,7 @@ class HourglassController extends ChartController { echo "<table style='position: relative; top: auto; float: $tablealign;'>"; for ($i = 0; $i < $ct; $i++) { $person2 = $children[$i]; - $chil = $person2->getXref(); + $chil = $person2->getXref(); echo '<tr>'; echo '<td id="td_', $chil, '" class="', I18N::direction(), '" style="text-align:', $otablealign, '">'; $kids = $this->printDescendency($person2, $count + 1); @@ -294,7 +293,7 @@ class HourglassController extends ChartController { $this->getBoxDimensions()->width -= 10; $this->getBoxDimensions()->height -= 10; print_pedigree_person($family->getSpouse($person), $this->showFull()); - $this->getBoxDimensions()->width = $tempw; + $this->getBoxDimensions()->width = $tempw; $this->getBoxDimensions()->height = $temph; $numkids += 0.95; echo "</td><td></td>"; @@ -314,7 +313,7 @@ class HourglassController extends ChartController { $famids = $person->getSpouseFamilies(); //-- make sure there is more than 1 child in the family with parents $cfamids = $person->getChildFamilies(); - $num = 0; + $num = 0; foreach ($cfamids as $family) { $num += $family->getNumberOfChildren(); } @@ -377,10 +376,10 @@ class HourglassController extends ChartController { /** * Calculates number of generations a person has * - * @param Individual $individual Individual to see how far down the descendency goes - * @param integer $depth Pass in 0 and it calculates how far down descendency goes + * @param Individual $individual Start individual + * @param int $depth Pass in 0 and it calculates how far down descendency goes * - * @return integer Number of generations the descendency actually goes + * @return int Number of generations the descendency actually goes */ private function maxDescendencyGenerations(Individual $individual, $depth) { if ($depth > $this->generations) { @@ -409,7 +408,6 @@ class HourglassController extends ChartController { /** * setup all of the javascript that is needed for the hourglass chart - * */ public function setupJavascript() { $js = " diff --git a/app/Controller/IndividualController.php b/app/Controller/IndividualController.php index 99c3bda206..0d8752d7ca 100644 --- a/app/Controller/IndividualController.php +++ b/app/Controller/IndividualController.php @@ -20,7 +20,7 @@ namespace Fisharebest\Webtrees; * Class IndividualController - Controller for the individual page */ class IndividualController extends GedcomRecordController { - public $name_count = 0; + public $name_count = 0; public $total_names = 0; public $tabs; @@ -41,7 +41,6 @@ class IndividualController extends GedcomRecordController { parent::__construct(); - // If we can display the details, add them to the page header if ($this->record && $this->record->canShow()) { $this->setPageTitle($this->record->getFullName() . ' ' . $this->record->getLifespan()); @@ -59,6 +58,7 @@ class IndividualController extends GedcomRecordController { if ($this->record) { return $this->record; } + return parent::getSignificantIndividual(); } @@ -77,6 +77,7 @@ class IndividualController extends GedcomRecordController { return $family; } } + return parent::getSignificantFamily(); } @@ -126,7 +127,7 @@ class IndividualController extends GedcomRecordController { null, $event->getParent()->getTree() ); - $all_names = $dummy->getAllNames(); + $all_names = $dummy->getAllNames(); $primary_name = $all_names[0]; $this->name_count++; @@ -278,7 +279,7 @@ class IndividualController extends GedcomRecordController { $menu->addSubmenu($submenu); $has_sex_record = false; - $submenu = new Menu(I18N::translate('Edit gender'), '#', 'menu-indi-editsex'); + $submenu = new Menu(I18N::translate('Edit gender'), '#', 'menu-indi-editsex'); foreach ($this->record->getFacts() as $fact) { if ($fact->getTag() == 'SEX' && $fact->canEdit()) { $submenu->setOnclick("return edit_record('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');"); @@ -350,6 +351,7 @@ class IndividualController extends GedcomRecordController { } elseif ($person->isPendingAddtion()) { $class .= ' new'; } + return $class; } @@ -362,6 +364,7 @@ class IndividualController extends GedcomRecordController { public function getSignificantSurname() { if ($this->record) { list($surn) = explode(',', $this->record->getSortname()); + return $surn; } else { return ''; @@ -376,9 +379,9 @@ class IndividualController extends GedcomRecordController { public function getSideBarContent() { global $controller; - $html = ''; + $html = ''; $active = 0; - $n = 0; + $n = 0; foreach (Module::getActiveSidebars($this->record->getTree()) as $mod) { if ($mod->hasSidebarContent()) { $html .= '<h3 id="' . $mod->getName() . '"><a href="#">' . $mod->getTitle() . '</a></h3>'; diff --git a/app/Controller/LifespanController.php b/app/Controller/LifespanController.php index afca613a07..7d94240bb5 100644 --- a/app/Controller/LifespanController.php +++ b/app/Controller/LifespanController.php @@ -22,19 +22,19 @@ use Fisharebest\ExtCalendar\GregorianCalendar; * Class LifespanController - Controller for the timeline chart */ class LifespanController extends PageController { - private $pids = array(); - public $people = array(); - public $place = ''; + private $pids = array(); + public $people = array(); + public $place = ''; public $beginYear = 0; - public $endYear = 0; - public $YrowLoc = 125; + public $endYear = 0; + public $YrowLoc = 125; // The following colours are deliberately omitted from the $colors list: // Blue, Red, Black, White, Green - private $colors = array('Aliceblue', 'Antiquewhite', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque', 'Blanchedalmond', 'Blueviolet', 'Brown', 'Burlywood', 'Cadetblue', 'Chartreuse', 'Chocolate', 'Coral', 'Cornflowerblue', 'Cornsilk', 'Crimson', 'Cyan', 'Darkcyan', 'Darkgoldenrod', 'Darkgray', 'Darkgreen', 'Darkkhaki', 'Darkmagenta', 'Darkolivegreen', 'Darkorange', 'Darkorchid', 'Darkred', 'Darksalmon', 'Darkseagreen', 'Darkslateblue', 'Darkturquoise', 'Darkviolet', 'Deeppink', 'Deepskyblue', 'Dimgray', 'Dodgerblue', 'Firebrick', 'Floralwhite', 'Forestgreen', 'Fuchsia', 'Gainsboro', 'Ghostwhite', 'Gold', 'Goldenrod', 'Gray', 'Greenyellow', 'Honeydew', 'Hotpink', 'Indianred', 'Ivory', 'Khaki', 'Lavender', 'Lavenderblush', 'Lawngreen', 'Lemonchiffon', 'Lightblue', 'Lightcoral', 'Lightcyan', 'Lightgoldenrodyellow', 'Lightgreen', 'Lightgrey', 'Lightpink', 'Lightsalmon', 'Lightseagreen', 'Lightskyblue', 'Lightslategray', 'Lightsteelblue', 'Lightyellow', 'Lime', 'Limegreen', 'Linen', 'Magenta', 'Maroon', 'Mediumaqamarine', ' Mediumblue', 'Mediumorchid', 'Mediumpurple', 'Mediumseagreen', 'Mediumslateblue', 'Mediumspringgreen', 'Mediumturquoise', 'Mediumvioletred', 'Mintcream', 'Mistyrose', 'Moccasin', 'Navajowhite', 'Oldlace', 'Olive', 'Olivedrab', 'Orange', 'Orangered', 'Orchid', 'Palegoldenrod', 'Palegreen', 'Paleturquoise', 'Palevioletred', 'Papayawhip', 'Peachpuff', 'Peru', 'Pink', 'Plum', 'Powderblue', 'Purple', 'Rosybrown', 'Royalblue', 'Saddlebrown', 'Salmon', 'Sandybrown', 'Seagreen', 'Seashell', 'Sienna', 'Silver', 'Skyblue', 'Slateblue', 'Slategray', 'Snow', 'Springgreen', 'Steelblue', 'Tan', 'Teal', 'Thistle', 'Tomato', 'Turquoise', 'Violet', 'Wheat', 'Whitesmoke', 'Yellow', 'YellowGreen'); - private $malecolorR = array(' 100', ' 110', ' 120', ' 130', ' 140', ' 150', ' 160', ' 170', ' 180', ' 190', ' 200', ' 210', ' 220', ' 230', ' 240', ' 250'); - private $malecolorG = array(' 100', ' 110', ' 120', ' 130', ' 140', ' 150', ' 160', ' 170', ' 180', ' 190', ' 200', ' 210', ' 220', ' 230', ' 240', ' 250'); - private $malecolorB = 255; + private $colors = array('Aliceblue', 'Antiquewhite', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque', 'Blanchedalmond', 'Blueviolet', 'Brown', 'Burlywood', 'Cadetblue', 'Chartreuse', 'Chocolate', 'Coral', 'Cornflowerblue', 'Cornsilk', 'Crimson', 'Cyan', 'Darkcyan', 'Darkgoldenrod', 'Darkgray', 'Darkgreen', 'Darkkhaki', 'Darkmagenta', 'Darkolivegreen', 'Darkorange', 'Darkorchid', 'Darkred', 'Darksalmon', 'Darkseagreen', 'Darkslateblue', 'Darkturquoise', 'Darkviolet', 'Deeppink', 'Deepskyblue', 'Dimgray', 'Dodgerblue', 'Firebrick', 'Floralwhite', 'Forestgreen', 'Fuchsia', 'Gainsboro', 'Ghostwhite', 'Gold', 'Goldenrod', 'Gray', 'Greenyellow', 'Honeydew', 'Hotpink', 'Indianred', 'Ivory', 'Khaki', 'Lavender', 'Lavenderblush', 'Lawngreen', 'Lemonchiffon', 'Lightblue', 'Lightcoral', 'Lightcyan', 'Lightgoldenrodyellow', 'Lightgreen', 'Lightgrey', 'Lightpink', 'Lightsalmon', 'Lightseagreen', 'Lightskyblue', 'Lightslategray', 'Lightsteelblue', 'Lightyellow', 'Lime', 'Limegreen', 'Linen', 'Magenta', 'Maroon', 'Mediumaqamarine', ' Mediumblue', 'Mediumorchid', 'Mediumpurple', 'Mediumseagreen', 'Mediumslateblue', 'Mediumspringgreen', 'Mediumturquoise', 'Mediumvioletred', 'Mintcream', 'Mistyrose', 'Moccasin', 'Navajowhite', 'Oldlace', 'Olive', 'Olivedrab', 'Orange', 'Orangered', 'Orchid', 'Palegoldenrod', 'Palegreen', 'Paleturquoise', 'Palevioletred', 'Papayawhip', 'Peachpuff', 'Peru', 'Pink', 'Plum', 'Powderblue', 'Purple', 'Rosybrown', 'Royalblue', 'Saddlebrown', 'Salmon', 'Sandybrown', 'Seagreen', 'Seashell', 'Sienna', 'Silver', 'Skyblue', 'Slateblue', 'Slategray', 'Snow', 'Springgreen', 'Steelblue', 'Tan', 'Teal', 'Thistle', 'Tomato', 'Turquoise', 'Violet', 'Wheat', 'Whitesmoke', 'Yellow', 'YellowGreen'); + private $malecolorR = array(' 100', ' 110', ' 120', ' 130', ' 140', ' 150', ' 160', ' 170', ' 180', ' 190', ' 200', ' 210', ' 220', ' 230', ' 240', ' 250'); + private $malecolorG = array(' 100', ' 110', ' 120', ' 130', ' 140', ' 150', ' 160', ' 170', ' 180', ' 190', ' 200', ' 210', ' 220', ' 230', ' 240', ' 250'); + private $malecolorB = 255; private $femalecolorR = 255; private $femalecolorG = array(' 100', ' 110', ' 120', ' 130', ' 140', ' 150', ' 160', ' 170', ' 180', ' 190', ' 200', ' 210', ' 220', ' 230', ' 240', ' 250'); private $femalecolorB = array('250', ' 240', ' 230', ' 220', ' 210', ' 200', ' 190', ' 180', ' 170', ' 160', ' 150', ' 140', ' 130', ' 120', ' 110', ' 100'); @@ -54,7 +54,7 @@ class LifespanController extends PageController { private $currentsex; private $nonfacts = array( - 'FAMS', 'FAMC', 'MAY', 'BLOB', 'OBJE', 'SEX', 'NAME', 'SOUR', 'NOTE', 'BAPL', 'ENDL', 'SLGC', 'SLGS', '_TODO', '_WT_OBJE_SORT', 'CHAN', 'HUSB', 'WIFE', 'CHIL', 'BIRT', 'DEAT', 'BURI' + 'FAMS', 'FAMC', 'MAY', 'BLOB', 'OBJE', 'SEX', 'NAME', 'SOUR', 'NOTE', 'BAPL', 'ENDL', 'SLGC', 'SLGS', '_TODO', '_WT_OBJE_SORT', 'CHAN', 'HUSB', 'WIFE', 'CHIL', 'BIRT', 'DEAT', 'BURI', ); /** @@ -194,7 +194,7 @@ class LifespanController extends PageController { * Add a person (and optionally their immediate family members) to the pids array * * @param Individual $person - * @param boolean $add_family + * @param bool $add_family */ private function addFamily(Individual $person, $add_family) { $this->pids[] = $person->getXref(); @@ -224,10 +224,10 @@ class LifespanController extends PageController { /** * Sets the start year and end year to a factor of 5 * - * @param integer $year - * @param integer $key + * @param int $year + * @param int $key * - * @return integer + * @return int */ private function modifyYear($year, $key) { $temp = $year; @@ -259,8 +259,8 @@ class LifespanController extends PageController { /** * Prints the time line * - * @param integer $startYear - * @param integer $endYear + * @param int $startYear + * @param int $endYear */ public function printTimeline($startYear, $endYear) { $leftPosition = 14; //start point @@ -285,9 +285,9 @@ class LifespanController extends PageController { * Method used to place the person boxes onto the timeline * * @param Individual[] $ar - * @param integer $top + * @param int $top * - * @return integer + * @return int */ public function fillTimeline($ar, $top) { global $maxX, $zindex; @@ -553,8 +553,8 @@ class LifespanController extends PageController { /** * Search for people who had events in a given year range * - * @param integer $startyear - * @param integer $endyear + * @param int $startyear + * @param int $endyear * * @return Individual[] */ diff --git a/app/Controller/MediaController.php b/app/Controller/MediaController.php index 22ab213b70..291e0bf683 100644 --- a/app/Controller/MediaController.php +++ b/app/Controller/MediaController.php @@ -26,7 +26,7 @@ class MediaController extends GedcomRecordController { public function __construct() { global $WT_TREE; - $xref = Filter::get('mid', WT_REGEX_XREF); + $xref = Filter::get('mid', WT_REGEX_XREF); $this->record = Media::getInstance($xref, $WT_TREE); parent::__construct(); diff --git a/app/Controller/PageController.php b/app/Controller/PageController.php index 5782a1b36d..36e0fd312e 100644 --- a/app/Controller/PageController.php +++ b/app/Controller/PageController.php @@ -29,7 +29,7 @@ class PageController extends BaseController { /** @var string <head><title> $page_title </title></head> */ private $page_title = WT_WEBTREES; - /** @var boolean Is this a popup window? */ + /** @var bool Is this a popup window? */ private $popup; /** @@ -101,7 +101,7 @@ class PageController extends BaseController { /** * Restrict access * - * @param boolean $condition + * @param bool $condition * * @return $this */ @@ -116,8 +116,6 @@ class PageController extends BaseController { /** * Print the page footer, using the theme - * - * @return void */ public function pageFooter() { echo @@ -140,8 +138,6 @@ class PageController extends BaseController { /** * Print the page footer, using the theme * Note that popup windows are deprecated - * - * @return void */ public function pageFooterPopupWindow() { echo @@ -164,7 +160,7 @@ class PageController extends BaseController { /** * Print the page header, using the theme * - * @param boolean $popup Is this a popup window + * @param bool $popup Is this a popup window * * @return $this */ diff --git a/app/Controller/PedigreeController.php b/app/Controller/PedigreeController.php index 6a0a5a5808..1c7d1a342a 100644 --- a/app/Controller/PedigreeController.php +++ b/app/Controller/PedigreeController.php @@ -20,7 +20,6 @@ namespace Fisharebest\Webtrees; * Class PedigreeController - Controller for the pedigree chart */ class PedigreeController extends ChartController { - /** * Chart orientation codes * Dont change them! the offset calculations rely on this order @@ -29,23 +28,23 @@ class PedigreeController extends ChartController { const LANDSCAPE = 1; const OLDEST_AT_TOP = 2; const OLDEST_AT_BOTTOM = 3; - const MENU_ITEM = '<a href="pedigree.php?rootid=%s&show_full=%s&PEDIGREE_GENERATIONS=%s&orientation=%s" class="%s noprint">%s</a>'; + const MENU_ITEM = '<a href="pedigree.php?rootid=%s&show_full=%s&PEDIGREE_GENERATIONS=%s&orientation=%s" class="%s noprint">%s</a>'; /** * Next and previous generation arrow size */ const ARROW_SIZE = 22; //pixels - /** @var integer Selected chart layout */ + /** @var int Selected chart layout */ public $orientation; - /** @var integer Number of generation to display */ + /** @var int Number of generation to display */ public $generations; /** @var array data pertaining to each chart node */ public $nodes = array(); - /** @var integer Number of nodes in the chart */ + /** @var int Number of nodes in the chart */ public $treesize; /** @var bool Are there ancestors beyond the bounds of this chart */ @@ -105,20 +104,20 @@ class PedigreeController extends ChartController { case self::LANDSCAPE: $this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow'; $this->arrows->menu = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow'; - $addoffset['x'] = $this->chartHasAncestors ? self::ARROW_SIZE : 0; - $addoffset['y'] = 0; + $addoffset['x'] = $this->chartHasAncestors ? self::ARROW_SIZE : 0; + $addoffset['y'] = 0; break; case self::OLDEST_AT_TOP: $this->arrows->prevGen = 'icon-uarrow'; $this->arrows->menu = 'icon-darrow'; - $addoffset['x'] = 0; - $addoffset['y'] = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0; + $addoffset['x'] = 0; + $addoffset['y'] = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0; break; case self::OLDEST_AT_BOTTOM: $this->arrows->prevGen = 'icon-darrow'; $this->arrows->menu = 'icon-uarrow'; - $addoffset['x'] = 0; - $addoffset['y'] = $this->chartHasAncestors ? self::ARROW_SIZE : 0; + $addoffset['x'] = 0; + $addoffset['y'] = $this->chartHasAncestors ? self::ARROW_SIZE : 0; break; } @@ -137,10 +136,10 @@ class PedigreeController extends ChartController { $boxpos = $i - pow(2, $this->generations - $curgen); // -- offset multiple for current generation if ($this->orientation < self::OLDEST_AT_TOP) { - $genoffset = pow(2, $curgen - $this->orientation); + $genoffset = pow(2, $curgen - $this->orientation); $boxspacing = $this->getBoxDimensions()->height + $byspacing; } else { - $genoffset = pow(2, $curgen - 1); + $genoffset = pow(2, $curgen - 1); $boxspacing = $this->getBoxDimensions()->width + $byspacing; } // -- calculate the yoffset position in the generation put child between parents @@ -161,7 +160,7 @@ class PedigreeController extends ChartController { $yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1)); } $parent = (int) (($i - 1) / 2); - $pgen = $curgen; + $pgen = $curgen; while ($parent > 0) { if ($parent % 2 == 0) { $yoffset = $yoffset - (($boxspacing / 2) * $pgen); @@ -243,7 +242,6 @@ class PedigreeController extends ChartController { return $item['y']; }, $this->nodes)); - $this->chartsize['x'] = $max_xoffset + $bxspacing + $this->getBoxDimensions()->width + $addoffset['x']; $this->chartsize['y'] = $max_yoffset + $byspacing + $this->getBoxDimensions()->height + $addoffset['y']; } @@ -257,7 +255,7 @@ class PedigreeController extends ChartController { */ public function get_menu() { $famids = $this->root->getSpouseFamilies(); - $html = ''; + $html = ''; if ($famids) { $html = sprintf('<div id="childarrow"><a href="#" class="menuselect noprint %s"></a><div id="childbox">', $this->arrows->menu); @@ -291,6 +289,7 @@ class PedigreeController extends ChartController { '</div>' . // #childbox '</div>'; // #childarrow } + return $html; } @@ -299,7 +298,8 @@ class PedigreeController extends ChartController { * * Create a link to generate a new chart based on the correct parent of the individual with this index * - * @param integer $index + * @param int $index + * * @return string */ public function gotoPreviousGen($index) { @@ -308,7 +308,7 @@ class PedigreeController extends ChartController { if ($this->nodes[$index]['indi'] && $this->nodes[$index]['indi']->getChildFamilies()) { $html .= '<div class="ancestorarrow">'; $rootParentId = 1; - if ($index > (int)($this->treesize / 2) + (int)($this->treesize / 4)) { + if ($index > (int) ($this->treesize / 2) + (int) ($this->treesize / 4)) { $rootParentId++; } $html .= sprintf(self::MENU_ITEM, $this->nodes[$rootParentId]['indi']->getXref(), $this->showFull(), $this->generations, $this->orientation, $this->arrows->prevGen, ''); @@ -317,6 +317,7 @@ class PedigreeController extends ChartController { $html .= '<div class="spacer"></div>'; } } + return $html; } } diff --git a/app/Controller/RelationshipController.php b/app/Controller/RelationshipController.php index c40d2d345b..0384953e39 100644 --- a/app/Controller/RelationshipController.php +++ b/app/Controller/RelationshipController.php @@ -27,7 +27,7 @@ class RelationshipController extends PageController { * * @param Individual $individual1 * @param Individual $individual2 - * @param boolean $all + * @param bool $all * * @return string[][] */ @@ -35,7 +35,7 @@ class RelationshipController extends PageController { $rows = Database::prepare( "SELECT l_from, l_to FROM `##link` WHERE l_file = :tree_id AND l_type IN ('FAMS', 'FAMC', 'CHIL', 'HUSB', 'WIFE')" )->execute(array( - 'tree_id' => $individual1->getTree()->getTreeId() + 'tree_id' => $individual1->getTree()->getTreeId(), ))->fetchAll(); $graph = array(); @@ -60,7 +60,7 @@ class RelationshipController extends PageController { while (list(, $next) = each($queue)) { // For each family on the path for ($n = count($next['path']) - 2; $n >= 1; $n -= 2) { - $exclude = $next['exclude']; + $exclude = $next['exclude']; $exclude[] = $next['path'][$n]; sort($exclude); $tmp = implode('-', $exclude); diff --git a/app/Controller/RepositoryController.php b/app/Controller/RepositoryController.php index 21ff8c823d..3eb4d924a0 100644 --- a/app/Controller/RepositoryController.php +++ b/app/Controller/RepositoryController.php @@ -44,7 +44,7 @@ class RepositoryController extends GedcomRecordController { $menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo'); if (Auth::isEditor($this->record->getTree())) { - $fact = $this->record->getFirstFact('NAME'); + $fact = $this->record->getFirstFact('NAME'); $submenu = new Menu(I18N::translate('Edit repository'), '#', 'menu-repo-edit'); if ($fact) { // Edit existing name diff --git a/app/Controller/SearchController.php b/app/Controller/SearchController.php index 3c5d84e47a..7daeaa5c32 100644 --- a/app/Controller/SearchController.php +++ b/app/Controller/SearchController.php @@ -74,16 +74,16 @@ class SearchController extends PageController { /** @var string @var string Replace parameter */ public $replace = ''; - /** @var boolean @var string Replace parameter */ + /** @var bool @var string Replace parameter */ public $replaceNames = false; - /** @var boolean @var string Replace parameter */ + /** @var bool @var string Replace parameter */ public $replacePlaces = false; - /** @var boolean @var string Replace parameter */ + /** @var bool @var string Replace parameter */ public $replaceAll = false; - /** @var boolean @var string Replace parameter */ + /** @var bool @var string Replace parameter */ public $replacePlacesWord = false; /** @@ -185,10 +185,10 @@ class SearchController extends PageController { break; case 'replace': $this->search_trees = array($WT_TREE); - $this->srindi = 'checked'; - $this->srfams = 'checked'; - $this->srsour = 'checked'; - $this->srnote = 'checked'; + $this->srindi = 'checked'; + $this->srfams = 'checked'; + $this->srsour = 'checked'; + $this->srnote = 'checked'; if (Filter::post('query')) { $this->searchAndReplace($WT_TREE); header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord); @@ -430,9 +430,6 @@ class SearchController extends PageController { * * The names' Soundex SQL table contains all the soundex values twice * The places table contains only one value - * - * The code should be improved - see RFE - * */ private function soundexSearch() { if (((!empty($this->lastname)) || (!empty($this->firstname)) || (!empty($this->place))) && $this->search_trees) { diff --git a/app/Controller/SimpleController.php b/app/Controller/SimpleController.php index ecbf3d8422..597cbdc7f4 100644 --- a/app/Controller/SimpleController.php +++ b/app/Controller/SimpleController.php @@ -32,7 +32,7 @@ class SimpleController extends PageController { /** * Simple (i.e. popup) windows are deprecated. * - * @param boolean $popup + * @param bool $popup * * @return $this */ @@ -43,7 +43,7 @@ class SimpleController extends PageController { /** * Restrict access * - * @param boolean $condition + * @param bool $condition * * @return $this */ diff --git a/app/Controller/SourceController.php b/app/Controller/SourceController.php index 1c78a02c5a..845f61d5e2 100644 --- a/app/Controller/SourceController.php +++ b/app/Controller/SourceController.php @@ -44,7 +44,7 @@ class SourceController extends GedcomRecordController { $menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour'); if (Auth::isEditor($this->record->getTree())) { - $fact = $this->record->getFirstFact('TITL'); + $fact = $this->record->getFirstFact('TITL'); $submenu = new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit'); if ($fact) { // Edit existing name diff --git a/app/Controller/TimelineController.php b/app/Controller/TimelineController.php index 551f8d93c9..de86a6dd3f 100644 --- a/app/Controller/TimelineController.php +++ b/app/Controller/TimelineController.php @@ -20,7 +20,7 @@ namespace Fisharebest\Webtrees; * Class TimelineController - Controller for the timeline chart */ class TimelineController extends PageController { - /** @var integer Height of the age box */ + /** @var int Height of the age box */ public $bheight = 30; /** @var Fact[] The facts to display on the chart */ @@ -35,10 +35,10 @@ class TimelineController extends PageController { /** @var integer[] Numeric birth days of each individual */ public $birthdays = array(); - /** @var integer Lowest year to display */ + /** @var int Lowest year to display */ public $baseyear = 0; - /** @var integer Highest year to display */ + /** @var int Highest year to display */ public $topyear = 0; /** @var string[] List of individual XREFs to display */ @@ -50,7 +50,7 @@ class TimelineController extends PageController { /** @var string URL-encoded list of XREFs */ public $pidlinks = ''; - /** @var integer Vertical scale */ + /** @var int Vertical scale */ public $scale = 2; // GEDCOM elements that may have DATE data, but should not be displayed |
