diff options
| author | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2015-01-18 21:44:41 +0000 |
|---|---|---|
| committer | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2015-01-18 21:44:41 +0000 |
| commit | 6f021f780be7c181ecc6fe06a645f1a6ded0936a (patch) | |
| tree | 82ca621bf5e60120688ce6b5a4a6a70e9ee8a09f /modules_v3 | |
| parent | 36a7643b44914916917dd6ccf1cddc24c66095b8 (diff) | |
| download | webtrees-6f021f780be7c181ecc6fe06a645f1a6ded0936a.tar.gz webtrees-6f021f780be7c181ecc6fe06a645f1a6ded0936a.tar.bz2 webtrees-6f021f780be7c181ecc6fe06a645f1a6ded0936a.zip | |
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Diffstat (limited to 'modules_v3')
| -rw-r--r-- | modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php | 824 | ||||
| -rw-r--r-- | modules_v3/batch_update/admin_batch_update.php | 284 | ||||
| -rw-r--r-- | modules_v3/googlemap/module.php | 924 |
3 files changed, 1016 insertions, 1016 deletions
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php index 55df699418..8697e31870 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php @@ -50,8 +50,8 @@ if (!defined('WT_WEBTREES')) { </script> <?php echo "<input id=personid type=\"text\" size=\"20\" style=\"color: #000000;\" value=\"\">"; - echo "<a href=\"#\" onclick=\"findindi()\">" ; - echo " ".WT_I18N::translate('Search'); + echo "<a href=\"#\" onclick=\"findindi()\">"; + echo " " . WT_I18N::translate('Search'); echo '</a>'; ?> </td> @@ -75,7 +75,7 @@ if (!defined('WT_WEBTREES')) { <?php // Header text with "Head" button ================================================= $headImg = '<i class="headimg vmiddle icon-button_head"></i>'; - $headImg2 = '<i class="headimg2 vmiddle icon-button_head" title="'.WT_I18N::translate('Click to choose individual as head of family.').'"></i>'; + $headImg2 = '<i class="headimg2 vmiddle icon-button_head" title="' . WT_I18N::translate('Click to choose individual as head of family.') . '"></i>'; echo WT_I18N::translate('Click %s to choose individual as head of family.', $headImg); ?> </td> @@ -94,13 +94,13 @@ if (!defined('WT_WEBTREES')) { $chBLDarray = Array(); foreach ($family->getChildren() as $child) { $chnam = $child->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); $chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name - $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } @@ -108,7 +108,7 @@ if (!defined('WT_WEBTREES')) { if ($family->getHusband()) { //-- Parents Husbands Parents -------------------------------------- - $gparent=$family->getHusband(); + $gparent = $family->getHusband(); foreach ($gparent->getChildFamilies() as $cfamily) { $phusb = $cfamily->getHusband(); $pwife = $cfamily->getWife(); @@ -119,14 +119,14 @@ if (!defined('WT_WEBTREES')) { //-- Parents Husbands Details -------------------------------------- $married = WT_Date::Compare($censdate, $marrdate); $nam = $gparent->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $label = get_close_relationship_name($person, $gparent); @@ -142,14 +142,14 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value" style="text-decoration:none;" > <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$gparent->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $gparent->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> </td> <td align="left" class="facts_value nowrap"> <a href='#' onclick='insertRowToTable("<?php - echo $gparent->getXref() ; // pid = PID + echo $gparent->getXref(); // pid = PID ?>", "<?php echo WT_Filter::escapeHtml($fulln); // nam = Full Name ?>", "<?php @@ -167,21 +167,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $gparent->getSex(); // gend = Gender ?>", "<?php - if ($married>=0) { + if ($married >= 0) { echo "M"; // cond = Condition (Married) } else { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -199,13 +199,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Husband Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $gparent->getSex()=="F") { + if (isset($chBLDarray) && $gparent->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $gparent->getFullName(); // Full Name (Link) + echo $gparent->getFullName(); // Full Name (Link) ?> </a> </td> @@ -217,7 +217,7 @@ if (!defined('WT_WEBTREES')) { if ($family->getWife()) { //-- Parents Wifes Parent Family --------------------------- - $gparent=$family->getWife(); + $gparent = $family->getWife(); $cfamily = null; foreach ($gparent->getChildFamilies() as $cfamily) { $phusb = $cfamily->getHusband(); @@ -229,25 +229,25 @@ if (!defined('WT_WEBTREES')) { //-- Wifes Details -------------------------------------- $married = WT_Date::Compare($censdate, $marrdate); $nam = $gparent->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; $husbnam = null; // Get wifes married name if available if ($cfamily && $cfamily->getHusband()) { $husbnams = $cfamily->getHusband()->getAllNames(); - if ($husbnams[0]['surname']=="@N.N." || $husbnams[0]['surname']=="") { + if ($husbnams[0]['surname'] == "@N.N." || $husbnams[0]['surname'] == "") { // if Husband or his name is not known then use wifes birth name $husbnam = $nam[0]['surname']; } else { $husbnam = $husbnams[0]['surname']; } } - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $husbnam; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $husbnam; } } $label = get_close_relationship_name($person, $gparent); @@ -262,7 +262,7 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$gparent->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $gparent->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> @@ -287,21 +287,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $gparent->getSex(); // gend = Gender ?>", "<?php - if ($married>=0 && isset($nam[1])) { + if ($married >= 0 && isset($nam[1])) { echo "M"; // cond = Condition (Married) } else { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -319,13 +319,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Wife Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $gparent->getSex()=="F") { + if (isset($chBLDarray) && $gparent->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $gparent->getFullName(); // Full Name (Link) + echo $gparent->getFullName(); // Full Name (Link) ?> </a> </td> @@ -339,40 +339,40 @@ if (!defined('WT_WEBTREES')) { foreach ($family->getChildren() as $child) { // Get Child’s Children’s Name DOB DOD ---- - $chBLDarray=Array(); + $chBLDarray = Array(); foreach ($child->getSpouseFamilies() as $childfamily) { $chchildren = $childfamily->getChildren(); foreach ($chchildren as $chchild) { $chnam = $chchild->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); $chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name// Child’s Full Name - $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } // Get child’s marriage status ---- - $married=""; - $marrdate=""; + $married = ""; + $marrdate = ""; foreach ($child->getSpouseFamilies() as $childfamily) { - $marrdate=$childfamily->getMarriageDate(); + $marrdate = $childfamily->getMarriageDate(); $married = WT_Date::Compare($censdate, $marrdate); } $nam = $child->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; - $chfulmn=null; + $chfulmn = null; $chnam = $child->getAllNames(); - for ($i=0; $i<count($nam); $i++) { - if ($chnam[$i]['type']=='_MARNM') { - $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $chnam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($chnam[$i]['type'] == '_MARNM') { + $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $chnam[$i]['surname']; } } $label = get_close_relationship_name($person, $child); @@ -388,7 +388,7 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$child->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $child->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> @@ -416,21 +416,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $child->getSex(); // gend = Gender ?>", "<?php - if ($married>0) { + if ($married > 0) { echo "M"; // cond = Condition (Married) - } else if ($married<0 || ($married=="0") ) { + } else if ($married < 0 || ($married == "0")) { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$child->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $child->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -448,7 +448,7 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Child Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $child->getSex()=="F") { + if (isset($chBLDarray) && $child->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } @@ -478,13 +478,13 @@ if (!defined('WT_WEBTREES')) { $chBLDarray = Array(); foreach ($family->getChildren() as $child) { $chnam = $child->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); $chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name - $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } @@ -492,7 +492,7 @@ if (!defined('WT_WEBTREES')) { if ($family->getHusband()) { //-- Step Husbands Parent Family -------------------------------------- - $gparent=$family->getHusband(); + $gparent = $family->getHusband(); foreach ($gparent->getChildFamilies() as $cfamily) { $phusb = $cfamily->getHusband(); $pwife = $cfamily->getWife(); @@ -503,14 +503,14 @@ if (!defined('WT_WEBTREES')) { //-- Step Husbands Details -------------------------------------- $married = WT_Date::Compare($censdate, $marrdate); $nam = $gparent->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $label = get_close_relationship_name($person, $gparent); @@ -527,7 +527,7 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$gparent->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $gparent->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> @@ -552,21 +552,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $gparent->getSex(); // gend = Gender ?>", "<?php - if ($married>=0) { + if ($married >= 0) { echo "M"; // cond = Condition (Married) } else { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -584,13 +584,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Step Husband Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $gparent->getSex()=="F") { + if (isset($chBLDarray) && $gparent->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $gparent->getFullName(); // Full Name (Link) + echo $gparent->getFullName(); // Full Name (Link) ?> </a> </td> @@ -602,7 +602,7 @@ if (!defined('WT_WEBTREES')) { if ($family->getWife()) { //-- Step Wifes Parent Family -------------------------------------- - $gparent=$family->getWife(); + $gparent = $family->getWife(); $cfamily = null; foreach ($gparent->getChildFamilies() as $cfamily) { $phusb = $cfamily->getHusband(); @@ -614,25 +614,25 @@ if (!defined('WT_WEBTREES')) { //-- Step Wifes Details -------------------------------------- $married = WT_Date::Compare($censdate, $marrdate); $nam = $gparent->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; $husbnam = null; // Get wifes married name if available if ($cfamily && $cfamily->getHusband()) { $husbnams = $cfamily->getHusband()->getAllNames(); - if ($husbnams[0]['surname']=="@N.N." || $husbnams[0]['surname']=="") { + if ($husbnams[0]['surname'] == "@N.N." || $husbnams[0]['surname'] == "") { // if Husband or his name is not known then use wifes birth name $husbnam = $nam[0]['surname']; } else { $husbnam = $husbnams[0]['surname']; } } - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $husbnam; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $husbnam; } } $label = get_close_relationship_name($person, $gparent); @@ -649,14 +649,14 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$gparent->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $gparent->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> </td> <td align="left" class="facts_value nowrap"> <a href='#' onclick='insertRowToTable("<?php - echo $gparent->getXref() ; // pid = PID + echo $gparent->getXref(); // pid = PID ?>", "<?php echo WT_Filter::escapeHtml($fulln); // nam = Full Name ?>", "<?php @@ -666,7 +666,7 @@ if (!defined('WT_WEBTREES')) { echo WT_Filter::escapeHtml($fulln); // mnam = Full Name } ?>", "<?php - if ($person ===$gparent) { + if ($person === $gparent) { echo 'head'; } else { echo WT_Filter::escapeHtml($label); @@ -674,21 +674,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $gparent->getSex(); // gend = Gender ?>", "<?php - if ($married>=0 && isset($nam[1])) { + if ($married >= 0 && isset($nam[1])) { echo "M"; // cond = Condition (Married) } else { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -706,13 +706,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Step Wife Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $gparent->getSex()=="F") { + if (isset($chBLDarray) && $gparent->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $gparent->getFullName(); // Full Name (Link) + echo $gparent->getFullName(); // Full Name (Link) ?> </a> </td> @@ -724,33 +724,33 @@ if (!defined('WT_WEBTREES')) { foreach ($family->getChildren() as $child) { // Get Child’s Children - $chBLDarray=Array(); + $chBLDarray = Array(); foreach ($child->getSpouseFamilies() as $childfamily) { $chchildren = $childfamily->getChildren(); foreach ($chchildren as $chchild) { $chnam = $chchild->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); $chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name - $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } $nam = $child->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; - $chfulmn=null; + $chfulmn = null; $chnam = $child->getAllNames(); - for ($i=0; $i<count($nam); $i++) { - if ($chnam[$i]['type']=='_MARNM') { - $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $chnam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($chnam[$i]['type'] == '_MARNM') { + $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $chnam[$i]['surname']; } } $label = get_close_relationship_name($person, $child); @@ -767,7 +767,7 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$child->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $child->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> @@ -777,7 +777,7 @@ if (!defined('WT_WEBTREES')) { if (($child->canShow())) { ?> <a href='#' onclick='insertRowToTable("<?php - echo $child->getXref() ; // pid = PID + echo $child->getXref(); // pid = PID ?>", "<?php echo WT_Filter::escapeHtml($fulln); // nam = Full Name ?>", "<?php @@ -798,14 +798,14 @@ if (!defined('WT_WEBTREES')) { echo ""; // cond = Condition (Married or Single) ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$child->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $child->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -823,13 +823,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Child Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $child->getSex()=="F") { + if (isset($chBLDarray) && $child->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $child->getFullName(); // Full Name (Link) + echo $child->getFullName(); // Full Name (Link) ?> </a> <?php @@ -853,13 +853,13 @@ if (!defined('WT_WEBTREES')) { $chBLDarray = Array(); foreach ($family->getChildren() as $child) { $chnam = $child->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); $chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name - $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } @@ -867,7 +867,7 @@ if (!defined('WT_WEBTREES')) { if ($family->getHusband()) { //-- Spouse Husbands Parents -------------------------------------- - $gparent=$family->getHusband(); + $gparent = $family->getHusband(); foreach ($gparent->getChildFamilies() as $cfamily) { $phusb = $cfamily->getHusband(); $pwife = $cfamily->getWife(); @@ -878,14 +878,14 @@ if (!defined('WT_WEBTREES')) { //-- Spouse Husbands Details -------------------------------------- $married = WT_Date::Compare($censdate, $marrdate); $nam = $gparent->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $label = get_close_relationship_name($person, $gparent); @@ -902,14 +902,14 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$gparent->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $gparent->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> </td> <td align="left" class="facts_value nowrap"> <a href='#' onclick='insertRowToTable("<?php - echo $gparent->getXref() ; // pid = PID + echo $gparent->getXref(); // pid = PID ?>", "<?php echo WT_Filter::escapeHtml($fulln); // nam = Full Name ?>", "<?php @@ -927,21 +927,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $gparent->getSex(); // gend = Gender ?>", "<?php - if ($married>=0) { + if ($married >= 0) { echo "M"; // cond = Condition (Married) } else { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -959,13 +959,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Husband Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $gparent->getSex()=="F") { + if (isset($chBLDarray) && $gparent->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $gparent->getFullName(); // Full Name (Link) + echo $gparent->getFullName(); // Full Name (Link) ?> </a> </td> @@ -977,7 +977,7 @@ if (!defined('WT_WEBTREES')) { if ($family->getWife()) { //-- Spouse Wifes Parents -------------------------------------- - $gparent=$family->getWife(); + $gparent = $family->getWife(); $cfamily = null; foreach ($gparent->getChildFamilies() as $cfamily) { $husb = $cfamily->getHusband(); @@ -989,25 +989,25 @@ if (!defined('WT_WEBTREES')) { //-- Spouse Wifes Details -------------------------------------- $married = WT_Date::Compare($censdate, $marrdate); $nam = $gparent->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; $husbnam = null; // Get wifes married name if available if ($cfamily && $cfamily->getHusband()) { $husbnams = $cfamily->getHusband()->getAllNames(); - if ($husbnams[0]['surname']=="@N.N." || $husbnams[0]['surname']=="") { + if ($husbnams[0]['surname'] == "@N.N." || $husbnams[0]['surname'] == "") { // if Husband or his name is not known then use wifes birth name $husbnam = $nam[0]['surname']; } else { $husbnam = $husbnams[0]['surname']; } } - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $husbnam; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $husbnam; } } $label = get_close_relationship_name($person, $gparent); @@ -1024,14 +1024,14 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$gparent->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $gparent->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> </td> <td align="left" class="facts_value nowrap"> <a href='#' onclick='insertRowToTable("<?php - echo $gparent->getXref() ; // pid = PID + echo $gparent->getXref(); // pid = PID ?>", "<?php echo WT_Filter::escapeHtml($fulln); // nam = Full Name ?>", "<?php @@ -1049,21 +1049,21 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $gparent->getSex(); // gend = Gender ?>", "<?php - if ($married>=0 && isset($nam[1])) { + if ($married >= 0 && isset($nam[1])) { echo "M"; // cond = Condition (Married) } else { echo "S"; // cond = Condition (Single) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -1081,13 +1081,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Wife Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $gparent->getSex()=="F") { + if (isset($chBLDarray) && $gparent->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $gparent->getFullName(); // Full Name (Link) + echo $gparent->getFullName(); // Full Name (Link) ?> </a> </td> @@ -1098,42 +1098,42 @@ if (!defined('WT_WEBTREES')) { foreach ($family->getChildren() as $child) { // Get Spouse child’s marriage status - $married=""; - $marrdate=""; + $married = ""; + $marrdate = ""; foreach ($child->getSpouseFamilies() as $childfamily) { - $marrdate=$childfamily->getMarriageDate(); + $marrdate = $childfamily->getMarriageDate(); $married = WT_Date::Compare($censdate, $marrdate); } // Get Child’s Children - $chBLDarray=Array(); + $chBLDarray = Array(); foreach ($child->getSpouseFamilies() as $childfamily) { $chchildren = $childfamily->getChildren(); foreach ($chchildren as $chchild) { $chnam = $chchild->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); $chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name// Child’s Full Name - $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } // Get Spouse child’s details $nam = $child->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $givn = rtrim($nam[0]['givn'],'*'); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $givn = rtrim($nam[0]['givn'], '*'); $surn = $nam[0]['surname']; - $chfulmn=null; + $chfulmn = null; $chnam = $child->getAllNames(); - for ($i=0; $i<count($nam); $i++) { - if ($chnam[$i]['type']=='_MARNM') { - $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $chnam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($chnam[$i]['type'] == '_MARNM') { + $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $chnam[$i]['surname']; } } $label = get_close_relationship_name($person, $child); @@ -1148,7 +1148,7 @@ if (!defined('WT_WEBTREES')) { </td> <td align="left" class="facts_value"> <?php - echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=".$child->getXref()."&gedcom=".WT_GEDURL."\">"; + echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $child->getXref() . "&gedcom=" . WT_GEDURL . "\">"; echo $headImg2; echo "</a>"; ?> @@ -1158,7 +1158,7 @@ if (!defined('WT_WEBTREES')) { if (($child->canShow())) { ?> <a href='#' onclick='insertRowToTable("<?php - echo $child->getXref() ; // pid = PID + echo $child->getXref(); // pid = PID ?>", "<?php echo WT_Filter::escapeHtml($fulln); // nam = Full Name ?>", "<?php @@ -1176,23 +1176,23 @@ if (!defined('WT_WEBTREES')) { ?>", "<?php echo $child->getSex(); // gend = Gender ?>", "<?php - if ($married>0) { + if ($married > 0) { echo "M"; // cond = Condition (Married) - } else if ($married<0 || ($married=="0") ) { + } else if ($married < 0 || ($married == "0")) { echo "S"; // cond = Condition (Single) } else { echo ""; // cond = Condition (Not Known) } ?>", "<?php if ($marrdate) { - echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian) + echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian) } ?>", "<?php - echo ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian) + echo ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian) ?>", "<?php - echo $censyear-$child->getbirthyear(); // age = Census Date minus YOB + echo $censyear - $child->getbirthyear(); // age = Census Date minus YOB ?>", "<?php - echo ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian) + echo ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian) ?>", "<?php echo ""; // occu = Occupation ?>", "<?php @@ -1210,13 +1210,13 @@ if (!defined('WT_WEBTREES')) { echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Child Mother’s Place of Birth Not known } ?>", "<?php - if (isset($chBLDarray) && $child->getSex()=="F") { + if (isset($chBLDarray) && $child->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); echo $chBLDarray; // Array of Children (name, birthdate, deathdate) } ?>");'> <?php - echo $child->getFullName(); // Full Name (Link) + echo $child->getFullName(); // Full Name (Link) ?> </a> <?php @@ -1253,9 +1253,9 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent; global $natdad, $natmom, $censyear; - $person=WT_Individual::getInstance($pid); + $person = WT_Individual::getInstance($pid); - $tmp = array('M'=>'','F'=>'F', 'U'=>'NN'); + $tmp = array('M'=>'', 'F'=>'F', 'U'=>'NN'); $isF = $tmp[$person->getSex()]; $spouselinks = ''; $parentlinks = ''; @@ -1264,20 +1264,20 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { if ($person->canShowName()) { //-- draw a box for the family popup - if ($TEXT_DIRECTION=="rtl") { + if ($TEXT_DIRECTION == "rtl") { $spouselinks .= "<table class=\"rtlnav person_box$isF\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; - $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" .$person->getFullName(). ")<br>"; + $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>"; $parentlinks .= "<table class=\"rtlnav person_box$isF\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; - $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>"; + $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; $step_parentlinks .= "<table class=\"rtlnav person_box$isF\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; - $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>"; + $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; } else { $spouselinks .= "<table class=\"ltrnav person_box$isF\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; - $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" .$person->getFullName(). ")<br>"; + $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>"; $parentlinks .= "<table class=\"ltrnav person_box$isF\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; - $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>"; + $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; $step_parentlinks .= "<table class=\"ltrnav person_box$isF\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; - $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>"; + $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; } $persons = ''; @@ -1296,13 +1296,13 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $chBLDarray = Array(); foreach ($children as $child) { $chnam = $child->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; $chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; - $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; + $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } @@ -1311,7 +1311,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { if ($husb || $children) { if ($husb) { // Parent Husbands Parents - $gparent=WT_Individual::getInstance($husb->getXref()); + $gparent = WT_Individual::getInstance($husb->getXref()); $parfams = $gparent->getChildFamilies(); foreach ($parfams as $pfamily) { $phusb = $pfamily->getHusband(); @@ -1324,54 +1324,54 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $person_parent = 'Yes'; if ($husb->canShowName()) { $nam = $husb->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable("; - $parentlinks .= "'".$husb->getXref()."',"; // pid = PID - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name + $parentlinks .= "'" . $husb->getXref() . "',"; // pid = PID + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name if (isset($fulmn)) { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Married Name + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Married Name } else { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name } - if ($currpid=="Wife" || $currpid=="Husband") { + if ($currpid == "Wife" || $currpid == "Husband") { $parentlinks .= "'Father in Law',"; // label = 1st Gen Male Relationship } else { $parentlinks .= "'Grand-Father',"; // label = 2st Gen Male Relationship } - $parentlinks .= "'".$husb->getSex()."',"; // sex = Gender - $parentlinks .= "''".","; // cond = Condition (Married etc) + $parentlinks .= "'" . $husb->getSex() . "',"; // sex = Gender + $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'".(($husb->getBirthDate()->minJD()+$husb->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth - if ($husb->getbirthyear()>=1) { - $parentlinks .= "'".($censyear-$husb->getbirthyear())."',"; // age = Census Year - Year of Birth + $parentlinks .= "'" . (($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + if ($husb->getbirthyear() >= 1) { + $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { - $parentlinks .= "''".","; // age = Undefined + $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'".(($husb->getDeathDate()->minJD()+$husb->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death - $parentlinks .= "''".","; // occu = Occupation - $parentlinks .= "'".WT_Filter::escapeHtml($husb->getBirthPlace())."'".","; // birthpl = Individuals Birthplace + $parentlinks .= "'" . (($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "''" . ","; // occu = Occupation + $parentlinks .= "'" . WT_Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pHusbFBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pHusbFBP)."'".","; // fbirthpl = Fathers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace } if (isset($pHusbMBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pHusbMBP)."'".","; // mbirthpl = Mothers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace } - if (isset($chBLDarray) && $husb->getSex()=="F") { + if (isset($chBLDarray) && $husb->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); - $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate) + $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } @@ -1399,59 +1399,59 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { } // Parent Wifes Details - $person_parent="Yes"; + $person_parent = "Yes"; if ($wife->canShowName()) { $nam = $wife->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable("; - $parentlinks .= "'".$wife->getXref()."',"; // pid = PID - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; + $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; if (isset($fulmn)) { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulmn))."',"; + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',"; } else { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; } - if ($currpid=="Wife" || $currpid=="Husband") { + if ($currpid == "Wife" || $currpid == "Husband") { $parentlinks .= "'Mother in Law',"; // label = 1st Gen Female Relationship } else { $parentlinks .= "'Grand-Mother',"; // label = 2st Gen Female Relationship } - $parentlinks .= "'".$wife->getSex()."',"; // sex = Gender - $parentlinks .= "''".","; // cond = Condition (Married etc) + $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender + $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'".(($wife->getBirthDate()->minJD()+$wife->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth - if ($wife->getbirthyear()>=1) { - $parentlinks .= "'".($censyear-$wife->getbirthyear())."',"; // age = Census Year - Year of Birth + $parentlinks .= "'" . (($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + if ($wife->getbirthyear() >= 1) { + $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { - $parentlinks .= "''".","; // age = Undefined + $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'".(($wife->getDeathDate()->minJD()+$wife->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death - $parentlinks .= "''".","; // occu = Occupation - $parentlinks .= "'".WT_Filter::escapeHtml($wife->getBirthPlace())."'".","; // birthpl = Individuals Birthplace + $parentlinks .= "'" . (($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "''" . ","; // occu = Occupation + $parentlinks .= "'" . WT_Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pWifeFBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pWifeFBP)."'".","; // fbirthpl = Fathers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($pWifeMBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pWifeMBP)."'".","; // mbirthpl = Mothers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } - if (isset($chBLDarray) && $wife->getSex()=="F") { + if (isset($chBLDarray) && $wife->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); - $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate) + $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } @@ -1478,13 +1478,13 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $chBLDarray = Array(); foreach ($children as $child) { $chnam = $child->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; $chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; - $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; + $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } @@ -1495,7 +1495,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { if (($husb || $children) && $husb !== $person) { if ($husb) { // Step Husbands Parents - $gparent=WT_Individual::getInstance($husb->getXref()); + $gparent = WT_Individual::getInstance($husb->getXref()); $parfams = $gparent->getChildFamilies(); foreach ($parfams as $pfamily) { $phusb = $pfamily->getHusband(); @@ -1507,54 +1507,54 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $person_step = 'Yes'; if ($husb->canShowName()) { $nam = $husb->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable("; - $parentlinks .= "'".$husb->getXref()."',"; // pid = PID - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name + $parentlinks .= "'" . $husb->getXref() . "',"; // pid = PID + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name if (isset($fulmn)) { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Married Name + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Married Name } else { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name } - if ($currpid=="Wife" || $currpid=="Husband") { + if ($currpid == "Wife" || $currpid == "Husband") { $parentlinks .= "'Step Father-in-Law',"; // label = 1st Gen Male Relationship } else { $parentlinks .= "'Step Grand-Father',"; // label = 2st Gen Male Relationship } - $parentlinks .= "'".$husb->getSex()."',"; // sex = Gender - $parentlinks .= "''".","; // cond = Condition (Married etc) + $parentlinks .= "'" . $husb->getSex() . "',"; // sex = Gender + $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'".(($husb->getBirthDate()->minJD()+$husb->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth - if ($husb->getbirthyear()>=1) { - $parentlinks .= "'".($censyear-$husb->getbirthyear())."',"; // age = Census Year - Year of Birth + $parentlinks .= "'" . (($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + if ($husb->getbirthyear() >= 1) { + $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { - $parentlinks .= "''".","; // age = Undefined + $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'".(($husb->getDeathDate()->minJD()+$husb->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death - $parentlinks .= "''".","; // occu = Occupation - $parentlinks .= "'".WT_Filter::escapeHtml($husb->getBirthPlace())."'".","; // birthpl = Individuals Birthplace + $parentlinks .= "'" . (($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "''" . ","; // occu = Occupation + $parentlinks .= "'" . WT_Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pHusbFBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pHusbFBP)."'".","; // fbirthpl = Fathers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace } if (isset($pHusbMBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pHusbMBP)."'".","; // mbirthpl = Mothers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace } - if (isset($chBLDarray) && $husb->getSex()=="F") { + if (isset($chBLDarray) && $husb->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); - $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate) + $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } @@ -1575,7 +1575,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { if ($wife || $children) { if ($wife) { // Step Wifes Parents - $gparent=WT_Individual::getInstance($wife->getXref()); + $gparent = WT_Individual::getInstance($wife->getXref()); $parfams = $gparent->getChildFamilies(); foreach ($parfams as $pfamily) { $pwhusb = $pfamily->getHusband(); @@ -1587,56 +1587,56 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $person_step = 'Yes'; if ($wife->canShowName()) { $nam = $wife->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM') { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM') { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable("; - $parentlinks .= "'".$wife->getXref()."',"; // pid = PID - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name + $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name if (isset($fulmn)) { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulmn))."',"; // mnam = Full Married Name + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',"; // mnam = Full Married Name } else { - $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name + $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name } - if ($currpid=="Wife" || $currpid=="Husband") { + if ($currpid == "Wife" || $currpid == "Husband") { $parentlinks .= "'Step Mother-in-Law',"; // label = 1st Gen Female Relationship } else { $parentlinks .= "'Step Grand-Mother',"; // label = 2st Gen Female Relationship } - $parentlinks .= "'".$wife->getSex()."',"; // sex = Gender - $parentlinks .= "''".","; // cond = Condition (Married etc) + $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender + $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'".(($wife->getBirthDate()->minJD()+$wife->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth - if ($wife->getbirthyear()>=1) { - $parentlinks .= "'".($censyear-$wife->getbirthyear())."',"; // age = Census Year - Year of Birth + $parentlinks .= "'" . (($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + if ($wife->getbirthyear() >= 1) { + $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { - $parentlinks .= "''".","; // age = Undefined + $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'".(($wife->getDeathDate()->minJD()+$wife->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death - $parentlinks .= "''".","; // occu = Occupation - $parentlinks .= "'".WT_Filter::escapeHtml($wife->getBirthPlace())."'".","; // birthpl = Individuals Birthplace + $parentlinks .= "'" . (($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "''" . ","; // occu = Occupation + $parentlinks .= "'" . WT_Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pWifeFBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pWifeFBP)."'".","; // fbirthpl = Fathers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($pWifeMBP)) { - $parentlinks .= "'".WT_Filter::escapeHtml($pWifeMBP)."'".","; // mbirthpl = Mothers Birthplace + $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { - $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known + $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } - if (isset($chBLDarray) && $wife->getSex()=="F") { + if (isset($chBLDarray) && $wife->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); - $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate) + $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } @@ -1663,13 +1663,13 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $chBLDarray = Array(); foreach ($children as $child) { $chnam = $child->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; $chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); // Child’s Full Name - $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); // Child’s Full Name + $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } @@ -1679,7 +1679,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { if ($spouse) { // Spouse Parents - $gparent=WT_Individual::getInstance($spouse->getXref()); + $gparent = WT_Individual::getInstance($spouse->getXref()); $spousefams = $gparent->getChildFamilies(); foreach ($spousefams as $pfamily) { $phusb = $pfamily->getHusband(); @@ -1691,67 +1691,67 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { // Spouse Details if ($spouse->canShowName()) { $nam = $spouse->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); // If spouse is a wife, then get her married name or default to her birth name - for ($i=0; $i<count($nam); $i++) { - if ($nam[$i]['type']=='_MARNM' && $is_wife) { - $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname']; + for ($i = 0; $i < count($nam); $i++) { + if ($nam[$i]['type'] == '_MARNM' && $is_wife) { + $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname']; } else { $fulmn = $fulln; } } $spouselinks .= "<a href=\"#\" onclick=\"insertRowToTable("; - $spouselinks .= "'".$spouse->getXref()."',"; // pid = PID - $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; + $spouselinks .= "'" . $spouse->getXref() . "',"; // pid = PID + $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; if (isset($fulmn)) { - $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulmn))."',"; + $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',"; } else { - $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; + $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; } - if ($currpid=="Son" || $currpid=="Daughter") { - if ($spouse->getSex()=="M") { + if ($currpid == "Son" || $currpid == "Daughter") { + if ($spouse->getSex() == "M") { $spouselinks .= "'Son in Law',"; // label = Male Relationship } else { $spouselinks .= "'Daughter in Law',"; // label = Female Relationship } } else { - if ($spouse->getSex()=="M") { + if ($spouse->getSex() == "M") { $spouselinks .= "'Brother in Law',"; // label = Male Relationship } else { $spouselinks .= "'Sister in Law',"; // label = Female Relationship } } - $spouselinks .= "'".$spouse->getSex()."',"; // sex = Gender - $spouselinks .= "''".","; // cond = Condition (Married etc) + $spouselinks .= "'" . $spouse->getSex() . "',"; // sex = Gender + $spouselinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $spouselinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; + $spouselinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; } - $spouselinks .= "'".(($spouse->getBirthDate()->minJD()+$spouse->getBirthDate()->maxJD())/2)."',"; - if ($spouse->getbirthyear()>=1) { - $spouselinks .= "'".($censyear-$spouse->getbirthyear())."',"; // age = Census Year - Year of Birth + $spouselinks .= "'" . (($spouse->getBirthDate()->minJD() + $spouse->getBirthDate()->maxJD()) / 2) . "',"; + if ($spouse->getbirthyear() >= 1) { + $spouselinks .= "'" . ($censyear - $spouse->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { - $spouselinks .= "''".","; // age = Undefined + $spouselinks .= "''" . ","; // age = Undefined } - $spouselinks .= "'".(($spouse->getDeathDate()->minJD()+$spouse->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death - $spouselinks .= "''".","; // occu = Occupation - $spouselinks .= "'".WT_Filter::escapeHtml($spouse->getBirthPlace())."'".","; // birthpl = Individuals Birthplace + $spouselinks .= "'" . (($spouse->getDeathDate()->minJD() + $spouse->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $spouselinks .= "''" . ","; // occu = Occupation + $spouselinks .= "'" . WT_Filter::escapeHtml($spouse->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pSpouseFBP)) { - $spouselinks .= "'".WT_Filter::escapeHtml($pSpouseFBP)."'".","; // fbirthpl = Fathers Birthplace + $spouselinks .= "'" . WT_Filter::escapeHtml($pSpouseFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { - $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known + $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($pSpouseMBP)) { - $spouselinks .= "'".WT_Filter::escapeHtml($pSpouseMBP)."'".","; // mbirthpl = Mothers Birthplace + $spouselinks .= "'" . WT_Filter::escapeHtml($pSpouseMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { - $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known + $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } - if (isset($chBLDarray) && $spouse->getSex()=="F") { + if (isset($chBLDarray) && $spouse->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); - $spouselinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate) + $spouselinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $spouselinks .= "''"; } @@ -1771,10 +1771,10 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { // Children $spouselinks .= "<ul class=\"clist\">"; foreach ($children as $child) { - $persons="Yes"; + $persons = "Yes"; // Child’s Parents - $gparent=WT_Individual::getInstance($child->getXref()); + $gparent = WT_Individual::getInstance($child->getXref()); foreach ($gparent->getChildFamilies() as $family) { $husb = $family->getHusband(); $wife = $family->getWife(); @@ -1783,18 +1783,18 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { } // Child’s Children - $chBLDarray=Array(); + $chBLDarray = Array(); foreach ($child->getSpouseFamilies() as $childfamily) { $chchildren = $childfamily->getChildren(); foreach ($chchildren as $chchild) { $chnam = $chchild->getAllNames(); - $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname']; + $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname']; $chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here - $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln); - $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); // Child’s Full Name - $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian) - $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian) - $chBLD = ($chfulln.", ".$chdob.", ".$chdod); + $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); + $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); // Child’s Full Name + $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); } } @@ -1812,75 +1812,75 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $spouselinks .= '<li>'; if ($child->canShowName()) { $nam = $child->getAllNames(); - $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname']; - $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln); - $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln); + $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname']; + $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); + $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln); // Get childs married name if available - $chfulmn=null; + $chfulmn = null; $chnam = $child->getAllNames(); - if ($chhusbnam[0]['surname']=="@N.N." || $chhusbnam[0]['surname']=="") { + if ($chhusbnam[0]['surname'] == "@N.N." || $chhusbnam[0]['surname'] == "") { // if Husband or his name is not known then use wifes birth name $husbnam = $nam[0]['surname']; } else { $husbnam = $chhusbnam[0]['surname']; } - for ($i=0; $i<count($nam); $i++) { - if ($chnam[$i]['type']=='_MARNM') { - $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $husbnam; + for ($i = 0; $i < count($nam); $i++) { + if ($chnam[$i]['type'] == '_MARNM') { + $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $husbnam; } } $spouselinks .= "<a href=\"#\" onclick=\"insertRowToTable("; - $spouselinks .= "'".$child->getXref()."',"; - $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name + $spouselinks .= "'" . $child->getXref() . "',"; + $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name if (isset($chfulmn)) { - $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($chfulmn))."',"; // mnam = Full Married Name + $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($chfulmn)) . "',"; // mnam = Full Married Name } else { - $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name + $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name } - if ($currpid=="Son" || $currpid=="Daughter") { - if ($child->getSex()=="M") { + if ($currpid == "Son" || $currpid == "Daughter") { + if ($child->getSex() == "M") { $spouselinks .= "'Grand-Son',"; // label = Male Relationship } else { $spouselinks .= "'Grand-Daughter',"; // label = Female Relationship } } else { - if ($child->getSex()=="M") { + if ($child->getSex() == "M") { $spouselinks .= "'Nephew',"; // label = Male Relationship } else { $spouselinks .= "'Niece',"; // label = Female Relationship } } - $spouselinks .= "'".$child->getSex()."',"; // sex = Gender - $spouselinks .= "''".","; // cond = Condition (Married etc) + $spouselinks .= "'" . $child->getSex() . "',"; // sex = Gender + $spouselinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $spouselinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian) + $spouselinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) } else { - $spouselinks .= "'nm'".","; + $spouselinks .= "'nm'" . ","; } - $spouselinks .= "'".(($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth - if ($child->getbirthyear()>=1) { - $spouselinks .= "'".($censyear-$child->getbirthyear())."',"; // age = Census Year - Year of Birth + $spouselinks .= "'" . (($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + if ($child->getbirthyear() >= 1) { + $spouselinks .= "'" . ($censyear - $child->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { - $spouselinks .= "''".","; // age = Undefined + $spouselinks .= "''" . ","; // age = Undefined } - $spouselinks .= "'".(($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death - $spouselinks .= "''".","; // occu = Occupation - $spouselinks .= "'".WT_Filter::escapeHtml($child->getBirthPlace())."'".","; // birthpl = Individuals Birthplace + $spouselinks .= "'" . (($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $spouselinks .= "''" . ","; // occu = Occupation + $spouselinks .= "'" . WT_Filter::escapeHtml($child->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($ChildFBP)) { - $spouselinks .= "'".WT_Filter::escapeHtml($ChildFBP)."'".","; // fbirthpl = Fathers Birthplace + $spouselinks .= "'" . WT_Filter::escapeHtml($ChildFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { - $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known + $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($ChildMBP)) { - $spouselinks .= "'".WT_Filter::escapeHtml($ChildMBP)."'".","; // mbirthpl = Mothers Birthplace + $spouselinks .= "'" . WT_Filter::escapeHtml($ChildMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { - $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known + $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } - if (isset($chBLDarray) && $child->getSex()=="F") { + if (isset($chBLDarray) && $child->getSex() == "F") { $chBLDarray = implode("::", $chBLDarray); - $spouselinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate) + $spouselinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $spouselinks .= "''"; } diff --git a/modules_v3/batch_update/admin_batch_update.php b/modules_v3/batch_update/admin_batch_update.php index 8a7caa8aa3..d6db1e0a43 100644 --- a/modules_v3/batch_update/admin_batch_update.php +++ b/modules_v3/batch_update/admin_batch_update.php @@ -24,17 +24,17 @@ require_once WT_ROOT . 'includes/functions/functions_edit.php'; * Class batch_update */ class batch_update { - var $plugin =null; // Form parameter: chosen plugin - var $xref =null; // Form parameter: record to update - var $action =null; // Form parameter: how to update record - var $data =null; // Form parameter: additional details for $action - var $plugins =null; // Array of available plugins - var $PLUGIN =null; // An instance of a plugin object - var $all_xrefs=null; // An array of all xrefs that might need to be updated - var $prev_xref=null; // The previous xref to process - var $curr_xref=null; // The xref to process - var $next_xref=null; // The next xref to process - var $record =null; // A GedcomRecord object corresponding to $curr_xref + var $plugin = null; // Form parameter: chosen plugin + var $xref = null; // Form parameter: record to update + var $action = null; // Form parameter: how to update record + var $data = null; // Form parameter: additional details for $action + var $plugins = null; // Array of available plugins + var $PLUGIN = null; // An instance of a plugin object + var $all_xrefs = null; // An array of all xrefs that might need to be updated + var $prev_xref = null; // The previous xref to process + var $curr_xref = null; // The xref to process + var $next_xref = null; // The next xref to process + var $record = null; // A GedcomRecord object corresponding to $curr_xref /** * What is the name of this plugin? @@ -52,64 +52,64 @@ class batch_update { */ function main() { // HTML common to all pages - $html= - self::getJavascript(). - '<form id="batch_update_form" action="module.php" method="get">'. - '<input type="hidden" name="mod" value="batch_update">'. - '<input type="hidden" name="mod_action" value="admin_batch_update">'. - '<input type="hidden" name="xref" value="'.$this->xref.'">'. - '<input type="hidden" name="action" value="">'. // will be set by javascript for next update - '<input type="hidden" name="data" value="">'. // will be set by javascript for next update - '<table id="batch_update"><tr>'. - '<th>'.WT_I18N::translate('Family tree').'</th>'. - '<td>'.select_edit_control('ged', WT_Tree::getNameList(), '', WT_GEDCOM, 'onchange="reset_reload();"'). - '</td></tr><tr><th>'.WT_I18N::translate('Batch update').'</th><td><select name="plugin" onchange="reset_reload();">'; + $html = + self::getJavascript() . + '<form id="batch_update_form" action="module.php" method="get">' . + '<input type="hidden" name="mod" value="batch_update">' . + '<input type="hidden" name="mod_action" value="admin_batch_update">' . + '<input type="hidden" name="xref" value="' . $this->xref . '">' . + '<input type="hidden" name="action" value="">' . // will be set by javascript for next update + '<input type="hidden" name="data" value="">' . // will be set by javascript for next update + '<table id="batch_update"><tr>' . + '<th>' . WT_I18N::translate('Family tree') . '</th>' . + '<td>' . select_edit_control('ged', WT_Tree::getNameList(), '', WT_GEDCOM, 'onchange="reset_reload();"') . + '</td></tr><tr><th>' . WT_I18N::translate('Batch update') . '</th><td><select name="plugin" onchange="reset_reload();">'; if (!$this->plugin) { - $html.='<option value="" selected="selected"></option>'; + $html .= '<option value="" selected="selected"></option>'; } foreach ($this->plugins as $class=>$plugin) { - $html.='<option value="'.$class.'"'.($this->plugin==$class ? ' selected="selected"' : '').'>'.$plugin->getName().'</option>'; + $html .= '<option value="' . $class . '"' . ($this->plugin == $class ? ' selected="selected"' : '') . '>' . $plugin->getName() . '</option>'; } - $html.='</select>'; + $html .= '</select>'; if ($this->PLUGIN) { - $html.='<br><em>'.$this->PLUGIN->getDescription().'</em>'; + $html .= '<br><em>' . $this->PLUGIN->getDescription() . '</em>'; } - $html.='</td></tr>'; + $html .= '</td></tr>'; if (!Auth::user()->getPreference('auto_accept')) { - $html.='<tr><td colspan="2" class="warning">'.WT_I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.').'</td></tr>'; + $html .= '<tr><td colspan="2" class="warning">' . WT_I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.') . '</td></tr>'; } // If a plugin is selected, display the details if ($this->PLUGIN) { - $html.=$this->PLUGIN->getOptionsForm(); - if (substr($this->action, -4)=='_all') { + $html .= $this->PLUGIN->getOptionsForm(); + if (substr($this->action, -4) == '_all') { // Reset - otherwise we might "undo all changes", which refreshes the // page, which makes them all again! - $html.='<script>reset_reload();</script>'; + $html .= '<script>reset_reload();</script>'; } else { if ($this->curr_xref) { // Create an object, so we can get the latest version of the name. - $this->record=WT_GedcomRecord::getInstance($this->curr_xref); + $this->record = WT_GedcomRecord::getInstance($this->curr_xref); - $html.= - '</table><table id="batch_update2"><tr><td>'. - self::createSubmitButton(WT_I18N::translate('previous'), $this->prev_xref). - self::createSubmitButton(WT_I18N::translate('next'), $this->next_xref). - '</td><th><a href="'.$this->record->getHtmlUrl().'">'.$this->record->getFullName().'</a>'. - '</th>'. - '</tr><tr><td valign="top">'. - '<br>'.implode('<br>',$this->PLUGIN->getActionButtons($this->curr_xref, $this->record)).'<br>'. - '</td><td dir="ltr" align="left">'. + $html .= + '</table><table id="batch_update2"><tr><td>' . + self::createSubmitButton(WT_I18N::translate('previous'), $this->prev_xref) . + self::createSubmitButton(WT_I18N::translate('next'), $this->next_xref) . + '</td><th><a href="' . $this->record->getHtmlUrl() . '">' . $this->record->getFullName() . '</a>' . + '</th>' . + '</tr><tr><td valign="top">' . + '<br>' . implode('<br>', $this->PLUGIN->getActionButtons($this->curr_xref, $this->record)) . '<br>' . + '</td><td dir="ltr" align="left">' . $this->PLUGIN->getActionPreview($this->record) . '</td></tr>'; } else { - $html.='<tr><td class="accepted" colspan=2>'.WT_I18N::translate('Nothing found.').'</td></tr>'; + $html .= '<tr><td class="accepted" colspan=2>' . WT_I18N::translate('Nothing found.') . '</td></tr>'; } } } - $html.='</table></form>'; + $html .= '</table></form>'; return $html; } @@ -118,24 +118,24 @@ class batch_update { * Constructor - initialise variables and validate user-input */ public function __construct() { - $this->plugins=self::getPluginList(); // List of available plugins - $this->plugin =WT_Filter::get('plugin'); // User parameters - $this->xref =WT_Filter::get('xref', WT_REGEX_XREF); - $this->action =WT_Filter::get('action'); - $this->data =WT_Filter::get('data'); + $this->plugins = self::getPluginList(); // List of available plugins + $this->plugin = WT_Filter::get('plugin'); // User parameters + $this->xref = WT_Filter::get('xref', WT_REGEX_XREF); + $this->action = WT_Filter::get('action'); + $this->data = WT_Filter::get('data'); // Don't do any processing until a plugin is chosen. if ($this->plugin && array_key_exists($this->plugin, $this->plugins)) { - $this->PLUGIN=new $this->plugin; + $this->PLUGIN = new $this->plugin; $this->PLUGIN->getOptions(); $this->getAllXrefs(); switch ($this->action) { case 'update': - $record=self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]); + $record = self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]); if ($this->PLUGIN->doesRecordNeedUpdate($this->xref, $record)) { - $newrecord=$this->PLUGIN->updateRecord($this->xref, $record); - if ($newrecord!=$record) { + $newrecord = $this->PLUGIN->updateRecord($this->xref, $record); + if ($newrecord != $record) { if ($newrecord) { WT_GedcomRecord::getInstance($this->xref)->updateRecord($newrecord, $this->PLUGIN->chan); } else { @@ -143,14 +143,14 @@ class batch_update { } } } - $this->xref=$this->findNextXref($this->xref); + $this->xref = $this->findNextXref($this->xref); break; case 'update_all': foreach ($this->all_xrefs as $xref=>$type) { - $record=self::getLatestRecord($xref, $type); + $record = self::getLatestRecord($xref, $type); if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) { - $newrecord=$this->PLUGIN->updateRecord($xref, $record); - if ($newrecord!=$record) { + $newrecord = $this->PLUGIN->updateRecord($xref, $record); + if ($newrecord != $record) { if ($newrecord) { WT_GedcomRecord::getInstance($this->xref)->updateRecord($newrecord, $this->PLUGIN->chan); } else { @@ -159,7 +159,7 @@ class batch_update { } } } - $this->xref=''; + $this->xref = ''; return; default: break; @@ -170,20 +170,20 @@ class batch_update { // been specified at all. if (array_key_exists($this->xref, $this->all_xrefs) && $this->PLUGIN->doesRecordNeedUpdate($this->xref, self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]))) { - $this->curr_xref=$this->xref; + $this->curr_xref = $this->xref; } // The requested record doesn't need updating - find one that does if (!$this->curr_xref) { - $this->curr_xref=$this->findNextXref($this->xref); + $this->curr_xref = $this->findNextXref($this->xref); } if (!$this->curr_xref) { - $this->curr_xref=$this->findPrevXref($this->xref); + $this->curr_xref = $this->findPrevXref($this->xref); } // If we've found a record to update, get details and look for the next/prev if ($this->curr_xref) { - $this->record=self::getLatestRecord($this->curr_xref, $this->all_xrefs[$this->curr_xref]); - $this->prev_xref=$this->findPrevXref($this->curr_xref); - $this->next_xref=$this->findNextXref($this->curr_xref); + $this->record = self::getLatestRecord($this->curr_xref, $this->all_xrefs[$this->curr_xref]); + $this->prev_xref = $this->findPrevXref($this->curr_xref); + $this->next_xref = $this->findNextXref($this->curr_xref); } } } @@ -197,8 +197,8 @@ class batch_update { */ function findNextXref($xref) { foreach (array_keys($this->all_xrefs) as $key) { - if ($key>$xref) { - $record=self::getLatestRecord($key, $this->all_xrefs[$key]); + if ($key > $xref) { + $record = self::getLatestRecord($key, $this->all_xrefs[$key]); if ($this->PLUGIN->doesRecordNeedUpdate($key, $record)) { return $key; } @@ -216,8 +216,8 @@ class batch_update { */ function findPrevXref($xref) { foreach (array_reverse(array_keys($this->all_xrefs)) as $key) { - if ($key<$xref) { - $record=self::getLatestRecord($key, $this->all_xrefs[$key]); + if ($key < $xref) { + $record = self::getLatestRecord($key, $this->all_xrefs[$key]); if ($this->PLUGIN->doesRecordNeedUpdate($key, $record)) { return $key; } @@ -230,36 +230,36 @@ class batch_update { * Generate a list of all XREFs. */ function getAllXrefs() { - $sql=array(); - $vars=array(); + $sql = array(); + $vars = array(); foreach ($this->PLUGIN->getRecordTypesToUpdate() as $type) { switch ($type) { case 'INDI': - $sql[]="SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?"; - $vars[]=WT_GED_ID; + $sql[] = "SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?"; + $vars[] = WT_GED_ID; break; case 'FAM': - $sql[]="SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?"; - $vars[]=WT_GED_ID; + $sql[] = "SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?"; + $vars[] = WT_GED_ID; break; case 'SOUR': - $sql[]="SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?"; - $vars[]=WT_GED_ID; + $sql[] = "SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?"; + $vars[] = WT_GED_ID; break; case 'OBJE': - $sql[]="SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?"; - $vars[]=WT_GED_ID; + $sql[] = "SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?"; + $vars[] = WT_GED_ID; break; default: - $sql[]="SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?"; - $vars[]=$type; - $vars[]=$type; - $vars[]=WT_GED_ID; + $sql[] = "SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?"; + $vars[] = $type; + $vars[] = $type; + $vars[] = WT_GED_ID; break; } } - $this->all_xrefs= - WT_DB::prepare(implode(' UNION ', $sql).' ORDER BY 1 ASC') + $this->all_xrefs = + WT_DB::prepare(implode(' UNION ', $sql) . ' ORDER BY 1 ASC') ->execute($vars) ->fetchAssoc(); } @@ -270,14 +270,14 @@ class batch_update { * @return base_plugin[] */ static function getPluginList() { - $array=array(); - $dir=dirname(__FILE__).'/plugins/'; - $dir_handle=opendir($dir); - while ($file=readdir($dir_handle)) { - if (substr($file, -4)=='.php') { - require dirname(__FILE__).'/plugins/'.$file; - $class=basename($file, '.php').'_bu_plugin'; - $array[$class]=new $class; + $array = array(); + $dir = dirname(__FILE__) . '/plugins/'; + $dir_handle = opendir($dir); + while ($file = readdir($dir_handle)) { + if (substr($file, -4) == '.php') { + require dirname(__FILE__) . '/plugins/' . $file; + $class = basename($file, '.php') . '_bu_plugin'; + $array[$class] = new $class; } } closedir($dir_handle); @@ -292,13 +292,13 @@ class batch_update { */ static function getJavascript() { return - '<script>'. - 'function reset_reload() {'. - ' var bu_form=document.getElementById("batch_update_form");'. - ' bu_form.xref.value="";'. - ' bu_form.action.value="";'. - ' bu_form.data.value="";'. - ' bu_form.submit();'. + '<script>' . + 'function reset_reload() {' . + ' var bu_form=document.getElementById("batch_update_form");' . + ' bu_form.xref.value="";' . + ' bu_form.action.value="";' . + ' bu_form.data.value="";' . + ' bu_form.submit();' . '}</script>' ; } @@ -313,14 +313,14 @@ class batch_update { * * @return string */ - static function createSubmitButton($text, $xref, $action='', $data='') { + static function createSubmitButton($text, $xref, $action = '', $data = '') { return - '<input type="submit" value="'.$text.'" onclick="'. - 'this.form.xref.value=\''.WT_Filter::escapeHtml($xref).'\';'. - 'this.form.action.value=\''.WT_Filter::escapeHtml($action).'\';'. - 'this.form.data.value=\''.WT_Filter::escapeHtml($data).'\';'. - 'return true;"'. - ($xref ? '' : ' disabled').'>'; + '<input type="submit" value="' . $text . '" onclick="' . + 'this.form.xref.value=\'' . WT_Filter::escapeHtml($xref) . '\';' . + 'this.form.action.value=\'' . WT_Filter::escapeHtml($action) . '\';' . + 'this.form.data.value=\'' . WT_Filter::escapeHtml($data) . '\';' . + 'return true;"' . + ($xref ? '' : ' disabled') . '>'; } /** @@ -361,7 +361,7 @@ class batch_update { * string updateRecord($xref, $gedrec) */ class base_plugin { - var $chan=false; // User option; update change record + var $chan = false; // User option; update change record /** * Default is to operate on INDI records @@ -376,7 +376,7 @@ class base_plugin { * Default option is just the "don't update CHAN record" */ function getOptions() { - $this->chan=WT_Filter::getBool('chan'); + $this->chan = WT_Filter::getBool('chan'); } /** @@ -386,10 +386,10 @@ class base_plugin { */ function getOptionsForm() { return - '<tr><th>'.WT_I18N::translate('Do not update the “last change” record').'</th>'. - '<td><select name="chan" onchange="this.form.submit();">'. - '<option value="0"' . ($this->chan ? '' : ' selected="selected"') . '>'.WT_I18N::translate('yes') .'</option>'. - '<option value="1"' . ($this->chan ? ' selected="selected"' : '') . '>'.WT_I18N::translate('no').'</option>'. + '<tr><th>' . WT_I18N::translate('Do not update the “last change” record') . '</th>' . + '<td><select name="chan" onchange="this.form.submit();">' . + '<option value="0"' . ($this->chan ? '' : ' selected="selected"') . '>' . WT_I18N::translate('yes') . '</option>' . + '<option value="1"' . ($this->chan ? ' selected="selected"' : '') . '>' . WT_I18N::translate('no') . '</option>' . '</select></td></tr>'; } @@ -403,12 +403,12 @@ class base_plugin { function getActionButtons($xref) { if (Auth::user()->getPreference('auto_accept')) { return array( - batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'), + batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'), batch_update::createSubmitButton(WT_I18N::translate('Update all'), $xref, 'update_all') ); } else { return array( - batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update') + batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update') ); } } @@ -421,34 +421,34 @@ class base_plugin { * @return string */ function getActionPreview(WT_GedcomRecord $record) { - $old_lines=preg_split('/[\n]+/', $record->getGedcom()); - $new_lines=preg_split('/[\n]+/', $this->updateRecord($record->getXref(), $record->getGedcom())); + $old_lines = preg_split('/[\n]+/', $record->getGedcom()); + $new_lines = preg_split('/[\n]+/', $this->updateRecord($record->getXref(), $record->getGedcom())); // Find matching lines using longest-common-subsequence algorithm. - $lcs=self::LongestCommonSubsequence($old_lines, $new_lines, 0, count($old_lines)-1, 0, count($new_lines)-1); + $lcs = self::LongestCommonSubsequence($old_lines, $new_lines, 0, count($old_lines) - 1, 0, count($new_lines) - 1); - $diff_lines=array(); - $last_old=-1; - $last_new=-1; + $diff_lines = array(); + $last_old = -1; + $last_new = -1; while ($lcs) { - list($old, $new)=array_shift($lcs); - while ($last_old<$old-1) { - $diff_lines[]=self::decorateDeletedText($old_lines[++$last_old]); + list($old, $new) = array_shift($lcs); + while ($last_old < $old - 1) { + $diff_lines[] = self::decorateDeletedText($old_lines[++$last_old]); } - while ($last_new<$new-1) { - $diff_lines[]=self::decorateInsertedText($new_lines[++$last_new]); + while ($last_new < $new - 1) { + $diff_lines[] = self::decorateInsertedText($new_lines[++$last_new]); } - $diff_lines[]=$new_lines[$new]; - $last_old=$old; - $last_new=$new; + $diff_lines[] = $new_lines[$new]; + $last_old = $old; + $last_new = $new; } - while ($last_old<count($old_lines)-1) { - $diff_lines[]=self::decorateDeletedText($old_lines[++$last_old]); + while ($last_old < count($old_lines) - 1) { + $diff_lines[] = self::decorateDeletedText($old_lines[++$last_old]); } - while ($last_new<count($new_lines)-1) { - $diff_lines[]=self::decorateInsertedText($new_lines[++$last_new]); + while ($last_new < count($new_lines) - 1) { + $diff_lines[] = self::decorateInsertedText($new_lines[++$last_new]); } - return '<pre>'.self::createEditLinks(implode("\n", $diff_lines)).'</pre>'; + return '<pre>' . self::createEditLinks(implode("\n", $diff_lines)) . '</pre>'; } /** @@ -464,21 +464,21 @@ class base_plugin { * @return array */ private static function LongestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2) { - if ($x2-$x1>=0 && $y2-$y1>=0) { - if ($X[$x1]==$Y[$y1]) { + if ($x2 - $x1 >= 0 && $y2 - $y1 >= 0) { + if ($X[$x1] == $Y[$y1]) { // Match at start of sequence - $tmp=self::LongestCommonSubsequence($X, $Y, $x1+1, $x2, $y1+1, $y2); + $tmp = self::LongestCommonSubsequence($X, $Y, $x1 + 1, $x2, $y1 + 1, $y2); array_unshift($tmp, array($x1, $y1)); return $tmp; - } elseif ($X[$x2]==$Y[$y2]) { + } elseif ($X[$x2] == $Y[$y2]) { // Match at end of sequence - $tmp=self::LongestCommonSubsequence($X, $Y, $x1, $x2-1, $y1, $y2-1); + $tmp = self::LongestCommonSubsequence($X, $Y, $x1, $x2 - 1, $y1, $y2 - 1); array_push($tmp, array($x2, $y2)); return $tmp; } else { // No match. Look for subsequences - $tmp1=self::LongestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2-1); - $tmp2=self::LongestCommonSubsequence($X, $Y, $x1, $x2-1, $y1, $y2); + $tmp1 = self::LongestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2 - 1); + $tmp2 = self::LongestCommonSubsequence($X, $Y, $x1, $x2 - 1, $y1, $y2); return count($tmp1) > count($tmp2) ? $tmp1 : $tmp2; } } else { @@ -495,7 +495,7 @@ class base_plugin { * @return string */ static function decorateInsertedText($text) { - return '<span class="added_text">'.$text.'</span>'; + return '<span class="added_text">' . $text . '</span>'; } /** @@ -506,7 +506,7 @@ class base_plugin { * @return string */ static function decorateDeletedText($text) { - return '<span class="deleted_text">'.$text.'</span>'; + return '<span class="deleted_text">' . $text . '</span>'; } /** diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php index 5a9af2c51d..a61cb1ce90 100644 --- a/modules_v3/googlemap/module.php +++ b/modules_v3/googlemap/module.php @@ -47,7 +47,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // Create GM tables, if not already present try { - WT_DB::updateSchema(WT_ROOT.WT_MODULES_DIR.'/googlemap/db_schema/', 'GM_SCHEMA_VERSION', 5); + WT_DB::updateSchema(WT_ROOT . WT_MODULES_DIR . '/googlemap/db_schema/', 'GM_SCHEMA_VERSION', 5); } catch (PDOException $ex) { // The schema update scripts should never fail. If they do, there is no clean recovery. die($ex); @@ -56,21 +56,21 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // Set default values try { // TODO: do this once only, in a db_schema upgrade script? - $this->setSetting('GM_MAP_TYPE', $this->getSetting('GM_MAP_TYPE', 'G_NORMAL_MAP')); // G_PHYSICAL_MAP, G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP - $this->setSetting('GM_MAX_ZOOM', $this->getSetting('GM_MAX_ZOOM', '20')); // max zoom level - $this->setSetting('GM_MIN_ZOOM', $this->getSetting('GM_MIN_ZOOM', '2')); // min zoom level - $this->setSetting('GM_PRECISION_0', $this->getSetting('GM_PRECISION_0', '0')); // Country level - $this->setSetting('GM_PRECISION_1', $this->getSetting('GM_PRECISION_1', '1')); // State level - $this->setSetting('GM_PRECISION_2', $this->getSetting('GM_PRECISION_2', '2')); // City level - $this->setSetting('GM_PRECISION_3', $this->getSetting('GM_PRECISION_3', '3')); // Neighborhood level - $this->setSetting('GM_PRECISION_4', $this->getSetting('GM_PRECISION_4', '4')); // House level - $this->setSetting('GM_PRECISION_5', $this->getSetting('GM_PRECISION_5', '5')); // Max prcision level - $this->setSetting('GM_XSIZE', $this->getSetting('GM_XSIZE', '600')); // X-size of Google map - $this->setSetting('GM_YSIZE', $this->getSetting('GM_YSIZE', '400')); // Y-size of Google map - $this->setSetting('GM_PH_XSIZE', $this->getSetting('GM_PH_XSIZE', '500')); // X-size of Place Hierarchy Google map - $this->setSetting('GM_PH_YSIZE', $this->getSetting('GM_PH_YSIZE', '350')); // Y-size of Place Hierarchy Google map - $this->setSetting('GM_PH_MARKER', $this->getSetting('GM_PH_MARKER', 'G_FLAG')); // Possible values: G_FLAG = Flag, G_DEFAULT_ICON = Standard icon - $this->setSetting('GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE', '0')); // Display full place name or only the actual level name + $this->setSetting('GM_MAP_TYPE', $this->getSetting('GM_MAP_TYPE', 'G_NORMAL_MAP')); // G_PHYSICAL_MAP, G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP + $this->setSetting('GM_MAX_ZOOM', $this->getSetting('GM_MAX_ZOOM', '20')); // max zoom level + $this->setSetting('GM_MIN_ZOOM', $this->getSetting('GM_MIN_ZOOM', '2')); // min zoom level + $this->setSetting('GM_PRECISION_0', $this->getSetting('GM_PRECISION_0', '0')); // Country level + $this->setSetting('GM_PRECISION_1', $this->getSetting('GM_PRECISION_1', '1')); // State level + $this->setSetting('GM_PRECISION_2', $this->getSetting('GM_PRECISION_2', '2')); // City level + $this->setSetting('GM_PRECISION_3', $this->getSetting('GM_PRECISION_3', '3')); // Neighborhood level + $this->setSetting('GM_PRECISION_4', $this->getSetting('GM_PRECISION_4', '4')); // House level + $this->setSetting('GM_PRECISION_5', $this->getSetting('GM_PRECISION_5', '5')); // Max prcision level + $this->setSetting('GM_XSIZE', $this->getSetting('GM_XSIZE', '600')); // X-size of Google map + $this->setSetting('GM_YSIZE', $this->getSetting('GM_YSIZE', '400')); // Y-size of Google map + $this->setSetting('GM_PH_XSIZE', $this->getSetting('GM_PH_XSIZE', '500')); // X-size of Place Hierarchy Google map + $this->setSetting('GM_PH_YSIZE', $this->getSetting('GM_PH_YSIZE', '350')); // Y-size of Place Hierarchy Google map + $this->setSetting('GM_PH_MARKER', $this->getSetting('GM_PH_MARKER', 'G_FLAG')); // Possible values: G_FLAG = Flag, G_DEFAULT_ICON = Standard icon + $this->setSetting('GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE', '0')); // Display full place name or only the actual level name } catch (Exception $ex) { // Perhaps the module hasn't been installed yet (no entry in wt_modules) } @@ -88,7 +88,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu /** {@inheritdoc} */ public function modAction($mod_action) { - switch($mod_action) { + switch ($mod_action) { case 'admin_config': $this->config(); break; @@ -118,7 +118,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu /** {@inheritdoc} */ public function getConfigLink() { - return 'module.php?mod='.$this->getName().'&mod_action=admin_config'; + return 'module.php?mod=' . $this->getName() . '&mod_action=admin_config'; } /** {@inheritdoc} */ @@ -165,7 +165,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_places">', WT_I18N::translate('Geographic data'), '</a>'; echo '</td>'; echo '<td width="25%" align="right">'; - echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_placecheck">', WT_I18N::translate('Place check'),'</a>'; + echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_placecheck">', WT_I18N::translate('Place check'), '</a>'; echo '</td>'; echo '</tr></table>'; } @@ -197,15 +197,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // end echo '</td></tr></table>'; echo '<script>loadMap();</script>'; - return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>'; + return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; } else { - $html='<table class="facts_table">'; - $html.='<tr><td colspan="2" class="facts_value">'.WT_I18N::translate('No map data for this person'); - $html.='</td></tr>'; + $html = '<table class="facts_table">'; + $html .= '<tr><td colspan="2" class="facts_value">' . WT_I18N::translate('No map data for this person'); + $html .= '</td></tr>'; if (Auth::isAdmin()) { - $html.='<tr><td class="center" colspan="2">'; - $html.='<a href="module.php?mod=googlemap&mod_action=admin_config">'.WT_I18N::translate('Google Maps™ preferences'). '</a>'; - $html.='</td></tr>'; + $html .= '<tr><td class="center" colspan="2">'; + $html .= '<a href="module.php?mod=googlemap&mod_action=admin_config">' . WT_I18N::translate('Google Maps™ preferences') . '</a>'; + $html .= '</td></tr>'; } return $html; } @@ -227,7 +227,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu * A form to edit the module configuration. */ private function config() { - require WT_ROOT.'includes/functions/functions_edit.php'; + require WT_ROOT . 'includes/functions/functions_edit.php'; $action = WT_Filter::post('action'); @@ -238,28 +238,28 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu ->pageHeader() ->addInlineJavascript('jQuery("#tabs").tabs();'); - if ($action=='update') { - $this->setSetting('GM_MAP_TYPE', WT_Filter::post('NEW_GM_MAP_TYPE')); - $this->setSetting('GM_USE_STREETVIEW', WT_Filter::post('NEW_GM_USE_STREETVIEW')); - $this->setSetting('GM_MIN_ZOOM', WT_Filter::post('NEW_GM_MIN_ZOOM')); - $this->setSetting('GM_MAX_ZOOM', WT_Filter::post('NEW_GM_MAX_ZOOM')); - $this->setSetting('GM_XSIZE', WT_Filter::post('NEW_GM_XSIZE')); - $this->setSetting('GM_YSIZE', WT_Filter::post('NEW_GM_YSIZE')); - $this->setSetting('GM_PRECISION_0', WT_Filter::post('NEW_GM_PRECISION_0')); - $this->setSetting('GM_PRECISION_1', WT_Filter::post('NEW_GM_PRECISION_1')); - $this->setSetting('GM_PRECISION_2', WT_Filter::post('NEW_GM_PRECISION_2')); - $this->setSetting('GM_PRECISION_3', WT_Filter::post('NEW_GM_PRECISION_3')); - $this->setSetting('GM_PRECISION_4', WT_Filter::post('NEW_GM_PRECISION_4')); - $this->setSetting('GM_PRECISION_5', WT_Filter::post('NEW_GM_PRECISION_5')); - $this->setSetting('GM_COORD', WT_Filter::post('NEW_GM_COORD')); - $this->setSetting('GM_PLACE_HIERARCHY', WT_Filter::post('NEW_GM_PLACE_HIERARCHY')); - $this->setSetting('GM_PH_XSIZE', WT_Filter::post('NEW_GM_PH_XSIZE')); - $this->setSetting('GM_PH_YSIZE', WT_Filter::post('NEW_GM_PH_YSIZE')); - $this->setSetting('GM_PH_MARKER', WT_Filter::post('NEW_GM_PH_MARKER')); - $this->setSetting('GM_DISP_SHORT_PLACE', WT_Filter::post('NEW_GM_DISP_SHORT_PLACE')); + if ($action == 'update') { + $this->setSetting('GM_MAP_TYPE', WT_Filter::post('NEW_GM_MAP_TYPE')); + $this->setSetting('GM_USE_STREETVIEW', WT_Filter::post('NEW_GM_USE_STREETVIEW')); + $this->setSetting('GM_MIN_ZOOM', WT_Filter::post('NEW_GM_MIN_ZOOM')); + $this->setSetting('GM_MAX_ZOOM', WT_Filter::post('NEW_GM_MAX_ZOOM')); + $this->setSetting('GM_XSIZE', WT_Filter::post('NEW_GM_XSIZE')); + $this->setSetting('GM_YSIZE', WT_Filter::post('NEW_GM_YSIZE')); + $this->setSetting('GM_PRECISION_0', WT_Filter::post('NEW_GM_PRECISION_0')); + $this->setSetting('GM_PRECISION_1', WT_Filter::post('NEW_GM_PRECISION_1')); + $this->setSetting('GM_PRECISION_2', WT_Filter::post('NEW_GM_PRECISION_2')); + $this->setSetting('GM_PRECISION_3', WT_Filter::post('NEW_GM_PRECISION_3')); + $this->setSetting('GM_PRECISION_4', WT_Filter::post('NEW_GM_PRECISION_4')); + $this->setSetting('GM_PRECISION_5', WT_Filter::post('NEW_GM_PRECISION_5')); + $this->setSetting('GM_COORD', WT_Filter::post('NEW_GM_COORD')); + $this->setSetting('GM_PLACE_HIERARCHY', WT_Filter::post('NEW_GM_PLACE_HIERARCHY')); + $this->setSetting('GM_PH_XSIZE', WT_Filter::post('NEW_GM_PH_XSIZE')); + $this->setSetting('GM_PH_YSIZE', WT_Filter::post('NEW_GM_PH_YSIZE')); + $this->setSetting('GM_PH_MARKER', WT_Filter::post('NEW_GM_PH_MARKER')); + $this->setSetting('GM_DISP_SHORT_PLACE', WT_Filter::post('NEW_GM_DISP_SHORT_PLACE')); - for ($i=1; $i<=9; $i++) { - $this->setSetting('GM_PREFIX_' . $i, WT_Filter::post('NEW_GM_PREFIX_' . $i)); + for ($i = 1; $i <= 9; $i++) { + $this->setSetting('GM_PREFIX_' . $i, WT_Filter::post('NEW_GM_PREFIX_' . $i)); $this->setSetting('GM_POSTFIX_' . $i, WT_Filter::post('NEW_GM_POSTFIX_' . $i)); } @@ -310,7 +310,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </tr> <tr> <th><?php echo /* I18N: http://en.wikipedia.org/wiki/Google_street_view */ WT_I18N::translate('Google Street View™'); ?></th> - <td><?php echo radio_buttons('NEW_GM_USE_STREETVIEW', array(false=>WT_I18N::translate('hide'),true=>WT_I18N::translate('show')), $this->getSetting('GM_USE_STREETVIEW')); ?></td> + <td><?php echo radio_buttons('NEW_GM_USE_STREETVIEW', array(false=>WT_I18N::translate('hide'), true=>WT_I18N::translate('show')), $this->getSetting('GM_USE_STREETVIEW')); ?></td> </tr> <tr> <th><?php echo WT_I18N::translate('Size of map (in pixels)'); ?></th> @@ -322,16 +322,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </td> </tr> <tr> - <th><?php echo WT_I18N::translate('Zoom level of map'), help_link('GM_MAP_ZOOM','googlemap'); ?></th> + <th><?php echo WT_I18N::translate('Zoom level of map'), help_link('GM_MAP_ZOOM', 'googlemap'); ?></th> <td> <?php echo WT_I18N::translate('minimum'); ?>: <select name="NEW_GM_MIN_ZOOM"> - <?php for ($j=1; $j < 15; $j++) { ?> - <option value="<?php echo $j, "\""; if ($this->getSetting('GM_MIN_ZOOM')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 1; $j < 15; $j++) { ?> + <option value="<?php echo $j, "\""; if ($this->getSetting('GM_MIN_ZOOM') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('maximum'); ?>: <select name="NEW_GM_MAX_ZOOM"> - <?php for ($j=1; $j < 21; $j++) { ?> - <option value="<?php echo $j, "\""; if ($this->getSetting('GM_MAX_ZOOM')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 1; $j < 21; $j++) { ?> + <option value="<?php echo $j, "\""; if ($this->getSetting('GM_MAX_ZOOM') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> </td> @@ -342,14 +342,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <div id="gm_advanced"> <table class="gm_edit_config"> <tr> - <th colspan="2"><?php echo WT_I18N::translate('Precision of the latitude and longitude'), help_link('GM_PRECISION','googlemap'); ?></th> + <th colspan="2"><?php echo WT_I18N::translate('Precision of the latitude and longitude'), help_link('GM_PRECISION', 'googlemap'); ?></th> <td> <table> <tr> <td><?php echo WT_I18N::translate('Country'); ?> </td> <td><select name="NEW_GM_PRECISION_0"> - <?php for ($j=0; $j < 10; $j++) { ?> - <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_0')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 0; $j < 10; $j++) { ?> + <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_0') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('digits'); ?> </td> @@ -357,8 +357,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <tr> <td><?php echo WT_I18N::translate('State'); ?> </td> <td><select name="NEW_GM_PRECISION_1"> - <?php for ($j=0; $j < 10; $j++) { ?> - <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_1')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 0; $j < 10; $j++) { ?> + <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_1') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('digits'); ?> </td> @@ -366,32 +366,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <tr> <td><?php echo WT_I18N::translate('City'); ?> </td> <td><select name="NEW_GM_PRECISION_2"> - <?php for ($j=0; $j < 10; $j++) { ?> - <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_2')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 0; $j < 10; $j++) { ?> + <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_2') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('digits'); ?> </td> </tr> <tr><td><?php echo WT_I18N::translate('Neighborhood'); ?> </td> <td><select name="NEW_GM_PRECISION_3"> - <?php for ($j=0; $j < 10; $j++) { ?> - <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_3')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 0; $j < 10; $j++) { ?> + <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_3') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('digits'); ?> </td> </tr> <tr><td><?php echo WT_I18N::translate('House'); ?> </td> <td><select name="NEW_GM_PRECISION_4"> - <?php for ($j=0; $j < 10; $j++) { ?> - <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_4')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 0; $j < 10; $j++) { ?> + <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_4') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('digits'); ?> </td> </tr> <tr><td><?php echo WT_I18N::translate('Max'); ?> </td> <td><select name="NEW_GM_PRECISION_5"> - <?php for ($j=0; $j < 10; $j++) { ?> - <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_5')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option> + <?php for ($j = 0; $j < 10; $j++) { ?> + <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_5') == $j) echo " selected=\"selected\""; echo ">", $j; ?></option> <?php } ?> </select> <?php echo WT_I18N::translate('digits'); ?> </td> @@ -400,17 +400,17 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </td> <td></td> </tr> - <th class="gm_prefix" colspan="3"><?php echo WT_I18N::translate('Optional prefixes and suffixes'), help_link('GM_NAME_PREFIX_SUFFIX','googlemap');?></th> + <th class="gm_prefix" colspan="3"><?php echo WT_I18N::translate('Optional prefixes and suffixes'), help_link('GM_NAME_PREFIX_SUFFIX', 'googlemap'); ?></th> </tr> <tr id="gm_level_titles"> <th></th> <th><?php echo WT_I18N::translate('Prefixes'); ?></th> <th><?php echo WT_I18N::translate('Suffixes'); ?></th> - <?php for ($level=1; $level < 10; $level++) { ?> + <?php for ($level = 1; $level < 10; $level++) { ?> <tr class="gm_levels"> <th> <?php - if ($level==1) { + if ($level == 1) { echo WT_I18N::translate('Country'); } else { echo WT_I18N::translate('Level'), " ", $level; @@ -443,17 +443,17 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <th><?php echo WT_I18N::translate('Type of place markers in Place Hierarchy'); ?></th> <td> <select name="NEW_GM_PH_MARKER"> - <option value="G_DEFAULT_ICON" <?php if ($this->getSetting('GM_PH_MARKER')=="G_DEFAULT_ICON") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Standard'); ?></option> - <option value="G_FLAG" <?php if ($this->getSetting('GM_PH_MARKER')=="G_FLAG") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Flag'); ?></option> + <option value="G_DEFAULT_ICON" <?php if ($this->getSetting('GM_PH_MARKER') == "G_DEFAULT_ICON") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Standard'); ?></option> + <option value="G_FLAG" <?php if ($this->getSetting('GM_PH_MARKER') == "G_FLAG") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Flag'); ?></option> </select> </td> </tr> <tr> - <th><?php echo WT_I18N::translate('Display short placenames'), help_link('GM_DISP_SHORT_PLACE','googlemap'); ?></th> + <th><?php echo WT_I18N::translate('Display short placenames'), help_link('GM_DISP_SHORT_PLACE', 'googlemap'); ?></th> <td><?php echo edit_field_yes_no('NEW_GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE')); ?></td> </tr> <tr> - <th><?php echo WT_I18N::translate('Display map coordinates'), help_link('GM_COORD','googlemap'); ?></th> + <th><?php echo WT_I18N::translate('Display map coordinates'), help_link('GM_COORD', 'googlemap'); ?></th> <td><?php echo edit_field_yes_no('NEW_GM_COORD', $this->getSetting('GM_COORD')); ?></td> </tr> </table> @@ -491,7 +491,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $action = WT_Filter::post('action'); $countrySelected = WT_Filter::get('countrySelected', null, 'Countries'); - $stateSelected = WT_Filter::get('stateSelected', null, 'States'); + $stateSelected = WT_Filter::get('stateSelected', null, 'States'); $country = array(); if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags')) { @@ -525,7 +525,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected); while ($file = readdir($rep)) { if (stristr($file, '.png')) { - $flags_s[] = substr($file, 0, strlen($file)-4); + $flags_s[] = substr($file, 0, strlen($file) - 4); } } closedir($rep); @@ -538,7 +538,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <?php if ($_POST['selcountry'] == 'Countries') { ?> window.opener.document.editplaces.icon.value = 'places/flags/<?php echo $flags[$_POST['FLAGS']]; ?>.png'; window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?>googlemap/places/flags/<?php echo $country[$_POST['FLAGS']]; ?>.png\"> <a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a> <a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>"; - <?php } elseif ($_POST['selstate'] != "States"){ ?> + <?php } elseif ($_POST['selstate'] != "States") { ?> window.opener.document.editplaces.icon.value = 'places/<?php echo $countrySelected, '/flags/', $_POST['selstate'], '/', $flags_s[$_POST['FLAGS']]; ?>.png'; window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?>googlemap/places/<?php echo $countrySelected, "/flags/", $_POST['selstate'], "/", $flags_s[$_POST['FLAGS']]; ?>.png\"> <a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a> <a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>"; <?php } else { ?> @@ -566,10 +566,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <?php } $countryList = array(); - $placesDir = scandir(WT_MODULES_DIR.'googlemap/places/'); + $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/'); for ($i = 0; $i < count($country); $i++) { - if (count(preg_grep('/'.$country[$i].'/', $placesDir)) != 0) { - $rep = opendir(WT_MODULES_DIR.'googlemap/places/'.$country[$i].'/'); + if (count(preg_grep('/' . $country[$i] . '/', $placesDir)) != 0) { + $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $country[$i] . '/'); while ($file = readdir($rep)) { if (stristr($file, 'flags')) { if (isset($countries[$country[$i]])) { @@ -585,10 +585,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu asort($countryList); $stateList = array(); if ($countrySelected != 'Countries') { - $placesDir = scandir(WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'); + $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/'); for ($i = 0; $i < count($flags); $i++) { if (in_array($flags[$i], $placesDir)) { - $rep = opendir(WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$flags[$i].'/'); + $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $flags[$i] . '/'); while ($file = readdir($rep)) { $stateList[$flags[$i]] = $flags[$i]; } @@ -606,7 +606,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <table class="facts_table"> <tr> <td class="optionbox" colspan="4"> - <?php echo help_link('PLE_FLAGS','googlemap'); ?> + <?php echo help_link('PLE_FLAGS', 'googlemap'); ?> <select name="COUNTRYSELECT" dir="ltr" onchange="selectCountry()"> <option value="Countries"><?php echo WT_I18N::translate('Countries'); ?></option> <?php foreach ($countryList as $country_key=>$country_name) { @@ -622,15 +622,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $j = 1; for ($i = 0; $i < count($flags); $i++) { if ($countrySelected == 'Countries') { - $tempstr = '<td><input type="radio" dir="ltr" name="FLAGS" value="'.$i.'"><img src="'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/places/flags/'.$flags[$i].'.png" alt="'.$flags[$i].'" title="'; - if ($flags[$i]!='blank') { + $tempstr = '<td><input type="radio" dir="ltr" name="FLAGS" value="' . $i . '"><img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/places/flags/' . $flags[$i] . '.png" alt="' . $flags[$i] . '" title="'; + if ($flags[$i] != 'blank') { if (isset($countries[$flags[$i]])) { - $tempstr.=$countries[$flags[$i]]; + $tempstr .= $countries[$flags[$i]]; } else { - $tempstr.=$flags[$i]; + $tempstr .= $flags[$i]; } } else { - $tempstr.=$countries['???']; + $tempstr .= $countries['???']; } echo $tempstr, '"> ', $flags[$i], '</input></td>'; } else { @@ -643,13 +643,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $j++; } echo '</tr><tr'; - if ($countrySelected == 'Countries' || count($stateList)==0) { + if ($countrySelected == 'Countries' || count($stateList) == 0) { echo ' style=" visibility: hidden"'; } echo '>'; ?> <td class="optionbox" colspan="4"> - <?php echo help_link('PLE_FLAGS','googlemap'); ?> + <?php echo help_link('PLE_FLAGS', 'googlemap'); ?> <select name="STATESELECT" dir="ltr" onchange="selectCountry()"> <option value="States"><?php echo /* I18N: Part of a country, state/region/county */ WT_I18N::translate('Subdivision'); ?></option> <?php foreach ($stateList as $state_key=>$state_name) { @@ -665,7 +665,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $j = 1; for ($i = 0; $i < count($flags_s); $i++) { if ($stateSelected != 'States') { - echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i, '"><img src="', WT_STATIC_URL.WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flags_s[$i], '.png"> ', $flags_s[$i], '</input></td>'; + echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i, '"><img src="', WT_STATIC_URL . WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flags_s[$i], '.png"> ', $flags_s[$i], '</input></td>'; } if ($j == 4) { echo '</tr><tr>'; @@ -727,10 +727,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <?php echo WT_I18N::translate('Generations'); ?> </td> <td class="descriptionbox wrap"> - <?php echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags','googlemap'); ?> + <?php echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags', 'googlemap'); ?> </td> <td class="descriptionbox wrap"> - <?php echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines','googlemap'); ?> + <?php echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines', 'googlemap'); ?> </td> </tr> <tr> @@ -741,7 +741,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <td class="optionbox"> <select name="PEDIGREE_GENERATIONS"> <?php - for ($p=3; $p<=$MAX_PEDIGREE_GENERATIONS; $p++) { + for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) { echo '<option value="', $p, '" '; if ($p == $controller->PEDIGREE_GENERATIONS) { echo 'selected="selected"'; @@ -781,18 +781,18 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <!-- count records by type --> <?php - $curgen=1; - $priv=0; - $count=0; - $miscount=0; + $curgen = 1; + $priv = 0; + $count = 0; + $miscount = 0; $missing = ''; $latlongval = array(); $lat = array(); $lon = array(); - for ($i=0; $i<($controller->treesize); $i++) { + for ($i = 0; $i < ($controller->treesize); $i++) { // -- check to see if we have moved to the next generation - if ($i+1 >= pow(2, $curgen)) {$curgen++;} + if ($i + 1 >= pow(2, $curgen)) {$curgen++; } $person = $controller->ancestors[$i]; if (!empty($person)) { $name = $person->getFullName(); @@ -863,7 +863,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo '<td valign="top">'; // print summary statistics if (isset($curgen)) { - $total=pow(2,$curgen)-1; + $total = pow(2, $curgen) - 1; echo WT_I18N::plural( '%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.', '%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.', @@ -877,7 +877,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if ($priv) { echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>'; } - if ($count+$priv != $total) { + if ($count + $priv != $total) { if ($miscount == 0) { echo WT_I18N::translate('No ancestors in the database.'), "<br>"; } else { @@ -892,8 +892,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo '</td>'; echo '</tr>'; echo '</table>'; - echo '</div>';// close #pedigreemap_chart - echo '</div>';// close #pedigreemap-page + echo '</div>'; // close #pedigreemap_chart + echo '</div>'; // close #pedigreemap-page ?> <!-- end of map display --> <!-- Start of map scripts --> @@ -912,7 +912,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu global $controller, $SHOW_HIGHLIGHT_IMAGES, $PEDIGREE_GENERATIONS; // The HomeControl returns the map to the original position and style - $js='function HomeControl(controlDiv, pm_map) {'. + $js = 'function HomeControl(controlDiv, pm_map) {' . // Set CSS styles for the DIV containing the control // Setting padding to 5 px will offset the control from the edge of the map 'controlDiv.style.paddingTop = "5px"; @@ -935,7 +935,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu controlText.style.fontSize = "12px"; controlText.style.paddingLeft = "15px"; controlText.style.paddingRight = "15px"; - controlText.innerHTML = "<b>'.WT_I18N::translate('Redraw map').'<\/b>"; + controlText.innerHTML = "<b>'.WT_I18N::translate('Redraw map') . '<\/b>"; controlUI.appendChild(controlText);'. // Setup the click event listeners: simply set the map to original LatLng 'google.maps.event.addDomListener(controlUI, "click", function() { @@ -956,7 +956,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu google.maps.event.trigger(gmarkers[i], "click"); }'. // this variable will collect the html which will eventually be placed in the side_bar - 'var side_bar_html = "";'. + 'var side_bar_html = "";' . // arrays to hold copies of the markers and html used by the side_bar // because the function closure trick doesnt work there 'var gmarkers = []; @@ -1246,7 +1246,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu lastlinkid=linkid; });'. // save the info we need to use later for the side_bar - 'gmarkers[i] = marker;'. + 'gmarkers[i] = marker;' . // add a line to the side_bar html 'side_bar_html += "<br><div id=\'"+linkid+"\' onclick=\'myclick(" + i + ")\'>" + html +"<br></div>"; i++; @@ -1305,14 +1305,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $name = $person->getFullName(); // -- check to see if we have moved to the next generation - if ($i+1 >= pow(2, $curgen)) { + if ($i + 1 >= pow(2, $curgen)) { $curgen++; } $relationship = get_close_relationship_name($controller->root, $person); - $event = '<img src="'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/sq'.$curgen.'.png" width="10" height="10"> '. - '<strong>'.$relationship.'</strong>'; + $event = '<img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/sq' . $curgen . '.png" width="10" height="10"> ' . + '<strong>' . $relationship . '</strong>'; // add thumbnail image if ($SHOW_HIGHLIGHT_IMAGES) { $image = $person->displayImage(); @@ -1322,18 +1322,18 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // end of add image $dataleft = WT_Filter::escapeJs($image . $event . ' — ' . $name); - $datamid = WT_Filter::escapeJs(' <span><a href="' . $person->getHtmlUrl() . '">('.WT_I18N::translate('View person').')</a></span>'); - $dataright = WT_Filter::escapeJs('<br><strong>'. WT_I18N::translate('Birth:') . ' </strong>' . $person->getBirthDate()->display() . ' — ' . $person->getBirthPlace()); + $datamid = WT_Filter::escapeJs(' <span><a href="' . $person->getHtmlUrl() . '">(' . WT_I18N::translate('View person') . ')</a></span>'); + $dataright = WT_Filter::escapeJs('<br><strong>' . WT_I18N::translate('Birth:') . ' </strong>' . $person->getBirthDate()->display() . ' — ' . $person->getBirthPlace()); $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace()); if ($latlongval[$i]) { - $lat[$i] = (double)str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati); - $lon[$i] = (double)str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long); + $lat[$i] = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati); + $lon[$i] = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long); if ($lat[$i] || $lon[$i]) { if (!$hideflags && $latlongval[$i]->pl_icon) { $flags[$i] = $latlongval[$i]->pl_icon; $ffile = strrchr($latlongval[$i]->pl_icon, '/'); - $ffile = substr($ffile,1, strpos($ffile, '.')-1); + $ffile = substr($ffile, 1, strpos($ffile, '.') - 1); if (empty($flags[$ffile])) { $flags[$ffile] = $i; // Only generate the flag once $js .= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . ');'; @@ -1386,14 +1386,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $js .= "' title='" . WT_I18N::translate('Pedigree map') . "'>" . $dataleft . "</a>" . $datamid . $dataright . "</div>\", \"" . $marker_number . "\");"; // Construct the polygon lines if (!$hidelines) { - $to_child = (intval(($i-1)/2)); // Draw a line from parent to child - if (array_key_exists($to_child, $lat) && $lat[$to_child]!=0 && $lon[$to_child]!=0) { - $js.=' + $to_child = (intval(($i - 1) / 2)); // Draw a line from parent to child + if (array_key_exists($to_child, $lat) && $lat[$to_child] != 0 && $lon[$to_child] != 0) { + $js .= ' var linecolor; var plines; - var lines = [new google.maps.LatLng('.$lat[$i].','.$lon[$i].'), - new google.maps.LatLng('.$lat[$to_child].','.$lon[$to_child].')]; - linecolor = "'.$colored_line[$curgen].'"; + var lines = [new google.maps.LatLng('.$lat[$i] . ',' . $lon[$i] . '), + new google.maps.LatLng('.$lat[$to_child] . ',' . $lon[$to_child] . ')]; + linecolor = "'.$colored_line[$curgen] . '"; plines = new google.maps.Polygon({ paths: lines, strokeColor: linecolor, @@ -1406,8 +1406,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } } // Extend and fit marker bounds - $js.='bounds.extend(point);'; - $js.='pm_map.fitBounds(bounds);'; + $js .= 'bounds.extend(point);'; + $js .= 'pm_map.fitBounds(bounds);'; $count++; } } @@ -1415,23 +1415,23 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $latlongval[$i] = null; } } - $js.='pm_map.setCenter(bounds.getCenter());'. + $js .= 'pm_map.setCenter(bounds.getCenter());' . // Close the sidebar highlight when the infowindow is closed 'google.maps.event.addListener(infowindow, "closeclick", function() { document.getElementById(lastlinkid).className = "person_box:target"; });'. // put the assembled side_bar_html contents into the side_bar div - 'document.getElementById("side_bar").innerHTML = side_bar_html;'. + 'document.getElementById("side_bar").innerHTML = side_bar_html;' . // create the context menu div 'var contextmenu = document.createElement("div"); contextmenu.style.visibility="hidden"; - contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom in').' </div></a>" - + "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom out').' </div></a>" - + "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom in here').'</div></a>" - + "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom out here').' </div></a>" - + "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'> '.WT_I18N::translate('Center map here').' </div></a>";'. + contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom in') . ' </div></a>" + + "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom out') . ' </div></a>" + + "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom in here') . '</div></a>" + + "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'> '.WT_I18N::translate('Zoom out here') . ' </div></a>" + + "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'> '.WT_I18N::translate('Center map here') . ' </div></a>";' . // listen for singlerightclick - 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {'. + 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {' . // store the "pixel" info in case we need it later // adjust the context menu location if near an egde // create a GControlPosition @@ -1447,15 +1447,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu }); '. // functions that perform the context menu options - 'function zoomIn() {'. + 'function zoomIn() {' . // perform the requested operation - 'pm_map.zoomIn();'. + 'pm_map.zoomIn();' . // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } function zoomOut() {'. // perform the requested operation - 'pm_map.zoomOut();'. + 'pm_map.zoomOut();' . // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } @@ -1493,9 +1493,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu * ... */ private function adminPlaceCheck() { - require_once WT_ROOT.'includes/functions/functions_edit.php'; + require_once WT_ROOT . 'includes/functions/functions_edit.php'; - $action = WT_Filter::get('action', '','go'); + $action = WT_Filter::get('action', '', 'go'); $gedcom_id = WT_Filter::get('gedcom_id', null, WT_GED_ID); $country = WT_Filter::get('country', '.+', 'XYZ'); $state = WT_Filter::get('state', '.+', 'XYZ'); @@ -1511,16 +1511,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <table id="gm_config"> <tr> <th> - <a href="module.php?mod=googlemap&mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'),'</a> + <a href="module.php?mod=googlemap&mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a> </th> <th> <a href="module.php?mod=googlemap&mod_action=admin_places"> - ', WT_I18N::translate('Geographic data'),' + ', WT_I18N::translate('Geographic data'), ' </a> </th> <th> <a class="current" href="module.php?mod=googlemap&mod_action=admin_placecheck"> - ', WT_I18N::translate('Place check'),' + ', WT_I18N::translate('Place check'), ' </a> </th> </tr> @@ -1538,27 +1538,27 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <select name="country" onchange="this.form.submit();"> <option value="XYZ" selected="selected">', /* I18N: first/default option in a drop-down listbox */ WT_I18N::translate('<select>'), '</option> <option value="XYZ">', WT_I18N::translate('All'), '</option>'; - $rows=WT_DB::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place") + $rows = WT_DB::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place") ->fetchAssoc(); foreach ($rows as $id=>$place) { echo '<option value="', WT_Filter::escapeHtml($place), '"'; - if ($place==$country) { + if ($place == $country) { echo ' selected="selected"'; - $par_id=$id; + $par_id = $id; } echo '>', WT_Filter::escapeHtml($place), '</option>'; } echo '</select>'; - if ($country!='XYZ') { + if ($country != 'XYZ') { echo '<label>', /* I18N: Part of a country, state/region/county */ WT_I18N::translate('Subdivision'), '</label> <select name="state" onchange="this.form.submit();"> <option value="XYZ" selected="selected">', WT_I18N::translate('<select>'), '</option> <option value="XYZ">', WT_I18N::translate('All'), '</option>'; - $places=WT_DB::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") + $places = WT_DB::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") ->execute(array($par_id)) ->fetchOneColumn(); foreach ($places as $place) { - echo '<option value="', WT_Filter::escapeHtml($place), '"', $place==$state?' selected="selected"':'', '>', WT_Filter::escapeHtml($place), '</option>'; + echo '<option value="', WT_Filter::escapeHtml($place), '"', $place == $state ? ' selected="selected"' : '', '>', WT_Filter::escapeHtml($place), '</option>'; } echo '</select>'; } @@ -1568,63 +1568,63 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo ' checked="checked"'; } echo '>'; - echo '</div>';// close div gm_check + echo '</div>'; // close div gm_check echo '<input type="hidden" name="action" value="go">'; - echo '</form>';//close form placecheck + echo '</form>'; //close form placecheck echo '<hr>'; switch ($action) { case 'go': //Identify gedcom file - $trees=WT_Tree::getAll(); + $trees = WT_Tree::getAll(); echo '<div id="gm_check_title">', $trees[$gedcom_id]->tree_title_html, '</div>'; //Select all '2 PLAC ' tags in the file and create array - $place_list=array(); - $ged_data=WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") + $place_list = array(); + $ged_data = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") ->execute(array("%\n2 PLAC %", $gedcom_id)) ->fetchOneColumn(); foreach ($ged_data as $ged_datum) { preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); foreach ($matches[1] as $match) { - $place_list[$match]=true; + $place_list[$match] = true; } } - $ged_data=WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") + $ged_data = WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") ->execute(array("%\n2 PLAC %", $gedcom_id)) ->fetchOneColumn(); foreach ($ged_data as $ged_datum) { preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); foreach ($matches[1] as $match) { - $place_list[$match]=true; + $place_list[$match] = true; } } // Unique list of places - $place_list=array_keys($place_list); + $place_list = array_keys($place_list); // Apply_filter - if ($country=='XYZ') { - $filter='.*$'; + if ($country == 'XYZ') { + $filter = '.*$'; } else { - $filter=preg_quote($country).'$'; - if ($state!='XYZ') { - $filter=preg_quote($state).', '.$filter; + $filter = preg_quote($country) . '$'; + if ($state != 'XYZ') { + $filter = preg_quote($state) . ', ' . $filter; } } - $place_list=preg_grep('/'.$filter.'/', $place_list); + $place_list = preg_grep('/' . $filter . '/', $place_list); //sort the array, limit to unique values, and count them usort($place_list, array('WT_I18N', 'strcasecmp')); - $i=count($place_list); + $i = count($place_list); //calculate maximum no. of levels to display - $x=0; - $max=0; - while ($x<$i) { - $levels=explode(",", $place_list[$x]); - $parts=count($levels); - if ($parts>$max) $max=$parts; - $x++;} - $x=0; + $x = 0; + $max = 0; + while ($x < $i) { + $levels = explode(",", $place_list[$x]); + $parts = count($levels); + if ($parts > $max) $max = $parts; + $x++; } + $x = 0; //scripts for edit, add and refresh ?> @@ -1642,117 +1642,117 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <?php //start to produce the display table - $cols=0; - $span=$max*3+3; + $cols = 0; + $span = $max * 3 + 3; echo '<div class="gm_check_details">'; echo '<table class="gm_check_details"><tr>'; echo '<th rowspan="3">', WT_I18N::translate('Place'), '</th>'; echo '<th colspan="', $span, '">', WT_I18N::translate('Geographic data'), '</th></tr>'; echo '<tr>'; - while ($cols<$max) { + while ($cols < $max) { if ($cols == 0) { echo '<th colspan="3">', WT_I18N::translate('Country'), '</th>'; } else { - echo '<th colspan="3">', WT_I18N::translate('Level'), ' ', $cols+1, '</th>'; + echo '<th colspan="3">', WT_I18N::translate('Level'), ' ', $cols + 1, '</th>'; } $cols++; } echo '</tr><tr>'; - $cols=0; - while ($cols<$max) { + $cols = 0; + while ($cols < $max) { echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th><th>', WT_I18N::translate('Latitude'), '</th><th>', WT_I18N::translate('Longitude'), '</th>'; $cols++; } echo '</tr>'; - $countrows=0; + $countrows = 0; $matched = array(); - while ($x<$i) { - $placestr=""; - $levels=explode(",", $place_list[$x]); - $parts=count($levels); - $levels=array_reverse($levels); - $placestr.="<a href=\"placelist.php?action=show"; + while ($x < $i) { + $placestr = ""; + $levels = explode(",", $place_list[$x]); + $parts = count($levels); + $levels = array_reverse($levels); + $placestr .= "<a href=\"placelist.php?action=show"; foreach ($levels as $pindex=>$ppart) { - $ppart=urlencode(trim($ppart)); - $placestr.="&parent[$pindex]=".$ppart.""; + $ppart = urlencode(trim($ppart)); + $placestr .= "&parent[$pindex]=" . $ppart . ""; } - $placestr.="\">".$place_list[$x]."</a>"; - $gedplace="<tr><td>".$placestr."</td>"; - $z=0; - $id=0; - $level=0; - $matched[$x]=0;// used to exclude places where the gedcom place is matched at all levels - $mapstr_edit="<a href=\"#\" onclick=\"edit_place_location('"; - $mapstr_add="<a href=\"#\" onclick=\"add_place_location('"; - $mapstr3=""; - $mapstr4=""; - $mapstr5="')\" title='"; - $mapstr6="' >"; - $mapstr7="')\">"; - $mapstr8="</a>"; + $placestr .= "\">" . $place_list[$x] . "</a>"; + $gedplace = "<tr><td>" . $placestr . "</td>"; + $z = 0; + $id = 0; + $level = 0; + $matched[$x] = 0; // used to exclude places where the gedcom place is matched at all levels + $mapstr_edit = "<a href=\"#\" onclick=\"edit_place_location('"; + $mapstr_add = "<a href=\"#\" onclick=\"add_place_location('"; + $mapstr3 = ""; + $mapstr4 = ""; + $mapstr5 = "')\" title='"; + $mapstr6 = "' >"; + $mapstr7 = "')\">"; + $mapstr8 = "</a>"; $plac = array(); $lati = array(); $long = array(); - while ($z<$parts) { - if ($levels[$z]==' ' || $levels[$z]=='') - $levels[$z]="unknown";// GoogleMap module uses "unknown" while GEDCOM uses , , + while ($z < $parts) { + if ($levels[$z] == ' ' || $levels[$z] == '') + $levels[$z] = "unknown"; // GoogleMap module uses "unknown" while GEDCOM uses , , - $levels[$z]=rtrim(ltrim($levels[$z])); + $levels[$z] = rtrim(ltrim($levels[$z])); - $placelist = $this->createPossiblePlaceNames($levels[$z], $z+1); // add the necessary prefix/postfix values to the place name + $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1); // add the necessary prefix/postfix values to the place name foreach ($placelist as $key=>$placename) { - $row= + $row = WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") ->execute(array($z, $id, $placename)) ->fetchOneRow(PDO::FETCH_ASSOC); if (!empty($row['pl_id'])) { - $row['pl_placerequested']=$levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db + $row['pl_placerequested'] = $levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db break; } } - if ($row['pl_id']!='') { - $id=$row['pl_id']; + if ($row['pl_id'] != '') { + $id = $row['pl_id']; } - if ($row['pl_place']!='') { - $placestr2=$mapstr_edit.$id."&level=".$level.$mapstr3.$mapstr5.WT_I18N::translate('Zoom=').$row['pl_zoom'].$mapstr6.$row['pl_placerequested'].$mapstr8; - if ($row['pl_place']=='unknown') + if ($row['pl_place'] != '') { + $placestr2 = $mapstr_edit . $id . "&level=" . $level . $mapstr3 . $mapstr5 . WT_I18N::translate('Zoom=') . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8; + if ($row['pl_place'] == 'unknown') $matched[$x]++; } else { - if ($levels[$z]=="unknown") { - $placestr2=$mapstr_add.$id."&level=".$level.$mapstr3.$mapstr7."<strong>".rtrim(ltrim(WT_I18N::translate('unknown')))."</strong>".$mapstr8;$matched[$x]++; + if ($levels[$z] == "unknown") { + $placestr2 = $mapstr_add . $id . "&level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . rtrim(ltrim(WT_I18N::translate('unknown'))) . "</strong>" . $mapstr8; $matched[$x]++; } else { - $placestr2=$mapstr_add.$id."&place_name=".urlencode($levels[$z])."&level=".$level.$mapstr3.$mapstr7.'<span class="error">'.rtrim(ltrim($levels[$z])).'</span>'.$mapstr8;$matched[$x]++; + $placestr2 = $mapstr_add . $id . "&place_name=" . urlencode($levels[$z]) . "&level=" . $level . $mapstr3 . $mapstr7 . '<span class="error">' . rtrim(ltrim($levels[$z])) . '</span>' . $mapstr8; $matched[$x]++; } } - $plac[$z]="<td>".$placestr2."</td>\n"; - if ($row['pl_lati']=='0') { - $lati[$z]="<td class='error'><strong>".$row['pl_lati']."</strong></td>"; - } elseif ($row['pl_lati']!='') { - $lati[$z]="<td>".$row['pl_lati']."</td>"; + $plac[$z] = "<td>" . $placestr2 . "</td>\n"; + if ($row['pl_lati'] == '0') { + $lati[$z] = "<td class='error'><strong>" . $row['pl_lati'] . "</strong></td>"; + } elseif ($row['pl_lati'] != '') { + $lati[$z] = "<td>" . $row['pl_lati'] . "</td>"; } else { - $lati[$z]="<td class='error center'><strong>X</strong></td>";$matched[$x]++; + $lati[$z] = "<td class='error center'><strong>X</strong></td>"; $matched[$x]++; } - if ($row['pl_long']=='0') { - $long[$z]="<td class='error'><strong>".$row['pl_long']."</strong></td>"; - } elseif ($row['pl_long']!='') { - $long[$z]="<td>".$row['pl_long']."</td>"; + if ($row['pl_long'] == '0') { + $long[$z] = "<td class='error'><strong>" . $row['pl_long'] . "</strong></td>"; + } elseif ($row['pl_long'] != '') { + $long[$z] = "<td>" . $row['pl_long'] . "</td>"; } else { - $long[$z]="<td class='error center'><strong>X</strong></td>";$matched[$x]++; + $long[$z] = "<td class='error center'><strong>X</strong></td>"; $matched[$x]++; } $level++; - $mapstr3=$mapstr3."&parent[".$z."]=".WT_Filter::escapeJs($row['pl_placerequested']); - $mapstr4=$mapstr4."&parent[".$z."]=".WT_Filter::escapeJs($levels[$z]); + $mapstr3 = $mapstr3 . "&parent[" . $z . "]=" . WT_Filter::escapeJs($row['pl_placerequested']); + $mapstr4 = $mapstr4 . "&parent[" . $z . "]=" . WT_Filter::escapeJs($levels[$z]); $z++; } if ($matching) { - $matched[$x]=1; + $matched[$x] = 1; } - if ($matched[$x]!=0) { + if ($matched[$x] != 0) { echo $gedplace; - $z=0; - while ($z<$max) { - if ($z<$parts) { + $z = 0; + while ($z < $max) { + if ($z < $parts) { echo $plac[$z]; echo $lati[$z]; echo $long[$z]; @@ -1932,14 +1932,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } if ($ctla && $ctlo) { $i++; - $gmarks[$i]=array( + $gmarks[$i] = array( 'class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), - 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.') , $match1[1]), - 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.') , $match2[1]), + 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), + 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => '', 'place' => $fact->getPlace()->getFullName(), @@ -1992,7 +1992,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $ctlo = preg_match('/\n4 LONG (.+)/', $birthrec, $match2); if ($ctla && $ctlo) { $i++; - $gmarks[$i]=array( + $gmarks[$i] = array( 'date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', @@ -2330,24 +2330,24 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // Add the markers to the map from the $gmarks array var locations = [ - <?php foreach($gmarks as $n=>$gmark) { ?> + <?php foreach ($gmarks as $n=>$gmark) { ?> <?php echo $n ? ',' : ''; ?> { - "event": "<?php echo WT_Filter::escapeJs($gmark['fact_label'] ); ?>", - "lat": "<?php echo WT_Filter::escapeJs($gmark['lat'] ); ?>", - "lng": "<?php echo WT_Filter::escapeJs($gmark['lng'] ); ?>", - "date": "<?php echo WT_Filter::escapeJs($gmark['date'] ); ?>", - "info": "<?php echo WT_Filter::escapeJs($gmark['info'] ); ?>", - "name": "<?php echo WT_Filter::escapeJs($gmark['name'] ); ?>", - "place": "<?php echo WT_Filter::escapeJs($gmark['place'] ); ?>", - "tooltip": "<?php echo WT_Filter::escapeJs($gmark['tooltip'] ); ?>", - "image": "<?php echo WT_Filter::escapeJs($gmark['image'] ); ?>", - "pl_icon": "<?php echo WT_Filter::escapeJs($gmark['pl_icon'] ); ?>", - "sv_lati": "<?php echo WT_Filter::escapeJs($gmark['sv_lati'] ); ?>", - "sv_long": "<?php echo WT_Filter::escapeJs($gmark['sv_long'] ); ?>", - "sv_bearing": "<?php echo WT_Filter::escapeJs($gmark['sv_bearing'] ); ?>", + "event": "<?php echo WT_Filter::escapeJs($gmark['fact_label']); ?>", + "lat": "<?php echo WT_Filter::escapeJs($gmark['lat']); ?>", + "lng": "<?php echo WT_Filter::escapeJs($gmark['lng']); ?>", + "date": "<?php echo WT_Filter::escapeJs($gmark['date']); ?>", + "info": "<?php echo WT_Filter::escapeJs($gmark['info']); ?>", + "name": "<?php echo WT_Filter::escapeJs($gmark['name']); ?>", + "place": "<?php echo WT_Filter::escapeJs($gmark['place']); ?>", + "tooltip": "<?php echo WT_Filter::escapeJs($gmark['tooltip']); ?>", + "image": "<?php echo WT_Filter::escapeJs($gmark['image']); ?>", + "pl_icon": "<?php echo WT_Filter::escapeJs($gmark['pl_icon']); ?>", + "sv_lati": "<?php echo WT_Filter::escapeJs($gmark['sv_lati']); ?>", + "sv_long": "<?php echo WT_Filter::escapeJs($gmark['sv_long']); ?>", + "sv_bearing": "<?php echo WT_Filter::escapeJs($gmark['sv_bearing']); ?>", "sv_elevation": "<?php echo WT_Filter::escapeJs($gmark['sv_elevation']); ?>", - "sv_zoom": "<?php echo WT_Filter::escapeJs($gmark['sv_zoom'] ); ?>" + "sv_zoom": "<?php echo WT_Filter::escapeJs($gmark['sv_zoom']); ?>" } <?php } ?> ]; @@ -2599,7 +2599,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu WT_DB::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?") ->execute(array($levelm)) ->fetch(PDO::FETCH_ASSOC); - if ($STREETVIEW && $level!=0 ) { + if ($STREETVIEW && $level != 0) { echo '<div id="place_map" style="margin-top:20px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; '; } else { echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; '; @@ -2608,33 +2608,33 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo '</td>'; echo '<script src="', $this->googleMapsScript(), '"></script>'; - $plzoom = $latlng['pl_zoom']; // Map zoom level + $plzoom = $latlng['pl_zoom']; // Map zoom level if (Auth::isAdmin()) { $placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck'; - if ($parent && isset($parent[0]) ) { - $placecheck_url .= '&country='.$parent[0]; + if ($parent && isset($parent[0])) { + $placecheck_url .= '&country=' . $parent[0]; if (isset($parent[1])) { - $placecheck_url .= '&state='.$parent[1]; + $placecheck_url .= '&state=' . $parent[1]; } } $adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places'; if ($latlng && isset($latlng['pl_id'])) { - $adminplaces_url .= '&parent='.$latlng['pl_id']; + $adminplaces_url .= '&parent=' . $latlng['pl_id']; } echo '</tr><tr><td>'; echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>'; echo ' | '; - echo '<a href="'.$adminplaces_url.'">', WT_I18N::translate('Geographic data'), '</a>'; + echo '<a href="' . $adminplaces_url . '">', WT_I18N::translate('Geographic data'), '</a>'; echo ' | '; - echo '<a href="'.$placecheck_url.'">', WT_I18N::translate('Place check'), '</a>'; + echo '<a href="' . $placecheck_url . '">', WT_I18N::translate('Place check'), '</a>'; if (array_key_exists('batch_update', WT_Module::getActiveModules())) { - $placelevels=preg_replace('/, '.WT_I18N::translate('unknown').'/', ', ', $placelevels); // replace ", unknown" with ", " - $placelevels=substr($placelevels, 2); // remove the leading ", " + $placelevels = preg_replace('/, ' . WT_I18N::translate('unknown') . '/', ', ', $placelevels); // replace ", unknown" with ", " + $placelevels = substr($placelevels, 2); // remove the leading ", " if ($placelevels) { - $batchupdate_url='module.php?mod=batch_update&mod_action=admin_batch_update&plugin=search_replace_bu_plugin&method=exact&ged='.WT_GEDCOM.'&search='.urlencode($placelevels); // exact match + $batchupdate_url = 'module.php?mod=batch_update&mod_action=admin_batch_update&plugin=search_replace_bu_plugin&method=exact&ged=' . WT_GEDCOM . '&search=' . urlencode($placelevels); // exact match echo ' | '; - echo '<a href="'.$batchupdate_url.'">', WT_I18N::translate('Batch update'), '</a>'; + echo '<a href="' . $batchupdate_url . '">', WT_I18N::translate('Batch update'), '</a>'; } } } @@ -2656,32 +2656,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu '); global $pl_lati, $pl_long; - if ($level>=1) { - $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati - $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long + if ($level >= 1) { + $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati + $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long // Check if Streetview location parameters are stored in database - $placeid = $latlng['pl_id']; // Placelocation place id - $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude - $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude - $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) - $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) - $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) + $placeid = $latlng['pl_id']; // Placelocation place id + $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude + $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude + $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) + $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) + $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) // Check if Street View Lati/Long are the default of 0 or null, if so use regular Place Lati/Long to set an initial location for the panda ------------ - if (($latlng['sv_lati']==null && $latlng['sv_long']==null) || ($latlng['sv_lati']==0 && $latlng['sv_long']==0)) { + if (($latlng['sv_lati'] == null && $latlng['sv_long'] == null) || ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0)) { $sv_lat = $pl_lati; $sv_lng = $pl_long; } // Set Street View parameters to numeric value if NULL (avoids problem with Google Street View™ Pane not rendering) - if ($sv_dir==null) { - $sv_dir=0; + if ($sv_dir == null) { + $sv_dir = 0; } - if ($sv_pitch==null) { - $sv_pitch=0; + if ($sv_pitch == null) { + $sv_pitch = 0; } - if ($sv_zoom==null) { - $sv_zoom=1; + if ($sv_zoom == null) { + $sv_zoom = 1; } ?> @@ -2691,11 +2691,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <?php $list_latlon = ( - WT_Gedcom_Tag::getLabel('LATI')."<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='".$sv_lat."'>". - WT_Gedcom_Tag::getLabel('LONG')."<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='".$sv_lng."'>". - /* I18N: Compass bearing (in degrees), for street-view mapping */ WT_I18N::translate('Bearing')."<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='".$sv_dir."'>". - /* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation')."<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='".$sv_pitch."'>". - WT_I18N::translate('Zoom')."<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='".$sv_zoom."'> + WT_Gedcom_Tag::getLabel('LATI') . "<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lat . "'>" . + WT_Gedcom_Tag::getLabel('LONG') . "<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lng . "'>" . + /* I18N: Compass bearing (in degrees), for street-view mapping */ WT_I18N::translate('Bearing') . "<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='" . $sv_dir . "'>" . + /* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation') . "<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_pitch . "'>" . + WT_I18N::translate('Zoom') . "<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_zoom . "'> "); if (Auth::isAdmin()) { echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">"; @@ -2766,7 +2766,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu * @param string $placelevels * @param boolean $lastlevel */ - private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel=false) { + private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel = false) { if (($place2['lati'] == NULL) || ($place2['long'] == NULL) || (($place2['lati'] == '0') && ($place2['long'] == '0'))) { echo 'var icon_type = new google.maps.MarkerImage();'; echo 'icon_type.image = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png";'; @@ -2801,13 +2801,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } else { if ($place2['place'] == 'Unknown') { if (!$this->getSetting('GM_DISP_SHORT_PLACE')) { - echo addslashes(WT_I18N::translate('unknown').$placelevels); + echo addslashes(WT_I18N::translate('unknown') . $placelevels); } else { echo WT_I18N::translate('unknown'); } } else { if (!$this->getSetting('GM_DISP_SHORT_PLACE')) { - echo addslashes($place2['place'].$placelevels); + echo addslashes($place2['place'] . $placelevels); } else { echo addslashes($place2['place']); } @@ -2817,8 +2817,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if ($lastlevel) { $this->printHowManyPeople($level, $parent); } else { - $parent[$level]=$place2['place']; - $this->printHowManyPeople($level+1, $parent); + $parent[$level] = $place2['place']; + $this->printHowManyPeople($level + 1, $parent); } echo '<br>', WT_I18N::translate('This place has no coordinates'); if (Auth::isAdmin()) @@ -2831,12 +2831,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if ($lati >= 0) { $lati = abs($lati); } elseif ($lati < 0) { - $lati = '-'.abs($lati); + $lati = '-' . abs($lati); } if ($long >= 0) { $long = abs($long); } elseif ($long < 0) { - $long = '-'.abs($long); + $long = '-' . abs($long); } // flags by kiwi3685 --- @@ -2880,13 +2880,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } else { if ($place2['place'] == 'Unknown') { if (!$this->getSetting('GM_DISP_SHORT_PLACE')) { - echo addslashes(WT_I18N::translate('unknown').$placelevels); + echo addslashes(WT_I18N::translate('unknown') . $placelevels); } else { echo WT_I18N::translate('unknown'); } } else { if (!$this->getSetting('GM_DISP_SHORT_PLACE')) { - echo addslashes($place2['place'].$placelevels); + echo addslashes($place2['place'] . $placelevels); } else { echo addslashes($place2['place']); } @@ -2896,11 +2896,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if ($lastlevel) { $this->printHowManyPeople($level, $parent); } else { - $parent[$level]=$place2['place']; - $this->printHowManyPeople($level+1, $parent); + $parent[$level] = $place2['place']; + $this->printHowManyPeople($level + 1, $parent); } - $temp=addslashes($place2['place']); - $temp=str_replace(array('‎', '‏'), array(WT_UTF8_LRM, WT_UTF8_RLM), $temp); + $temp = addslashes($place2['place']); + $temp = str_replace(array('‎', '‏'), array(WT_UTF8_LRM, WT_UTF8_RLM), $temp); if (!$this->getSetting('GM_COORD')) { echo "<br><br></div>\", icon_type, \"", $temp, "\");"; } else { @@ -2972,13 +2972,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // Creates a marker whose info window displays the given name function createMarker(point, html, icon, name) { // Choose icon and shadow ============ - if (icon.image && '.$level.'<=3) { - if (icon.image!="'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/marker_yellow.png") { + if (icon.image && '.$level . '<=3) { + if (icon.image!="'.WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png") { var iconImage = new google.maps.MarkerImage(icon.image, new google.maps.Size(25, 15), new google.maps.Point(0,0), new google.maps.Point(1, 45)); - var iconShadow = new google.maps.MarkerImage("'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/flag_shadow.png", + var iconShadow = new google.maps.MarkerImage("'.WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/flag_shadow.png", new google.maps.Size(35, 45), new google.maps.Point(0,0), new google.maps.Point(1, 45)); @@ -3045,21 +3045,21 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu '); $levelm = $this->setLevelMap($level, $parent); - if (isset($levelo[0])) $levelo[0]=0; - $numls = count($parent)-1; + if (isset($levelo[0])) $levelo[0] = 0; + $numls = count($parent) - 1; $levelo = $this->checkWhereAmI($numls, $levelm); - if ($numfound<2 && ($level==1 || !isset($levelo[$level-1]))) { + if ($numfound < 2 && ($level == 1 || !isset($levelo[$level - 1]))) { $controller->addInlineJavascript('map.maxZoom=6;'); - } elseif ($numfound<2 && !isset($levelo[$level-2])) { - } elseif ($level==2) { + } elseif ($numfound < 2 && !isset($levelo[$level - 2])) { + } elseif ($level == 2) { $controller->addInlineJavascript('map.maxZoom=10;'); } //create markers ob_start(); // TODO: rewrite print_gm_markers, and the functions called therein, to either return text or add JS directly. - if ($numfound==0 && $level>0) { - if (isset($levelo[($level-1)])) { // ** BH not sure yet what this if statement is for ... TODO ** + if ($numfound == 0 && $level > 0) { + if (isset($levelo[($level - 1)])) { // ** BH not sure yet what this if statement is for ... TODO ** // show the current place on the map $place = WT_DB::prepare("SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id=?") @@ -3070,10 +3070,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // re-calculate the hierarchy information required to display the current place $thisloc = $parent; array_pop($thisloc); - $thislevel = $level-1 ; - $thislinklevels = substr($linklevels,0,strrpos($linklevels,'&')); - if (strpos($placelevels,',',1)) { - $thisplacelevels = substr($placelevels,strpos($placelevels,',',1)); + $thislevel = $level - 1; + $thislinklevels = substr($linklevels, 0, strrpos($linklevels, '&')); + if (strpos($placelevels, ',', 1)) { + $thisplacelevels = substr($placelevels, strpos($placelevels, ',', 1)); } else { // this is the top level, remove everything $thisplacelevels = ''; @@ -3085,26 +3085,26 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } // display any sub-places - $placeidlist=array(); + $placeidlist = array(); foreach ($place_names as $placename) { $thisloc = $parent; $thisloc[] = $placename; - $this_levelm = $this->setLevelMap($level+1, $thisloc); + $this_levelm = $this->setLevelMap($level + 1, $thisloc); if ($this_levelm) $placeidlist[] = $this_levelm; } if ($placeidlist) { // flip the array (thus removing duplicates) - $placeidlist=array_flip($placeidlist); + $placeidlist = array_flip($placeidlist); // remove entry for parent location unset($placeidlist[$levelm]); } if ($placeidlist) { // the keys are all we care about (this reverses the earlier array_flip, and ensures there are no "holes" in the array) - $placeidlist=array_keys($placeidlist); + $placeidlist = array_keys($placeidlist); // note: this implode/array_fill code generates one '?' for each entry in the $placeidlist array $placelist = - WT_DB::prepare('SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id IN ('.implode(',', array_fill(0, count($placeidlist), '?')).')') + WT_DB::prepare('SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id IN (' . implode(',', array_fill(0, count($placeidlist), '?')) . ')') ->execute($placeidlist) ->fetchAll(PDO::FETCH_ASSOC); @@ -3142,14 +3142,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu * @return int */ private function getHighestIndex() { - return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); + return (int) WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); } /** * @return int */ private function getHighestLevel() { - return (int)WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); + return (int) WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); } /** @@ -3173,9 +3173,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu ))->fetchAll(); } else { $rows = WT_DB::prepare( - "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon". - " FROM `##placelocation`". - " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place". + "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . + " FROM `##placelocation`" . + " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place" . " WHERE pl_parent_id = :parent_id" . " ORDER BY pl_place COLLATE :collation" )->execute(array( @@ -3253,12 +3253,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu * ... */ private function placesEdit() { - require WT_ROOT.'includes/functions/functions_edit.php'; + require WT_ROOT . 'includes/functions/functions_edit.php'; $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); - $action = WT_Filter::post('action', null, WT_Filter::get('action')); - $placeid = WT_Filter::post('placeid', null, WT_Filter::get('placeid')); + $action = WT_Filter::post('action', null, WT_Filter::get('action')); + $placeid = WT_Filter::post('placeid', null, WT_Filter::get('placeid')); $place_name = WT_Filter::post('place_name', null, WT_Filter::get('place_name')); $controller = new WT_Controller_Simple; @@ -3268,17 +3268,17 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu ->addInlineJavascript('$("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");') ->pageHeader(); - $where_am_i=$this->placeIdToHierarchy($placeid); - $level=count($where_am_i); + $where_am_i = $this->placeIdToHierarchy($placeid); + $level = count($where_am_i); - if ($action=='addrecord' && Auth::isAdmin()) { - $statement= + if ($action == 'addrecord' && Auth::isAdmin()) { + $statement = WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) { - $statement->execute(array($this->getHighestIndex()+1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'])); + $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'])); } else { - $statement->execute(array($this->getHighestIndex()+1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'])); + $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'])); } // autoclose window when update successful unless debug on @@ -3289,14 +3289,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu exit; } - if ($action=='updaterecord' && Auth::isAdmin()) { - $statement= + if ($action == 'updaterecord' && Auth::isAdmin()) { + $statement = WT_DB::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?"); if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) { $statement->execute(array($_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid)); } else { - $statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid)); + $statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid)); } // autoclose window when update successful unless debug on @@ -3324,16 +3324,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu exit; } - if ($action=="update") { + if ($action == "update") { // --- find the place in the file - $row= + $row = WT_DB::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?") ->execute(array($placeid)) ->fetchOneRow(); $place_name = $row->pl_place; $place_icon = $row->pl_icon; $selected_country = explode("/", $place_icon); - if (isset($selected_country[1]) && $selected_country[1]!="flags") + if (isset($selected_country[1]) && $selected_country[1] != "flags") $selected_country = $selected_country[1]; else $selected_country = "Countries"; @@ -3342,9 +3342,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $zoomfactor = $row->pl_zoom; $parent_lati = "0.0"; $parent_long = "0.0"; - if ($row->pl_lati!==null && $row->pl_long!==null) { - $place_lati = (float)(str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati)); - $place_long = (float)(str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long)); + if ($row->pl_lati !== null && $row->pl_long !== null) { + $place_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); + $place_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); } else { $place_lati = null; $place_long = null; @@ -3352,57 +3352,57 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } do { - $row= + $row = WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?") ->execute(array($parent_id)) ->fetchOneRow(); if (!$row) { break; } - if ($row->pl_lati!==null && $row->pl_long!==null) { - $parent_lati = (float)(str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati)); - $parent_long = (float)(str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long)); + if ($row->pl_lati !== null && $row->pl_long !== null) { + $parent_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); + $parent_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); if ($zoomfactor == 1) { $zoomfactor = $row->pl_zoom; } } $parent_id = $row->pl_parent_id; } - while ($row->pl_parent_id!=0 && $row->pl_lati===null && $row->pl_long===null); + while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null); echo '<b>', WT_Filter::escapeHtml(str_replace('Unknown', WT_I18N::translate('unknown'), implode(WT_I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>'; } - if ($action=='add') { + if ($action == 'add') { // --- find the parent place in the file if ($placeid != 0) { - if (!isset($place_name)) $place_name = ''; + if (!isset($place_name)) $place_name = ''; $place_lati = null; $place_long = null; $zoomfactor = 1; $parent_lati = '0.0'; $parent_long = '0.0'; $place_icon = ''; - $parent_id=$placeid; + $parent_id = $placeid; do { - $row= + $row = WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?") ->execute(array($parent_id)) ->fetchOneRow(); - if ($row->pl_lati!==null && $row->pl_long!==null) { - $parent_lati=str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati); - $parent_long=str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long); - $zoomfactor=$row->pl_zoom; - if ($zoomfactor>$GM_MAX_ZOOM) { - $zoomfactor=$GM_MAX_ZOOM; + if ($row->pl_lati !== null && $row->pl_long !== null) { + $parent_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati); + $parent_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long); + $zoomfactor = $row->pl_zoom; + if ($zoomfactor > $GM_MAX_ZOOM) { + $zoomfactor = $GM_MAX_ZOOM; } - $level=$row->pl_level+1; + $level = $row->pl_level + 1; } $parent_id = $row->pl_parent_id; - } while ($row->pl_parent_id!=0 && $row->pl_lati===null && $row->pl_long===null); + } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null); } else { - if (!isset($place_name)) $place_name = ''; + if (!isset($place_name)) $place_name = ''; $place_lati = null; $place_long = null; $parent_lati = "0.0"; @@ -3414,9 +3414,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } $selected_country = 'Countries'; - if (!isset($place_name) || $place_name=="") echo '<b>', WT_I18N::translate('unknown'); + if (!isset($place_name) || $place_name == "") echo '<b>', WT_I18N::translate('unknown'); else echo '<b>', $place_name; - if (count($where_am_i)>0) + if (count($where_am_i) > 0) echo ', ', WT_Filter::escapeHtml(str_replace('Unknown', WT_I18N::translate('unknown'), implode(WT_I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>'; echo '</b><br>'; } @@ -3741,15 +3741,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // Create the Main Location Marker <?php if ($level < 3 && $place_icon != '') { - echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/',$place_icon,'",'; - echo 'new google.maps.Size(25, 15),'; // Image size - echo 'new google.maps.Point(0, 0),'; // Image origin - echo 'new google.maps.Point(0, 44)'; // Image anchor + echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place_icon, '",'; + echo 'new google.maps.Size(25, 15),'; // Image size + echo 'new google.maps.Point(0, 0),'; // Image origin + echo 'new google.maps.Point(0, 44)'; // Image anchor echo ');'; echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/flag_shadow.png",'; - echo 'new google.maps.Size(35, 45),'; // Shadow size - echo 'new google.maps.Point(0,0),'; // Shadow origin - echo 'new google.maps.Point(1, 45)'; // Shadow anchor is base of flagpole + echo 'new google.maps.Size(35, 45),'; // Shadow size + echo 'new google.maps.Point(0,0),'; // Shadow origin + echo 'new google.maps.Point(1, 45)'; // Shadow anchor is base of flagpole echo ');'; echo 'marker = new google.maps.Marker({'; echo 'icon: image,'; @@ -3847,14 +3847,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu var contentString = '<div id="iwcontent_edit">'+name+'<\/div>'; <?php echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png",'; - echo 'new google.maps.Size(20, 34),'; // Image size - echo 'new google.maps.Point(0, 0),'; // Image origin - echo 'new google.maps.Point(10, 34)'; // Image anchor + echo 'new google.maps.Size(20, 34),'; // Image size + echo 'new google.maps.Point(0, 0),'; // Image origin + echo 'new google.maps.Point(10, 34)'; // Image anchor echo ');'; echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/shadow50.png",'; - echo 'new google.maps.Size(37, 34),'; // Shadow size - echo 'new google.maps.Point(0, 0),'; // Shadow origin - echo 'new google.maps.Point(10, 34)'; // Shadow anchor is base of image + echo 'new google.maps.Size(37, 34),'; // Shadow size + echo 'new google.maps.Point(0, 0),'; // Shadow origin + echo 'new google.maps.Point(10, 34)'; // Shadow anchor is base of image echo ');'; ?> var marker = new google.maps.Marker({ @@ -3931,7 +3931,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } function showLocation_level(address) { - address += '<?php if ($level>0) echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))); ?>'; + address += '<?php if ($level > 0) echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))); ?>'; geocoder.geocode({'address': address}, addAddressToMap); } @@ -3975,7 +3975,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </td> </tr> <tr> - <td class="descriptionbox"><?php echo WT_I18N::translate('Precision'), help_link('PLE_PRECISION','googlemap'); ?></td> + <td class="descriptionbox"><?php echo WT_I18N::translate('Precision'), help_link('PLE_PRECISION', 'googlemap'); ?></td> <?php $exp = explode(".", $place_lati); if (isset($exp[1])) { @@ -3990,23 +3990,23 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $precision2 = -1; } ($precision1 > $precision2) ? ($precision = $precision1) : ($precision = $precision2); - if ($precision == -1 ) ($level > 3) ? ($precision = 3) : ($precision = $level); + if ($precision == -1) ($level > 3) ? ($precision = 3) : ($precision = $level); elseif ($precision > 5) { $precision = 5; } ?> <td class="optionbox" colspan="2"> - <input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_0')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_0'); ?>"> + <input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_0')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_0'); ?>"> <label for="new_prec_0"><?php echo WT_I18N::translate('Country'); ?></label> - <input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_1')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_1'); ?>"> + <input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_1')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_1'); ?>"> <label for="new_prec_1"><?php echo WT_I18N::translate('State'); ?></label> - <input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_2')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_2'); ?>"> + <input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_2')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_2'); ?>"> <label for="new_prec_2"><?php echo WT_I18N::translate('City'); ?></label> - <input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_3')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_3'); ?>"> + <input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_3')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_3'); ?>"> <label for="new_prec_3"><?php echo WT_I18N::translate('Neighborhood'); ?></label> - <input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_4')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_4'); ?>"> + <input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_4')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_4'); ?>"> <label for="new_prec_4"><?php echo WT_I18N::translate('House'); ?></label> - <input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision>=$this->getSetting('GM_PRECISION_5')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_5'); ?>"> + <input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision >= $this->getSetting('GM_PRECISION_5')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_5'); ?>"> <label for="new_prec_5"><?php echo WT_I18N::translate('Max'); ?></label> </td> </tr> @@ -4031,12 +4031,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </td> </tr> <tr> - <td class="descriptionbox"><?php echo WT_I18N::translate('Zoom level'), help_link('PLE_ZOOM','googlemap'); ?></td> + <td class="descriptionbox"><?php echo WT_I18N::translate('Zoom level'), help_link('PLE_ZOOM', 'googlemap'); ?></td> <td class="optionbox" colspan="2"> <input type="text" id="NEW_ZOOM_FACTOR" name="NEW_ZOOM_FACTOR" value="<?php echo $zoomfactor; ?>" size="20" onchange="updateMap();"></td> </tr> <tr> - <td class="descriptionbox"><?php echo WT_I18N::translate('Flag'), help_link('PLE_ICON','googlemap'); ?></td> + <td class="descriptionbox"><?php echo WT_I18N::translate('Flag'), help_link('PLE_ICON', 'googlemap'); ?></td> <td class="optionbox" colspan="2"> <div id="flagsDiv"> <?php @@ -4063,7 +4063,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu * ... */ private function adminPlaces() { - require WT_ROOT.'includes/functions/functions_edit.php'; + require WT_ROOT . 'includes/functions/functions_edit.php'; $action = WT_Filter::get('action'); $parent = WT_Filter::get('parent'); @@ -4071,30 +4071,30 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $deleteRecord = WT_Filter::get('deleteRecord'); if (!isset($parent)) { - $parent=0; + $parent = 0; } $controller = new WT_Controller_Page; $controller->restrictAccess(Auth::isAdmin()); - if ($action=='ExportFile' && Auth::isAdmin()) { + if ($action == 'ExportFile' && Auth::isAdmin()) { Zend_Session::writeClose(); $tmp = $this->placeIdToHierarchy($parent); $maxLevel = $this->getHighestLevel(); - if ($maxLevel>8) $maxLevel=8; + if ($maxLevel > 8) $maxLevel = 8; $tmp[0] = 'places'; - $outputFileName=preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)).'.csv'; + $outputFileName = preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)) . '.csv'; header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="'.$outputFileName.'"'); + header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";'; - if ($maxLevel>0) echo '"', WT_I18N::translate('State'), '";'; - if ($maxLevel>1) echo '"', WT_I18N::translate('County'), '";'; - if ($maxLevel>2) echo '"', WT_I18N::translate('City'), '";'; - if ($maxLevel>3) echo '"', WT_I18N::translate('Place'), '";'; - if ($maxLevel>4) echo '"', WT_I18N::translate('Place'), '";'; - if ($maxLevel>5) echo '"', WT_I18N::translate('Place'), '";'; - if ($maxLevel>6) echo '"', WT_I18N::translate('Place'), '";'; - if ($maxLevel>7) echo '"', WT_I18N::translate('Place'), '";'; + if ($maxLevel > 0) echo '"', WT_I18N::translate('State'), '";'; + if ($maxLevel > 1) echo '"', WT_I18N::translate('County'), '";'; + if ($maxLevel > 2) echo '"', WT_I18N::translate('City'), '";'; + if ($maxLevel > 3) echo '"', WT_I18N::translate('Place'), '";'; + if ($maxLevel > 4) echo '"', WT_I18N::translate('Place'), '";'; + if ($maxLevel > 5) echo '"', WT_I18N::translate('Place'), '";'; + if ($maxLevel > 6) echo '"', WT_I18N::translate('Place'), '";'; + if ($maxLevel > 7) echo '"', WT_I18N::translate('Place'), '";'; echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";'; echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL; $this->outputLevel($parent); @@ -4127,9 +4127,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </table> <?php - if ($action=='ImportGedcom') { - $placelist=array(); - $j=0; + if ($action == 'ImportGedcom') { + $placelist = array(); + $j = 0; $gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?") ->execute(array(WT_GED_ID, WT_GED_ID)) @@ -4147,7 +4147,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if ($placelist[$j]['lati'] < 0) { $placelist[$j]['lati'][0] = 'S'; } else { - $placelist[$j]['lati'] = 'N'.$placelist[$j]['lati']; + $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati']; } } } @@ -4158,7 +4158,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if ($placelist[$j]['long'] < 0) { $placelist[$j]['long'][0] = 'W'; } else { - $placelist[$j]['long'] = 'E'.$placelist[$j]['long']; + $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; } } } @@ -4184,9 +4184,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $placelistUniq[$j]['long'] = $place['long']; $j = $j + 1; } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { - if (($placelistUniq[$j-1]['lati'] == 0) || ($placelistUniq[$j-1]['long'] == 0)) { - $placelistUniq[$j-1]['lati'] = $place['lati']; - $placelistUniq[$j-1]['long'] = $place['long']; + if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { + $placelistUniq[$j - 1]['lati'] = $place['lati']; + $placelistUniq[$j - 1]['long'] = $place['long']; } elseif (($place['lati'] != '0') || ($place['long'] != '0')) { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } @@ -4198,32 +4198,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $highestIndex = $this->getHighestIndex(); - $default_zoom_level=array(4, 7, 10, 12); + $default_zoom_level = array(4, 7, 10, 12); foreach ($placelistUniq as $k=>$place) { - $parent=preg_split('/ *, */', $place['place']); - $parent=array_reverse($parent); - $parent_id=0; - for ($i=0; $i<count($parent); $i++) { + $parent = preg_split('/ *, */', $place['place']); + $parent = array_reverse($parent); + $parent_id = 0; + for ($i = 0; $i < count($parent); $i++) { if (!isset($default_zoom_level[$i])) - $default_zoom_level[$i]=$default_zoom_level[$i-1]; - $escparent=$parent[$i]; + $default_zoom_level[$i] = $default_zoom_level[$i - 1]; + $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } - $row= + $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?") ->execute(array($i, $parent_id, $escparent)) ->fetchOneRow(); - if ($i < count($parent)-1) { + if ($i < count($parent) - 1) { // Create higher-level places, if necessary if (empty($row)) { $highestIndex++; WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)") ->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); echo WT_Filter::escapeHtml($escparent), '<br>'; - $parent_id=$highestIndex; + $parent_id = $highestIndex; } else { - $parent_id=$row->pl_id; + $parent_id = $row->pl_id; } } else { // Create lowest-level place, if necessary @@ -4233,7 +4233,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); echo WT_Filter::escapeHtml($escparent), '<br>'; } else { - if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati']!='0' && $place['long']!='0') { + if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") ->execute(array($place['lati'], $place['long'], $row->pl_id)); echo WT_Filter::escapeHtml($escparent), '<br>'; @@ -4242,12 +4242,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } } } - $parent=0; + $parent = 0; } - if ($action=='ImportFile') { + if ($action == 'ImportFile') { $placefiles = array(); - $this->findFiles(WT_MODULES_DIR.'googlemap/extra'); + $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); sort($placefiles); ?> <form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> @@ -4256,15 +4256,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu <th><?php echo WT_I18N::translate('File containing places (CSV)'); ?></th> <td><input type="file" name="placesfile" size="50"></td> </tr> - <?php if (count($placefiles)>0) { ?> + <?php if (count($placefiles) > 0) { ?> <tr> - <th><?php echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE','googlemap'); ?></th> + <th><?php echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE', 'googlemap'); ?></th> <td> <select name="localfile"> <option></option> <?php foreach ($placefiles as $p=>$placefile) { ?> <option value="<?php echo WT_Filter::escapeHtml($placefile); ?>"><?php - if (substr($placefile, 0, 1)=="/") echo substr($placefile, 1); + if (substr($placefile, 0, 1) == "/") echo substr($placefile, 1); else echo $placefile; ?></option> <?php } ?> </select> @@ -4294,7 +4294,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $country_names = array(); $stats = new WT_Stats(WT_GEDCOM); foreach ($stats->iso3166() as $key=>$value) { - $country_names[$key]=WT_I18N::translate($key); + $country_names[$key] = WT_I18N::translate($key); } if (isset($_POST['cleardatabase'])) { WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1"); @@ -4302,7 +4302,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if (!empty($_FILES['placesfile']['tmp_name'])) { $lines = file($_FILES['placesfile']['tmp_name']); } elseif (!empty($_REQUEST['localfile'])) { - $lines = file(WT_MODULES_DIR.'googlemap/extra'.$_REQUEST['localfile']); + $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); } // Strip BYTE-ORDER-MARK, if present if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) { @@ -4319,16 +4319,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } $fields = count($fieldrec); $set_icon = true; - if (!is_dir(WT_MODULES_DIR.'googlemap/places/flags/')) { + if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { $set_icon = false; } foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); - if (is_numeric($fieldrec[0]) && $fieldrec[0]<=$maxLevel) { + if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { $placelist[$j] = array(); $placelist[$j]['place'] = ''; - for ($ii=$fields-4; $ii>1; $ii--) { - if ($fieldrec[0] > $ii-2) $placelist[$j]['place'] .= $fieldrec[$ii].','; + for ($ii = $fields - 4; $ii > 1; $ii--) { + if ($fieldrec[0] > $ii - 2) $placelist[$j]['place'] .= $fieldrec[$ii] . ','; } foreach ($country_names as $countrycode => $countryname) { if ($countrycode == strtoupper($fieldrec[1])) { @@ -4337,11 +4337,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } } $placelist[$j]['place'] .= $fieldrec[1]; - $placelist[$j]['long'] = $fieldrec[$fields-4]; - $placelist[$j]['lati'] = $fieldrec[$fields-3]; - $placelist[$j]['zoom'] = $fieldrec[$fields-2]; - if($set_icon) { - $placelist[$j]['icon'] = trim($fieldrec[$fields-1]); + $placelist[$j]['long'] = $fieldrec[$fields - 4]; + $placelist[$j]['lati'] = $fieldrec[$fields - 3]; + $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; + if ($set_icon) { + $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); } else { $placelist[$j]['icon'] = ''; } @@ -4364,11 +4364,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $placelistUniq[$j]['icon'] = $place['icon']; $j = $j + 1; } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { - if (($placelistUniq[$j-1]['lati'] == 0) || ($placelistUniq[$j-1]['long'] == 0)) { - $placelistUniq[$j-1]['lati'] = $place['lati']; - $placelistUniq[$j-1]['long'] = $place['long']; - $placelistUniq[$j-1]['zoom'] = $place['zoom']; - $placelistUniq[$j-1]['icon'] = $place['icon']; + if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { + $placelistUniq[$j - 1]['lati'] = $place['lati']; + $placelistUniq[$j - 1]['long'] = $place['long']; + $placelistUniq[$j - 1]['zoom'] = $place['zoom']; + $placelistUniq[$j - 1]['icon'] = $place['icon']; } elseif (($place['lati'] != '0') || ($place['long'] != '0')) { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } @@ -4386,42 +4386,42 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu foreach ($placelistUniq as $k=>$place) { $parent = explode(',', $place['place']); $parent = array_reverse($parent); - $parent_id=0; - for ($i=0; $i<count($parent); $i++) { - $escparent=$parent[$i]; + $parent_id = 0; + for ($i = 0; $i < count($parent); $i++) { + $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } - $row= + $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") ->execute(array($i, $parent_id, $escparent)) ->fetchOneRow(); if (empty($row)) { // this name does not yet exist: create entry if (!isset($_POST['updateonly'])) { $highestIndex = $highestIndex + 1; - if (($i+1) == count($parent)) { + if (($i + 1) == count($parent)) { $zoomlevel = $place['zoom']; } elseif (isset($default_zoom_level[$i])) { $zoomlevel = $default_zoom_level[$i]; } else { $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); } - if (($place['lati'] == '0') || ($place['long'] == '0') || (($i+1) < count($parent))) { + if (($place['lati'] == '0') || ($place['long'] == '0') || (($i + 1) < count($parent))) { WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)") ->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); } else { //delete leading zero - $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.') , $place['lati']); - $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.') , $place['long']); + $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); + $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); if ($pl_lati >= 0) { - $place['lati'] = 'N'.abs($pl_lati); + $place['lati'] = 'N' . abs($pl_lati); } elseif ($pl_lati < 0) { - $place['lati'] = 'S'.abs($pl_lati); + $place['lati'] = 'S' . abs($pl_lati); } if ($pl_long >= 0) { - $place['long'] = 'E'.abs($pl_long); + $place['long'] = 'E' . abs($pl_long); } elseif ($pl_long < 0) { - $place['long'] = 'W'.abs($pl_long); + $place['long'] = 'W' . abs($pl_long); } WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)") ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); @@ -4430,7 +4430,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } } else { $parent_id = $row->pl_id; - if ((isset($_POST['overwritedata'])) && ($i+1 == count($parent))) { + if ((isset($_POST['overwritedata'])) && ($i + 1 == count($parent))) { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?") ->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); } else { @@ -4446,11 +4446,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } } } - $parent=0; + $parent = 0; } - if ($action=='DeleteRecord') { - $exists= + if ($action == 'DeleteRecord') { + $exists = WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?") ->execute(array($deleteRecord)) ->fetchOne(); @@ -4466,7 +4466,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu ?> <script> function updateList(inactive) { - window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri=strstr($_SERVER['REQUEST_URI'], '&inactive', true);} else { $uri=$_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?>'+inactive; + window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true); } else { $uri = $_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?>'+inactive; } function edit_place_location(placeid) { @@ -4488,9 +4488,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </script> <?php echo '<div id="gm_breadcrumb">'; - $where_am_i=$this->placeIdToHierarchy($parent); + $where_am_i = $this->placeIdToHierarchy($parent); foreach (array_reverse($where_am_i, true) as $id=>$place) { - if ($id==$parent) { + if ($id == $parent) { if ($place != 'Unknown') { echo WT_Filter::escapeHtml($place); } else { @@ -4512,9 +4512,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo '<input type="checkbox" name="inactive" id="inactive"'; if ($inactive) echo ' checked="checked"'; echo ' onclick="updateList(this.checked)"'; - echo '>', help_link('PLE_ACTIVE','googlemap'), '</div></form>'; + echo '>', help_link('PLE_ACTIVE', 'googlemap'), '</div></form>'; - $placelist=$this->getPlaceListLocation($parent, $inactive); + $placelist = $this->getPlaceListLocation($parent, $inactive); echo '<div class="gm_plac_edit">'; echo '<table class="gm_plac_edit"><tr>'; echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>'; @@ -4548,11 +4548,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu } echo '</td>'; echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', WT_I18N::translate('Edit'), '"></a></td>'; - $noRows= + $noRows = WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?") ->execute(array($place['place_id'])) ->fetchOne(); - if ($noRows==0) { ?> + if ($noRows == 0) { ?> <td><a href="#" onclick="delete_place(<?php echo $place['place_id']?>);return false;" class="icon-delete" title="<?php echo WT_I18N::translate('Remove'); ?>"></a></td> <?php } else { ?> <td><i class="icon-delete-grey"></i></td> |
