@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | private function getTags($text) |
157 | 157 | { |
158 | 158 | // Extract all tags from the provided text |
159 | - preg_match_all('/#([^#]+)(?=#)/', (string)$text, $match); |
|
159 | + preg_match_all('/#([^#]+)(?=#)/', (string) $text, $match); |
|
160 | 160 | $tags = $match[1]; |
161 | 161 | $c = \count($tags); |
162 | 162 | $new_tags = []; // tag to replace |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | private function totalIndividualsQuery() |
394 | 394 | { |
395 | - return (int)Database::prepare( |
|
395 | + return (int) Database::prepare( |
|
396 | 396 | "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id" |
397 | 397 | )->execute([ |
398 | 398 | 'tree_id' => $this->tree->getTreeId(), |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | private function totalIndisWithSourcesQuery() |
418 | 418 | { |
419 | - return (int)Database::prepare( |
|
419 | + return (int) Database::prepare( |
|
420 | 420 | "SELECT COUNT(DISTINCT i_id)" . |
421 | 421 | " FROM `##individuals` JOIN `##link` ON i_id = l_from AND i_file = l_file" . |
422 | 422 | " WHERE l_file = :tree_id AND l_type = 'SOUR'" |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | */ |
500 | 500 | private function totalFamiliesQuery() |
501 | 501 | { |
502 | - return (int)Database::prepare( |
|
502 | + return (int) Database::prepare( |
|
503 | 503 | "SELECT COUNT(*) FROM `##families` WHERE f_file = :tree_id" |
504 | 504 | )->execute([ |
505 | 505 | 'tree_id' => $this->tree->getTreeId(), |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | */ |
524 | 524 | private function totalFamsWithSourcesQuery() |
525 | 525 | { |
526 | - return (int)Database::prepare( |
|
526 | + return (int) Database::prepare( |
|
527 | 527 | "SELECT COUNT(DISTINCT f_id)" . |
528 | 528 | " FROM `##families` JOIN `##link` ON f_id = l_from AND f_file = l_file" . |
529 | 529 | " WHERE l_file = :tree_id AND l_type = 'SOUR'" |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | */ |
607 | 607 | private function totalSourcesQuery() |
608 | 608 | { |
609 | - return (int)Database::prepare( |
|
609 | + return (int) Database::prepare( |
|
610 | 610 | "SELECT COUNT(*) FROM `##sources` WHERE s_file = :tree_id" |
611 | 611 | )->execute([ |
612 | 612 | 'tree_id' => $this->tree->getTreeId(), |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | */ |
641 | 641 | private function totalNotesQuery() |
642 | 642 | { |
643 | - return (int)Database::prepare( |
|
643 | + return (int) Database::prepare( |
|
644 | 644 | "SELECT COUNT(*) FROM `##other` WHERE o_type='NOTE' AND o_file = :tree_id" |
645 | 645 | )->execute([ |
646 | 646 | 'tree_id' => $this->tree->getTreeId(), |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | private function totalRepositoriesQuery() |
676 | 676 | { |
677 | - return (int)Database::prepare( |
|
677 | + return (int) Database::prepare( |
|
678 | 678 | "SELECT COUNT(*) FROM `##other` WHERE o_type='REPO' AND o_file = :tree_id" |
679 | 679 | )->execute([ |
680 | 680 | 'tree_id' => $this->tree->getTreeId(), |
@@ -785,11 +785,11 @@ discard block |
||
785 | 785 | } |
786 | 786 | } |
787 | 787 | if ($types) { |
788 | - $sql .= ' AND d_fact IN (' . implode(', ', array_fill(0, \count($types), '?')) . ')'; |
|
788 | + $sql .= ' AND d_fact IN (' . implode(', ', array_fill(0, \count($types), '?')) . ')'; |
|
789 | 789 | $vars = array_merge($vars, $types); |
790 | 790 | } |
791 | 791 | } |
792 | - $sql .= ' AND d_fact NOT IN (' . implode(', ', array_fill(0, \count($no_types), '?')) . ')'; |
|
792 | + $sql .= ' AND d_fact NOT IN (' . implode(', ', array_fill(0, \count($no_types), '?')) . ')'; |
|
793 | 793 | $vars = array_merge($vars, $no_types); |
794 | 794 | |
795 | 795 | $n = Database::prepare($sql)->execute($vars)->fetchOne(); |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | */ |
902 | 902 | private function totalSexMalesQuery() |
903 | 903 | { |
904 | - return (int)Database::prepare( |
|
904 | + return (int) Database::prepare( |
|
905 | 905 | "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'M'" |
906 | 906 | )->execute([ |
907 | 907 | 'tree_id' => $this->tree->getTreeId(), |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | */ |
936 | 936 | private function totalSexFemalesQuery() |
937 | 937 | { |
938 | - return (int)Database::prepare( |
|
938 | + return (int) Database::prepare( |
|
939 | 939 | "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'F'" |
940 | 940 | )->execute([ |
941 | 941 | 'tree_id' => $this->tree->getTreeId(), |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | */ |
970 | 970 | private function totalSexUnknownQuery() |
971 | 971 | { |
972 | - return (int)Database::prepare( |
|
972 | + return (int) Database::prepare( |
|
973 | 973 | "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'U'" |
974 | 974 | )->execute([ |
975 | 975 | 'tree_id' => $this->tree->getTreeId(), |
@@ -1041,12 +1041,12 @@ discard block |
||
1041 | 1041 | if ($tot == 0) { |
1042 | 1042 | return ''; |
1043 | 1043 | } elseif ($tot_u > 0) { |
1044 | - $chd = $this->arrayToExtendedEncoding([ |
|
1044 | + $chd = $this->arrayToExtendedEncoding([ |
|
1045 | 1045 | 4095 * $tot_u / $tot, |
1046 | 1046 | 4095 * $tot_f / $tot, |
1047 | 1047 | 4095 * $tot_m / $tot, |
1048 | 1048 | ]); |
1049 | - $chl = |
|
1049 | + $chl = |
|
1050 | 1050 | I18N::translateContext('unknown people', 'Unknown') . ' - ' . $per_u . '|' . |
1051 | 1051 | I18N::translate('Females') . ' - ' . $per_f . '|' . |
1052 | 1052 | I18N::translate('Males') . ' - ' . $per_m; |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | 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 . '" />'; |
1059 | 1059 | } else { |
1060 | - $chd = $this->arrayToExtendedEncoding([ |
|
1060 | + $chd = $this->arrayToExtendedEncoding([ |
|
1061 | 1061 | 4095 * $tot_f / $tot, |
1062 | 1062 | 4095 * $tot_m / $tot, |
1063 | 1063 | ]); |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | */ |
1084 | 1084 | private function totalLivingQuery() |
1085 | 1085 | { |
1086 | - return (int)Database::prepare( |
|
1086 | + return (int) Database::prepare( |
|
1087 | 1087 | "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom NOT REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'" |
1088 | 1088 | )->execute([ |
1089 | 1089 | 'tree_id' => $this->tree->getTreeId(), |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | */ |
1118 | 1118 | private function totalDeceasedQuery() |
1119 | 1119 | { |
1120 | - return (int)Database::prepare( |
|
1120 | + return (int) Database::prepare( |
|
1121 | 1121 | "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'" |
1122 | 1122 | )->execute([ |
1123 | 1123 | 'tree_id' => $this->tree->getTreeId(), |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | if ($tot == 0) { |
1183 | 1183 | return ''; |
1184 | 1184 | } else { |
1185 | - $chd = $this->arrayToExtendedEncoding([ |
|
1185 | + $chd = $this->arrayToExtendedEncoding([ |
|
1186 | 1186 | 4095 * $tot_l / $tot, |
1187 | 1187 | 4095 * $tot_d / $tot, |
1188 | 1188 | ]); |
@@ -1253,18 +1253,18 @@ discard block |
||
1253 | 1253 | if ($type == 'unknown') { |
1254 | 1254 | // There has to be a better way then this :( |
1255 | 1255 | foreach ($this->media_types as $t) { |
1256 | - $sql .= " AND (m_gedcom NOT LIKE ? AND m_gedcom NOT LIKE ?)"; |
|
1256 | + $sql .= " AND (m_gedcom NOT LIKE ? AND m_gedcom NOT LIKE ?)"; |
|
1257 | 1257 | $vars[] = "%3 TYPE {$t}%"; |
1258 | 1258 | $vars[] = "%1 _TYPE {$t}%"; |
1259 | 1259 | } |
1260 | 1260 | } else { |
1261 | - $sql .= " AND (m_gedcom LIKE ? OR m_gedcom LIKE ?)"; |
|
1261 | + $sql .= " AND (m_gedcom LIKE ? OR m_gedcom LIKE ?)"; |
|
1262 | 1262 | $vars[] = "%3 TYPE {$type}%"; |
1263 | 1263 | $vars[] = "%1 _TYPE {$type}%"; |
1264 | 1264 | } |
1265 | 1265 | } |
1266 | 1266 | |
1267 | - return (int)Database::prepare($sql)->execute($vars)->fetchOne(); |
|
1267 | + return (int) Database::prepare($sql)->execute($vars)->fetchOne(); |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | /** |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | private function totalPlacesQuery() |
1726 | 1726 | { |
1727 | 1727 | return |
1728 | - (int)Database::prepare("SELECT COUNT(*) FROM `##places` WHERE p_file=?") |
|
1728 | + (int) Database::prepare("SELECT COUNT(*) FROM `##places` WHERE p_file=?") |
|
1729 | 1729 | ->execute([$this->tree->getTreeId()]) |
1730 | 1730 | ->fetchOne(); |
1731 | 1731 | } |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | $chart_url .= '&chs=' . $WT_STATS_MAP_X . 'x' . $WT_STATS_MAP_Y; |
1896 | 1896 | $chart_url .= '&chld=' . implode('', array_keys($surn_countries)) . '&chd=s:'; |
1897 | 1897 | foreach ($surn_countries as $count) { |
1898 | - $chart_url .= substr(self::GOOGLE_CHART_ENCODING, (int)($count / max($surn_countries) * 61), 1); |
|
1898 | + $chart_url .= substr(self::GOOGLE_CHART_ENCODING, (int) ($count / max($surn_countries) * 61), 1); |
|
1899 | 1899 | } |
1900 | 1900 | $chart = '<div id="google_charts" class="center">'; |
1901 | 1901 | $chart .= '<p>' . $chart_title . '</p>'; |
@@ -1937,9 +1937,9 @@ discard block |
||
1937 | 1937 | $country = trim($place->country); |
1938 | 1938 | if (array_key_exists($country, $country_names)) { |
1939 | 1939 | if (!isset($all_db_countries[$country_names[$country]][$country])) { |
1940 | - $all_db_countries[$country_names[$country]][$country] = (int)$place->tot; |
|
1940 | + $all_db_countries[$country_names[$country]][$country] = (int) $place->tot; |
|
1941 | 1941 | } else { |
1942 | - $all_db_countries[$country_names[$country]][$country] += (int)$place->tot; |
|
1942 | + $all_db_countries[$country_names[$country]][$country] += (int) $place->tot; |
|
1943 | 1943 | } |
1944 | 1944 | } |
1945 | 1945 | } |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | $centuries = ''; |
2117 | 2117 | $counts = []; |
2118 | 2118 | foreach ($rows as $values) { |
2119 | - $counts[] = round(100 * $values->total / $tot, 0); |
|
2119 | + $counts[] = round(100 * $values->total / $tot, 0); |
|
2120 | 2120 | $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number($values->total) . '|'; |
2121 | 2121 | } |
2122 | 2122 | $chd = $this->arrayToExtendedEncoding($counts); |
@@ -2210,7 +2210,7 @@ discard block |
||
2210 | 2210 | $centuries = ''; |
2211 | 2211 | $counts = []; |
2212 | 2212 | foreach ($rows as $values) { |
2213 | - $counts[] = round(100 * $values->total / $tot, 0); |
|
2213 | + $counts[] = round(100 * $values->total / $tot, 0); |
|
2214 | 2214 | $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number($values->total) . '|'; |
2215 | 2215 | } |
2216 | 2216 | $chd = $this->arrayToExtendedEncoding($counts); |
@@ -2460,7 +2460,7 @@ discard block |
||
2460 | 2460 | } |
2461 | 2461 | break; |
2462 | 2462 | case 'age': |
2463 | - $result = I18N::number((int)($row->age / 365.25)); |
|
2463 | + $result = I18N::number((int) ($row->age / 365.25)); |
|
2464 | 2464 | break; |
2465 | 2465 | case 'name': |
2466 | 2466 | $result = '<a href="' . e($person->url()) . '">' . $person->getFullName() . '</a>'; |
@@ -2489,7 +2489,7 @@ discard block |
||
2489 | 2489 | $sex_search = ''; |
2490 | 2490 | } |
2491 | 2491 | if (isset($params[0])) { |
2492 | - $total = (int)$params[0]; |
|
2492 | + $total = (int) $params[0]; |
|
2493 | 2493 | } else { |
2494 | 2494 | $total = 10; |
2495 | 2495 | } |
@@ -2523,10 +2523,10 @@ discard block |
||
2523 | 2523 | foreach ($rows as $row) { |
2524 | 2524 | $person = Individual::getInstance($row->deathdate, $this->tree); |
2525 | 2525 | $age = $row->age; |
2526 | - if ((int)($age / 365.25) > 0) { |
|
2527 | - $age = (int)($age / 365.25) . 'y'; |
|
2528 | - } elseif ((int)($age / 30.4375) > 0) { |
|
2529 | - $age = (int)($age / 30.4375) . 'm'; |
|
2526 | + if ((int) ($age / 365.25) > 0) { |
|
2527 | + $age = (int) ($age / 365.25) . 'y'; |
|
2528 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
2529 | + $age = (int) ($age / 30.4375) . 'm'; |
|
2530 | 2530 | } else { |
2531 | 2531 | $age = $age . 'd'; |
2532 | 2532 | } |
@@ -2588,11 +2588,11 @@ discard block |
||
2588 | 2588 | $sex_search = ''; |
2589 | 2589 | } |
2590 | 2590 | if (isset($params[0])) { |
2591 | - $total = (int)$params[0]; |
|
2591 | + $total = (int) $params[0]; |
|
2592 | 2592 | } else { |
2593 | 2593 | $total = 10; |
2594 | 2594 | } |
2595 | - $rows = $this->runSql( |
|
2595 | + $rows = $this->runSql( |
|
2596 | 2596 | "SELECT" . |
2597 | 2597 | " birth.d_gid AS id," . |
2598 | 2598 | " MIN(birth.d_julianday1) AS age" . |
@@ -2615,10 +2615,10 @@ discard block |
||
2615 | 2615 | foreach ($rows as $row) { |
2616 | 2616 | $person = Individual::getInstance($row->id, $this->tree); |
2617 | 2617 | $age = (WT_CLIENT_JD - $row->age); |
2618 | - if ((int)($age / 365.25) > 0) { |
|
2619 | - $age = (int)($age / 365.25) . 'y'; |
|
2620 | - } elseif ((int)($age / 30.4375) > 0) { |
|
2621 | - $age = (int)($age / 30.4375) . 'm'; |
|
2618 | + if ((int) ($age / 365.25) > 0) { |
|
2619 | + $age = (int) ($age / 365.25) . 'y'; |
|
2620 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
2621 | + $age = (int) ($age / 30.4375) . 'm'; |
|
2622 | 2622 | } else { |
2623 | 2623 | $age = $age . 'd'; |
2624 | 2624 | } |
@@ -2695,10 +2695,10 @@ discard block |
||
2695 | 2695 | |
2696 | 2696 | $age = $rows[0]->age; |
2697 | 2697 | if ($show_years) { |
2698 | - if ((int)($age / 365.25) > 0) { |
|
2699 | - $age = (int)($age / 365.25) . 'y'; |
|
2700 | - } elseif ((int)($age / 30.4375) > 0) { |
|
2701 | - $age = (int)($age / 30.4375) . 'm'; |
|
2698 | + if ((int) ($age / 365.25) > 0) { |
|
2699 | + $age = (int) ($age / 365.25) . 'y'; |
|
2700 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
2701 | + $age = (int) ($age / 30.4375) . 'm'; |
|
2702 | 2702 | } elseif (!empty($age)) { |
2703 | 2703 | $age = $age . 'd'; |
2704 | 2704 | } |
@@ -2768,7 +2768,7 @@ discard block |
||
2768 | 2768 | if ($sizes[0] < 980) { |
2769 | 2769 | $sizes[0] += 50; |
2770 | 2770 | } |
2771 | - $chxl .= $this->centuryName($century) . '|'; |
|
2771 | + $chxl .= $this->centuryName($century) . '|'; |
|
2772 | 2772 | $average = 0; |
2773 | 2773 | if (isset($values['F'])) { |
2774 | 2774 | $countsf .= $values['F'] . ','; |
@@ -2810,7 +2810,7 @@ discard block |
||
2810 | 2810 | while ($offset = strpos($title, ' ', $offset + 1)) { |
2811 | 2811 | $counter[] = $offset; |
2812 | 2812 | } |
2813 | - $half = (int)(\count($counter) / 2); |
|
2813 | + $half = (int) (\count($counter) / 2); |
|
2814 | 2814 | $chtt = substr_replace($title, '|', $counter[$half], 1); |
2815 | 2815 | } |
2816 | 2816 | |
@@ -3386,16 +3386,16 @@ discard block |
||
3386 | 3386 | case 'age': |
3387 | 3387 | $age = $row->age; |
3388 | 3388 | if ($show_years) { |
3389 | - if ((int)($age / 365.25) > 0) { |
|
3390 | - $age = (int)($age / 365.25) . 'y'; |
|
3391 | - } elseif ((int)($age / 30.4375) > 0) { |
|
3392 | - $age = (int)($age / 30.4375) . 'm'; |
|
3389 | + if ((int) ($age / 365.25) > 0) { |
|
3390 | + $age = (int) ($age / 365.25) . 'y'; |
|
3391 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3392 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3393 | 3393 | } else { |
3394 | 3394 | $age = $age . 'd'; |
3395 | 3395 | } |
3396 | 3396 | $result = FunctionsDate::getAgeAtEvent($age); |
3397 | 3397 | } else { |
3398 | - $result = I18N::number((int)($age / 365.25)); |
|
3398 | + $result = I18N::number((int) ($age / 365.25)); |
|
3399 | 3399 | } |
3400 | 3400 | break; |
3401 | 3401 | } |
@@ -3415,7 +3415,7 @@ discard block |
||
3415 | 3415 | private function ageOfMarriageQuery($type = 'list', $age_dir = 'ASC', $params = []) |
3416 | 3416 | { |
3417 | 3417 | if (isset($params[0])) { |
3418 | - $total = (int)$params[0]; |
|
3418 | + $total = (int) $params[0]; |
|
3419 | 3419 | } else { |
3420 | 3420 | $total = 10; |
3421 | 3421 | } |
@@ -3498,10 +3498,10 @@ discard block |
||
3498 | 3498 | if ($type === 'name') { |
3499 | 3499 | return $family->formatList(); |
3500 | 3500 | } |
3501 | - if ((int)($age / 365.25) > 0) { |
|
3502 | - $age = (int)($age / 365.25) . 'y'; |
|
3503 | - } elseif ((int)($age / 30.4375) > 0) { |
|
3504 | - $age = (int)($age / 30.4375) . 'm'; |
|
3501 | + if ((int) ($age / 365.25) > 0) { |
|
3502 | + $age = (int) ($age / 365.25) . 'y'; |
|
3503 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3504 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3505 | 3505 | } else { |
3506 | 3506 | $age = $age . 'd'; |
3507 | 3507 | } |
@@ -3563,7 +3563,7 @@ discard block |
||
3563 | 3563 | private function ageBetweenSpousesQuery($type = 'list', $age_dir = 'DESC', $params = []) |
3564 | 3564 | { |
3565 | 3565 | if (isset($params[0])) { |
3566 | - $total = (int)$params[0]; |
|
3566 | + $total = (int) $params[0]; |
|
3567 | 3567 | } else { |
3568 | 3568 | $total = 10; |
3569 | 3569 | } |
@@ -3608,10 +3608,10 @@ discard block |
||
3608 | 3608 | break; |
3609 | 3609 | } |
3610 | 3610 | $age = $fam->age; |
3611 | - if ((int)($age / 365.25) > 0) { |
|
3612 | - $age = (int)($age / 365.25) . 'y'; |
|
3613 | - } elseif ((int)($age / 30.4375) > 0) { |
|
3614 | - $age = (int)($age / 30.4375) . 'm'; |
|
3611 | + if ((int) ($age / 365.25) > 0) { |
|
3612 | + $age = (int) ($age / 365.25) . 'y'; |
|
3613 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3614 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3615 | 3615 | } else { |
3616 | 3616 | $age = $age . 'd'; |
3617 | 3617 | } |
@@ -3699,16 +3699,16 @@ discard block |
||
3699 | 3699 | case 'age': |
3700 | 3700 | $age = $row->age; |
3701 | 3701 | if ($show_years) { |
3702 | - if ((int)($age / 365.25) > 0) { |
|
3703 | - $age = (int)($age / 365.25) . 'y'; |
|
3704 | - } elseif ((int)($age / 30.4375) > 0) { |
|
3705 | - $age = (int)($age / 30.4375) . 'm'; |
|
3702 | + if ((int) ($age / 365.25) > 0) { |
|
3703 | + $age = (int) ($age / 365.25) . 'y'; |
|
3704 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3705 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3706 | 3706 | } else { |
3707 | 3707 | $age = $age . 'd'; |
3708 | 3708 | } |
3709 | 3709 | $result = FunctionsDate::getAgeAtEvent($age); |
3710 | 3710 | } else { |
3711 | - $result = (int)($age / 365.25); |
|
3711 | + $result = (int) ($age / 365.25); |
|
3712 | 3712 | } |
3713 | 3713 | break; |
3714 | 3714 | } |
@@ -3792,7 +3792,7 @@ discard block |
||
3792 | 3792 | $sizes = explode('x', $size); |
3793 | 3793 | $tot = 0; |
3794 | 3794 | foreach ($rows as $values) { |
3795 | - $tot += (int)$values->total; |
|
3795 | + $tot += (int) $values->total; |
|
3796 | 3796 | } |
3797 | 3797 | // Beware divide by zero |
3798 | 3798 | if ($tot === 0) { |
@@ -3801,7 +3801,7 @@ discard block |
||
3801 | 3801 | $centuries = ''; |
3802 | 3802 | $counts = []; |
3803 | 3803 | foreach ($rows as $values) { |
3804 | - $counts[] = round(100 * $values->total / $tot, 0); |
|
3804 | + $counts[] = round(100 * $values->total / $tot, 0); |
|
3805 | 3805 | $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number($values->total) . '|'; |
3806 | 3806 | } |
3807 | 3807 | $chd = $this->arrayToExtendedEncoding($counts); |
@@ -3897,7 +3897,7 @@ discard block |
||
3897 | 3897 | $centuries = ''; |
3898 | 3898 | $counts = []; |
3899 | 3899 | foreach ($rows as $values) { |
3900 | - $counts[] = round(100 * $values->total / $tot, 0); |
|
3900 | + $counts[] = round(100 * $values->total / $tot, 0); |
|
3901 | 3901 | $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number($values->total) . '|'; |
3902 | 3902 | } |
3903 | 3903 | $chd = $this->arrayToExtendedEncoding($counts); |
@@ -4166,7 +4166,7 @@ discard block |
||
4166 | 4166 | if ($sizes[0] < 1000) { |
4167 | 4167 | $sizes[0] += 50; |
4168 | 4168 | } |
4169 | - $chxl .= $this->centuryName($century) . '|'; |
|
4169 | + $chxl .= $this->centuryName($century) . '|'; |
|
4170 | 4170 | $average = 0; |
4171 | 4171 | if (isset($values['F'])) { |
4172 | 4172 | if ($max <= 50) { |
@@ -4223,7 +4223,7 @@ discard block |
||
4223 | 4223 | while ($offset = strpos(I18N::translate('Average age in century of marriage'), ' ', $offset + 1)) { |
4224 | 4224 | $counter[] = $offset; |
4225 | 4225 | } |
4226 | - $half = (int)(\count($counter) / 2); |
|
4226 | + $half = (int) (\count($counter) / 2); |
|
4227 | 4227 | $chtt = substr_replace(I18N::translate('Average age in century of marriage'), '|', $counter[$half], 1); |
4228 | 4228 | } |
4229 | 4229 | |
@@ -4759,7 +4759,7 @@ discard block |
||
4759 | 4759 | private function topTenFamilyQuery($type = 'list', $params = []) |
4760 | 4760 | { |
4761 | 4761 | if (isset($params[0])) { |
4762 | - $total = (int)$params[0]; |
|
4762 | + $total = (int) $params[0]; |
|
4763 | 4763 | } else { |
4764 | 4764 | $total = 10; |
4765 | 4765 | } |
@@ -4826,7 +4826,7 @@ discard block |
||
4826 | 4826 | private function ageBetweenSiblingsQuery($type = 'list', $params = []) |
4827 | 4827 | { |
4828 | 4828 | if (isset($params[0])) { |
4829 | - $total = (int)$params[0]; |
|
4829 | + $total = (int) $params[0]; |
|
4830 | 4830 | } else { |
4831 | 4831 | $total = 10; |
4832 | 4832 | } |
@@ -4882,10 +4882,10 @@ discard block |
||
4882 | 4882 | return $return; |
4883 | 4883 | } |
4884 | 4884 | $age = $fam->age; |
4885 | - if ((int)($age / 365.25) > 0) { |
|
4886 | - $age = (int)($age / 365.25) . 'y'; |
|
4887 | - } elseif ((int)($age / 30.4375) > 0) { |
|
4888 | - $age = (int)($age / 30.4375) . 'm'; |
|
4885 | + if ((int) ($age / 365.25) > 0) { |
|
4886 | + $age = (int) ($age / 365.25) . 'y'; |
|
4887 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
4888 | + $age = (int) ($age / 30.4375) . 'm'; |
|
4889 | 4889 | } else { |
4890 | 4890 | $age = $age . 'd'; |
4891 | 4891 | } |
@@ -4896,7 +4896,7 @@ discard block |
||
4896 | 4896 | if ($type == 'list') { |
4897 | 4897 | if ($one && !\in_array($fam->family, $dist)) { |
4898 | 4898 | if ($child1->canShow() && $child2->canShow()) { |
4899 | - $return = '<li>'; |
|
4899 | + $return = '<li>'; |
|
4900 | 4900 | $return .= '<a href="' . e($child2->url()) . '">' . $child2->getFullName() . '</a> '; |
4901 | 4901 | $return .= I18N::translate('and') . ' '; |
4902 | 4902 | $return .= '<a href="' . e($child1->url()) . '">' . $child1->getFullName() . '</a>'; |
@@ -4907,7 +4907,7 @@ discard block |
||
4907 | 4907 | $dist[] = $fam->family; |
4908 | 4908 | } |
4909 | 4909 | } elseif (!$one && $child1->canShow() && $child2->canShow()) { |
4910 | - $return = '<li>'; |
|
4910 | + $return = '<li>'; |
|
4911 | 4911 | $return .= '<a href="' . e($child2->url()) . '">' . $child2->getFullName() . '</a> '; |
4912 | 4912 | $return .= I18N::translate('and') . ' '; |
4913 | 4913 | $return .= '<a href="' . e($child1->url()) . '">' . $child1->getFullName() . '</a>'; |
@@ -5182,7 +5182,7 @@ discard block |
||
5182 | 5182 | $total = 10; |
5183 | 5183 | } |
5184 | 5184 | $sizes = explode('x', $size); |
5185 | - $total = (int)$total; |
|
5185 | + $total = (int) $total; |
|
5186 | 5186 | $rows = $this->runSql( |
5187 | 5187 | " SELECT f_numchil AS tot, f_id AS id" . |
5188 | 5188 | " FROM `##families`" . |
@@ -5195,7 +5195,7 @@ discard block |
||
5195 | 5195 | } |
5196 | 5196 | $tot = 0; |
5197 | 5197 | foreach ($rows as $row) { |
5198 | - $tot += (int)$row->tot; |
|
5198 | + $tot += (int) $row->tot; |
|
5199 | 5199 | } |
5200 | 5200 | $chd = ''; |
5201 | 5201 | $chl = []; |
@@ -5207,7 +5207,7 @@ discard block |
||
5207 | 5207 | } else { |
5208 | 5208 | $per = round(100 * $row->tot / $tot, 0); |
5209 | 5209 | } |
5210 | - $chd .= $this->arrayToExtendedEncoding([$per]); |
|
5210 | + $chd .= $this->arrayToExtendedEncoding([$per]); |
|
5211 | 5211 | $chl[] = htmlspecialchars_decode(strip_tags($family->getFullName())) . ' - ' . I18N::number($row->tot); |
5212 | 5212 | } |
5213 | 5213 | } |
@@ -5553,7 +5553,7 @@ discard block |
||
5553 | 5553 | if ($max < $values->count) { |
5554 | 5554 | $max = $values->count; |
5555 | 5555 | } |
5556 | - $tot += (int)$values->count; |
|
5556 | + $tot += (int) $values->count; |
|
5557 | 5557 | } |
5558 | 5558 | $unknown = $this->noChildrenFamiliesQuery() - $tot; |
5559 | 5559 | if ($unknown > $max) { |
@@ -5577,13 +5577,13 @@ discard block |
||
5577 | 5577 | $chm .= 't' . $unknown . ',000000,0,' . $i . ',11,1'; |
5578 | 5578 | $chxl .= I18N::translateContext('unknown century', 'Unknown') . '|1:||' . I18N::translate('century') . '|2:|0|'; |
5579 | 5579 | $step = $max + 1; |
5580 | - for ($d = (int)($max + 1); $d > 0; $d--) { |
|
5580 | + for ($d = (int) ($max + 1); $d > 0; $d--) { |
|
5581 | 5581 | if (($max + 1) < ($d * 10 + 1) && fmod(($max + 1), $d) == 0) { |
5582 | 5582 | $step = $d; |
5583 | 5583 | } |
5584 | 5584 | } |
5585 | - if ($step == (int)($max + 1)) { |
|
5586 | - for ($d = (int)($max); $d > 0; $d--) { |
|
5585 | + if ($step == (int) ($max + 1)) { |
|
5586 | + for ($d = (int) ($max); $d > 0; $d--) { |
|
5587 | 5587 | if ($max < ($d * 10 + 1) && fmod($max, $d) == 0) { |
5588 | 5588 | $step = $d; |
5589 | 5589 | } |
@@ -5608,7 +5608,7 @@ discard block |
||
5608 | 5608 | private function topTenGrandFamilyQuery($type = 'list', $params = []) |
5609 | 5609 | { |
5610 | 5610 | if (isset($params[0])) { |
5611 | - $total = (int)$params[0]; |
|
5611 | + $total = (int) $params[0]; |
|
5612 | 5612 | } else { |
5613 | 5613 | $total = 10; |
5614 | 5614 | } |
@@ -5706,8 +5706,8 @@ discard block |
||
5706 | 5706 | */ |
5707 | 5707 | private function commonSurnamesQuery($type = 'list', $show_tot = false, $params = []) |
5708 | 5708 | { |
5709 | - $threshold = empty($params[0]) ? 10 : (int)$params[0]; |
|
5710 | - $number_of_surnames = empty($params[1]) ? 10 : (int)$params[1]; |
|
5709 | + $threshold = empty($params[0]) ? 10 : (int) $params[0]; |
|
5710 | + $number_of_surnames = empty($params[1]) ? 10 : (int) $params[1]; |
|
5711 | 5711 | $sorting = empty($params[2]) ? 'alpha' : $params[2]; |
5712 | 5712 | |
5713 | 5713 | $surnames = $this->topSurnames($number_of_surnames, $threshold); |
@@ -5883,7 +5883,7 @@ discard block |
||
5883 | 5883 | $max_name = 0; |
5884 | 5884 | $top_name = ''; |
5885 | 5885 | foreach ($surns as $spfxsurn => $count) { |
5886 | - $per = $count; |
|
5886 | + $per = $count; |
|
5887 | 5887 | $count_per += $per; |
5888 | 5888 | // select most common surname from all variants |
5889 | 5889 | if ($per > $max_name) { |
@@ -5907,11 +5907,11 @@ discard block |
||
5907 | 5907 | ], $top_name); |
5908 | 5908 | } |
5909 | 5909 | $per = round(100 * $count_per / $tot_indi, 0); |
5910 | - $chd .= $this->arrayToExtendedEncoding([$per]); |
|
5910 | + $chd .= $this->arrayToExtendedEncoding([$per]); |
|
5911 | 5911 | $chl[] = $top_name . ' - ' . I18N::number($count_per); |
5912 | 5912 | } |
5913 | 5913 | $per = round(100 * ($tot_indi - $tot) / $tot_indi, 0); |
5914 | - $chd .= $this->arrayToExtendedEncoding([$per]); |
|
5914 | + $chd .= $this->arrayToExtendedEncoding([$per]); |
|
5915 | 5915 | $chl[] = I18N::translate('Other') . ' - ' . I18N::number($tot_indi - $tot); |
5916 | 5916 | |
5917 | 5917 | $chart_title = implode(I18N::$list_separator, $chl); |
@@ -5933,12 +5933,12 @@ discard block |
||
5933 | 5933 | private function commonGivenQuery($sex = 'B', $type = 'list', $show_tot = false, $params = []) |
5934 | 5934 | { |
5935 | 5935 | if (isset($params[0]) && $params[0] != '' && $params[0] >= 0) { |
5936 | - $threshold = (int)$params[0]; |
|
5936 | + $threshold = (int) $params[0]; |
|
5937 | 5937 | } else { |
5938 | 5938 | $threshold = 1; |
5939 | 5939 | } |
5940 | 5940 | if (isset($params[1]) && $params[1] != '' && $params[1] >= 0) { |
5941 | - $maxtoshow = (int)$params[1]; |
|
5941 | + $maxtoshow = (int) $params[1]; |
|
5942 | 5942 | } else { |
5943 | 5943 | $maxtoshow = 10; |
5944 | 5944 | } |
@@ -6331,11 +6331,11 @@ discard block |
||
6331 | 6331 | } else { |
6332 | 6332 | $per = round(100 * $count / $tot_indi, 0); |
6333 | 6333 | } |
6334 | - $chd .= $this->arrayToExtendedEncoding([$per]); |
|
6334 | + $chd .= $this->arrayToExtendedEncoding([$per]); |
|
6335 | 6335 | $chl[] = $givn . ' - ' . I18N::number($count); |
6336 | 6336 | } |
6337 | 6337 | $per = round(100 * ($tot_indi - $tot) / $tot_indi, 0); |
6338 | - $chd .= $this->arrayToExtendedEncoding([$per]); |
|
6338 | + $chd .= $this->arrayToExtendedEncoding([$per]); |
|
6339 | 6339 | $chl[] = I18N::translate('Other') . ' - ' . I18N::number($tot_indi - $tot); |
6340 | 6340 | |
6341 | 6341 | $chart_title = implode(I18N::$list_separator, $chl); |
@@ -6562,7 +6562,7 @@ discard block |
||
6562 | 6562 | $datestamp = I18N::dateFormat(); |
6563 | 6563 | } |
6564 | 6564 | |
6565 | - return FunctionsDate::timestampToGedcomDate((int)$user->getPreference('reg_timestamp'))->display(false, $datestamp); |
|
6565 | + return FunctionsDate::timestampToGedcomDate((int) $user->getPreference('reg_timestamp'))->display(false, $datestamp); |
|
6566 | 6566 | case 'regtime': |
6567 | 6567 | if (\is_array($params) && isset($params[0]) && $params[0] != '') { |
6568 | 6568 | $datestamp = $params[0]; |
@@ -6570,7 +6570,7 @@ discard block |
||
6570 | 6570 | $datestamp = str_replace('%', '', I18N::timeFormat()); |
6571 | 6571 | } |
6572 | 6572 | |
6573 | - return date($datestamp, (int)$user->getPreference('reg_timestamp')); |
|
6573 | + return date($datestamp, (int) $user->getPreference('reg_timestamp')); |
|
6574 | 6574 | case 'loggedin': |
6575 | 6575 | if (\is_array($params) && isset($params[0]) && $params[0] != '') { |
6576 | 6576 | $yes = $params[0]; |
@@ -6910,9 +6910,9 @@ discard block |
||
6910 | 6910 | if ($value < 0) { |
6911 | 6911 | $value = 0; |
6912 | 6912 | } |
6913 | - $first = (int)($value / 64); |
|
6913 | + $first = (int) ($value / 64); |
|
6914 | 6914 | $second = $value % 64; |
6915 | - $encoding .= $xencoding[(int)$first] . $xencoding[(int)$second]; |
|
6915 | + $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
6916 | 6916 | } |
6917 | 6917 | |
6918 | 6918 | return $encoding; |
@@ -7056,7 +7056,7 @@ discard block |
||
7056 | 7056 | */ |
7057 | 7057 | public function totalUserMessages() |
7058 | 7058 | { |
7059 | - $total = (int)Database::prepare("SELECT COUNT(*) FROM `##message` WHERE user_id = ?") |
|
7059 | + $total = (int) Database::prepare("SELECT COUNT(*) FROM `##message` WHERE user_id = ?") |
|
7060 | 7060 | ->execute([Auth::id()]) |
7061 | 7061 | ->fetchOne(); |
7062 | 7062 | |
@@ -7071,7 +7071,7 @@ discard block |
||
7071 | 7071 | public function totalUserJournal() |
7072 | 7072 | { |
7073 | 7073 | try { |
7074 | - $number = (int)Database::prepare("SELECT COUNT(*) FROM `##news` WHERE user_id = ?") |
|
7074 | + $number = (int) Database::prepare("SELECT COUNT(*) FROM `##news` WHERE user_id = ?") |
|
7075 | 7075 | ->execute([Auth::id()]) |
7076 | 7076 | ->fetchOne(); |
7077 | 7077 | } catch (PDOException $ex) { |
@@ -7092,7 +7092,7 @@ discard block |
||
7092 | 7092 | public function totalGedcomNews() |
7093 | 7093 | { |
7094 | 7094 | try { |
7095 | - $number = (int)Database::prepare("SELECT COUNT(*) FROM `##news` WHERE gedcom_id = ?") |
|
7095 | + $number = (int) Database::prepare("SELECT COUNT(*) FROM `##news` WHERE gedcom_id = ?") |
|
7096 | 7096 | ->execute([$this->tree->getTreeId()]) |
7097 | 7097 | ->fetchOne(); |
7098 | 7098 | } catch (PDOException $ex) { |