@@ -30,10 +30,10 @@ |
||
30 | 30 | * @param string $gedcom |
31 | 31 | * @return NULL|\MyArtJaub\Webtrees\Family |
32 | 32 | */ |
33 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
33 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
34 | 34 | $dfam = null; |
35 | 35 | $fam = fw\Family::getInstance($xref, $tree, $gedcom); |
36 | - if($fam){ |
|
36 | + if ($fam) { |
|
37 | 37 | $dfam = new Family($fam); |
38 | 38 | } |
39 | 39 | return $dfam; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
29 | 29 | */ |
30 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
30 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
31 | 31 | $this->gedcomrecord = $gedcomrecord_in; |
32 | 32 | } |
33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
38 | 38 | */ |
39 | - public function getDerivedRecord(){ |
|
39 | + public function getDerivedRecord() { |
|
40 | 40 | return $this->gedcomrecord; |
41 | 41 | } |
42 | 42 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
68 | 68 | switch ($style) { |
69 | 69 | case 10: |
70 | - return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
70 | + return '<i>'.$fact->getLabel().' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact).' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
71 | 71 | default: |
72 | 72 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
73 | 73 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | // Permissions are configured |
53 | 53 | if (is_numeric($permission_level)) { |
54 | 54 | // Logged in with the correct role? |
55 | - if (Auth::accessLevel($tree, $user) <= (int) $permission_level) { |
|
55 | + if (Auth::accessLevel($tree, $user) <= (int)$permission_level) { |
|
56 | 56 | return $handler->handle($request); |
57 | 57 | } |
58 | 58 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | class Individual extends GedcomRecord { |
22 | 22 | |
23 | 23 | /** @var array|null List of titles the individal holds */ |
24 | - protected $titles=null; |
|
24 | + protected $titles = null; |
|
25 | 25 | |
26 | 26 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
27 | 27 | protected $unprotected_prim_surname = null; |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param null|string $gedcom |
36 | 36 | * @return null|Individual |
37 | 37 | */ |
38 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
38 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
39 | 39 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
40 | - if($indi){ |
|
40 | + if ($indi) { |
|
41 | 41 | return new Individual($indi); |
42 | 42 | } |
43 | 43 | return null; |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array Array of titles |
50 | 50 | */ |
51 | - public function getTitles(){ |
|
52 | - if(is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
51 | + public function getTitles() { |
|
52 | + if (is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
53 | 53 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
54 | - $this->titles=array(); |
|
54 | + $this->titles = array(); |
|
55 | 55 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
56 | - foreach($titlefacts as $titlefact){ |
|
56 | + foreach ($titlefacts as $titlefact) { |
|
57 | 57 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
58 | - if($ct2>0){ |
|
59 | - $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
|
58 | + if ($ct2 > 0) { |
|
59 | + $this->titles[$match2[1][0]][] = trim($match2[2][0]); |
|
60 | 60 | } |
61 | - else{ |
|
62 | - $this->titles[$titlefact->getValue()][]=''; |
|
61 | + else { |
|
62 | + $this->titles[$titlefact->getValue()][] = ''; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @return string Primary surname |
74 | 74 | */ |
75 | 75 | public function getUnprotectedPrimarySurname() { |
76 | - if(!$this->unprotected_prim_surname){ |
|
77 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
76 | + if (!$this->unprotected_prim_surname) { |
|
77 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
78 | 78 | $this->unprotected_prim_surname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
79 | 79 | } |
80 | 80 | return $this->unprotected_prim_surname; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | * @param boolean $perc Should the coefficient of reliability be returned |
87 | 87 | * @return string|array Estimated birth place if found, null otherwise |
88 | 88 | */ |
89 | - public function getEstimatedBirthPlace($perc=false){ |
|
90 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
91 | - if($perc){ |
|
92 | - return array ($bplace, 1); |
|
89 | + public function getEstimatedBirthPlace($perc = false) { |
|
90 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
91 | + if ($perc) { |
|
92 | + return array($bplace, 1); |
|
93 | 93 | } |
94 | - else{ |
|
94 | + else { |
|
95 | 95 | return $bplace; |
96 | 96 | } |
97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param boolean $perc Should the coefficient of reliability be returned |
105 | 105 | * @return string|array Estimated birth place if found, null otherwise |
106 | 106 | */ |
107 | - public function getSignificantPlace(){ |
|
108 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
107 | + public function getSignificantPlace() { |
|
108 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
109 | 109 | return $bplace; |
110 | 110 | } |
111 | 111 | |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
118 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
119 | 119 | return $dplace; |
120 | 120 | } |
121 | 121 | |
122 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
122 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
123 | 123 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
124 | 124 | if ($rplace) { |
125 | 125 | return $rplace; |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param string $text Text to display |
34 | 34 | */ |
35 | - static public function promptAlert($text){ |
|
35 | + static public function promptAlert($text) { |
|
36 | 36 | echo '<script>'; |
37 | - echo 'alert("',fw\Filter::escapeHtml($text),'")'; |
|
37 | + echo 'alert("', fw\Filter::escapeHtml($text), '")'; |
|
38 | 38 | echo '</script>'; |
39 | 39 | } |
40 | 40 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return float Result of the safe division |
48 | 48 | */ |
49 | 49 | public static function safeDivision($num, $denom, $default = 0) { |
50 | - if($denom && $denom!=0){ |
|
50 | + if ($denom && $denom != 0) { |
|
51 | 51 | return $num / $denom; |
52 | 52 | } |
53 | 53 | return $default; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param float $default Default value if denominator null or 0 |
62 | 62 | * @return float Percentage |
63 | 63 | */ |
64 | - public static function getPercentage($num, $denom, $default = 0){ |
|
64 | + public static function getPercentage($num, $denom, $default = 0) { |
|
65 | 65 | return 100 * self::safeDivision($num, $denom, $default); |
66 | 66 | } |
67 | 67 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @param int $target The final max width/height |
73 | 73 | * @return array array of ($width, $height). One of them must be $target |
74 | 74 | */ |
75 | - static public function getResizedImageSize($file, $target=25){ |
|
76 | - list($width, $height, , ) = getimagesize($file); |
|
75 | + static public function getResizedImageSize($file, $target = 25) { |
|
76 | + list($width, $height,,) = getimagesize($file); |
|
77 | 77 | $max = max($width, $height); |
78 | 78 | $rapp = $target / $max; |
79 | 79 | $width = intval($rapp * $width); |
@@ -103,21 +103,21 @@ discard block |
||
103 | 103 | * @param int $length Length of the token, default to 32 |
104 | 104 | * @return string Random token |
105 | 105 | */ |
106 | - public static function generateRandomToken($length=32) { |
|
106 | + public static function generateRandomToken($length = 32) { |
|
107 | 107 | $chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); |
108 | 108 | $len_chars = count($chars); |
109 | 109 | $token = ''; |
110 | 110 | |
111 | 111 | for ($i = 0; $i < $length; $i++) |
112 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
112 | + $token .= $chars[mt_rand(0, $len_chars - 1)]; |
|
113 | 113 | |
114 | 114 | # Number of 32 char chunks |
115 | - $chunks = ceil( strlen($token) / 32 ); |
|
115 | + $chunks = ceil(strlen($token) / 32); |
|
116 | 116 | $md5token = ''; |
117 | 117 | |
118 | 118 | # Run each chunk through md5 |
119 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
120 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
119 | + for ($i = 1; $i <= $chunks; $i++) |
|
120 | + $md5token .= md5(substr($token, $i * 32 - 32, 32)); |
|
121 | 121 | |
122 | 122 | # Trim the token |
123 | 123 | return substr($md5token, 0, $length); |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | * @param string $string Filesystem encoded string to encode |
130 | 130 | * @return string UTF-8 encoded string |
131 | 131 | */ |
132 | - public static function encodeFileSystemToUtf8($string){ |
|
132 | + public static function encodeFileSystemToUtf8($string) { |
|
133 | 133 | if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
134 | - return iconv('cp1252', 'utf-8//IGNORE',$string); |
|
134 | + return iconv('cp1252', 'utf-8//IGNORE', $string); |
|
135 | 135 | } |
136 | 136 | return $string; |
137 | 137 | } |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | * @param string $string UTF-8 encoded string to encode |
143 | 143 | * @return string Filesystem encoded string |
144 | 144 | */ |
145 | - public static function encodeUtf8ToFileSystem($string){ |
|
145 | + public static function encodeUtf8ToFileSystem($string) { |
|
146 | 146 | if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
147 | - return iconv('utf-8', 'cp1252//IGNORE' , $string); |
|
147 | + return iconv('utf-8', 'cp1252//IGNORE', $string); |
|
148 | 148 | } |
149 | 149 | return $string; |
150 | 150 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return boolean True if path valid |
158 | 158 | */ |
159 | 159 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
160 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
160 | + if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 |
@@ -75,16 +75,16 @@ |
||
75 | 75 | |
76 | 76 | $initial = mb_substr($surname, 0, 1); |
77 | 77 | $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
78 | - ->reject(function (int $count, string $initial): bool { |
|
78 | + ->reject(function(int $count, string $initial): bool { |
|
79 | 79 | |
80 | 80 | return $initial === '@' || $initial === ','; |
81 | 81 | }); |
82 | 82 | |
83 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname; |
|
83 | + $title = I18N::translate('Patronymic Lineages').' — '.$surname; |
|
84 | 84 | |
85 | 85 | $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages(); |
86 | 86 | |
87 | - return $this->viewResponse($this->module->name() . '::lineages-page', [ |
|
87 | + return $this->viewResponse($this->module->name().'::lineages-page', [ |
|
88 | 88 | 'title' => $title, |
89 | 89 | 'module' => $this->module, |
90 | 90 | 'tree' => $tree, |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $initial = $request->getAttribute('alpha'); |
74 | 74 | $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
75 | - ->reject(function (int $count, string $initial): bool { |
|
75 | + ->reject(function(int $count, string $initial): bool { |
|
76 | 76 | |
77 | 77 | return $initial === '@' || $initial === ','; |
78 | 78 | }); |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | $show_all = $request->getQueryParams()['show_all'] ?? 'no'; |
81 | 81 | |
82 | 82 | if ($show_all === 'yes') { |
83 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All'); |
|
83 | + $title = I18N::translate('Patronymic Lineages').' — '.I18N::translate('All'); |
|
84 | 84 | $surnames = $this->indilist_module->surnames($tree, '', '', false, false, I18N::locale()); |
85 | 85 | } elseif ($initial !== null && mb_strlen($initial) == 1) { |
86 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $initial; |
|
86 | + $title = I18N::translate('Patronymic Lineages').' — '.$initial; |
|
87 | 87 | $surnames = $this->indilist_module->surnames($tree, '', $initial, false, false, I18N::locale()); |
88 | 88 | } else { |
89 | - $title = I18N::translate('Patronymic Lineages'); |
|
89 | + $title = I18N::translate('Patronymic Lineages'); |
|
90 | 90 | $surnames = []; |
91 | 91 | } |
92 | 92 | |
93 | - return $this->viewResponse($this->module->name() . '::surnames-page', [ |
|
93 | + return $this->viewResponse($this->module->name().'::surnames-page', [ |
|
94 | 94 | 'title' => $title, |
95 | 95 | 'module' => $this->module, |
96 | 96 | 'tree' => $tree, |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function headContent(): string |
73 | 73 | { |
74 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
74 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function bodyContent(): string |
82 | 82 | { |
83 | - return '<script src="' . $this->assetUrl('js/issourced.min.js') . '"></script>'; |
|
83 | + return '<script src="'.$this->assetUrl('js/issourced.min.js').'"></script>'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | $source_status_service = app(SourceStatusService::class); |
103 | 103 | |
104 | 104 | $spouse_families_status = $individual->spouseFamilies()->map( |
105 | - function (Family $sfamily) use ($source_status_service): array { |
|
106 | - return [ $sfamily, $source_status_service->sourceStatusForMarriage($sfamily)]; |
|
105 | + function(Family $sfamily) use ($source_status_service): array { |
|
106 | + return [$sfamily, $source_status_service->sourceStatusForMarriage($sfamily)]; |
|
107 | 107 | } |
108 | - )->filter(function (array $item): bool { |
|
108 | + )->filter(function(array $item): bool { |
|
109 | 109 | return $item[1]->isSet(); |
110 | 110 | }); |
111 | 111 | |
112 | - return view($this->name() . '::sidebar/content', [ |
|
112 | + return view($this->name().'::sidebar/content', [ |
|
113 | 113 | 'module_name' => $this->name(), |
114 | 114 | 'individual' => $individual, |
115 | 115 | 'source_status_individual' => $source_status_service->sourceStatusForRecord($individual), |
@@ -81,12 +81,12 @@ |
||
81 | 81 | } |
82 | 82 | } catch (Throwable $ex) { |
83 | 83 | return $this->viewResponse('errors/unhandled-exception', [ |
84 | - 'error' => I18N::translate('Error while retrieving Matomo statistics: ') . |
|
84 | + 'error' => I18N::translate('Error while retrieving Matomo statistics: '). |
|
85 | 85 | (Auth::isAdmin() ? $ex->getMessage() : I18N::translate('Log in as admin for error details')) |
86 | 86 | ], StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR); |
87 | 87 | } |
88 | 88 | |
89 | - return $this->viewResponse($this->module->name() . '::matomo-stats', [ |
|
89 | + return $this->viewResponse($this->module->name().'::matomo-stats', [ |
|
90 | 90 | 'visits_year' => $nb_visits_year, |
91 | 91 | 'visits_today' => $nb_visits_today |
92 | 92 | ]); |