diff options
Diffstat (limited to 'library/WT')
| -rw-r--r-- | library/WT/Auth.php | 2 | ||||
| -rw-r--r-- | library/WT/Controller/AdvancedSearch.php | 268 | ||||
| -rw-r--r-- | library/WT/Controller/Ajax.php | 2 | ||||
| -rw-r--r-- | library/WT/Controller/Ancestry.php | 66 | ||||
| -rw-r--r-- | library/WT/Controller/Base.php | 4 | ||||
| -rw-r--r-- | library/WT/Controller/Branches.php | 2 | ||||
| -rw-r--r-- | library/WT/Controller/Chart.php | 4 | ||||
| -rw-r--r-- | library/WT/Controller/Compact.php | 38 | ||||
| -rw-r--r-- | library/WT/Controller/Descendancy.php | 70 | ||||
| -rw-r--r-- | library/WT/Controller/Family.php | 26 | ||||
| -rw-r--r-- | library/WT/Controller/Familybook.php | 4 | ||||
| -rw-r--r-- | library/WT/Controller/Fanchart.php | 50 | ||||
| -rw-r--r-- | library/WT/Controller/GedcomRecord.php | 2 | ||||
| -rw-r--r-- | library/WT/Controller/Hourglass.php | 6 | ||||
| -rw-r--r-- | library/WT/Controller/Individual.php | 66 | ||||
| -rw-r--r-- | library/WT/Controller/Lifespan.php | 8 | ||||
| -rw-r--r-- | library/WT/Controller/Note.php | 6 | ||||
| -rw-r--r-- | library/WT/Controller/Page.php | 10 | ||||
| -rw-r--r-- | library/WT/Controller/Pedigree.php | 152 |
19 files changed, 393 insertions, 393 deletions
diff --git a/library/WT/Auth.php b/library/WT/Auth.php index 1371e1506d..5ed052d6bc 100644 --- a/library/WT/Auth.php +++ b/library/WT/Auth.php @@ -124,7 +124,7 @@ class Auth { * * @return boolean */ - public static function isMember(WT_Tree $tree = null, User $user=null) { + public static function isMember(WT_Tree $tree = null, User $user = null) { global $WT_TREE; if ($tree === null) { diff --git a/library/WT/Controller/AdvancedSearch.php b/library/WT/Controller/AdvancedSearch.php index 1f8bf7f012..90f8b9ef92 100644 --- a/library/WT/Controller/AdvancedSearch.php +++ b/library/WT/Controller/AdvancedSearch.php @@ -37,9 +37,9 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { $this->setPageTitle(WT_I18N::translate('Advanced search')); if (empty($_REQUEST['action'])) { - $this->action="advanced"; + $this->action = "advanced"; } - if ($this->action=="advanced") { + if ($this->action == "advanced") { if (isset($_REQUEST['fields'])) { $this->fields = $_REQUEST['fields']; ksort($this->fields); @@ -54,7 +54,7 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { $this->advancedSearch(); } if (!$this->fields) { - $this->fields=array( + $this->fields = array( 'NAME:GIVN:SDX', 'NAME:SURN:SDX', 'BIRT:DATE', @@ -151,9 +151,9 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { * @return int */ public static function tagSort($x, $y) { - list($x1)=explode(':', $x.':'); - list($y1)=explode(':', $y.':'); - $tmp=WT_I18N::strcasecmp(WT_Gedcom_Tag::getLabel($x1), WT_Gedcom_Tag::getLabel($y1)); + list($x1) = explode(':', $x . ':'); + list($y1) = explode(':', $y . ':'); + $tmp = WT_I18N::strcasecmp(WT_Gedcom_Tag::getLabel($x1), WT_Gedcom_Tag::getLabel($y1)); if ($tmp) { return $tmp; } else { @@ -216,7 +216,7 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { $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) { + 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; } @@ -244,46 +244,46 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { * @return void */ function advancedSearch() { - $this->myindilist = array (); + $this->myindilist = array(); $fct = count($this->fields); - if ($fct==0) { + if ($fct == 0) { return; } // Dynamic SQL query, plus bind variables - $sql="SELECT DISTINCT ind.i_id AS xref, ind.i_file AS gedcom_id, ind.i_gedcom AS gedcom FROM `##individuals` ind"; - $bind=array(); + $sql = "SELECT DISTINCT ind.i_id AS xref, ind.i_file AS gedcom_id, ind.i_gedcom AS gedcom FROM `##individuals` ind"; + $bind = array(); // Join the following tables - $father_name =false; - $mother_name =false; - $spouse_family =false; - $indi_name =false; - $indi_date =false; - $fam_date =false; - $indi_plac =false; - $fam_plac =false; + $father_name = false; + $mother_name = false; + $spouse_family = false; + $indi_name = false; + $indi_date = false; + $fam_date = false; + $indi_plac = false; + $fam_plac = false; foreach ($this->fields as $n=>$field) { if ($this->values[$n]) { - if (substr($field, 0, 14)=='FAMC:HUSB:NAME') { - $father_name=true; - } elseif (substr($field, 0, 14)=='FAMC:WIFE:NAME') { - $mother_name=true; - } elseif (substr($field, 0, 4)=='NAME') { - $indi_name=true; - } elseif (strpos($field, ':DATE')!==false) { - if (substr($field, 0, 4)=='FAMS') { - $fam_date=true; - $spouse_family=true; + if (substr($field, 0, 14) == 'FAMC:HUSB:NAME') { + $father_name = true; + } elseif (substr($field, 0, 14) == 'FAMC:WIFE:NAME') { + $mother_name = true; + } elseif (substr($field, 0, 4) == 'NAME') { + $indi_name = true; + } elseif (strpos($field, ':DATE') !== false) { + if (substr($field, 0, 4) == 'FAMS') { + $fam_date = true; + $spouse_family = true; } else { - $indi_date=true; + $indi_date = true; } - } elseif (strpos($field, ':PLAC')!==false) { - if (substr($field, 0, 4)=='FAMS') { - $fam_plac=true; - $spouse_family=true; + } elseif (strpos($field, ':PLAC') !== false) { + if (substr($field, 0, 4) == 'FAMS') { + $fam_plac = true; + $spouse_family = true; } else { - $indi_plac=true; + $indi_plac = true; } } elseif ($field == 'FAMS:NOTE') { $spouse_family = true; @@ -292,85 +292,85 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { } if ($father_name || $mother_name) { - $sql.=" JOIN `##link` l_1 ON (l_1.l_file=ind.i_file AND l_1.l_from=ind.i_id AND l_1.l_type='FAMC')"; + $sql .= " JOIN `##link` l_1 ON (l_1.l_file=ind.i_file AND l_1.l_from=ind.i_id AND l_1.l_type='FAMC')"; } if ($father_name) { - $sql.=" JOIN `##link` l_2 ON (l_2.l_file=ind.i_file AND l_2.l_from=l_1.l_to AND l_2.l_type='HUSB')"; - $sql.=" JOIN `##name` f_n ON (f_n.n_file=ind.i_file AND f_n.n_id =l_2.l_to)"; + $sql .= " JOIN `##link` l_2 ON (l_2.l_file=ind.i_file AND l_2.l_from=l_1.l_to AND l_2.l_type='HUSB')"; + $sql .= " JOIN `##name` f_n ON (f_n.n_file=ind.i_file AND f_n.n_id =l_2.l_to)"; } if ($mother_name) { - $sql.=" JOIN `##link` l_3 ON (l_3.l_file=ind.i_file AND l_3.l_from=l_1.l_to AND l_3.l_type='WIFE')"; - $sql.=" JOIN `##name` m_n ON (m_n.n_file=ind.i_file AND m_n.n_id =l_3.l_to)"; + $sql .= " JOIN `##link` l_3 ON (l_3.l_file=ind.i_file AND l_3.l_from=l_1.l_to AND l_3.l_type='WIFE')"; + $sql .= " JOIN `##name` m_n ON (m_n.n_file=ind.i_file AND m_n.n_id =l_3.l_to)"; } if ($spouse_family) { - $sql.=" JOIN `##link` l_4 ON (l_4.l_file=ind.i_file AND l_4.l_from=ind.i_id AND l_4.l_type='FAMS')"; - $sql.=" JOIN `##families` fam ON (fam.f_file=ind.i_file AND fam.f_id =l_4.l_to)"; + $sql .= " JOIN `##link` l_4 ON (l_4.l_file=ind.i_file AND l_4.l_from=ind.i_id AND l_4.l_type='FAMS')"; + $sql .= " JOIN `##families` fam ON (fam.f_file=ind.i_file AND fam.f_id =l_4.l_to)"; } if ($indi_name) { - $sql.=" JOIN `##name` i_n ON (i_n.n_file=ind.i_file AND i_n.n_id=ind.i_id)"; + $sql .= " JOIN `##name` i_n ON (i_n.n_file=ind.i_file AND i_n.n_id=ind.i_id)"; } if ($indi_date) { - $sql.=" JOIN `##dates` i_d ON (i_d.d_file=ind.i_file AND i_d.d_gid=ind.i_id)"; + $sql .= " JOIN `##dates` i_d ON (i_d.d_file=ind.i_file AND i_d.d_gid=ind.i_id)"; } if ($fam_date) { - $sql.=" JOIN `##dates` f_d ON (f_d.d_file=ind.i_file AND f_d.d_gid=fam.f_id)"; + $sql .= " JOIN `##dates` f_d ON (f_d.d_file=ind.i_file AND f_d.d_gid=fam.f_id)"; } if ($indi_plac) { - $sql.=" JOIN `##placelinks` i_pl ON (i_pl.pl_file=ind.i_file AND i_pl.pl_gid =ind.i_id)"; - $sql.=" JOIN (". - "SELECT 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) AS place, p1.p_id AS id, p1.p_file AS file". - " FROM `##places` AS p1". - " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)". - " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)". - " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)". - " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)". - " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)". - " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)". - " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)". - " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)". + $sql .= " JOIN `##placelinks` i_pl ON (i_pl.pl_file=ind.i_file AND i_pl.pl_gid =ind.i_id)"; + $sql .= " JOIN (" . + "SELECT 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) AS place, p1.p_id AS id, p1.p_file AS file" . + " FROM `##places` AS p1" . + " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)" . + " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)" . + " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)" . + " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)" . + " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)" . + " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)" . + " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)" . + " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)" . ") AS i_p ON (i_p.file =ind.i_file AND i_pl.pl_p_id= i_p.id)"; } if ($fam_plac) { - $sql.=" JOIN `##placelinks` f_pl ON (f_pl.pl_file=ind.i_file AND f_pl.pl_gid =fam.f_id)"; - $sql.=" JOIN (". - "SELECT 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) AS place, p1.p_id AS id, p1.p_file AS file". - " FROM `##places` AS p1". - " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)". - " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)". - " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)". - " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)". - " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)". - " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)". - " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)". - " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)". + $sql .= " JOIN `##placelinks` f_pl ON (f_pl.pl_file=ind.i_file AND f_pl.pl_gid =fam.f_id)"; + $sql .= " JOIN (" . + "SELECT 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) AS place, p1.p_id AS id, p1.p_file AS file" . + " FROM `##places` AS p1" . + " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)" . + " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)" . + " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)" . + " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)" . + " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)" . + " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)" . + " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)" . + " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)" . ") AS f_p ON (f_p.file =ind.i_file AND f_pl.pl_p_id= f_p.id)"; } // Add the where clause - $sql.=" WHERE ind.i_file=?"; - $bind[]=WT_GED_ID; - for ($i=0; $i<$fct; $i++) { + $sql .= " WHERE ind.i_file=?"; + $bind[] = WT_GED_ID; + for ($i = 0; $i < $fct; $i++) { $field = $this->fields[$i]; $value = $this->values[$i]; if ($value === '') { continue; } - $parts = preg_split("/:/", $field.'::::'); - if ($parts[0]=='NAME') { + $parts = preg_split("/:/", $field . '::::'); + if ($parts[0] == 'NAME') { // NAME:* switch ($parts[1]) { case 'GIVN': switch ($parts[2]) { case 'EXACT': - $sql.=" AND i_n.n_givn=?"; - $bind[]=$value; + $sql .= " AND i_n.n_givn=?"; + $bind[] = $value; break; case 'BEGINS': - $sql.=" AND i_n.n_givn LIKE CONCAT(?, '%')"; - $bind[]=$value; + $sql .= " AND i_n.n_givn LIKE CONCAT(?, '%')"; + $bind[] = $value; break; case 'CONTAINS': - $sql.=" AND i_n.n_givn LIKE CONCAT('%', ?, '%')"; - $bind[]=$value; + $sql .= " AND i_n.n_givn LIKE CONCAT('%', ?, '%')"; + $bind[] = $value; break; case 'SDX_STD': $sdx = WT_Soundex::russell($value); @@ -408,16 +408,16 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { case 'SURN': switch ($parts[2]) { case 'EXACT': - $sql.=" AND i_n.n_surname=?"; - $bind[]=$value; + $sql .= " AND i_n.n_surname=?"; + $bind[] = $value; break; case 'BEGINS': - $sql.=" AND i_n.n_surname LIKE CONCAT(?, '%')"; - $bind[]=$value; + $sql .= " AND i_n.n_surname LIKE CONCAT(?, '%')"; + $bind[] = $value; break; case 'CONTAINS': - $sql.=" AND i_n.n_surname LIKE CONCAT('%', ?, '%')"; - $bind[]=$value; + $sql .= " AND i_n.n_surname LIKE CONCAT('%', ?, '%')"; + $bind[] = $value; break; case 'SDX_STD': $sdx = WT_Soundex::russell($value); @@ -456,12 +456,12 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { case '_MARNM': case '_HEB': case '_AKA': - $sql.=" AND i_n.n_type=? AND i_n.n_full LIKE CONCAT('%', ?, '%')"; - $bind[]=$parts[1]; - $bind[]=$value; + $sql .= " AND i_n.n_type=? AND i_n.n_full LIKE CONCAT('%', ?, '%')"; + $bind[] = $parts[1]; + $bind[] = $value; break; } - } elseif ($parts[1]=='DATE') { + } elseif ($parts[1] == 'DATE') { // *:DATE $date = new WT_Date($value); if ($date->isOK()) { @@ -472,16 +472,16 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { $jd2 = $date->date1->maxJD; } if (!empty($this->plusminus[$i])) { - $adjd = $this->plusminus[$i]*365; + $adjd = $this->plusminus[$i] * 365; $jd1 = $jd1 - $adjd; $jd2 = $jd2 + $adjd; } - $sql.=" AND i_d.d_fact=? AND i_d.d_julianday1>=? AND i_d.d_julianday2<=?"; - $bind[]=$parts[0]; - $bind[]=$jd1; - $bind[]=$jd2; + $sql .= " AND i_d.d_fact=? AND i_d.d_julianday1>=? AND i_d.d_julianday2<=?"; + $bind[] = $parts[0]; + $bind[] = $jd1; + $bind[] = $jd2; } - } elseif ($parts[0]=='FAMS' && $parts[2]=='DATE') { + } elseif ($parts[0] == 'FAMS' && $parts[2] == 'DATE') { // FAMS:*:DATE $date = new WT_Date($value); if ($date->isOK()) { @@ -492,42 +492,42 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { $jd2 = $date->date1->maxJD; } if (!empty($this->plusminus[$i])) { - $adjd = $this->plusminus[$i]*365; + $adjd = $this->plusminus[$i] * 365; $jd1 = $jd1 - $adjd; $jd2 = $jd2 + $adjd; } - $sql.=" AND f_d.d_fact=? AND f_d.d_julianday1>=? AND f_d.d_julianday2<=?"; - $bind[]=$parts[1]; - $bind[]=$jd1; - $bind[]=$jd2; + $sql .= " AND f_d.d_fact=? AND f_d.d_julianday1>=? AND f_d.d_julianday2<=?"; + $bind[] = $parts[1]; + $bind[] = $jd1; + $bind[] = $jd2; } - } elseif ($parts[1]=='PLAC') { + } elseif ($parts[1] == 'PLAC') { // *:PLAC // SQL can only link a place to a person/family, not to an event. - $sql.=" AND i_p.place LIKE CONCAT('%', ?, '%')"; - $bind[]=$value; - } elseif ($parts[0]=='FAMS' && $parts[2]=='PLAC') { + $sql .= " AND i_p.place LIKE CONCAT('%', ?, '%')"; + $bind[] = $value; + } elseif ($parts[0] == 'FAMS' && $parts[2] == 'PLAC') { // FAMS:*:PLAC // SQL can only link a place to a person/family, not to an event. - $sql.=" AND f_p.place LIKE CONCAT('%', ?, '%')"; - $bind[]=$value; - } elseif ($parts[0]=='FAMC' && $parts[2]=='NAME') { - $table=$parts[1]=='HUSB' ? 'f_n' : 'm_n'; + $sql .= " AND f_p.place LIKE CONCAT('%', ?, '%')"; + $bind[] = $value; + } elseif ($parts[0] == 'FAMC' && $parts[2] == 'NAME') { + $table = $parts[1] == 'HUSB' ? 'f_n' : 'm_n'; // NAME:* switch ($parts[3]) { case 'GIVN': switch ($parts[4]) { case 'EXACT': - $sql.=" AND {$table}.n_givn=?"; - $bind[]=$value; + $sql .= " AND {$table}.n_givn=?"; + $bind[] = $value; break; case 'BEGINS': - $sql.=" AND {$table}.n_givn LIKE CONCAT(?, '%')"; - $bind[]=$value; + $sql .= " AND {$table}.n_givn LIKE CONCAT(?, '%')"; + $bind[] = $value; break; case 'CONTAINS': - $sql.=" AND {$table}.n_givn LIKE CONCAT('%', ?, '%')"; - $bind[]=$value; + $sql .= " AND {$table}.n_givn LIKE CONCAT('%', ?, '%')"; + $bind[] = $value; break; case 'SDX_STD': $sdx = WT_Soundex::russell($value); @@ -565,16 +565,16 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { case 'SURN': switch ($parts[4]) { case 'EXACT': - $sql.=" AND {$table}.n_surname=?"; - $bind[]=$value; + $sql .= " AND {$table}.n_surname=?"; + $bind[] = $value; break; case 'BEGINS': - $sql.=" AND {$table}.n_surname LIKE CONCAT(?, '%')"; - $bind[]=$value; + $sql .= " AND {$table}.n_surname LIKE CONCAT(?, '%')"; + $bind[] = $value; break; case 'CONTAINS': - $sql.=" AND {$table}.n_surname LIKE CONCAT('%', ?, '%')"; - $bind[]=$value; + $sql .= " AND {$table}.n_surname LIKE CONCAT('%', ?, '%')"; + $bind[] = $value; break; case 'SDX_STD': $sdx = WT_Soundex::russell($value); @@ -610,30 +610,30 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { } break; } - } elseif ($parts[0]=='FAMS') { + } elseif ($parts[0] == 'FAMS') { // e.g. searches for occupation, religion, note, etc. - $sql.=" AND fam.f_gedcom REGEXP CONCAT('\n[0-9] ', ?, '(.*\n[0-9] CONT)* [^\n]*', ?)"; - $bind[]=$parts[1]; - $bind[]=$value; + $sql .= " AND fam.f_gedcom REGEXP CONCAT('\n[0-9] ', ?, '(.*\n[0-9] CONT)* [^\n]*', ?)"; + $bind[] = $parts[1]; + $bind[] = $value; } else { // e.g. searches for occupation, religion, note, etc. - $sql.=" AND ind.i_gedcom REGEXP CONCAT('\n[0-9] ', ?, '(.*\n[0-9] CONT)* [^\n]*', ?)"; - $bind[]=$parts[0]; - $bind[]=$value; + $sql .= " AND ind.i_gedcom REGEXP CONCAT('\n[0-9] ', ?, '(.*\n[0-9] CONT)* [^\n]*', ?)"; + $bind[] = $parts[0]; + $bind[] = $value; } } - $rows=WT_DB::prepare($sql)->execute($bind)->fetchAll(); + $rows = WT_DB::prepare($sql)->execute($bind)->fetchAll(); foreach ($rows as $row) { - $person=WT_Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom); + $person = WT_Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom); // Check for XXXX:PLAC fields, which were only partially matched by SQL 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())) { + 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; } } } - $this->myindilist[]=$person; + $this->myindilist[] = $person; } } @@ -641,7 +641,7 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { * @return bool */ function printResults() { - require_once WT_ROOT.'includes/functions/functions_print_lists.php'; + require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; if ($this->myindilist) { uasort($this->myindilist, array('WT_GedcomRecord', 'compare')); echo format_indi_table($this->myindilist); diff --git a/library/WT/Controller/Ajax.php b/library/WT/Controller/Ajax.php index 87fe05a8d7..ab2387c001 100644 --- a/library/WT/Controller/Ajax.php +++ b/library/WT/Controller/Ajax.php @@ -29,7 +29,7 @@ class WT_Controller_Ajax extends WT_Controller_Base { Zend_Session::writeClose(); // Ajax responses are always UTF8 header('Content-Type: text/html; charset=UTF-8'); - $this->page_header=true; + $this->page_header = true; return $this; } diff --git a/library/WT/Controller/Ancestry.php b/library/WT/Controller/Ancestry.php index 8b769807e6..736a2a43d6 100644 --- a/library/WT/Controller/Ancestry.php +++ b/library/WT/Controller/Ancestry.php @@ -46,22 +46,22 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { parent::__construct(); // Extract form parameters - $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); - $this->show_cousins = WT_Filter::getInteger('show_cousins', 0, 1); - $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3); - $box_width = WT_Filter::getInteger('box_width', 50, 300, 100); + $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); + $this->show_cousins = WT_Filter::getInteger('show_cousins', 0, 1); + $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3); + $box_width = WT_Filter::getInteger('box_width', 50, 300, 100); $PEDIGREE_GENERATIONS = WT_Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); // This is passed as a global. A parameter would be better... - $show_full=$this->show_full; + $show_full = $this->show_full; $OLD_PGENS = $PEDIGREE_GENERATIONS; // -- size of the detailed boxes based upon optional width parameter - $Dbwidth=($box_width*$bwidth)/100; - $Dbheight=($box_width*$bheight)/100; - $bwidth=$Dbwidth; - $bheight=$Dbheight; + $Dbwidth = ($box_width * $bwidth) / 100; + $Dbheight = ($box_width * $bheight) / 100; + $bwidth = $Dbwidth; + $bheight = $Dbheight; // -- adjust size of the compact box if (!$this->show_full) { @@ -69,8 +69,8 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { $bheight = Theme::theme()->parameter('compact-chart-box-y'); } - $pbwidth = $bwidth+12; - $pbheight = $bheight+14; + $pbwidth = $bwidth + 12; + $pbheight = $bheight + 14; if ($this->root && $this->root->canShowName()) { $this->setPageTitle( @@ -81,10 +81,10 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { $this->setPageTitle(WT_I18N::translate('Ancestors')); } - if (strlen($this->name)<30) { - $this->cellwidth="420"; + if (strlen($this->name) < 30) { + $this->cellwidth = "420"; } else { - $this->cellwidth=(strlen($this->name)*14); + $this->cellwidth = (strlen($this->name) * 14); } } @@ -99,16 +99,16 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { global $OLD_PGENS, $pidarr, $box_width; if ($person) { - $pid=$person->getXref(); - $label=WT_I18N::translate('Ancestors of %s', $person->getFullName()); + $pid = $person->getXref(); + $label = WT_I18N::translate('Ancestors of %s', $person->getFullName()); } else { - $pid=''; - $label=''; + $pid = ''; + $label = ''; } // child echo '<li>'; echo '<table><tr><td>'; - if ($sosa==1) { + if ($sosa == 1) { echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent'), '"></td><td>'; } else { echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="2" alt="">'; @@ -117,20 +117,20 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { print_pedigree_person($person); echo '</td>'; echo '<td>'; - if ($sosa>1) { - print_url_arrow('?rootid='.$pid.'&PEDIGREE_GENERATIONS='.$OLD_PGENS.'&show_full='.$this->show_full.'&box_width='.$box_width.'&chart_style='.$this->chart_style.'&ged='.WT_GEDURL, $label, 3); + if ($sosa > 1) { + print_url_arrow('?rootid=' . $pid . '&PEDIGREE_GENERATIONS=' . $OLD_PGENS . '&show_full=' . $this->show_full . '&box_width=' . $box_width . '&chart_style=' . $this->chart_style . '&ged=' . WT_GEDURL, $label, 3); } echo '</td>'; - echo '<td class="details1"> <span dir="ltr" class="person_box'. (($sosa==1)?'NN':(($sosa%2)?'F':'')) . '"> ', $sosa, ' </span> '; + echo '<td class="details1"> <span dir="ltr" class="person_box' . (($sosa == 1) ? 'NN' : (($sosa % 2) ? 'F' : '')) . '"> ', $sosa, ' </span> '; echo '</td><td class="details1">'; - $relation =''; - $new=($pid=='' || !isset($pidarr[$pid])); + $relation = ''; + $new = ($pid == '' || !isset($pidarr[$pid])); if (!$new) { - $relation = '<br>[=<a href="#sosa'.$pidarr[$pid].'">'.$pidarr[$pid].'</a> - '.get_sosa_name($pidarr[$pid]).']'; + $relation = '<br>[=<a href="#sosa' . $pidarr[$pid] . '">' . $pidarr[$pid] . '</a> - ' . get_sosa_name($pidarr[$pid]) . ']'; } else { - $pidarr[$pid]=$sosa; + $pidarr[$pid] = $sosa; } - echo get_sosa_name($sosa).$relation; + echo get_sosa_name($sosa) . $relation; echo '</td>'; echo '</tr></table>'; @@ -139,14 +139,14 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { return; } // parents - $family=$person->getPrimaryChildFamily(); + $family = $person->getPrimaryChildFamily(); - if ($family && $new && $depth>0) { + if ($family && $new && $depth > 0) { // print marriage info echo '<span class="details1">'; echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent'), '" alt=""><a href="#" onclick="return expand_layer(\'sosa_', $sosa, '\');" class="top"><i id="sosa_', $sosa, '_img" class="icon-minus" title="', WT_I18N::translate('View family'), '"></i></a>'; - echo ' <span dir="ltr" class="person_box"> ', ($sosa*2), ' </span> ', WT_I18N::translate('and'); - echo ' <span dir="ltr" class="person_boxF"> ', ($sosa*2+1), ' </span> '; + echo ' <span dir="ltr" class="person_box"> ', ($sosa * 2), ' </span> ', WT_I18N::translate('and'); + echo ' <span dir="ltr" class="person_boxF"> ', ($sosa * 2 + 1), ' </span> '; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>'; @@ -155,8 +155,8 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { echo '</span>'; // display parents recursively - or show empty boxes echo '<ul id="sosa_', $sosa, '" class="generation">'; - $this->printChildAscendancy($family->getHusband(), $sosa*2, $depth-1); - $this->printChildAscendancy($family->getWife(), $sosa*2+1, $depth-1); + $this->printChildAscendancy($family->getHusband(), $sosa * 2, $depth - 1); + $this->printChildAscendancy($family->getWife(), $sosa * 2 + 1, $depth - 1); echo '</ul>'; } echo '</li>'; diff --git a/library/WT/Controller/Base.php b/library/WT/Controller/Base.php index 963ae40a46..2572bfb893 100644 --- a/library/WT/Controller/Base.php +++ b/library/WT/Controller/Base.php @@ -31,7 +31,7 @@ class WT_Controller_Base { ); private $external_javascript = array(); - protected $page_header = false; // Have we printed a page header? + protected $page_header = false; // Have we printed a page header? /** * Startup activity @@ -78,7 +78,7 @@ class WT_Controller_Base { $backtrace = debug_backtrace(); $script = '/* ' . $backtrace[0]['file'] . ':' . $backtrace[0]['line'] . ' */' . PHP_EOL . $script; } - $tmp =& $this->inline_javascript[$priority]; + $tmp = & $this->inline_javascript[$priority]; $tmp[] = $script; return $this; diff --git a/library/WT/Controller/Branches.php b/library/WT/Controller/Branches.php index bb42210352..14eae86996 100644 --- a/library/WT/Controller/Branches.php +++ b/library/WT/Controller/Branches.php @@ -272,7 +272,7 @@ class WT_Controller_Branches extends WT_Controller_Page { * @return string */ private static function sosaGeneration($sosa) { - $generation = (int)log($sosa, 2) + 1; + $generation = (int) log($sosa, 2) + 1; return '<sup title="' . WT_I18N::translate('Generation') . '">' . $generation . '</sup>'; } diff --git a/library/WT/Controller/Chart.php b/library/WT/Controller/Chart.php index 3301328572..1205aa37d8 100644 --- a/library/WT/Controller/Chart.php +++ b/library/WT/Controller/Chart.php @@ -36,11 +36,11 @@ class WT_Controller_Chart extends WT_Controller_Page { $this->root = WT_Individual::getInstance($rootid); if (!$this->root) { // Missing root individual? Show the chart for someone. - $this->root = $this->getSignificantIndividual(); + $this->root = $this->getSignificantIndividual(); } if (!$this->root || !$this->root->canShowName()) { - header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden'); + header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $this->error_message = WT_I18N::translate('This individual does not exist or you do not have permission to view it.'); } } diff --git a/library/WT/Controller/Compact.php b/library/WT/Controller/Compact.php index 8d4ac4d17f..5b58818c3e 100644 --- a/library/WT/Controller/Compact.php +++ b/library/WT/Controller/Compact.php @@ -24,10 +24,10 @@ */ class WT_Controller_Compact extends WT_Controller_Chart { // Data for the view - public $show_thumbs=false; + public $show_thumbs = false; // Date for the controller - private $treeid=array(); + private $treeid = array(); /** * Startup activity @@ -60,16 +60,16 @@ class WT_Controller_Compact extends WT_Controller_Chart { $indi = $this->treeid[$n]; if ($indi && $indi->canShowName()) { - $name=$indi->getFullName(); - $addname=$indi->getAddName(); + $name = $indi->getFullName(); + $addname = $indi->getAddName(); if ($this->show_thumbs && $SHOW_HIGHLIGHT_IMAGES) { - $html=$indi->displayImage(); + $html = $indi->displayImage(); } else { - $html=''; + $html = ''; } - $html .= '<a class="name1" href="'.$indi->getHtmlUrl().'">'; + $html .= '<a class="name1" href="' . $indi->getHtmlUrl() . '">'; $html .= $name; if ($addname) { $html .= '<br>' . $addname; @@ -77,7 +77,7 @@ class WT_Controller_Compact extends WT_Controller_Chart { $html .= '</a>'; $html .= '<br>'; if ($indi->canShow()) { - $html.='<div class="details1">'.$indi->getLifeSpan().'</div>'; + $html .= '<div class="details1">' . $indi->getLifeSpan() . '</div>'; } } else { // Empty box @@ -85,20 +85,20 @@ class WT_Controller_Compact extends WT_Controller_Chart { } // -- box color - $isF=''; - if ($n==1) { - if ($indi && $indi->getSex()=='F') { - $isF='F'; + $isF = ''; + if ($n == 1) { + if ($indi && $indi->getSex() == 'F') { + $isF = 'F'; } - } elseif ($n%2) { - $isF='F'; + } elseif ($n % 2) { + $isF = 'F'; } // -- box size - if ($n==1) { - return '<td class="person_box'.$isF.' person_box_template" style="text-align:center; vertical-align:top;">'.$html.'</td>'; + if ($n == 1) { + return '<td class="person_box' . $isF . ' person_box_template" style="text-align:center; vertical-align:top;">' . $html . '</td>'; } else { - return '<td class="person_box'.$isF.' person_box_template" style="text-align:center; vertical-align:top;" width="15%">'.$html.'</td>'; + return '<td class="person_box' . $isF . ' person_box_template" style="text-align:center; vertical-align:top;" width="15%">' . $html . '</td>'; } } @@ -115,7 +115,7 @@ class WT_Controller_Compact extends WT_Controller_Chart { $arrow_dir = substr($arrow_dir, 0, 1); if ($TEXT_DIRECTION == 'rtl') { - if ($arrow_dir=='l') { + if ($arrow_dir == 'l') { $arrow_dir = 'r'; } elseif ($arrow_dir == 'r') { $arrow_dir = 'l'; @@ -126,7 +126,7 @@ class WT_Controller_Compact extends WT_Controller_Chart { $title = WT_I18N::translate('Compact tree of %s', $indi->getFullName()); $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; + $text .= "&show_thumbs=" . $this->show_thumbs; } $text .= "\"></a>"; } else { diff --git a/library/WT/Controller/Descendancy.php b/library/WT/Controller/Descendancy.php index e34bf15023..fc635329d0 100644 --- a/library/WT/Controller/Descendancy.php +++ b/library/WT/Controller/Descendancy.php @@ -43,8 +43,8 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { var $pbwidth; var $pbheight; // d'Aboville numbering system [ http://www.saintclair.org/numbers/numdob.html ] - var $dabo_num=array(); - var $dabo_sex=array(); + var $dabo_num = array(); + var $dabo_sex = array(); var $name; var $cellwidth; var $show_cousins; @@ -58,21 +58,21 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { parent::__construct(); // Extract parameters from form - $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); + $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3, 0); $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); - $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); + $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... - $show_full=$this->show_full; + $show_full = $this->show_full; if (!isset($this->personcount)) { $this->personcount = 1; } // -- size of the detailed boxes based upon optional width parameter - $Dbwidth = ($this->box_width*$bwidth)/100; - $Dbheight = ($this->box_width*$bheight)/100; + $Dbwidth = ($this->box_width * $bwidth) / 100; + $Dbheight = ($this->box_width * $bheight) / 100; $bwidth = $Dbwidth; $bheight = $Dbheight; @@ -82,14 +82,14 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { $bheight = Theme::theme()->parameter('compact-chart-box-y'); } - $pbwidth = $bwidth+12; - $pbheight = $bheight+14; + $pbwidth = $bwidth + 12; + $pbheight = $bheight + 14; // Validate form variables - if (strlen($this->name)<30) { - $this->cellwidth=420; + if (strlen($this->name) < 30) { + $this->cellwidth = 420; } else { - $this->cellwidth=(strlen($this->name)*14); + $this->cellwidth = (strlen($this->name) * 14); } if ($this->root && $this->root->canShowName()) { @@ -112,16 +112,16 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { * * @return void */ - public function printChildFamily(WT_Individual $person, $depth, $label='1.', $gpid='') { + public function printChildFamily(WT_Individual $person, $depth, $label = '1.', $gpid = '') { - if ($depth<2) { + if ($depth < 2) { return; } foreach ($person->getSpouseFamilies() as $family) { print_sosa_family($family->getXref(), '', -1, $label, $person->getXref(), $gpid); - $i=1; + $i = 1; foreach ($family->getChildren() as $child) { - $this->printChildFamily($child, $depth-1, $label.($i++).'.', $person->getXref()); + $this->printChildFamily($child, $depth - 1, $label . ($i++) . '.', $person->getXref()); } } } @@ -137,8 +137,8 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { public function printChildDescendancy(WT_Individual $person, $depth) { echo "<li>"; echo "<table><tr><td>"; - if ($depth==$this->generations) { - echo "<img src=\"".Theme::theme()->parameter('image-spacer')."\" height=\"3\" width=\"", Theme::theme()->parameter('chart-descendancy-indent'), "\" alt=\"\"></td><td>"; + if ($depth == $this->generations) { + echo "<img src=\"" . Theme::theme()->parameter('image-spacer') . "\" height=\"3\" width=\"", Theme::theme()->parameter('chart-descendancy-indent'), "\" alt=\"\"></td><td>"; } else { echo "<img src=\"" . Theme::theme()->parameter('image-spacer') . "\" height=\"3\" width=\"3\" alt=\"\">"; echo "<img src=\"" . Theme::theme()->parameter('image-hline') . "\" height=\"3\" width=\"", Theme::theme()->parameter('chart-descendancy-indent') - 3, "\" alt=\"\"></td><td>"; @@ -151,24 +151,24 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { echo '<td>'; foreach ($person->getChildFamilies() as $cfamily) { foreach ($cfamily->getSpouses() as $parent) { - print_url_arrow('?rootid='.$parent->getXref().'&generations='.$this->generations.'&chart_style='.$this->chart_style.'&show_full='.$this->show_full.'&box_width='.$this->box_width.'&ged='.WT_GEDURL, WT_I18N::translate('Start at parents'), 2); + print_url_arrow('?rootid=' . $parent->getXref() . '&generations=' . $this->generations . '&chart_style=' . $this->chart_style . '&show_full=' . $this->show_full . '&box_width=' . $this->box_width . '&ged=' . WT_GEDURL, WT_I18N::translate('Start at parents'), 2); // only show the arrow for one of the parents break; } } // d'Aboville child number - $level =$this->generations-$depth; + $level = $this->generations - $depth; if ($this->show_full) { echo '<br><br> '; } echo '<span dir="ltr">'; //needed so that RTL languages will display this properly if (!isset($this->dabo_num[$level])) { - $this->dabo_num[$level]=0; + $this->dabo_num[$level] = 0; } $this->dabo_num[$level]++; - $this->dabo_num[$level+1]=0; - $this->dabo_sex[$level]=$person->getSex(); + $this->dabo_num[$level + 1] = 0; + $this->dabo_sex[$level] = $person->getSex(); for ($i = 0; $i <= $level; $i++) { $isf = $this->dabo_sex[$i]; if ($isf === 'M') { @@ -177,7 +177,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { if ($isf === 'U') { $isf = 'NN'; } - echo "<span class=\"person_box".$isf."\"> ".$this->dabo_num[$i]." </span>"; + echo "<span class=\"person_box" . $isf . "\"> " . $this->dabo_num[$i] . " </span>"; if ($i < $level) { echo '.'; } @@ -208,7 +208,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { echo '<li>'; echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent') + 4, '" alt="">'; echo '<span class="details1">'; - echo "<a href=\"#\" onclick=\"expand_layer('".$uid."'); return false;\" class=\"top\"><i id=\"".$uid."_img\" class=\"icon-minus\" title=\"".WT_I18N::translate('View family')."\"></i></a>"; + echo "<a href=\"#\" onclick=\"expand_layer('" . $uid . "'); return false;\" class=\"top\"><i id=\"" . $uid . "_img\" class=\"icon-minus\" title=\"" . WT_I18N::translate('View family') . "\"></i></a>"; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>'; @@ -217,8 +217,8 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { echo '</span>'; // print spouse - $spouse=$family->getSpouse($person); - echo '<ul id="'.$uid.'" class="generation">'; + $spouse = $family->getSpouse($person); + echo '<ul id="' . $uid . '" class="generation">'; echo '<li>'; echo '<table><tr><td>'; print_pedigree_person($spouse); @@ -230,7 +230,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { if ($spouse) { foreach ($spouse->getChildFamilies() as $cfamily) { foreach ($cfamily->getSpouses() as $parent) { - print_url_arrow('?rootid='.$parent->getXref().'&generations='.$this->generations.'&chart_style='.$this->chart_style.'&show_full='.$this->show_full.'&box_width='.$this->box_width.'&ged='.WT_GEDURL, WT_I18N::translate('Start at parents'), 2); + print_url_arrow('?rootid=' . $parent->getXref() . '&generations=' . $this->generations . '&chart_style=' . $this->chart_style . '&show_full=' . $this->show_full . '&box_width=' . $this->box_width . '&ged=' . WT_GEDURL, WT_I18N::translate('Start at parents'), 2); // only show the arrow for one of the parents break; } @@ -245,12 +245,12 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { $children = $family->getChildren(); echo '<tr><td colspan="3" class="details1" > '; if ($children) { - echo WT_Gedcom_Tag::getLabel('NCHI').': '.count($children); + echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children); } else { // Distinguish between no children (NCHI 0) and no recorded // children (no CHIL records) if (strpos($family->getGedcom(), '\n1 NCHI 0')) { - echo WT_Gedcom_Tag::getLabel('NCHI').': '.count($children); + echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children); } else { echo WT_I18N::translate('No children'); } @@ -259,7 +259,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { echo '</li>'; if ($depth > 1) { foreach ($children as $child) { - $this->printChildDescendancy($child, $depth-1); + $this->printChildDescendancy($child, $depth - 1); } } echo '</ul>'; @@ -279,14 +279,14 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { if ($n < 1) { return $array; } - $array[$person->getXref()]=$person; + $array[$person->getXref()] = $person; foreach ($person->getSpouseFamilies() as $family) { $spouse = $family->getSpouse($person); if ($spouse) { $array[$spouse->getXref()] = $spouse; } foreach ($family->getChildren() as $child) { - $array = $this->individualDescendancy($child, $n-1, $array); + $array = $this->individualDescendancy($child, $n - 1, $array); } } return $array; @@ -306,9 +306,9 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { return $array; } foreach ($person->getSpouseFamilies() as $family) { - $array[$family->getXref()]=$family; + $array[$family->getXref()] = $family; foreach ($family->getChildren() as $child) { - $array = $this->familyDescendancy($child, $n-1, $array); + $array = $this->familyDescendancy($child, $n - 1, $array); } } return $array; diff --git a/library/WT/Controller/Family.php b/library/WT/Controller/Family.php index 98404d076c..020b8f49ff 100644 --- a/library/WT/Controller/Family.php +++ b/library/WT/Controller/Family.php @@ -21,7 +21,7 @@ use WT\Auth; -require_once WT_ROOT.'includes/functions/functions_print_facts.php'; +require_once WT_ROOT . 'includes/functions/functions_print_facts.php'; /** * Class WT_Controller_Family - Controller for the family page @@ -79,9 +79,9 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { * @return string */ function getTimelineIndis($tags) { - preg_match_all('/\n1 (?:'.implode('|', $tags).') @('.WT_REGEX_XREF.')@/', $this->record->getGedcom(), $matches); + preg_match_all('/\n1 (?:' . implode('|', $tags) . ') @(' . WT_REGEX_XREF . ')@/', $this->record->getGedcom(), $matches); foreach ($matches[1] as &$match) { - $match='pids%5B%5D='.$match; + $match = 'pids%5B%5D=' . $match; } return implode('&', $matches[1]); } @@ -104,18 +104,18 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { if (WT_USER_CAN_EDIT) { // edit_fam / members $submenu = new WT_Menu(WT_I18N::translate('Change family members'), '#', 'menu-fam-change'); - $submenu->setOnclick("return change_family_members('".$this->record->getXref()."');"); + $submenu->setOnclick("return change_family_members('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); // edit_fam / add child $submenu = new WT_Menu(WT_I18N::translate('Add a child to this family'), '#', 'menu-fam-addchil'); - $submenu->setOnclick("return add_child_to_family('".$this->record->getXref()."', 'U');"); + $submenu->setOnclick("return add_child_to_family('" . $this->record->getXref() . "', 'U');"); $menu->addSubmenu($submenu); // edit_fam / reorder_children if ($this->record->getNumberOfChildren() > 1) { $submenu = new WT_Menu(WT_I18N::translate('Re-order children'), '#', 'menu-fam-orderchil'); - $submenu->setOnclick("return reorder_children('".$this->record->getXref()."');"); + $submenu->setOnclick("return reorder_children('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } } @@ -123,7 +123,7 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-fam-del'); - $submenu->setOnclick("return delete_family('" . WT_I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') . "', '".$this->record->getXref()."');"); + $submenu->setOnclick("return delete_family('" . WT_I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } @@ -141,7 +141,7 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { '#', 'menu-fam-addfav' ); - $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'".$this->record->getXref()."'},function(){location.reload();})"); + $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } @@ -194,14 +194,14 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { echo '<tr><td class="descriptionbox">'; echo WT_Gedcom_Tag::getLabel('NOTE'); echo '</td><td class="optionbox">'; - echo "<a href=\"#\" onclick=\"return add_new_record('".$this->record->getXref()."','NOTE');\">", WT_I18N::translate('Add a new note'), '</a>'; + echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','NOTE');\">", WT_I18N::translate('Add a new note'), '</a>'; echo help_link('add_note'); echo '</td></tr>'; echo '<tr><td class="descriptionbox">'; echo WT_Gedcom_Tag::getLabel('SHARED_NOTE'); echo '</td><td class="optionbox">'; - echo "<a href=\"#\" onclick=\"return add_new_record('".$this->record->getXref()."','SHARED_NOTE');\">", WT_I18N::translate('Add a new shared note'), '</a>'; + echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SHARED_NOTE');\">", WT_I18N::translate('Add a new shared note'), '</a>'; echo help_link('add_shared_note'); echo '</td></tr>'; @@ -209,17 +209,17 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord { echo '<tr><td class="descriptionbox">'; echo WT_Gedcom_Tag::getLabel('OBJE'); echo '</td><td class="optionbox">'; - echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&linktoid=".$this->record->getXref()."', '_blank', edit_window_specs); return false;\">", WT_I18N::translate('Add a new media object'), '</a>'; + echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&linktoid=" . $this->record->getXref() . "', '_blank', edit_window_specs); return false;\">", WT_I18N::translate('Add a new media object'), '</a>'; echo help_link('OBJE'); echo '<br>'; - echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=".$this->record->getXref()."&linkto=family', '_blank', find_window_specs); return false;\">", WT_I18N::translate('Link to an existing media object'), '</a>'; + echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=" . $this->record->getXref() . "&linkto=family', '_blank', find_window_specs); return false;\">", WT_I18N::translate('Link to an existing media object'), '</a>'; echo '</td></tr>'; } echo '<tr><td class="descriptionbox">'; echo WT_Gedcom_Tag::getLabel('SOUR'); echo '</td><td class="optionbox">'; - echo "<a href=\"#\" onclick=\"return add_new_record('".$this->record->getXref()."','SOUR');\">", WT_I18N::translate('Add a new source citation'), '</a>'; + echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SOUR');\">", WT_I18N::translate('Add a new source citation'), '</a>'; echo help_link('add_source'); echo '</td></tr>'; } diff --git a/library/WT/Controller/Familybook.php b/library/WT/Controller/Familybook.php index bf8b064f15..a97074f2fc 100644 --- a/library/WT/Controller/Familybook.php +++ b/library/WT/Controller/Familybook.php @@ -152,7 +152,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { if ($ct > 1) { if ($i == 0) { //-- adjust for the first column on left - $h = round(((($bheight) * $kids) + 8) / 2); // Assumes border = 1 and padding = 3 + $h = round(((($bheight) * $kids) + 8) / 2); // Assumes border = 1 and padding = 3 //-- adjust for other vertical columns if ($kids > 1) { $h = ($kids - 1) * 4 + $h; @@ -231,7 +231,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { return; } - $genoffset = $this->generations; // handle pedigree n generations lines + $genoffset = $this->generations; // handle pedigree n generations lines //-- calculate how tall the lines should be $lh = ($bhalfheight + 4) * pow(2, ($genoffset - $count - 1)); // diff --git a/library/WT/Controller/Fanchart.php b/library/WT/Controller/Fanchart.php index e39e83f733..d87a9d2975 100644 --- a/library/WT/Controller/Fanchart.php +++ b/library/WT/Controller/Fanchart.php @@ -44,8 +44,8 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { $default_generations = $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS'); // Extract the request parameters - $this->fan_style = WT_Filter::getInteger('fan_style', 2, 4, 3); - $this->fan_width = WT_Filter::getInteger('fan_width', 50, 300, 100); + $this->fan_style = WT_Filter::getInteger('fan_style', 2, 4, 3); + $this->fan_width = WT_Filter::getInteger('fan_width', 50, 300, 100); $this->generations = WT_Filter::getInteger('generations', 2, 9, $default_generations); if ($this->root && $this->root->canShowName()) { @@ -80,14 +80,14 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { * @return string $text output string */ public function splitAlignText($data, $maxlen) { - $RTLOrd = array(215,216,217,218,219); + $RTLOrd = array(215, 216, 217, 218, 219); $lines = explode("\n", $data); // more than 1 line : recursive calls - if (count($lines)>1) { + if (count($lines) > 1) { $text = ''; foreach ($lines as $line) { - $text .= $this->splitAlignText($line, $maxlen)."\n"; + $text .= $this->splitAlignText($line, $maxlen) . "\n"; } return $text; } @@ -104,21 +104,21 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { } } if ($found) { - $line=$data; + $line = $data; } else { foreach ($split as $word) { $len = strlen($line); $wlen = strlen($word); - if (($len+$wlen)<$maxlen) { + if (($len + $wlen) < $maxlen) { if (!empty($line)) { $line .= ' '; } $line .= "$word"; } else { - $p = max(0,(int)(($maxlen-$len)/2)); + $p = max(0, (int) (($maxlen - $len) / 2)); if (!empty($line)) { $line = str_repeat(' ', $p) . $line; // center alignment using spaces - $text .= $line. "\n"; + $text .= $line . "\n"; } $line = $word; } @@ -127,10 +127,10 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { // last line if (!empty($line)) { $len = strlen($line); - if (in_array(ord($line{0}),$RTLOrd)) { - $len/=2; + 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; } @@ -186,12 +186,12 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white); ImageColorTransparent($image, $white); - $color = ImageColorAllocate( + $color = ImageColorAllocate( $image, hexdec(substr(Theme::theme()->parameter('chart-font-color'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-font-color'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-font-color'), 4, 2))); - $bgcolor = ImageColorAllocate( + $bgcolor = ImageColorAllocate( $image, hexdec(substr(Theme::theme()->parameter('chart-background-u'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-u'), 2, 2)), @@ -261,7 +261,7 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE); // split and center text by lines - $wmax = (int)($angle * 7 / Theme::theme()->parameter('chart-font-size') * $scale); + $wmax = (int) ($angle * 7 / Theme::theme()->parameter('chart-font-size') * $scale); $wmax = min($wmax, 35 * $scale); if ($gen == 0) { $wmax = min($wmax, 17 * $scale); @@ -348,22 +348,22 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { } $html .= '</a>'; $html .= '<ul class="charts">'; - $html.= '<li><a href="pedigree.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '" >' . WT_I18N::translate('Pedigree') . '</a></li>'; + $html .= '<li><a href="pedigree.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '" >' . WT_I18N::translate('Pedigree') . '</a></li>'; if (array_key_exists('googlemap', WT_Module::getActiveModules())) { - $html.= '<li><a href="module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Pedigree map') . '</a></li>'; + $html .= '<li><a href="module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Pedigree map') . '</a></li>'; } if (WT_USER_GEDCOM_ID && WT_USER_GEDCOM_ID != $pid) { - $html.= '<li><a href="relationship.php?pid1=' . WT_USER_GEDCOM_ID . '&pid2=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Relationship to me').'</a></li>'; + $html .= '<li><a href="relationship.php?pid1=' . WT_USER_GEDCOM_ID . '&pid2=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Relationship to me') . '</a></li>'; } - $html.= '<li><a href="descendancy.php?rootid=' . $pid . '&ged='.WT_GEDURL.'" >' . WT_I18N::translate('Descendants') . '</a></li>'; - $html.= '<li><a href="ancestry.php?rootid=' . $pid . '&ged='.WT_GEDURL . '">' . WT_I18N::translate('Ancestors') . '</a></li>'; - $html.= '<li><a href="compact.php?rootid=' . $pid . '&ged='.WT_GEDURL . '">' . WT_I18N::translate('Compact tree') . '</a></li>'; - $html.= '<li><a href="' . $tempURL . '">' . WT_I18N::translate('Fan chart') . '</a></li>'; - $html.= '<li><a href="hourglass.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Hourglass chart') . '</a></li>'; + $html .= '<li><a href="descendancy.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '" >' . WT_I18N::translate('Descendants') . '</a></li>'; + $html .= '<li><a href="ancestry.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Ancestors') . '</a></li>'; + $html .= '<li><a href="compact.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Compact tree') . '</a></li>'; + $html .= '<li><a href="' . $tempURL . '">' . WT_I18N::translate('Fan chart') . '</a></li>'; + $html .= '<li><a href="hourglass.php?rootid=' . $pid . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('Hourglass chart') . '</a></li>'; if (array_key_exists('tree', WT_Module::getActiveModules())) { $html .= '<li><a href="module.php?mod=tree&mod_action=treeview&ged=' . WT_GEDURL . '&rootid=' . $pid . '">' . WT_I18N::translate('Interactive tree') . '</a></li>'; } - $html .='</ul>'; + $html .= '</ul>'; // spouse(s) and children foreach ($person->getSpouseFamilies() as $family) { $spouse = $family->getSpouse($person); @@ -412,7 +412,7 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { switch ($what) { case 'html': - return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&fan_style=' . $this->fan_style . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width.'&img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . WT_I18N::translate('Fan chart of %s', strip_tags($person->getFullName())) . '" usemap="#fanmap"></div>'; + return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&fan_style=' . $this->fan_style . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . WT_I18N::translate('Fan chart of %s', strip_tags($person->getFullName())) . '" usemap="#fanmap"></div>'; case 'png': ImageStringUp($image, 1, $fanw - 10, $fanh / 3, WT_SERVER_NAME . WT_SCRIPT_PATH, $color); diff --git a/library/WT/Controller/GedcomRecord.php b/library/WT/Controller/GedcomRecord.php index b39d277a13..01be351a73 100644 --- a/library/WT/Controller/GedcomRecord.php +++ b/library/WT/Controller/GedcomRecord.php @@ -28,7 +28,7 @@ class WT_Controller_GedcomRecord extends WT_Controller_Page { public function __construct() { // Automatically fix broken links if ($this->record && $this->record->canEdit()) { - $broken_links=0; + $broken_links = 0; foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) { if (!$fact->isPendingDeletion() && $fact->getTarget() === null) { $this->record->deleteFact($fact->getFactId(), false); diff --git a/library/WT/Controller/Hourglass.php b/library/WT/Controller/Hourglass.php index e3bb28f122..562ef13071 100644 --- a/library/WT/Controller/Hourglass.php +++ b/library/WT/Controller/Hourglass.php @@ -94,7 +94,7 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { $bheight = Theme::theme()->parameter('compact-chart-box-y'); } - $this->bhalfheight = (int)($bheight / 2); + $this->bhalfheight = (int) ($bheight / 2); // Validate parameters $this->hourPerson = WT_Individual::getInstance($this->pid); @@ -127,7 +127,7 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { return; } - $genoffset = $this->generations; // handle pedigree n generations lines + $genoffset = $this->generations; // handle pedigree n generations lines // //Prints empty table columns for children w/o parents up to the max generation @@ -390,7 +390,7 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { } // filter out root person from children array so only siblings remain - $siblings = array_filter($family->getChildren(), function (WT_Individual $item) use ($pid) { + $siblings = array_filter($family->getChildren(), function(WT_Individual $item) use ($pid) { return $item->getXref() != $pid; }); $num = count($siblings); diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php index 1d99683d1e..41ff7c9891 100644 --- a/library/WT/Controller/Individual.php +++ b/library/WT/Controller/Individual.php @@ -22,7 +22,7 @@ use WT\Auth; use WT\User; -require_once WT_ROOT.'includes/functions/functions_print_facts.php'; +require_once WT_ROOT . 'includes/functions/functions_print_facts.php'; /** * Class WT_Controller_Individual - Controller for the individual page @@ -96,18 +96,18 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { // Search engines should not make AJAX requests if ($SEARCH_SPIDER) { - header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden'); + header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit; } // Initialise tabs - $tab=WT_Filter::get('module'); + $tab = WT_Filter::get('module'); // A request for a non-existant tab? if (array_key_exists($tab, $this->tabs)) { - $mod=$this->tabs[$tab]; + $mod = $this->tabs[$tab]; } else { - header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); exit; } @@ -134,17 +134,17 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { $factrec = $event->getGedcom(); // Create a dummy record, so we can extract the formatted NAME value from the event. - $dummy=new WT_Individual( + $dummy = new WT_Individual( 'xref', - "0 @xref@ INDI\n1 DEAT Y\n".$factrec, + "0 @xref@ INDI\n1 DEAT Y\n" . $factrec, null, WT_GED_ID ); - $all_names=$dummy->getAllNames(); - $primary_name=$all_names[0]; + $all_names = $dummy->getAllNames(); + $primary_name = $all_names[0]; $this->name_count++; - if ($this->name_count >1) { echo '<h3 class="name_two">',$dummy->getFullName(), '</h3>'; } //Other names accordion element + if ($this->name_count > 1) { echo '<h3 class="name_two">', $dummy->getFullName(), '</h3>'; } //Other names accordion element echo '<div class="indi_name_details'; if ($event->isPendingDeletion()) { echo ' old'; @@ -167,17 +167,17 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { } } if ($this->record->canEdit() && !$event->isPendingDeletion()) { - echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('".WT_I18N::translate('Are you sure you want to delete this fact?')."', '".$this->record->getXref()."', '".$event->getFactId()."');\" title=\"".WT_I18N::translate('Delete this name')."\"><span class=\"link_text\">".WT_I18N::translate('Delete this name')."</span></a></div>"; - echo "<div class=\"editlink\"><a href=\"#\" class=\"editicon\" onclick=\"edit_name('".$this->record->getXref()."', '".$event->getFactId()."'); return false;\" title=\"".WT_I18N::translate('Edit name')."\"><span class=\"link_text\">".WT_I18N::translate('Edit name')."</span></a></div>"; + echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('" . WT_I18N::translate('Are you sure you want to delete this fact?') . "', '" . $this->record->getXref() . "', '" . $event->getFactId() . "');\" title=\"" . WT_I18N::translate('Delete this name') . "\"><span class=\"link_text\">" . WT_I18N::translate('Delete this name') . "</span></a></div>"; + echo "<div class=\"editlink\"><a href=\"#\" class=\"editicon\" onclick=\"edit_name('" . $this->record->getXref() . "', '" . $event->getFactId() . "'); return false;\" title=\"" . WT_I18N::translate('Edit name') . "\"><span class=\"link_text\">" . WT_I18N::translate('Edit name') . "</span></a></div>"; } echo '</dd>'; echo '</dl>'; echo '</div>'; $ct = preg_match_all('/\n2 (\w+) (.*)/', $factrec, $nmatch, PREG_SET_ORDER); - for ($i=0; $i<$ct; $i++) { + for ($i = 0; $i < $ct; $i++) { echo '<div>'; $fact = $nmatch[$i][1]; - if ($fact!='SOUR' && $fact!='NOTE' && $fact!='SPFX') { + if ($fact != 'SOUR' && $fact != 'NOTE' && $fact != 'SPFX') { echo '<dl><dt class="label">', WT_Gedcom_Tag::getLabel($fact, $this->record), '</dt>'; echo '<dd class="field">'; // Before using dir="auto" on this field, note that Gecko treats this as an inline element but WebKit treats it as a block element if (isset($nmatch[$i][2])) { @@ -192,7 +192,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { // The SURN field is not necessarily the surname. // Where it is not a substring of the real surname, show it after the real surname. $surname = WT_Filter::escapeHtml($primary_name['surname']); - if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2]))!==false) { + if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) { echo '<span dir="auto">' . $surname . '</span>'; } else { echo WT_I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>'); @@ -239,7 +239,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { echo 'male_gender"'; if ($event->canEdit()) { echo ' title="', WT_I18N::translate('Male'), ' - ', WT_I18N::translate('Edit'), '"'; - echo ' onclick="edit_record(\''.$this->record->getXref().'\', \''.$event->getFactId().'\'); return false;">'; + echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">'; } else { echo ' title="', WT_I18N::translate('Male'), '">'; } @@ -248,7 +248,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { echo 'female_gender"'; if ($event->canEdit()) { echo ' title="', WT_I18N::translate('Female'), ' - ', WT_I18N::translate('Edit'), '"'; - echo ' onclick="edit_record(\''.$this->record->getXref().'\', \''.$event->getFactId().'\'); return false;">'; + echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">'; } else { echo ' title="', WT_I18N::translate('Female'), '">'; } @@ -257,7 +257,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { echo 'unknown_gender"'; if ($event->canEdit()) { echo ' title="', WT_I18N::translate_c('unknown gender', 'Unknown'), ' - ', WT_I18N::translate('Edit'), '"'; - echo ' onclick="edit_record(\''.$this->record->getXref().'\', \''.$event->getFactId().'\'); return false;">'; + echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">'; } else { echo ' title="', WT_I18N::translate_c('unknown gender', 'Unknown'), '">'; } @@ -286,19 +286,19 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { if (WT_USER_CAN_EDIT) { foreach ($this->record->getFacts() as $fact) { if ($fact->getTag() === 'NAME' && $fact->canEdit()) { - $menu->setOnclick("return edit_name('".$this->record->getXref() . "', '" . $fact->getFactId() . "');"); + $menu->setOnclick("return edit_name('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');"); break; } } $submenu = new WT_Menu(WT_I18N::translate('Add a new name'), '#', 'menu-indi-addname'); - $submenu->setOnclick("return add_name('".$this->record->getXref()."');"); + $submenu->setOnclick("return add_name('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); $has_sex_record = false; $submenu = new WT_Menu(WT_I18N::translate('Edit gender'), '#', 'menu-indi-editsex'); foreach ($this->record->getFacts() as $fact) { - if ($fact->getTag()=='SEX' && $fact->canEdit()) { + if ($fact->getTag() == 'SEX' && $fact->canEdit()) { $submenu->setOnclick("return edit_record('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');"); $has_sex_record = true; break; @@ -309,9 +309,9 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { } $menu->addSubmenu($submenu); - if (count($this->record->getSpouseFamilies())>1) { + if (count($this->record->getSpouseFamilies()) > 1) { $submenu = new WT_Menu(WT_I18N::translate('Re-order families'), '#', 'menu-indi-orderfam'); - $submenu->setOnclick("return reorder_families('".$this->record->getXref()."');"); + $submenu->setOnclick("return reorder_families('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } } @@ -319,7 +319,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-indi-del'); - $submenu->setOnclick("return delete_individual('".WT_I18N::translate('Are you sure you want to delete ā%sā?', WT_Filter::escapeJs(strip_tags($this->record->getFullName())))."', '".$this->record->getXref()."');"); + $submenu->setOnclick("return delete_individual('" . WT_I18N::translate('Are you sure you want to delete ā%sā?', WT_Filter::escapeJs(strip_tags($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } @@ -337,7 +337,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { '#', 'menu-indi-addfav' ); - $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'".$this->record->getXref()."'},function(){location.reload();})"); + $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } @@ -352,7 +352,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { * @return string returns 'person_box', 'person_boxF', or 'person_boxNN' */ function getPersonStyle($person) { - switch($person->getSex()) { + switch ($person->getSex()) { case 'M': $class = 'person_box'; break; @@ -394,16 +394,16 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { public function getSideBarContent() { global $controller; - $html=''; - $active=0; - $n=0; + $html = ''; + $active = 0; + $n = 0; foreach (WT_Module::getActiveSidebars() as $mod) { if ($mod->hasSidebarContent()) { - $html.='<h3 id="'.$mod->getName().'"><a href="#">'.$mod->getTitle().'</a></h3>'; - $html.='<div id="sb_content_'.$mod->getName().'">'.$mod->getSidebarContent().'</div>'; + $html .= '<h3 id="' . $mod->getName() . '"><a href="#">' . $mod->getTitle() . '</a></h3>'; + $html .= '<div id="sb_content_' . $mod->getName() . '">' . $mod->getSidebarContent() . '</div>'; // The family navigator should be opened by default - if ($mod->getName()=='family_nav') { - $active=$n; + if ($mod->getName() == 'family_nav') { + $active = $n; } ++$n; } diff --git a/library/WT/Controller/Lifespan.php b/library/WT/Controller/Lifespan.php index dbfaee38fd..229291106a 100644 --- a/library/WT/Controller/Lifespan.php +++ b/library/WT/Controller/Lifespan.php @@ -77,7 +77,7 @@ class WT_Controller_Lifespan extends WT_Controller_Page { $this->Mcolorindex = 0; $this->zoomfactor = 10; $this->color = '#0000FF'; - $this->currentYear = (int)date('Y'); + $this->currentYear = (int) date('Y'); $this->deathMod = 0; $this->endDate = $this->currentYear; @@ -131,7 +131,7 @@ class WT_Controller_Lifespan extends WT_Controller_Page { $this->endYear = $endYear; if ($beginYear == 0 || $endYear == 0) { //-- cleanup user input - $this->pids = array_unique($this->pids); //removes duplicates + $this->pids = array_unique($this->pids); //removes duplicates foreach ($this->pids as $key => $value) { if ($value != $remove) { $this->pids[$key] = $value; @@ -169,7 +169,7 @@ class WT_Controller_Lifespan extends WT_Controller_Page { } // Sort the array in order of birth year - uasort($this->people, function (WT_Individual $a, WT_Individual $b) { + uasort($this->people, function(WT_Individual $a, WT_Individual $b) { return WT_Date::Compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); }); //If there is people in the array posted back this if occurs @@ -280,7 +280,7 @@ class WT_Controller_Lifespan extends WT_Controller_Page { $timelineTick = $totalYears / $yearSpan; //calculates the length of the timeline for ($i = 0; $i < $timelineTick; $i++) { - echo "<div class=\"sublinks_cell\" style=\"text-align: left; position: absolute; top: ", $top, "px; left: ", $leftPosition, "px; width: ", $tickDistance, "px;\">$newStartYear<i class=\"icon-lifespan-chunk\"></i></div>"; //onclick="zoomToggle('100px', '100px', '200px', '200px', this);" + echo "<div class=\"sublinks_cell\" style=\"text-align: left; position: absolute; top: ", $top, "px; left: ", $leftPosition, "px; width: ", $tickDistance, "px;\">$newStartYear<i class=\"icon-lifespan-chunk\"></i></div>"; //onclick="zoomToggle('100px', '100px', '200px', '200px', this);" $leftPosition += $tickDistance; $newStartYear += $yearSpan; } diff --git a/library/WT/Controller/Note.php b/library/WT/Controller/Note.php index 80a8a1734e..47f57cc51f 100644 --- a/library/WT/Controller/Note.php +++ b/library/WT/Controller/Note.php @@ -19,7 +19,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -require_once WT_ROOT.'includes/functions/functions_print_facts.php'; +require_once WT_ROOT . 'includes/functions/functions_print_facts.php'; /** * Class WT_Controller_Note - Controller for the shared note page @@ -48,7 +48,7 @@ class WT_Controller_Note extends WT_Controller_GedcomRecord { if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit'); - $submenu->setOnclick('return edit_note(\''.$this->record->getXref().'\');'); + $submenu->setOnclick('return edit_note(\'' . $this->record->getXref() . '\');'); $menu->addSubmenu($submenu); } @@ -66,7 +66,7 @@ class WT_Controller_Note extends WT_Controller_GedcomRecord { '#', 'menu-note-addfav' ); - $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'".$this->record->getXref()."'},function(){location.reload();})"); + $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } diff --git a/library/WT/Controller/Page.php b/library/WT/Controller/Page.php index d0755b51e8..2b0349d6c5 100644 --- a/library/WT/Controller/Page.php +++ b/library/WT/Controller/Page.php @@ -24,7 +24,7 @@ class WT_Controller_Page extends WT_Controller_Base { // Page header information private $canonical_url = ''; private $meta_robots = 'noindex,nofollow'; // Most pages are not intended for robots - private $page_title = WT_WEBTREES; // <head><title> $page_title </title></head> + private $page_title = WT_WEBTREES; // <head><title> $page_title </title></head> /** * Startup activity @@ -144,10 +144,10 @@ class WT_Controller_Page extends WT_Controller_Base { Theme::theme()->hookFooterExtraJavascript() . '</body>' . '</html>' . PHP_EOL . - '<!-- webtrees: ' . WT_VERSION . ' -->' . - '<!-- Execution time: ' . WT_I18N::number(microtime(true) - $start_time, 3) . ' seconds -->' . - '<!-- Memory: ' . WT_I18N::number(memory_get_peak_usage(true)/1024) . ' KB -->' . - '<!-- SQL queries: ' . WT_I18N::number(WT_DB::getQueryCount()) . ' -->'; + '<!-- webtrees: ' . WT_VERSION . ' -->' . + '<!-- Execution time: ' . WT_I18N::number(microtime(true) - $start_time, 3) . ' seconds -->' . + '<!-- Memory: ' . WT_I18N::number(memory_get_peak_usage(true) / 1024) . ' KB -->' . + '<!-- SQL queries: ' . WT_I18N::number(WT_DB::getQueryCount()) . ' -->'; } /** diff --git a/library/WT/Controller/Pedigree.php b/library/WT/Controller/Pedigree.php index 60f57a3632..bc167e5064 100644 --- a/library/WT/Controller/Pedigree.php +++ b/library/WT/Controller/Pedigree.php @@ -63,20 +63,20 @@ class WT_Controller_Pedigree extends WT_Controller_Chart { $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); $this->PEDIGREE_GENERATIONS = WT_Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); - if ($this->talloffset==1) $this->talloffset=1; // Make SURE this is an integer - if ($this->talloffset>1 && $this->PEDIGREE_GENERATIONS>8) $this->PEDIGREE_GENERATIONS=8; + if ($this->talloffset == 1) $this->talloffset = 1; // Make SURE this is an integer + if ($this->talloffset > 1 && $this->PEDIGREE_GENERATIONS > 8) $this->PEDIGREE_GENERATIONS = 8; // TODO: some library functions expect this as a global. // Passing a function parameter would be much better. global $PEDIGREE_GENERATIONS; - $PEDIGREE_GENERATIONS=$this->PEDIGREE_GENERATIONS; + $PEDIGREE_GENERATIONS = $this->PEDIGREE_GENERATIONS; // This is passed as a global. A parameter would be better... $this->show_full = ($this->show_full) ? 1 : 0; // Make SURE this is an integer - if ($this->talloffset>3) { - $this->talloffset=3; - } elseif ($this->talloffset<0) { - $this->talloffset=0; + if ($this->talloffset > 3) { + $this->talloffset = 3; + } elseif ($this->talloffset < 0) { + $this->talloffset = 0; } $show_full = $this->show_full; $talloffset = $this->talloffset; @@ -99,39 +99,39 @@ class WT_Controller_Pedigree extends WT_Controller_Chart { } //-- adjustments for portrait mode - if ($this->talloffset==0) { - $bxspacing+=12; - $baseyoffset -= 20*($this->PEDIGREE_GENERATIONS-1); + if ($this->talloffset == 0) { + $bxspacing += 12; + $baseyoffset -= 20 * ($this->PEDIGREE_GENERATIONS - 1); } $this->ancestors = $this->sosaAncestors($PEDIGREE_GENERATIONS); - $this->treesize = pow(2, (int)($this->PEDIGREE_GENERATIONS))-1; + $this->treesize = pow(2, (int) ($this->PEDIGREE_GENERATIONS)) - 1; // sosaAncestors() puts everyone at $i+1 - for ($i=0; $i<$this->treesize; $i++) { - $this->ancestors[$i] = $this->ancestors[$i+1]; + for ($i = 0; $i < $this->treesize; $i++) { + $this->ancestors[$i] = $this->ancestors[$i + 1]; } if (!$this->show_full) { - if ($this->talloffset==0) { - $baseyoffset = 160+$bheight*2; - } elseif ($this->talloffset==1) { - $baseyoffset = 180+$bheight*2; - } elseif ($this->talloffset>1) { - if ($this->PEDIGREE_GENERATIONS==3) { + if ($this->talloffset == 0) { + $baseyoffset = 160 + $bheight * 2; + } elseif ($this->talloffset == 1) { + $baseyoffset = 180 + $bheight * 2; + } elseif ($this->talloffset > 1) { + if ($this->PEDIGREE_GENERATIONS == 3) { $baseyoffset = 30; } else { $baseyoffset = -85; } } } else { - if ($this->talloffset==0) { - $baseyoffset = 100+$bheight/2; - } elseif ($this->talloffset==1) { - $baseyoffset = 160+$bheight/2; - } elseif ($this->talloffset>1) { - if ($this->PEDIGREE_GENERATIONS==3) { + if ($this->talloffset == 0) { + $baseyoffset = 100 + $bheight / 2; + } elseif ($this->talloffset == 1) { + $baseyoffset = 160 + $bheight / 2; + } elseif ($this->talloffset > 1) { + if ($this->PEDIGREE_GENERATIONS == 3) { $baseyoffset = 30; } else { $baseyoffset = -85; @@ -139,94 +139,94 @@ class WT_Controller_Pedigree extends WT_Controller_Chart { } } // -- this next section will create and position the DIV layers for the pedigree tree - $this->curgen = 1; // -- variable to track which generation the algorithm is currently working on - $this->yoffset=0; // -- used to offset the position of each box as it is generated - $this->xoffset=0; - $this->prevyoffset=0; // -- used to track the y position of the previous box + $this->curgen = 1; // -- variable to track which generation the algorithm is currently working on + $this->yoffset = 0; // -- used to offset the position of each box as it is generated + $this->xoffset = 0; + $this->prevyoffset = 0; // -- used to track the y position of the previous box $this->offsetarray = array(); $this->minyoffset = 0; - if ($this->treesize<3) $this->treesize=3; + if ($this->treesize < 3) $this->treesize = 3; // -- loop through all of IDs in the array starting at the last and working to the first //-- calculation the box positions - for ($i=($this->treesize-1); $i>=0; $i--) { + for ($i = ($this->treesize - 1); $i >= 0; $i--) { // -- check to see if we have moved to the next generation - if ($i < (int)($this->treesize / (pow(2, $this->curgen)))) { + if ($i < (int) ($this->treesize / (pow(2, $this->curgen)))) { $this->curgen++; } //-- box position in current generation - $boxpos = $i-pow(2, $this->PEDIGREE_GENERATIONS-$this->curgen); + $boxpos = $i - pow(2, $this->PEDIGREE_GENERATIONS - $this->curgen); //-- offset multiple for current generation if ($this->talloffset < 2) { - $genoffset = pow(2, $this->curgen-$this->talloffset); - $boxspacing = $this->pbheight+$byspacing; + $genoffset = pow(2, $this->curgen - $this->talloffset); + $boxspacing = $this->pbheight + $byspacing; } else { - $genoffset = pow(2, $this->curgen-1); - $boxspacing = $this->pbwidth+$byspacing; + $genoffset = pow(2, $this->curgen - 1); + $boxspacing = $this->pbwidth + $byspacing; } // -- calculate the yoffset Position in the generation Spacing between boxes put child between parents - $this->yoffset = $baseyoffset+($boxpos * ($boxspacing * $genoffset))+(($boxspacing/2)*$genoffset)+($boxspacing * $genoffset); + $this->yoffset = $baseyoffset + ($boxpos * ($boxspacing * $genoffset)) + (($boxspacing / 2) * $genoffset) + ($boxspacing * $genoffset); // -- calculate the xoffset - if ($this->talloffset==0) { - if ($this->PEDIGREE_GENERATIONS<6) { - $addxoffset = $basexoffset+(10+60*(5-$this->PEDIGREE_GENERATIONS)); - $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth+$bxspacing) / 2)+$addxoffset; + if ($this->talloffset == 0) { + if ($this->PEDIGREE_GENERATIONS < 6) { + $addxoffset = $basexoffset + (10 + 60 * (5 - $this->PEDIGREE_GENERATIONS)); + $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset; } else { - $addxoffset = $basexoffset+10; - $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth+$bxspacing) / 2)+$addxoffset; + $addxoffset = $basexoffset + 10; + $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset; } //-- compact the tree - if ($this->curgen<$this->PEDIGREE_GENERATIONS) { - $parent = (int)(($i-1)/2); - if ($i%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * ($this->curgen-1)); - else $this->yoffset=$this->yoffset + (($boxspacing/2) * ($this->curgen-1)); + if ($this->curgen < $this->PEDIGREE_GENERATIONS) { + $parent = (int) (($i - 1) / 2); + if ($i % 2 == 0) $this->yoffset = $this->yoffset - (($boxspacing / 2) * ($this->curgen - 1)); + else $this->yoffset = $this->yoffset + (($boxspacing / 2) * ($this->curgen - 1)); $pgen = $this->curgen; - while ($parent>0) { - if ($parent%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * $pgen); - else $this->yoffset=$this->yoffset + (($boxspacing/2) * $pgen); + while ($parent > 0) { + if ($parent % 2 == 0) $this->yoffset = $this->yoffset - (($boxspacing / 2) * $pgen); + else $this->yoffset = $this->yoffset + (($boxspacing / 2) * $pgen); $pgen++; - if ($pgen>3) { - $temp=0; - for ($j=1; $j<($pgen-2); $j++) $temp += (pow(2, $j)-1); - if ($parent%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * $temp); - else $this->yoffset=$this->yoffset + (($boxspacing/2) * $temp); + if ($pgen > 3) { + $temp = 0; + for ($j = 1; $j < ($pgen - 2); $j++) $temp += (pow(2, $j) - 1); + if ($parent % 2 == 0) $this->yoffset = $this->yoffset - (($boxspacing / 2) * $temp); + else $this->yoffset = $this->yoffset + (($boxspacing / 2) * $temp); } - $parent = (int)(($parent-1)/2); + $parent = (int) (($parent - 1) / 2); } - if ($this->curgen>3) { - $temp=0; - for ($j=1; $j<($this->curgen-2); $j++) $temp += (pow(2, $j)-1); - if ($i%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * $temp); - else $this->yoffset=$this->yoffset + (($boxspacing/2) * $temp); + if ($this->curgen > 3) { + $temp = 0; + for ($j = 1; $j < ($this->curgen - 2); $j++) $temp += (pow(2, $j) - 1); + if ($i % 2 == 0) $this->yoffset = $this->yoffset - (($boxspacing / 2) * $temp); + else $this->yoffset = $this->yoffset + (($boxspacing / 2) * $temp); } } - $this->yoffset-=(($boxspacing/2)*pow(2,($this->PEDIGREE_GENERATIONS-2))-($boxspacing/2)); + $this->yoffset -= (($boxspacing / 2) * pow(2, ($this->PEDIGREE_GENERATIONS - 2)) - ($boxspacing / 2)); } - else if ($this->talloffset==1) { - $this->xoffset = 22 + $basexoffset + (($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth+$bxspacing)); + else if ($this->talloffset == 1) { + $this->xoffset = 22 + $basexoffset + (($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth + $bxspacing)); if ($this->curgen == $this->PEDIGREE_GENERATIONS) $this->xoffset; - if ($this->PEDIGREE_GENERATIONS<4) $this->xoffset += 60; + if ($this->PEDIGREE_GENERATIONS < 4) $this->xoffset += 60; } - else if ($this->talloffset==2) { - if ($this->show_full) $this->xoffset = ($this->curgen) * (($this->pbwidth+$bxspacing) / 2)+($this->curgen)*10+136.5; - else $this->xoffset = ($this->curgen) * (($this->pbwidth+$bxspacing) / 4)+($this->curgen)*10+215.75; + else if ($this->talloffset == 2) { + if ($this->show_full) $this->xoffset = ($this->curgen) * (($this->pbwidth + $bxspacing) / 2) + ($this->curgen) * 10 + 136.5; + else $this->xoffset = ($this->curgen) * (($this->pbwidth + $bxspacing) / 4) + ($this->curgen) * 10 + 215.75; } else { - if ($this->show_full) $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth+$bxspacing) / 2)+260; - else $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth+$bxspacing) / 4)+270; + if ($this->show_full) $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + 260; + else $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 4) + 270; } - if ($this->curgen == 1 && $this->talloffset==1) $this->xoffset += 10; - $this->offsetarray[$i]["x"]=$this->xoffset; - $this->offsetarray[$i]["y"]=$this->yoffset; + if ($this->curgen == 1 && $this->talloffset == 1) $this->xoffset += 10; + $this->offsetarray[$i]["x"] = $this->xoffset; + $this->offsetarray[$i]["y"] = $this->yoffset; } //-- calculate the smallest yoffset and adjust the tree to that offset $minyoffset = 0; - for ($i=0; $i<count($this->ancestors); $i++) { + for ($i = 0; $i < count($this->ancestors); $i++) { if (!empty($offsetarray[$i])) { - if (($minyoffset==0)||($minyoffset>$this->offsetarray[$i]["y"])) $minyoffset = $this->offsetarray[$i]["y"]; + if (($minyoffset == 0) || ($minyoffset > $this->offsetarray[$i]["y"])) $minyoffset = $this->offsetarray[$i]["y"]; } } } |
