summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2013-07-16 21:59:08 +0000
committerfisharebest <fisharebest@gmail.com>2013-07-16 21:59:08 +0000
commitb9bb8ea33d62189c30d40456cb4550a5d4b3e5b2 (patch)
treeb19b32487da9d4d1c627b8df357bf09ad0ae6c7b
parent41ad8fa957e59c44918e076c17ea7b6e23dfcf61 (diff)
downloadwebtrees-b9bb8ea33d62189c30d40456cb4550a5d4b3e5b2.tar.gz
webtrees-b9bb8ea33d62189c30d40456cb4550a5d4b3e5b2.tar.bz2
webtrees-b9bb8ea33d62189c30d40456cb4550a5d4b3e5b2.zip
Refactor - no longer need WT_GedcomRecord::equals() - can use "=="
-rw-r--r--branches.php2
-rw-r--r--edit_interface.php4
-rw-r--r--includes/functions/functions.php20
-rw-r--r--includes/functions/functions_print_facts.php2
-rw-r--r--library/WT/Controller/Fanchart.php2
-rw-r--r--library/WT/Controller/Individual.php3
-rw-r--r--library/WT/Controller/Lifespan.php2
-rw-r--r--library/WT/Fact.php2
-rw-r--r--library/WT/Family.php2
-rw-r--r--library/WT/GedcomRecord.php5
-rw-r--r--library/WT/Individual.php6
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php4
-rw-r--r--modules_v3/personal_facts/module.php2
-rw-r--r--modules_v3/tree/class_treeview.php4
-rw-r--r--pedigree.php2
15 files changed, 27 insertions, 35 deletions
diff --git a/branches.php b/branches.php
index 81c839b168..1e6a1c1b7e 100644
--- a/branches.php
+++ b/branches.php
@@ -138,7 +138,7 @@ function print_fams(WT_Individual $person, WT_Family $family=null) {
$person->getLifeSpan().' '.$sosa;
if ($family) {
foreach ($person->getFacts('FAMC') as $fact) {
- if ($fact->getTarget()->equals($family)) {
+ if ($fact->getTarget() == $family) {
$pedi = $fact->getAttribute('PEDI');
break;
}
diff --git a/edit_interface.php b/edit_interface.php
index dba3e7418f..5bbcdfaa4e 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -601,7 +601,7 @@ case 'linkfamaction':
// Replace any existing child->family link (we may be changing the PEDI);
$fact_id = null;
foreach ($person->getFacts('FAMC') as $fact) {
- if ($family->equals($fact->getTarget())) {
+ if ($family == $fact->getTarget()) {
$fact_id = $fact->getFactId();
break;
}
@@ -613,7 +613,7 @@ case 'linkfamaction':
// Only set the family->child link if it does not already exist
$edit_fact = null;
foreach ($family->getFacts('CHIL') as $fact) {
- if ($person->equals($fact->getTarget())) {
+ if ($person == $fact->getTarget()) {
$edit_fact = $fact;
break;
}
diff --git a/includes/functions/functions.php b/includes/functions/functions.php
index 4756ba8c75..d40cfeb817 100644
--- a/includes/functions/functions.php
+++ b/includes/functions/functions.php
@@ -523,7 +523,7 @@ function sort_facts(&$arr) {
// Stop after 3 steps, because pending edits may mean that there is no longer a
// relationship to find.
function get_close_relationship_name(WT_Individual $person1, WT_Individual $person2) {
- if ($person1->equals($person2)) {
+ if ($person1 == $person2) {
$label = '<i class="icon-selected" title="' . WT_I18N::translate('self') . '"></i>';
} else {
$label = get_relationship_name(get_relationship($person1, $person2, true, 3));
@@ -535,7 +535,7 @@ function get_close_relationship_name(WT_Individual $person1, WT_Individual $pers
// Stop after 4 steps, as distant relationships may take a long time to find.
// TODO review the limit of 4 when the performance of the function is improved
function get_associate_relationship_name(WT_Individual $person1, WT_Individual $person2) {
- if ($person1->equals($person2)) {
+ if ($person1 == $person2) {
$label = WT_I18N::translate('self');
} else {
$label = get_relationship_name(get_relationship($person1, $person2, true, 4));
@@ -553,7 +553,7 @@ function get_associate_relationship_name(WT_Individual $person1, WT_Individual $
* @param int $path_to_find - which path in the relationship to find, 0 is the shortest path, 1 is the next shortest path, etc
*/
function get_relationship(WT_Individual $person1, WT_Individual $person2, $followspouse=true, $maxlength=0, $path_to_find=0) {
- if (!$person1 || !$person2 || $person1->equals($person2)) {
+ if ($person1 == $person2) {
return false;
}
@@ -603,7 +603,7 @@ function get_relationship(WT_Individual $person1, WT_Individual $person2, $follo
$node1['indi'] = $spouse;
$node1['relations'][] = 'parent';
$p1nodes[] = $node1;
- if ($spouse->equals($person2)) {
+ if ($spouse == $person2) {
if ($path_to_find>0) {
$path_to_find--;
} else {
@@ -623,7 +623,7 @@ function get_relationship(WT_Individual $person1, WT_Individual $person2, $follo
$node1['indi'] = $child;
$node1['relations'][] = 'sibling';
$p1nodes[] = $node1;
- if ($child->equals($person2)) {
+ if ($child == $person2) {
if ($path_to_find>0) {
$path_to_find--;
} else {
@@ -648,7 +648,7 @@ function get_relationship(WT_Individual $person1, WT_Individual $person2, $follo
$node1['indi'] = $spouse;
$node1['relations'][] = 'spouse';
$p1nodes[] = $node1;
- if ($spouse->equals($person2)) {
+ if ($spouse == $person2) {
if ($path_to_find>0) {
$path_to_find--;
} else {
@@ -669,7 +669,7 @@ function get_relationship(WT_Individual $person1, WT_Individual $person2, $follo
$node1['indi'] = $child;
$node1['relations'][] = 'child';
$p1nodes[] = $node1;
- if ($child->equals($person2)) {
+ if ($child == $person2) {
if ($path_to_find>0) {
$path_to_find--;
} else {
@@ -884,7 +884,7 @@ function get_relationship_name_from_path($path, WT_Individual $person1=null, WT_
case 'hus':
if ($person1 && $person2) {
foreach ($person1->getSpouseFamilies() as $family) {
- if ($person2->equals($family->getSpouse($person1))) {
+ if ($person2 == $family->getSpouse($person1)) {
if ($family->isNotMarried()) {
return WT_I18N::translate_c('MALE', 'partner');
} elseif($family->isDivorced()) {
@@ -897,7 +897,7 @@ function get_relationship_name_from_path($path, WT_Individual $person1=null, WT_
case 'wif':
if ($person1 && $person1) {
foreach ($person1->getSpouseFamilies() as $family) {
- if ($person2->equals($family->getSpouse($person1))) {
+ if ($person2 == $family->getSpouse($person1)) {
if ($family->isNotMarried()) {
return WT_I18N::translate_c('FEMALE', 'partner');
} elseif($family->isDivorced()) {
@@ -910,7 +910,7 @@ function get_relationship_name_from_path($path, WT_Individual $person1=null, WT_
case 'spo':
if ($person1 && $person2) {
foreach ($person1->getSpouseFamilies() as $family) {
- if ($person2->equals($family->getSpouse($person1))) {
+ if ($person2 == $family->getSpouse($person1)) {
if ($family->isNotMarried()) {
return WT_I18N::translate_c('MALE/FEMALE', 'partner');
} elseif($family->isDivorced()) {
diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php
index b2439ab8b0..e5fc3ac5be 100644
--- a/includes/functions/functions_print_facts.php
+++ b/includes/functions/functions_print_facts.php
@@ -205,7 +205,7 @@ function print_fact(WT_Fact $fact, WT_GedcomRecord $record) {
// Print the spouse and family of this fact/event
if ($parent instanceof WT_Family && $record instanceof WT_Individual) {
foreach ($parent->getSpouses() as $spouse) {
- if (!$record->equals($spouse)) {
+ if (!$record == $spouse) {
echo '<a href="', $spouse->getHtmlUrl(), '">', $spouse->getFullName(), '</a> - ';
}
}
diff --git a/library/WT/Controller/Fanchart.php b/library/WT/Controller/Fanchart.php
index c841dddad7..e09d183db2 100644
--- a/library/WT/Controller/Fanchart.php
+++ b/library/WT/Controller/Fanchart.php
@@ -335,7 +335,7 @@ class WT_Controller_Fanchart extends WT_Controller_Chart {
$html.= '<br><span class="name1">'.WT_I18N::translate('Sibling').'</span>';
}
foreach ($children as $sibling) {
- if (!$sibling->equals($person)) {
+ if ($sibling == $person) {
$html.= '<br>&nbsp;&nbsp;<a href="'.$sibling->getHtmlUrl().'" class="name1"> '.$sibling->getFullName().'</a>';
}
}
diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php
index 8dc0fc4b1c..fccbe8e45f 100644
--- a/library/WT/Controller/Individual.php
+++ b/library/WT/Controller/Individual.php
@@ -326,9 +326,6 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord {
return $menu;
}
- function add_asso_facts() {
- }
-
/**
* get the person box stylesheet class
* for the given person
diff --git a/library/WT/Controller/Lifespan.php b/library/WT/Controller/Lifespan.php
index 5412b60e95..0271965738 100644
--- a/library/WT/Controller/Lifespan.php
+++ b/library/WT/Controller/Lifespan.php
@@ -221,7 +221,7 @@ class WT_Controller_Lifespan extends WT_Controller_Page {
$this->pids[]=$parent->getXref();
}
foreach ($family->getChildren() as $sibling) {
- if (!$person->equals($sibling)) {
+ if ($person != $sibling) {
$this->pids[]=$sibling->getXref();
}
}
diff --git a/library/WT/Fact.php b/library/WT/Fact.php
index eb20137bd5..36545261bb 100644
--- a/library/WT/Fact.php
+++ b/library/WT/Fact.php
@@ -342,7 +342,7 @@ class WT_Fact {
// Facts from same families stay grouped together
// Keep MARR and DIV from the same families from mixing with events from other FAMs
// Use the original order in which the facts were added
- if ($a->parent instanceof WT_Family && $b->parent instanceof WT_Family && !$a->parent->equals($b->parent)) {
+ if ($a->parent instanceof WT_Family && $b->parent instanceof WT_Family && $a->parent != $b->parent) {
return $a->sortOrder - $b->sortOrder;
}
diff --git a/library/WT/Family.php b/library/WT/Family.php
index a27a1bd827..ad40eb41a5 100644
--- a/library/WT/Family.php
+++ b/library/WT/Family.php
@@ -126,7 +126,7 @@ class WT_Family extends WT_GedcomRecord {
// Find the spouse of a person - or create a dummy person if this family
// record is missing one of the spouses.
function getSpouse(WT_Individual $person, $access_level=WT_USER_ACCESS_LEVEL) {
- if ($person->equals($this->getWife())) {
+ if ($person == $this->getWife()) {
return $this->getHusband();
} else {
return $this->getWife();
diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php
index 64a28cdee2..721d3fa4e2 100644
--- a/library/WT/GedcomRecord.php
+++ b/library/WT/GedcomRecord.php
@@ -250,11 +250,6 @@ class WT_GedcomRecord {
return $this->pending === '';
}
- // Are two records the same?
- public function equals($obj) {
- return $obj && $this->xref==$obj->getXref();
- }
-
// Generate a URL to this record, suitable for use in HTML, etc.
public function getHtmlUrl() {
return $this->_getLinkUrl(static::URL_PREFIX, '&amp;');
diff --git a/library/WT/Individual.php b/library/WT/Individual.php
index c71239ed79..f4238fa33a 100644
--- a/library/WT/Individual.php
+++ b/library/WT/Individual.php
@@ -936,8 +936,8 @@ class WT_Individual extends WT_GedcomRecord {
// Create a label for a step family
function getStepFamilyLabel(WT_Family $family) {
foreach ($this->getChildFamilies() as $fam) {
- if (!$fam->equals($family)) {
- if ((is_null($fam->getHusband()) || !$fam->getHusband()->equals($family->getHusband())) && (is_null($fam->getWife()) || $fam->getWife()->equals($family->getWife()))) {
+ if ($fam != $family) {
+ if ((is_null($fam->getHusband()) || $fam->getHusband() != $family->getHusband()) && (is_null($fam->getWife()) || $fam->getWife() == $family->getWife())) {
if ($family->getHusband()) {
if ($family->getWife()->getSex()=='F') {
return /* I18N: A step-family. %s is an individual’s name */ WT_I18N::translate('Mother’s family with %s', $family->getHusband()->getFullName());
@@ -951,7 +951,7 @@ class WT_Individual extends WT_GedcomRecord {
return /* I18N: A step-family. */ WT_I18N::translate('Father’s family with an unknown individual');
}
}
- } elseif ((is_null($fam->getWife()) || !$fam->getWife()->equals($family->getWife())) && (is_null($fam->getHusband()) || $fam->getHusband()->equals($family->getHusband()))) {
+ } elseif ((is_null($fam->getWife()) || $fam->getWife() != $family->getWife()) && (is_null($fam->getHusband()) || $fam->getHusband() == $family->getHusband())) {
if ($family->getWife()) {
if ($family->getHusband()->getSex()=='F') {
return /* I18N: A step-family. %s is an individual’s name */ WT_I18N::translate('Mother’s family with %s', $family->getWife()->getFullName());
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 6299c4ab10..d3c5a70b81 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php
@@ -1086,7 +1086,7 @@ if (!defined('WT_WEBTREES')) {
echo addslashes($fulln); // mnam = Full Name
}
?>", "<?php
- if ($gparent->equals($person)) {
+ if ($gparent == $person) {
echo "Head"; // label = Head
} else {
echo $label; // label = Relationship
@@ -1582,7 +1582,7 @@ function print_pedigree_person_nav2($pid, $style=1, $count=0, $personcount="1",
//-- Step Husband --------------------------------------
if ($natdad == "yes") {
} else {
- if (($husb || $num>0) && !$husb->equals($person)) {
+ if (($husb || $num>0) && $husb != $person) {
if ($husb) {
//-- Step Husbands Parents -----------------------------
$gparent=WT_Individual::getInstance($husb->getXref());
diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php
index a2726fe43b..5f8f65f037 100644
--- a/modules_v3/personal_facts/module.php
+++ b/modules_v3/personal_facts/module.php
@@ -337,7 +337,7 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
foreach ($family->getSpouses() as $spouse) {
foreach ($spouse->getSpouseFamilies() as $sfamily) {
- if (!$family->equals($sfamily)) {
+ if ($family != $sfamily) {
// Add half-siblings
foreach (self::child_facts($person, $sfamily, '_HSIB', '') as $fact) {
$facts[] = $fact;
diff --git a/modules_v3/tree/class_treeview.php b/modules_v3/tree/class_treeview.php
index 152020a036..8afa4131bc 100644
--- a/modules_v3/tree/class_treeview.php
+++ b/modules_v3/tree/class_treeview.php
@@ -244,8 +244,8 @@ class TreeView {
$dashed = '';
foreach ($sfams as $famid=>$family) {
$p = $family->getSpouse($person);
- if (!empty($p)) {
- if (($p->equals($partner)) || $this->allPartners) {
+ if ($p) {
+ if (($p == $partner) || $this->allPartners) {
$pf = $p->getPrimaryChildFamily();
if (!empty($pf)) {
$fop[] = Array($pf->getHusband(), $pf);
diff --git a/pedigree.php b/pedigree.php
index 6d7d423d3f..c8eb0fa22f 100644
--- a/pedigree.php
+++ b/pedigree.php
@@ -225,7 +225,7 @@ if (count($famids)>0) {
echo '<span class="name1"><br>', WT_I18N::translate('Sibling'), '<br></span>';
}
foreach ($children as $child) {
- if (!$controller->root->equals($child) && !is_null($child)) {
+ if ($controller->root != $child) {
echo "&nbsp;&nbsp;<a href=\"pedigree.php?PEDIGREE_GENERATIONS={$controller->PEDIGREE_GENERATIONS}&amp;rootid=".$child->getXref()."&amp;show_full={$controller->show_full}&amp;talloffset={$talloffset}\"><span ";
$name = $child->getFullName();
echo 'class="name1"> ';