diff options
Diffstat (limited to 'app')
158 files changed, 2264 insertions, 2246 deletions
diff --git a/app/Auth.php b/app/Auth.php index 0bda01a7d1..d6aaeecdc7 100644 --- a/app/Auth.php +++ b/app/Auth.php @@ -29,7 +29,7 @@ class Auth { /** * Are we currently logged in? * - * @return boolean + * @return bool */ public static function check() { return self::id() !== null; @@ -40,7 +40,7 @@ class Auth { * * @param User|null $user * - * @return boolean + * @return bool */ public static function isAdmin(User $user = null) { if ($user === null) { @@ -56,7 +56,7 @@ class Auth { * @param Tree $tree * @param User|null $user * - * @return boolean + * @return bool */ public static function isManager(Tree $tree, User $user = null) { if ($user === null) { @@ -72,7 +72,7 @@ class Auth { * @param Tree $tree * @param User|null $user * - * @return boolean + * @return bool */ public static function isModerator(Tree $tree, User $user = null) { if ($user === null) { @@ -88,8 +88,7 @@ class Auth { * @param Tree $tree * @param User|null $user * - * - * @return boolean + * @return bool */ public static function isEditor(Tree $tree, User $user = null) { if ($user === null) { @@ -105,7 +104,7 @@ class Auth { * @param Tree $tree * @param User|null $user * - * @return boolean + * @return bool */ public static function isMember(Tree $tree, User $user = null) { if ($user === null) { @@ -121,7 +120,7 @@ class Auth { * @param Tree $tree * @param User|null $user * - * @return integer + * @return int */ public static function accessLevel(Tree $tree, User $user = null) { if ($user === null) { @@ -140,7 +139,7 @@ class Auth { /** * Is the current visitor a search engine? The global is set in session.php * - * @return boolean + * @return bool */ public static function isSearchEngine() { global $SEARCH_SPIDER; @@ -165,11 +164,11 @@ class Auth { public static function user() { $user = User::find(self::id()); if ($user === null) { - $visitor = new \stdClass; - $visitor->user_id = ''; + $visitor = new \stdClass; + $visitor->user_id = ''; $visitor->user_name = ''; $visitor->real_name = ''; - $visitor->email = ''; + $visitor->email = ''; return new User($visitor); } else { 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 diff --git a/app/Database.php b/app/Database.php index 221af0bbbe..8eaecd13e2 100644 --- a/app/Database.php +++ b/app/Database.php @@ -63,8 +63,6 @@ class Database { /** * Disconnect from the server, so we can connect to another one - * - * @return void */ public static function disconnect() { self::$pdo = null; @@ -96,7 +94,7 @@ class Database { PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, PDO::ATTR_CASE => PDO::CASE_LOWER, - PDO::ATTR_AUTOCOMMIT => true + PDO::ATTR_AUTOCOMMIT => true, ) ); self::$pdo->exec("SET NAMES UTF8"); @@ -107,9 +105,9 @@ class Database { /** * We don't access $instance directly, only via query(), exec() and prepare() * - * @return Database - * * @throws \Exception + * + * @return Database */ public static function getInstance() { if (self::$pdo instanceof PDO) { @@ -122,7 +120,7 @@ class Database { /** * Are we currently connected to a database? * - * @return boolean + * @return bool */ public static function isConnected() { return self::$pdo instanceof PDO; @@ -132,11 +130,9 @@ class Database { * Log the details of a query, for debugging and analysis. * * @param string $query - * @param integer $rows - * @param double $microtime + * @param int $rows + * @param float $microtime * @param string[] $bind_variables - * - * @return void */ public static function logQuery($query, $rows, $microtime, $bind_variables) { if (WT_DEBUG_SQL) { @@ -187,7 +183,7 @@ class Database { /** * Determine the number of queries executed, for the page statistics. * - * @return integer + * @return int */ public static function getQueryCount() { return count(self::$log); @@ -199,7 +195,7 @@ class Database { * @return string */ public static function getQueryLog() { - $html = '<table border="1" style="table-layout: fixed; width: 960px;word-wrap: break-word;"><col span="3"><col align="char"><thead><tr><th>#</th><th style="width: 800px;">Query</th><th>Rows</th><th>Time (ms)</th></tr></thead><tbody>' . implode('', self::$log) . '</tbody></table>'; + $html = '<table border="1" style="table-layout: fixed; width: 960px;word-wrap: break-word;"><col span="3"><col align="char"><thead><tr><th>#</th><th style="width: 800px;">Query</th><th>Rows</th><th>Time (ms)</th></tr></thead><tbody>' . implode('', self::$log) . '</tbody></table>'; self::$log = array(); return $html; @@ -238,13 +234,13 @@ class Database { * * @param string $sql The SQL statement to execute * - * @return integer The number of rows affected by this SQL query + * @return int The number of rows affected by this SQL query */ public static function exec($sql) { - $sql = str_replace('##', WT_TBLPREFIX, $sql); + $sql = str_replace('##', WT_TBLPREFIX, $sql); $start = microtime(true); - $rows = self::$pdo->exec($sql); - $end = microtime(true); + $rows = self::$pdo->exec($sql); + $end = microtime(true); self::logQuery($sql, $rows, $end - $start, array()); return $rows; @@ -255,8 +251,9 @@ class Database { * * @param $sql * - * @return Statement * @throws \Exception + * + * @return Statement */ public static function prepare($sql) { if (!self::$pdo instanceof PDO) { @@ -286,9 +283,8 @@ class Database { * * @param string $schema_dir * @param string $schema_name - * @param integer $target_version + * @param int $target_version * - * @return void * @throws \Exception */ public static function updateSchema($schema_dir, $schema_name, $target_version) { diff --git a/app/Date.php b/app/Date.php index 0a7f8b7150..8df95929c3 100644 --- a/app/Date.php +++ b/app/Date.php @@ -106,8 +106,9 @@ class Date { * * @param string $date * - * @return CalendarDate * @throws \DomainException + * + * @return CalendarDate */ private function parseDate($date) { // Valid calendar escape specified? - use it @@ -199,7 +200,6 @@ class Date { } } - /** * A list of supported calendars and their names. * @@ -219,9 +219,9 @@ class Date { /** * Convert a date to the preferred format and calendar(s) display. * - * @param boolean|null $url Wrap the date in a link to calendar.php - * @param string|null $date_format Override the default date format - * @param boolean|null $convert_calendars Convert the date into other calendars + * @param bool|null $url Wrap the date in a link to calendar.php + * @param string|null $date_format Override the default date format + * @param bool|null $convert_calendars Convert the date into other calendars * * @return string */ @@ -385,7 +385,7 @@ class Date { /** * Get the earliest Julian day number from this GEDCOM date. * - * @return integer + * @return int */ public function minimumJulianDay() { return $this->minimumDate()->minJD; @@ -394,7 +394,7 @@ class Date { /** * Get the latest Julian day number from this GEDCOM date. * - * @return integer + * @return int */ public function maximumJulianDay() { return $this->maximumDate()->maxJD; @@ -406,7 +406,7 @@ class Date { * For a month-only date, this would be somewhere around the 16th day. * For a year-only date, this would be somewhere around 1st July. * - * @return integer + * @return int */ public function julianDay() { return (int) (($this->minimumJulianDay() + $this->maximumJulianDay()) / 2); @@ -418,8 +418,8 @@ class Date { * This is typically used to create an estimated death date, * which is before a certain number of years after the birth date. * - * @param integer $years - a number of years, positive or negative - * @param string $qualifier - typically “BEF” or “AFT” + * @param int $years a number of years, positive or negative + * @param string $qualifier typically “BEF” or “AFT” * * @return Date */ @@ -439,12 +439,13 @@ class Date { /** * Calculate the the age of a person, on a date. * - * @param Date $d1 - * @param Date $d2 - * @param integer $format + * @param Date $d1 + * @param Date $d2 + * @param int $format * - * @return int|string * @throws \InvalidArgumentException + * + * @return int|string */ public static function getAge(Date $d1, Date $d2 = null, $format = 0) { if ($d2) { @@ -497,7 +498,7 @@ class Date { * * @param Date $d1 * @param Date|null $d2 - * @param boolean $warn_on_negative + * @param bool $warn_on_negative * * @return string */ @@ -527,7 +528,7 @@ class Date { * @param Date $a * @param Date $b * - * @return integer + * @return int */ public static function compare(Date $a, Date $b) { // Get min/max JD for each date. @@ -578,7 +579,7 @@ class Date { * An incomplete date such as "12 AUG" would be invalid, as * we cannot sort it. * - * @return boolean + * @return bool */ public function isOK() { return $this->minimumJulianDay() && $this->maximumJulianDay(); @@ -590,12 +591,12 @@ class Date { * jewish/arabic users. This is only for interfacing with external entities, * such as the ancestry.com search interface or the dated fact icons. * - * @return integer + * @return int */ public function gregorianYear() { if ($this->isOK()) { $gregorian_calendar = new GregorianCalendar; - list($year) = $gregorian_calendar->jdToYmd($this->julianDay()); + list($year) = $gregorian_calendar->jdToYmd($this->julianDay()); return $year; } else { diff --git a/app/Date/CalendarDate.php b/app/Date/CalendarDate.php index 9c43571bc9..7e0eed739c 100644 --- a/app/Date/CalendarDate.php +++ b/app/Date/CalendarDate.php @@ -41,19 +41,19 @@ class CalendarDate { /** @var CalendarInterface The calendar system used to represent this date */ protected $calendar; - /** @var integer Year number */ + /** @var int Year number */ public $y; - /** @var integer Month number */ + /** @var int Month number */ public $m; - /** @var integer Day number */ + /** @var int Day number */ public $d; - /** @var integer Earliest Julian day number (start of month/year for imprecise dates) */ + /** @var int Earliest Julian day number (start of month/year for imprecise dates) */ public $minJD; - /** @var integer Latest Julian day number (end of month/year for imprecise dates) */ + /** @var int Latest Julian day number (end of month/year for imprecise dates) */ public $maxJD; /** @@ -67,8 +67,8 @@ class CalendarDate { public function __construct($date) { // Construct from an integer (a julian day number) if (is_integer($date)) { - $this->minJD = $date; - $this->maxJD = $date; + $this->minJD = $date; + $this->maxJD = $date; list($this->y, $this->m, $this->d) = $this->calendar->jdToYmd($date); return; @@ -132,7 +132,7 @@ class CalendarDate { /** * Is the current year a leap year? * - * @return boolean + * @return bool */ public function isLeapYear() { return $this->calendar->isLeapYear($this->y); @@ -150,8 +150,8 @@ class CalendarDate { $this->maxJD = $this->calendar->ymdToJd($this->nextYear($this->y), 1, 1) - 1; } elseif ($this->d == 0) { list($ny, $nm) = $this->nextMonth(); - $this->minJD = $this->calendar->ymdToJd($this->y, $this->m, 1); - $this->maxJD = $this->calendar->ymdToJd($ny, $nm, 1) - 1; + $this->minJD = $this->calendar->ymdToJd($this->y, $this->m, 1); + $this->maxJD = $this->calendar->ymdToJd($ny, $nm, 1) - 1; } else { $this->minJD = $this->calendar->ymdToJd($this->y, $this->m, $this->d); $this->maxJD = $this->minJD; @@ -163,8 +163,8 @@ class CalendarDate { * * We put these in the base class, to save duplicating it in the Julian and Gregorian calendars. * - * @param integer $month_number - * @param boolean $leap_year Some calendars use leap months + * @param int $month_number + * @param bool $leap_year Some calendars use leap months * * @return string */ @@ -197,8 +197,8 @@ class CalendarDate { * * We put these in the base class, to save duplicating it in the Julian and Gregorian calendars. * - * @param integer $month_number - * @param boolean $leap_year Some calendars use leap months + * @param int $month_number + * @param bool $leap_year Some calendars use leap months * * @return string */ @@ -231,8 +231,8 @@ class CalendarDate { * * We put these in the base class, to save duplicating it in the Julian and Gregorian calendars. * - * @param integer $month_number - * @param boolean $leap_year Some calendars use leap months + * @param int $month_number + * @param bool $leap_year Some calendars use leap months * * @return string */ @@ -265,8 +265,8 @@ class CalendarDate { * * We put these in the base class, to save duplicating it in the Julian and Gregorian calendars. * - * @param integer $month_number - * @param boolean $leap_year Some calendars use leap months + * @param int $month_number + * @param bool $leap_year Some calendars use leap months * * @return string */ @@ -297,8 +297,8 @@ class CalendarDate { /** * Abbreviated month name * - * @param integer $month_number - * @param boolean $leap_year Some calendars use leap months + * @param int $month_number + * @param bool $leap_year Some calendars use leap months * * @return string */ @@ -329,7 +329,7 @@ class CalendarDate { /** * Full day of th eweek * - * @param integer $day_number + * @param int $day_number * * @return string */ @@ -354,7 +354,7 @@ class CalendarDate { /** * Abbreviated day of the week * - * @param integer $day_number + * @param int $day_number * * @return string */ @@ -379,9 +379,9 @@ class CalendarDate { /** * Most years are 1 more than the previous, but not always (e.g. 1BC->1AD) * - * @param integer $year + * @param int $year * - * @return integer + * @return int */ protected function nextYear($year) { return $year + 1; @@ -392,7 +392,7 @@ class CalendarDate { * * @param string $year * - * @return integer + * @return int */ protected function extractYear($year) { return (int) $year; @@ -404,7 +404,7 @@ class CalendarDate { * @param CalendarDate $d1 * @param CalendarDate $d2 * - * @return integer + * @return int */ public static function compare(CalendarDate $d1, CalendarDate $d2) { if ($d1->maxJD < $d2->minJD) { @@ -423,9 +423,9 @@ class CalendarDate { * * @todo JewishDate needs to redefine this to cope with leap months * - * @param boolean $full true=gedcom style, false=just years - * @param integer $jd date for calculation - * @param boolean $warn_on_negative show a warning triangle for negative ages + * @param bool $full true=gedcom style, false=just years + * @param int $jd date for calculation + * @param bool $warn_on_negative show a warning triangle for negative ages * * @return string */ @@ -443,9 +443,9 @@ class CalendarDate { return '<i class="icon-warning"></i>'; } list($y, $m, $d) = $this->calendar->jdToYmd($jd); - $dy = $y - $this->y; - $dm = $m - max($this->m, 1); - $dd = $d - max($this->d, 1); + $dy = $y - $this->y; + $dm = $m - max($this->m, 1); + $dd = $d - max($this->d, 1); if ($dd < 0) { $dm--; } @@ -500,7 +500,7 @@ class CalendarDate { /** * Is this date within the valid range of the calendar * - * @return boolean + * @return bool */ public function inValidRange() { return $this->minJD >= $this->calendar->jdStart() && $this->maxJD <= $this->calendar->jdEnd(); @@ -509,7 +509,7 @@ class CalendarDate { /** * How many months in a year * - * @return integer + * @return int */ public function monthsInYear() { return $this->calendar->monthsInYear(); @@ -518,7 +518,7 @@ class CalendarDate { /** * How many days in the current month * - * @return integer + * @return int */ public function daysInMonth() { try { @@ -533,7 +533,7 @@ class CalendarDate { /** * How many days in the current week * - * @return integer + * @return int */ public function daysInWeek() { return $this->calendar->daysInWeek(); @@ -851,7 +851,7 @@ class CalendarDate { /** * Convert a decimal number to roman numerals * - * @param integer $number + * @param int $number * * @return string */ @@ -876,7 +876,7 @@ class CalendarDate { * * @param string $roman * - * @return integer + * @return int */ protected function romanNumeralsToNumber($roman) { $num = 0; diff --git a/app/Date/JulianDate.php b/app/Date/JulianDate.php index a13e994a7e..c0fdb8989d 100644 --- a/app/Date/JulianDate.php +++ b/app/Date/JulianDate.php @@ -23,7 +23,7 @@ use Fisharebest\ExtCalendar\JulianCalendar; * (Proleptic means we extend it backwards, prior to its introduction in 46BC) */ class JulianDate extends CalendarDate { - /** @var boolean True for dates recorded in new-style/old-style format, e.g. 2 FEB 1743/44 */ + /** @var bool True for dates recorded in new-style/old-style format, e.g. 2 FEB 1743/44 */ private $new_old_style = false; /** {@inheritdoc} */ diff --git a/app/Fact.php b/app/Fact.php index 8e79348834..383679f063 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -32,10 +32,10 @@ class Fact { /** @var string The GEDCOM tag for this record */ private $tag; - /** @var boolean Is this a recently deleted fact, pending approval? */ + /** @var bool Is this a recently deleted fact, pending approval? */ private $pending_deletion = false; - /** @var boolean Is this a recently added fact, pending approval? */ + /** @var bool Is this a recently added fact, pending approval? */ private $pending_addition = false; /** @var Date The date of this fact, from the “2 DATE …” attribute */ @@ -44,7 +44,7 @@ class Fact { /** @var Place The place of this fact, from the “2 PLAC …” attribute */ private $place; - /** @var integer Temporary(!) variable Used by sort_facts() */ + /** @var int Temporary(!) variable Used by sort_facts() */ public $sortOrder; /** @@ -129,9 +129,9 @@ class Fact { /** * Do the privacy rules allow us to display this fact to the current user * - * @param integer|null $access_level + * @param int|null $access_level * - * @return boolean + * @return bool */ public function canShow($access_level = null) { if ($access_level === null) { @@ -167,7 +167,7 @@ class Fact { /** * Check whether this fact is protected against edit * - * @return boolean + * @return bool */ public function canEdit() { // Managers can edit anything @@ -284,7 +284,7 @@ class Fact { /** * Is this a newly deleted fact, pending approval. * - * @return boolean + * @return bool */ public function isPendingDeletion() { return $this->pending_deletion; @@ -301,7 +301,7 @@ class Fact { /** * Is this a newly added fact, pending approval. * - * @return boolean + * @return bool */ public function isPendingAddition() { return $this->pending_addition; @@ -415,7 +415,7 @@ class Fact { * @param Fact $a Fact one * @param Fact $b Fact two * - * @return integer + * @return int */ public static function compareDate(Fact $a, Fact $b) { if ($a->getDate()->isOK() && $b->getDate()->isOK()) { @@ -445,7 +445,7 @@ class Fact { * @param Fact $a Fact one * @param Fact $b Fact two * - * @return integer + * @return int */ public static function compareType(Fact $a, Fact $b) { global $factsort; diff --git a/app/Family.php b/app/Family.php index 7cb1a9a59a..11992c4f91 100644 --- a/app/Family.php +++ b/app/Family.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class Family extends GedcomRecord { const RECORD_TYPE = 'FAM'; - const URL_PREFIX = 'family.php?famid='; + const URL_PREFIX = 'family.php?famid='; /** @var Individual|null The husband (or first spouse for same-sex couples) */ private $husb; @@ -164,7 +164,7 @@ class Family extends GedcomRecord { /** * Get the (zero, one or two) spouses from this family. * - * @param integer|null $access_level + * @param int|null $access_level * * @return Individual[] */ @@ -187,7 +187,7 @@ class Family extends GedcomRecord { /** * Get a list of this family’s children. * - * @param integer|null $access_level + * @param int|null $access_level * * @return Individual[] */ @@ -215,7 +215,7 @@ class Family extends GedcomRecord { * @param Family $x * @param Family $y * - * @return integer + * @return int */ public static function compareMarrDate(Family $x, Family $y) { return Date::compare($x->getMarriageDate(), $y->getMarriageDate()); @@ -224,7 +224,7 @@ class Family extends GedcomRecord { /** * Number of children - for the individual list * - * @return integer + * @return int */ public function getNumberOfChildren() { $nchi = count($this->getChildren()); @@ -261,7 +261,7 @@ class Family extends GedcomRecord { /** * Get the marriage year - displayed on lists of families * - * @return integer + * @return int */ public function getMarriageYear() { return $this->getMarriageDate()->minimumDate()->y; diff --git a/app/File.php b/app/File.php index 37eda3abc4..ba076674f0 100644 --- a/app/File.php +++ b/app/File.php @@ -34,9 +34,9 @@ class File { * @return null|string */ public static function fetchUrl($url, $stream = null) { - $host = parse_url($url, PHP_URL_HOST); - $port = parse_url($url, PHP_URL_PORT); - $path = parse_url($url, PHP_URL_PATH); + $host = parse_url($url, PHP_URL_HOST); + $port = parse_url($url, PHP_URL_PORT); + $path = parse_url($url, PHP_URL_PATH); $query = parse_url($url, PHP_URL_QUERY); if (!$port) { @@ -89,7 +89,7 @@ class File { * * @param string $path * - * @return boolean Was the file deleted + * @return bool Was the file deleted */ public static function delete($path) { if (is_dir($path)) { @@ -121,7 +121,7 @@ class File { * * @param string $path * - * @return boolean Does the folder now exist + * @return bool Does the folder now exist */ public static function mkdir($path) { if (is_dir($path)) { diff --git a/app/Filter.php b/app/Filter.php index 026cb4a6e7..92e50f65c3 100644 --- a/app/Filter.php +++ b/app/Filter.php @@ -165,7 +165,7 @@ class Filter { $config = HTMLPurifier_Config::createDefault(); $config->set('Cache.SerializerPath', $HTML_PURIFIER_CACHE_DIR); $purifier = new HTMLPurifier($config); - $text = $purifier->purify($text); + $text = $purifier->purify($text); return $text; } @@ -204,6 +204,7 @@ class Filter { }, ) ); + return ($tmp === null || $tmp === false) ? $default : $tmp; } } @@ -234,6 +235,7 @@ class Filter { ), ) ); + return $tmp[$variable] ?: array(); } else { // PHP5.3 requires the $tmp variable @@ -245,10 +247,11 @@ class Filter { 'filter' => FILTER_CALLBACK, 'options' => function ($x) { return !function_exists('mb_convert_encoding') || mb_check_encoding($x, 'UTF-8') ? $x : false; - } + }, ), ) ); + return $tmp[$variable] ?: array(); } } @@ -284,7 +287,7 @@ class Filter { * * @param string $variable * - * @return boolean + * @return bool */ public static function getBool($variable) { return (bool) filter_input(INPUT_GET, $variable, FILTER_VALIDATE_BOOLEAN); @@ -293,15 +296,15 @@ class Filter { /** * Validate integer GET parameters * - * @param string $variable - * @param integer $min - * @param integer $max - * @param integer $default + * @param string $variable + * @param int $min + * @param int $max + * @param int $default * - * @return integer + * @return int */ public static function getInteger($variable, $min = 0, $max = PHP_INT_MAX, $default = 0) { - return filter_input(INPUT_GET, $variable, FILTER_VALIDATE_INT, array('options'=>array('min_range'=>$min, 'max_range'=>$max, 'default'=>$default))); + return filter_input(INPUT_GET, $variable, FILTER_VALIDATE_INT, array('options' => array('min_range' => $min, 'max_range' => $max, 'default' => $default))); } /** @@ -359,7 +362,7 @@ class Filter { * * @param string $variable * - * @return boolean + * @return bool */ public static function postBool($variable) { return (bool) filter_input(INPUT_POST, $variable, FILTER_VALIDATE_BOOLEAN); @@ -368,15 +371,15 @@ class Filter { /** * Validate integer POST parameters * - * @param string $variable - * @param integer $min - * @param integer $max - * @param integer $default + * @param string $variable + * @param int $min + * @param int $max + * @param int $default * - * @return integer + * @return int */ public static function postInteger($variable, $min = 0, $max = PHP_INT_MAX, $default = 0) { - return filter_input(INPUT_POST, $variable, FILTER_VALIDATE_INT, array('options'=>array('min_range'=>$min, 'max_range'=>$max, 'default'=>$default))); + return filter_input(INPUT_POST, $variable, FILTER_VALIDATE_INT, array('options' => array('min_range' => $min, 'max_range' => $max, 'default' => $default))); } /** @@ -446,7 +449,7 @@ $_SERVER[$variable]))) { */ public static function getCsrfToken() { if (!Session::has('CSRF_TOKEN')) { - $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcedfghijklmnopqrstuvwxyz0123456789'; + $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcedfghijklmnopqrstuvwxyz0123456789'; $csrf_token = ''; for ($n = 0; $n < 32; ++$n) { $csrf_token .= substr($charset, mt_rand(0, 61), 1); @@ -469,7 +472,7 @@ $_SERVER[$variable]))) { /** * Check that the POST request contains the CSRF token generated above. * - * @return boolean + * @return bool */ public static function checkCsrf() { if (self::post('csrf') !== self::getCsrfToken()) { diff --git a/app/FlashMessages.php b/app/FlashMessages.php index 34c9bf3549..09c8f1aefe 100644 --- a/app/FlashMessages.php +++ b/app/FlashMessages.php @@ -35,7 +35,7 @@ class FlashMessages { $message->text = $text; $message->status = $status; - $messages = Session::get(self::FLASH_KEY, array()); + $messages = Session::get(self::FLASH_KEY, array()); $messages[] = $message; Session::put(self::FLASH_KEY, $messages); } diff --git a/app/Gedcom/GedcomCodeRela.php b/app/Gedcom/GedcomCodeRela.php index 3ad0993caf..9020c9532b 100644 --- a/app/Gedcom/GedcomCodeRela.php +++ b/app/Gedcom/GedcomCodeRela.php @@ -20,7 +20,6 @@ namespace Fisharebest\Webtrees; * Class GedcomCodeRela - Functions and logic for GEDCOM "RELA" codes */ class GedcomCodeRela { - /** @var string[] List of possible values for the RELA tag */ private static $TYPES = array( 'attendant', 'attending', 'best_man', 'bridesmaid', 'buyer', diff --git a/app/Gedcom/GedcomCodeTemp.php b/app/Gedcom/GedcomCodeTemp.php index ac24b7b890..33f91ee3a2 100644 --- a/app/Gedcom/GedcomCodeTemp.php +++ b/app/Gedcom/GedcomCodeTemp.php @@ -25,7 +25,7 @@ class GedcomCodeTemp { * * @param string $tag * - * @return boolean + * @return bool */ public static function isTagLDS($tag) { return $tag === 'BAPL' || $tag === 'CONL' || $tag === 'ENDL' || $tag === 'SLGC' || $tag === 'SLGS'; diff --git a/app/Gedcom/GedcomTag.php b/app/Gedcom/GedcomTag.php index 6b101981d5..8d36c18f6f 100644 --- a/app/Gedcom/GedcomTag.php +++ b/app/Gedcom/GedcomTag.php @@ -91,7 +91,7 @@ class GedcomTag { * * @param string $tag * - * @return boolean + * @return bool */ public static function isTag($tag) { return in_array($tag, self::$ALL_TAGS); diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index 99d38f394c..67b4ea4e6a 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -38,22 +38,22 @@ class GedcomRecord { /** @var Fact[] facts extracted from $gedcom/$pending */ protected $facts; - /** @var boolean Can we display details of this record to Auth::PRIV_PRIVATE */ + /** @var bool Can we display details of this record to Auth::PRIV_PRIVATE */ private $disp_public; - /** @var boolean Can we display details of this record to Auth::PRIV_USER */ + /** @var bool Can we display details of this record to Auth::PRIV_USER */ private $disp_user; - /** @var boolean Can we display details of this record to Auth::PRIV_NONE */ + /** @var bool Can we display details of this record to Auth::PRIV_NONE */ private $disp_none; /** @var string[][] All the names of this individual */ protected $_getAllNames; - /** @var integer Cached result */ + /** @var int Cached result */ protected $_getPrimaryName; - /** @var integer Cached result */ + /** @var int Cached result */ protected $_getSecondaryName; // Allow getInstance() to return references to existing objects @@ -125,8 +125,9 @@ class GedcomRecord { * @param Tree $tree * @param string|null $gedcom * - * @return GedcomRecord|null * @throws \Exception + * + * @return GedcomRecord|null */ public static function getInstance($xref, Tree $tree, $gedcom = null) { $tree_id = $tree->getTreeId(); @@ -146,10 +147,10 @@ class GedcomRecord { if (!isset(self::$pending_record_cache[$tree_id])) { // Fetch all pending records in one database query self::$pending_record_cache[$tree_id] = array(); - $rows = Database::prepare( + $rows = Database::prepare( "SELECT xref, new_gedcom FROM `##change` WHERE status = 'pending' AND gedcom_id = :tree_id ORDER BY change_id" )->execute(array( - 'tree_id' => $tree_id + 'tree_id' => $tree_id, ))->fetchAll(); foreach ($rows as $row) { self::$pending_record_cache[$tree_id][$row->xref] = $row->new_gedcom; @@ -219,8 +220,8 @@ class GedcomRecord { /** * Fetch data from the database * - * @param string $xref - * @param integer $tree_id + * @param string $xref + * @param int $tree_id * * @return null|string */ @@ -295,7 +296,7 @@ class GedcomRecord { /** * Does this record have a pending change? * - * @return boolean + * @return bool */ public function isPendingAddtion() { return $this->pending !== null; @@ -304,7 +305,7 @@ class GedcomRecord { /** * Does this record have a pending deletion? * - * @return boolean + * @return bool */ public function isPendingDeletion() { return $this->pending === ''; @@ -352,9 +353,9 @@ class GedcomRecord { /** * Work out whether this record can be shown to a user with a given access level * - * @param integer $access_level + * @param int $access_level * - * @return boolean + * @return bool */ private function canShowRecord($access_level) { // This setting would better be called "$ENABLE_PRIVACY" @@ -396,9 +397,9 @@ class GedcomRecord { /** * Each object type may have its own special rules, and re-implement this function. * - * @param integer $access_level + * @param int $access_level * - * @return boolean + * @return bool */ protected function canShowByType($access_level) { $fact_privacy = $this->tree->getFactPrivacy(); @@ -415,9 +416,9 @@ class GedcomRecord { /** * Can the details of this record be shown? * - * @param integer|null $access_level + * @param int|null $access_level * - * @return boolean + * @return bool */ public function canShow($access_level = null) { if ($access_level === null) { @@ -431,16 +432,19 @@ class GedcomRecord { if ($this->disp_public === null) { $this->disp_public = $this->canShowRecord(Auth::PRIV_PRIVATE); } + return $this->disp_public; case Auth::PRIV_USER: // member if ($this->disp_user === null) { $this->disp_user = $this->canShowRecord(Auth::PRIV_USER); } + return $this->disp_user; case Auth::PRIV_NONE: // admin if ($this->disp_none === null) { $this->disp_none = $this->canShowRecord(Auth::PRIV_NONE); } + return $this->disp_none; case Auth::PRIV_HIDE: // hidden from admins // We use this value to bypass privacy checks. For example, @@ -455,9 +459,9 @@ class GedcomRecord { /** * Can the name of this record be shown? * - * @param integer|null $access_level + * @param int|null $access_level * - * @return boolean + * @return bool */ public function canShowName($access_level = null) { if ($access_level === null) { @@ -470,7 +474,7 @@ class GedcomRecord { /** * Can we edit this record? * - * @return boolean + * @return bool */ public function canEdit() { return Auth::isManager($this->tree) || Auth::isEditor($this->tree) && strpos($this->gedcom, "\n1 RESN locked") === false; @@ -480,7 +484,7 @@ class GedcomRecord { * Remove private data from the raw gedcom record. * Return both the visible and invisible data. We need the invisible data when editing. * - * @param integer $access_level + * @param int $access_level * * @return string */ @@ -498,6 +502,7 @@ class GedcomRecord { foreach ($this->getFacts(null, false, $access_level) as $fact) { $gedrec .= "\n" . $fact->getGedcom(); } + return $gedrec; } else { // We cannot display the details, but we may be able to display @@ -509,7 +514,7 @@ class GedcomRecord { /** * Generate a private version of this record * - * @param integer $access_level + * @param int $access_level * * @return string */ @@ -543,8 +548,8 @@ class GedcomRecord { * ['full'] = the name as specified in the record, e.g. 'Vincent van Gogh' or 'John Unknown' * ['sort'] = a sortable version of the name (not for display), e.g. 'Gogh, Vincent' or '@N.N., John' * - * @param integer $level - * @param string $fact_type + * @param int $level + * @param string $fact_type * @param Fact[] $facts */ protected function extractNamesFromFacts($level, $fact_type, $facts) { @@ -595,6 +600,7 @@ class GedcomRecord { $this->addName(static::RECORD_TYPE, I18N::translate('Private'), null); } } + return $this->_getAllNames; } @@ -610,7 +616,7 @@ class GedcomRecord { /** * Which of the (possibly several) names of this record is the primary one. * - * @return integer + * @return int */ public function getPrimaryName() { static $language_script; @@ -639,7 +645,7 @@ class GedcomRecord { /** * Which of the (possibly several) names of this record is the secondary one. * - * @return integer + * @return int */ public function getSecondaryName() { if (is_null($this->_getSecondaryName)) { @@ -649,7 +655,7 @@ class GedcomRecord { $all_names = $this->getAllNames(); if (count($all_names) > 1) { $primary_script = I18N::textScript($all_names[$this->getPrimaryName()]['sort']); - foreach ($all_names as $n=>$name) { + foreach ($all_names as $n => $name) { if ($n != $this->getPrimaryName() && $name['type'] != '_MARNM' && I18N::textScript($name['sort']) != $primary_script) { $this->_getSecondaryName = $n; break; @@ -657,13 +663,14 @@ class GedcomRecord { } } } + return $this->_getSecondaryName; } /** * Allow the choice of primary name to be overidden, e.g. in a search result * - * @param integer $n + * @param int $n */ public function setPrimaryName($n) { $this->_getPrimaryName = $n; @@ -686,7 +693,7 @@ class GedcomRecord { * @param GedcomRecord $x * @param GedcomRecord $y * - * @return integer + * @return int */ public static function compare(GedcomRecord $x, GedcomRecord $y) { if ($x->canShowName()) { @@ -712,6 +719,7 @@ class GedcomRecord { public function getFullName() { if ($this->canShowName()) { $tmp = $this->getAllNames(); + return $tmp[$this->getPrimaryName()]['full']; } else { return I18N::translate('Private'); @@ -726,6 +734,7 @@ class GedcomRecord { public function getSortName() { // The sortable name is never displayed, no need to call canShowName() $tmp = $this->getAllNames(); + return $tmp[$this->getPrimaryName()]['sort']; } @@ -737,6 +746,7 @@ class GedcomRecord { public function getAddName() { if ($this->canShowName() && $this->getPrimaryName() != $this->getSecondaryName()) { $all_names = $this->getAllNames(); + return $all_names[$this->getSecondaryName()]['full']; } else { return null; @@ -748,9 +758,9 @@ class GedcomRecord { * If $find is set, then we are displaying items from a selection list. * $name allows us to use something other than the record name. * - * @param string $tag - * @param boolean $find - * @param null $name + * @param string $tag + * @param bool $find + * @param null $name * * @return string */ @@ -765,6 +775,7 @@ class GedcomRecord { $html .= ' class="list_item"><b>' . $name . '</b>'; $html .= $this->formatListDetails(); $html = '<' . $tag . '>' . $html . '</a></' . $tag . '>'; + return $html; } @@ -781,8 +792,8 @@ class GedcomRecord { /** * Extract/format the first fact from a list of facts. * - * @param string $facts - * @param integer $style + * @param string $facts + * @param int $style * * @return string */ @@ -798,6 +809,7 @@ class GedcomRecord { } } } + return ''; } @@ -830,6 +842,7 @@ class GedcomRecord { $list[] = $record; } } + return $list; } @@ -860,6 +873,7 @@ class GedcomRecord { $list[] = $record; } } + return $list; } @@ -891,6 +905,7 @@ class GedcomRecord { $list[] = $record; } } + return $list; } @@ -922,6 +937,7 @@ class GedcomRecord { $list[] = $record; } } + return $list; } @@ -954,6 +970,7 @@ class GedcomRecord { $list[] = $record; } } + return $list; } @@ -986,6 +1003,7 @@ class GedcomRecord { $list[] = $record; } } + return $list; } @@ -1051,10 +1069,10 @@ class GedcomRecord { /** * The facts and events for this record. * - * @param string $filter - * @param boolean $sort - * @param integer|null $access_level - * @param boolean $override Include private records, to allow us to implement $SHOW_PRIVATE_RELATIONSHIPS and $SHOW_LIVING_NAMES. + * @param string $filter + * @param bool $sort + * @param int|null $access_level + * @param bool $override Include private records, to allow us to implement $SHOW_PRIVATE_RELATIONSHIPS and $SHOW_LIVING_NAMES. * * @return Fact[] */ @@ -1074,6 +1092,7 @@ class GedcomRecord { if ($sort) { sort_facts($facts); } + return $facts; } @@ -1081,7 +1100,7 @@ class GedcomRecord { * Get the last-change timestamp for this record, either as a formatted string * (for display) or as a unix timestamp (for sorting) * - * @param boolean $sorting + * @param bool $sorting * * @return string */ @@ -1136,8 +1155,8 @@ class GedcomRecord { /** * Add a new fact to this record * - * @param string $gedcom - * @param boolean $update_chan + * @param string $gedcom + * @param bool $update_chan */ public function createFact($gedcom, $update_chan) { $this->updateFact(null, $gedcom, $update_chan); @@ -1146,8 +1165,8 @@ class GedcomRecord { /** * Delete a fact from this record * - * @param string $fact_id - * @param boolean $update_chan + * @param string $fact_id + * @param bool $update_chan */ public function deleteFact($fact_id, $update_chan) { $this->updateFact($fact_id, null, $update_chan); @@ -1156,9 +1175,9 @@ class GedcomRecord { /** * Replace a fact with a new gedcom data. * - * @param string $fact_id - * @param string $gedcom - * @param boolean $update_chan + * @param string $fact_id + * @param string $gedcom + * @param bool $update_chan * * @throws \Exception */ @@ -1214,7 +1233,7 @@ class GedcomRecord { $this->xref, $old_gedcom, $new_gedcom, - Auth::id() + Auth::id(), )); $this->pending = $new_gedcom; @@ -1231,8 +1250,8 @@ class GedcomRecord { /** * Update this record * - * @param string $gedcom - * @param boolean $update_chan + * @param string $gedcom + * @param bool $update_chan */ public function updateRecord($gedcom, $update_chan) { // MSDOS line endings will break things in horrible ways @@ -1253,7 +1272,7 @@ class GedcomRecord { $this->xref, $this->getGedcom(), $gedcom, - Auth::id() + Auth::id(), )); // Clear the cache @@ -1291,7 +1310,7 @@ class GedcomRecord { } // Clear the cache - self::$gedcom_record_cache = null; + self::$gedcom_record_cache = null; self::$pending_record_cache = null; Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref); @@ -1300,8 +1319,8 @@ class GedcomRecord { /** * Remove all links from this record to $xref * - * @param string $xref - * @param boolean $update_chan + * @param string $xref + * @param bool $update_chan */ public function removeLinks($xref, $update_chan) { $value = '@' . $xref . '@'; @@ -1312,9 +1331,9 @@ class GedcomRecord { } elseif (preg_match_all('/\n(\d) ' . WT_REGEX_TAG . ' ' . $value . '/', $fact->getGedcom(), $matches, PREG_SET_ORDER)) { $gedcom = $fact->getGedcom(); foreach ($matches as $match) { - $next_level = $match[1] + 1; + $next_level = $match[1] + 1; $next_levels = '[' . $next_level . '-9]'; - $gedcom = preg_replace('/' . $match[0] . '(\n' . $next_levels . '.*)*/', '', $gedcom); + $gedcom = preg_replace('/' . $match[0] . '(\n' . $next_levels . '.*)*/', '', $gedcom); } $this->updateFact($fact->getFactId(), $gedcom, $update_chan); } diff --git a/app/HitCounter.php b/app/HitCounter.php index ffa8f1cf29..c7e542b6ab 100644 --- a/app/HitCounter.php +++ b/app/HitCounter.php @@ -27,7 +27,7 @@ class HitCounter { * @param string $page * @param string $parameter * - * @return integer + * @return int */ public static function countHit(Tree $tree, $page, $parameter) { // Don't increment the counter while we stay on the same page. @@ -78,7 +78,7 @@ class HitCounter { * @param string $page * @param string $parameter * - * @return integer + * @return int */ public static function getCount(Tree $tree, $page, $parameter) { return (int) Database::prepare( diff --git a/app/I18N.php b/app/I18N.php index a628dd0ea6..8108b17a69 100644 --- a/app/I18N.php +++ b/app/I18N.php @@ -78,18 +78,18 @@ class I18N { // Characters that are displayed in mirror form in RTL text. private static $mirror_characters = array( - '(' => ')', - ')' => '(', - '[' => ']', - ']' => '[', - '{' => '}', - '}' => '{', - '<' => '>', - '>' => '<', + '(' => ')', + ')' => '(', + '[' => ']', + ']' => '[', + '{' => '}', + '}' => '{', + '<' => '>', + '>' => '<', '‹' => '›', '›' => '‹', - '«' => '»', - '»' => '«', + '«' => '»', + '»' => '«', '﴾' => '﴿', '﴿' => '﴾', '“' => '”', @@ -245,7 +245,7 @@ class I18N { * * Used for years, etc., where we do not want thousands-separators, decimals, etc. * - * @param integer $n + * @param int $n * * @return string */ @@ -265,7 +265,7 @@ class I18N { /** * What is the first day of the week. * - * @return integer Sunday=0, Monday=1, etc. + * @return int Sunday=0, Monday=1, etc. */ public static function firstDay() { return self::$locale->territory()->firstDay(); @@ -415,7 +415,7 @@ class I18N { if ($rebuild_cache) { $translations = array(); foreach ($translation_files as $translation_file) { - $translation = new Translation($translation_file); + $translation = new Translation($translation_file); $translations = array_merge($translations, $translation->asArray()); } file_put_contents($cache_file, '<' . '?php return ' . var_export($translations, true) . ';'); @@ -488,8 +488,8 @@ class I18N { * fr: 12 345,67 * de: 12.345,67 * - * @param float $n - * @param integer $precision + * @param float $n + * @param int $precision * * @return string */ @@ -505,8 +505,8 @@ class I18N { * fr: 12,3 % * de: 12,3% * - * @param float $n - * @param integer $precision + * @param float $n + * @param int $precision * * @return string */ @@ -558,15 +558,15 @@ class I18N { $text = strtr($text, self::$mirror_characters); $reversed = ''; - $digits = ''; + $digits = ''; while ($text != '') { $letter = mb_substr($text, 0, 1); - $text = mb_substr($text, 1); + $text = mb_substr($text, 1); if (strpos(self::DIGITS, $letter) !== false) { $digits .= $letter; } else { $reversed = $letter . $digits . $reversed; - $digits = ''; + $digits = ''; } } @@ -603,7 +603,7 @@ class I18N { * @param string $string1 * @param string $string2 * - * @return integer + * @return int */ public static function strcasecmp($string1, $string2) { $strpos1 = 0; @@ -731,26 +731,26 @@ class I18N { $string = strip_tags($string); // otherwise HTML tags show up as latin $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8'); // otherwise HTML entities show up as latin $string = str_replace(array('@N.N.', '@P.N.'), '', $string); // otherwise unknown names show up as latin - $pos = 0; + $pos = 0; $strlen = strlen($string); while ($pos < $strlen) { // get the Unicode Code Point for the character at position $pos $byte1 = ord($string[$pos]); if ($byte1 < 0x80) { $code_point = $byte1; - $chrlen = 1; + $chrlen = 1; } elseif ($byte1 < 0xC0) { // Invalid continuation character return 'Latn'; } elseif ($byte1 < 0xE0) { $code_point = (($byte1 & 0x1F) << 6) + (ord($string[$pos + 1]) & 0x3F); - $chrlen = 2; + $chrlen = 2; } elseif ($byte1 < 0xF0) { $code_point = (($byte1 & 0x0F) << 12) + ((ord($string[$pos + 1]) & 0x3F) << 6) + (ord($string[$pos + 2]) & 0x3F); - $chrlen = 3; + $chrlen = 3; } elseif ($byte1 < 0xF8) { $code_point = (($byte1 & 0x07) << 24) + ((ord($string[$pos + 1]) & 0x3F) << 12) + ((ord($string[$pos + 2]) & 0x3F) << 6) + (ord($string[$pos + 3]) & 0x3F); - $chrlen = 3; + $chrlen = 3; } else { // Invalid UTF return 'Latn'; @@ -771,7 +771,7 @@ class I18N { /** * Convert a number of seconds into a relative time. For example, 630 => "10 hours, 30 minutes ago" * - * @param integer $seconds + * @param int $seconds * * @return string */ @@ -784,18 +784,23 @@ class I18N { if ($seconds > $year) { $years = (int) ($seconds / $year); + return self::plural('%s year ago', '%s years ago', $years, self::number($years)); } elseif ($seconds > $month) { $months = (int) ($seconds / $month); + return self::plural('%s month ago', '%s months ago', $months, self::number($months)); } elseif ($seconds > $day) { $days = (int) ($seconds / $day); + return self::plural('%s day ago', '%s days ago', $days, self::number($days)); } elseif ($seconds > $hour) { $hours = (int) ($seconds / $hour); + return self::plural('%s hour ago', '%s hours ago', $hours, self::number($hours)); } elseif ($seconds > $minute) { $minutes = (int) ($seconds / $minute); + return self::plural('%s minute ago', '%s minutes ago', $minutes, self::number($minutes)); } else { return self::plural('%s second ago', '%s seconds ago', $seconds, self::number($seconds)); @@ -845,7 +850,7 @@ class I18N { /** * What is the last day of the weekend. * - * @return integer Sunday=0, Monday=1, etc. + * @return int Sunday=0, Monday=1, etc. */ public static function weekendEnd() { return self::$locale->territory()->weekendEnd(); @@ -854,7 +859,7 @@ class I18N { /** * What is the first day of the weekend. * - * @return integer Sunday=0, Monday=1, etc. + * @return int Sunday=0, Monday=1, etc. */ public static function weekendStart() { return self::$locale->territory()->weekendStart(); diff --git a/app/Individual.php b/app/Individual.php index 56fa3c620b..7a8f023a7e 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -23,7 +23,7 @@ use Fisharebest\ExtCalendar\GregorianCalendar; */ class Individual extends GedcomRecord { const RECORD_TYPE = 'INDI'; - const URL_PREFIX = 'individual.php?pid='; + const URL_PREFIX = 'individual.php?pid='; public $generation; // used in some lists to keep track of this individual’s generation in that list @@ -112,7 +112,7 @@ class Individual extends GedcomRecord { // Dead people... if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) { - $keep_alive = false; + $keep_alive = false; $KEEP_ALIVE_YEARS_BIRTH = $this->tree->getPreference('KEEP_ALIVE_YEARS_BIRTH'); if ($KEEP_ALIVE_YEARS_BIRTH) { preg_match_all('/\n1 (?:' . WT_EVENTS_BIRT . ').*(?:\n[2-9].*)*(?:\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER); @@ -154,9 +154,9 @@ class Individual extends GedcomRecord { * For relationship privacy calculations - is this individual a close relative? * * @param Individual $target - * @param integer $distance + * @param int $distance * - * @return boolean + * @return bool */ private static function isRelated(Individual $target, $distance) { static $cache = null; @@ -268,7 +268,7 @@ class Individual extends GedcomRecord { * @param Individual $x * @param Individual $y * - * @return integer + * @return int */ public static function compareBirthDate(Individual $x, Individual $y) { return Date::compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate()); @@ -280,7 +280,7 @@ class Individual extends GedcomRecord { * @param Individual $x * @param Individual $y * - * @return integer + * @return int */ public static function compareDeathDate(Individual $x, Individual $y) { return Date::compare($x->getEstimatedDeathDate(), $y->getEstimatedDeathDate()); @@ -290,7 +290,7 @@ class Individual extends GedcomRecord { * Calculate whether this individual is living or dead. * If not known to be dead, then assume living. * - * @return boolean + * @return bool */ public function isDead() { $MAX_ALIVE_AGE = $this->tree->getPreference('MAX_ALIVE_AGE'); @@ -406,7 +406,7 @@ class Individual extends GedcomRecord { continue; } $level = $match[1]; - $prim = $media->isPrimary(); + $prim = $media->isPrimary(); if ($prim == 'N') { continue; } @@ -694,7 +694,7 @@ class Individual extends GedcomRecord { if ($min && $max) { $gregorian_calendar = new GregorianCalendar; - list($year) = $gregorian_calendar->jdToYmd((int) ((max($min) + min($max)) / 2)); + list($year) = $gregorian_calendar->jdToYmd((int) ((max($min) + min($max)) / 2)); $this->_getEstimatedBirthDate = new Date('EST ' . $year); } else { $this->_getEstimatedBirthDate = new Date(''); // always return a date object @@ -782,7 +782,7 @@ class Individual extends GedcomRecord { /** * Get a list of this individual’s spouse families * - * @param integer|null $access_level + * @param int|null $access_level * * @return Family[] */ @@ -813,7 +813,7 @@ class Individual extends GedcomRecord { * @return Individual|null */ public function getCurrentSpouse() { - $tmp = $this->getSpouseFamilies(); + $tmp = $this->getSpouseFamilies(); $family = end($tmp); if ($family) { return $family->getSpouse($this); @@ -825,7 +825,7 @@ class Individual extends GedcomRecord { /** * Count the children belonging to this individual. * - * @return integer + * @return int */ public function getNumberOfChildren() { if (preg_match('/\n1 NCHI (\d+)(?:\n|$)/', $this->getGedcom(), $match)) { @@ -845,7 +845,7 @@ class Individual extends GedcomRecord { /** * Get a list of this individual’s child families (i.e. their parents). * - * @param integer|null $access_level + * @param int|null $access_level * * @return Family[] */ @@ -919,7 +919,7 @@ class Individual extends GedcomRecord { */ public function getChildStepFamilies() { $step_families = array(); - $families = $this->getChildFamilies(); + $families = $this->getChildFamilies(); foreach ($families as $family) { $father = $family->getHusband(); if ($father) { @@ -949,7 +949,7 @@ class Individual extends GedcomRecord { */ public function getSpouseStepFamilies() { $step_families = array(); - $families = $this->getSpouseFamilies(); + $families = $this->getSpouseFamilies(); foreach ($families as $family) { $spouse = $family->getSpouse($this); if ($spouse) { @@ -1030,7 +1030,6 @@ class Individual extends GedcomRecord { } /** - * * @todo this function does not belong in this class * * @param Family $family @@ -1138,11 +1137,11 @@ class Individual extends GedcomRecord { //////////////////////////////////////////////////////////////////////////// $sublevel = 1 + (int) $gedcom[0]; - $NPFX = preg_match("/\n{$sublevel} NPFX (.+)/", $gedcom, $match) ? $match[1] : ''; - $GIVN = preg_match("/\n{$sublevel} GIVN (.+)/", $gedcom, $match) ? $match[1] : ''; - $SURN = preg_match("/\n{$sublevel} SURN (.+)/", $gedcom, $match) ? $match[1] : ''; - $NSFX = preg_match("/\n{$sublevel} NSFX (.+)/", $gedcom, $match) ? $match[1] : ''; - $NICK = preg_match("/\n{$sublevel} NICK (.+)/", $gedcom, $match) ? $match[1] : ''; + $NPFX = preg_match("/\n{$sublevel} NPFX (.+)/", $gedcom, $match) ? $match[1] : ''; + $GIVN = preg_match("/\n{$sublevel} GIVN (.+)/", $gedcom, $match) ? $match[1] : ''; + $SURN = preg_match("/\n{$sublevel} SURN (.+)/", $gedcom, $match) ? $match[1] : ''; + $NSFX = preg_match("/\n{$sublevel} NSFX (.+)/", $gedcom, $match) ? $match[1] : ''; + $NICK = preg_match("/\n{$sublevel} NICK (.+)/", $gedcom, $match) ? $match[1] : ''; // SURN is an comma-separated list of surnames... if ($SURN) { @@ -1210,7 +1209,7 @@ class Individual extends GedcomRecord { // Add placeholder for unknown given name if (!$GIVN) { $GIVN = '@P.N.'; - $pos = strpos($full, '/'); + $pos = strpos($full, '/'); $full = substr($full, 0, $pos) . '@P.N. ' . substr($full, $pos); } @@ -1255,7 +1254,7 @@ class Individual extends GedcomRecord { $full = preg_replace('/([^ >]*)\*/', '<span class="starredname">\\1</span>', $full); // Remove prefered-name indicater - they don’t go in the database - $GIVN = str_replace('*', '', $GIVN); + $GIVN = str_replace('*', '', $GIVN); $fullNN = str_replace('*', '', $fullNN); foreach ($SURNS as $SURN) { @@ -1312,20 +1311,20 @@ class Individual extends GedcomRecord { $char = ($bwidth / 6.5); } if ($this->canShowName()) { - $tmp = $this->getAllNames(); - $givn = $tmp[$this->getPrimaryName()]['givn']; - $surn = $tmp[$this->getPrimaryName()]['surname']; - $new_givn = explode(' ', $givn); + $tmp = $this->getAllNames(); + $givn = $tmp[$this->getPrimaryName()]['givn']; + $surn = $tmp[$this->getPrimaryName()]['surname']; + $new_givn = explode(' ', $givn); $count_givn = count($new_givn); - $len_givn = mb_strlen($givn); - $len_surn = mb_strlen($surn); - $len = $len_givn + $len_surn; - $i = 1; + $len_givn = mb_strlen($givn); + $len_surn = mb_strlen($surn); + $len = $len_givn + $len_surn; + $i = 1; while ($len > $char && $i <= $count_givn) { $new_givn[$count_givn - $i] = mb_substr($new_givn[$count_givn - $i], 0, 1); - $givn = implode(' ', $new_givn); - $len_givn = mb_strlen($givn); - $len = $len_givn + $len_surn; + $givn = implode(' ', $new_givn); + $len_givn = mb_strlen($givn); + $len = $len_givn + $len_surn; $i++; } $max_surn = $char - $i * 2; diff --git a/app/Log.php b/app/Log.php index b483be05ca..8cc7bae34f 100644 --- a/app/Log.php +++ b/app/Log.php @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - namespace Fisharebest\Webtrees; /** @@ -51,7 +50,7 @@ class Log { $message, WT_CLIENT_IP, Auth::id(), - $tree ? $tree->getTreeId() : null + $tree ? $tree->getTreeId() : null, )); } diff --git a/app/Mail.php b/app/Mail.php index a654d2efc9..fd32cc79b9 100644 --- a/app/Mail.php +++ b/app/Mail.php @@ -52,7 +52,7 @@ class Mail { * @param string $subject * @param string $message * - * @return boolean + * @return bool */ public static function send(Tree $tree, $to_email, $to_name, $replyto_email, $replyto_name, $subject, $message) { try { @@ -77,12 +77,12 @@ class Mail { /** * Send an automated system message (such as a password reminder) from a tree to a user. * - * @param Tree $tree - * @param User $user - * @param string $subject - * @param string $message + * @param Tree $tree + * @param User $user + * @param string $subject + * @param string $message * - * @return boolean + * @return bool */ public static function systemMessage(Tree $tree, User $user, $subject, $message) { return self::send( diff --git a/app/Media.php b/app/Media.php index 39607bf7bc..a4b9333044 100644 --- a/app/Media.php +++ b/app/Media.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class Media extends GedcomRecord { const RECORD_TYPE = 'OBJE'; - const URL_PREFIX = 'mediaviewer.php?mid='; + const URL_PREFIX = 'mediaviewer.php?mid='; // TODO: these should be private, with getTitle() and getFilename() functions /** @var string The "TITL" value from the GEDCOM */ @@ -74,7 +74,7 @@ class Media extends GedcomRecord { $linked_ids = Database::prepare( "SELECT l_from FROM `##link` WHERE l_to = ? AND l_file = ?" )->execute(array( - $this->xref, $this->tree->getTreeId() + $this->xref, $this->tree->getTreeId(), ))->fetchOneColumn(); foreach ($linked_ids as $linked_id) { $linked_record = GedcomRecord::getInstance($linked_id, $this->tree); @@ -241,7 +241,7 @@ class Media extends GedcomRecord { * * @param string $which specify either 'main' or 'thumb' * - * @return boolean + * @return bool */ public function fileExists($which = 'main') { return file_exists($this->getServerFilename($which)); @@ -249,6 +249,7 @@ class Media extends GedcomRecord { /** * Determine if the file is an external url + * * @return bool */ public function isExternal() { @@ -275,7 +276,7 @@ class Media extends GedcomRecord { * * @param string $which specify either 'main' or 'thumb' * - * @return integer + * @return int */ public function getFilesizeraw($which = 'main') { try { @@ -290,7 +291,7 @@ class Media extends GedcomRecord { * * @param string $which specify either 'main' or 'thumb' * - * @return integer + * @return int */ public function getFiletime($which = 'main') { try { @@ -323,7 +324,6 @@ class Media extends GedcomRecord { * Deprecated? This does not need to be a function here. * * @return string - * */ public function getMediaType() { if (preg_match('/\n\d TYPE (.+)/', $this->gedcom, $match)) { @@ -349,9 +349,9 @@ class Media extends GedcomRecord { /** * get image properties * - * @param string $which specify either 'main' or 'thumb' - * @param integer $addWidth amount to add to width - * @param integer $addHeight amount to add to height + * @param string $which specify either 'main' or 'thumb' + * @param int $addWidth amount to add to width + * @param int $addHeight amount to add to height * * @return array */ @@ -393,13 +393,13 @@ class Media extends GedcomRecord { if (!is_array($imgsize) || empty($imgsize['0'])) { // this is not an image, OR the file doesn’t exist OR it is a url - $imgsize[0] = 0; - $imgsize[1] = 0; - $imgsize['adjW'] = 0; - $imgsize['adjH'] = 0; - $imgsize['ext'] = ''; - $imgsize['mime'] = ''; - $imgsize['WxH'] = ''; + $imgsize[0] = 0; + $imgsize[1] = 0; + $imgsize['adjW'] = 0; + $imgsize['adjH'] = 0; + $imgsize['ext'] = ''; + $imgsize['mime'] = ''; + $imgsize['WxH'] = ''; $imgsize['imgWH'] = ''; if ($this->isExternal()) { // don’t let large external images break the dislay @@ -410,7 +410,7 @@ class Media extends GedcomRecord { if (empty($imgsize['mime'])) { // this is not an image, OR the file doesn’t exist OR it is a url // set file type equal to the file extension - can’t use parse_url because this may not be a full url - $exp = explode('?', $this->file); + $exp = explode('?', $this->file); $imgsize['ext'] = strtoupper(pathinfo($exp[0], PATHINFO_EXTENSION)); // all mimetypes we wish to serve with the media firewall must be added to this array. $mime = array( @@ -445,15 +445,15 @@ class Media extends GedcomRecord { /** * Generate a URL directly to the media file * - * @param string $which - * @param boolean $download + * @param string $which + * @param bool $download * * @return string */ public function getHtmlUrlDirect($which = 'main', $download = false) { // “cb” is “cache buster”, so clients will make new request if anything significant about the user or the file changes // The extension is there so that image viewers (e.g. colorbox) can do something sensible - $thumbstr = ($which == 'thumb') ? '&thumb=1' : ''; + $thumbstr = ($which == 'thumb') ? '&thumb=1' : ''; $downloadstr = ($download) ? '&dl=1' : ''; return @@ -546,7 +546,7 @@ class Media extends GedcomRecord { if ($this->isExternal() || !file_exists($this->getServerFilename('thumb'))) { // Use an icon $mime_type = str_replace('/', '-', $this->mimeType()); - $image = + $image = '<i' . ' dir="' . 'auto' . '"' . // For the tool-tip ' class="' . 'icon-mime-' . $mime_type . '"' . diff --git a/app/Menu.php b/app/Menu.php index a5459bd7bb..604c587b8b 100644 --- a/app/Menu.php +++ b/app/Menu.php @@ -117,9 +117,9 @@ class Menu { * @param string $iconclass */ public function addClass($menuclass, $submenuclass = '', $iconclass = '') { - $this->menuclass = $menuclass; + $this->menuclass = $menuclass; $this->submenuclass = $submenuclass; - $this->iconclass = $iconclass; + $this->iconclass = $iconclass; } /** diff --git a/app/Module.php b/app/Module.php index 61e794c3e5..2347a94715 100644 --- a/app/Module.php +++ b/app/Module.php @@ -49,7 +49,7 @@ class Module { Database::prepare( "UPDATE `##module` SET status = 'disabled' WHERE module_name = :module_name" )->execute(array( - 'module_name' => $module_name + 'module_name' => $module_name, )); } } @@ -85,7 +85,7 @@ class Module { $array = array(); foreach ($module_names as $module_name) { $interface = __NAMESPACE__ . '\Module' . ucfirst($component) . 'Interface'; - $module = self::getModuleByName($module_name); + $module = self::getModuleByName($module_name); if ($module instanceof $interface) { $array[$module_name] = $module; } @@ -123,7 +123,7 @@ class Module { $array = array(); foreach ($module_names as $module_name) { $interface = __NAMESPACE__ . '\Module' . ucfirst($component) . 'Interface'; - $module = self::getModuleByName($module_name); + $module = self::getModuleByName($module_name); if ($module instanceof $interface) { $array[$module_name] = $module; } @@ -325,9 +325,7 @@ class Module { * After creating a new family tree, we need to assign the default access * rights for each module. * - * @param integer $tree_id - * - * @return void + * @param int $tree_id */ public static function setDefaultAccess($tree_id) { foreach (self::getInstalledModules('disabled') as $module) { diff --git a/app/Module/AbstractModule.php b/app/Module/AbstractModule.php index 9f6d617a1e..c5a7a90314 100644 --- a/app/Module/AbstractModule.php +++ b/app/Module/AbstractModule.php @@ -40,7 +40,7 @@ abstract class AbstractModule { } /** - * @param integer $block_id + * @param int $block_id * @param string $setting_name * @param string|null $default_value * @@ -58,7 +58,7 @@ abstract class AbstractModule { } /** - * @param integer $block_id + * @param int $block_id * @param string $setting_name * @param string|null $setting_value * @@ -104,7 +104,7 @@ abstract class AbstractModule { * * Some modules are aimed at admins or managers, and are not generally shown to users. * - * @return integer + * @return int */ public function defaultAccessLevel() { // Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN @@ -125,8 +125,6 @@ abstract class AbstractModule { * * Since modules may have many settings, and will probably want to use * lots of them, load them all at once and cache them. - * - * @return void */ private function loadAllSettings() { if ($this->settings === null) { @@ -199,9 +197,9 @@ abstract class AbstractModule { * Get a the current access level for a module * * @param Tree $tree - * @param string $component - tab, block, menu, etc + * @param string $component tab, block, menu, etc * - * @return integer + * @return int */ public function getAccessLevel(Tree $tree, $component) { $access_level = Database::prepare( diff --git a/app/Module/AhnentafelReportModule.php b/app/Module/AhnentafelReportModule.php index 384b240d41..014442afb0 100644 --- a/app/Module/AhnentafelReportModule.php +++ b/app/Module/AhnentafelReportModule.php @@ -42,7 +42,7 @@ class AhnentafelReportModule extends AbstractModule implements ModuleReportInter global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/AlbumModule.php b/app/Module/AlbumModule.php index 1e6decc75e..2cfc5c2fa0 100644 --- a/app/Module/AlbumModule.php +++ b/app/Module/AlbumModule.php @@ -44,7 +44,6 @@ class AlbumModule extends AbstractModule implements ModuleTabInterface { return Auth::isEditor($WT_TREE) || $this->getMedia(); } - /** {@inheritdoc} */ public function isGrayedOut() { return !$this->getMedia(); @@ -153,6 +152,7 @@ class AlbumModule extends AbstractModule implements ModuleTabInterface { } $html .= '</ul>'; $html .= '</td></tr></table>'; + return $html; } @@ -197,6 +197,7 @@ class AlbumModule extends AbstractModule implements ModuleTabInterface { return array_search($x->getXref(), $wt_obje_sort) - array_search($y->getXref(), $wt_obje_sort); }); } + return $this->media_list; } diff --git a/app/Module/BatchUpdate/BatchUpdateBasePlugin.php b/app/Module/BatchUpdate/BatchUpdateBasePlugin.php index f65b74bd7a..c2fa070bdf 100644 --- a/app/Module/BatchUpdate/BatchUpdateBasePlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateBasePlugin.php @@ -68,11 +68,11 @@ class BatchUpdateBasePlugin { if (Auth::user()->getPreference('auto_accept')) { return array( BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'), - BatchUpdateModule::createSubmitButton(I18N::translate('Update all'), $xref, 'update_all') + BatchUpdateModule::createSubmitButton(I18N::translate('Update all'), $xref, 'update_all'), ); } else { return array( - BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update') + BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'), ); } } @@ -91,8 +91,8 @@ class BatchUpdateBasePlugin { $lcs = self::longestCommonSubsequence($old_lines, $new_lines, 0, count($old_lines) - 1, 0, count($new_lines) - 1); $diff_lines = array(); - $last_old = -1; - $last_new = -1; + $last_old = -1; + $last_new = -1; while ($lcs) { list($old, $new) = array_shift($lcs); while ($last_old < $old - 1) { @@ -102,8 +102,8 @@ class BatchUpdateBasePlugin { $diff_lines[] = self::decorateInsertedText($new_lines[++$last_new]); } $diff_lines[] = $new_lines[$new]; - $last_old = $old; - $last_new = $new; + $last_old = $old; + $last_new = $new; } while ($last_old < count($old_lines) - 1) { $diff_lines[] = self::decorateDeletedText($old_lines[++$last_old]); @@ -120,10 +120,10 @@ class BatchUpdateBasePlugin { * * @param string[] $X * @param string[] $Y - * @param integer $x1 - * @param integer $x2 - * @param integer $y1 - * @param integer $y2 + * @param int $x1 + * @param int $x2 + * @param int $y1 + * @param int $y2 * * @return array */ @@ -133,16 +133,19 @@ class BatchUpdateBasePlugin { // Match at start of sequence $tmp = self::longestCommonSubsequence($X, $Y, $x1 + 1, $x2, $y1 + 1, $y2); array_unshift($tmp, array($x1, $y1)); + return $tmp; } elseif ($X[$x2] == $Y[$y2]) { // Match at end of sequence $tmp = self::longestCommonSubsequence($X, $Y, $x1, $x2 - 1, $y1, $y2 - 1); array_push($tmp, array($x2, $y2)); + return $tmp; } else { // No match. Look for subsequences $tmp1 = self::longestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2 - 1); $tmp2 = self::longestCommonSubsequence($X, $Y, $x1, $x2 - 1, $y1, $y2); + return count($tmp1) > count($tmp2) ? $tmp1 : $tmp2; } } else { diff --git a/app/Module/BatchUpdate/BatchUpdateDuplicateLinksPlugin.php b/app/Module/BatchUpdate/BatchUpdateDuplicateLinksPlugin.php index 16a7542c8d..e767f015d7 100644 --- a/app/Module/BatchUpdate/BatchUpdateDuplicateLinksPlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateDuplicateLinksPlugin.php @@ -53,7 +53,7 @@ class BatchUpdateDuplicateLinksPlugin extends BatchUpdateBasePlugin { * @param string $xref * @param string $gedrec * - * @return boolean + * @return bool */ public function doesRecordNeedUpdate($xref, $gedrec) { return @@ -75,7 +75,7 @@ class BatchUpdateDuplicateLinksPlugin extends BatchUpdateBasePlugin { array( '/(\n1.*@.+@.*(?:(?:\n[2-9].*)*))((?:\n1.*(?:\n[2-9].*)*)*\1)/', '/(\n2.*@.+@.*(?:(?:\n[3-9].*)*))((?:\n2.*(?:\n[3-9].*)*)*\1)/', - '/(\n3.*@.+@.*(?:(?:\n[4-9].*)*))((?:\n3.*(?:\n[4-9].*)*)*\1)/' + '/(\n3.*@.+@.*(?:(?:\n[4-9].*)*))((?:\n3.*(?:\n[4-9].*)*)*\1)/', ), '$2', $gedrec diff --git a/app/Module/BatchUpdate/BatchUpdateMarriedNamesPlugin.php b/app/Module/BatchUpdate/BatchUpdateMarriedNamesPlugin.php index 371a11705f..3755863e80 100644 --- a/app/Module/BatchUpdate/BatchUpdateMarriedNamesPlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateMarriedNamesPlugin.php @@ -47,7 +47,7 @@ class BatchUpdateMarriedNamesPlugin extends BatchUpdateBasePlugin { * @param string $xref * @param string $gedrec * - * @return boolean + * @return bool */ public function doesRecordNeedUpdate($xref, $gedrec) { return preg_match('/^1 SEX F/m', $gedrec) && preg_match('/^1 NAME /m', $gedrec) && self::surnamesToAdd($xref, $gedrec); @@ -67,7 +67,7 @@ class BatchUpdateMarriedNamesPlugin extends BatchUpdateBasePlugin { $SURNAME_TRADITION = $WT_TREE->getPreference('SURNAME_TRADITION'); preg_match('/^1 NAME (.*)/m', $gedrec, $match); - $wife_name = $match[1]; + $wife_name = $match[1]; $married_names = array(); foreach (self::surnamesToAdd($xref, $gedrec) as $surname) { switch ($this->surname) { @@ -82,6 +82,7 @@ class BatchUpdateMarriedNamesPlugin extends BatchUpdateBasePlugin { break; } } + return preg_replace('/(^1 NAME .*([\r\n]+[2-9].*)*)/m', '\\1' . implode('', $married_names), $gedrec, 1); } @@ -92,14 +93,14 @@ class BatchUpdateMarriedNamesPlugin extends BatchUpdateBasePlugin { * @return string[] */ private function surnamesToAdd($xref, $gedrec) { - $wife_surnames = self::surnames($xref, $gedrec); - $husb_surnames = array(); + $wife_surnames = self::surnames($xref, $gedrec); + $husb_surnames = array(); $missing_surnames = array(); preg_match_all('/^1 FAMS @(.+)@/m', $gedrec, $fmatch); foreach ($fmatch[1] as $famid) { $famrec = BatchUpdateModule::getLatestRecord($famid, 'FAM'); if (preg_match('/^1 MARR/m', $famrec) && preg_match('/^1 HUSB @(.+)@/m', $famrec, $hmatch)) { - $husbrec = BatchUpdateModule::getLatestRecord($hmatch[1], 'INDI'); + $husbrec = BatchUpdateModule::getLatestRecord($hmatch[1], 'INDI'); $husb_surnames = array_unique(array_merge($husb_surnames, self::surnames($hmatch[1], $husbrec))); } } diff --git a/app/Module/BatchUpdate/BatchUpdateMissingDeathPlugin.php b/app/Module/BatchUpdate/BatchUpdateMissingDeathPlugin.php index cdee3380d2..ecbed8795a 100644 --- a/app/Module/BatchUpdate/BatchUpdateMissingDeathPlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateMissingDeathPlugin.php @@ -44,7 +44,7 @@ class BatchUpdateMissingDeathPlugin extends BatchUpdateBasePlugin { * @param string $xref * @param string $gedrec * - * @return boolean + * @return bool */ public function doesRecordNeedUpdate($xref, $gedrec) { global $WT_TREE; diff --git a/app/Module/BatchUpdate/BatchUpdateNameFormatPlugin.php b/app/Module/BatchUpdate/BatchUpdateNameFormatPlugin.php index c3728070d0..27d3c03526 100644 --- a/app/Module/BatchUpdate/BatchUpdateNameFormatPlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateNameFormatPlugin.php @@ -44,7 +44,7 @@ class BatchUpdateNameFormatPlugin extends BatchUpdateBasePlugin { * @param string $xref * @param string $gedrec * - * @return boolean + * @return bool */ public function doesRecordNeedUpdate($xref, $gedrec) { return diff --git a/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php b/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php index 2a032c24f4..c022c428fc 100644 --- a/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php @@ -60,7 +60,7 @@ class BatchUpdateSearchReplacePlugin extends BatchUpdateBasePlugin { * @param string $xref * @param string $gedrec * - * @return boolean + * @return bool */ public function doesRecordNeedUpdate($xref, $gedrec) { return !$this->error && preg_match('/(?:' . $this->regex . ')/mu' . $this->case, $gedrec); diff --git a/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php b/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php index ca6f82b9a0..d2d743a4a9 100644 --- a/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php +++ b/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php @@ -42,7 +42,7 @@ class BirthDeathMarriageReportModule extends AbstractModule implements ModuleRep global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/BatchUpdateModule.php b/app/Module/BatchUpdateModule.php index 414872a83c..431d956d41 100644 --- a/app/Module/BatchUpdateModule.php +++ b/app/Module/BatchUpdateModule.php @@ -118,7 +118,7 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface $this->xref = $this->findNextXref($this->xref); break; case 'update_all': - foreach ($this->all_xrefs as $xref=>$type) { + foreach ($this->all_xrefs as $xref => $type) { $record = self::getLatestRecord($xref, $type); if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) { $newrecord = $this->PLUGIN->updateRecord($xref, $record); @@ -173,7 +173,7 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface $html .= '<option value="" selected></option>'; } - foreach ($this->plugins as $class=>$plugin) { + foreach ($this->plugins as $class => $plugin) { $html .= '<option value="' . $class . '" ' . ($this->plugin == $class ? 'selected' : '') . '>' . $plugin->getName() . '</option>'; } $html .= '</select>'; @@ -235,6 +235,7 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface } } } + return null; } @@ -254,6 +255,7 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface } } } + return null; } @@ -263,28 +265,28 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface private function getAllXrefs() { global $WT_TREE; - $sql = array(); + $sql = array(); $vars = array(); foreach ($this->PLUGIN->getRecordTypesToUpdate() as $type) { switch ($type) { case 'INDI': - $sql[] = "SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?"; + $sql[] = "SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?"; $vars[] = $WT_TREE->getTreeId(); break; case 'FAM': - $sql[] = "SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?"; + $sql[] = "SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?"; $vars[] = $WT_TREE->getTreeId(); break; case 'SOUR': - $sql[] = "SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?"; + $sql[] = "SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?"; $vars[] = $WT_TREE->getTreeId(); break; case 'OBJE': - $sql[] = "SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?"; + $sql[] = "SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?"; $vars[] = $WT_TREE->getTreeId(); break; default: - $sql[] = "SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?"; + $sql[] = "SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?"; $vars[] = $type; $vars[] = $type; $vars[] = $WT_TREE->getTreeId(); @@ -303,11 +305,11 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface * @return BatchUpdateBasePlugin[] */ private function getPluginList() { - $plugins = array(); + $plugins = array(); $dir_handle = opendir(__DIR__ . '/BatchUpdate'); while (($file = readdir($dir_handle)) !== false) { if (substr($file, -10) == 'Plugin.php' && $file !== 'BatchUpdateBasePlugin.php') { - $class = __NAMESPACE__ . '\\' . basename($file, '.php'); + $class = __NAMESPACE__ . '\\' . basename($file, '.php'); $plugins[$class] = new $class; } } @@ -387,5 +389,4 @@ class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface return 'module.php?mod=' . $this->getName() . '&mod_action=admin_batch_update'; } - } diff --git a/app/Module/BirthReportModule.php b/app/Module/BirthReportModule.php index 7c7bea4ebe..ec14fa1e41 100644 --- a/app/Module/BirthReportModule.php +++ b/app/Module/BirthReportModule.php @@ -42,7 +42,7 @@ class BirthReportModule extends AbstractModule implements ModuleReportInterface global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/CemeteryReportModule.php b/app/Module/CemeteryReportModule.php index c26bcf70a2..d7e3cc52ab 100644 --- a/app/Module/CemeteryReportModule.php +++ b/app/Module/CemeteryReportModule.php @@ -42,7 +42,7 @@ class CemeteryReportModule extends AbstractModule implements ModuleReportInterfa global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/CensusAssistantModule.php b/app/Module/CensusAssistantModule.php index 2775f4be84..b64b57b536 100644 --- a/app/Module/CensusAssistantModule.php +++ b/app/Module/CensusAssistantModule.php @@ -54,7 +54,7 @@ class CensusAssistantModule extends AbstractModule { */ private static function mediaFind() { global $WT_TREE; - + $controller = new SimpleController; $filter = Filter::get('filter'); $multiple = Filter::getBool('multiple'); @@ -116,7 +116,7 @@ class CensusAssistantModule extends AbstractModule { echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; echo "<br>"; - $filter = trim($filter); + $filter = trim($filter); $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); echo "<table class=\"tabs_table width90\"><tr>"; $myindilist = search_indis_names($filter_array, array($WT_TREE)); @@ -126,13 +126,13 @@ class CensusAssistantModule extends AbstractModule { foreach ($myindilist as $indi) { $nam = Filter::escapeHtml($indi->getFullName()); echo "<li><a href=\"#\" onclick=\"pasterow( - '".$indi->getXref() . "' , - '".$nam . "' , - '".$indi->getSex() . "' , - '".$indi->getbirthyear() . "' , - '".(1901 - $indi->getbirthyear()) . "' , - '".$indi->getbirthplace() . "'); return false;\"> - <b>".$indi->getFullName() . "</b> "; + '" . $indi->getXref() . "' , + '" . $nam . "' , + '" . $indi->getSex() . "' , + '" . $indi->getbirthyear() . "' , + '" . (1901 - $indi->getbirthyear()) . "' , + '" . $indi->getbirthplace() . "'); return false;\"> + <b>" . $indi->getFullName() . "</b> "; $born = GedcomTag::getLabel('BIRT'); echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getbirthyear(), " ", $indi->getbirthplace(), "</span></a></li>"; @@ -268,7 +268,7 @@ class CensusAssistantModule extends AbstractModule { $postamble = Filter::escapeHtml($match[5]); $fmt_headers = array(); - foreach ($headers as $key=>$value) { + foreach ($headers as $key => $value) { $fmt_headers['.b.' . $key] = '<span title="' . Filter::escapeHtml($value) . '">' . $key . '</span>'; } diff --git a/app/Module/ChangeReportModule.php b/app/Module/ChangeReportModule.php index f4f570b232..65f22614c4 100644 --- a/app/Module/ChangeReportModule.php +++ b/app/Module/ChangeReportModule.php @@ -42,7 +42,7 @@ class ChangeReportModule extends AbstractModule implements ModuleReportInterface global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/ChartsBlockModule.php b/app/Module/ChartsBlockModule.php index 9ae2aba114..68a67a977e 100644 --- a/app/Module/ChartsBlockModule.php +++ b/app/Module/ChartsBlockModule.php @@ -56,7 +56,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { $person = Individual::getInstance($pid, $WT_TREE); } - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype == 'gedcom' && Auth::isManager($WT_TREE) || $ctype == 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; @@ -110,7 +110,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { case 'treenav': $title .= I18N::translate('Interactive tree of %s', $person->getFullName()); $mod = new InteractiveTreeModule(WT_MODULES_DIR . 'tree'); - $tv = new TreeView; + $tv = new TreeView; $content .= '<td>'; $content .= '<script>jQuery("head").append(\'<link rel="stylesheet" href="' . $mod->css() . '" type="text/css" />\');</script>'; $content .= '<script src="' . $mod->js() . '"></script>'; @@ -175,7 +175,8 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { 'pedigree' => I18N::translate('Pedigree'), 'descendants' => I18N::translate('Descendants'), 'hourglass' => I18N::translate('Hourglass chart'), - 'treenav' => I18N::translate('Interactive tree')), + 'treenav' => I18N::translate('Interactive tree'), + ), null, $type); ?> </td> </tr> diff --git a/app/Module/CkeditorModule.php b/app/Module/CkeditorModule.php index 47d503c1fe..d2cd3ab9f8 100644 --- a/app/Module/CkeditorModule.php +++ b/app/Module/CkeditorModule.php @@ -37,8 +37,6 @@ class CkeditorModule extends AbstractModule { * before we have sent the page footer. * * @param BaseController $controller - * - * @return void */ public static function enableEditor($controller) { $controller diff --git a/app/Module/ClippingsCart/ClippingsCart.php b/app/Module/ClippingsCart/ClippingsCart.php index 67c463aa3f..b4d98034f6 100644 --- a/app/Module/ClippingsCart/ClippingsCart.php +++ b/app/Module/ClippingsCart/ClippingsCart.php @@ -46,13 +46,13 @@ class ClippingsCart { /** @var string Whether to download as ZIP file */ private $Zip; - /** @var integer The number of ancestor generations (individuals) to add */ + /** @var int The number of ancestor generations (individuals) to add */ public $level1; - /** @var integer The number of ancestor generations (families) to add */ + /** @var int The number of ancestor generations (families) to add */ public $level2; - /** @var integer The number of descendent generations to add */ + /** @var int The number of descendent generations to add */ public $level3; /** @@ -215,7 +215,7 @@ class ClippingsCart { $record = str_replace($match[0], '', $record); } } - $record = convert_media_path($record, $this->conv_path); + $record = convert_media_path($record, $this->conv_path); $savedRecord = $record; // Save this for the "does this file exist" check if ($convert === 'yes') { $record = utf8_decode($record); @@ -239,7 +239,7 @@ class ClippingsCart { // This autoloads the PclZip library, so we can use its constants. new PclZip(''); - $ft = preg_match_all("/\n\d FILE (.+)/", $savedRecord, $match, PREG_SET_ORDER); + $ft = preg_match_all("/\n\d FILE (.+)/", $savedRecord, $match, PREG_SET_ORDER); $MEDIA_DIRECTORY = $WT_TREE->getPreference('MEDIA_DIRECTORY'); for ($k = 0; $k < $ft; $k++) { // Skip external files and non-existant files @@ -270,7 +270,7 @@ class ClippingsCart { } $filetext .= "0 TRLR\n"; //-- make sure the preferred line endings are used - $filetext = preg_replace("/[\r\n]+/", WT_EOL, $filetext); + $filetext = preg_replace("/[\r\n]+/", WT_EOL, $filetext); $this->download_data = $filetext; $this->downloadClipping(); } @@ -281,23 +281,23 @@ class ClippingsCart { */ private function zipCart() { $tempFileName = 'clipping' . rand() . '.ged'; - $fp = fopen(WT_DATA_DIR . $tempFileName, "wb"); + $fp = fopen(WT_DATA_DIR . $tempFileName, "wb"); if ($fp) { flock($fp, LOCK_EX); fwrite($fp, $this->download_data); flock($fp, LOCK_UN); fclose($fp); $zipName = "clippings" . rand(0, 1500) . ".zip"; - $fname = WT_DATA_DIR . $zipName; + $fname = WT_DATA_DIR . $zipName; $comment = "Created by " . WT_WEBTREES . " " . WT_VERSION . " on " . date("d M Y") . "."; $archive = new PclZip($fname); // add the ged file to the root of the zip file (strip off the data folder) $this->media_list[] = array(\PCLZIP_ATT_FILE_NAME => WT_DATA_DIR . $tempFileName, \PCLZIP_ATT_FILE_NEW_FULL_NAME => $tempFileName); - $v_list = $archive->create($this->media_list, \PCLZIP_OPT_COMMENT, $comment); + $v_list = $archive->create($this->media_list, \PCLZIP_OPT_COMMENT, $comment); if ($v_list == 0) { echo "Error : " . $archive->errorInfo(true) . "</td></tr>"; } else { - $openedFile = fopen($fname, "rb"); + $openedFile = fopen($fname, "rb"); $this->download_data = fread($openedFile, filesize($fname)); fclose($openedFile); unlink($fname); @@ -334,7 +334,7 @@ class ClippingsCart { */ public function addClipping(GedcomRecord $record) { if ($record->canShowName()) { - $cart = Session::get('cart'); + $cart = Session::get('cart'); $cart[$record->getTree()->getTreeId()][$record->getXref()] = true; // Add directly linked records preg_match_all('/\n\d (?:OBJE|NOTE|SOUR|REPO) @(' . WT_REGEX_XREF . ')@/', $record->getGedcom(), $matches); @@ -349,7 +349,7 @@ class ClippingsCart { * Recursive function to traverse the tree * * @param Family|null $family - * @param integer $level + * @param int $level */ public function addFamilyDescendancy(Family $family = null, $level = PHP_INT_MAX) { if (!$family) { @@ -391,7 +391,7 @@ class ClippingsCart { * Recursively add direct-line ancestors to cart * * @param Individual|null $person - * @param integer $level + * @param int $level */ public function addAncestorsToCart(Individual $person = null, $level = 0) { if (!$person) { @@ -411,7 +411,7 @@ class ClippingsCart { * Recursively adds direct-line ancestors and their families to the cart * * @param Individual|null $person - * @param integer $level + * @param int $level */ public function addAncestorsToCartFamilies(Individual $person = null, $level = 0) { if (!$person) { @@ -432,7 +432,7 @@ class ClippingsCart { * @param string $a * @param string $b * - * @return integer + * @return int */ private static function compareClippings($a, $b) { global $WT_TREE; diff --git a/app/Module/ClippingsCartModule.php b/app/Module/ClippingsCartModule.php index c2190696cc..087e11d144 100644 --- a/app/Module/ClippingsCartModule.php +++ b/app/Module/ClippingsCartModule.php @@ -20,7 +20,6 @@ namespace Fisharebest\Webtrees; * Class ClippingsCartModule */ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, ModuleSidebarInterface { - /** {@inheritdoc} */ public function getTitle() { return /* I18N: Name of a module */ I18N::translate('Clippings cart'); @@ -49,7 +48,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); - $cart = Session::get('cart'); + $cart = Session::get('cart'); $clip_ctrl = new ClippingsCart; $controller = new PageController; @@ -472,6 +471,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, $submenu = new Menu(I18N::translate('Add to the clippings cart'), 'module.php?mod=clippings&mod_action=index&action=add&id=' . $controller->record->getXref(), 'menu-clippingsadd'); $menu->addSubmenu($submenu); } + return $menu; } @@ -530,7 +530,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, } elseif ($add1) { $record = Individual::getInstance($add1, $WT_TREE); if ($record) { - $clip_ctrl->id = $record->getXref(); + $clip_ctrl->id = $record->getXref(); $clip_ctrl->type = $record::RECORD_TYPE; if ($others == 'parents') { foreach ($record->getChildFamilies() as $family) { @@ -629,6 +629,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) { $out .= '<br><a href="module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&add=' . $pid . '&pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>'; } + return $out; } @@ -651,14 +652,14 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, $out .= '<form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> - <input type="hidden" name="pid" value="' .$pid . '"> + <input type="hidden" name="pid" value="' . $pid . '"> <input type="hidden" name="action" value="download"> <table> - <tr><td colspan="2" class="topbottombar"><h2>'. I18N::translate('Download') . '</h2></td></tr> - <tr><td class="descriptionbox width50 wrap">'. I18N::translate('Zip file(s)') . '</td> + <tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr> + <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td> <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr> - <tr><td class="descriptionbox width50 wrap">'. I18N::translate('Include media (automatically zips files)') . '</td> + <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td> <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr> '; @@ -681,23 +682,23 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, } $out .= ' - <tr><td class="descriptionbox width50 wrap">'. I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td> + <tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td> <td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr> <tr> - <td class="descriptionbox width50 wrap">'. I18N::translate('Add the GEDCOM media path to filenames') . '</td> + <td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '"> <span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td> </tr> - <input type="hidden" name="conv_path" value="'.$clip_ctrl->conv_path . '"> + <input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '"> </td></tr> <tr><td class="topbottombar" colspan="2"> - <input type="button" value="'. I18N::translate('Cancel') . '" onclick="cancelDownload();"> - <input type="submit" value="'. I18N::translate('Download') . '"> + <input type="button" value="' . I18N::translate('Cancel') . '" onclick="cancelDownload();"> + <input type="submit" value="' . I18N::translate('Download') . '"> </form>'; return $out; diff --git a/app/Module/DeathReportModule.php b/app/Module/DeathReportModule.php index 84bc6f4079..2c24edc056 100644 --- a/app/Module/DeathReportModule.php +++ b/app/Module/DeathReportModule.php @@ -42,7 +42,7 @@ class DeathReportModule extends AbstractModule implements ModuleReportInterface global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/DescendancyModule.php b/app/Module/DescendancyModule.php index 3d5a08bb7c..99b2bea9d4 100644 --- a/app/Module/DescendancyModule.php +++ b/app/Module/DescendancyModule.php @@ -125,7 +125,7 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface /** * @param Individual $person - * @param integer $generations + * @param int $generations * * @return string */ @@ -148,7 +148,7 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface /** * @param Family $family * @param Individual $person - * @param integer $generations + * @param int $generations * * @return string */ @@ -163,7 +163,7 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface } $marryear = $family->getMarriageYear(); - $marr = $marryear ? '<i class="icon-rings"></i>' . $marryear : ''; + $marr = $marryear ? '<i class="icon-rings"></i>' . $marryear : ''; return '<li class="sb_desc_indi_li">' . @@ -212,7 +212,7 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface /** * @param Individual $person - * @param integer $generations + * @param int $generations * * @return string */ @@ -231,8 +231,8 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface } /** - * @param Family $family - * @param integer $generations + * @param Family $family + * @param int $generations * * @return string */ diff --git a/app/Module/DescendancyReportModule.php b/app/Module/DescendancyReportModule.php index 82b4b2c558..b7ea4b7a20 100644 --- a/app/Module/DescendancyReportModule.php +++ b/app/Module/DescendancyReportModule.php @@ -42,7 +42,7 @@ class DescendancyReportModule extends AbstractModule implements ModuleReportInte global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/ExtraInformationModule.php b/app/Module/ExtraInformationModule.php index 30d2e8148f..12f91ab546 100644 --- a/app/Module/ExtraInformationModule.php +++ b/app/Module/ExtraInformationModule.php @@ -75,7 +75,7 @@ class ExtraInformationModule extends AbstractModule implements ModuleSidebarInte * * @param Fact $fact * - * @return boolean + * @return bool */ public static function showFact(Fact $fact) { switch ($fact->getTag()) { diff --git a/app/Module/FactSourcesReportModule.php b/app/Module/FactSourcesReportModule.php index 2fdfe299d0..4949828c74 100644 --- a/app/Module/FactSourcesReportModule.php +++ b/app/Module/FactSourcesReportModule.php @@ -42,7 +42,7 @@ class FactSourcesReportModule extends AbstractModule implements ModuleReportInte global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/FamiliesSidebarModule.php b/app/Module/FamiliesSidebarModule.php index 8451a4ca41..90a7c391f9 100644 --- a/app/Module/FamiliesSidebarModule.php +++ b/app/Module/FamiliesSidebarModule.php @@ -104,7 +104,7 @@ class FamiliesSidebarModule extends AbstractModule implements ModuleSidebarInter if (!famloadedNames[surname]) { jQuery.ajax({ - url: "module.php?mod='.$this->getName() . '&mod_action=ajax&sb_action=families&alpha="+alpha+"&surname="+surname, + url: "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=families&alpha="+alpha+"&surname="+surname, cache: false, success: function(html) { jQuery("#sb_fam_"+surname+" div").html(html); @@ -129,7 +129,7 @@ class FamiliesSidebarModule extends AbstractModule implements ModuleSidebarInter '); $out = '<form method="post" action="module.php?mod=' . $this->getName() . '&mod_action=ajax" onsubmit="return false;"><input type="search" name="sb_fam_name" id="sb_fam_name" placeholder="' . I18N::translate('Search') . '"><p>'; - foreach ($initials as $letter=>$count) { + foreach ($initials as $letter => $count) { switch ($letter) { case '@': $html = $UNKNOWN_NN; @@ -163,7 +163,7 @@ class FamiliesSidebarModule extends AbstractModule implements ModuleSidebarInter */ private function getAlphaSurnames(Tree $tree, $alpha) { $surnames = QueryName::surnames($tree, '', $alpha, true, true); - $out = '<ul>'; + $out = '<ul>'; foreach (array_keys($surnames) as $surname) { $out .= '<li id="sb_fam_' . $surname . '" class="sb_fam_surname_li"><a href="' . $surname . '" title="' . $surname . '" alt="' . $alpha . '" class="sb_fam_surname">' . $surname . '</a>'; $out .= '<div class="name_tree_div"></div>'; @@ -183,7 +183,7 @@ class FamiliesSidebarModule extends AbstractModule implements ModuleSidebarInter */ public function getSurnameFams(Tree $tree, $alpha, $surname) { $families = QueryName::families($tree, $surname, $alpha, '', true); - $out = '<ul>'; + $out = '<ul>'; foreach ($families as $family) { if ($family->canShowName()) { $out .= '<li><a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . ' '; @@ -233,17 +233,17 @@ class FamiliesSidebarModule extends AbstractModule implements ModuleSidebarInter $vars = array(); if (empty($ids)) { //-- no match : search for FAM id - $where = "f_id LIKE CONCAT('%', ?, '%')"; + $where = "f_id LIKE CONCAT('%', ?, '%')"; $vars[] = $query; } else { //-- search for spouses - $qs = implode(',', array_fill(0, count($ids), '?')); + $qs = implode(',', array_fill(0, count($ids), '?')); $where = "(f_husb IN ($qs) OR f_wife IN ($qs))"; - $vars = array_merge($vars, $ids, $ids); + $vars = array_merge($vars, $ids, $ids); } $vars[] = $tree->getTreeId(); - $rows = Database::prepare("SELECT f_id AS xref, f_file AS gedcom_id, f_gedcom AS gedcom FROM `##families` WHERE {$where} AND f_file=?") + $rows = Database::prepare("SELECT f_id AS xref, f_file AS gedcom_id, f_gedcom AS gedcom FROM `##families` WHERE {$where} AND f_file=?") ->execute($vars) ->fetchAll(); diff --git a/app/Module/FamilyGroupReportModule.php b/app/Module/FamilyGroupReportModule.php index 8c3194d381..ef956cbf80 100644 --- a/app/Module/FamilyGroupReportModule.php +++ b/app/Module/FamilyGroupReportModule.php @@ -42,7 +42,7 @@ class FamilyGroupReportModule extends AbstractModule implements ModuleReportInte global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&famid=' . $controller->getSignificantFamily()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/FamilyNavigatorModule.php b/app/Module/FamilyNavigatorModule.php index a707c2d82d..524bf18dbf 100644 --- a/app/Module/FamilyNavigatorModule.php +++ b/app/Module/FamilyNavigatorModule.php @@ -20,7 +20,6 @@ namespace Fisharebest\Webtrees; * Class FamilyNavigatorModule */ class FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInterface { - const TTL = "<div class='flyout2'>%s</div>"; const LNK = "<div class='flyout3' data-href='%s'>%s</div>"; const MSG = "<div class='flyout4'>(%s)</div>"; // class flyout4 not used in standard themes @@ -156,8 +155,8 @@ class FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInter } /** - * @param $person - * @param boolean $showUnknown + * @param $person + * @param bool $showUnknown * * @return string */ @@ -179,7 +178,7 @@ class FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInter private function getParents(Individual $person) { $father = null; $mother = null; - $html = sprintf(self::TTL, I18N::translate('Parents')); + $html = sprintf(self::TTL, I18N::translate('Parents')); $family = $person->getPrimaryChildFamily(); if (!Auth::isSearchEngine() && $person->canShowName() && $family !== null) { $father = $family->getHusband(); @@ -207,6 +206,7 @@ class FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInter if (!($father instanceof Individual || $mother instanceof Individual)) { $html .= sprintf(self::MSG, I18N::translateContext('unknown family', 'unknown')); } + return $html; } @@ -234,6 +234,7 @@ class FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInter if (!$html) { $html = sprintf(self::MSG, I18N::translate('none')); } + return sprintf(self::TTL, I18N::translate('Family')) . $html; } diff --git a/app/Module/FamilyTreeFavoritesModule.php b/app/Module/FamilyTreeFavoritesModule.php index 870864fc5e..de67daa00d 100644 --- a/app/Module/FamilyTreeFavoritesModule.php +++ b/app/Module/FamilyTreeFavoritesModule.php @@ -99,7 +99,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt $userfavs = array(); } - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = $this->getTitle(); @@ -111,7 +111,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt $content = ''; if ($userfavs) { - foreach ($userfavs as $key=>$favorite) { + foreach ($userfavs as $key => $favorite) { if (isset($favorite['id'])) { $key = $favorite['id']; } @@ -195,6 +195,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -234,9 +235,9 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt /** * Delete a favorite from the database * - * @param integer $favorite_id + * @param int $favorite_id * - * @return boolean + * @return bool */ public static function deleteFavorite($favorite_id) { return (bool) @@ -249,7 +250,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt * * @param $favorite * - * @return boolean + * @return bool */ public static function addFavorite($favorite) { // -- make sure a favorite is added @@ -288,7 +289,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt /** * Get favorites for a user or family tree * - * @param integer $gedcom_id + * @param int $gedcom_id * * @return string[][] */ diff --git a/app/Module/FamilyTreeStatisticsModule.php b/app/Module/FamilyTreeStatisticsModule.php index d7eec9541c..53c95b6bc1 100644 --- a/app/Module/FamilyTreeStatisticsModule.php +++ b/app/Module/FamilyTreeStatisticsModule.php @@ -65,7 +65,7 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn } } - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; @@ -81,7 +81,7 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn if ($show_last_update) { $content .= '<div>' . /* I18N: %s is a date */ I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>'; } -/** Responsive Design */ + /** Responsive Design */ $content .= '<div class="stat-table1">'; if ($stat_indi) { diff --git a/app/Module/FrequentlyAskedQuestionsModule.php b/app/Module/FrequentlyAskedQuestionsModule.php index 764c03908b..e0d6818875 100644 --- a/app/Module/FrequentlyAskedQuestionsModule.php +++ b/app/Module/FrequentlyAskedQuestionsModule.php @@ -78,7 +78,7 @@ class FrequentlyAskedQuestionsModule extends AbstractModule implements ModuleMen )->execute(array( 'tree_id' => Filter::postInteger('gedcom_id'), 'block_order' => Filter::postInteger('block_order'), - 'block_id' => $block_id + 'block_id' => $block_id, )); } else { Database::prepare( @@ -243,7 +243,7 @@ class FrequentlyAskedQuestionsModule extends AbstractModule implements ModuleMen )->execute(array( 'block_order' => $block_order, 'module_name_1' => $this->getName(), - 'module_name_2' => $this->getName() + 'module_name_2' => $this->getName(), ))->fetchOneRow(); if ($swap_block) { Database::prepare( diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php index bf06203da9..e7d266e3ce 100644 --- a/app/Module/GoogleMapsModule.php +++ b/app/Module/GoogleMapsModule.php @@ -37,14 +37,13 @@ use PDOException; * Hence, use "Google Maps™ mapping service" where appropriate. */ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, ModuleTabInterface { - /** @var array of ancestors of root person */ private $ancestors = array(); - /** @var integer Number of generation to display */ + /** @var int Number of generation to display */ private $generations; - /** @var integer Number of nodes in the chart */ + /** @var int Number of nodes in the chart */ private $treesize; /** {@inheritdoc} */ @@ -190,6 +189,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // end echo '</td></tr></table>'; echo '<script>loadMap();</script>'; + return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; } else { $html = '<table class="facts_table">'; @@ -200,6 +200,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $html .= '<a href="module.php?mod=googlemap&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>'; $html .= '</td></tr>'; } + return $html; } } @@ -270,10 +271,10 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $controller->pageHeader(); $map_types = array( - 'ROADMAP' => I18N::translate('Map'), + 'ROADMAP' => I18N::translate('Map'), 'SATELLITE' => I18N::translate('Satellite'), - 'HYBRID' => I18N::translate('Hybrid'), - 'TERRAIN' => I18N::translate('Terrain'), + 'HYBRID' => I18N::translate('Hybrid'), + 'TERRAIN' => I18N::translate('Terrain'), ); ?> @@ -320,7 +321,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, </tr> <tr> <th><?php echo /* I18N: http://en.wikipedia.org/wiki/Google_street_view */ I18N::translate('Google Street View™'); ?></th> - <td><?php echo radio_buttons('GM_USE_STREETVIEW', array(false=> I18N::translate('hide'), true=> I18N::translate('show')), $this->getSetting('GM_USE_STREETVIEW'), 'class="radio-inline"'); ?></td> + <td><?php echo radio_buttons('GM_USE_STREETVIEW', array(false => I18N::translate('hide'), true => I18N::translate('show')), $this->getSetting('GM_USE_STREETVIEW'), 'class="radio-inline"'); ?></td> </tr> <tr> <th><?php echo I18N::translate('Size of map (in pixels)'); ?></th> @@ -612,7 +613,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <?php } $countryList = array(); - $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/'); + $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/'); for ($i = 0; $i < count($country); $i++) { if (count(preg_grep('/' . $country[$i] . '/', $placesDir)) != 0) { $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $country[$i] . '/'); @@ -659,7 +660,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <td class="optionbox" colspan="4"> <select name="COUNTRYSELECT" dir="ltr" onchange="selectCountry()"> <option value="Countries"><?php echo I18N::translate('Countries'); ?></option> - <?php foreach ($countryList as $country_key=>$country_name) { + <?php foreach ($countryList as $country_key => $country_name) { echo '<option value="', $country_key, '" '; if ($countrySelected == $country_key) { echo 'selected'; @@ -703,7 +704,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <td class="optionbox" colspan="4"> <select name="STATESELECT" dir="ltr" onchange="selectCountry()"> <option value="States"><?php echo /* I18N: Part of a country, state/region/county */ I18N::translate('Subdivision'); ?></option> - <?php foreach ($stateList as $state_key=>$state_name) { + <?php foreach ($stateList as $state_key => $state_name) { echo '<option value="', $state_key, '" '; if ($stateSelected == $state_key) { echo 'selected'; @@ -745,10 +746,10 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); - $controller = new ChartController(); + $controller = new ChartController(); $this->generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); - $this->treesize = pow(2, $this->generations) - 1; - $this->ancestors = array_values($controller->sosaAncestors($this->generations)); + $this->treesize = pow(2, $this->generations) - 1; + $this->ancestors = array_values($controller->sosaAncestors($this->generations)); // Start of internal configuration variables // Limit this to match available number of icons. @@ -809,15 +810,15 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <!-- count records by type --> <?php - $curgen = 1; - $priv = 0; - $count = 0; + $curgen = 1; + $priv = 0; + $count = 0; $miscount = 0; - $missing = ''; + $missing = ''; $latlongval = array(); - $lat = array(); - $lon = array(); + $lat = array(); + $lon = array(); for ($i = 0; $i < ($this->treesize); $i++) { // -- check to see if we have moved to the next generation if ($i + 1 >= pow(2, $curgen)) {$curgen++; } @@ -941,7 +942,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // Set CSS styles for the DIV containing the control // Setting padding to 5 px will offset the control from the edge of the map 'controlDiv.style.paddingTop = "5px"; - controlDiv.style.paddingRight = "0px";'. + controlDiv.style.paddingRight = "0px";' . // Set CSS for the control border 'var controlUI = document.createElement("DIV"); controlUI.style.backgroundColor = "white"; @@ -953,15 +954,15 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, controlUI.style.cursor = "pointer"; controlUI.style.textAlign = "center"; controlUI.title = ""; - controlDiv.appendChild(controlUI);'. + controlDiv.appendChild(controlUI);' . // Set CSS for the control interior 'var controlText = document.createElement("DIV"); controlText.style.fontFamily = "Arial,sans-serif"; controlText.style.fontSize = "12px"; controlText.style.paddingLeft = "15px"; controlText.style.paddingRight = "15px"; - controlText.innerHTML = "<b>'. I18N::translate('Redraw map') . '<\/b>"; - controlUI.appendChild(controlText);'. + controlText.innerHTML = "<b>' . I18N::translate('Redraw map') . '<\/b>"; + controlUI.appendChild(controlText);' . // Setup the click event listeners: simply set the map to original LatLng 'google.maps.event.addDomListener(controlUI, "click", function() { pm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN), @@ -972,14 +973,14 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, document.getElementById(lastlinkid).className = "person_box:target"; } }); - }'. + }' . // This function picks up the click and opens the corresponding info window 'function myclick(i) { if (document.getElementById(lastlinkid) != null) { document.getElementById(lastlinkid).className = "person_box:target"; } google.maps.event.trigger(gmarkers[i], "click"); - }'. + }' . // this variable will collect the html which will eventually be placed in the side_bar 'var side_bar_html = "";' . // arrays to hold copies of the markers and html used by the side_bar @@ -987,7 +988,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, 'var gmarkers = []; var i = 0; var lastlinkid; - var infowindow = new google.maps.InfoWindow({});'. + var infowindow = new google.maps.InfoWindow({});' . // === Create an associative array of GIcons() 'var gicons = []; gicons["1"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon1.png") @@ -1247,10 +1248,10 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor - );'. + );' . // / A function to create the marker and set up the event window 'function createMarker(point, name, html, mhtml, icontype) { - var contentString = "<div id=\'iwcontent_edit\'>"+mhtml+"<\/div>";'. + var contentString = "<div id=\'iwcontent_edit\'>"+mhtml+"<\/div>";' . // Create a marker with the requested icon 'var marker = new google.maps.Marker({ icon: gicons[icontype], @@ -1269,14 +1270,14 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, document.getElementById(lastlinkid).className = "person_box:target"; } lastlinkid=linkid; - });'. + });' . // save the info we need to use later for the side_bar 'gmarkers[i] = marker;' . // add a line to the side_bar html 'side_bar_html += "<br><div id=\'"+linkid+"\' onclick=\'myclick(" + i + ")\'>" + html +"<br></div>"; i++; return marker; - };'. + };' . // create the map 'var myOptions = { zoom: 6, @@ -1298,12 +1299,12 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, document.getElementById(lastlinkid).className = "person_box:target"; } infowindow.close(); - });'. + });' . // Create the DIV to hold the control and call HomeControl() passing in this DIV. -- 'var homeControlDiv = document.createElement("DIV"); var homeControl = new HomeControl(homeControlDiv, pm_map); homeControlDiv.index = 1; - pm_map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);'. + pm_map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);' . // create the map bounds 'var bounds = new google.maps.LatLngBounds();'; // add the points @@ -1393,9 +1394,9 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $js .= ' var linecolor; var plines; - var lines = [new google.maps.LatLng('.$lat[$i] . ',' . $lon[$i] . '), - new google.maps.LatLng('.$lat[$to_child] . ',' . $lon[$to_child] . ')]; - linecolor = "'.$colored_line[$curgen] . '"; + var lines = [new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . '), + new google.maps.LatLng(' . $lat[$to_child] . ',' . $lon[$to_child] . ')]; + linecolor = "' . $colored_line[$curgen] . '"; plines = new google.maps.Polygon({ paths: lines, strokeColor: linecolor, @@ -1420,17 +1421,17 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // Close the sidebar highlight when the infowindow is closed 'google.maps.event.addListener(infowindow, "closeclick", function() { document.getElementById(lastlinkid).className = "person_box:target"; - });'. + });' . // put the assembled side_bar_html contents into the side_bar div 'document.getElementById("side_bar").innerHTML = side_bar_html;' . // create the context menu div 'var contextmenu = document.createElement("div"); contextmenu.style.visibility="hidden"; - contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'> '. I18N::translate('Zoom in') . ' </div></a>" - + "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'> '. I18N::translate('Zoom out') . ' </div></a>" - + "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'> '. I18N::translate('Zoom in here') . '</div></a>" - + "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'> '. I18N::translate('Zoom out here') . ' </div></a>" - + "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'> '. I18N::translate('Center map here') . ' </div></a>";' . + contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'> ' . I18N::translate('Zoom in') . ' </div></a>" + + "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'> ' . I18N::translate('Zoom out') . ' </div></a>" + + "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'> ' . I18N::translate('Zoom in here') . '</div></a>" + + "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'> ' . I18N::translate('Zoom out here') . ' </div></a>" + + "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'> ' . I18N::translate('Center map here') . ' </div></a>";' . // listen for singlerightclick 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {' . // store the "pixel" info in case we need it later @@ -1446,7 +1447,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, pos.apply(contextmenu); contextmenu.style.visibility = "visible"; }); - '. + ' . // functions that perform the context menu options 'function zoomIn() {' . // perform the requested operation @@ -1454,34 +1455,34 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } - function zoomOut() {'. + function zoomOut() {' . // perform the requested operation 'pm_map.zoomOut();' . // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } - function zoomInHere() {'. + function zoomInHere() {' . // perform the requested operation 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel) - pm_map.zoomIn(point,true);'. + pm_map.zoomIn(point,true);' . // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } - function zoomOutHere() {'. + function zoomOutHere() {' . // perform the requested operation 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel) - pm_map.setCenter(point,pm_map.getZoom()-1);'. + pm_map.setCenter(point,pm_map.getZoom()-1);' . // There is no pm_map.zoomOut() equivalent // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } - function centreMapHere() {'. + function centreMapHere() {' . // perform the requested operation 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel) - pm_map.setCenter(point);'. + pm_map.setCenter(point);' . // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; - }'. + }' . // If the user clicks on the map, close the context menu 'google.maps.event.addListener(pm_map, "click", function() { contextmenu.style.visibility="hidden"; @@ -1548,7 +1549,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <option value="XYZ">', I18N::translate('All'), '</option>'; $rows = Database::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place") ->fetchAssoc(); - foreach ($rows as $id=>$place) { + foreach ($rows as $id => $place) { echo '<option value="', Filter::escapeHtml($place), '" '; if ($place == $country) { echo 'selected'; @@ -1586,7 +1587,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, echo '<div id="gm_check_title">', Tree::findById($gedcom_id)->getTitleHtml(), '</div>'; //Select all '2 PLAC ' tags in the file and create array $place_list = array(); - $ged_data = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") + $ged_data = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") ->execute(array("%\n2 PLAC %", $gedcom_id)) ->fetchOneColumn(); foreach ($ged_data as $ged_datum) { @@ -1623,11 +1624,11 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $i = count($place_list); //calculate maximum no. of levels to display - $x = 0; + $x = 0; $max = 0; while ($x < $i) { - $levels = explode(",", $place_list[$x]); - $parts = count($levels); + $levels = explode(",", $place_list[$x]); + $parts = count($levels); if ($parts > $max) $max = $parts; $x++; } $x = 0; @@ -1671,34 +1672,34 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } echo '</tr>'; $countrows = 0; - $matched = array(); + $matched = array(); while ($x < $i) { $placestr = ""; - $levels = explode(",", $place_list[$x]); - $parts = count($levels); - $levels = array_reverse($levels); + $levels = explode(",", $place_list[$x]); + $parts = count($levels); + $levels = array_reverse($levels); $placestr .= "<a href=\"placelist.php?action=show"; - foreach ($levels as $pindex=>$ppart) { + foreach ($levels as $pindex => $ppart) { $ppart = urlencode(trim($ppart)); $placestr .= "&parent[$pindex]=" . $ppart . ""; } $placestr .= "\">" . $place_list[$x] . "</a>"; - $gedplace = "<tr><td>" . $placestr . "</td>"; - $z = 0; - $id = 0; - $level = 0; + $gedplace = "<tr><td>" . $placestr . "</td>"; + $z = 0; + $id = 0; + $level = 0; $matched[$x] = 0; // used to exclude places where the gedcom place is matched at all levels $mapstr_edit = "<a href=\"#\" onclick=\"edit_place_location('"; - $mapstr_add = "<a href=\"#\" onclick=\"add_place_location('"; - $mapstr3 = ""; - $mapstr4 = ""; - $mapstr5 = "')\" title='"; - $mapstr6 = "' >"; - $mapstr7 = "')\">"; - $mapstr8 = "</a>"; - $plac = array(); - $lati = array(); - $long = array(); + $mapstr_add = "<a href=\"#\" onclick=\"add_place_location('"; + $mapstr3 = ""; + $mapstr4 = ""; + $mapstr5 = "')\" title='"; + $mapstr6 = "' >"; + $mapstr7 = "')\">"; + $mapstr8 = "</a>"; + $plac = array(); + $lati = array(); + $long = array(); while ($z < $parts) { if ($levels[$z] == ' ' || $levels[$z] == '') $levels[$z] = "unknown"; // GoogleMap module uses "unknown" while GEDCOM uses , , @@ -1706,7 +1707,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $levels[$z] = rtrim(ltrim($levels[$z])); $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1); // add the necessary prefix/postfix values to the place name - foreach ($placelist as $key=>$placename) { + foreach ($placelist as $key => $placename) { $row = Database::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") ->execute(array($z, $id, $placename)) @@ -1788,7 +1789,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, * * @param Individual $individual * - * @return boolean + * @return bool */ private function checkMapData(Individual $individual) { $statement = Database::prepare( @@ -1874,8 +1875,8 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** - * @param string $placename - * @param integer $level + * @param string $placename + * @param int $level * * @return string[] */ @@ -1943,7 +1944,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // Create the markers list array $gmarks = array(); - $i = 0; + $i = 0; foreach ($indifacts as $fact) { if (!$fact->getPlace()->isEmpty()) { @@ -2354,7 +2355,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // Add the markers to the map from the $gmarks array var locations = [ - <?php foreach ($gmarks as $n=>$gmark) { ?> + <?php foreach ($gmarks as $n => $gmark) { ?> <?php echo $n ? ',' : ''; ?> { "event": "<?php echo Filter::escapeJs($gmark['fact_label']); ?>", @@ -2495,7 +2496,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, /** * @param string $place * - * @return integer + * @return int */ private function getPlaceLocationId($place) { $par = explode(',', strip_tags($place)); @@ -2513,7 +2514,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $pl_id = (int) Database::prepare( "SELECT pl_id FROM `##placelocation` WHERE pl_level = :level AND pl_parent_id = :parent_id AND pl_place LIKE :placename" )->execute(array( - 'level' => $i, + 'level' => $i, 'parent_id' => $place_id, 'placename' => $placename, ))->fetchOne(); @@ -2533,7 +2534,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, /** * @param string $place * - * @return integer + * @return int */ private function getPlaceId($place) { global $WT_TREE; @@ -2550,8 +2551,8 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $pl_id = (int) Database::prepare( "SELECT p_id FROM `##places` WHERE p_parent_id = :place_id AND p_file = :tree_id AND p_place = :placename" )->execute(array( - 'place_id' => $place_id, - 'tree_id' => $WT_TREE->getTreeId(), + 'place_id' => $place_id, + 'tree_id' => $WT_TREE->getTreeId(), 'placename' => $placename, ))->fetchOne(); if ($pl_id) { @@ -2568,10 +2569,10 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** - * @param integer $level + * @param int $level * @param string[] $parent * - * @return integer + * @return int */ private function setPlaceIdMap($level, $parent) { $fullplace = ''; @@ -2588,10 +2589,10 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** - * @param integer $level + * @param int $level * @param string[] $parent * - * @return integer + * @return int */ private function setLevelMap($level, $parent) { $fullplace = ''; @@ -2620,7 +2621,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, global $level, $levelm, $plzoom, $controller, $WT_TREE; $STREETVIEW = $this->getSetting('GM_USE_STREETVIEW'); - $parent = Filter::getArray('parent'); + $parent = Filter::getArray('parent'); // create the map echo '<table style="margin:20px auto 0 auto;"><tr valign="top"><td>'; @@ -2740,8 +2741,8 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** - * @param integer $numls - * @param integer $levelm + * @param int $numls + * @param int $levelm * * @return integer[] */ @@ -2758,7 +2759,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** - * @param integer $level + * @param int $level * @param string[] $parent */ private function printHowManyPeople($level, $parent) { @@ -2785,12 +2786,12 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, /** * @param string[] $place2 - * @param integer $level + * @param int $level * @param string[] $parent - * @param integer $levelm + * @param int $levelm * @param string $linklevels * @param string $placelevels - * @param boolean $lastlevel + * @param bool $lastlevel */ private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel = false) { if (!$place2['lati'] || !$place2['long']) { @@ -2931,8 +2932,8 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, /** * Called by placelist.php * - * @param integer $numfound - * @param integer $level + * @param int $numfound + * @param int $level * @param string[] $parent * @param string $linklevels * @param string $placelevels @@ -2991,13 +2992,13 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // Creates a marker whose info window displays the given name function createMarker(point, html, icon, name) { // Choose icon and shadow ============ - if (icon.image && '.$level . '<=3) { - if (icon.image!="'.WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png") { + if (icon.image && ' . $level . '<=3) { + if (icon.image!="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png") { var iconImage = new google.maps.MarkerImage(icon.image, new google.maps.Size(25, 15), new google.maps.Point(0,0), new google.maps.Point(12, 15)); - var iconShadow = new google.maps.MarkerImage("'.WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/flag_shadow.png", + var iconShadow = new google.maps.MarkerImage("' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/flag_shadow.png", new google.maps.Size(35, 45), new google.maps.Point(0,0), new google.maps.Point(1, 45)); @@ -3063,10 +3064,10 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } '); - $levelm = $this->setLevelMap($level, $parent); + $levelm = $this->setLevelMap($level, $parent); if (isset($levelo[0])) $levelo[0] = 0; - $numls = count($parent) - 1; - $levelo = $this->checkWhereAmI($numls, $levelm); + $numls = count($parent) - 1; + $levelo = $this->checkWhereAmI($numls, $levelm); if ($numfound < 2 && ($level == 1 || !isset($levelo[$level - 1]))) { $controller->addInlineJavascript('map.maxZoom=6;'); } elseif ($numfound < 2 && !isset($levelo[$level - 2])) { @@ -3089,7 +3090,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // re-calculate the hierarchy information required to display the current place $thisloc = $parent; array_pop($thisloc); - $thislevel = $level - 1; + $thislevel = $level - 1; $thislinklevels = substr($linklevels, 0, strrpos($linklevels, '&')); if (strpos($placelevels, ',', 1)) { $thisplacelevels = substr($placelevels, strpos($placelevels, ',', 1)); @@ -3106,9 +3107,9 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // display any sub-places $placeidlist = array(); foreach ($place_names as $placename) { - $thisloc = $parent; - $thisloc[] = $placename; - $this_levelm = $this->setLevelMap($level + 1, $thisloc); + $thisloc = $parent; + $thisloc[] = $placename; + $this_levelm = $this->setLevelMap($level + 1, $thisloc); if ($this_levelm) $placeidlist[] = $this_levelm; } @@ -3143,7 +3144,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, * e.g. 0=>"Top level", 16=>"England", 19=>"London", 217=>"Westminster" * NB This function exists in both places.php and places_edit.php * - * @param integer $id + * @param int $id * * @return string[] */ @@ -3176,8 +3177,8 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, /** * Find all of the places in the hierarchy * - * @param integer $parent_id - * @param boolean $inactive + * @param int $parent_id + * @param bool $inactive * * @return array[] */ @@ -3209,11 +3210,11 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, foreach ($rows as $row) { $placelist[] = array( 'place_id' => $row->pl_id, - 'place' => $row->pl_place, - 'lati' => $row->pl_lati, - 'long' => $row->pl_long, - 'zoom' => $row->pl_zoom, - 'icon' => $row->pl_icon, + 'place' => $row->pl_place, + 'lati' => $row->pl_lati, + 'long' => $row->pl_long, + 'zoom' => $row->pl_zoom, + 'icon' => $row->pl_icon, ); } @@ -3221,7 +3222,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } /** - * @param integer $parent_id + * @param int $parent_id */ private function outputLevel($parent_id) { $tmp = $this->placeIdToHierarchy($parent_id); @@ -3293,7 +3294,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, ->pageHeader(); $where_am_i = $this->placeIdToHierarchy($placeid); - $level = count($where_am_i); + $level = count($where_am_i); if ($action == 'addrecord' && Auth::isAdmin()) { $statement = @@ -3336,7 +3337,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, Filter::get('svbear'), Filter::get('svelev'), Filter::get('svzoom'), - $placeid + $placeid, )); $controller->addInlineJavaScript('window.close();'); exit; @@ -3348,18 +3349,18 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, Database::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?") ->execute(array($placeid)) ->fetchOneRow(); - $place_name = $row->pl_place; - $place_icon = $row->pl_icon; + $place_name = $row->pl_place; + $place_icon = $row->pl_icon; $selected_country = explode("/", $place_icon); if (isset($selected_country[1]) && $selected_country[1] != "flags") $selected_country = $selected_country[1]; else $selected_country = "Countries"; - $parent_id = $row->pl_parent_id; - $level = $row->pl_level; - $zoomfactor = $row->pl_zoom; - $parent_lati = "0.0"; - $parent_long = "0.0"; + $parent_id = $row->pl_parent_id; + $level = $row->pl_level; + $zoomfactor = $row->pl_zoom; + $parent_lati = "0.0"; + $parent_long = "0.0"; if ($row->pl_lati !== null && $row->pl_long !== null) { $place_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); $place_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); @@ -3395,13 +3396,13 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, // --- find the parent place in the file if ($placeid != 0) { if (!isset($place_name)) $place_name = ''; - $place_lati = null; - $place_long = null; - $zoomfactor = 1; - $parent_lati = '0.0'; - $parent_long = '0.0'; - $place_icon = ''; - $parent_id = $placeid; + $place_lati = null; + $place_long = null; + $zoomfactor = 1; + $parent_lati = '0.0'; + $parent_long = '0.0'; + $place_icon = ''; + $parent_id = $placeid; do { $row = Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?") @@ -3410,7 +3411,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, if ($row->pl_lati !== null && $row->pl_long !== null) { $parent_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati); $parent_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long); - $zoomfactor = $row->pl_zoom; + $zoomfactor = $row->pl_zoom; if ($zoomfactor > $GM_MAX_ZOOM) { $zoomfactor = $GM_MAX_ZOOM; } @@ -3421,14 +3422,14 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } else { if (!isset($place_name)) $place_name = ''; - $place_lati = null; - $place_long = null; - $parent_lati = "0.0"; - $parent_long = "0.0"; - $place_icon = ''; - $parent_id = 0; - $level = 0; - $zoomfactor = $this->getSetting('GM_MIN_ZOOM'); + $place_lati = null; + $place_long = null; + $parent_lati = "0.0"; + $parent_long = "0.0"; + $place_icon = ''; + $parent_id = 0; + $level = 0; + $zoomfactor = $this->getSetting('GM_MIN_ZOOM'); } $selected_country = 'Countries'; @@ -4109,11 +4110,11 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, $controller->restrictAccess(Auth::isAdmin()); if ($action == 'ExportFile' && Auth::isAdmin()) { - $tmp = $this->placeIdToHierarchy($parent); - $maxLevel = $this->getHighestLevel(); + $tmp = $this->placeIdToHierarchy($parent); + $maxLevel = $this->getHighestLevel(); if ($maxLevel > 8) $maxLevel = 8; - $tmp[0] = 'places'; - $outputFileName = preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)) . '.csv'; + $tmp[0] = 'places'; + $outputFileName = preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)) . '.csv'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); echo '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";'; @@ -4162,18 +4163,18 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <?php if ($action == 'ImportGedcom') { - $placelist = array(); - $j = 0; + $placelist = array(); + $j = 0; $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?") ->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId())) ->fetchOneColumn(); foreach ($gedcom_records as $gedrec) { - $i = 1; + $i = 1; $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i); while (!empty($placerec)) { if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { - $placelist[$j] = array(); + $placelist[$j] = array(); $placelist[$j]['place'] = trim($match[1]); if (preg_match("/4 LATI (.*)/", $placerec, $match)) { $placelist[$j]['lati'] = trim($match[1]); @@ -4197,26 +4198,26 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } } else $placelist[$j]['long'] = null; - $j = $j + 1; + $j = $j + 1; } - $i = $i + 1; + $i = $i + 1; $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i); } } asort($placelist); - $prevPlace = ''; - $prevLati = ''; - $prevLong = ''; + $prevPlace = ''; + $prevLati = ''; + $prevLong = ''; $placelistUniq = array(); - $j = 0; - foreach ($placelist as $k=>$place) { + $j = 0; + foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { - $placelistUniq[$j] = array(); + $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; - $placelistUniq[$j]['lati'] = $place['lati']; - $placelistUniq[$j]['long'] = $place['long']; - $j = $j + 1; + $placelistUniq[$j]['lati'] = $place['lati']; + $placelistUniq[$j]['long'] = $place['long']; + $j = $j + 1; } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { $placelistUniq[$j - 1]['lati'] = $place['lati']; @@ -4226,21 +4227,21 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } } $prevPlace = $place['place']; - $prevLati = $place['lati']; - $prevLong = $place['long']; + $prevLati = $place['lati']; + $prevLong = $place['long']; } $highestIndex = $this->getHighestIndex(); $default_zoom_level = array(4, 7, 10, 12); - foreach ($placelistUniq as $k=>$place) { - $parent = preg_split('/ *, */', $place['place']); - $parent = array_reverse($parent); + foreach ($placelistUniq as $k => $place) { + $parent = preg_split('/ *, */', $place['place']); + $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { if (!isset($default_zoom_level[$i])) $default_zoom_level[$i] = $default_zoom_level[$i - 1]; - $escparent = $parent[$i]; + $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } @@ -4297,7 +4298,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <td> <select name="localfile"> <option></option> - <?php foreach ($placefiles as $p=>$placefile) { ?> + <?php foreach ($placefiles as $p => $placefile) { ?> <option value="<?php echo Filter::escapeHtml($placefile); ?>"><?php if (substr($placefile, 0, 1) == "/") echo substr($placefile, 1); else echo $placefile; ?></option> @@ -4330,8 +4331,8 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, if ($action === 'ImportFile2') { $country_names = array(); - $stats = new Stats($WT_TREE); - foreach ($stats->iso3166() as $key=>$value) { + $stats = new Stats($WT_TREE); + foreach ($stats->iso3166() as $key => $value) { $country_names[$key] = I18N::translate($key); } if (isset($_POST['cleardatabase'])) { @@ -4348,14 +4349,14 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } asort($lines); $highestIndex = $this->getHighestIndex(); - $placelist = array(); - $j = 0; - $maxLevel = 0; + $placelist = array(); + $j = 0; + $maxLevel = 0; foreach ($lines as $p => $placerec) { - $fieldrec = explode(';', $placerec); + $fieldrec = explode(';', $placerec); if ($fieldrec[0] > $maxLevel) $maxLevel = $fieldrec[0]; } - $fields = count($fieldrec); + $fields = count($fieldrec); $set_icon = true; if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { $set_icon = false; @@ -4363,7 +4364,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { - $placelist[$j] = array(); + $placelist[$j] = array(); $placelist[$j]['place'] = ''; for ($ii = $fields - 4; $ii > 1; $ii--) { if ($fieldrec[0] > $ii - 2) $placelist[$j]['place'] .= $fieldrec[$ii] . ','; @@ -4387,20 +4388,20 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } } - $prevPlace = ''; - $prevLati = ''; - $prevLong = ''; + $prevPlace = ''; + $prevLati = ''; + $prevLong = ''; $placelistUniq = array(); - $j = 0; - foreach ($placelist as $k=>$place) { + $j = 0; + foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { - $placelistUniq[$j] = array(); + $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; - $placelistUniq[$j]['lati'] = $place['lati']; - $placelistUniq[$j]['long'] = $place['long']; - $placelistUniq[$j]['zoom'] = $place['zoom']; - $placelistUniq[$j]['icon'] = $place['icon']; - $j = $j + 1; + $placelistUniq[$j]['lati'] = $place['lati']; + $placelistUniq[$j]['long'] = $place['long']; + $placelistUniq[$j]['zoom'] = $place['zoom']; + $placelistUniq[$j]['icon'] = $place['icon']; + $j = $j + 1; } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { $placelistUniq[$j - 1]['lati'] = $place['lati']; @@ -4412,18 +4413,18 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, } } $prevPlace = $place['place']; - $prevLati = $place['lati']; - $prevLong = $place['long']; + $prevLati = $place['lati']; + $prevLong = $place['long']; } - $default_zoom_level = array(); + $default_zoom_level = array(); $default_zoom_level[0] = 4; $default_zoom_level[1] = 7; $default_zoom_level[2] = 10; $default_zoom_level[3] = 12; - foreach ($placelistUniq as $k=>$place) { - $parent = explode(',', $place['place']); - $parent = array_reverse($parent); + foreach ($placelistUniq as $k => $place) { + $parent = explode(',', $place['place']); + $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { $escparent = $parent[$i]; @@ -4528,7 +4529,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, <?php echo '<div id="gm_breadcrumb">'; $where_am_i = $this->placeIdToHierarchy($parent); - foreach (array_reverse($where_am_i, true) as $id=>$place) { + foreach (array_reverse($where_am_i, true) as $id => $place) { if ($id == $parent) { if ($place != 'Unknown') { echo Filter::escapeHtml($place); diff --git a/app/Module/HtmlBlockModule.php b/app/Module/HtmlBlockModule.php index 93f91d0082..a8adac0ae0 100644 --- a/app/Module/HtmlBlockModule.php +++ b/app/Module/HtmlBlockModule.php @@ -81,7 +81,7 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { /* * Start Of Output */ - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; @@ -130,13 +130,13 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { } $templates = array( - I18N::translate('Keyword examples')=> + I18N::translate('Keyword examples') => '#getAllTagsTable#', - I18N::translate('Narrative description')=> + I18N::translate('Narrative description') => /* I18N: do not translate the #keywords# */ I18N::translate('This family tree was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), - I18N::translate('Statistics')=> + I18N::translate('Statistics') => '<div class="gedcom_stats"> <span style="font-weight: bold;"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br> ' . I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . ' @@ -145,43 +145,43 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { <td valign="top" class="width20"> <table cellspacing="1" cellpadding="0"> <tr> - <td class="facts_label">'. I18N::translate('Individuals') . '</td> + <td class="facts_label">' . I18N::translate('Individuals') . '</td> <td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Males') . '</td> + <td class="facts_label">' . I18N::translate('Males') . '</td> <td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Females') . '</td> + <td class="facts_label">' . I18N::translate('Females') . '</td> <td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Total surnames') . '</td> - <td class="facts_value" align="right"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged='. $WT_TREE->getNameUrl() . '">#totalSurnames#</a></td> + <td class="facts_label">' . I18N::translate('Total surnames') . '</td> + <td class="facts_value" align="right"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . $WT_TREE->getNameUrl() . '">#totalSurnames#</a></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Families') . '</td> - <td class="facts_value" align="right"><a href="famlist.php?ged='. $WT_TREE->getNameUrl() . '">#totalFamilies#</a></td> + <td class="facts_label">' . I18N::translate('Families') . '</td> + <td class="facts_value" align="right"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalFamilies#</a></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Sources') . '</td> - <td class="facts_value" align="right"><a href="sourcelist.php?ged='. $WT_TREE->getNameUrl() . '">#totalSources#</a></td> + <td class="facts_label">' . I18N::translate('Sources') . '</td> + <td class="facts_value" align="right"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalSources#</a></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Media objects') . '</td> - <td class="facts_value" align="right"><a href="medialist.php?ged='. $WT_TREE->getNameUrl() . '">#totalMedia#</a></td> + <td class="facts_label">' . I18N::translate('Media objects') . '</td> + <td class="facts_value" align="right"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalMedia#</a></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Repositories') . '</td> - <td class="facts_value" align="right"><a href="repolist.php?ged='. $WT_TREE->getNameUrl() . '">#totalRepositories#</a></td> + <td class="facts_label">' . I18N::translate('Repositories') . '</td> + <td class="facts_value" align="right"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">#totalRepositories#</a></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Total events') . '</td> + <td class="facts_label">' . I18N::translate('Total events') . '</td> <td class="facts_value" align="right">#totalEvents#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Total users') . '</td> + <td class="facts_label">' . I18N::translate('Total users') . '</td> <td class="facts_value" align="right">#totalUsers#</td> </tr> </table> @@ -190,42 +190,42 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { <td valign="top"> <table cellspacing="1" cellpadding="0" border="0"> <tr> - <td class="facts_label">'. I18N::translate('Earliest birth year') . '</td> + <td class="facts_label">' . I18N::translate('Earliest birth year') . '</td> <td class="facts_value" align="right">#firstBirthYear#</td> <td class="facts_value">#firstBirth#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Latest birth year') . '</td> + <td class="facts_label">' . I18N::translate('Latest birth year') . '</td> <td class="facts_value" align="right">#lastBirthYear#</td> <td class="facts_value">#lastBirth#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Earliest death year') . '</td> + <td class="facts_label">' . I18N::translate('Earliest death year') . '</td> <td class="facts_value" align="right">#firstDeathYear#</td> <td class="facts_value">#firstDeath#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Latest death year') . '</td> + <td class="facts_label">' . I18N::translate('Latest death year') . '</td> <td class="facts_value" align="right">#lastDeathYear#</td> <td class="facts_value">#lastDeath#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Individual who lived the longest') . '</td> + <td class="facts_label">' . I18N::translate('Individual who lived the longest') . '</td> <td class="facts_value" align="right">#longestLifeAge#</td> <td class="facts_value">#longestLife#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Average age at death') . '</td> + <td class="facts_label">' . I18N::translate('Average age at death') . '</td> <td class="facts_value" align="right">#averageLifespan#</td> <td class="facts_value"></td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Family with the most children') . '</td> + <td class="facts_label">' . I18N::translate('Family with the most children') . '</td> <td class="facts_value" align="right">#largestFamilySize#</td> <td class="facts_value">#largestFamily#</td> </tr> <tr> - <td class="facts_label">'. I18N::translate('Average number of children per family') . '</td> + <td class="facts_label">' . I18N::translate('Average number of children per family') . '</td> <td class="facts_value" align="right">#averageChildren#</td> <td class="facts_value"></td> </tr> @@ -235,7 +235,7 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { </table><br> <span style="font-weight: bold;">' . I18N::translate('Most common surnames') . '</span><br> #commonSurnames# - </div>' + </div>', ); $title = $this->getBlockSetting($block_id, 'title'); @@ -260,7 +260,7 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface { } echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">'; echo '<option value="', Filter::escapeHtml($html), '">', I18N::translate('Custom'), '</option>'; - foreach ($templates as $title=>$template) { + foreach ($templates as $title => $template) { echo '<option value="', Filter::escapeHtml($template), '">', $title, '</option>'; } echo '</select>'; diff --git a/app/Module/IndividualFactsTabModule.php b/app/Module/IndividualFactsTabModule.php index 0e12f19e45..8ad9c4aef2 100644 --- a/app/Module/IndividualFactsTabModule.php +++ b/app/Module/IndividualFactsTabModule.php @@ -143,7 +143,6 @@ class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterf echo '<script>jQuery("tr.histo").toggle();</script>'; } - return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; } @@ -333,7 +332,7 @@ class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterf * Get the events of parents and grandparents. * * @param Individual $person - * @param integer $sosa + * @param int $sosa * * @return Fact[] */ @@ -455,7 +454,7 @@ class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterf // rather than UTF8 encoding. $hist = html_entity_decode($hist, ENT_QUOTES, 'UTF-8'); - $fact = new Fact($hist, $person, 'histo'); + $fact = new Fact($hist, $person, 'histo'); $sdate = $fact->getDate(); if ($sdate->isOK() && Date::compare($birt_date, $sdate) <= 0 && Date::compare($sdate, $deat_date) <= 0) { $facts[] = $fact; diff --git a/app/Module/IndividualFamiliesReportModule.php b/app/Module/IndividualFamiliesReportModule.php index a106176855..aeed18a4df 100644 --- a/app/Module/IndividualFamiliesReportModule.php +++ b/app/Module/IndividualFamiliesReportModule.php @@ -42,7 +42,7 @@ class IndividualFamiliesReportModule extends AbstractModule implements ModuleRep global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/IndividualReportModule.php b/app/Module/IndividualReportModule.php index 877118d2d5..a390781fa3 100644 --- a/app/Module/IndividualReportModule.php +++ b/app/Module/IndividualReportModule.php @@ -42,7 +42,7 @@ class IndividualReportModule extends AbstractModule implements ModuleReportInter global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/IndividualSidebarModule.php b/app/Module/IndividualSidebarModule.php index cdd5255c52..434deb0b31 100644 --- a/app/Module/IndividualSidebarModule.php +++ b/app/Module/IndividualSidebarModule.php @@ -129,7 +129,7 @@ class IndividualSidebarModule extends AbstractModule implements ModuleSidebarInt '); $out = '<form method="post" action="module.php?mod=' . $this->getName() . '&mod_action=ajax" onsubmit="return false;"><input type="search" name="sb_indi_name" id="sb_indi_name" placeholder="' . I18N::translate('Search') . '"><p>'; - foreach ($initials as $letter=>$count) { + foreach ($initials as $letter => $count) { switch ($letter) { case '@': $html = $UNKNOWN_NN; @@ -163,7 +163,7 @@ class IndividualSidebarModule extends AbstractModule implements ModuleSidebarInt */ private function getAlphaSurnames(Tree $tree, $alpha) { $surnames = QueryName::surnames($tree, '', $alpha, true, false); - $out = '<ul>'; + $out = '<ul>'; foreach (array_keys($surnames) as $surname) { $out .= '<li id="sb_indi_' . $surname . '" class="sb_indi_surname_li"><a href="' . $surname . '" title="' . $surname . '" alt="' . $alpha . '" class="sb_indi_surname">' . $surname . '</a>'; $out .= '<div class="name_tree_div"></div>'; @@ -183,7 +183,7 @@ class IndividualSidebarModule extends AbstractModule implements ModuleSidebarInt */ private function getSurnameIndis(Tree $tree, $alpha, $surname) { $indis = QueryName::individuals($tree, $surname, $alpha, '', true, false); - $out = '<ul>'; + $out = '<ul>'; foreach ($indis as $person) { if ($person->canShowName()) { $out .= '<li><a href="' . $person->getHtmlUrl() . '">' . $person->getSexImage() . ' ' . $person->getFullName() . ' '; diff --git a/app/Module/InteractiveTree/TreeView.php b/app/Module/InteractiveTree/TreeView.php index 6f660f5d32..4d5f4a7e44 100644 --- a/app/Module/InteractiveTree/TreeView.php +++ b/app/Module/InteractiveTree/TreeView.php @@ -29,7 +29,7 @@ class TreeView { * @param string $name the name of the TreeView object’s instance */ public function __construct($name = 'tree') { - $this->name = $name; + $this->name = $name; $this->all_partners = Filter::cookie('allPartners', 'true|false', 'true'); } @@ -38,7 +38,7 @@ class TreeView { * Size is set by the container, as the viewport can scale itself automatically * * @param Individual $root_person the id of the root person - * @param integer $generations number of generations to draw + * @param int $generations number of generations to draw * * @return string[] HTML and Javascript */ @@ -80,14 +80,14 @@ class TreeView { global $WT_TREE; $list = explode(';', $list); - $r = array(); + $r = array(); foreach ($list as $jsonRequest) { $firstLetter = substr($jsonRequest, 0, 1); $jsonRequest = substr($jsonRequest, 1); switch ($firstLetter) { case 'c': $fidlist = explode(',', $jsonRequest); - $flist = array(); + $flist = array(); foreach ($fidlist as $fid) { $flist[] = Family::getInstance($fid, $WT_TREE); } @@ -95,9 +95,9 @@ class TreeView { break; case 'p': $params = explode('@', $jsonRequest); - $fid = $params[0]; - $order = $params[1]; - $f = Family::getInstance($fid, $WT_TREE); + $fid = $params[0]; + $order = $params[1]; + $f = Family::getInstance($fid, $WT_TREE); if ($f->getHusband()) { $r[] = $this->drawPerson($f->getHusband(), 0, 1, $f, $order); } elseif ($f->getWife()) { @@ -106,6 +106,7 @@ class TreeView { break; } } + return json_encode($r); } @@ -150,22 +151,23 @@ class TreeView { foreach ($individual->getFacts(WT_EVENTS_DEAT, true) as $fact) { $hmtl .= $fact->summary(); } + return '<div class="tv' . $individual->getSex() . ' tv_person_expanded">' . $hmtl . '</div>'; } /** * Draw the children for some families * - * @param array $familyList array of families to draw the children for - * @param integer $gen number of generations to draw - * @param boolean $ajax setted to true for an ajax call + * @param array $familyList array of families to draw the children for + * @param int $gen number of generations to draw + * @param bool $ajax setted to true for an ajax call * * @return string */ private function drawChildren(array $familyList, $gen = 1, $ajax = false) { - $html = ''; + $html = ''; $children2draw = array(); - $f2load = array(); + $f2load = array(); foreach ($familyList as $f) { if (empty($f)) { @@ -183,7 +185,7 @@ class TreeView { $tc = count($children2draw); if ($tc) { $f2load = implode(',', $f2load); - $nbc = 0; + $nbc = 0; foreach ($children2draw as $child) { $nbc++; if ($tc == 1) { @@ -201,6 +203,7 @@ class TreeView { $html = '<td align="right"' . ($gen == 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine(); } } + return $html; } @@ -208,11 +211,11 @@ class TreeView { * Draw a person in the tree * * @param Individual $person The Person object to draw the box for - * @param integer $gen The number of generations up or down to print - * @param integer $state Whether we are going up or down the tree, -1 for descendents +1 for ancestors + * @param int $gen The number of generations up or down to print + * @param int $state Whether we are going up or down the tree, -1 for descendents +1 for ancestors * @param Family $pfamily - * @param string $order first (1), last(2), unique(0), or empty. Required for drawing lines between boxes - * @param boolean $isRoot + * @param string $order first (1), last(2), unique(0), or empty. Required for drawing lines between boxes + * @param bool $isRoot * * @return string * @@ -294,7 +297,7 @@ class TreeView { $html .= '</td></tr>'; } if (count($fop)) { - $n = 0; + $n = 0; $nb = count($fop); foreach ($fop as $p) { $n++; @@ -311,6 +314,7 @@ class TreeView { if ($isRoot) { $html .= '</td><td id="tv_tree_right"></td></tr><tr><td id="tv_tree_bottomleft"></td><td id="tv_tree_bottom"></td><td id="tv_tree_bottomright"></td></tr></tbody></table>'; } + return $html; } @@ -353,6 +357,7 @@ class TreeView { $title = ''; } $sex = $individual->getSex(); + return '<div class="tv' . $sex . ' ' . $dashed . '"' . $title . '><a href="' . $individual->getHtmlUrl() . '"></a>' . $individual->getFullName() . ' <span class="dates">' . $individual->getLifeSpan() . '</span></div>'; } diff --git a/app/Module/InteractiveTreeModule.php b/app/Module/InteractiveTreeModule.php index 108f190096..cfaba7af07 100644 --- a/app/Module/InteractiveTreeModule.php +++ b/app/Module/InteractiveTreeModule.php @@ -40,8 +40,9 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface public function getTabContent() { global $controller; - $tv = new TreeView('tvTab'); + $tv = new TreeView('tvTab'); list($html, $js) = $tv->drawViewport($controller->record, 3); + return '<script src="' . $this->js() . '"></script>' . '<script src="' . WT_JQUERYUI_TOUCH_PUNCH_URL . '"></script>' . @@ -88,7 +89,7 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface switch ($mod_action) { case 'treeview': $controller = new ChartController; - $tv = new TreeView('tv'); + $tv = new TreeView('tv'); ob_start(); $person = $controller->getSignificantIndividual(); @@ -113,9 +114,9 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface case 'getDetails': header('Content-Type: text/html; charset=UTF-8'); - $pid = Filter::get('pid', WT_REGEX_XREF); - $i = Filter::get('instance'); - $tv = new TreeView($i); + $pid = Filter::get('pid', WT_REGEX_XREF); + $i = Filter::get('instance'); + $tv = new TreeView($i); $individual = Individual::getInstance($pid, $WT_TREE); if ($individual) { echo $tv->getDetails($individual); @@ -124,8 +125,8 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface case 'getPersons': header('Content-Type: text/html; charset=UTF-8'); - $q = Filter::get('q'); - $i = Filter::get('instance'); + $q = Filter::get('q'); + $i = Filter::get('instance'); $tv = new TreeView($i); echo $tv->getPersons($q); break; diff --git a/app/Module/LoginBlockModule.php b/app/Module/LoginBlockModule.php index baa8b45796..0bc8a249ce 100644 --- a/app/Module/LoginBlockModule.php +++ b/app/Module/LoginBlockModule.php @@ -33,7 +33,7 @@ class LoginBlockModule extends AbstractModule implements ModuleBlockInterface { /** {@inheritdoc} */ public function getBlock($block_id, $template = true, $cfg = null) { global $controller; - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $controller->addInlineJavascript(' jQuery("#new_passwd").hide(); @@ -55,24 +55,24 @@ class LoginBlockModule extends AbstractModule implements ModuleBlockInterface { } else { $title = I18N::translate('Login'); $content = '<div id="login-box"> - <form id="login-form" name="login-form" method="post" action="'. WT_LOGIN_URL . '" onsubmit="d=new Date(); this.timediff.value=-60*d.getTimezoneOffset();"> + <form id="login-form" name="login-form" method="post" action="' . WT_LOGIN_URL . '" onsubmit="d=new Date(); this.timediff.value=-60*d.getTimezoneOffset();"> <input type="hidden" name="action" value="login"> <input type="hidden" name="timediff" value="">'; $content .= '<div> - <label for="username">'. I18N::translate('Username') . + <label for="username">' . I18N::translate('Username') . '<input type="text" id="username" name="username" class="formField"> </label> </div> <div> - <label for="password">'. I18N::translate('Password') . + <label for="password">' . I18N::translate('Password') . '<input type="password" id="password" name="password" class="formField"> </label> </div> <div> - <input type="submit" value="'. I18N::translate('Login') . '"> + <input type="submit" value="' . I18N::translate('Login') . '"> </div> <div> - <a href="#" id="passwd_click">'. I18N::translate('Request new password') . '</a> + <a href="#" id="passwd_click">' . I18N::translate('Request new password') . '</a> </div>'; if (Site::getPreference('USE_REGISTRATION_MODULE')) { $content .= '<div><a href="' . WT_LOGIN_URL . '?action=register">' . I18N::translate('Request new user account') . '</a></div>'; @@ -81,16 +81,16 @@ class LoginBlockModule extends AbstractModule implements ModuleBlockInterface { // hidden New Password block $content .= '<div id="new_passwd"> - <form id="new_passwd_form" name="new_passwd_form" action="'.WT_LOGIN_URL . '" method="post"> + <form id="new_passwd_form" name="new_passwd_form" action="' . WT_LOGIN_URL . '" method="post"> <input type="hidden" name="time" value=""> <input type="hidden" name="action" value="requestpw"> - <h4>'. I18N::translate('Lost password request') . '</h4> + <h4>' . I18N::translate('Lost password request') . '</h4> <div> - <label for="new_passwd_username">'. I18N::translate('Username or email address') . + <label for="new_passwd_username">' . I18N::translate('Username or email address') . '<input type="text" id="new_passwd_username" name="new_passwd_username" value=""> </label> </div> - <div><input type="submit" value="'. I18N::translate('continue') . '"></div> + <div><input type="submit" value="' . I18N::translate('continue') . '"></div> </form> </div>'; //"new_passwd" $content .= '</div>'; //"login-box" diff --git a/app/Module/MarriageReportModule.php b/app/Module/MarriageReportModule.php index e675366a9f..43ad668a8a 100644 --- a/app/Module/MarriageReportModule.php +++ b/app/Module/MarriageReportModule.php @@ -42,7 +42,7 @@ class MarriageReportModule extends AbstractModule implements ModuleReportInterfa global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/MissingFactsReportModule.php b/app/Module/MissingFactsReportModule.php index cfc187b7b0..1444b05a9e 100644 --- a/app/Module/MissingFactsReportModule.php +++ b/app/Module/MissingFactsReportModule.php @@ -42,7 +42,7 @@ class MissingFactsReportModule extends AbstractModule implements ModuleReportInt global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/ModuleBlockInterface.php b/app/Module/ModuleBlockInterface.php index cf04fbfc20..7e277ab8bd 100644 --- a/app/Module/ModuleBlockInterface.php +++ b/app/Module/ModuleBlockInterface.php @@ -23,7 +23,7 @@ interface ModuleBlockInterface { /** * Generate the HTML content of this block. * - * @param integer $block_id + * @param int $block_id * * @return string */ @@ -34,30 +34,28 @@ interface ModuleBlockInterface { * Simple blocks are faster in-line, more comples ones * can be loaded later. * - * @return boolean + * @return bool */ public function loadAjax(); /** * Can this block be shown on the user’s home page? * - * @return boolean + * @return bool */ public function isUserBlock(); /** * Can this block be shown on the tree’s home page? * - * @return boolean + * @return bool */ public function isGedcomBlock(); /** * An HTML form to edit block settings * - * @param integer $block_id - * - * @return void + * @param int $block_id */ public function configureBlock($block_id); } diff --git a/app/Module/ModuleMenuInterface.php b/app/Module/ModuleMenuInterface.php index f8e4e5a6bc..c29a4c8716 100644 --- a/app/Module/ModuleMenuInterface.php +++ b/app/Module/ModuleMenuInterface.php @@ -23,7 +23,7 @@ interface ModuleMenuInterface { /** * The user can re-order menus. Until they do, they are shown in this order. * - * @return integer + * @return int */ public function defaultMenuOrder(); diff --git a/app/Module/ModuleSidebarInterface.php b/app/Module/ModuleSidebarInterface.php index 61d9d3e0be..f6e5aa0f16 100644 --- a/app/Module/ModuleSidebarInterface.php +++ b/app/Module/ModuleSidebarInterface.php @@ -23,12 +23,13 @@ interface ModuleSidebarInterface { /** * The user can change the order of sidebars. Until they do this, they are shown in this order. * - * @return integer + * @return int */ public function defaultSidebarOrder(); /** * Load this sidebar synchronously. + * * @return string */ public function getSidebarContent(); @@ -43,7 +44,7 @@ interface ModuleSidebarInterface { /** * Does this sidebar have anything to display for this individual? * - * @return boolean + * @return bool */ public function hasSidebarContent(); } diff --git a/app/Module/ModuleTabInterface.php b/app/Module/ModuleTabInterface.php index 01327eaf49..de8d83ece5 100644 --- a/app/Module/ModuleTabInterface.php +++ b/app/Module/ModuleTabInterface.php @@ -24,7 +24,7 @@ interface ModuleTabInterface { * The user can re-arrange the tab order, but until they do, this * is the order in which tabs are shown. * - * @return integer + * @return int */ public function defaultTabOrder(); @@ -37,14 +37,15 @@ interface ModuleTabInterface { /** * Is this tab empty? If so, we don't always need to display it. - * @return boolean + * + * @return bool */ public function hasTabContent(); /** * Can this tab load asynchronously? * - * @return boolean + * @return bool */ public function canLoadAjax(); @@ -61,7 +62,7 @@ interface ModuleTabInterface { * A greyed out tab has no actual content, but may perhaps have * options to create content. * - * @return boolean + * @return bool */ public function isGrayedOut(); } diff --git a/app/Module/OccupationReportModule.php b/app/Module/OccupationReportModule.php index 590355dc6c..29ff50daf6 100644 --- a/app/Module/OccupationReportModule.php +++ b/app/Module/OccupationReportModule.php @@ -42,7 +42,7 @@ class OccupationReportModule extends AbstractModule implements ModuleReportInter global $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', 'menu-report-' . $this->getName() diff --git a/app/Module/OnThisDayModule.php b/app/Module/OnThisDayModule.php index bf4c596f1d..220b6c2fd6 100644 --- a/app/Module/OnThisDayModule.php +++ b/app/Module/OnThisDayModule.php @@ -77,6 +77,7 @@ class OnThisDayModule extends AbstractModule implements ModuleBlockInterface { if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -129,15 +130,15 @@ class OnThisDayModule extends AbstractModule implements ModuleBlockInterface { echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; - echo select_edit_control('infoStyle', array('list'=> I18N::translate('list'), 'table'=> I18N::translate('table')), null, $infoStyle, ''); + echo select_edit_control('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Sort order'); echo '</td><td class="optionbox">'; echo select_edit_control('sortStyle', array( - /* I18N: An option in a list-box */ 'alpha'=> I18N::translate('sort by name'), - /* I18N: An option in a list-box */ 'anniv'=> I18N::translate('sort by date'), + /* I18N: An option in a list-box */ 'alpha' => I18N::translate('sort by name'), + /* I18N: An option in a list-box */ 'anniv' => I18N::translate('sort by date'), ), null, $sortStyle, ''); echo '</td></tr>'; diff --git a/app/Module/PageMenuModule.php b/app/Module/PageMenuModule.php index 99c28af01f..1a8f9448a0 100644 --- a/app/Module/PageMenuModule.php +++ b/app/Module/PageMenuModule.php @@ -47,6 +47,7 @@ class PageMenuModule extends AbstractModule implements ModuleMenuInterface { if (Auth::isEditor($WT_TREE) && method_exists($controller, 'getEditMenu')) { $menu = $controller->getEditMenu(); } + return $menu; } } diff --git a/app/Module/PedigreeReportModule.php b/app/Module/PedigreeReportModule.php index d71ddf5151..02fd503854 100644 --- a/app/Module/PedigreeReportModule.php +++ b/app/Module/PedigreeReportModule.php @@ -42,7 +42,7 @@ class PedigreeReportModule extends AbstractModule implements ModuleReportInterfa global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/RecentChangesModule.php b/app/Module/RecentChangesModule.php index 37b8335668..af5155eab5 100644 --- a/app/Module/RecentChangesModule.php +++ b/app/Module/RecentChangesModule.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class RecentChangesModule extends AbstractModule implements ModuleBlockInterface { const DEFAULT_DAYS = 7; - const MAX_DAYS = 90; + const MAX_DAYS = 90; /** {@inheritdoc} */ public function getTitle() { @@ -43,7 +43,6 @@ class RecentChangesModule extends AbstractModule implements ModuleBlockInterface $block = $this->getBlockSetting($block_id, 'block', '1'); $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0'); - if ($cfg) { foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'block') as $name) { if (array_key_exists($name, $cfg)) { @@ -89,6 +88,7 @@ class RecentChangesModule extends AbstractModule implements ModuleBlockInterface if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -145,7 +145,7 @@ class RecentChangesModule extends AbstractModule implements ModuleBlockInterface echo select_edit_control('sortStyle', array( 'name' => /* I18N: An option in a list-box */ I18N::translate('sort by name'), 'date_asc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, oldest first'), - 'date_desc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, newest first') + 'date_desc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, newest first'), ), null, $sortStyle, ''); echo '</td></tr>'; diff --git a/app/Module/RelatedIndividualsReportModule.php b/app/Module/RelatedIndividualsReportModule.php index 8b106db6de..5fc0fa84a9 100644 --- a/app/Module/RelatedIndividualsReportModule.php +++ b/app/Module/RelatedIndividualsReportModule.php @@ -42,7 +42,7 @@ class RelatedIndividualsReportModule extends AbstractModule implements ModuleRep global $controller, $WT_TREE; $menus = array(); - $menu = new Menu( + $menu = new Menu( $this->getTitle(), 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), 'menu-report-' . $this->getName() diff --git a/app/Module/RelativesTabModule.php b/app/Module/RelativesTabModule.php index 0924a4c964..e22497bfc6 100644 --- a/app/Module/RelativesTabModule.php +++ b/app/Module/RelativesTabModule.php @@ -38,7 +38,7 @@ class RelativesTabModule extends AbstractModule implements ModuleTabInterface { /** * @param Date $prev * @param Date $next - * @param integer $child_number + * @param int $child_number * * @return string */ @@ -167,7 +167,7 @@ class RelativesTabModule extends AbstractModule implements ModuleTabInterface { ///// MARR ///// $found = false; - $prev = new Date(''); + $prev = new Date(''); foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { $found |= !$fact->isPendingDeletion(); if ($fact->isPendingAddition()) { diff --git a/app/Module/ResearchTaskModule.php b/app/Module/ResearchTaskModule.php index 7dba5c2899..21f04cc1ae 100644 --- a/app/Module/ResearchTaskModule.php +++ b/app/Module/ResearchTaskModule.php @@ -97,10 +97,10 @@ class ResearchTaskModule extends AbstractModule implements ModuleBlockInterface $content .= '<th>' . GedcomTag::getLabel('TEXT') . '</th>'; $content .= '</tr></thead><tbody>'; - $found = false; + $found = false; $end_jd = $show_future ? 99999999 : WT_CLIENT_JD; foreach (get_calendar_events(0, $end_jd, '_TODO', $WT_TREE) as $fact) { - $record = $fact->getParent(); + $record = $fact->getParent(); $user_name = $fact->getAttribute('_WT_USER'); if ($user_name === Auth::user()->getUserName() || !$user_name && $show_unassigned || $user_name && $show_other) { $content .= '<tr>'; @@ -129,6 +129,7 @@ class ResearchTaskModule extends AbstractModule implements ModuleBlockInterface if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; diff --git a/app/Module/ReviewChangesModule.php b/app/Module/ReviewChangesModule.php index 6e3ce92ff0..abba95c04e 100644 --- a/app/Module/ReviewChangesModule.php +++ b/app/Module/ReviewChangesModule.php @@ -79,7 +79,7 @@ class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface } } if (Auth::isEditor($WT_TREE) && $WT_TREE->hasPendingEdit()) { - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'user' || Auth::isManager($WT_TREE)) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; @@ -116,6 +116,7 @@ class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; diff --git a/app/Module/SiteMapModule.php b/app/Module/SiteMapModule.php index 3a0dcdee83..eb8f5be413 100644 --- a/app/Module/SiteMapModule.php +++ b/app/Module/SiteMapModule.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class SiteMapModule extends AbstractModule implements ModuleConfigInterface { const RECORDS_PER_VOLUME = 500; // Keep sitemap files small, for memory, CPU and max_allowed_packet limits. - const CACHE_LIFE = 1209600; // Two weeks + const CACHE_LIFE = 1209600; // Two weeks /** {@inheritdoc} */ public function getTitle() { @@ -70,7 +70,7 @@ class SiteMapModule extends AbstractModule implements ModuleConfigInterface { if ($timestamp > WT_TIMESTAMP - self::CACHE_LIFE) { $data = $this->getSetting('sitemap.xml'); } else { - $data = ''; + $data = ''; $lastmod = '<lastmod>' . date('Y-m-d') . '</lastmod>'; foreach (Tree::getAll() as $tree) { if ($tree->getPreference('include_in_sitemap')) { @@ -128,7 +128,7 @@ class SiteMapModule extends AbstractModule implements ModuleConfigInterface { * A separate file for each family tree and each record type. * These files depend on access levels, so only cache for visitors. * - * @param integer $ged_id + * @param int $ged_id * @param string $rec_type * @param string $volume */ @@ -139,7 +139,7 @@ class SiteMapModule extends AbstractModule implements ModuleConfigInterface { if ($timestamp > WT_TIMESTAMP - self::CACHE_LIFE && !Auth::check()) { $data = $this->getSetting('sitemap-' . $ged_id . '-' . $rec_type . '-' . $volume . '.xml'); } else { - $data = '<url><loc>' . WT_BASE_URL . 'index.php?ctype=gedcom&ged=' . $tree->getNameUrl() . '</loc></url>' . PHP_EOL; + $data = '<url><loc>' . WT_BASE_URL . 'index.php?ctype=gedcom&ged=' . $tree->getNameUrl() . '</loc></url>' . PHP_EOL; $records = array(); switch ($rec_type) { case 'i': diff --git a/app/Module/SlideShowModule.php b/app/Module/SlideShowModule.php index 6e07517bf1..2e0c261b16 100644 --- a/app/Module/SlideShowModule.php +++ b/app/Module/SlideShowModule.php @@ -82,7 +82,7 @@ class SlideShowModule extends AbstractModule implements ModuleBlockInterface { // Keep looking through the media until a suitable one is found. $random_media = null; while ($all_media) { - $n = array_rand($all_media); + $n = array_rand($all_media); $media = Media::getInstance($all_media[$n], $WT_TREE); if ($media->canShow() && !$media->isExternal()) { // Check if it is linked to a suitable individual @@ -101,7 +101,7 @@ class SlideShowModule extends AbstractModule implements ModuleBlockInterface { unset($all_media[$n]); }; - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; @@ -142,7 +142,7 @@ class SlideShowModule extends AbstractModule implements ModuleBlockInterface { } function reload_image() { if (play) { - jQuery("#block_'.$block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1"); + jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1"); } } </script>'; @@ -240,39 +240,39 @@ class SlideShowModule extends AbstractModule implements ModuleBlockInterface { echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Show only individuals, events, or all?'); echo '</td><td class="optionbox">'; - echo select_edit_control('filter', array('indi'=> I18N::translate('Individuals'), 'event'=> I18N::translate('Facts and events'), 'all'=> I18N::translate('All')), null, $filter, ''); + echo select_edit_control('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, ''); echo '</td></tr>'; $filters = array( - 'avi' =>$this->getBlockSetting($block_id, 'filter_avi', '0'), - 'bmp' =>$this->getBlockSetting($block_id, 'filter_bmp', '1'), - 'gif' =>$this->getBlockSetting($block_id, 'filter_gif', '1'), - 'jpeg' =>$this->getBlockSetting($block_id, 'filter_jpeg', '1'), - 'mp3' =>$this->getBlockSetting($block_id, 'filter_mp3', '0'), - 'ole' =>$this->getBlockSetting($block_id, 'filter_ole', '1'), - 'pcx' =>$this->getBlockSetting($block_id, 'filter_pcx', '1'), - 'pdf' =>$this->getBlockSetting($block_id, 'filter_pdf', '0'), - 'png' =>$this->getBlockSetting($block_id, 'filter_png', '1'), - 'tiff' =>$this->getBlockSetting($block_id, 'filter_tiff', '1'), - 'wav' =>$this->getBlockSetting($block_id, 'filter_wav', '0'), - 'audio' =>$this->getBlockSetting($block_id, 'filter_audio', '0'), - 'book' =>$this->getBlockSetting($block_id, 'filter_book', '1'), - 'card' =>$this->getBlockSetting($block_id, 'filter_card', '1'), - 'certificate'=>$this->getBlockSetting($block_id, 'filter_certificate', '1'), - 'coat' =>$this->getBlockSetting($block_id, 'filter_coat', '1'), - 'document' =>$this->getBlockSetting($block_id, 'filter_document', '1'), - 'electronic' =>$this->getBlockSetting($block_id, 'filter_electronic', '1'), - 'fiche' =>$this->getBlockSetting($block_id, 'filter_fiche', '1'), - 'film' =>$this->getBlockSetting($block_id, 'filter_film', '1'), - 'magazine' =>$this->getBlockSetting($block_id, 'filter_magazine', '1'), - 'manuscript' =>$this->getBlockSetting($block_id, 'filter_manuscript', '1'), - 'map' =>$this->getBlockSetting($block_id, 'filter_map', '1'), - 'newspaper' =>$this->getBlockSetting($block_id, 'filter_newspaper', '1'), - 'other' =>$this->getBlockSetting($block_id, 'filter_other', '1'), - 'painting' =>$this->getBlockSetting($block_id, 'filter_painting', '1'), - 'photo' =>$this->getBlockSetting($block_id, 'filter_photo', '1'), - 'tombstone' =>$this->getBlockSetting($block_id, 'filter_tombstone', '1'), - 'video' =>$this->getBlockSetting($block_id, 'filter_video', '0'), + 'avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), + 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), + 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), + 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), + 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), + 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), + 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), + 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), + 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), + 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), + 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), + 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), + 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), + 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), + 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), + 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), + 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), + 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), + 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), + 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), + 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), + 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), + 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), + 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), + 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), + 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), + 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), + 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), + 'video' => $this->getBlockSetting($block_id, 'filter_video', '0'), ); echo '<tr><td class="descriptionbox wrap width33">'; diff --git a/app/Module/StoriesModule.php b/app/Module/StoriesModule.php index 6d36ec26a7..df42b8d338 100644 --- a/app/Module/StoriesModule.php +++ b/app/Module/StoriesModule.php @@ -75,7 +75,7 @@ class StoriesModule extends AbstractModule implements ModuleTabInterface, Module )->execute(array( $this->getName(), $controller->record->getXref(), - $controller->record->getTree()->getTreeId() + $controller->record->getTree()->getTreeId(), ))->fetchOneColumn(); $html = ''; @@ -102,7 +102,7 @@ class StoriesModule extends AbstractModule implements ModuleTabInterface, Module /** {@inheritdoc} */ public function hasTabContent() { - return $this->getTabContent() <> ''; + return $this->getTabContent() != ''; } /** {@inheritdoc} */ @@ -119,7 +119,7 @@ class StoriesModule extends AbstractModule implements ModuleTabInterface, Module )->execute(array( $this->getName(), $controller->record->getXref(), - $controller->record->getTree()->getTreeId() + $controller->record->getTree()->getTreeId(), ))->fetchOne(); return $count_of_stories == 0; @@ -155,7 +155,7 @@ class StoriesModule extends AbstractModule implements ModuleTabInterface, Module Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $this->getName(), - 0 + 0, )); $block_id = Database::getInstance()->lastInsertId(); } diff --git a/app/Module/ThemeSelectModule.php b/app/Module/ThemeSelectModule.php index 7cc142613b..980913fb23 100644 --- a/app/Module/ThemeSelectModule.php +++ b/app/Module/ThemeSelectModule.php @@ -33,10 +33,10 @@ class ThemeSelectModule extends AbstractModule implements ModuleBlockInterface { /** {@inheritdoc} */ public function getBlock($block_id, $template = true, $cfg = null) { /** @var BaseTheme */ - $id = $this->getName() . $block_id; + $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = $this->getTitle(); - $menu = Theme::theme()->menuThemes(); + $menu = Theme::theme()->menuThemes(); if ($menu) { $content = '<div class="center theme_form">' . $menu . '</div><br>'; diff --git a/app/Module/TopGivenNamesModule.php b/app/Module/TopGivenNamesModule.php index adfe7ba89c..220cb6e739 100644 --- a/app/Module/TopGivenNamesModule.php +++ b/app/Module/TopGivenNamesModule.php @@ -88,8 +88,8 @@ class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface $params = array(1, $num, 'rcount'); $content .= '<table style="margin:auto;"> <tr valign="top"> - <td>'.$stats->commonGivenFemaleTable($params) . '</td> - <td>'.$stats->commonGivenMaleTable($params) . '</td>'; + <td>' . $stats->commonGivenFemaleTable($params) . '</td> + <td>' . $stats->commonGivenMaleTable($params) . '</td>'; $content .= '</tr></table>'; break; } @@ -99,6 +99,7 @@ class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -141,7 +142,7 @@ class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; - echo select_edit_control('infoStyle', array('list'=> I18N::translate('list'), 'table'=> I18N::translate('table')), null, $infoStyle, ''); + echo select_edit_control('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap width33">'; diff --git a/app/Module/TopPageViewsModule.php b/app/Module/TopPageViewsModule.php index 2ddea6a4a5..c2f48dc953 100644 --- a/app/Module/TopPageViewsModule.php +++ b/app/Module/TopPageViewsModule.php @@ -67,13 +67,12 @@ class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface 'limit' => (int) $num, ))->FetchAssoc(); - if ($block) { $content .= "<table width=\"90%\">"; } else { $content .= "<table>"; } - foreach ($top10 as $id=>$count) { + foreach ($top10 as $id => $count) { $record = GedcomRecord::getInstance($id, $WT_TREE); if ($record && $record->canShow()) { $content .= '<tr valign="top">'; @@ -93,6 +92,7 @@ class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -135,7 +135,7 @@ class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface echo "<tr><td class=\"descriptionbox wrap width33\">"; echo I18N::translate('Place counts before or after name?'); echo "</td><td class=\"optionbox\">"; - echo select_edit_control('count_placement', array('before'=> I18N::translate('before'), 'after'=> I18N::translate('after')), null, $count_placement, ''); + echo select_edit_control('count_placement', array('before' => I18N::translate('before'), 'after' => I18N::translate('after')), null, $count_placement, ''); echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap width33">'; diff --git a/app/Module/TopSurnamesModule.php b/app/Module/TopSurnamesModule.php index 7641d6c43a..349df64ed8 100644 --- a/app/Module/TopSurnamesModule.php +++ b/app/Module/TopSurnamesModule.php @@ -111,6 +111,7 @@ class TopSurnamesModule extends AbstractModule implements ModuleBlockInterface { if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { @@ -170,7 +171,7 @@ class TopSurnamesModule extends AbstractModule implements ModuleBlockInterface { * @param string[] $a * @param string[] $b * - * @return integer + * @return int */ private static function surnameCountSort($a, $b) { $counta = 0; diff --git a/app/Module/UpcomingAnniversariesModule.php b/app/Module/UpcomingAnniversariesModule.php index 88e543a4aa..64859c7a16 100644 --- a/app/Module/UpcomingAnniversariesModule.php +++ b/app/Module/UpcomingAnniversariesModule.php @@ -79,6 +79,7 @@ class UpcomingAnniversariesModule extends AbstractModule implements ModuleBlockI if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -140,15 +141,15 @@ class UpcomingAnniversariesModule extends AbstractModule implements ModuleBlockI echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; - echo select_edit_control('infoStyle', array('list'=> I18N::translate('list'), 'table'=> I18N::translate('table')), null, $infoStyle, ''); + echo select_edit_control('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Sort order'); echo '</td><td class="optionbox">'; echo select_edit_control('sortStyle', array( - /* I18N: An option in a list-box */ 'alpha'=> I18N::translate('sort by name'), - /* I18N: An option in a list-box */ 'anniv'=> I18N::translate('sort by date'), + /* I18N: An option in a list-box */ 'alpha' => I18N::translate('sort by name'), + /* I18N: An option in a list-box */ 'anniv' => I18N::translate('sort by date'), ), null, $sortStyle, ''); echo '</td></tr>'; diff --git a/app/Module/UserFavoritesModule.php b/app/Module/UserFavoritesModule.php index f59b34626d..4e2829350d 100644 --- a/app/Module/UserFavoritesModule.php +++ b/app/Module/UserFavoritesModule.php @@ -42,7 +42,7 @@ class UserFavoritesModule extends FamilyTreeFavoritesModule { /** * Get the favorites for a user (for the current family tree) * - * @param integer $user_id + * @param int $user_id * * @return string[][] */ diff --git a/app/Module/UserJournalModule.php b/app/Module/UserJournalModule.php index 95a4ddc988..a795f7c5e0 100644 --- a/app/Module/UserJournalModule.php +++ b/app/Module/UserJournalModule.php @@ -81,6 +81,7 @@ class UserJournalModule extends AbstractModule implements ModuleBlockInterface { if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; diff --git a/app/Module/UserMessagesModule.php b/app/Module/UserMessagesModule.php index a90362b597..57a3487dde 100644 --- a/app/Module/UserMessagesModule.php +++ b/app/Module/UserMessagesModule.php @@ -113,6 +113,7 @@ class UserMessagesModule extends AbstractModule implements ModuleBlockInterface if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; diff --git a/app/Module/UserWelcomeModule.php b/app/Module/UserWelcomeModule.php index 3168bd8d67..399b7e5722 100644 --- a/app/Module/UserWelcomeModule.php +++ b/app/Module/UserWelcomeModule.php @@ -34,9 +34,9 @@ class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface { public function getBlock($block_id, $template = true, $cfg = null) { global $WT_TREE; - $id = $this->getName() . $block_id; - $class = $this->getName() . '_block'; - $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>'; + $id = $this->getName() . $block_id; + $class = $this->getName() . '_block'; + $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>'; $content = '<table><tr>'; $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>'; diff --git a/app/Module/WelcomeBlockModule.php b/app/Module/WelcomeBlockModule.php index c405befcf1..3f1d14fc9b 100644 --- a/app/Module/WelcomeBlockModule.php +++ b/app/Module/WelcomeBlockModule.php @@ -35,10 +35,10 @@ class WelcomeBlockModule extends AbstractModule implements ModuleBlockInterface global $controller, $WT_TREE; $indi_xref = $controller->getSignificantIndividual()->getXref(); - $id = $this->getName() . $block_id; - $class = $this->getName() . '_block'; - $title = '<span dir="auto">' . $WT_TREE->getTitleHtml() . '</span>'; - $content = '<table><tr>'; + $id = $this->getName() . $block_id; + $class = $this->getName() . '_block'; + $title = '<span dir="auto">' . $WT_TREE->getTitleHtml() . '</span>'; + $content = '<table><tr>'; $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>'; $content .= '<td><a href="individual.php?pid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>'; if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) { diff --git a/app/Module/YahrzeitModule.php b/app/Module/YahrzeitModule.php index a064599c2b..fa69761247 100644 --- a/app/Module/YahrzeitModule.php +++ b/app/Module/YahrzeitModule.php @@ -72,7 +72,7 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { // Exact hebrew dates only $date = $fact->getDate(); if ($date->minimumDate() instanceof JewishDate && $date->minimumJulianDay() === $date->maximumJulianDay()) { - $fact->jd = $jd; + $fact->jd = $jd; $yahrzeits[] = $fact; } } @@ -84,8 +84,8 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { foreach ($yahrzeits as $yahrzeit) { if ($yahrzeit->getTag() === 'DEAT') { $today = new JewishDate($yahrzeit->jd); - $hd = $yahrzeit->getDate()->minimumDate(); - $hd1 = new JewishDate($hd); + $hd = $yahrzeit->getDate()->minimumDate(); + $hd1 = new JewishDate($hd); $hd1->y += 1; $hd1->setJdFromYmd(); // Special rules. See http://www.hebcal.com/help/anniv.html @@ -122,7 +122,7 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { $controller ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) ->addInlineJavascript(' - jQuery("#'.$table_id . '").dataTable({ + jQuery("#' . $table_id . '").dataTable({ dom: \'t\', ' . I18N::datatablesI18N() . ', autoWidth: false, @@ -142,7 +142,7 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { /* 6-YART */ { visible: false } ] }); - jQuery("#'.$table_id . '").css("visibility", "visible"); + jQuery("#' . $table_id . '").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $content = ''; @@ -164,7 +164,7 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { $ind = $yahrzeit->getParent(); // Individual name(s) $name = $ind->getFullName(); - $url = $ind->getHtmlUrl(); + $url = $ind->getHtmlUrl(); $content .= '<td>'; $content .= '<a href="' . $url . '">' . $name . '</a>'; $content .= $ind->getSexImage(); @@ -208,6 +208,7 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { if ($block) { $class .= ' small_inner_block'; } + return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; @@ -253,15 +254,15 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; - echo select_edit_control('infoStyle', array('list'=> I18N::translate('list'), 'table'=> I18N::translate('table')), null, $infoStyle, ''); + echo select_edit_control('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Calendar'); echo '</td><td class="optionbox">'; echo select_edit_control('calendar', array( - 'jewish' => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'), - 'gregorian'=> /* I18N: The gregorian calendar */ I18N::translate('Gregorian'), + 'jewish' => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'), + 'gregorian' => /* I18N: The gregorian calendar */ I18N::translate('Gregorian'), ), null, $calendar, ''); echo '</td></tr>'; diff --git a/app/Note.php b/app/Note.php index 73833912e1..fabd791332 100644 --- a/app/Note.php +++ b/app/Note.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class Note extends GedcomRecord { const RECORD_TYPE = 'NOTE'; - const URL_PREFIX = 'note.php?nid='; + const URL_PREFIX = 'note.php?nid='; /** * Get an instance of a note object. For single records, @@ -63,7 +63,7 @@ class Note extends GedcomRecord { $linked_ids = Database::prepare( "SELECT l_from FROM `##link` WHERE l_to=? AND l_file=?" )->execute(array( - $this->xref, $this->tree->getTreeId() + $this->xref, $this->tree->getTreeId(), ))->fetchOneColumn(); foreach ($linked_ids as $linked_id) { $linked_record = GedcomRecord::getInstance($linked_id, $this->tree); @@ -87,7 +87,7 @@ class Note extends GedcomRecord { "SELECT o_gedcom FROM `##other` WHERE o_id = :xref AND o_file = :tree_id AND o_type = 'NOTE'" )->execute(array( 'xref' => $xref, - 'tree_id' => $tree_id + 'tree_id' => $tree_id, ))->fetchOne(); } diff --git a/app/Place.php b/app/Place.php index 0d7c6d9295..f21e1b2565 100644 --- a/app/Place.php +++ b/app/Place.php @@ -47,7 +47,7 @@ class Place { } /** - * @return integer + * @return int */ public function getPlaceId() { $place_id = 0; @@ -203,7 +203,7 @@ class Place { */ public static function allPlaces(Tree $tree) { $places = array(); - $rows = + $rows = Database::prepare( "SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)" . " FROM `##places` AS p1" . @@ -225,6 +225,7 @@ class Place { foreach ($rows as $row) { $places[] = new Place($row, $tree); } + return $places; } @@ -236,7 +237,7 @@ class Place { */ public static function findPlaces($filter, Tree $tree) { $places = array(); - $rows = + $rows = Database::prepare( "SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)" . " FROM `##places` AS p1" . @@ -251,14 +252,15 @@ class Place { " WHERE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) LIKE CONCAT('%', :filter_1, '%') AND CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) NOT LIKE CONCAT('%,%', :filter_2, '%') AND p1.p_file = :tree_id" . " ORDER BY CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) COLLATE :collation" )->execute(array( - 'filter_1' => preg_quote($filter), - 'filter_2' => preg_quote($filter), - 'tree_id' => $tree->getTreeId(), + 'filter_1' => preg_quote($filter), + 'filter_2' => preg_quote($filter), + 'tree_id' => $tree->getTreeId(), 'collation' => I18N::collation(), ))->fetchOneColumn(); foreach ($rows as $row) { $places[] = new Place($row, $tree); } + return $places; } } diff --git a/app/Query/QueryMedia.php b/app/Query/QueryMedia.php index 605ddc22e6..42ab27fbc8 100644 --- a/app/Query/QueryMedia.php +++ b/app/Query/QueryMedia.php @@ -18,10 +18,6 @@ namespace Fisharebest\Webtrees; /** * Class QueryMedia - generate lists of files for admin_media.php - * - * @package webtrees - * @copyright (c) 2014 webtrees development team - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 */ class QueryMedia { /** @@ -80,8 +76,9 @@ class QueryMedia { * @param string $filter optional search string * @param string $form_type option OBJE/FILE/FORM/TYPE * - * @return Media[] * @throws \Exception + * + * @return Media[] */ public static function mediaList($folder, $subfolders, $sort, $filter, $form_type) { global $WT_TREE; @@ -148,6 +145,7 @@ class QueryMedia { $list[] = $media; } } + return $list; } } diff --git a/app/Query/QueryName.php b/app/Query/QueryName.php index e825baa92f..306ae2dc1e 100644 --- a/app/Query/QueryName.php +++ b/app/Query/QueryName.php @@ -18,10 +18,6 @@ namespace Fisharebest\Webtrees; /** * Class QueryName - generate lists for indilist.php and famlist.php - * - * @package webtrees - * @copyright (c) 2015 webtrees development team - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 */ class QueryName { /** @@ -35,82 +31,82 @@ class QueryName { switch ($locale) { case 'ar': return array( - 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی' + 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی', ); case 'cs': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ); case 'da': case 'nb': case 'nn': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å', ); case 'el': return array( - 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω' + 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', ); case 'es': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ); case 'et': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y', ); case 'fi': case 'sv': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö', ); case 'he': return array( - 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת' + 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת', ); case 'hu': return array( - 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS' + 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS', ); case 'lt': return array( - 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž' + 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž', ); case 'nl': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ', ); case 'pl': return array( - 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż' + 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż', ); case 'ro': return array( - 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z', ); case 'ru': return array( - 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я' + 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', ); case 'sk': return array( - 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž' + 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž', ); case 'sl': return array( - 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž' + 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', ); case 'sr': return array( - 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž' + 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', ); case 'tr': return array( - 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z' + 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z', ); default: return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ); } } @@ -231,10 +227,10 @@ class QueryName { /** * Get a list of initial surname letters for indilist.php and famlist.php * - * @param Tree $tree Find surnames from this tree - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only consider individuals with FAMS records - * @param boolean $totals if set, count the number of names beginning with each letter + * @param Tree $tree Find surnames from this tree + * @param bool $marnm if set, include married names + * @param bool $fams if set, only consider individuals with FAMS records + * @param bool $totals if set, count the number of names beginning with each letter * * @return integer[] */ @@ -275,7 +271,7 @@ class QueryName { foreach (self::getAlphabetForLocale(WT_LOCALE) as $n => $letter) { $sql .= " AND n_surn COLLATE :collate_" . $n . " NOT LIKE :letter_" . $n; $args['collate_' . $n] = I18N::collation(); - $args['letter_' . $n] = $letter . '%'; + $args['letter_' . $n] = $letter . '%'; } $sql .= " GROUP BY UPPER(LEFT(n_surn, 1))) AS subquery ORDER BY initial = '', initial = '@', initial"; foreach (Database::prepare($sql)->execute($args)->fetchAssoc() as $alpha => $count) { @@ -306,11 +302,11 @@ class QueryName { /** * Get a list of initial given name letters for indilist.php and famlist.php * - * @param Tree $tree Find names in this tree - * @param string $surn if set, only consider people with this surname - * @param string $salpha if set, only consider surnames starting with this letter - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only consider individuals with FAMS records + * @param Tree $tree Find names in this tree + * @param string $surn if set, only consider people with this surname + * @param string $salpha if set, only consider surnames starting with this letter + * @param bool $marnm if set, include married names + * @param bool $fams if set, only consider individuals with FAMS records * * @return integer[] */ @@ -341,7 +337,7 @@ class QueryName { // are any names beginning with that letter. It looks better to // show the full alphabet, rather than omitting rare letters such as X foreach (self::getAlphabetForLocale(WT_LOCALE) as $letter) { - $count = Database::prepare($sql . " AND " . self::getInitialSql('n_givn', $letter))->fetchOne(); + $count = Database::prepare($sql . " AND " . self::getInitialSql('n_givn', $letter))->fetchOne(); $alphas[$letter] = $count; } @@ -361,7 +357,7 @@ class QueryName { if ($surn) { $sql .= " AND n_surn COLLATE :collate_1 = :surn"; $args['collate_1'] = I18N::collation(); - $args['surn'] = $surn; + $args['surn'] = $surn; } elseif ($salpha === ',') { $sql .= " AND n_surn = ''"; } elseif ($salpha === '@') { @@ -388,11 +384,11 @@ class QueryName { /** * Get a list of actual surnames and variants, based on a "root" surname. * - * @param Tree $tree only fetch individuals from this tree - * @param string $surn if set, only fetch people with this surname - * @param string $salpha if set, only consider surnames starting with this letter - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only consider individuals with FAMS records + * @param Tree $tree only fetch individuals from this tree + * @param string $surn if set, only fetch people with this surname + * @param string $salpha if set, only consider surnames starting with this letter + * @param bool $marnm if set, include married names + * @param bool $fams if set, only consider individuals with FAMS records * * @return array */ @@ -406,14 +402,14 @@ class QueryName { ($marnm ? "" : " AND n_type != '_MARNM'"); $args = array( - 'tree_id' => $tree->getTreeId(), + 'tree_id' => $tree->getTreeId(), 'collate_0' => I18N::collation(), ); if ($surn) { $sql .= " AND n_surn COLLATE :collate_1 = :surn"; $args['collate_1'] = I18N::collation(); - $args['surn'] = $surn; + $args['surn'] = $surn; } elseif ($salpha === ',') { $sql .= " AND n_surn = ''"; } elseif ($salpha === '@') { @@ -442,12 +438,12 @@ class QueryName { * To search for unknown names, use $surn="@N.N.", $salpha="@" or $galpha="@" * To search for names with no surnames, use $salpha="," * - * @param Tree $tree only fetch individuals from this tree - * @param string $surn if set, only fetch people with this surname - * @param string $salpha if set, only fetch surnames starting with this letter + * @param Tree $tree only fetch individuals from this tree + * @param string $surn if set, only fetch people with this surname + * @param string $salpha if set, only fetch surnames starting with this letter * @param string $galpha if set, only fetch given names starting with this letter - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only fetch individuals with FAMS records + * @param bool $marnm if set, include married names + * @param bool $fams if set, only fetch individuals with FAMS records * * @return Individual[] */ @@ -467,7 +463,7 @@ class QueryName { if ($surn) { $sql .= " AND n_surn COLLATE :collate_1 = :surn"; $args['collate_1'] = I18N::collation(); - $args['surn'] = $surn; + $args['surn'] = $surn; } elseif ($salpha === ',') { $sql .= " AND n_surn = ''"; } elseif ($salpha === '@') { @@ -491,7 +487,7 @@ class QueryName { foreach ($rows as $row) { $person = Individual::getInstance($row->xref, $tree, $row->gedcom); // The name from the database may be private - check the filtered list... - foreach ($person->getAllNames() as $n=>$name) { + foreach ($person->getAllNames() as $n => $name) { if ($name['fullNN'] == $row->n_full) { $person->setPrimaryName($n); // We need to clone $person, as we may have multiple references to the @@ -512,11 +508,11 @@ class QueryName { * To search for unknown names, use $surn="@N.N.", $salpha="@" or $galpha="@" * To search for names with no surnames, use $salpha="," * - * @param Tree $tree only fetch individuals from this tree - * @param string $surn if set, only fetch people with this surname - * @param string $salpha if set, only fetch surnames starting with this letter - * @param string $galpha if set, only fetch given names starting with this letter - * @param boolean $marnm if set, include married names + * @param Tree $tree only fetch individuals from this tree + * @param string $surn if set, only fetch people with this surname + * @param string $salpha if set, only fetch surnames starting with this letter + * @param string $galpha if set, only fetch given names starting with this letter + * @param bool $marnm if set, include married names * * @return Family[] */ diff --git a/app/Report/ReportBase.php b/app/Report/ReportBase.php index 7b196b117c..6ea64b581a 100644 --- a/app/Report/ReportBase.php +++ b/app/Report/ReportBase.php @@ -62,16 +62,16 @@ class ReportBase { /** @var string The default Report font name */ public $defaultFont = 'dejavusans'; - /** @var integer The default Report font size */ + /** @var int The default Report font size */ public $defaultFontSize = 12; /** @var string Header (H), Page header (PH), Body (B) or Footer (F) */ public $processing = 'H'; - /** @var boolean RTL Language (false=LTR, true=RTL) */ + /** @var bool RTL Language (false=LTR, true=RTL) */ public $rtl = false; - /** @var boolean Show the Generated by... (true=show the text) */ + /** @var bool Show the Generated by... (true=show the text) */ public $showGenText = true; /** @var string Generated By... text */ @@ -94,7 +94,6 @@ class ReportBase { * * Setting up document wide defaults that will be inherited of the report modules * As DEFAULT A4 and Portrait will be used if not set - * */ public function setup() { // Set RTL direction @@ -389,7 +388,7 @@ class ReportBase { break; default: $this->pageFormat = 'A4'; - $sizes = array(595.28, 841.89); + $sizes = array(595.28, 841.89); break; } $this->pagew = $sizes[0]; @@ -411,7 +410,7 @@ class ReportBase { * * @param string $p Header (H), Page header (PH), Body (B) or Footer (F) * - * @return integer + * @return int */ public function setProcessing($p) { $this->processing = $p; @@ -424,7 +423,7 @@ class ReportBase { * * @param string $data * - * @return integer + * @return int */ public function addTitle($data) { $this->title .= $data; @@ -437,7 +436,7 @@ class ReportBase { * * @param string $data * - * @return integer + * @return int */ public function addDescription($data) { $this->rsubject .= $data; @@ -450,7 +449,7 @@ class ReportBase { * * @param array $style * - * @return integer + * @return int */ public function addStyle($style) { $this->Styles[$style['name']] = $style; @@ -483,7 +482,6 @@ class ReportBase { * @param resource $parser the resource handler for the XML parser * @param string $name the name of the XML element parsed * @param array $attrs an array of key value pairs for the attributes - * */ function startElement($parser, $name, $attrs) { global $elementHandler, $processIfs, $processGedcoms, $processRepeats, $vars; @@ -519,7 +517,6 @@ function startElement($parser, $name, $attrs) { * * @param resource $parser the resource handler for the XML parser * @param string $name the name of the XML element parsed - * */ function endElement($parser, $name) { global $elementHandler, $processIfs, $processGedcoms, $processRepeats; @@ -728,9 +725,9 @@ function pageHeaderStartHandler() { function pageHeaderEndHandler() { global $printData, $printDataStack, $wt_report, $currentElement, $wt_reportStack; - $printData = array_pop($printDataStack); + $printData = array_pop($printDataStack); $currentElement = $wt_report; - $wt_report = array_pop($wt_reportStack); + $wt_report = array_pop($wt_reportStack); $wt_report->addElement($currentElement); } @@ -948,8 +945,6 @@ function totalPagesStartHandler() { * Called at the start of an element. * * @param array $attrs an array of key value pairs for the attributes - * - * @return void */ function gedcomStartHandler($attrs) { global $vars, $gedrec, $gedrecStack, $processGedcoms, $fact, $desc, $ged_level, $WT_TREE; @@ -960,41 +955,41 @@ function gedcomStartHandler($attrs) { return; } - $tag = $attrs['id']; - $tag = str_replace("@fact", $fact, $tag); - $tags = explode(":", $tag); + $tag = $attrs['id']; + $tag = str_replace("@fact", $fact, $tag); + $tags = explode(":", $tag); $newgedrec = ''; if (count($tags) < 2) { - $tmp = GedcomRecord::getInstance($attrs['id'], $WT_TREE); + $tmp = GedcomRecord::getInstance($attrs['id'], $WT_TREE); $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($WT_TREE)) : ''; } if (empty($newgedrec)) { - $tgedrec = $gedrec; + $tgedrec = $gedrec; $newgedrec = ''; foreach ($tags as $tag) { if (preg_match("/\\$(.+)/", $tag, $match)) { if (isset($vars[$match[1]]['gedcom'])) { $newgedrec = $vars[$match[1]]['gedcom']; } else { - $tmp = GedcomRecord::getInstance($match[1], $WT_TREE); + $tmp = GedcomRecord::getInstance($match[1], $WT_TREE); $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($WT_TREE)) : ''; } } else { if (preg_match("/@(.+)/", $tag, $match)) { $gmatch = array(); if (preg_match("/\d $match[1] @([^@]+)@/", $tgedrec, $gmatch)) { - $tmp = GedcomRecord::getInstance($gmatch[1], $WT_TREE); + $tmp = GedcomRecord::getInstance($gmatch[1], $WT_TREE); $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($WT_TREE)) : ''; - $tgedrec = $newgedrec; + $tgedrec = $newgedrec; } else { $newgedrec = ''; break; } } else { - $temp = explode(" ", trim($tgedrec)); - $level = $temp[0] + 1; + $temp = explode(" ", trim($tgedrec)); + $level = $temp[0] + 1; $newgedrec = get_sub_record($level, "$level $tag", $tgedrec); - $tgedrec = $newgedrec; + $tgedrec = $newgedrec; } } } @@ -1004,8 +999,8 @@ function gedcomStartHandler($attrs) { $gedrec = $newgedrec; if (preg_match("/(\d+) (_?[A-Z0-9]+) (.*)/", $gedrec, $match)) { $ged_level = $match[1]; - $fact = $match[2]; - $desc = trim($match[3]); + $fact = $match[2]; + $desc = trim($match[3]); } } else { $processGedcoms++; @@ -1014,8 +1009,6 @@ function gedcomStartHandler($attrs) { /** * Called at the end of an element. - * - * @return void */ function gedcomEndHandler() { global $gedrec, $gedrecStack, $processGedcoms, $fact, $desc; @@ -1023,10 +1016,10 @@ function gedcomEndHandler() { if ($processGedcoms > 0) { $processGedcoms--; } else { - $temp = array_pop($gedrecStack); + $temp = array_pop($gedrecStack); $gedrec = $temp[0]; - $fact = $temp[1]; - $desc = $temp[2]; + $fact = $temp[1]; + $desc = $temp[2]; } } @@ -1163,9 +1156,9 @@ function textBoxStartHandler($attrs) { function textBoxEndHandler() { global $printData, $printDataStack, $wt_report, $currentElement, $wt_reportStack; - $printData = array_pop($printDataStack); + $printData = array_pop($printDataStack); $currentElement = $wt_report; - $wt_report = array_pop($wt_reportStack); + $wt_report = array_pop($wt_reportStack); $wt_report->addElement($currentElement); } @@ -1215,7 +1208,7 @@ function getPersonNameStartHandler($attrs) { // @deprecated global $currentElement, $vars, $gedrec, $WT_TREE; - $id = ""; + $id = ""; $match = array(); if (empty($attrs['id'])) { if (preg_match("/0 @(.+)@/", $gedrec, $match)) { @@ -1254,9 +1247,9 @@ function getPersonNameStartHandler($attrs) { $name = strip_tags($name); if (!empty($attrs['truncate'])) { if (mb_strlen($name) > $attrs['truncate']) { - $name = preg_replace("/\(.*\) ?/", '', $name); //removes () and text inbetween - what about ", [ and { etc? + $name = preg_replace("/\(.*\) ?/", '', $name); //removes () and text inbetween - what about ", [ and { etc? $words = preg_split('/[, -]+/', $name); // names separated with space, comma or hyphen - any others? - $name = $words[count($words) - 1]; + $name = $words[count($words) - 1]; for ($i = count($words) - 2; $i >= 0; $i--) { $len = mb_strlen($name); for ($j = count($words) - 3; $j >= 0; $j--) { @@ -1299,7 +1292,7 @@ function gedcomValueStartHandler($attrs) { // @deprecated global $currentElement, $gedrec, $fact, $desc, $WT_TREE; - $id = ""; + $id = ""; $match = array(); if (preg_match("/0 @(.+)@/", $gedrec, $match)) { $id = $match[1]; @@ -1323,7 +1316,7 @@ function gedcomValueStartHandler($attrs) { } else { $tag = str_replace("@fact", $fact, $tag); if (empty($attrs['level'])) { - $temp = explode(" ", trim($gedrec)); + $temp = explode(" ", trim($gedrec)); $level = $temp[0]; if ($level == 0) { $level++; @@ -1331,15 +1324,15 @@ function gedcomValueStartHandler($attrs) { } else { $level = $attrs['level']; } - $tags = preg_split('/[: ]/', $tag); + $tags = preg_split('/[: ]/', $tag); $value = get_gedcom_value($tag, $level, $gedrec); switch (end($tags)) { case 'DATE': - $tmp = new Date($value); + $tmp = new Date($value); $value = $tmp->display(); break; case 'PLAC': - $tmp = new Place($value, $WT_TREE); + $tmp = new Place($value, $WT_TREE); $value = $tmp->getShortName(); break; } @@ -1373,7 +1366,7 @@ function repeatTagStartHandler($attrs) { } array_push($repeatsStack, array($repeats, $repeatBytes)); - $repeats = array(); + $repeats = array(); $repeatBytes = xml_get_current_line_number($parser); $tag = ""; @@ -1386,17 +1379,17 @@ function repeatTagStartHandler($attrs) { $value = trim($value); $currentElement->addText($value); } else { - $tag = str_replace("@fact", $fact, $tag); - $tags = explode(":", $tag); - $temp = explode(" ", trim($gedrec)); + $tag = str_replace("@fact", $fact, $tag); + $tags = explode(":", $tag); + $temp = explode(" ", trim($gedrec)); $level = $temp[0]; if ($level == 0) { $level++; } $subrec = $gedrec; - $t = $tag; - $count = count($tags); - $i = 0; + $t = $tag; + $count = count($tags); + $i = 0; while ($i < $count) { $t = $tags[$i]; if (!empty($t)) { @@ -1416,7 +1409,7 @@ function repeatTagStartHandler($attrs) { } $level--; $count = preg_match_all("/$level $t(.*)/", $subrec, $match, PREG_SET_ORDER); - $i = 0; + $i = 0; while ($i < $count) { $repeats[] = get_sub_record($level, "$level $t", $subrec, $i + 1); $i++; @@ -1452,7 +1445,7 @@ function repeatTagEndHandler() { } $lineoffset++; $reportxml = "<tempdoc>\n"; - $line_nr = $lineoffset + $repeatBytes; + $line_nr = $lineoffset + $repeatBytes; // RepeatTag Level counter $count = 1; while (0 < $count) { @@ -1475,7 +1468,7 @@ function repeatTagEndHandler() { foreach ($repeats as $gedrec) { //-- start the sax parser $repeat_parser = xml_parser_create(); - $parser = $repeat_parser; + $parser = $repeat_parser; //-- make sure everything is case sensitive xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false); //-- set the main element handler functions @@ -1495,8 +1488,8 @@ function repeatTagEndHandler() { $gedrec = $oldgedrec; $parser = array_pop($parserStack); } - $temp = array_pop($repeatsStack); - $repeats = $temp[0]; + $temp = array_pop($repeatsStack); + $repeats = $temp[0]; $repeatBytes = $temp[1]; } @@ -1504,18 +1497,13 @@ function repeatTagEndHandler() { * Variable lookup * * Retrieve predefined variables : + * * @ desc GEDCOM fact description, example: * 1 EVEN This is a description * @ fact GEDCOM fact tag, such as BIRT, DEAT etc. * $ I18N::translate('....') * $ language_settings[] * - * - * Or retrieve variables preset with <SetVar> element - * - * If the variable is a date and 'date="1"' attribute is set then the date will be reformated - * from Sep to September - * * @param array $attrs an array of key value pairs for the attributes */ function varStartHandler($attrs) { @@ -1551,7 +1539,7 @@ function varStartHandler($attrs) { // Check if variable is set as a date and reformat the date if (isset($attrs['date'])) { if ($attrs['date'] === "1") { - $g = new Date($var); + $g = new Date($var); $var = $g->display(); } } @@ -1571,10 +1559,10 @@ function factsStartHandler($attrs) { } array_push($repeatsStack, array($repeats, $repeatBytes)); - $repeats = array(); + $repeats = array(); $repeatBytes = xml_get_current_line_number($parser); - $id = ""; + $id = ""; $match = array(); if (preg_match("/0 @(.+)@/", $gedrec, $match)) { $id = $match[1]; @@ -1591,7 +1579,7 @@ function factsStartHandler($attrs) { if (empty($attrs['diff']) && !empty($id)) { $facts = $record->getFacts(); sort_facts($facts); - $repeats = array(); + $repeats = array(); $nonfacts = explode(',', $tag); foreach ($facts as $event) { if (!in_array($event->getTag(), $nonfacts)) { @@ -1600,7 +1588,7 @@ function factsStartHandler($attrs) { } } else { foreach ($record->getFacts() as $fact) { - if ($fact->isPendingAddition() && $fact->getTag() <> 'CHAN') { + if ($fact->isPendingAddition() && $fact->getTag() != 'CHAN') { $repeats[] = $fact->getGedcom(); } } @@ -1621,7 +1609,7 @@ function factsEndHandler() { // Check if there is anything to repeat if (count($repeats) > 0) { - $line = xml_get_current_line_number($parser) - 1; + $line = xml_get_current_line_number($parser) - 1; $lineoffset = 0; foreach ($repeatsStack as $rep) { $lineoffset += $rep[1]; @@ -1634,8 +1622,8 @@ function factsEndHandler() { } $lineoffset++; $reportxml = "<tempdoc>\n"; - $i = $line + $lineoffset; - $line_nr = $repeatBytes + $lineoffset; + $i = $line + $lineoffset; + $line_nr = $repeatBytes + $lineoffset; while ($line_nr < $i) { $reportxml .= $lines[$line_nr]; $line_nr++; @@ -1646,12 +1634,12 @@ function factsEndHandler() { // Save original values array_push($parserStack, $parser); $oldgedrec = $gedrec; - $count = count($repeats); - $i = 0; + $count = count($repeats); + $i = 0; while ($i < $count) { $gedrec = $repeats[$i]; - $fact = ""; - $desc = ""; + $fact = ""; + $desc = ""; if (preg_match("/1 (\w+)(.*)/", $gedrec, $match)) { $fact = $match[1]; if ($fact == "EVEN" or $fact == "FACT") { @@ -1667,7 +1655,7 @@ function factsEndHandler() { } //-- start the sax parser $repeat_parser = xml_parser_create(); - $parser = $repeat_parser; + $parser = $repeat_parser; //-- make sure everything is case sensitive xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false); //-- set the main element handler functions @@ -1688,8 +1676,8 @@ function factsEndHandler() { $parser = array_pop($parserStack); $gedrec = $oldgedrec; } - $temp = array_pop($repeatsStack); - $repeats = $temp[0]; + $temp = array_pop($repeatsStack); + $repeats = $temp[0]; $repeatBytes = $temp[1]; } @@ -1706,7 +1694,7 @@ function setVarStartHandler($attrs) { throw new \DomainException('REPORT ERROR var: The attribute "name" is missing or not set in the XML file'); } - $name = $attrs['name']; + $name = $attrs['name']; $value = $attrs['value']; $match = array(); // Current GEDCOM record strings @@ -1730,9 +1718,9 @@ function setVarStartHandler($attrs) { $name = $vars["'" . $match[1] . "'"]['id']; } $count = preg_match_all("/\\$(\w+)/", $value, $match, PREG_SET_ORDER); - $i = 0; + $i = 0; while ($i < $count) { - $t = $vars[$match[$i][1]]['id']; + $t = $vars[$match[$i][1]]['id']; $value = preg_replace("/\\$" . $match[$i][1] . "/", $t, $value, 1); $i++; } @@ -1747,19 +1735,19 @@ function setVarStartHandler($attrs) { if (preg_match("/(\d+)\s*([\-\+\*\/])\s*(\d+)/", $value, $match)) { switch ($match[2]) { case "+": - $t = $match[1] + $match[3]; + $t = $match[1] + $match[3]; $value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value); break; case "-": - $t = $match[1] - $match[3]; + $t = $match[1] - $match[3]; $value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value); break; case "*": - $t = $match[1] * $match[3]; + $t = $match[1] * $match[3]; $value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value); break; case "/": - $t = $match[1] / $match[3]; + $t = $match[1] / $match[3]; $value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value); break; } @@ -1789,11 +1777,11 @@ function ifStartHandler($attrs) { $condition = str_replace(array(" LT ", " GT "), array("<", ">"), $condition); // Replace the first accurance only once of @fact:DATE or in any other combinations to the current fact, such as BIRT $condition = str_replace("@fact", $fact, $condition); - $match = array(); - $count = preg_match_all("/@([\w:\.]+)/", $condition, $match, PREG_SET_ORDER); - $i = 0; + $match = array(); + $count = preg_match_all("/@([\w:\.]+)/", $condition, $match, PREG_SET_ORDER); + $i = 0; while ($i < $count) { - $id = $match[$i][1]; + $id = $match[$i][1]; $value = "\"\""; if ($id == "ID") { if (preg_match("/0 @(.+)@/", $gedrec, $match)) { @@ -1807,7 +1795,7 @@ function ifStartHandler($attrs) { $value = "\"$generation\""; } else { - $temp = explode(" ", trim($gedrec)); + $temp = explode(" ", trim($gedrec)); $level = $temp[0]; if ($level == 0) { $level++; @@ -1824,7 +1812,7 @@ function ifStartHandler($attrs) { $i++; } $condition = "return (bool) ($condition);"; - $ret = @eval($condition); + $ret = @eval($condition); if (!$ret) { $processIfs++; } @@ -1858,14 +1846,14 @@ function footnoteStartHandler($attrs) { if ($record && $record->canShow()) { array_push($printDataStack, $printData); $printData = true; - $style = ""; + $style = ""; if (!empty($attrs['style'])) { $style = $attrs['style']; } $footnoteElement = $currentElement; - $currentElement = $ReportRoot->createFootnote($style); + $currentElement = $ReportRoot->createFootnote($style); } else { - $printData = false; + $printData = false; $processFootnote = false; } } @@ -1880,7 +1868,7 @@ function footnoteEndHandler() { if ($processFootnote) { $printData = array_pop($printDataStack); - $temp = trim($currentElement->getValue()); + $temp = trim($currentElement->getValue()); if (strlen($temp) > 3) { $wt_report->addElement($currentElement); } @@ -1945,7 +1933,7 @@ function ageAtDeathStartHandler() { if ($age != '' && $age != "0d") { if ($fact_age != '' && $fact_age != $age || $fact_age == '' && $husb_age == '' && $wife_age == '' || $husb_age != '' && $person->getSex() == 'M' && $husb_age != $age || $wife_age != '' && $person->getSex() == 'F' && $wife_age != $age ) { - $value = get_age_at_event($age, false); + $value = get_age_at_event($age, false); $abbrev = substr($value, 0, strpos($value, ' ') + 5); if ($value !== $abbrev) { $value = $abbrev . '.'; @@ -1959,7 +1947,6 @@ function ageAtDeathStartHandler() { /** * XML element Forced line break handler - HTML code - * */ function brStartHandler() { global $printData, $currentElement, $processGedcoms; @@ -1984,7 +1971,7 @@ function spStartHandler() { function highlightedImageStartHandler($attrs) { global $gedrec, $wt_report, $ReportRoot, $WT_TREE; - $id = ''; + $id = ''; $match = array(); if (preg_match("/0 @(.+)@/", $gedrec, $match)) { $id = $match[1]; @@ -2026,7 +2013,7 @@ function highlightedImageStartHandler($attrs) { $ln = $attrs['ln']; } - $width = 0; + $width = 0; $height = 0; if (!empty($attrs['width'])) { $width = (int) $attrs['width']; @@ -2035,7 +2022,7 @@ function highlightedImageStartHandler($attrs) { $height = (int) $attrs['height']; } - $person = Individual::getInstance($id, $WT_TREE); + $person = Individual::getInstance($id, $WT_TREE); $mediaobject = $person->findHighlightedMedia(); if ($mediaobject) { $attributes = $mediaobject->getImageAttributes('thumb'); @@ -2057,18 +2044,18 @@ function highlightedImageStartHandler($attrs) { 'SWC', 'IFF', 'WBMP', - 'XBM' + 'XBM', ) ) && $mediaobject->canShow() && $mediaobject->fileExists('thumb') ) { if (($width > 0) and ($height == 0)) { - $perc = $width / $attributes['adjW']; + $perc = $width / $attributes['adjW']; $height = round($attributes['adjH'] * $perc); } elseif ($height > 0 && $width == 0) { - $perc = $height / $attributes['adjH']; + $perc = $height / $attributes['adjH']; $width = round($attributes['adjW'] * $perc); } else { - $width = $attributes['adjW']; + $width = $attributes['adjW']; $height = $attributes['adjH']; } $image = $ReportRoot->createImageFromObject($mediaobject, $left, $top, $width, $height, $align, $ln); @@ -2119,7 +2106,7 @@ function imageStartHandler($attrs) { $ln = $attrs['ln']; } - $width = 0; + $width = 0; $height = 0; if (!empty($attrs['width'])) { $width = (int) $attrs['width']; @@ -2136,7 +2123,7 @@ function imageStartHandler($attrs) { $match = array(); if (preg_match("/\d OBJE @(.+)@/", $gedrec, $match)) { $mediaobject = Media::getInstance($match[1], $WT_TREE); - $attributes = $mediaobject->getImageAttributes('thumb'); + $attributes = $mediaobject->getImageAttributes('thumb'); if (in_array( $attributes['ext'], array( @@ -2155,18 +2142,18 @@ function imageStartHandler($attrs) { 'SWC', 'IFF', 'WBMP', - 'XBM' + 'XBM', ) ) && $mediaobject->canShow() && $mediaobject->fileExists('thumb') ) { if (($width > 0) and ($height == 0)) { - $perc = $width / $attributes['adjW']; + $perc = $width / $attributes['adjW']; $height = round($attributes['adjH'] * $perc); } elseif ($height > 0 && $width == 0) { - $perc = $height / $attributes['adjH']; + $perc = $height / $attributes['adjH']; $width = round($attributes['adjW'] * $perc); } else { - $width = $attributes['adjW']; + $width = $attributes['adjW']; $height = $attributes['adjH']; } $image = $ReportRoot->createImageFromObject($mediaobject, $left, $top, $width, $height, $align, $ln); @@ -2177,13 +2164,13 @@ function imageStartHandler($attrs) { if (file_exists($file) && preg_match("/(jpg|jpeg|png|gif)$/i", $file)) { $size = getimagesize($file); if (($width > 0) and ($height == 0)) { - $perc = $width / $size[0]; + $perc = $width / $size[0]; $height = round($size[1] * $perc); } elseif ($height > 0 && $width == 0) { - $perc = $height / $size[1]; + $perc = $height / $size[1]; $width = round($size[0] * $perc); } else { - $width = $size[0]; + $width = $size[0]; $height = $size[1]; } $image = $ReportRoot->createImage($file, $left, $top, $width, $height, $align, $ln); @@ -2457,14 +2444,14 @@ function listStartHandler($attrs) { throw new \DomainException('Invalid list name: ' . $listname); } - $filters = array(); + $filters = array(); $filters2 = array(); if ((isset($attrs['filter1'])) and (count($list) > 0)) { foreach ($attrs as $key => $value) { if (preg_match("/filter(\d)/", $key)) { $condition = $value; if (preg_match("/@(\w+)/", $condition, $match)) { - $id = $match[1]; + $id = $match[1]; $value = "''"; if ($id == "ID") { if (preg_match("/0 @(.+)@/", $gedrec, $match)) { @@ -2483,16 +2470,16 @@ function listStartHandler($attrs) { } //-- handle regular expressions if (preg_match("/([A-Z:]+)\s*([^\s]+)\s*(.+)/", $condition, $match)) { - $tag = trim($match[1]); + $tag = trim($match[1]); $expr = trim($match[2]); - $val = trim($match[3]); + $val = trim($match[3]); if (preg_match("/\\$(\w+)/", $val, $match)) { $val = $vars[$match[1]]['id']; $val = trim($val); } if ($val) { $searchstr = ""; - $tags = explode(":", $tag); + $tags = explode(":", $tag); //-- only limit to a level number if we are specifically looking at a level if (count($tags) > 1) { $level = 1; @@ -2511,7 +2498,7 @@ function listStartHandler($attrs) { if ($tag == "EMAIL" || $tag == "_EMAIL") { $tag = "_?EMAIL"; } - $t = $tag; + $t = $tag; $searchstr = "1 " . $tag; } switch ($expr) { @@ -2546,26 +2533,26 @@ function listStartHandler($attrs) { if ($filters2) { $mylist = array(); foreach ($list as $indi) { - $key = $indi->getXref(); + $key = $indi->getXref(); $grec = $indi->privatizeGedcom(Auth::accessLevel($WT_TREE)); $keep = true; foreach ($filters2 as $filter) { if ($keep) { - $tag = $filter['tag']; + $tag = $filter['tag']; $expr = $filter['expr']; - $val = $filter['val']; + $val = $filter['val']; if ($val == "''") { $val = ""; } $tags = explode(":", $tag); - $t = end($tags); - $v = get_gedcom_value($tag, 1, $grec); + $t = end($tags); + $v = get_gedcom_value($tag, 1, $grec); //-- check for EMAIL and _EMAIL (silly double gedcom standard :P) if ($t == "EMAIL" && empty($v)) { - $tag = str_replace("EMAIL", "_EMAIL", $tag); + $tag = str_replace("EMAIL", "_EMAIL", $tag); $tags = explode(":", $tag); - $t = end($tags); - $v = get_sub_record(1, $tag, $grec); + $t = end($tags); + $v = get_sub_record(1, $tag, $grec); } switch ($expr) { @@ -2573,7 +2560,7 @@ function listStartHandler($attrs) { if ($t == "DATE") { $date1 = new Date($v); $date2 = new Date($val); - $keep = (Date::compare($date1, $date2) >= 0); + $keep = (Date::compare($date1, $date2) >= 0); } elseif ($val >= $v) { $keep = true; } @@ -2582,7 +2569,7 @@ function listStartHandler($attrs) { if ($t == "DATE") { $date1 = new Date($v); $date2 = new Date($val); - $keep = (Date::compare($date1, $date2) <= 0); + $keep = (Date::compare($date1, $date2) <= 0); } elseif ($val >= $v) { $keep = true; } @@ -2655,7 +2642,7 @@ function listEndHandler() { } $lineoffset++; $reportxml = "<tempdoc>\n"; - $line_nr = $lineoffset + $repeatBytes; + $line_nr = $lineoffset + $repeatBytes; // List Level counter $count = 1; while (0 < $count) { @@ -2676,14 +2663,14 @@ function listEndHandler() { array_push($parserStack, $parser); $oldgedrec = $gedrec; - $list_total = count($list); + $list_total = count($list); $list_private = 0; foreach ($list as $record) { if ($record->canShow()) { $gedrec = $record->privatizeGedcom(Auth::accessLevel($record->getTree())); //-- start the sax parser $repeat_parser = xml_parser_create(); - $parser = $repeat_parser; + $parser = $repeat_parser; //-- make sure everything is case sensitive xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false); //-- set the main element handler functions @@ -2707,8 +2694,8 @@ function listEndHandler() { $parser = array_pop($parserStack); $gedrec = $oldgedrec; } - $temp = array_pop($repeatsStack); - $repeats = $temp[0]; + $temp = array_pop($repeatsStack); + $repeats = $temp[0]; $repeatBytes = $temp[1]; } @@ -2780,7 +2767,7 @@ function relativesStartHandler($attrs) { $id = trim($id); } - $list = array(); + $list = array(); $person = Individual::getInstance($id, $WT_TREE); if (!empty($person)) { $list[$id] = $person; @@ -2788,7 +2775,7 @@ function relativesStartHandler($attrs) { case "child-family": foreach ($person->getChildFamilies() as $family) { $husband = $family->getHusband(); - $wife = $family->getWife(); + $wife = $family->getWife(); if (!empty($husband)) { $list[$husband->getXref()] = $husband; } @@ -2806,7 +2793,7 @@ function relativesStartHandler($attrs) { case "spouse-family": foreach ($person->getSpouseFamilies() as $family) { $husband = $family->getHusband(); - $wife = $family->getWife(); + $wife = $family->getWife(); if (!empty($husband)) { $list[$husband->getXref()] = $husband; } @@ -2856,7 +2843,7 @@ function relativesStartHandler($attrs) { foreach ($list as $key => $value) { $generation = $value->generation; if ($generation == $genCounter) { - $newarray[$key] = new \stdClass; + $newarray[$key] = new \stdClass; $newarray[$key]->generation = $generation; } } @@ -2896,7 +2883,7 @@ function relativesEndHandler() { } $lineoffset++; $reportxml = "<tempdoc>\n"; - $line_nr = $lineoffset + $repeatBytes; + $line_nr = $lineoffset + $repeatBytes; // Relatives Level counter $count = 1; while (0 < $count) { @@ -2917,17 +2904,17 @@ function relativesEndHandler() { array_push($parserStack, $parser); $oldgedrec = $gedrec; - $list_total = count($list); + $list_total = count($list); $list_private = 0; foreach ($list as $key => $value) { if (isset($value->generation)) { $generation = $value->generation; } - $tmp = GedcomRecord::getInstance($key, $WT_TREE); + $tmp = GedcomRecord::getInstance($key, $WT_TREE); $gedrec = $tmp->privatizeGedcom(Auth::accessLevel($WT_TREE)); //-- start the sax parser $repeat_parser = xml_parser_create(); - $parser = $repeat_parser; + $parser = $repeat_parser; //-- make sure everything is case sensitive xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false); //-- set the main element handler functions @@ -2945,8 +2932,8 @@ function relativesEndHandler() { $parser = array_pop($parserStack); $gedrec = $oldgedrec; } - $temp = array_pop($repeatsStack); - $repeats = $temp[0]; + $temp = array_pop($repeatsStack); + $repeats = $temp[0]; $repeatBytes = $temp[1]; } @@ -2988,7 +2975,7 @@ function htmlStartHandler($tag, $attrs) { return; } array_push($wt_reportStack, $wt_report); - $wt_report = $ReportRoot->createHTML($tag, $attrs); + $wt_report = $ReportRoot->createHTML($tag, $attrs); $currentElement = $wt_report; array_push($printDataStack, $printData); @@ -3004,9 +2991,9 @@ function htmlEndHandler($tag) { return; } - $printData = array_pop($printDataStack); + $printData = array_pop($printDataStack); $currentElement = $wt_report; - $wt_report = array_pop($wt_reportStack); + $wt_report = array_pop($wt_reportStack); if (!is_null($wt_report)) { $wt_report->addElement($currentElement); } else { @@ -3050,7 +3037,7 @@ function descriptionEndHandler() { * get gedcom tag value * * @param string $tag The tag to find, use : to delineate subtags - * @param integer $level The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record + * @param int $level The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record * @param string $gedrec The gedcom record to get the value from * * @return string the value of a gedcom tag from the given gedcom record @@ -3061,16 +3048,16 @@ function get_gedcom_value($tag, $level, $gedrec) { if (empty($gedrec)) { return ''; } - $tags = explode(':', $tag); + $tags = explode(':', $tag); $origlevel = $level; if ($level == 0) { - $level = $gedrec{0} +1; + $level = $gedrec{0} + 1; } $subrec = $gedrec; foreach ($tags as $t) { $lastsubrec = $subrec; - $subrec = get_sub_record($level, "$level $t", $subrec); + $subrec = get_sub_record($level, "$level $t", $subrec); if (empty($subrec) && $origlevel == 0) { $level--; $subrec = get_sub_record($level, "$level $t", $lastsubrec); @@ -3126,13 +3113,13 @@ function get_gedcom_value($tag, $level, $gedrec) { /** * @param string[] $list * @param string $pid - * @param boolean $children - * @param integer $generations + * @param bool $children + * @param int $generations */ function add_ancestors(&$list, $pid, $children = false, $generations = -1) { global $WT_TREE; - $genlist = array($pid); + $genlist = array($pid); $list[$pid]->generation = 1; while (count($genlist) > 0) { $id = array_shift($genlist); @@ -3142,13 +3129,13 @@ function add_ancestors(&$list, $pid, $children = false, $generations = -1) { $person = Individual::getInstance($id, $WT_TREE); foreach ($person->getChildFamilies() as $family) { $husband = $family->getHusband(); - $wife = $family->getWife(); + $wife = $family->getWife(); if ($husband) { - $list[$husband->getXref()] = $husband; + $list[$husband->getXref()] = $husband; $list[$husband->getXref()]->generation = $list[$id]->generation + 1; } if ($wife) { - $list[$wife->getXref()] = $wife; + $list[$wife->getXref()] = $wife; $list[$wife->getXref()]->generation = $list[$id]->generation + 1; } if ($generations == -1 || $list[$id]->generation + 1 < $generations) { @@ -3176,8 +3163,8 @@ function add_ancestors(&$list, $pid, $children = false, $generations = -1) { /** * @param string[] $list * @param string $pid - * @param boolean $parents - * @param integer $generations + * @param bool $parents + * @param int $generations */ function add_descendancy(&$list, $pid, $parents = false, $generations = -1) { global $WT_TREE; @@ -3195,7 +3182,7 @@ function add_descendancy(&$list, $pid, $parents = false, $generations = -1) { foreach ($person->getSpouseFamilies() as $family) { if ($parents) { $husband = $family->getHusband(); - $wife = $family->getWife(); + $wife = $family->getWife(); if ($husband) { $list[$husband->getXref()] = $husband; if (isset($list[$pid]->generation)) { diff --git a/app/Report/ReportBaseCell.php b/app/Report/ReportBaseCell.php index 3cc3eceaa3..04349744b7 100644 --- a/app/Report/ReportBaseCell.php +++ b/app/Report/ReportBaseCell.php @@ -114,40 +114,40 @@ class ReportBaseCell extends ReportBaseElement { /** * CELL - Element * - * @param integer $width cell width (expressed in points) - * @param integer $height cell height (expressed in points) - * @param mixed $border Border style - * @param string $align Text alignement - * @param string $bgcolor Background color code - * @param string $style The name of the text style - * @param integer $ln Indicates where the current position should go after the call - * @param mixed $top Y-position - * @param mixed $left X-position - * @param integer $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. - * @param integer $stretch Stretch carachter mode - * @param string $bocolor Border color - * @param string $tcolor Text color - * @param $reseth + * @param int $width cell width (expressed in points) + * @param int $height cell height (expressed in points) + * @param mixed $border Border style + * @param string $align Text alignement + * @param string $bgcolor Background color code + * @param string $style The name of the text style + * @param int $ln Indicates where the current position should go after the call + * @param mixed $top Y-position + * @param mixed $left X-position + * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. + * @param int $stretch Stretch carachter mode + * @param string $bocolor Border color + * @param string $tcolor Text color + * @param $reseth */ public function __construct( $width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth ) { - $this->align = $align; - $this->border = $border; - $this->bgcolor = $bgcolor; - $this->bocolor = $bocolor; - $this->fill = $fill; - $this->height = $height; - $this->left = $left; - $this->newline = $ln; + $this->align = $align; + $this->border = $border; + $this->bgcolor = $bgcolor; + $this->bocolor = $bocolor; + $this->fill = $fill; + $this->height = $height; + $this->left = $left; + $this->newline = $ln; $this->styleName = $style; - $this->text = ""; - $this->tcolor = $tcolor; - $this->top = $top; - $this->url = ""; - $this->stretch = $stretch; - $this->width = $width; - $this->reseth = $reseth; + $this->text = ""; + $this->tcolor = $tcolor; + $this->top = $top; + $this->url = ""; + $this->stretch = $stretch; + $this->width = $width; + $this->reseth = $reseth; return 0; } @@ -168,7 +168,7 @@ class ReportBaseCell extends ReportBaseElement { * * @param string $url The URL address to save * - * @return integer + * @return int */ public function setUrl($url) { $this->url = $url; diff --git a/app/Report/ReportBaseElement.php b/app/Report/ReportBaseElement.php index 1102257413..7a9fcf6d0f 100644 --- a/app/Report/ReportBaseElement.php +++ b/app/Report/ReportBaseElement.php @@ -29,8 +29,6 @@ class ReportBaseElement { * Element renderer * * @param ReportHtml|ReportPdf $renderer - * - * @return void */ public function render($renderer) { //-- to be implemented in inherited classes @@ -57,7 +55,7 @@ class ReportBaseElement { /** * @param string $t * - * @return integer + * @return int */ public function addText($t) { global $wt_report, $reportTitle, $reportDescription; @@ -79,7 +77,7 @@ class ReportBaseElement { } /** - * @return integer + * @return int */ public function addNewline() { $this->text .= "\n"; @@ -98,7 +96,7 @@ class ReportBaseElement { * @param $wrapwidth * @param $cellwidth * - * @return integer + * @return int */ public function setWrapWidth($wrapwidth, $cellwidth) { return 0; @@ -106,8 +104,6 @@ class ReportBaseElement { /** * @param $renderer - * - * @return void */ public function renderFootnote($renderer) { // To be implemented in inherited classes @@ -115,8 +111,6 @@ class ReportBaseElement { /** * @param $text - * - * @return void */ public function setText($text) { $this->text = $text; diff --git a/app/Report/ReportBaseFootnote.php b/app/Report/ReportBaseFootnote.php index 1a6055b962..7014d0ce72 100644 --- a/app/Report/ReportBaseFootnote.php +++ b/app/Report/ReportBaseFootnote.php @@ -74,7 +74,7 @@ class ReportBaseFootnote extends ReportBaseElement { /** * @param $t * - * @return integer + * @return int */ public function addText($t) { $t = trim($t, "\r\n\t"); @@ -106,10 +106,10 @@ class ReportBaseFootnote extends ReportBaseElement { /** * @param $n * - * @return integer + * @return int */ public function setNum($n) { - $this->num = $n; + $this->num = $n; $this->numText = "$n "; return 0; @@ -118,7 +118,7 @@ class ReportBaseFootnote extends ReportBaseElement { /** * @param $a * - * @return integer + * @return int */ public function setAddlink($a) { $this->addlink = $a; diff --git a/app/Report/ReportBaseHtml.php b/app/Report/ReportBaseHtml.php index 02d6e50f22..8752180d45 100644 --- a/app/Report/ReportBaseHtml.php +++ b/app/Report/ReportBaseHtml.php @@ -29,7 +29,7 @@ class ReportBaseHtml extends ReportBaseElement { * @param $attrs */ public function __construct($tag, $attrs) { - $this->tag = $tag; + $this->tag = $tag; $this->attrs = $attrs; return 0; @@ -58,7 +58,7 @@ class ReportBaseHtml extends ReportBaseElement { /** * @param $element * - * @return integer + * @return int */ public function addElement($element) { $this->elements[] = $element; diff --git a/app/Report/ReportBaseImage.php b/app/Report/ReportBaseImage.php index dd457e41f2..434f263b8e 100644 --- a/app/Report/ReportBaseImage.php +++ b/app/Report/ReportBaseImage.php @@ -75,13 +75,13 @@ class ReportBaseImage extends ReportBaseElement { * @param string $ln T:same line, N:next line */ public function __construct($file, $x, $y, $w, $h, $align, $ln) { - $this->file = $file; - $this->width = $w; + $this->file = $file; + $this->width = $w; $this->height = $h; - $this->x = $x; - $this->y = $y; - $this->align = $align; - $this->line = $ln; + $this->x = $x; + $this->y = $y; + $this->align = $align; + $this->line = $ln; return 0; } diff --git a/app/Report/ReportBasePageheader.php b/app/Report/ReportBasePageheader.php index a1f482d893..17b6c43488 100644 --- a/app/Report/ReportBasePageheader.php +++ b/app/Report/ReportBasePageheader.php @@ -32,7 +32,7 @@ class ReportBasePageheader extends ReportBaseElement { } /** - * @return integer + * @return int */ public function textBox() { $this->elements = array(); @@ -45,7 +45,7 @@ class ReportBasePageheader extends ReportBaseElement { * * @param $element * - * @return integer + * @return int */ public function addElement($element) { $this->elements[] = $element; diff --git a/app/Report/ReportBaseText.php b/app/Report/ReportBaseText.php index 4f7bfa4214..ad1cb50c42 100644 --- a/app/Report/ReportBaseText.php +++ b/app/Report/ReportBaseText.php @@ -35,13 +35,13 @@ class ReportBaseText extends ReportBaseElement { /** * Remaining width of a cel * - * @var integer User unit (points) + * @var int User unit (points) */ public $wrapWidthRemaining; /** * Original width of a cell * - * @var integer User unit (points) + * @var int User unit (points) */ public $wrapWidthCell; @@ -52,10 +52,10 @@ class ReportBaseText extends ReportBaseElement { * @param string $color HTML color code */ public function __construct($style, $color) { - $this->text = ''; - $this->color = $color; + $this->text = ''; + $this->color = $color; $this->wrapWidthRemaining = 0; - $this->styleName = $style; + $this->styleName = $style; return 0; } diff --git a/app/Report/ReportBaseTextbox.php b/app/Report/ReportBaseTextbox.php index 6d84743b58..2bdc52f937 100644 --- a/app/Report/ReportBaseTextbox.php +++ b/app/Report/ReportBaseTextbox.php @@ -36,7 +36,7 @@ class ReportBaseTextbox extends ReportBaseElement { /** * Whether or not paint the background * - * @var boolean + * @var bool */ public $fill; @@ -55,19 +55,19 @@ class ReportBaseTextbox extends ReportBaseElement { /** * After this box is finished rendering, should the next section of text start immediately after the this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. Default is 0 * - * @var boolean + * @var bool */ public $newline; /** - * @var boolean + * @var bool */ public $pagecheck; /** * Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0 * - * @var boolean + * @var bool */ public $border; /** @@ -86,7 +86,7 @@ class ReportBaseTextbox extends ReportBaseElement { public $style; /** - * @var array $borderstyle Border style of rectangle. Array with keys among the following: + * @var array Border style of rectangle. Array with keys among the following: * <ul> * <li>all: Line style of all borders. Array like for {@link SetLineStyle SetLineStyle}.</li> * <li>L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for {@link SetLineStyle SetLineStyle}.</li> @@ -110,7 +110,7 @@ class ReportBaseTextbox extends ReportBaseElement { /** * Use cell padding or not * - * @var boolean $padding + * @var bool */ public $padding; /** @@ -121,34 +121,34 @@ class ReportBaseTextbox extends ReportBaseElement { /** * TextBox - Element - Base * - * @param float $width Text box width - * @param float $height Text box height - * @param boolean $border - * @param string $bgcolor Background color code in HTML - * @param boolean $newline - * @param mixed $left - * @param mixed $top - * @param boolean $pagecheck - * @param string $style - * @param boolean $fill - * @param boolean $padding - * @param boolean $reseth + * @param float $width Text box width + * @param float $height Text box height + * @param bool $border + * @param string $bgcolor Background color code in HTML + * @param bool $newline + * @param mixed $left + * @param mixed $top + * @param bool $pagecheck + * @param string $style + * @param bool $fill + * @param bool $padding + * @param bool $reseth */ public function __construct( $width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth ) { - $this->border = $border; - $this->bgcolor = $bgcolor; - $this->fill = $fill; - $this->height = $height; - $this->left = $left; - $this->newline = $newline; + $this->border = $border; + $this->bgcolor = $bgcolor; + $this->fill = $fill; + $this->height = $height; + $this->left = $left; + $this->newline = $newline; $this->pagecheck = $pagecheck; - $this->style = $style; - $this->top = $top; - $this->width = $width; - $this->padding = $padding; - $this->reseth = $reseth; + $this->style = $style; + $this->top = $top; + $this->width = $width; + $this->padding = $padding; + $this->reseth = $reseth; return 0; } @@ -158,7 +158,7 @@ class ReportBaseTextbox extends ReportBaseElement { * * @param object|string $element * - * @return integer + * @return int */ public function addElement($element) { $this->elements[] = $element; diff --git a/app/Report/ReportHtml.php b/app/Report/ReportHtml.php index 987ab7cc41..08badcde63 100644 --- a/app/Report/ReportHtml.php +++ b/app/Report/ReportHtml.php @@ -135,7 +135,7 @@ class ReportHtml extends ReportBase { // Setting up the correct dimensions if Portrait (default) or Landscape if ($this->orientation == "landscape") { - $tmpw = $this->pagew; + $tmpw = $this->pagew; $this->pagew = $this->pageh; $this->pageh = $tmpw; } @@ -143,7 +143,7 @@ class ReportHtml extends ReportBase { $this->noMarginWidth = (int) ($this->pagew - $this->leftmargin - $this->rightmargin); // If RTL if ($this->rtl) { - $this->alignRTL = "right"; + $this->alignRTL = "right"; $this->entityRTL = "‏"; } // Change the default HTML font name @@ -252,7 +252,7 @@ class ReportHtml extends ReportBase { echo '</div>'; echo '<script>document.getElementById("headerdiv").style.height="', $this->topmargin - $this->headermargin - 6, 'pt";</script>'; echo '<div id="bodydiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt; height: 100%;">'; - $this->Y = 0; + $this->Y = 0; $this->maxY = 0; $this->runPageHeader(); foreach ($this->bodyElements as $element) { @@ -269,8 +269,8 @@ class ReportHtml extends ReportBase { echo '<script>document.getElementById("bodydiv").style.height="', $this->maxY, 'pt";</script>'; echo '<div id="bottommargin" style="position: relative; top: auto; height: ', $this->bottommargin - $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; echo '<div id="footerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;height:auto;">'; - $this->Y = 0; - $this->X = 0; + $this->Y = 0; + $this->X = 0; $this->maxY = 0; foreach ($this->footerElements as $element) { if (is_object($element)) { @@ -289,20 +289,20 @@ class ReportHtml extends ReportBase { /** * Create a new Cell object - ReportHtml * - * @param integer $width cell width (expressed in points) - * @param integer $height cell height (expressed in points) - * @param mixed $border Border style - * @param string $align Text alignement - * @param string $bgcolor Background color code - * @param string $style The name of the text style - * @param integer $ln Indicates where the current position should go after the call - * @param mixed $top Y-position - * @param mixed $left X-position - * @param integer $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. - * @param integer $stretch Stretch carachter mode - * @param string $bocolor Border color - * @param string $tcolor Text color - * @param boolean $reseth + * @param int $width cell width (expressed in points) + * @param int $height cell height (expressed in points) + * @param mixed $border Border style + * @param string $align Text alignement + * @param string $bgcolor Background color code + * @param string $style The name of the text style + * @param int $ln Indicates where the current position should go after the call + * @param mixed $top Y-position + * @param mixed $left X-position + * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. + * @param int $stretch Stretch carachter mode + * @param string $bocolor Border color + * @param string $tcolor Text color + * @param bool $reseth * * @return object ReportHtmlCell */ @@ -450,10 +450,11 @@ class ReportHtml extends ReportBase { /** * @param $element * - * @return integer + * @return int */ public function addPageHeader($element) { $this->pageHeaderElements[] = $element; + return count($this->headerElements) - 1; } @@ -462,17 +463,18 @@ class ReportHtml extends ReportBase { * * @param object $footnote * - * @return boolean false if not numbered before | object if already numbered + * @return bool false if not numbered before | object if already numbered */ public function checkFootnote($footnote) { - $ct = count($this->printedfootnotes); - $i = 0; + $ct = count($this->printedfootnotes); + $i = 0; $val = $footnote->getValue(); while ($i < $ct) { if ($this->printedfootnotes[$i]->getValue() == $val) { // If this footnote already exist then set up the numbers for this object $footnote->setNum($i + 1); $footnote->setAddlink($i + 1); + return $this->printedfootnotes[$i]; } $i++; @@ -481,6 +483,7 @@ class ReportHtml extends ReportBase { $footnote->setNum($ct + 1); $footnote->setAddlink($ct + 1); $this->printedfootnotes[] = $footnote; + return false; } @@ -496,12 +499,13 @@ class ReportHtml extends ReportBase { * * @param string $str * - * @return integer Number of lines. 0 if empty line + * @return int Number of lines. 0 if empty line */ public function countLines($str) { if ($str == "") { return 0; } + return (substr_count($str, "\n") + 1); } @@ -513,26 +517,28 @@ class ReportHtml extends ReportBase { } /** - * @return integer + * @return int */ public function getCurrentStyleHeight() { if (empty($this->currentStyle)) { return $this->defaultFontSize; } $style = $this->getStyle($this->currentStyle); + return $style["size"]; } /** * @param $cellWidth * - * @return integer + * @return int */ public function getFootnotesHeight($cellWidth) { $h = 0; foreach ($this->printedfootnotes as $element) { $h += $element->getFootnoteHeight($this, $cellWidth); } + return $h; } @@ -555,10 +561,11 @@ class ReportHtml extends ReportBase { /** * @param $text * - * @return integer + * @return int */ public function getStringWidth($text) { $style = $this->getStyle($this->currentStyle); + return mb_strlen($text) * ($style['size'] / 2); } @@ -567,7 +574,7 @@ class ReportHtml extends ReportBase { * * @param $str * - * @return integer + * @return int */ public function getTextCellHeight($str) { // Count the number of lines to calculate the height @@ -597,7 +604,7 @@ class ReportHtml extends ReportBase { /** * Get the current page number - ReportHtml * - * @return integer + * @return int */ public function pageNo() { return $this->pageN; @@ -649,8 +656,8 @@ class ReportHtml extends ReportBase { /** * Wrap text - ReportHtml * - * @param string $str Text to wrap - * @param integer $width Width in points the text has to fit into + * @param string $str Text to wrap + * @param int $width Width in points the text has to fit into * * @return string */ @@ -660,7 +667,7 @@ class ReportHtml extends ReportBase { // Wordwrap each line $lines = explode("\n", $str); // Line Feed counter - $lfct = count($lines); + $lfct = count($lines); $wraptext = ''; foreach ($lines as $line) { $wtext = utf8_wordwrap($line, $lw, "\n", true); @@ -671,18 +678,19 @@ class ReportHtml extends ReportBase { } $lfct--; } + return $wraptext; } /** * Write text - ReportHtml * - * @param string $text Text to print - * @param string $color HTML RGB color code (Ex: #001122) - * @param boolean $useclass + * @param string $text Text to print + * @param string $color HTML RGB color code (Ex: #001122) + * @param bool $useclass */ public function write($text, $color = '', $useclass = true) { - $style = $this->getStyle($this->getCurrentStyle()); + $style = $this->getStyle($this->getCurrentStyle()); $htmlcode = '<span dir="' . I18N::direction() . '"'; if ($useclass) { $htmlcode .= ' class="' . $style['name'] . '"'; diff --git a/app/Report/ReportHtmlCell.php b/app/Report/ReportHtmlCell.php index f0acc03e45..9383f4a080 100644 --- a/app/Report/ReportHtmlCell.php +++ b/app/Report/ReportHtmlCell.php @@ -24,8 +24,6 @@ class ReportHtmlCell extends ReportBaseCell { * HTML Cell renderer * * @param ReportHtml $renderer - * - * @return void */ public function render($renderer) { if (strpos($this->text, "{{:ptp:}}") !== false) { @@ -135,7 +133,7 @@ class ReportHtmlCell extends ReportBaseCell { if (!empty($temptext)) { // Wrap the text $temptext = $renderer->textWrap($temptext, $cW); - $tmph = $renderer->getTextCellHeight($temptext); + $tmph = $renderer->getTextCellHeight($temptext); // Add some cell padding $this->height += $cP; if ($tmph > $this->height) { diff --git a/app/Report/ReportHtmlFootnote.php b/app/Report/ReportHtmlFootnote.php index cdc565ec13..e8a2e45af3 100644 --- a/app/Report/ReportHtmlFootnote.php +++ b/app/Report/ReportHtmlFootnote.php @@ -24,8 +24,6 @@ class ReportHtmlFootnote extends ReportBaseFootnote { * HTML Footnotes number renderer * * @param ReportHtml $renderer - * - * @return void */ public function render($renderer) { $renderer->setCurrentStyle("footnotenum"); @@ -39,8 +37,6 @@ class ReportHtmlFootnote extends ReportBaseFootnote { * Uses style name "footnote" by default * * @param ReportHtml $html - * - * @return void */ public function renderFootnote($html) { @@ -62,9 +58,9 @@ class ReportHtmlFootnote extends ReportBaseFootnote { * Calculates the Footnotes height * * @param ReportHtml $html - * @param integer $cellWidth The width of the cell to use it for text wraping + * @param int $cellWidth The width of the cell to use it for text wraping * - * @return integer Footnote height in points + * @return int Footnote height in points */ public function getFootnoteHeight($html, $cellWidth = 0) { if ($html->getCurrentStyle() != $this->styleName) { @@ -75,8 +71,9 @@ class ReportHtmlFootnote extends ReportBaseFootnote { $this->text = $html->textWrap($this->text, $cellWidth); } $this->text = $this->text . "\n\n"; - $ct = substr_count($this->text, "\n"); - $fsize = $html->getCurrentStyleHeight(); + $ct = substr_count($this->text, "\n"); + $fsize = $html->getCurrentStyleHeight(); + return ($fsize * $ct) * $html->cellHeightRatio; } @@ -111,18 +108,18 @@ class ReportHtmlFootnote extends ReportBaseFootnote { if ($this->wrapWidthRemaining > 0) { // Check with line counter too! if (($lw >= $this->wrapWidthRemaining) or ($lfct > 1)) { - $newtext = ""; + $newtext = ""; $wrapWidthRemaining = $this->wrapWidthRemaining; - $lines = explode("\n", $this->numText); + $lines = explode("\n", $this->numText); // Go throught the text line by line foreach ($lines as $line) { // Line width in points + a little margin $lw = $html->GetStringWidth($line); // If the line has to be wraped if ($lw > $wrapWidthRemaining) { - $words = explode(" ", $line); + $words = explode(" ", $line); $addspace = count($words); - $lw = 0; + $lw = 0; foreach ($words as $word) { $addspace--; $lw += $html->GetStringWidth($word . " "); @@ -156,15 +153,17 @@ class ReportHtmlFootnote extends ReportBaseFootnote { $lfct--; } $this->numText = $newtext; - $lfct = substr_count($this->numText, "\n"); + $lfct = substr_count($this->numText, "\n"); + return array($lw, 1, $lfct); } } - $l = 0; + $l = 0; $lfct = substr_count($this->numText, "\n"); if ($lfct > 0) { $l = 2; } + return array($lw, $l, $lfct); } } diff --git a/app/Report/ReportHtmlHtml.php b/app/Report/ReportHtmlHtml.php index ff6546b47a..4140aae11e 100644 --- a/app/Report/ReportHtmlHtml.php +++ b/app/Report/ReportHtmlHtml.php @@ -22,8 +22,8 @@ namespace Fisharebest\Webtrees; class ReportHtmlHtml extends ReportBaseHtml { /** * @param ReportHtml $renderer - * @param boolean $sub - * @param boolean $inat + * @param bool $sub + * @param bool $inat * * @return string */ @@ -53,7 +53,7 @@ class ReportHtmlHtml extends ReportBaseHtml { if ($inat) { $startX = $renderer->GetX(); $startY = $renderer->GetY(); - $width = $renderer->getRemainingWidth(); + $width = $renderer->getRemainingWidth(); echo "<div style=\"position: absolute;top: ", $startY, "pt;", $renderer->alignRTL, ": ", $startX, "pt;width: ", $width, "pt;\">"; $startY += $renderer->getCurrentStyleHeight() + 2; $renderer->SetY($startY); diff --git a/app/Report/ReportHtmlImage.php b/app/Report/ReportHtmlImage.php index e8ad0bc8e5..df35b06a3f 100644 --- a/app/Report/ReportHtmlImage.php +++ b/app/Report/ReportHtmlImage.php @@ -24,8 +24,6 @@ class ReportHtmlImage extends ReportBaseImage { * Image renderer * * @param ReportHtml $renderer - * - * @return void */ public function render($renderer) { global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright; @@ -62,9 +60,9 @@ class ReportHtmlImage extends ReportBaseImage { echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n"; } - $lastpicpage = $renderer->pageNo(); - $lastpicleft = $this->x; - $lastpicright = $this->x + $this->width; + $lastpicpage = $renderer->pageNo(); + $lastpicleft = $this->x; + $lastpicright = $this->x + $this->width; $lastpicbottom = $this->y + $this->height; // Setup for the next line if ($this->line == "N") { diff --git a/app/Report/ReportHtmlLine.php b/app/Report/ReportHtmlLine.php index 16d4d1a7e5..7785b69d19 100644 --- a/app/Report/ReportHtmlLine.php +++ b/app/Report/ReportHtmlLine.php @@ -24,8 +24,6 @@ class ReportHtmlLine extends ReportBaseLine { * HTML line renderer * * @param ReportHtml $renderer - * - * @return void */ public function render($renderer) { if ($this->x1 == '.') { diff --git a/app/Report/ReportHtmlPageheader.php b/app/Report/ReportHtmlPageheader.php index cbdd4aece9..5348f0358e 100644 --- a/app/Report/ReportHtmlPageheader.php +++ b/app/Report/ReportHtmlPageheader.php @@ -22,8 +22,6 @@ namespace Fisharebest\Webtrees; class ReportHtmlPageheader extends ReportBasePageheader { /** * @param ReportHtml $renderer - * - * @return void */ public function render($renderer) { $renderer->clearPageHeader(); diff --git a/app/Report/ReportHtmlText.php b/app/Report/ReportHtmlText.php index 18a42091cb..eb92c669dd 100644 --- a/app/Report/ReportHtmlText.php +++ b/app/Report/ReportHtmlText.php @@ -22,10 +22,8 @@ namespace Fisharebest\Webtrees; class ReportHtmlText extends ReportBaseText { /** * @param ReportHtml $renderer - * @param integer $curx - * @param boolean $attrib Is is called from a different element? - * - * @return void + * @param int $curx + * @param bool $attrib Is is called from a different element? */ public function render($renderer, $curx = 0, $attrib = true) { @@ -46,7 +44,7 @@ class ReportHtmlText extends ReportBaseText { // Save the start positions $startX = $renderer->getX(); $startY = $renderer->getY(); - $width = $renderer->getRemainingWidth(); + $width = $renderer->getRemainingWidth(); // If text is wider then page width then wrap it if ($renderer->GetStringWidth($temptext) > $width) { $lines = explode("\n", $temptext); @@ -85,6 +83,7 @@ class ReportHtmlText extends ReportBaseText { $ct += 1; } $style = $html->getStyle($this->styleName); + return ($style["size"] * $ct) * $html->cellHeightRatio; } @@ -115,18 +114,18 @@ class ReportHtmlText extends ReportBaseText { if ($this->wrapWidthRemaining > 0) { // Check with line counter too! if (($lw >= $this->wrapWidthRemaining) or ($lfct > 1)) { - $newtext = ""; + $newtext = ""; $wrapWidthRemaining = $this->wrapWidthRemaining; - $lines = explode("\n", $this->text); + $lines = explode("\n", $this->text); // Go throught the text line by line foreach ($lines as $line) { // Line width in points + a little margin $lw = $html->GetStringWidth($line); // If the line has to be wraped if ($lw > $wrapWidthRemaining) { - $words = explode(" ", $line); + $words = explode(" ", $line); $addspace = count($words); - $lw = 0; + $lw = 0; foreach ($words as $word) { $addspace--; $lw += $html->GetStringWidth($word . " "); @@ -160,15 +159,17 @@ class ReportHtmlText extends ReportBaseText { $lfct--; } $this->text = $newtext; - $lfct = substr_count($this->text, "\n"); + $lfct = substr_count($this->text, "\n"); + return array($lw, 1, $lfct); } } - $l = 0; + $l = 0; $lfct = substr_count($this->text, "\n"); if ($lfct > 0) { $l = 2; } + return array($lw, $l, $lfct); } } diff --git a/app/Report/ReportHtmlTextbox.php b/app/Report/ReportHtmlTextbox.php index a379631c3a..e86d39ad77 100644 --- a/app/Report/ReportHtmlTextbox.php +++ b/app/Report/ReportHtmlTextbox.php @@ -22,13 +22,11 @@ namespace Fisharebest\Webtrees; class ReportHtmlTextbox extends ReportBaseTextbox { /** * @param ReportHtml $renderer - * - * @return void */ public function render($renderer) { // checkFootnote - $newelements = array(); - $lastelement = array(); + $newelements = array(); + $lastelement = array(); $footnote_element = array(); // Element counter $cE = count($this->elements); @@ -52,7 +50,7 @@ class ReportHtmlTextbox extends ReportBaseTextbox { $lastelement->addText(str_replace("\n", "<br>", $element->getValue())); } elseif (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = $element; + $lastelement = $element; } } } // Collect the Footnote links @@ -62,7 +60,7 @@ class ReportHtmlTextbox extends ReportBaseTextbox { // Save first the last element if any if (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = array(); + $lastelement = array(); } // Save the Footnote with it’s link number as key for sorting later $footnote_element[$element->num] = $element; @@ -77,14 +75,14 @@ class ReportHtmlTextbox extends ReportBaseTextbox { } if (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = array(); + $lastelement = array(); } $newelements[] = $element; } } else { if (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = array(); + $lastelement = array(); } if (!empty($footnote_element)) { ksort($footnote_element); @@ -146,7 +144,7 @@ class ReportHtmlTextbox extends ReportBaseTextbox { $eH = 0; // Footnote height (in points) $fH = 0; - $w = 0; + $w = 0; //-- $lw is an array // 0 => last line width // 1 => 1 if text was wrapped, 0 if text did not wrap diff --git a/app/Report/ReportPdf.php b/app/Report/ReportPdf.php index d85cde54b3..25415bed49 100644 --- a/app/Report/ReportPdf.php +++ b/app/Report/ReportPdf.php @@ -23,26 +23,26 @@ class ReportPdf extends ReportBase { /** * PDF compression - Zlib extension is required * - * @var boolean const + * @var bool const */ const COMPRESSION = true; /** * If true reduce the RAM memory usage by caching temporary data on filesystem (slower). * - * @var boolean const + * @var bool const */ const DISK_CACHE = false; /** * true means that the input text is unicode (PDF) * - * @var boolean const + * @var bool const */ const UNICODE = true; /** * false means that the full font is embedded, true means only the used chars * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files * - * @var boolean const + * @var bool const */ const SUBSETTING = false; /** @@ -61,7 +61,7 @@ class ReportPdf extends ReportBase { // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4 $this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, array( $this->pagew, - $this->pageh + $this->pageh, ), self::UNICODE, "UTF-8", self::DISK_CACHE); // Setup the PDF margins @@ -105,7 +105,7 @@ class ReportPdf extends ReportBase { * * @param object|string $element Object or string * - * @return integer + * @return int */ public function addElement($element) { if ($this->processing == "B") { @@ -147,20 +147,20 @@ class ReportPdf extends ReportBase { /** * Create a new Cell object - ReportPdf * - * @param integer $width cell width (expressed in points) - * @param integer $height cell height (expressed in points) - * @param mixed $border Border style - * @param string $align Text alignement - * @param string $bgcolor Background color code - * @param string $style The name of the text style - * @param integer $ln Indicates where the current position should go after the call - * @param mixed $top Y-position - * @param mixed $left X-position - * @param integer $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1 - * @param integer $stretch Stretch carachter mode - * @param string $bocolor Border color - * @param string $tcolor Text color - * @param boolean $reseth + * @param int $width cell width (expressed in points) + * @param int $height cell height (expressed in points) + * @param mixed $border Border style + * @param string $align Text alignement + * @param string $bgcolor Background color code + * @param string $style The name of the text style + * @param int $ln Indicates where the current position should go after the call + * @param mixed $top Y-position + * @param mixed $left X-position + * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1 + * @param int $stretch Stretch carachter mode + * @param string $bocolor Border color + * @param string $tcolor Text color + * @param bool $reseth * * @return ReportPdfCell */ @@ -173,18 +173,18 @@ class ReportPdf extends ReportBase { /** * Create a new TextBox object - ReportPdf * - * @param float $width Text box width - * @param float $height Text box height - * @param boolean $border - * @param string $bgcolor Background color code in HTML - * @param boolean $newline - * @param mixed $left - * @param mixed $top - * @param boolean $pagecheck - * @param string $style - * @param boolean $fill - * @param boolean $padding - * @param boolean $reseth + * @param float $width Text box width + * @param float $height Text box height + * @param bool $border + * @param string $bgcolor Background color code in HTML + * @param bool $newline + * @param mixed $left + * @param mixed $top + * @param bool $pagecheck + * @param string $style + * @param bool $fill + * @param bool $padding + * @param bool $reseth * * @return ReportPdfTextbox */ @@ -232,8 +232,8 @@ class ReportPdf extends ReportBase { * @param string $file Filename * @param mixed $x * @param mixed $y - * @param integer $w Image width - * @param integer $h Image height + * @param int $w Image width + * @param int $h Image height * @param string $align L:left, C:center, R:right or empty to use x/y * @param string $ln T:same line, N:next line * @@ -246,13 +246,13 @@ class ReportPdf extends ReportBase { /** * Create a new image object from Media Object - ReportPdf * - * @param Media $mediaobject - * @param mixed $x - * @param mixed $y - * @param integer $w Image width - * @param integer $h Image height - * @param string $align L:left, C:center, R:right or empty to use x/y - * @param string $ln T:same line, N:next line + * @param Media $mediaobject + * @param mixed $x + * @param mixed $y + * @param int $w Image width + * @param int $h Image height + * @param string $align L:left, C:center, R:right or empty to use x/y + * @param string $ln T:same line, N:next line * * @return ReportPdfImage */ diff --git a/app/Report/ReportPdfCell.php b/app/Report/ReportPdfCell.php index 669d03a5f9..25d208adae 100644 --- a/app/Report/ReportPdfCell.php +++ b/app/Report/ReportPdfCell.php @@ -24,8 +24,6 @@ class ReportPdfCell extends ReportBaseCell { * PDF Cell renderer * * @param PDF $renderer - * - * @return void */ public function render($renderer) { @@ -36,7 +34,7 @@ class ReportPdfCell extends ReportBaseCell { $temptext = str_replace("#PAGENUM#", $renderer->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext); - $match = array(); + $match = array(); // Indicates if the cell background must be painted (1) or transparent (0) if ($this->fill == 1) { if (!empty($this->bgcolor)) { @@ -99,7 +97,7 @@ class ReportPdfCell extends ReportBaseCell { if (!empty($temptext)) { $cHT = $renderer->getNumLines($temptext, $this->width); $cHT = $cHT * $renderer->getCellHeightRatio() * $renderer->getCurrentStyleHeight(); - $cM = $renderer->getMargins(); + $cM = $renderer->getMargins(); // Add padding if (is_array($cM['cell'])) { $cHT += ($cM['padding_bottom'] + $cM['padding_top']); diff --git a/app/Report/ReportPdfFootnote.php b/app/Report/ReportPdfFootnote.php index a79412b21f..0d84a4c80c 100644 --- a/app/Report/ReportPdfFootnote.php +++ b/app/Report/ReportPdfFootnote.php @@ -24,8 +24,6 @@ class ReportPdfFootnote extends ReportBaseFootnote { * PDF Footnotes number renderer * * @param PDF $renderer - * - * @return void */ public function render($renderer) { $renderer->setCurrentStyle("footnotenum"); @@ -37,8 +35,6 @@ class ReportPdfFootnote extends ReportBaseFootnote { * Uses style name "footnote" by default * * @param PDF $pdf - * - * @return void */ public function renderFootnote($pdf) { if ($pdf->getCurrentStyle() != $this->styleName) { @@ -104,16 +100,16 @@ class ReportPdfFootnote extends ReportBaseFootnote { $wrapWidthRemaining = (int) ($this->wrapWidthRemaining); if (($lw >= $wrapWidthRemaining) or ($lfct > 1)) { $newtext = ""; - $lines = explode("\n", $this->numText); + $lines = explode("\n", $this->numText); // Go throught the text line by line foreach ($lines as $line) { // Line width in points $lw = ceil($pdf->GetStringWidth($line)); // If the line has to be wraped if ($lw >= $wrapWidthRemaining) { - $words = explode(" ", $line); + $words = explode(" ", $line); $addspace = count($words); - $lw = 0; + $lw = 0; foreach ($words as $word) { $addspace--; $lw += ceil($pdf->GetStringWidth($word . " ")); @@ -147,12 +143,12 @@ class ReportPdfFootnote extends ReportBaseFootnote { $lfct--; } $this->numText = $newtext; - $lfct = substr_count($this->numText, "\n"); + $lfct = substr_count($this->numText, "\n"); return array($lw, 1, $lfct); } } - $l = 0; + $l = 0; $lfct = substr_count($this->numText, "\n"); if ($lfct > 0) { $l = 2; diff --git a/app/Report/ReportPdfHtml.php b/app/Report/ReportPdfHtml.php index fced9b1a75..6cbdda06d1 100644 --- a/app/Report/ReportPdfHtml.php +++ b/app/Report/ReportPdfHtml.php @@ -21,10 +21,10 @@ namespace Fisharebest\Webtrees; */ class ReportPdfHtml extends ReportBaseHtml { /** - * @param $renderer - * @param boolean $sub + * @param $renderer + * @param bool $sub * - * @return integer|string + * @return int|string */ public function render($renderer, $sub = false) { if (!empty($this->attrs['style'])) { diff --git a/app/Report/ReportPdfImage.php b/app/Report/ReportPdfImage.php index 37e9ef7e37..d43ce57066 100644 --- a/app/Report/ReportPdfImage.php +++ b/app/Report/ReportPdfImage.php @@ -24,8 +24,6 @@ class ReportPdfImage extends ReportBaseImage { * PDF image renderer * * @param PDF $renderer - * - * @return void */ public function render($renderer) { global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright; @@ -85,11 +83,11 @@ class ReportPdfImage extends ReportBaseImage { $this->align ); } - $lastpicpage = $renderer->PageNo(); + $lastpicpage = $renderer->PageNo(); $renderer->lastpicpage = $renderer->getPage(); - $lastpicleft = $this->x; - $lastpicright = $this->x + $this->width; - $lastpicbottom = $this->y + $this->height; + $lastpicleft = $this->x; + $lastpicright = $this->x + $this->width; + $lastpicbottom = $this->y + $this->height; // Setup for the next line if ($this->line == "N") { $renderer->SetY($lastpicbottom); diff --git a/app/Report/ReportPdfLine.php b/app/Report/ReportPdfLine.php index d5120e7b00..b751f022ea 100644 --- a/app/Report/ReportPdfLine.php +++ b/app/Report/ReportPdfLine.php @@ -24,8 +24,6 @@ class ReportPdfLine extends ReportBaseLine { * PDF line renderer * * @param PDF $renderer - * - * @return void */ public function render($renderer) { if ($this->x1 == ".") { diff --git a/app/Report/ReportPdfPageheader.php b/app/Report/ReportPdfPageheader.php index fdc502eb28..b9c3e753fc 100644 --- a/app/Report/ReportPdfPageheader.php +++ b/app/Report/ReportPdfPageheader.php @@ -24,8 +24,6 @@ class ReportPdfPageheader extends ReportBasePageheader { * PageHeader element renderer * * @param PDF $renderer - * - * @return void */ public function render($renderer) { $renderer->clearPageHeader(); diff --git a/app/Report/ReportPdfText.php b/app/Report/ReportPdfText.php index 2655a4a776..7c54e02a1a 100644 --- a/app/Report/ReportPdfText.php +++ b/app/Report/ReportPdfText.php @@ -24,8 +24,6 @@ class ReportPdfText extends ReportBaseText { * PDF Text renderer * * @param PDF $renderer - * - * @return void */ public function render($renderer) { // Set up the style @@ -106,16 +104,16 @@ class ReportPdfText extends ReportBaseText { $wrapWidthRemaining = (int) ($this->wrapWidthRemaining); if (($lw >= ($wrapWidthRemaining)) or ($lfct > 1)) { $newtext = ""; - $lines = explode("\n", $this->text); + $lines = explode("\n", $this->text); // Go throught the text line by line foreach ($lines as $line) { // Line width in points + a little margin $lw = $pdf->GetStringWidth($line); // If the line has to be wraped if ($lw >= $wrapWidthRemaining) { - $words = explode(" ", $line); + $words = explode(" ", $line); $addspace = count($words); - $lw = 0; + $lw = 0; foreach ($words as $word) { $addspace--; $lw += $pdf->GetStringWidth($word . " "); @@ -149,12 +147,12 @@ class ReportPdfText extends ReportBaseText { $lfct--; } $this->text = $newtext; - $lfct = substr_count($this->text, "\n"); + $lfct = substr_count($this->text, "\n"); return array($lw, 1, $lfct); } } - $l = 0; + $l = 0; $lfct = substr_count($this->text, "\n"); if ($lfct > 0) { $l = 2; diff --git a/app/Report/ReportPdfTextbox.php b/app/Report/ReportPdfTextbox.php index 799804c45a..874bbc24d3 100644 --- a/app/Report/ReportPdfTextbox.php +++ b/app/Report/ReportPdfTextbox.php @@ -25,12 +25,12 @@ class ReportPdfTextbox extends ReportBaseTextbox { * * @param PDF $renderer * - * @return boolean|integer + * @return bool|int */ public function render($renderer) { - $newelements = array(); - $lastelement = ""; + $newelements = array(); + $lastelement = ""; $footnote_element = array(); // Element counter $cE = count($this->elements); @@ -54,7 +54,7 @@ class ReportPdfTextbox extends ReportBaseTextbox { $lastelement->addText(str_replace("\n", "<br>", $element->getValue())); } elseif (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = $element; + $lastelement = $element; } } } // Collect the Footnote links @@ -64,7 +64,7 @@ class ReportPdfTextbox extends ReportBaseTextbox { // Save first the last element if any if (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = array(); + $lastelement = array(); } // Save the Footnote with it’s link number as key for sorting later $footnote_element[$element->num] = $element; @@ -79,14 +79,14 @@ class ReportPdfTextbox extends ReportBaseTextbox { } if (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = array(); + $lastelement = array(); } $newelements[] = $element; } } else { if (!empty($lastelement)) { $newelements[] = $lastelement; - $lastelement = array(); + $lastelement = array(); } if (!empty($footnote_element)) { ksort($footnote_element); @@ -147,7 +147,7 @@ class ReportPdfTextbox extends ReportBaseTextbox { } // Element height (exept text) $eH = 0; - $w = 0; + $w = 0; // Temp Height $cHT = 0; //-- $lw is an array diff --git a/app/Report/ReportTcpdf.php b/app/Report/ReportTcpdf.php index acc19b9672..d28ecbdc81 100644 --- a/app/Report/ReportTcpdf.php +++ b/app/Report/ReportTcpdf.php @@ -42,13 +42,13 @@ class ReportTcpdf extends TCPDF { /** @var string Currently used style name */ public $currentStyle; - /** @var integer The last cell height */ + /** @var int The last cell height */ public $lastCellHeight = 0; - /** @var integer The largest font size within a TextBox to calculate the height */ + /** @var int The largest font size within a TextBox to calculate the height */ public $largestFontHeight = 0; - /** @var integer The last pictures page number */ + /** @var int The last pictures page number */ public $lastpicpage = 0; public $wt_report; @@ -130,7 +130,7 @@ class ReportTcpdf extends TCPDF { * * @param object|string $element * - * @return integer The number of the Header elements + * @return int The number of the Header elements */ public function addHeader($element) { $this->headerElements[] = $element; @@ -143,7 +143,7 @@ class ReportTcpdf extends TCPDF { * * @param object|string $element * - * @return integer The number of the Page Header elements + * @return int The number of the Page Header elements */ public function addPageHeader($element) { $this->pageHeaderElements[] = $element; @@ -156,7 +156,7 @@ class ReportTcpdf extends TCPDF { * * @param object|string $element * - * @return integer The number of the Body elements + * @return int The number of the Body elements */ public function addBody($element) { $this->bodyElements[] = $element; @@ -169,7 +169,7 @@ class ReportTcpdf extends TCPDF { * * @param object|string $element * - * @return integer The number of the Footer elements + * @return int The number of the Footer elements */ public function addFooter($element) { $this->footerElements[] = $element; @@ -244,7 +244,7 @@ class ReportTcpdf extends TCPDF { */ public function setCurrentStyle($s) { $this->currentStyle = $s; - $style = $this->wt_report->getStyle($s); + $style = $this->wt_report->getStyle($s); $this->SetFont($style['font'], $style['style'], $style['size']); } @@ -257,7 +257,7 @@ class ReportTcpdf extends TCPDF { */ public function getStyle($s) { if (!isset($this->wt_report->Styles[$s])) { - $s = $this->getCurrentStyle(); + $s = $this->getCurrentStyle(); $this->wt_report->Styles[$s] = $s; } @@ -300,7 +300,7 @@ class ReportTcpdf extends TCPDF { } /** - * @return integer + * @return int */ public function getFootnotesHeight() { $h = 0; @@ -314,7 +314,7 @@ class ReportTcpdf extends TCPDF { /** * Returns the the current font size height -PDF * - * @return integer + * @return int */ public function getCurrentStyleHeight() { if (empty($this->currentStyle)) { @@ -330,12 +330,12 @@ class ReportTcpdf extends TCPDF { * * @param object $footnote * - * @return boolean false if not numbered befor | object if already numbered + * @return bool false if not numbered befor | object if already numbered */ public function checkFootnote($footnote) { - $ct = count($this->printedfootnotes); + $ct = count($this->printedfootnotes); $val = $footnote->getValue(); - $i = 0; + $i = 0; while ($i < $ct) { if ($this->printedfootnotes[$i]->getValue() == $val) { // If this footnote already exist then set up the numbers for this object @@ -365,7 +365,6 @@ class ReportTcpdf extends TCPDF { $this->AddPage(); } - /******************************************* * TCPDF protected functions *******************************************/ @@ -373,9 +372,9 @@ class ReportTcpdf extends TCPDF { /** * Add a page if needed -PDF * - * @param integer $height Cell height + * @param int $height Cell height * - * @return boolean true in case of page break, false otherwise + * @return bool true in case of page break, false otherwise */ public function checkPageBreakPDF($height) { return $this->checkPageBreak($height); diff --git a/app/Repository.php b/app/Repository.php index 9219ba01a5..7cb68d46ed 100644 --- a/app/Repository.php +++ b/app/Repository.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class Repository extends GedcomRecord { const RECORD_TYPE = 'REPO'; - const URL_PREFIX = 'repo.php?rid='; + const URL_PREFIX = 'repo.php?rid='; /** * Get an instance of a repository object. For single records, diff --git a/app/Session.php b/app/Session.php index e4c0bef459..b6fdb67c4f 100644 --- a/app/Session.php +++ b/app/Session.php @@ -28,13 +28,13 @@ class Session { */ public static function start(array $config = array()) { $default_config = array( - 'use_cookies' => 1, - 'name' => 'WT_SESSION', + 'use_cookies' => 1, + 'name' => 'WT_SESSION', 'cookie_lifetime' => 0, - 'gc_maxlifetime' => 7200, - 'gc_probability' => 1, - 'gc_divisor' => 100, - 'cookie_path' => '', + 'gc_maxlifetime' => 7200, + 'gc_probability' => 1, + 'gc_divisor' => 100, + 'cookie_path' => '', 'cookie_httponly' => true, ); session_register_shutdown(); @@ -84,7 +84,7 @@ class Session { * * @param string $name * - * @return boolean + * @return bool */ public static function has($name) { return array_key_exists($name, $_SESSION); diff --git a/app/Site.php b/app/Site.php index 854d9f682d..48a51b4d9e 100644 --- a/app/Site.php +++ b/app/Site.php @@ -56,8 +56,6 @@ class Site { * * @param string $setting_name * @param string|int|bool $setting_value - * - * @return void */ public static function setPreference($setting_name, $setting_value) { // Only need to update the database if the setting has actually changed. @@ -66,7 +64,7 @@ class Site { Database::prepare( "DELETE FROM `##site_setting` WHERE setting_name = :setting_name" )->execute(array( - 'setting_name' => $setting_name + 'setting_name' => $setting_name, )); } else { Database::prepare( diff --git a/app/Soundex.php b/app/Soundex.php index d09de7bc7a..fa5bd336ac 100644 --- a/app/Soundex.php +++ b/app/Soundex.php @@ -36,7 +36,7 @@ class Soundex { * @param string $soundex1 * @param string $soundex2 * - * @return boolean + * @return bool */ public static function compare($soundex1, $soundex2) { if ($soundex1 && $soundex2) { @@ -165,517 +165,517 @@ class Soundex { * @var string[][] */ private static $dmsounds = array( - 'A' => array('1', '0', '', ''), - 'À' => array('1', '0', '', ''), - 'Á' => array('1', '0', '', ''), - 'Â' => array('1', '0', '', ''), - 'Ã' => array('1', '0', '', ''), - 'Ä' => array('1', '0', '1', '', '0', '', ''), - 'Å' => array('1', '0', '', ''), - 'Ă' => array('1', '0', '', ''), - 'Ą' => array('1', '', '', '', '', '', '6'), - 'Ạ' => array('1', '0', '', ''), - 'Ả' => array('1', '0', '', ''), - 'Ấ' => array('1', '0', '', ''), - 'Ầ' => array('1', '0', '', ''), - 'Ẩ' => array('1', '0', '', ''), - 'Ẫ' => array('1', '0', '', ''), - 'Ậ' => array('1', '0', '', ''), - 'Ắ' => array('1', '0', '', ''), - 'Ằ' => array('1', '0', '', ''), - 'Ẳ' => array('1', '0', '', ''), - 'Ẵ' => array('1', '0', '', ''), - 'Ặ' => array('1', '0', '', ''), - 'AE' => array('1', '0', '1', ''), - 'Æ' => array('1', '0', '1', ''), - 'AI' => array('1', '0', '1', ''), - 'AJ' => array('1', '0', '1', ''), - 'AU' => array('1', '0', '7', ''), - 'AV' => array('1', '0', '7', '', '7', '7', '7'), - 'ÄU' => array('1', '0', '1', ''), - 'AY' => array('1', '0', '1', ''), - 'B' => array('0', '7', '7', '7'), - 'C' => array('0', '5', '5', '5', '34', '4', '4'), - 'Ć' => array('0', '4', '4', '4'), - 'Č' => array('0', '4', '4', '4'), - 'Ç' => array('0', '4', '4', '4'), - 'CH' => array('0', '5', '5', '5', '34', '4', '4'), - 'CHS' => array('0', '5', '54', '54'), - 'CK' => array('0', '5', '5', '5', '45', '45', '45'), - 'CCS' => array('0', '4', '4', '4'), - 'CS' => array('0', '4', '4', '4'), - 'CSZ' => array('0', '4', '4', '4'), - 'CZ' => array('0', '4', '4', '4'), - 'CZS' => array('0', '4', '4', '4'), - 'D' => array('0', '3', '3', '3'), - 'Ď' => array('0', '3', '3', '3'), - 'Đ' => array('0', '3', '3', '3'), - 'DRS' => array('0', '4', '4', '4'), - 'DRZ' => array('0', '4', '4', '4'), - 'DS' => array('0', '4', '4', '4'), - 'DSH' => array('0', '4', '4', '4'), - 'DSZ' => array('0', '4', '4', '4'), - 'DT' => array('0', '3', '3', '3'), - 'DDZ' => array('0', '4', '4', '4'), - 'DDZS' => array('0', '4', '4', '4'), - 'DZ' => array('0', '4', '4', '4'), - 'DŹ' => array('0', '4', '4', '4'), - 'DŻ' => array('0', '4', '4', '4'), - 'DZH' => array('0', '4', '4', '4'), - 'DZS' => array('0', '4', '4', '4'), - 'E' => array('1', '0', '', ''), - 'È' => array('1', '0', '', ''), - 'É' => array('1', '0', '', ''), - 'Ê' => array('1', '0', '', ''), - 'Ë' => array('1', '0', '', ''), - 'Ĕ' => array('1', '0', '', ''), - 'Ė' => array('1', '0', '', ''), - 'Ę' => array('1', '', '', '6', '', '', ''), - 'Ẹ' => array('1', '0', '', ''), - 'Ẻ' => array('1', '0', '', ''), - 'Ẽ' => array('1', '0', '', ''), - 'Ế' => array('1', '0', '', ''), - 'Ề' => array('1', '0', '', ''), - 'Ể' => array('1', '0', '', ''), - 'Ễ' => array('1', '0', '', ''), - 'Ệ' => array('1', '0', '', ''), - 'EAU' => array('1', '0', '', ''), - 'EI' => array('1', '0', '1', ''), - 'EJ' => array('1', '0', '1', ''), - 'EU' => array('1', '1', '1', ''), - 'EY' => array('1', '0', '1', ''), - 'F' => array('0', '7', '7', '7'), - 'FB' => array('0', '7', '7', '7'), - 'G' => array('0', '5', '5', '5', '34', '4', '4'), - 'Ğ' => array('0', '', '', ''), - 'GGY' => array('0', '5', '5', '5'), - 'GY' => array('0', '5', '5', '5'), - 'H' => array('0', '5', '5', '', '5', '5', '5'), - 'I' => array('1', '0', '', ''), - 'Ì' => array('1', '0', '', ''), - 'Í' => array('1', '0', '', ''), - 'Î' => array('1', '0', '', ''), - 'Ï' => array('1', '0', '', ''), - 'Ĩ' => array('1', '0', '', ''), - 'Į' => array('1', '0', '', ''), - 'İ' => array('1', '0', '', ''), - 'Ỉ' => array('1', '0', '', ''), - 'Ị' => array('1', '0', '', ''), - 'IA' => array('1', '1', '', ''), - 'IE' => array('1', '1', '', ''), - 'IO' => array('1', '1', '', ''), - 'IU' => array('1', '1', '', ''), - 'J' => array('0', '1', '', '', '4', '4', '4', '5', '5', ''), - 'K' => array('0', '5', '5', '5'), - 'KH' => array('0', '5', '5', '5'), - 'KS' => array('0', '5', '54', '54'), - 'L' => array('0', '8', '8', '8'), - 'Ľ' => array('0', '8', '8', '8'), - 'Ĺ' => array('0', '8', '8', '8'), - 'Ł' => array('0', '7', '7', '7', '8', '8', '8'), - 'LL' => array('0', '8', '8', '8', '58', '8', '8', '1', '8', '8'), - 'LLY' => array('0', '8', '8', '8', '1', '8', '8'), - 'LY' => array('0', '8', '8', '8', '1', '8', '8'), - 'M' => array('0', '6', '6', '6'), - 'MĔ' => array('0', '66', '66', '66'), - 'MN' => array('0', '66', '66', '66'), - 'N' => array('0', '6', '6', '6'), - 'Ń' => array('0', '6', '6', '6'), - 'Ň' => array('0', '6', '6', '6'), - 'Ñ' => array('0', '6', '6', '6'), - 'NM' => array('0', '66', '66', '66'), - 'O' => array('1', '0', '', ''), - 'Ò' => array('1', '0', '', ''), - 'Ó' => array('1', '0', '', ''), - 'Ô' => array('1', '0', '', ''), - 'Õ' => array('1', '0', '', ''), - 'Ö' => array('1', '0', '', ''), - 'Ø' => array('1', '0', '', ''), - 'Ő' => array('1', '0', '', ''), - 'Œ' => array('1', '0', '', ''), - 'Ơ' => array('1', '0', '', ''), - 'Ọ' => array('1', '0', '', ''), - 'Ỏ' => array('1', '0', '', ''), - 'Ố' => array('1', '0', '', ''), - 'Ồ' => array('1', '0', '', ''), - 'Ổ' => array('1', '0', '', ''), - 'Ỗ' => array('1', '0', '', ''), - 'Ộ' => array('1', '0', '', ''), - 'Ớ' => array('1', '0', '', ''), - 'Ờ' => array('1', '0', '', ''), - 'Ở' => array('1', '0', '', ''), - 'Ỡ' => array('1', '0', '', ''), - 'Ợ' => array('1', '0', '', ''), - 'OE' => array('1', '0', '', ''), - 'OI' => array('1', '0', '1', ''), - 'OJ' => array('1', '0', '1', ''), - 'OU' => array('1', '0', '', ''), - 'OY' => array('1', '0', '1', ''), - 'P' => array('0', '7', '7', '7'), - 'PF' => array('0', '7', '7', '7'), - 'PH' => array('0', '7', '7', '7'), - 'Q' => array('0', '5', '5', '5'), - 'R' => array('0', '9', '9', '9'), - 'Ř' => array('0', '4', '4', '4'), - 'RS' => array('0', '4', '4', '4', '94', '94', '94'), - 'RZ' => array('0', '4', '4', '4', '94', '94', '94'), - 'S' => array('0', '4', '4', '4'), - 'Ś' => array('0', '4', '4', '4'), - 'Š' => array('0', '4', '4', '4'), - 'Ş' => array('0', '4', '4', '4'), - 'SC' => array('0', '2', '4', '4'), - 'ŠČ' => array('0', '2', '4', '4'), - 'SCH' => array('0', '4', '4', '4'), - 'SCHD' => array('0', '2', '43', '43'), - 'SCHT' => array('0', '2', '43', '43'), - 'SCHTCH' => array('0', '2', '4', '4'), + 'A' => array('1', '0', '', ''), + 'À' => array('1', '0', '', ''), + 'Á' => array('1', '0', '', ''), + 'Â' => array('1', '0', '', ''), + 'Ã' => array('1', '0', '', ''), + 'Ä' => array('1', '0', '1', '', '0', '', ''), + 'Å' => array('1', '0', '', ''), + 'Ă' => array('1', '0', '', ''), + 'Ą' => array('1', '', '', '', '', '', '6'), + 'Ạ' => array('1', '0', '', ''), + 'Ả' => array('1', '0', '', ''), + 'Ấ' => array('1', '0', '', ''), + 'Ầ' => array('1', '0', '', ''), + 'Ẩ' => array('1', '0', '', ''), + 'Ẫ' => array('1', '0', '', ''), + 'Ậ' => array('1', '0', '', ''), + 'Ắ' => array('1', '0', '', ''), + 'Ằ' => array('1', '0', '', ''), + 'Ẳ' => array('1', '0', '', ''), + 'Ẵ' => array('1', '0', '', ''), + 'Ặ' => array('1', '0', '', ''), + 'AE' => array('1', '0', '1', ''), + 'Æ' => array('1', '0', '1', ''), + 'AI' => array('1', '0', '1', ''), + 'AJ' => array('1', '0', '1', ''), + 'AU' => array('1', '0', '7', ''), + 'AV' => array('1', '0', '7', '', '7', '7', '7'), + 'ÄU' => array('1', '0', '1', ''), + 'AY' => array('1', '0', '1', ''), + 'B' => array('0', '7', '7', '7'), + 'C' => array('0', '5', '5', '5', '34', '4', '4'), + 'Ć' => array('0', '4', '4', '4'), + 'Č' => array('0', '4', '4', '4'), + 'Ç' => array('0', '4', '4', '4'), + 'CH' => array('0', '5', '5', '5', '34', '4', '4'), + 'CHS' => array('0', '5', '54', '54'), + 'CK' => array('0', '5', '5', '5', '45', '45', '45'), + 'CCS' => array('0', '4', '4', '4'), + 'CS' => array('0', '4', '4', '4'), + 'CSZ' => array('0', '4', '4', '4'), + 'CZ' => array('0', '4', '4', '4'), + 'CZS' => array('0', '4', '4', '4'), + 'D' => array('0', '3', '3', '3'), + 'Ď' => array('0', '3', '3', '3'), + 'Đ' => array('0', '3', '3', '3'), + 'DRS' => array('0', '4', '4', '4'), + 'DRZ' => array('0', '4', '4', '4'), + 'DS' => array('0', '4', '4', '4'), + 'DSH' => array('0', '4', '4', '4'), + 'DSZ' => array('0', '4', '4', '4'), + 'DT' => array('0', '3', '3', '3'), + 'DDZ' => array('0', '4', '4', '4'), + 'DDZS' => array('0', '4', '4', '4'), + 'DZ' => array('0', '4', '4', '4'), + 'DŹ' => array('0', '4', '4', '4'), + 'DŻ' => array('0', '4', '4', '4'), + 'DZH' => array('0', '4', '4', '4'), + 'DZS' => array('0', '4', '4', '4'), + 'E' => array('1', '0', '', ''), + 'È' => array('1', '0', '', ''), + 'É' => array('1', '0', '', ''), + 'Ê' => array('1', '0', '', ''), + 'Ë' => array('1', '0', '', ''), + 'Ĕ' => array('1', '0', '', ''), + 'Ė' => array('1', '0', '', ''), + 'Ę' => array('1', '', '', '6', '', '', ''), + 'Ẹ' => array('1', '0', '', ''), + 'Ẻ' => array('1', '0', '', ''), + 'Ẽ' => array('1', '0', '', ''), + 'Ế' => array('1', '0', '', ''), + 'Ề' => array('1', '0', '', ''), + 'Ể' => array('1', '0', '', ''), + 'Ễ' => array('1', '0', '', ''), + 'Ệ' => array('1', '0', '', ''), + 'EAU' => array('1', '0', '', ''), + 'EI' => array('1', '0', '1', ''), + 'EJ' => array('1', '0', '1', ''), + 'EU' => array('1', '1', '1', ''), + 'EY' => array('1', '0', '1', ''), + 'F' => array('0', '7', '7', '7'), + 'FB' => array('0', '7', '7', '7'), + 'G' => array('0', '5', '5', '5', '34', '4', '4'), + 'Ğ' => array('0', '', '', ''), + 'GGY' => array('0', '5', '5', '5'), + 'GY' => array('0', '5', '5', '5'), + 'H' => array('0', '5', '5', '', '5', '5', '5'), + 'I' => array('1', '0', '', ''), + 'Ì' => array('1', '0', '', ''), + 'Í' => array('1', '0', '', ''), + 'Î' => array('1', '0', '', ''), + 'Ï' => array('1', '0', '', ''), + 'Ĩ' => array('1', '0', '', ''), + 'Į' => array('1', '0', '', ''), + 'İ' => array('1', '0', '', ''), + 'Ỉ' => array('1', '0', '', ''), + 'Ị' => array('1', '0', '', ''), + 'IA' => array('1', '1', '', ''), + 'IE' => array('1', '1', '', ''), + 'IO' => array('1', '1', '', ''), + 'IU' => array('1', '1', '', ''), + 'J' => array('0', '1', '', '', '4', '4', '4', '5', '5', ''), + 'K' => array('0', '5', '5', '5'), + 'KH' => array('0', '5', '5', '5'), + 'KS' => array('0', '5', '54', '54'), + 'L' => array('0', '8', '8', '8'), + 'Ľ' => array('0', '8', '8', '8'), + 'Ĺ' => array('0', '8', '8', '8'), + 'Ł' => array('0', '7', '7', '7', '8', '8', '8'), + 'LL' => array('0', '8', '8', '8', '58', '8', '8', '1', '8', '8'), + 'LLY' => array('0', '8', '8', '8', '1', '8', '8'), + 'LY' => array('0', '8', '8', '8', '1', '8', '8'), + 'M' => array('0', '6', '6', '6'), + 'MĔ' => array('0', '66', '66', '66'), + 'MN' => array('0', '66', '66', '66'), + 'N' => array('0', '6', '6', '6'), + 'Ń' => array('0', '6', '6', '6'), + 'Ň' => array('0', '6', '6', '6'), + 'Ñ' => array('0', '6', '6', '6'), + 'NM' => array('0', '66', '66', '66'), + 'O' => array('1', '0', '', ''), + 'Ò' => array('1', '0', '', ''), + 'Ó' => array('1', '0', '', ''), + 'Ô' => array('1', '0', '', ''), + 'Õ' => array('1', '0', '', ''), + 'Ö' => array('1', '0', '', ''), + 'Ø' => array('1', '0', '', ''), + 'Ő' => array('1', '0', '', ''), + 'Œ' => array('1', '0', '', ''), + 'Ơ' => array('1', '0', '', ''), + 'Ọ' => array('1', '0', '', ''), + 'Ỏ' => array('1', '0', '', ''), + 'Ố' => array('1', '0', '', ''), + 'Ồ' => array('1', '0', '', ''), + 'Ổ' => array('1', '0', '', ''), + 'Ỗ' => array('1', '0', '', ''), + 'Ộ' => array('1', '0', '', ''), + 'Ớ' => array('1', '0', '', ''), + 'Ờ' => array('1', '0', '', ''), + 'Ở' => array('1', '0', '', ''), + 'Ỡ' => array('1', '0', '', ''), + 'Ợ' => array('1', '0', '', ''), + 'OE' => array('1', '0', '', ''), + 'OI' => array('1', '0', '1', ''), + 'OJ' => array('1', '0', '1', ''), + 'OU' => array('1', '0', '', ''), + 'OY' => array('1', '0', '1', ''), + 'P' => array('0', '7', '7', '7'), + 'PF' => array('0', '7', '7', '7'), + 'PH' => array('0', '7', '7', '7'), + 'Q' => array('0', '5', '5', '5'), + 'R' => array('0', '9', '9', '9'), + 'Ř' => array('0', '4', '4', '4'), + 'RS' => array('0', '4', '4', '4', '94', '94', '94'), + 'RZ' => array('0', '4', '4', '4', '94', '94', '94'), + 'S' => array('0', '4', '4', '4'), + 'Ś' => array('0', '4', '4', '4'), + 'Š' => array('0', '4', '4', '4'), + 'Ş' => array('0', '4', '4', '4'), + 'SC' => array('0', '2', '4', '4'), + 'ŠČ' => array('0', '2', '4', '4'), + 'SCH' => array('0', '4', '4', '4'), + 'SCHD' => array('0', '2', '43', '43'), + 'SCHT' => array('0', '2', '43', '43'), + 'SCHTCH' => array('0', '2', '4', '4'), 'SCHTSCH' => array('0', '2', '4', '4'), - 'SCHTSH' => array('0', '2', '4', '4'), - 'SD' => array('0', '2', '43', '43'), - 'SH' => array('0', '4', '4', '4'), - 'SHCH' => array('0', '2', '4', '4'), - 'SHD' => array('0', '2', '43', '43'), - 'SHT' => array('0', '2', '43', '43'), - 'SHTCH' => array('0', '2', '4', '4'), - 'SHTSH' => array('0', '2', '4', '4'), - 'ß' => array('0', '', '4', '4'), - 'ST' => array('0', '2', '43', '43'), - 'STCH' => array('0', '2', '4', '4'), - 'STRS' => array('0', '2', '4', '4'), - 'STRZ' => array('0', '2', '4', '4'), - 'STSCH' => array('0', '2', '4', '4'), - 'STSH' => array('0', '2', '4', '4'), - 'SSZ' => array('0', '4', '4', '4'), - 'SZ' => array('0', '4', '4', '4'), - 'SZCS' => array('0', '2', '4', '4'), - 'SZCZ' => array('0', '2', '4', '4'), - 'SZD' => array('0', '2', '43', '43'), - 'SZT' => array('0', '2', '43', '43'), - 'T' => array('0', '3', '3', '3'), - 'Ť' => array('0', '3', '3', '3'), - 'Ţ' => array('0', '3', '3', '3', '4', '4', '4'), - 'TC' => array('0', '4', '4', '4'), - 'TCH' => array('0', '4', '4', '4'), - 'TH' => array('0', '3', '3', '3'), - 'TRS' => array('0', '4', '4', '4'), - 'TRZ' => array('0', '4', '4', '4'), - 'TS' => array('0', '4', '4', '4'), - 'TSCH' => array('0', '4', '4', '4'), - 'TSH' => array('0', '4', '4', '4'), - 'TSZ' => array('0', '4', '4', '4'), - 'TTCH' => array('0', '4', '4', '4'), - 'TTS' => array('0', '4', '4', '4'), - 'TTSCH' => array('0', '4', '4', '4'), - 'TTSZ' => array('0', '4', '4', '4'), - 'TTZ' => array('0', '4', '4', '4'), - 'TZ' => array('0', '4', '4', '4'), - 'TZS' => array('0', '4', '4', '4'), - 'U' => array('1', '0', '', ''), - 'Ù' => array('1', '0', '', ''), - 'Ú' => array('1', '0', '', ''), - 'Û' => array('1', '0', '', ''), - 'Ü' => array('1', '0', '', ''), - 'Ũ' => array('1', '0', '', ''), - 'Ū' => array('1', '0', '', ''), - 'Ů' => array('1', '0', '', ''), - 'Ű' => array('1', '0', '', ''), - 'Ų' => array('1', '0', '', ''), - 'Ư' => array('1', '0', '', ''), - 'Ụ' => array('1', '0', '', ''), - 'Ủ' => array('1', '0', '', ''), - 'Ứ' => array('1', '0', '', ''), - 'Ừ' => array('1', '0', '', ''), - 'Ử' => array('1', '0', '', ''), - 'Ữ' => array('1', '0', '', ''), - 'Ự' => array('1', '0', '', ''), - 'UE' => array('1', '0', '', ''), - 'UI' => array('1', '0', '1', ''), - 'UJ' => array('1', '0', '1', ''), - 'UY' => array('1', '0', '1', ''), - 'UW' => array('1', '0', '1', '', '0', '7', '7'), - 'V' => array('0', '7', '7', '7'), - 'W' => array('0', '7', '7', '7'), - 'X' => array('0', '5', '54', '54'), - 'Y' => array('1', '1', '', ''), - 'Ý' => array('1', '1', '', ''), - 'Ỳ' => array('1', '1', '', ''), - 'Ỵ' => array('1', '1', '', ''), - 'Ỷ' => array('1', '1', '', ''), - 'Ỹ' => array('1', '1', '', ''), - 'Z' => array('0', '4', '4', '4'), - 'Ź' => array('0', '4', '4', '4'), - 'Ż' => array('0', '4', '4', '4'), - 'Ž' => array('0', '4', '4', '4'), - 'ZD' => array('0', '2', '43', '43'), - 'ZDZ' => array('0', '2', '4', '4'), - 'ZDZH' => array('0', '2', '4', '4'), - 'ZH' => array('0', '4', '4', '4'), - 'ZHD' => array('0', '2', '43', '43'), - 'ZHDZH' => array('0', '2', '4', '4'), - 'ZS' => array('0', '4', '4', '4'), - 'ZSCH' => array('0', '4', '4', '4'), - 'ZSH' => array('0', '4', '4', '4'), - 'ZZS' => array('0', '4', '4', '4'), + 'SCHTSH' => array('0', '2', '4', '4'), + 'SD' => array('0', '2', '43', '43'), + 'SH' => array('0', '4', '4', '4'), + 'SHCH' => array('0', '2', '4', '4'), + 'SHD' => array('0', '2', '43', '43'), + 'SHT' => array('0', '2', '43', '43'), + 'SHTCH' => array('0', '2', '4', '4'), + 'SHTSH' => array('0', '2', '4', '4'), + 'ß' => array('0', '', '4', '4'), + 'ST' => array('0', '2', '43', '43'), + 'STCH' => array('0', '2', '4', '4'), + 'STRS' => array('0', '2', '4', '4'), + 'STRZ' => array('0', '2', '4', '4'), + 'STSCH' => array('0', '2', '4', '4'), + 'STSH' => array('0', '2', '4', '4'), + 'SSZ' => array('0', '4', '4', '4'), + 'SZ' => array('0', '4', '4', '4'), + 'SZCS' => array('0', '2', '4', '4'), + 'SZCZ' => array('0', '2', '4', '4'), + 'SZD' => array('0', '2', '43', '43'), + 'SZT' => array('0', '2', '43', '43'), + 'T' => array('0', '3', '3', '3'), + 'Ť' => array('0', '3', '3', '3'), + 'Ţ' => array('0', '3', '3', '3', '4', '4', '4'), + 'TC' => array('0', '4', '4', '4'), + 'TCH' => array('0', '4', '4', '4'), + 'TH' => array('0', '3', '3', '3'), + 'TRS' => array('0', '4', '4', '4'), + 'TRZ' => array('0', '4', '4', '4'), + 'TS' => array('0', '4', '4', '4'), + 'TSCH' => array('0', '4', '4', '4'), + 'TSH' => array('0', '4', '4', '4'), + 'TSZ' => array('0', '4', '4', '4'), + 'TTCH' => array('0', '4', '4', '4'), + 'TTS' => array('0', '4', '4', '4'), + 'TTSCH' => array('0', '4', '4', '4'), + 'TTSZ' => array('0', '4', '4', '4'), + 'TTZ' => array('0', '4', '4', '4'), + 'TZ' => array('0', '4', '4', '4'), + 'TZS' => array('0', '4', '4', '4'), + 'U' => array('1', '0', '', ''), + 'Ù' => array('1', '0', '', ''), + 'Ú' => array('1', '0', '', ''), + 'Û' => array('1', '0', '', ''), + 'Ü' => array('1', '0', '', ''), + 'Ũ' => array('1', '0', '', ''), + 'Ū' => array('1', '0', '', ''), + 'Ů' => array('1', '0', '', ''), + 'Ű' => array('1', '0', '', ''), + 'Ų' => array('1', '0', '', ''), + 'Ư' => array('1', '0', '', ''), + 'Ụ' => array('1', '0', '', ''), + 'Ủ' => array('1', '0', '', ''), + 'Ứ' => array('1', '0', '', ''), + 'Ừ' => array('1', '0', '', ''), + 'Ử' => array('1', '0', '', ''), + 'Ữ' => array('1', '0', '', ''), + 'Ự' => array('1', '0', '', ''), + 'UE' => array('1', '0', '', ''), + 'UI' => array('1', '0', '1', ''), + 'UJ' => array('1', '0', '1', ''), + 'UY' => array('1', '0', '1', ''), + 'UW' => array('1', '0', '1', '', '0', '7', '7'), + 'V' => array('0', '7', '7', '7'), + 'W' => array('0', '7', '7', '7'), + 'X' => array('0', '5', '54', '54'), + 'Y' => array('1', '1', '', ''), + 'Ý' => array('1', '1', '', ''), + 'Ỳ' => array('1', '1', '', ''), + 'Ỵ' => array('1', '1', '', ''), + 'Ỷ' => array('1', '1', '', ''), + 'Ỹ' => array('1', '1', '', ''), + 'Z' => array('0', '4', '4', '4'), + 'Ź' => array('0', '4', '4', '4'), + 'Ż' => array('0', '4', '4', '4'), + 'Ž' => array('0', '4', '4', '4'), + 'ZD' => array('0', '2', '43', '43'), + 'ZDZ' => array('0', '2', '4', '4'), + 'ZDZH' => array('0', '2', '4', '4'), + 'ZH' => array('0', '4', '4', '4'), + 'ZHD' => array('0', '2', '43', '43'), + 'ZHDZH' => array('0', '2', '4', '4'), + 'ZS' => array('0', '4', '4', '4'), + 'ZSCH' => array('0', '4', '4', '4'), + 'ZSH' => array('0', '4', '4', '4'), + 'ZZS' => array('0', '4', '4', '4'), // Cyrillic alphabet - 'А' => array('1', '0', '', ''), - 'Б' => array('0', '7', '7', '7'), - 'В' => array('0', '7', '7', '7'), - 'Г' => array('0', '5', '5', '5'), - 'Д' => array('0', '3', '3', '3'), + 'А' => array('1', '0', '', ''), + 'Б' => array('0', '7', '7', '7'), + 'В' => array('0', '7', '7', '7'), + 'Г' => array('0', '5', '5', '5'), + 'Д' => array('0', '3', '3', '3'), 'ДЗ' => array('0', '4', '4', '4'), - 'Е' => array('1', '0', '', ''), - 'Ё' => array('1', '0', '', ''), - 'Ж' => array('0', '4', '4', '4'), - 'З' => array('0', '4', '4', '4'), - 'И' => array('1', '0', '', ''), - 'Й' => array('1', '1', '', '', '4', '4', '4'), - 'К' => array('0', '5', '5', '5'), - 'Л' => array('0', '8', '8', '8'), - 'М' => array('0', '6', '6', '6'), - 'Н' => array('0', '6', '6', '6'), - 'О' => array('1', '0', '', ''), - 'П' => array('0', '7', '7', '7'), - 'Р' => array('0', '9', '9', '9'), + 'Е' => array('1', '0', '', ''), + 'Ё' => array('1', '0', '', ''), + 'Ж' => array('0', '4', '4', '4'), + 'З' => array('0', '4', '4', '4'), + 'И' => array('1', '0', '', ''), + 'Й' => array('1', '1', '', '', '4', '4', '4'), + 'К' => array('0', '5', '5', '5'), + 'Л' => array('0', '8', '8', '8'), + 'М' => array('0', '6', '6', '6'), + 'Н' => array('0', '6', '6', '6'), + 'О' => array('1', '0', '', ''), + 'П' => array('0', '7', '7', '7'), + 'Р' => array('0', '9', '9', '9'), 'РЖ' => array('0', '4', '4', '4'), - 'С' => array('0', '4', '4', '4'), - 'Т' => array('0', '3', '3', '3'), - 'У' => array('1', '0', '', ''), - 'Ф' => array('0', '7', '7', '7'), - 'Х' => array('0', '5', '5', '5'), - 'Ц' => array('0', '4', '4', '4'), - 'Ч' => array('0', '4', '4', '4'), - 'Ш' => array('0', '4', '4', '4'), - 'Щ' => array('0', '2', '4', '4'), - 'Ъ' => array('0', '', '', ''), - 'Ы' => array('0', '1', '', ''), - 'Ь' => array('0', '', '', ''), - 'Э' => array('1', '0', '', ''), - 'Ю' => array('0', '1', '', ''), - 'Я' => array('0', '1', '', ''), + 'С' => array('0', '4', '4', '4'), + 'Т' => array('0', '3', '3', '3'), + 'У' => array('1', '0', '', ''), + 'Ф' => array('0', '7', '7', '7'), + 'Х' => array('0', '5', '5', '5'), + 'Ц' => array('0', '4', '4', '4'), + 'Ч' => array('0', '4', '4', '4'), + 'Ш' => array('0', '4', '4', '4'), + 'Щ' => array('0', '2', '4', '4'), + 'Ъ' => array('0', '', '', ''), + 'Ы' => array('0', '1', '', ''), + 'Ь' => array('0', '', '', ''), + 'Э' => array('1', '0', '', ''), + 'Ю' => array('0', '1', '', ''), + 'Я' => array('0', '1', '', ''), // Greek alphabet - 'Α' => array('1', '0', '', ''), - 'Ά' => array('1', '0', '', ''), + 'Α' => array('1', '0', '', ''), + 'Ά' => array('1', '0', '', ''), 'ΑΙ' => array('1', '0', '1', ''), 'ΑΥ' => array('1', '0', '1', ''), - 'Β' => array('0', '7', '7', '7'), - 'Γ' => array('0', '5', '5', '5'), - 'Δ' => array('0', '3', '3', '3'), - 'Ε' => array('1', '0', '', ''), - 'Έ' => array('1', '0', '', ''), + 'Β' => array('0', '7', '7', '7'), + 'Γ' => array('0', '5', '5', '5'), + 'Δ' => array('0', '3', '3', '3'), + 'Ε' => array('1', '0', '', ''), + 'Έ' => array('1', '0', '', ''), 'ΕΙ' => array('1', '0', '1', ''), 'ΕΥ' => array('1', '1', '1', ''), - 'Ζ' => array('0', '4', '4', '4'), - 'Η' => array('1', '0', '', ''), - 'Ή' => array('1', '0', '', ''), - 'Θ' => array('0', '3', '3', '3'), - 'Ι' => array('1', '0', '', ''), - 'Ί' => array('1', '0', '', ''), - 'Ϊ' => array('1', '0', '', ''), - 'ΐ' => array('1', '0', '', ''), - 'Κ' => array('0', '5', '5', '5'), - 'Λ' => array('0', '8', '8', '8'), - 'Μ' => array('0', '6', '6', '6'), + 'Ζ' => array('0', '4', '4', '4'), + 'Η' => array('1', '0', '', ''), + 'Ή' => array('1', '0', '', ''), + 'Θ' => array('0', '3', '3', '3'), + 'Ι' => array('1', '0', '', ''), + 'Ί' => array('1', '0', '', ''), + 'Ϊ' => array('1', '0', '', ''), + 'ΐ' => array('1', '0', '', ''), + 'Κ' => array('0', '5', '5', '5'), + 'Λ' => array('0', '8', '8', '8'), + 'Μ' => array('0', '6', '6', '6'), 'ΜΠ' => array('0', '7', '7', '7'), - 'Ν' => array('0', '6', '6', '6'), + 'Ν' => array('0', '6', '6', '6'), 'ΝΤ' => array('0', '3', '3', '3'), - 'Ξ' => array('0', '5', '54', '54'), - 'Ο' => array('1', '0', '', ''), - 'Ό' => array('1', '0', '', ''), + 'Ξ' => array('0', '5', '54', '54'), + 'Ο' => array('1', '0', '', ''), + 'Ό' => array('1', '0', '', ''), 'ΟΙ' => array('1', '0', '1', ''), 'ΟΥ' => array('1', '0', '1', ''), - 'Π' => array('0', '7', '7', '7'), - 'Ρ' => array('0', '9', '9', '9'), - 'Σ' => array('0', '4', '4', '4'), - 'ς' => array('0', '', '', '4'), - 'Τ' => array('0', '3', '3', '3'), + 'Π' => array('0', '7', '7', '7'), + 'Ρ' => array('0', '9', '9', '9'), + 'Σ' => array('0', '4', '4', '4'), + 'ς' => array('0', '', '', '4'), + 'Τ' => array('0', '3', '3', '3'), 'ΤΖ' => array('0', '4', '4', '4'), 'ΤΣ' => array('0', '4', '4', '4'), - 'Υ' => array('1', '1', '', ''), - 'Ύ' => array('1', '1', '', ''), - 'Ϋ' => array('1', '1', '', ''), - 'ΰ' => array('1', '1', '', ''), + 'Υ' => array('1', '1', '', ''), + 'Ύ' => array('1', '1', '', ''), + 'Ϋ' => array('1', '1', '', ''), + 'ΰ' => array('1', '1', '', ''), 'ΥΚ' => array('1', '5', '5', '5'), 'ΥΥ' => array('1', '65', '65', '65'), - 'Φ' => array('0', '7', '7', '7'), - 'Χ' => array('0', '5', '5', '5'), - 'Ψ' => array('0', '7', '7', '7'), - 'Ω' => array('1', '0', '', ''), - 'Ώ' => array('1', '0', '', ''), + 'Φ' => array('0', '7', '7', '7'), + 'Χ' => array('0', '5', '5', '5'), + 'Ψ' => array('0', '7', '7', '7'), + 'Ω' => array('1', '0', '', ''), + 'Ώ' => array('1', '0', '', ''), // Hebrew alphabet - 'א' => array('1', '0', '', ''), - 'או' => array('1', '0', '7', ''), - 'אג' => array('1', '4', '4', '4', '5', '5', '5', '34', '34', '34'), - 'בב' => array('0', '7', '7', '7', '77', '77', '77'), - 'ב' => array('0', '7', '7', '7'), - 'גג' => array('0', '4', '4', '4', '5', '5', '5', '45', '45', '45', '55', '55', '55', '54', '54', '54'), - 'גד' => array('0', '43', '43', '43', '53', '53', '53'), - 'גה' => array('0', '45', '45', '45', '55', '55', '55'), - 'גז' => array('0', '44', '44', '44', '45', '45', '45'), - 'גח' => array('0', '45', '45', '45', '55', '55', '55'), - 'גכ' => array('0', '45', '45', '45', '55', '55', '55'), - 'גך' => array('0', '45', '45', '45', '55', '55', '55'), - 'גצ' => array('0', '44', '44', '44', '45', '45', '45'), - 'גץ' => array('0', '44', '44', '44', '45', '45', '45'), - 'גק' => array('0', '45', '45', '45', '54', '54', '54'), - 'גש' => array('0', '44', '44', '44', '54', '54', '54'), - 'גת' => array('0', '43', '43', '43', '53', '53', '53'), - 'ג' => array('0', '4', '4', '4', '5', '5', '5'), - 'דז' => array('0', '4', '4', '4'), - 'דד' => array('0', '3', '3', '3', '33', '33', '33'), - 'דט' => array('0', '33', '33', '33'), - 'דש' => array('0', '4', '4', '4'), - 'דצ' => array('0', '4', '4', '4'), - 'דץ' => array('0', '4', '4', '4'), - 'ד' => array('0', '3', '3', '3'), - 'הג' => array('0', '54', '54', '54', '55', '55', '55'), - 'הכ' => array('0', '55', '55', '55'), - 'הח' => array('0', '55', '55', '55'), - 'הק' => array('0', '55', '55', '55', '5', '5', '5'), - 'הה' => array('0', '5', '5', '', '55', '55', ''), - 'ה' => array('0', '5', '5', ''), - 'וי' => array('1', '', '', '', '7', '7', '7'), - 'ו' => array('1', '7', '7', '7', '7', '', ''), - 'וו' => array('1', '7', '7', '7', '7', '', ''), + 'א' => array('1', '0', '', ''), + 'או' => array('1', '0', '7', ''), + 'אג' => array('1', '4', '4', '4', '5', '5', '5', '34', '34', '34'), + 'בב' => array('0', '7', '7', '7', '77', '77', '77'), + 'ב' => array('0', '7', '7', '7'), + 'גג' => array('0', '4', '4', '4', '5', '5', '5', '45', '45', '45', '55', '55', '55', '54', '54', '54'), + 'גד' => array('0', '43', '43', '43', '53', '53', '53'), + 'גה' => array('0', '45', '45', '45', '55', '55', '55'), + 'גז' => array('0', '44', '44', '44', '45', '45', '45'), + 'גח' => array('0', '45', '45', '45', '55', '55', '55'), + 'גכ' => array('0', '45', '45', '45', '55', '55', '55'), + 'גך' => array('0', '45', '45', '45', '55', '55', '55'), + 'גצ' => array('0', '44', '44', '44', '45', '45', '45'), + 'גץ' => array('0', '44', '44', '44', '45', '45', '45'), + 'גק' => array('0', '45', '45', '45', '54', '54', '54'), + 'גש' => array('0', '44', '44', '44', '54', '54', '54'), + 'גת' => array('0', '43', '43', '43', '53', '53', '53'), + 'ג' => array('0', '4', '4', '4', '5', '5', '5'), + 'דז' => array('0', '4', '4', '4'), + 'דד' => array('0', '3', '3', '3', '33', '33', '33'), + 'דט' => array('0', '33', '33', '33'), + 'דש' => array('0', '4', '4', '4'), + 'דצ' => array('0', '4', '4', '4'), + 'דץ' => array('0', '4', '4', '4'), + 'ד' => array('0', '3', '3', '3'), + 'הג' => array('0', '54', '54', '54', '55', '55', '55'), + 'הכ' => array('0', '55', '55', '55'), + 'הח' => array('0', '55', '55', '55'), + 'הק' => array('0', '55', '55', '55', '5', '5', '5'), + 'הה' => array('0', '5', '5', '', '55', '55', ''), + 'ה' => array('0', '5', '5', ''), + 'וי' => array('1', '', '', '', '7', '7', '7'), + 'ו' => array('1', '7', '7', '7', '7', '', ''), + 'וו' => array('1', '7', '7', '7', '7', '', ''), 'וופ' => array('1', '7', '7', '7', '77', '77', '77'), - 'זש' => array('0', '4', '4', '4', '44', '44', '44'), + 'זש' => array('0', '4', '4', '4', '44', '44', '44'), 'זדז' => array('0', '2', '4', '4'), - 'ז' => array('0', '4', '4', '4'), - 'זג' => array('0', '44', '44', '44', '45', '45', '45'), - 'זז' => array('0', '4', '4', '4', '44', '44', '44'), - 'זס' => array('0', '44', '44', '44'), - 'זצ' => array('0', '44', '44', '44'), - 'זץ' => array('0', '44', '44', '44'), - 'חג' => array('0', '54', '54', '54', '53', '53', '53'), - 'חח' => array('0', '5', '5', '5', '55', '55', '55'), - 'חק' => array('0', '55', '55', '55', '5', '5', '5'), - 'חכ' => array('0', '45', '45', '45', '55', '55', '55'), - 'חס' => array('0', '5', '54', '54'), - 'חש' => array('0', '5', '54', '54'), - 'ח' => array('0', '5', '5', '5'), - 'טש' => array('0', '4', '4', '4'), - 'טד' => array('0', '33', '33', '33'), - 'טי' => array('0', '3', '3', '3', '4', '4', '4', '3', '3', '34'), - 'טת' => array('0', '33', '33', '33'), - 'טט' => array('0', '3', '3', '3', '33', '33', '33'), - 'ט' => array('0', '3', '3', '3'), - 'י' => array('1', '1', '', ''), - 'יא' => array('1', '1', '', '', '1', '1', '1'), - 'כג' => array('0', '55', '55', '55', '54', '54', '54'), - 'כש' => array('0', '5', '54', '54'), - 'כס' => array('0', '5', '54', '54'), - 'ככ' => array('0', '5', '5', '5', '55', '55', '55'), - 'כך' => array('0', '5', '5', '5', '55', '55', '55'), - 'כ' => array('0', '5', '5', '5'), - 'כח' => array('0', '55', '55', '55', '5', '5', '5'), - 'ך' => array('0', '', '5', '5'), - 'ל' => array('0', '8', '8', '8'), - 'לל' => array('0', '88', '88', '88', '8', '8', '8'), - 'מנ' => array('0', '66', '66', '66'), - 'מן' => array('0', '66', '66', '66'), - 'ממ' => array('0', '6', '6', '6', '66', '66', '66'), - 'מם' => array('0', '6', '6', '6', '66', '66', '66'), - 'מ' => array('0', '6', '6', '6'), - 'ם' => array('0', '', '6', '6'), - 'נמ' => array('0', '66', '66', '66'), - 'נם' => array('0', '66', '66', '66'), - 'ננ' => array('0', '6', '6', '6', '66', '66', '66'), - 'נן' => array('0', '6', '6', '6', '66', '66', '66'), - 'נ' => array('0', '6', '6', '6'), - 'ן' => array('0', '', '6', '6'), + 'ז' => array('0', '4', '4', '4'), + 'זג' => array('0', '44', '44', '44', '45', '45', '45'), + 'זז' => array('0', '4', '4', '4', '44', '44', '44'), + 'זס' => array('0', '44', '44', '44'), + 'זצ' => array('0', '44', '44', '44'), + 'זץ' => array('0', '44', '44', '44'), + 'חג' => array('0', '54', '54', '54', '53', '53', '53'), + 'חח' => array('0', '5', '5', '5', '55', '55', '55'), + 'חק' => array('0', '55', '55', '55', '5', '5', '5'), + 'חכ' => array('0', '45', '45', '45', '55', '55', '55'), + 'חס' => array('0', '5', '54', '54'), + 'חש' => array('0', '5', '54', '54'), + 'ח' => array('0', '5', '5', '5'), + 'טש' => array('0', '4', '4', '4'), + 'טד' => array('0', '33', '33', '33'), + 'טי' => array('0', '3', '3', '3', '4', '4', '4', '3', '3', '34'), + 'טת' => array('0', '33', '33', '33'), + 'טט' => array('0', '3', '3', '3', '33', '33', '33'), + 'ט' => array('0', '3', '3', '3'), + 'י' => array('1', '1', '', ''), + 'יא' => array('1', '1', '', '', '1', '1', '1'), + 'כג' => array('0', '55', '55', '55', '54', '54', '54'), + 'כש' => array('0', '5', '54', '54'), + 'כס' => array('0', '5', '54', '54'), + 'ככ' => array('0', '5', '5', '5', '55', '55', '55'), + 'כך' => array('0', '5', '5', '5', '55', '55', '55'), + 'כ' => array('0', '5', '5', '5'), + 'כח' => array('0', '55', '55', '55', '5', '5', '5'), + 'ך' => array('0', '', '5', '5'), + 'ל' => array('0', '8', '8', '8'), + 'לל' => array('0', '88', '88', '88', '8', '8', '8'), + 'מנ' => array('0', '66', '66', '66'), + 'מן' => array('0', '66', '66', '66'), + 'ממ' => array('0', '6', '6', '6', '66', '66', '66'), + 'מם' => array('0', '6', '6', '6', '66', '66', '66'), + 'מ' => array('0', '6', '6', '6'), + 'ם' => array('0', '', '6', '6'), + 'נמ' => array('0', '66', '66', '66'), + 'נם' => array('0', '66', '66', '66'), + 'ננ' => array('0', '6', '6', '6', '66', '66', '66'), + 'נן' => array('0', '6', '6', '6', '66', '66', '66'), + 'נ' => array('0', '6', '6', '6'), + 'ן' => array('0', '', '6', '6'), 'סתש' => array('0', '2', '4', '4'), 'סתז' => array('0', '2', '4', '4'), 'סטז' => array('0', '2', '4', '4'), 'סטש' => array('0', '2', '4', '4'), 'סצד' => array('0', '2', '4', '4'), - 'סט' => array('0', '2', '4', '4', '43', '43', '43'), - 'סת' => array('0', '2', '4', '4', '43', '43', '43'), - 'סג' => array('0', '44', '44', '44', '4', '4', '4'), - 'סס' => array('0', '4', '4', '4', '44', '44', '44'), - 'סצ' => array('0', '44', '44', '44'), - 'סץ' => array('0', '44', '44', '44'), - 'סז' => array('0', '44', '44', '44'), - 'סש' => array('0', '44', '44', '44'), - 'ס' => array('0', '4', '4', '4'), - 'ע' => array('1', '0', '', ''), - 'פב' => array('0', '7', '7', '7', '77', '77', '77'), + 'סט' => array('0', '2', '4', '4', '43', '43', '43'), + 'סת' => array('0', '2', '4', '4', '43', '43', '43'), + 'סג' => array('0', '44', '44', '44', '4', '4', '4'), + 'סס' => array('0', '4', '4', '4', '44', '44', '44'), + 'סצ' => array('0', '44', '44', '44'), + 'סץ' => array('0', '44', '44', '44'), + 'סז' => array('0', '44', '44', '44'), + 'סש' => array('0', '44', '44', '44'), + 'ס' => array('0', '4', '4', '4'), + 'ע' => array('1', '0', '', ''), + 'פב' => array('0', '7', '7', '7', '77', '77', '77'), 'פוו' => array('0', '7', '7', '7', '77', '77', '77'), - 'פפ' => array('0', '7', '7', '7', '77', '77', '77'), - 'פף' => array('0', '7', '7', '7', '77', '77', '77'), - 'פ' => array('0', '7', '7', '7'), - 'ף' => array('0', '', '7', '7'), - 'צג' => array('0', '44', '44', '44', '45', '45', '45'), - 'צז' => array('0', '44', '44', '44'), - 'צס' => array('0', '44', '44', '44'), - 'צצ' => array('0', '4', '4', '4', '5', '5', '5', '44', '44', '44', '54', '54', '54', '45', '45', '45'), - 'צץ' => array('0', '4', '4', '4', '5', '5', '5', '44', '44', '44', '54', '54', '54'), - 'צש' => array('0', '44', '44', '44', '4', '4', '4', '5', '5', '5'), - 'צ' => array('0', '4', '4', '4', '5', '5', '5'), - 'ץ' => array('0', '', '4', '4'), - 'קה' => array('0', '55', '55', '5'), - 'קס' => array('0', '5', '54', '54'), - 'קש' => array('0', '5', '54', '54'), - 'קק' => array('0', '5', '5', '5', '55', '55', '55'), - 'קח' => array('0', '55', '55', '55'), - 'קכ' => array('0', '55', '55', '55'), - 'קך' => array('0', '55', '55', '55'), - 'קג' => array('0', '55', '55', '55', '54', '54', '54'), - 'ק' => array('0', '5', '5', '5'), - 'רר' => array('0', '99', '99', '99', '9', '9', '9'), - 'ר' => array('0', '9', '9', '9'), + 'פפ' => array('0', '7', '7', '7', '77', '77', '77'), + 'פף' => array('0', '7', '7', '7', '77', '77', '77'), + 'פ' => array('0', '7', '7', '7'), + 'ף' => array('0', '', '7', '7'), + 'צג' => array('0', '44', '44', '44', '45', '45', '45'), + 'צז' => array('0', '44', '44', '44'), + 'צס' => array('0', '44', '44', '44'), + 'צצ' => array('0', '4', '4', '4', '5', '5', '5', '44', '44', '44', '54', '54', '54', '45', '45', '45'), + 'צץ' => array('0', '4', '4', '4', '5', '5', '5', '44', '44', '44', '54', '54', '54'), + 'צש' => array('0', '44', '44', '44', '4', '4', '4', '5', '5', '5'), + 'צ' => array('0', '4', '4', '4', '5', '5', '5'), + 'ץ' => array('0', '', '4', '4'), + 'קה' => array('0', '55', '55', '5'), + 'קס' => array('0', '5', '54', '54'), + 'קש' => array('0', '5', '54', '54'), + 'קק' => array('0', '5', '5', '5', '55', '55', '55'), + 'קח' => array('0', '55', '55', '55'), + 'קכ' => array('0', '55', '55', '55'), + 'קך' => array('0', '55', '55', '55'), + 'קג' => array('0', '55', '55', '55', '54', '54', '54'), + 'ק' => array('0', '5', '5', '5'), + 'רר' => array('0', '99', '99', '99', '9', '9', '9'), + 'ר' => array('0', '9', '9', '9'), 'שטז' => array('0', '2', '4', '4'), 'שתש' => array('0', '2', '4', '4'), 'שתז' => array('0', '2', '4', '4'), 'שטש' => array('0', '2', '4', '4'), - 'שד' => array('0', '2', '43', '43'), - 'שז' => array('0', '44', '44', '44'), - 'שס' => array('0', '44', '44', '44'), - 'שת' => array('0', '2', '43', '43'), - 'שג' => array('0', '4', '4', '4', '44', '44', '44', '4', '43', '43'), - 'שט' => array('0', '2', '43', '43', '44', '44', '44'), - 'שצ' => array('0', '44', '44', '44', '45', '45', '45'), - 'שץ' => array('0', '44', '', '44', '45', '', '45'), - 'שש' => array('0', '4', '4', '4', '44', '44', '44'), - 'ש' => array('0', '4', '4', '4'), - 'תג' => array('0', '34', '34', '34'), - 'תז' => array('0', '34', '34', '34'), - 'תש' => array('0', '4', '4', '4'), - 'תת' => array('0', '3', '3', '3', '4', '4', '4', '33', '33', '33', '44', '44', '44', '34', '34', '34', '43', '43', '43'), - 'ת' => array('0', '3', '3', '3', '4', '4', '4'), + 'שד' => array('0', '2', '43', '43'), + 'שז' => array('0', '44', '44', '44'), + 'שס' => array('0', '44', '44', '44'), + 'שת' => array('0', '2', '43', '43'), + 'שג' => array('0', '4', '4', '4', '44', '44', '44', '4', '43', '43'), + 'שט' => array('0', '2', '43', '43', '44', '44', '44'), + 'שצ' => array('0', '44', '44', '44', '45', '45', '45'), + 'שץ' => array('0', '44', '', '44', '45', '', '45'), + 'שש' => array('0', '4', '4', '4', '44', '44', '44'), + 'ש' => array('0', '4', '4', '4'), + 'תג' => array('0', '34', '34', '34'), + 'תז' => array('0', '34', '34', '34'), + 'תש' => array('0', '4', '4', '4'), + 'תת' => array('0', '3', '3', '3', '4', '4', '4', '33', '33', '33', '44', '44', '44', '34', '34', '34', '43', '43', '43'), + 'ת' => array('0', '3', '3', '3', '4', '4', '4'), // Arabic alphabet - 'ا' => array('1', '0', '', ''), - 'ب' => array('0', '7', '7', '7'), - 'ت' => array('0', '3', '3', '3'), - 'ث' => array('0', '3', '3', '3'), - 'ج' => array('0', '4', '4', '4'), - 'ح' => array('0', '5', '5', '5'), - 'خ' => array('0', '5', '5', '5'), - 'د' => array('0', '3', '3', '3'), - 'ذ' => array('0', '3', '3', '3'), - 'ر' => array('0', '9', '9', '9'), - 'ز' => array('0', '4', '4', '4'), - 'س' => array('0', '4', '4', '4'), - 'ش' => array('0', '4', '4', '4'), - 'ص' => array('0', '4', '4', '4'), - 'ض' => array('0', '3', '3', '3'), - 'ط' => array('0', '3', '3', '3'), - 'ظ' => array('0', '4', '4', '4'), - 'ع' => array('1', '0', '', ''), - 'غ' => array('0', '0', '', ''), - 'ف' => array('0', '7', '7', '7'), - 'ق' => array('0', '5', '5', '5'), - 'ك' => array('0', '5', '5', '5'), - 'ل' => array('0', '8', '8', '8'), + 'ا' => array('1', '0', '', ''), + 'ب' => array('0', '7', '7', '7'), + 'ت' => array('0', '3', '3', '3'), + 'ث' => array('0', '3', '3', '3'), + 'ج' => array('0', '4', '4', '4'), + 'ح' => array('0', '5', '5', '5'), + 'خ' => array('0', '5', '5', '5'), + 'د' => array('0', '3', '3', '3'), + 'ذ' => array('0', '3', '3', '3'), + 'ر' => array('0', '9', '9', '9'), + 'ز' => array('0', '4', '4', '4'), + 'س' => array('0', '4', '4', '4'), + 'ش' => array('0', '4', '4', '4'), + 'ص' => array('0', '4', '4', '4'), + 'ض' => array('0', '3', '3', '3'), + 'ط' => array('0', '3', '3', '3'), + 'ظ' => array('0', '4', '4', '4'), + 'ع' => array('1', '0', '', ''), + 'غ' => array('0', '0', '', ''), + 'ف' => array('0', '7', '7', '7'), + 'ق' => array('0', '5', '5', '5'), + 'ك' => array('0', '5', '5', '5'), + 'ل' => array('0', '8', '8', '8'), 'لا' => array('0', '8', '8', '8'), - 'م' => array('0', '6', '6', '6'), - 'ن' => array('0', '6', '6', '6'), + 'م' => array('0', '6', '6', '6'), + 'ن' => array('0', '6', '6', '6'), 'هن' => array('0', '66', '66', '66'), - 'ه' => array('0', '5', '5', ''), - 'و' => array('1', '', '', '', '7', '', ''), - 'ي' => array('0', '1', '', ''), - 'آ' => array('0', '1', '', ''), - 'ة' => array('0', '', '', '3'), - 'ی' => array('0', '1', '', ''), - 'ى' => array('1', '1', '', ''), + 'ه' => array('0', '5', '5', ''), + 'و' => array('1', '', '', '', '7', '', ''), + 'ي' => array('0', '1', '', ''), + 'آ' => array('0', '1', '', ''), + 'ة' => array('0', '', '', '3'), + 'ی' => array('0', '1', '', ''), + 'ى' => array('1', '1', '', ''), ); /** @@ -692,7 +692,7 @@ class Soundex { // Initialize $name_script = I18N::textScript($name); - $noVowels = ($name_script == 'Hebr' || $name_script == 'Arab'); + $noVowels = ($name_script == 'Hebr' || $name_script == 'Arab'); $lastPos = strlen($name) - 1; $currPos = 0; diff --git a/app/Source.php b/app/Source.php index 9c381c450e..ccf483a66e 100644 --- a/app/Source.php +++ b/app/Source.php @@ -21,7 +21,7 @@ namespace Fisharebest\Webtrees; */ class Source extends GedcomRecord { const RECORD_TYPE = 'SOUR'; - const URL_PREFIX = 'source.php?sid='; + const URL_PREFIX = 'source.php?sid='; /** * Get an instance of a source object. For single records, diff --git a/app/Statement.php b/app/Statement.php index 536526e901..e1f54df0ae 100644 --- a/app/Statement.php +++ b/app/Statement.php @@ -30,7 +30,7 @@ class Statement { /** @var PDOStatement */ private $pdo_statement; - /** @var boolean Keep track of calls to execute(), so we can do it automatically */ + /** @var bool Keep track of calls to execute(), so we can do it automatically */ private $executed = false; /** @@ -47,8 +47,9 @@ class Statement { * * @param array $bind_variables * - * @return Statement * @throws \Exception + * + * @return Statement */ public function execute($bind_variables = array()) { if ($this->executed) { @@ -96,8 +97,6 @@ class Statement { /** * Close the cursor, and mark it as not-executed, so we can execute * it again (perhaps with different parameters). - * - * @return void */ public function closeCursor() { $this->pdo_statement->closeCursor(); @@ -109,7 +108,7 @@ class Statement { * * Execute the query, if necessary. Typically when there are no parameters. * - * @param integer $fetch_style + * @param int $fetch_style * * @return \stdClass|array|false */ @@ -126,7 +125,7 @@ class Statement { * * Execute the query, if necessary. Typically when there are no parameters. * - * @param integer $fetch_style + * @param int $fetch_style * * @return \stdClass[]|string[][] */ @@ -146,7 +145,7 @@ class Statement { * * Execute the query, if necessary. Typically when there are no parameters. * - * @param integer $fetch_style + * @param int $fetch_style * * @return \stdClass|array|null */ @@ -224,7 +223,7 @@ class Statement { /** * How many rows were affected by this statement. * - * @return integer + * @return int */ public function rowCount() { return $this->pdo_statement->rowCount(); diff --git a/app/Stats.php b/app/Stats.php index 93e6548056..4148757978 100644 --- a/app/Stats.php +++ b/app/Stats.php @@ -31,7 +31,7 @@ class Stats { /** @var string[] All public functions are available as keywords - except these ones */ private $public_but_not_allowed = array( - '__construct', 'embedTags', 'iso3166', 'getAllCountries', 'getAllTagsTable', 'getAllTagsText', 'statsPlaces', 'statsBirthQuery', 'statsDeathQuery', 'statsMarrQuery', 'statsAgeQuery', 'monthFirstChildQuery', 'statsChildrenQuery', 'statsMarrAgeQuery' + '__construct', 'embedTags', 'iso3166', 'getAllCountries', 'getAllTagsTable', 'getAllTagsText', 'statsPlaces', 'statsBirthQuery', 'statsDeathQuery', 'statsMarrQuery', 'statsAgeQuery', 'monthFirstChildQuery', 'statsChildrenQuery', 'statsMarrAgeQuery', ); /** @var string[] List of GEDCOM media types */ @@ -156,7 +156,7 @@ class Stats { public function embedTags($text) { if (strpos($text, '#') !== false) { list($new_tags, $new_values) = $this->getTags($text); - $text = str_replace($new_tags, $new_values, $text); + $text = str_replace($new_tags, $new_values, $text); } return $text; @@ -170,7 +170,7 @@ class Stats { } /** - * @return integer + * @return int */ public function gedcomId() { return $this->tree->getTreeId(); @@ -308,13 +308,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalIndividualsQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = :tree_id" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -326,7 +326,7 @@ class Stats { } /** - * @return integer + * @return int */ private function totalIndisWithSourcesQuery() { return (int) Database::prepare( @@ -371,16 +371,17 @@ class Stats { } else { $color_to = $WT_STATS_CHART_COLOR2; } - $sizes = explode('x', $size); + $sizes = explode('x', $size); $tot_indi = $this->totalIndividualsQuery(); if ($tot_indi == 0) { return ''; } else { $tot_sindi_per = round($this->totalIndisWithSourcesQuery() / $tot_indi, 3); - $chd = $this->arrayToExtendedEncoding(array(100 - 100 * $tot_sindi_per, 100 * $tot_sindi_per)); - $chl = I18N::translate('Without sources') . ' - ' . I18N::percentage(1 - $tot_sindi_per, 1) . '|' . + $chd = $this->arrayToExtendedEncoding(array(100 - 100 * $tot_sindi_per, 100 * $tot_sindi_per)); + $chl = I18N::translate('Without sources') . ' - ' . I18N::percentage(1 - $tot_sindi_per, 1) . '|' . I18N::translate('With sources') . ' - ' . I18N::percentage($tot_sindi_per, 1); $chart_title = I18N::translate('Individuals with sources'); + return '<img src="https://chart.googleapis.com/chart?cht=p3&chd=e:' . $chd . '&chs=' . $size . '&chco=' . $color_from . ',' . $color_to . '&chf=bg,s,ffffff00&chl=' . rawurlencode($chl) . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . $chart_title . '" title="' . $chart_title . '">'; } } @@ -393,13 +394,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalFamiliesQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##families` WHERE f_file = :tree_id" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -411,7 +412,7 @@ class Stats { } /** - * @return integer + * @return int */ private function totalFamsWithSourcesQuery() { return (int) Database::prepare( @@ -441,7 +442,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if (isset($params[0]) && $params[0] != '') { $size = strtolower($params[0]); } else { @@ -457,16 +457,17 @@ class Stats { } else { $color_to = $WT_STATS_CHART_COLOR2; } - $sizes = explode('x', $size); + $sizes = explode('x', $size); $tot_fam = $this->totalFamiliesQuery(); if ($tot_fam == 0) { return ''; } else { $tot_sfam_per = round($this->totalFamsWithSourcesQuery() / $tot_fam, 3); - $chd = $this->arrayToExtendedEncoding(array(100 - 100 * $tot_sfam_per, 100 * $tot_sfam_per)); - $chl = I18N::translate('Without sources') . ' - ' . I18N::percentage(1 - $tot_sfam_per, 1) . '|' . + $chd = $this->arrayToExtendedEncoding(array(100 - 100 * $tot_sfam_per, 100 * $tot_sfam_per)); + $chl = I18N::translate('Without sources') . ' - ' . I18N::percentage(1 - $tot_sfam_per, 1) . '|' . I18N::translate('With sources') . ' - ' . I18N::percentage($tot_sfam_per, 1); $chart_title = I18N::translate('Families with sources'); + return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_from},{$color_to}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; } } @@ -479,13 +480,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalSourcesQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##sources` WHERE s_file = :tree_id" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -504,13 +505,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalNotesQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##other` WHERE o_type='NOTE' AND o_file = :tree_id" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -529,13 +530,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalRepositoriesQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##other` WHERE o_type='REPO' AND o_file = :tree_id" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -560,17 +561,17 @@ class Stats { */ public function totalSurnames($params = array()) { if ($params) { - $qs = implode(',', array_fill(0, count($params), '?')); - $opt = "IN ({$qs})"; - $vars = $params; + $qs = implode(',', array_fill(0, count($params), '?')); + $opt = "IN ({$qs})"; + $vars = $params; $distinct = ''; } else { - $opt = "IS NOT NULL"; - $vars = ''; + $opt = "IS NOT NULL"; + $vars = ''; $distinct = 'DISTINCT'; } $vars[] = $this->tree->getTreeId(); - $total = + $total = Database::prepare( "SELECT SQL_CACHE COUNT({$distinct} n_surn COLLATE '" . I18N::collation() . "')" . " FROM `##name`" . @@ -592,9 +593,9 @@ class Stats { */ public function totalGivennames($params = array()) { if ($params) { - $qs = implode(',', array_fill(0, count($params), '?')); + $qs = implode(',', array_fill(0, count($params), '?')); $params[] = $this->tree->getTreeId(); - $total = + $total = Database::prepare("SELECT SQL_CACHE COUNT( n_givn) FROM `##name` WHERE n_givn IN ({$qs}) AND n_file=?") ->execute($params) ->fetchOne(); @@ -614,7 +615,7 @@ class Stats { * @return string */ public function totalEvents($params = array()) { - $sql = "SELECT SQL_CACHE COUNT(*) AS tot FROM `##dates` WHERE d_file=?"; + $sql = "SELECT SQL_CACHE COUNT(*) AS tot FROM `##dates` WHERE d_file=?"; $vars = array($this->tree->getTreeId()); $no_types = array('HEAD', 'CHAN'); @@ -698,10 +699,10 @@ class Stats { * @return string */ public function totalEventsOther() { - $facts = array_merge(explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV . '|' . WT_EVENTS_DEAT)); + $facts = array_merge(explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV . '|' . WT_EVENTS_DEAT)); $no_facts = array(); foreach ($facts as $fact) { - $fact = '!' . str_replace('\'', '', $fact); + $fact = '!' . str_replace('\'', '', $fact); $no_facts[] = $fact; } @@ -709,13 +710,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalSexMalesQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'M'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -734,13 +735,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalSexFemalesQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'F'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -759,13 +760,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalSexUnknownQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'U'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -817,7 +818,7 @@ class Stats { $tot_f = $this->totalSexFemalesQuery(); $tot_m = $this->totalSexMalesQuery(); $tot_u = $this->totalSexUnknownQuery(); - $tot = $tot_f + $tot_m + $tot_u; + $tot = $tot_f + $tot_m + $tot_u; // I18N data - for display $per_f = $this->totalSexFemalesPercentage(); $per_m = $this->totalSexMalesPercentage(); @@ -834,6 +835,7 @@ class Stats { I18N::translate('Males') . ' - ' . $per_m . I18N::$list_separator . I18N::translate('Females') . ' - ' . $per_f . I18N::$list_separator . I18N::translateContext('unknown people', 'Unknown') . ' - ' . $per_u; + return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_unknown},{$color_female},{$color_male}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; } else { $chd = $this->arrayToExtendedEncoding(array(4095 * $tot_f / $tot, 4095 * $tot_m / $tot)); @@ -842,6 +844,7 @@ class Stats { I18N::translate('Males') . ' - ' . $per_m; $chart_title = I18N::translate('Males') . ' - ' . $per_m . I18N::$list_separator . I18N::translate('Females') . ' - ' . $per_f; + return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_female},{$color_male}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; } } @@ -852,13 +855,13 @@ class Stats { * than MAX_ALIVE_AGE years ago, and who have no DEAT record. * A good reason to run the “Add missing DEAT records” batch-update! * - * @return integer + * @return int */ private function totalLivingQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom NOT REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -877,13 +880,13 @@ class Stats { } /** - * @return integer + * @return int */ private function totalDeceasedQuery() { return (int) Database::prepare( "SELECT SQL_CACHE COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchOne(); } @@ -929,7 +932,7 @@ class Stats { // Raw data - for calculation $tot_l = $this->totalLivingQuery(); $tot_d = $this->totalDeceasedQuery(); - $tot = $tot_l + $tot_d; + $tot = $tot_l + $tot_d; // I18N data - for display $per_l = $this->totalLivingPercentage(); $per_d = $this->totalDeceasedPercentage(); @@ -979,13 +982,13 @@ class Stats { /** * @param string $type * - * @return integer + * @return int */ private function totalMediaType($type = 'all') { if (!in_array($type, $this->_media_types) && $type != 'all' && $type != 'unknown') { return 0; } - $sql = "SELECT SQL_CACHE COUNT(*) AS tot FROM `##media` WHERE m_file=?"; + $sql = "SELECT SQL_CACHE COUNT(*) AS tot FROM `##media` WHERE m_file=?"; $vars = array($this->tree->getTreeId()); if ($type != 'all') { @@ -1173,18 +1176,18 @@ class Stats { $color_to = $WT_STATS_CHART_COLOR2; } $sizes = explode('x', $size); - $tot = $this->totalMediaType('all'); + $tot = $this->totalMediaType('all'); // Beware divide by zero if ($tot == 0) { return I18N::translate('None'); } // Build a table listing only the media types actually present in the GEDCOM $mediaCounts = array(); - $mediaTypes = ""; + $mediaTypes = ""; $chart_title = ""; - $c = 0; - $max = 0; - $media = array(); + $c = 0; + $max = 0; + $media = array(); foreach ($this->_media_types as $type) { $count = $this->totalMediaType($type); if ($count > 0) { @@ -1205,7 +1208,7 @@ class Stats { if (($max / $tot) > 0.6 && count($media) > 10) { arsort($media); $media = array_slice($media, 0, 10); - $c = $tot; + $c = $tot; foreach ($media as $cm) { $c -= $cm; } @@ -1222,8 +1225,8 @@ class Stats { $chart_title .= GedcomTag::getFileFormTypeValue($type) . ' (' . $count . '), '; } $chart_title = substr($chart_title, 0, -2); - $chd = $this->arrayToExtendedEncoding($mediaCounts); - $chl = substr($mediaTypes, 0, -1); + $chd = $this->arrayToExtendedEncoding($mediaCounts); + $chl = substr($mediaTypes, 0, -1); return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_from},{$color_to}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; } @@ -1264,7 +1267,7 @@ class Stats { if (!isset($rows[0])) { return ''; } - $row = $rows[0]; + $row = $rows[0]; $record = GedcomRecord::getInstance($row['d_gid'], $this->tree); switch ($type) { default: @@ -1276,7 +1279,7 @@ class Stats { } break; case 'year': - $date = new Date($row['d_type'] . ' ' . $row['d_year']); + $date = new Date($row['d_type'] . ' ' . $row['d_year']); $result = $date->display(); break; case 'name': @@ -1296,10 +1299,10 @@ class Stats { } /** - * @param string $what - * @param string $fact - * @param integer $parent - * @param boolean $country + * @param string $what + * @param string $fact + * @param int $parent + * @param bool $country * * @return integer[]|string[][] */ @@ -1309,13 +1312,13 @@ class Stats { $rows = Database::prepare( "SELECT i_gedcom AS ged FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom LIKE '%\n2 PLAC %'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchAll(); } elseif ($what == 'FAM') { $rows = Database::prepare( "SELECT f_gedcom AS ged FROM `##families` WHERE f_file = :tree_id AND f_gedcom LIKE '%\n2 PLAC %'" )->execute(array( - 'tree_id' => $this->tree->getTreeId() + 'tree_id' => $this->tree->getTreeId(), ))->fetchAll(); } $placelist = array(); @@ -1387,7 +1390,7 @@ class Stats { } /** - * @return integer + * @return int */ private function totalPlacesQuery() { return @@ -1440,7 +1443,7 @@ class Stats { I18N::init($locale->languageTag()); $countries = $this->getAllCountries(); foreach ($this->iso3166() as $three => $two) { - $country_to_iso3166[$three] = $two; + $country_to_iso3166[$three] = $two; $country_to_iso3166[$countries[$three]] = $two; } } @@ -1453,7 +1456,7 @@ class Stats { $chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname; // Count how many people are events in each country $surn_countries = array(); - $indis = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false); + $indis = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false); foreach ($indis as $person) { if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) { // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. @@ -1473,7 +1476,7 @@ class Stats { $chart_title = I18N::translate('Birth by country'); // Count how many people were born in each country $surn_countries = array(); - $b_countries = $this->statsPlaces('INDI', 'BIRT', 0, true); + $b_countries = $this->statsPlaces('INDI', 'BIRT', 0, true); foreach ($b_countries as $place => $count) { $country = $place; if (array_key_exists($country, $country_to_iso3166)) { @@ -1489,7 +1492,7 @@ class Stats { $chart_title = I18N::translate('Death by country'); // Count how many people were death in each country $surn_countries = array(); - $d_countries = $this->statsPlaces('INDI', 'DEAT', 0, true); + $d_countries = $this->statsPlaces('INDI', 'DEAT', 0, true); foreach ($d_countries as $place => $count) { $country = $place; if (array_key_exists($country, $country_to_iso3166)) { @@ -1505,7 +1508,7 @@ class Stats { $chart_title = I18N::translate('Marriage by country'); // Count how many families got marriage in each country $surn_countries = array(); - $m_countries = $this->statsPlaces('FAM'); + $m_countries = $this->statsPlaces('FAM'); // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. foreach ($m_countries as $place) { $country = $place['country']; @@ -1523,7 +1526,7 @@ class Stats { $chart_title = I18N::translate('Individual distribution chart'); // Count how many people have events in each country $surn_countries = array(); - $a_countries = $this->statsPlaces('INDI'); + $a_countries = $this->statsPlaces('INDI'); // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. foreach ($a_countries as $place) { $country = $place['country']; @@ -1566,7 +1569,7 @@ class Stats { return ''; } $top10 = array(); - $i = 1; + $i = 1; // Get the country names for each language $country_names = array(); foreach (I18N::activeLocales() as $locale) { @@ -1593,7 +1596,7 @@ class Stats { foreach ($all_db_countries as $country_code => $country) { $top10[] = '<li>'; foreach ($country as $country_name => $tot) { - $tmp = new Place($country_name, $this->tree); + $tmp = new Place($country_name, $this->tree); $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $all_countries[$country_code] . '</a>'; $top10[] .= $place . ' - ' . I18N::number($tot); } @@ -1603,6 +1606,7 @@ class Stats { } } $top10 = implode('', $top10); + return '<ul>' . $top10 . '</ul>'; } @@ -1611,12 +1615,12 @@ class Stats { */ public function commonBirthPlacesList() { $places = $this->statsPlaces('INDI', 'BIRT'); - $top10 = array(); - $i = 1; + $top10 = array(); + $i = 1; arsort($places); foreach ($places as $place => $count) { - $tmp = new Place($place, $this->tree); - $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; + $tmp = new Place($place, $this->tree); + $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; $top10[] = '<li>' . $place . ' - ' . I18N::number($count) . '</li>'; if ($i++ == 10) { break; @@ -1632,12 +1636,12 @@ class Stats { */ public function commonDeathPlacesList() { $places = $this->statsPlaces('INDI', 'DEAT'); - $top10 = array(); - $i = 1; + $top10 = array(); + $i = 1; arsort($places); foreach ($places as $place => $count) { - $tmp = new Place($place, $this->tree); - $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; + $tmp = new Place($place, $this->tree); + $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; $top10[] = '<li>' . $place . ' - ' . I18N::number($count) . '</li>'; if ($i++ == 10) { break; @@ -1653,12 +1657,12 @@ class Stats { */ public function commonMarriagePlacesList() { $places = $this->statsPlaces('FAM', 'MARR'); - $top10 = array(); - $i = 1; + $top10 = array(); + $i = 1; arsort($places); foreach ($places as $place => $count) { - $tmp = new Place($place, $this->tree); - $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; + $tmp = new Place($place, $this->tree); + $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $tmp->getFullName() . '</a>'; $top10[] = '<li>' . $place . ' - ' . I18N::number($count) . '</li>'; if ($i++ == 10) { break; @@ -1670,10 +1674,10 @@ class Stats { } /** - * @param boolean $simple - * @param boolean $sex - * @param integer $year1 - * @param integer $year2 + * @param bool $simple + * @param bool $sex + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return array|string @@ -1684,7 +1688,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if ($simple) { $sql = "SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total FROM `##dates` " . @@ -1738,7 +1741,7 @@ class Stats { $color_to = $WT_STATS_CHART_COLOR2; } $sizes = explode('x', $size); - $tot = 0; + $tot = 0; foreach ($rows as $values) { $tot += $values['total']; } @@ -1747,7 +1750,7 @@ class Stats { return ''; } $centuries = ""; - $counts = array(); + $counts = array(); foreach ($rows as $values) { $counts[] = round(100 * $values['total'] / $tot, 0); $centuries .= $this->centuryName($values['century']) . ' - ' . I18N::number($values['total']) . '|'; @@ -1762,10 +1765,10 @@ class Stats { } /** - * @param boolean $simple - * @param boolean $sex - * @param integer $year1 - * @param integer $year2 + * @param bool $simple + * @param bool $sex + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return array|string @@ -1829,7 +1832,7 @@ class Stats { $color_to = $WT_STATS_CHART_COLOR2; } $sizes = explode('x', $size); - $tot = 0; + $tot = 0; foreach ($rows as $values) { $tot += $values['total']; } @@ -1838,7 +1841,7 @@ class Stats { return ''; } $centuries = ""; - $counts = array(); + $counts = array(); foreach ($rows as $values) { $counts[] = round(100 * $values['total'] / $tot, 0); $centuries .= $this->centuryName($values['century']) . ' - ' . I18N::number($values['total']) . '|'; @@ -1848,6 +1851,7 @@ class Stats { return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_from},{$color_to}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Deaths by century') . "\" title=\"" . I18N::translate('Deaths by century') . "\" />"; } + return $rows; } @@ -2022,7 +2026,7 @@ class Stats { if (!isset($rows[0])) { return ''; } - $row = $rows[0]; + $row = $rows[0]; $person = Individual::getInstance($row['id'], $this->tree); switch ($type) { default: @@ -2040,6 +2044,7 @@ class Stats { $result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>"; break; } + return $result; } @@ -2092,7 +2097,7 @@ class Stats { $top10 = array(); foreach ($rows as $row) { $person = Individual::getInstance($row['deathdate'], $this->tree); - $age = $row['age']; + $age = $row['age']; if ((int) ($age / 365.25) > 0) { $age = (int) ($age / 365.25) . 'y'; } elseif ((int) ($age / 30.4375) > 0) { @@ -2120,6 +2125,7 @@ class Stats { if ($type == 'list') { return '<ul>' . $top10 . '</ul>'; } + return $top10; } @@ -2168,7 +2174,7 @@ class Stats { $top10 = array(); foreach ($rows as $row) { $person = Individual::getInstance($row['id'], $this->tree); - $age = (WT_CLIENT_JD - $row['age']); + $age = (WT_CLIENT_JD - $row['age']); if ((int) ($age / 365.25) > 0) { $age = (int) ($age / 365.25) . 'y'; } elseif ((int) ($age / 30.4375) > 0) { @@ -2194,6 +2200,7 @@ class Stats { if ($type === 'list') { return '<ul>' . $top10 . '</ul>'; } + return $top10; } @@ -2243,6 +2250,7 @@ class Stats { } elseif (!empty($age)) { $age = $age . 'd'; } + return get_age_at_event($age, true); } else { return I18N::number($age / 365.25); @@ -2250,11 +2258,11 @@ class Stats { } /** - * @param boolean $simple + * @param bool $simple * @param string $related * @param string $sex - * @param integer $year1 - * @param integer $year2 + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return array|string @@ -2267,7 +2275,7 @@ class Stats { $size = '230x250'; } $sizes = explode('x', $size); - $rows = $this->runSql( + $rows = $this->runSql( "SELECT SQL_CACHE" . " ROUND(AVG(death.d_julianday2-birth.d_julianday1)/365.25,1) AS age," . " FLOOR(death.d_year/100+1) AS century," . @@ -2292,11 +2300,11 @@ class Stats { if (empty($rows)) { return ''; } - $chxl = '0:|'; + $chxl = '0:|'; $countsm = ''; $countsf = ''; $countsa = ''; - $out = array(); + $out = array(); foreach ($rows as $values) { $out[$values['century']][$values['sex']] = $values['age']; } @@ -2331,7 +2339,7 @@ class Stats { $countsm = substr($countsm, 0, -1); $countsf = substr($countsf, 0, -1); $countsa = substr($countsa, 0, -1); - $chd = 't2:' . $countsm . '|' . $countsf . '|' . $countsa; + $chd = 't2:' . $countsm . '|' . $countsf . '|' . $countsa; $decades = ''; for ($i = 0; $i <= 100; $i += 10) { $decades .= '|' . I18N::number($i); @@ -2341,7 +2349,7 @@ class Stats { if (count($rows) > 6 || mb_strlen($title) < 30) { $chtt = $title; } else { - $offset = 0; + $offset = 0; $counter = array(); while ($offset = strpos($title, ' ', $offset + 1)) { $counter[] = $offset; @@ -2349,10 +2357,11 @@ class Stats { $half = (int) (count($counter) / 2); $chtt = substr_replace($title, '|', $counter[$half], 1); } + return '<img src="' . "https://chart.googleapis.com/chart?cht=bvg&chs={$sizes[0]}x{$sizes[1]}&chm=D,FF0000,2,0,3,1|N*f1*,000000,0,-1,11,1|N*f1*,000000,1,-1,11,1&chf=bg,s,ffffff00|c,s,ffffff00&chtt=" . rawurlencode($chtt) . "&chd={$chd}&chco=0000FF,FFA0CB,FF0000&chbh=20,3&chxt=x,x,y,y&chxl=" . rawurlencode($chxl) . "&chdl=" . rawurlencode(I18N::translate('Males') . '|' . I18N::translate('Females') . '|' . I18N::translate('Average age at death')) . "\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Average age related to death century') . "\" title=\"" . I18N::translate('Average age related to death century') . "\" />"; } else { $sex_search = ''; - $years = ''; + $years = ''; if ($sex == 'F') { $sex_search = " AND i_sex='F'"; } elseif ($sex == 'M') { @@ -2459,7 +2468,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -2525,7 +2534,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -2591,7 +2600,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -2615,7 +2624,7 @@ class Stats { 'MARR' => I18N::translate('marriage'), 'ADOP' => I18N::translate('adoption'), 'BURI' => I18N::translate('burial'), - 'CENS' => I18N::translate('census added') + 'CENS' => I18N::translate('census added'), ); $fact_query = "IN ('" . str_replace('|', "','", $facts) . "')"; @@ -2642,7 +2651,7 @@ class Stats { if (!isset($rows[0])) { return ''; } - $row = $rows[0]; + $row = $rows[0]; $record = GedcomRecord::getInstance($row['id'], $this->tree); switch ($type) { default: @@ -2654,7 +2663,7 @@ class Stats { } break; case 'year': - $date = new Date($row['type'] . ' ' . $row['year']); + $date = new Date($row['type'] . ' ' . $row['year']); $result = $date->display(); break; case 'type': @@ -2676,6 +2685,7 @@ class Stats { } break; } + return $result; } @@ -2752,10 +2762,10 @@ class Stats { /** * Query the database for marriage tags. * - * @param string $type - * @param string $age_dir - * @param string $sex - * @param boolean $show_years + * @param string $type + * @param string $age_dir + * @param string $sex + * @param bool $show_years * * @return string */ @@ -2825,6 +2835,7 @@ class Stats { } break; } + return $result; } @@ -2914,7 +2925,7 @@ class Stats { asort($rows); } $top10 = array(); - $i = 0; + $i = 0; foreach ($rows as $fam => $age) { $family = Family::getInstance($fam, $this->tree); if ($type === 'name') { @@ -2957,6 +2968,7 @@ class Stats { if ($type === 'list') { return '<ul>' . $top10 . '</ul>'; } + return $top10; } @@ -3043,10 +3055,10 @@ class Stats { } /** - * @param string $type - * @param string $age_dir - * @param string $sex - * @param boolean $show_years + * @param string $type + * @param string $age_dir + * @param string $sex + * @param bool $show_years * * @return string */ @@ -3115,14 +3127,15 @@ class Stats { } break; } + return $result; } /** - * @param boolean $simple - * @param boolean $first - * @param integer $year1 - * @param integer $year2 + * @param bool $simple + * @param bool $first + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return string|array @@ -3133,7 +3146,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if ($simple) { $sql = "SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total" . @@ -3192,7 +3204,7 @@ class Stats { $color_to = $WT_STATS_CHART_COLOR2; } $sizes = explode('x', $size); - $tot = 0; + $tot = 0; foreach ($rows as $values) { $tot += $values['total']; } @@ -3201,23 +3213,25 @@ class Stats { return ''; } $centuries = ""; - $counts = array(); + $counts = array(); foreach ($rows as $values) { $counts[] = round(100 * $values['total'] / $tot, 0); $centuries .= $this->centuryName($values['century']) . ' - ' . I18N::number($values['total']) . '|'; } $chd = $this->arrayToExtendedEncoding($counts); $chl = substr($centuries, 0, -1); + return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_from},{$color_to}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Marriages by century') . "\" title=\"" . I18N::translate('Marriages by century') . "\" />"; } + return $rows; } /** - * @param boolean $simple - * @param boolean $first - * @param integer $year1 - * @param integer $year2 + * @param bool $simple + * @param bool $first + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return string|array @@ -3228,7 +3242,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if ($simple) { $sql = "SELECT SQL_CACHE FLOOR(d_year/100+1) AS century, COUNT(*) AS total" . @@ -3286,7 +3299,7 @@ class Stats { $color_to = $WT_STATS_CHART_COLOR2; } $sizes = explode('x', $size); - $tot = 0; + $tot = 0; foreach ($rows as $values) { $tot += $values['total']; } @@ -3295,15 +3308,17 @@ class Stats { return ''; } $centuries = ""; - $counts = array(); + $counts = array(); foreach ($rows as $values) { $counts[] = round(100 * $values['total'] / $tot, 0); $centuries .= $this->centuryName($values['century']) . ' - ' . I18N::number($values['total']) . '|'; } $chd = $this->arrayToExtendedEncoding($counts); $chl = substr($centuries, 0, -1); + return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_from},{$color_to}&chf=bg,s,ffffff00&chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Divorces by century') . "\" title=\"" . I18N::translate('Divorces by century') . "\" />"; } + return $rows; } @@ -3438,10 +3453,10 @@ class Stats { } /** - * @param boolean $simple + * @param bool $simple * @param string $sex - * @param integer $year1 - * @param integer $year2 + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return array|string @@ -3454,7 +3469,7 @@ class Stats { $size = '200x250'; } $sizes = explode('x', $size); - $rows = $this->runSql( + $rows = $this->runSql( "SELECT SQL_CACHE " . " ROUND(AVG(married.d_julianday2-birth.d_julianday1-182.5)/365.25,1) AS age, " . " FLOOR(married.d_year/100+1) AS century, " . @@ -3492,14 +3507,14 @@ class Stats { $max = $values['age']; } } - $chxl = '0:|'; - $chmm = ''; - $chmf = ''; - $i = 0; + $chxl = '0:|'; + $chmm = ''; + $chmf = ''; + $i = 0; $countsm = ''; $countsf = ''; $countsa = ''; - $out = array(); + $out = array(); foreach ($rows as $values) { $out[$values['century']][$values['sex']] = $values['age']; } @@ -3549,8 +3564,8 @@ class Stats { $countsm = substr($countsm, 0, -1); $countsf = substr($countsf, 0, -1); $countsa = substr($countsa, 0, -1); - $chmf = substr($chmf, 0, -1); - $chd = 't2:' . $countsm . '|' . $countsf . '|' . $countsa; + $chmf = substr($chmf, 0, -1); + $chd = 't2:' . $countsm . '|' . $countsf . '|' . $countsa; if ($max <= 50) { $chxl .= '1:||' . I18N::translate('century') . '|2:|0|10|20|30|40|50|3:||' . I18N::translate('Age') . '|'; } else { @@ -3559,7 +3574,7 @@ class Stats { if (count($rows) > 4 || mb_strlen(I18N::translate('Average age in century of marriage')) < 30) { $chtt = I18N::translate('Average age in century of marriage'); } else { - $offset = 0; + $offset = 0; $counter = array(); while ($offset = strpos(I18N::translate('Average age in century of marriage'), ' ', $offset + 1)) { $counter[] = $offset; @@ -3567,6 +3582,7 @@ class Stats { $half = (int) (count($counter) / 2); $chtt = substr_replace(I18N::translate('Average age in century of marriage'), '|', $counter[$half], 1); } + return "<img src=\"" . "https://chart.googleapis.com/chart?cht=bvg&chs={$sizes[0]}x{$sizes[1]}&chm=D,FF0000,2,0,3,1|{$chmm}{$chmf}&chf=bg,s,ffffff00|c,s,ffffff00&chtt=" . rawurlencode($chtt) . "&chd={$chd}&chco=0000FF,FFA0CB,FF0000&chbh=20,3&chxt=x,x,y,y&chxl=" . rawurlencode($chxl) . "&chdl=" . rawurlencode(I18N::translate('Males') . "|" . I18N::translate('Females') . "|" . I18N::translate('Average age')) . "\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Average age in century of marriage') . "\" title=\"" . I18N::translate('Average age in century of marriage') . "\" />"; } else { if ($year1 >= 0 && $year2 >= 0) { @@ -3601,6 +3617,7 @@ class Stats { " birth.d_type IN ('@#DGREGORIAN@', '@#DJULIAN@') AND birth.d_fact='BIRT' AND " . " married.d_julianday1>birth.d_julianday1 AND birth.d_julianday1<>0 " ); + return $rows; } } @@ -3620,7 +3637,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -3643,7 +3660,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -3666,7 +3683,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -3689,7 +3706,7 @@ class Stats { } /** - * @param boolean $show_years + * @param bool $show_years * * @return string */ @@ -3905,6 +3922,7 @@ class Stats { $n = Database::prepare("SELECT SQL_CACHE COUNT(DISTINCT f_husb) FROM `##families` WHERE f_file=? AND f_gedcom LIKE '%\\n1 MARR%'") ->execute(array($this->tree->getTreeId())) ->fetchOne(); + return I18N::number($n); } @@ -3915,6 +3933,7 @@ class Stats { $n = Database::prepare("SELECT SQL_CACHE COUNT(DISTINCT f_wife) FROM `##families` WHERE f_file=? AND f_gedcom LIKE '%\\n1 MARR%'") ->execute(array($this->tree->getTreeId())) ->fetchOne(); + return I18N::number($n); } @@ -3939,7 +3958,7 @@ class Stats { if (!isset($rows[0])) { return ''; } - $row = $rows[0]; + $row = $rows[0]; $family = Family::getInstance($row['id'], $this->tree); switch ($type) { default: @@ -3957,6 +3976,7 @@ class Stats { $result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>'; break; } + return $result; } @@ -4012,6 +4032,7 @@ class Stats { if ($type === 'list') { return '<ul>' . $top10 . '</ul>'; } + return $top10; } @@ -4075,6 +4096,7 @@ class Stats { } else { $return = I18N::translate('This information is private and cannot be shown.'); } + return $return; } $age = $fam['age']; @@ -4100,7 +4122,7 @@ class Stats { $return .= " <a href=\"" . $family->getHtmlUrl() . "\">[" . I18N::translate('View family') . "]</a>"; $return .= '</li>'; $top10[] = $return; - $dist[] = $fam['family']; + $dist[] = $fam['family']; } } elseif (!$one && $child1->canShow() && $child2->canShow()) { $return = "<li>"; @@ -4118,6 +4140,7 @@ class Stats { $return .= "<br>" . I18N::translate('and') . "<br>"; $return .= $child1->formatList('span', false, $child1->getFullName()); $return .= "<br><a href=\"" . $family->getHtmlUrl() . "\">[" . I18N::translate('View family') . "]</a>"; + return $return; } else { return I18N::translate('This information is private and cannot be shown.'); @@ -4133,14 +4156,15 @@ class Stats { if ($type === 'list') { return '<ul>' . $top10 . '</ul>'; } + return $top10; } /** - * @param boolean $simple - * @param boolean $sex - * @param integer $year1 - * @param integer $year2 + * @param bool $simple + * @param bool $sex + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return string|string[][] @@ -4151,7 +4175,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if ($year1 >= 0 && $year2 >= 0) { $sql_years = " AND (d_year BETWEEN '{$year1}' AND '{$year2}')"; } else { @@ -4212,7 +4235,7 @@ class Stats { $color_to = $WT_STATS_CHART_COLOR2; } $sizes = explode('x', $size); - $tot = 0; + $tot = 0; foreach ($rows as $values) { $tot += $values['total']; } @@ -4220,7 +4243,7 @@ class Stats { if ($tot == 0) { return ''; } - $text = ''; + $text = ''; $counts = array(); foreach ($rows as $values) { $counts[] = round(100 * $values['total'] / $tot, 0); @@ -4267,8 +4290,10 @@ class Stats { } $chd = $this->arrayToExtendedEncoding($counts); $chl = substr($text, 0, -1); + return '<img src="https://chart.googleapis.com/chart?cht=p3&chd=e:' . $chd . '&chs=' . $size . '&chco=' . $color_from . ',' . $color_to . '&chf=bg,s,ffffff00&chl=' . $chl . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . I18N::translate('Month of birth of first child in a relation') . '" title="' . I18N::translate('Month of birth of first child in a relation') . '" />'; } + return $rows; } @@ -4344,7 +4369,7 @@ class Stats { } $sizes = explode('x', $size); $total = (int) $total; - $rows = $this->runSql( + $rows = $this->runSql( " SELECT SQL_CACHE f_numchil AS tot, f_id AS id" . " FROM `##families`" . " WHERE f_file={$this->tree->getTreeId()}" . @@ -4396,10 +4421,10 @@ class Stats { } /** - * @param boolean $simple + * @param bool $simple * @param string $sex - * @param integer $year1 - * @param integer $year2 + * @param int $year1 + * @param int $year2 * @param string[] $params * * @return string|string[][] @@ -4412,8 +4437,8 @@ class Stats { $size = '220x200'; } $sizes = explode('x', $size); - $max = 0; - $rows = $this->runSql( + $max = 0; + $rows = $this->runSql( " SELECT SQL_CACHE ROUND(AVG(f_numchil),2) AS num, FLOOR(d_year/100+1) AS century" . " FROM `##families`" . " JOIN `##dates` ON (d_file = f_file AND d_gid=f_id)" . @@ -4431,9 +4456,9 @@ class Stats { $max = $values['num']; } } - $chm = ""; - $chxl = "0:|"; - $i = 0; + $chm = ""; + $chxl = "0:|"; + $i = 0; $counts = array(); foreach ($rows as $values) { if ($sizes[0] < 980) { @@ -4634,8 +4659,8 @@ class Stats { } else { $years = ""; } - $max = 0; - $tot = 0; + $max = 0; + $tot = 0; $rows = $this->runSql( "SELECT SQL_CACHE" . " COUNT(*) AS count," . @@ -4665,9 +4690,9 @@ class Stats { if ($unknown > $max) { $max = $unknown; } - $chm = ""; - $chxl = "0:|"; - $i = 0; + $chm = ""; + $chxl = "0:|"; + $i = 0; $counts = array(); foreach ($rows as $values) { if ($sizes[0] < 980) { @@ -4679,7 +4704,7 @@ class Stats { $i++; } $counts[] = round(4095 * $unknown / ($max + 1)); - $chd = $this->arrayToExtendedEncoding($counts); + $chd = $this->arrayToExtendedEncoding($counts); $chm .= 't' . $unknown . ',000000,0,' . $i . ',11,1'; $chxl .= I18N::translateContext('unknown century', 'Unknown') . "|1:||" . I18N::translate('century') . "|2:|0|"; $step = $max + 1; @@ -4699,6 +4724,7 @@ class Stats { $chxl .= $n . "|"; } $chxl .= "3:||" . I18N::translate('Total families') . "|"; + return "<img src=\"https://chart.googleapis.com/chart?cht=bvg&chs={$sizes[0]}x{$sizes[1]}&chf=bg,s,ffffff00|c,s,ffffff00&chm=D,FF0000,0,0:" . ($i - 1) . ",3,1|{$chm}&chd=e:{$chd}&chco=0000FF,ffffff00&chbh=30,3&chxt=x,x,y,y&chxl=" . rawurlencode($chxl) . "\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Number of families without children') . "\" title=\"" . I18N::translate('Number of families without children') . "\" />"; } @@ -4761,6 +4787,7 @@ class Stats { if ($type === 'list') { return '<ul>' . $top10 . '</ul>'; } + return $top10; } @@ -4784,7 +4811,7 @@ class Stats { /** * @param string $type - * @param boolean $show_tot + * @param bool $show_tot * @param string[] $params * * @return string @@ -4832,6 +4859,7 @@ class Stats { foreach (array_keys($surname_list) as $surname) { $surnames = array_merge($surnames, QueryName::surnames($this->tree, $surname, '', false, false)); } + return format_surname_list($surnames, ($type == 'list' ? 1 : 2), $show_tot, 'indilist.php', $this->tree); } @@ -4840,6 +4868,7 @@ class Stats { */ public function getCommonSurname() { $surnames = array_keys(get_top_surnames($this->tree->getTreeId(), 1, 1)); + return array_shift($surnames); } @@ -4890,7 +4919,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if (isset($params[0]) && $params[0] != '') { $size = strtolower($params[0]); } else { @@ -4916,7 +4944,7 @@ class Stats { } else { $maxtoshow = 7; } - $sizes = explode('x', $size); + $sizes = explode('x', $size); $tot_indi = $this->totalIndividualsQuery(); $surnames = get_common_surnames($threshold, $this->tree); if (count($surnames) <= 0) { @@ -4924,7 +4952,7 @@ class Stats { } $SURNAME_TRADITION = $this->tree->getPreference('SURNAME_TRADITION'); uasort($surnames, __NAMESPACE__ . '\Stats::nameTotalReverseSort'); - $surnames = array_slice($surnames, 0, $maxtoshow); + $surnames = array_slice($surnames, 0, $maxtoshow); $all_surnames = array(); foreach (array_keys($surnames) as $n => $surname) { if ($n >= $maxtoshow) { @@ -4966,14 +4994,15 @@ class Stats { $chl[] = I18N::translate('Other') . ' - ' . I18N::number($tot_indi - $tot); $chart_title = implode(I18N::$list_separator, $chl); - $chl = implode('|', $chl); + $chl = implode('|', $chl); + return '<img src="https://chart.googleapis.com/chart?cht=p3&chd=e:' . $chd . '&chs=' . $size . '&chco=' . $color_from . ',' . $color_to . '&chf=bg,s,ffffff00&chl=' . rawurlencode($chl) . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . $chart_title . '" title="' . $chart_title . '" />'; } /** * @param string $sex * @param string $type - * @param boolean $show_tot + * @param bool $show_tot * @param string[] $params * * @return string @@ -5085,6 +5114,7 @@ class Stats { jQuery("#' . $table_id . '").css("visibility", "visible"); '); $lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All')); + return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>'; case 'list': return '<ul>' . implode('', $common) . '</ul>'; @@ -5289,7 +5319,6 @@ class Stats { $WT_STATS_S_CHART_X = Theme::theme()->parameter('stats-small-chart-x'); $WT_STATS_S_CHART_Y = Theme::theme()->parameter('stats-small-chart-y'); - if (isset($params[0]) && $params[0] != '') { $size = strtolower($params[0]); } else { @@ -5310,9 +5339,9 @@ class Stats { } else { $maxtoshow = 7; } - $sizes = explode('x', $size); + $sizes = explode('x', $size); $tot_indi = $this->totalIndividualsQuery(); - $given = $this->commonGivenQuery('B', 'chart'); + $given = $this->commonGivenQuery('B', 'chart'); if (!is_array($given)) { return ''; } @@ -5340,7 +5369,8 @@ class Stats { $chl[] = I18N::translate('Other') . ' - ' . I18N::number($tot_indi - $tot); $chart_title = implode(I18N::$list_separator, $chl); - $chl = implode('|', $chl); + $chl = implode('|', $chl); + return "<img src=\"https://chart.googleapis.com/chart?cht=p3&chd=e:{$chd}&chs={$size}&chco={$color_from},{$color_to}&chf=bg,s,ffffff00&chl=" . rawurlencode($chl) . "\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; } @@ -5353,7 +5383,7 @@ class Stats { $content = ''; // List active users $NumAnonymous = 0; - $loggedusers = array(); + $loggedusers = array(); foreach (User::allLoggedIn() as $user) { if (Auth::isAdmin() || $user->getPreference('visibleonline')) { $loggedusers[] = $user; @@ -5405,16 +5435,17 @@ class Stats { if ($type == 'list') { $content .= '</ul>'; } + return $content; } /** * @param string $type * - * @return integer + * @return int */ private function usersLoggedInTotalQuery($type = 'all') { - $anon = 0; + $anon = 0; $visible = 0; foreach (User::allLoggedIn() as $user) { if (Auth::isAdmin() || $user->getPreference('visibleonline')) { @@ -5447,21 +5478,21 @@ class Stats { } /** - * @return integer + * @return int */ public function usersLoggedInTotal() { return $this->usersLoggedInTotalQuery('all'); } /** - * @return integer + * @return int */ public function usersLoggedInTotalAnon() { return $this->usersLoggedInTotalQuery('anon'); } /** - * @return integer + * @return int */ public function usersLoggedInTotalVisible() { return $this->usersLoggedInTotalQuery('visible'); @@ -5526,6 +5557,7 @@ class Stats { } else { $datestamp = I18N::dateFormat(); } + return timestamp_to_gedcom_date($user->getPreference('reg_timestamp'))->display(false, $datestamp); case 'regtime': if (is_array($params) && isset($params[0]) && $params[0] != '') { @@ -5533,6 +5565,7 @@ class Stats { } else { $datestamp = str_replace('%', '', I18N::timeFormat()); } + return date($datestamp, $user->getPreference('reg_timestamp')); case 'loggedin': if (is_array($params) && isset($params[0]) && $params[0] != '') { @@ -5545,6 +5578,7 @@ class Stats { } else { $no = I18N::translate('no'); } + return Database::prepare("SELECT SQL_NO_CACHE 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no; } } @@ -5602,7 +5636,7 @@ class Stats { */ public function contactWebmaster() { $user_id = $this->tree->getPreference('WEBMASTER_USER_ID'); - $user = User::find($user_id); + $user = User::find($user_id); if ($user) { return Theme::theme()->contactLink($user); } else { @@ -5615,7 +5649,7 @@ class Stats { */ public function contactGedcom() { $user_id = $this->tree->getPreference('CONTACT_USER_ID'); - $user = User::find($user_id); + $user = User::find($user_id); if ($user) { return Theme::theme()->contactLink($user); } else { @@ -5699,11 +5733,11 @@ class Stats { if ($page_name === null) { // index.php?ctype=gedcom - $page_name = 'index.php'; + $page_name = 'index.php'; $page_parameter = 'gedcom:' . ($page_parameter ? Tree::findByName($page_parameter)->getTreeId() : $this->tree->getTreeId()); } elseif ($page_name == 'index.php') { // index.php?ctype=user - $user = User::findByIdentifier($page_parameter); + $user = User::findByIdentifier($page_parameter); $page_parameter = 'user:' . ($user ? $user->getUserId() : Auth::id()); } else { // indi/fam/sour/etc. @@ -5799,10 +5833,11 @@ class Stats { if ($value < 0) { $value = 0; } - $first = (int) ($value / 64); + $first = (int) ($value / 64); $second = $value % 64; $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; } + return $encoding; } @@ -5810,7 +5845,7 @@ class Stats { * @param array $a * @param array $b * - * @return integer + * @return int */ private function nameTotalSort($a, $b) { return $a['match'] - $b['match']; @@ -5820,7 +5855,7 @@ class Stats { * @param array $a * @param array $b * - * @return integer + * @return int */ private function nameTotalReverseSort($a, $b) { return $b['match'] - $a['match']; @@ -5838,7 +5873,7 @@ class Stats { if (isset($cache[$id])) { return $cache[$id]; } - $rows = Database::prepare($sql)->fetchAll(PDO::FETCH_ASSOC); + $rows = Database::prepare($sql)->fetchAll(PDO::FETCH_ASSOC); $cache[$id] = $rows; return $rows; @@ -5871,7 +5906,7 @@ class Stats { } /** - * @return integer + * @return int */ public function totalGedcomFavorites() { if (Module::getModuleByName('gedcom_favorites')) { @@ -5882,7 +5917,7 @@ class Stats { } /** - * @return integer + * @return int */ public function totalUserFavorites() { if (Module::getModuleByName('user_favorites')) { @@ -5925,12 +5960,13 @@ class Stats { if (count($bits) < 2) { continue; } - $v = array_shift($bits); + $v = array_shift($bits); $cfg[$v] = implode('=', $bits); } - $block = $all_blocks[$block]; + $block = $all_blocks[$block]; $block_id = Filter::getInteger('block_id'); - $content = $block->getBlock($block_id, false, $cfg); + $content = $block->getBlock($block_id, false, $cfg); + return $content; } @@ -6315,7 +6351,7 @@ class Stats { /** * century name, English => 21st, Polish => XXI, etc. * - * @param integer $century + * @param int $century * * @return string */ diff --git a/app/Theme.php b/app/Theme.php index 57a18d7ed8..fe59856625 100644 --- a/app/Theme.php +++ b/app/Theme.php @@ -70,8 +70,9 @@ class Theme { * * @param BaseTheme|null $theme * - * @return BaseTheme * @throws \LogicException + * + * @return BaseTheme */ public static function theme(BaseTheme $theme = null) { diff --git a/app/Theme/AdministrationTheme.php b/app/Theme/AdministrationTheme.php index a33e3ac220..bf56c6caf8 100644 --- a/app/Theme/AdministrationTheme.php +++ b/app/Theme/AdministrationTheme.php @@ -22,7 +22,7 @@ namespace Fisharebest\Webtrees; class AdministrationTheme extends BaseTheme { /** {@inheritdoc} */ protected function stylesheets() { - $stylesheets = parent::stylesheets(); + $stylesheets = parent::stylesheets(); $stylesheets[] = WT_DATATABLES_BOOTSTRAP_CSS_URL; $stylesheets[] = WT_BOOTSTRAP_DATETIMEPICKER_CSS_URL; $stylesheets[] = $this->assetUrl() . 'style.css'; diff --git a/app/Theme/BaseTheme.php b/app/Theme/BaseTheme.php index 57eb1b5b04..b81ded11ac 100644 --- a/app/Theme/BaseTheme.php +++ b/app/Theme/BaseTheme.php @@ -26,7 +26,7 @@ abstract class BaseTheme { /** @var string An escaped version of the "ged=XXX" URL parameter */ protected $tree_url; - /** @var integer The number of times this page has been shown */ + /** @var int The number of times this page has been shown */ protected $page_views; /** @@ -410,7 +410,7 @@ abstract class BaseTheme { /** * Add markup to the hit counter. * - * @param integer $count + * @param int $count * * @return string */ @@ -592,8 +592,6 @@ abstract class BaseTheme { /** * Allow themes to do things after initialization (since they cannot use * the constructor). - * - * @return void */ public function hookAfterInit() { } @@ -629,9 +627,9 @@ abstract class BaseTheme { /** * Add HTML markup to create an alert * - * @param string $html The content of the alert - * @param string $level One of 'success', 'info', 'warning', 'danger' - * @param boolean $dismissible If true, add a close button. + * @param string $html The content of the alert + * @param string $level One of 'success', 'info', 'warning', 'danger' + * @param bool $dismissible If true, add a close button. * * @return string */ @@ -768,7 +766,6 @@ abstract class BaseTheme { $thumbnail = ''; } - return '<div data-pid="' . $individual->getXref() . '" class="person_box_template ' . $personBoxClass . ' iconz box-style0" style="width: ' . $this->parameter('compact-chart-box-x') . 'px; min-height: ' . $this->parameter('compact-chart-box-y') . 'px">' . '<div class="compact_view">' . @@ -926,7 +923,7 @@ abstract class BaseTheme { foreach ($individual->getSpouseFamilies() as $family) { $menus[] = new Menu('<strong>' . I18N::translate('Family with spouse') . '</strong>', $family->getHtmlUrl()); - $spouse = $family->getSpouse($individual); + $spouse = $family->getSpouse($individual); if ($spouse && $spouse->canShowName()) { $menus[] = new Menu($spouse->getFullName(), $spouse->getHtmlUrl()); } @@ -960,8 +957,6 @@ abstract class BaseTheme { * happens in a theme file, and we need to be able to change it. * * @param Tree|null $tree The current tree (if there is one). - * - * @return void */ final public function init(Tree $tree = null) { $this->tree = $tree; @@ -1791,7 +1786,7 @@ abstract class BaseTheme { * * @param PageController $controller * - * @return integer Number of views, or zero for pages that aren't logged. + * @return int Number of views, or zero for pages that aren't logged. */ protected function pageViews(PageController $controller) { if ($this->tree && $this->tree->getPreference('SHOW_COUNTER')) { @@ -1816,7 +1811,7 @@ abstract class BaseTheme { * * @param string $parameter_name * - * @return string|integer|float + * @return string|int|float */ public function parameter($parameter_name) { $parameters = array( @@ -1987,8 +1982,6 @@ abstract class BaseTheme { /** * Send any HTTP headers. - * - * @return void */ public function sendHeaders() { header('Content-Type: text/html; charset=UTF-8'); diff --git a/app/Theme/ColorsTheme.php b/app/Theme/ColorsTheme.php index 301bbbe238..35805f2308 100644 --- a/app/Theme/ColorsTheme.php +++ b/app/Theme/ColorsTheme.php @@ -57,22 +57,22 @@ class ColorsTheme extends CloudsTheme { */ public function hookAfterInit() { $this->palettes = array( - 'aquamarine' => /* I18N: The name of a colour-scheme */ I18N::translate('Aqua Marine'), - 'ash' => /* I18N: The name of a colour-scheme */ I18N::translate('Ash'), - 'belgianchocolate'=> /* I18N: The name of a colour-scheme */ I18N::translate('Belgian Chocolate'), - 'bluelagoon' => /* I18N: The name of a colour-scheme */ I18N::translate('Blue Lagoon'), - 'bluemarine' => /* I18N: The name of a colour-scheme */ I18N::translate('Blue Marine'), - 'coffeeandcream' => /* I18N: The name of a colour-scheme */ I18N::translate('Coffee and Cream'), - 'coldday' => /* I18N: The name of a colour-scheme */ I18N::translate('Cold Day'), - 'greenbeam' => /* I18N: The name of a colour-scheme */ I18N::translate('Green Beam'), - 'mediterranio' => /* I18N: The name of a colour-scheme */ I18N::translate('Mediterranio'), - 'mercury' => /* I18N: The name of a colour-scheme */ I18N::translate('Mercury'), - 'nocturnal' => /* I18N: The name of a colour-scheme */ I18N::translate('Nocturnal'), - 'olivia' => /* I18N: The name of a colour-scheme */ I18N::translate('Olivia'), - 'pinkplastic' => /* I18N: The name of a colour-scheme */ I18N::translate('Pink Plastic'), - 'sage' => /* I18N: The name of a colour-scheme */ I18N::translate('Sage'), - 'shinytomato' => /* I18N: The name of a colour-scheme */ I18N::translate('Shiny Tomato'), - 'tealtop' => /* I18N: The name of a colour-scheme */ I18N::translate('Teal Top'), + 'aquamarine' => /* I18N: The name of a colour-scheme */ I18N::translate('Aqua Marine'), + 'ash' => /* I18N: The name of a colour-scheme */ I18N::translate('Ash'), + 'belgianchocolate' => /* I18N: The name of a colour-scheme */ I18N::translate('Belgian Chocolate'), + 'bluelagoon' => /* I18N: The name of a colour-scheme */ I18N::translate('Blue Lagoon'), + 'bluemarine' => /* I18N: The name of a colour-scheme */ I18N::translate('Blue Marine'), + 'coffeeandcream' => /* I18N: The name of a colour-scheme */ I18N::translate('Coffee and Cream'), + 'coldday' => /* I18N: The name of a colour-scheme */ I18N::translate('Cold Day'), + 'greenbeam' => /* I18N: The name of a colour-scheme */ I18N::translate('Green Beam'), + 'mediterranio' => /* I18N: The name of a colour-scheme */ I18N::translate('Mediterranio'), + 'mercury' => /* I18N: The name of a colour-scheme */ I18N::translate('Mercury'), + 'nocturnal' => /* I18N: The name of a colour-scheme */ I18N::translate('Nocturnal'), + 'olivia' => /* I18N: The name of a colour-scheme */ I18N::translate('Olivia'), + 'pinkplastic' => /* I18N: The name of a colour-scheme */ I18N::translate('Pink Plastic'), + 'sage' => /* I18N: The name of a colour-scheme */ I18N::translate('Sage'), + 'shinytomato' => /* I18N: The name of a colour-scheme */ I18N::translate('Shiny Tomato'), + 'tealtop' => /* I18N: The name of a colour-scheme */ I18N::translate('Teal Top'), ); uasort($this->palettes, __NAMESPACE__ . '\I18N::strcasecmp'); diff --git a/app/Tree.php b/app/Tree.php index 81183e71f1..33953b8e0a 100644 --- a/app/Tree.php +++ b/app/Tree.php @@ -22,7 +22,7 @@ use PDOException; * Class Tree - Provide an interface to the wt_gedcom table */ class Tree { - /** @var integer The tree's ID number */ + /** @var int The tree's ID number */ private $tree_id; /** @var string The tree's name */ @@ -53,9 +53,9 @@ class Tree { * Create a tree object. This is a private constructor - it can only * be called from Tree::getAll() to ensure proper initialisation. * - * @param integer $tree_id - * @param string $tree_name - * @param string $tree_title + * @param int $tree_id + * @param string $tree_name + * @param string $tree_title */ private function __construct($tree_id, $tree_name, $tree_title) { $this->tree_id = $tree_id; @@ -74,7 +74,7 @@ class Tree { 'priv_user' => Auth::PRIV_USER, 'priv_none' => Auth::PRIV_NONE, 'priv_hide' => Auth::PRIV_HIDE, - 'tree_id' => $this->tree_id + 'tree_id' => $this->tree_id, ))->fetchAll(); foreach ($rows as $row) { @@ -89,13 +89,12 @@ class Tree { } } - } /** * The ID of this tree * - * @return integer + * @return int */ public function getTreeId() { return $this->tree_id; @@ -284,7 +283,7 @@ class Tree { 'user_id' => $user->getUserId(), 'tree_id' => $this->tree_id, 'setting_name' => $setting_name, - 'setting_value' => $setting_value + 'setting_value' => $setting_value, )); } // Update our cache @@ -301,7 +300,7 @@ class Tree { * * @param User $user * - * @return boolean + * @return bool */ public function canAcceptChanges(User $user) { return Auth::isModerator($this, $user); @@ -315,7 +314,7 @@ class Tree { public static function getAll() { if (self::$trees === null) { self::$trees = array(); - $rows = Database::prepare( + $rows = Database::prepare( "SELECT SQL_CACHE g.gedcom_id AS tree_id, g.gedcom_name AS tree_name, gs1.setting_value AS tree_title" . " FROM `##gedcom` g" . " LEFT JOIN `##gedcom_setting` gs1 ON (g.gedcom_id=gs1.gedcom_id AND gs1.setting_name='title')" . @@ -344,10 +343,11 @@ class Tree { /** * Find the tree with a specific ID. * - * @param integer $tree_id + * @param int $tree_id * - * @return Tree * @throws \DomainException + * + * @return Tree */ public static function findById($tree_id) { foreach (self::getAll() as $tree) { @@ -568,7 +568,7 @@ class Tree { $note = I18N::translate('Edit this individual and replace their details with your own.'); Database::prepare("INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)")->execute(array( $tree_id, - "0 HEAD\n1 CHAR UTF-8\n0 @I1@ INDI\n1 NAME {$john_doe}\n1 SEX M\n1 BIRT\n2 DATE 01 JAN 1850\n2 NOTE {$note}\n0 TRLR\n" + "0 HEAD\n1 CHAR UTF-8\n0 @I1@ INDI\n1 NAME {$john_doe}\n1 SEX M\n1 BIRT\n2 DATE 01 JAN 1850\n2 NOTE {$note}\n0 TRLR\n", )); // Set the initial blocks @@ -594,11 +594,10 @@ class Tree { return (bool) Database::prepare( "SELECT 1 FROM `##change` WHERE status = 'pending' AND gedcom_id = :tree_id" )->execute(array( - 'tree_id' => $this->tree_id + 'tree_id' => $this->tree_id, ))->fetchOne(); } - /** * Delete all the genealogy data from a tree - in preparation for importing * new data. Optionally retain the media data, for when the user has been @@ -675,7 +674,7 @@ class Tree { 'tree_id_2' => $this->tree_id, 'tree_id_3' => $this->tree_id, 'tree_id_4' => $this->tree_id, - 'tree_id_5' => $this->tree_id + 'tree_id_5' => $this->tree_id, )); $buffer = reformat_record_export(gedcom_header($this)); @@ -818,8 +817,9 @@ class Tree { * * @param string $gedcom * - * @return GedcomRecord * @throws \Exception + * + * @return GedcomRecord */ public function createRecord($gedcom) { if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom, $match)) { @@ -851,7 +851,7 @@ class Tree { $this->tree_id, $xref, $gedcom, - Auth::id() + Auth::id(), )); Log::addEditLog('Create: ' . $type . ' ' . $xref); diff --git a/app/User.php b/app/User.php index c635482775..224c62eef1 100644 --- a/app/User.php +++ b/app/User.php @@ -41,7 +41,7 @@ class User { /** * Find the user with a specified user_id. * - * @param integer|null $user_id + * @param int|null $user_id * * @return User|null */ @@ -89,7 +89,7 @@ class User { " WHERE gedcom_id = :tree_id AND setting_name = 'gedcomid' AND setting_value = :xref" )->execute(array( 'tree_id' => $individual->getTree()->getTreeId(), - 'xref' => $individual->getXref() + 'xref' => $individual->getXref(), ))->fetchOne(); return self::find($user_id); @@ -140,13 +140,14 @@ class User { "INSERT INTO `##block` (`user_id`, `location`, `block_order`, `module_name`)" . " SELECT :user_id , `location`, `block_order`, `module_name` FROM `##block` WHERE `user_id` = -1" )->execute(array('user_id' => $user->getUserId())); + return $user; } /** * Get a count of all users. * - * @return integer + * @return int */ public static function count() { return (int) Database::prepare( @@ -275,10 +276,9 @@ class User { } /** Validate a supplied password - * * @param string $password * - * @return boolean + * @return bool */ public function checkPassword($password) { $password_hash = Database::prepare( @@ -289,6 +289,7 @@ class User { if (password_needs_rehash($password_hash, PASSWORD_DEFAULT)) { $this->setPassword($password); } + return true; } else { return false; |
