summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/WT/Controller/AdvancedSearch.php8
-rw-r--r--library/WT/Controller/Ancestry.php8
-rw-r--r--library/WT/Controller/Base.php30
-rw-r--r--library/WT/Controller/Descendancy.php8
-rw-r--r--library/WT/Controller/Family.php2
-rw-r--r--library/WT/Controller/GedcomRecord.php30
-rw-r--r--library/WT/Controller/Hourglass.php8
-rw-r--r--library/WT/Controller/Individual.php11
-rw-r--r--library/WT/Controller/Lifespan.php9
-rw-r--r--library/WT/Controller/Media.php2
-rw-r--r--library/WT/Controller/Note.php2
-rw-r--r--library/WT/Controller/Pedigree.php8
-rw-r--r--library/WT/Controller/Repository.php2
-rw-r--r--library/WT/Controller/Search.php16
-rw-r--r--library/WT/Controller/Source.php2
-rw-r--r--library/WT/Controller/Timeline.php9
16 files changed, 73 insertions, 82 deletions
diff --git a/library/WT/Controller/AdvancedSearch.php b/library/WT/Controller/AdvancedSearch.php
index ae8b81f439..cbec1757e3 100644
--- a/library/WT/Controller/AdvancedSearch.php
+++ b/library/WT/Controller/AdvancedSearch.php
@@ -36,6 +36,9 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search {
function __construct() {
parent::__construct();
+
+ $this->setPageTitle(WT_I18N::translate('Advanced search'));
+
if (empty($_REQUEST['action'])) {
$this->action="advanced";
}
@@ -112,11 +115,6 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search {
return $ofields;
}
- function getPageTitle() {
- if ($this->action=="advanced") return WT_I18N::translate('Advanced search');
- else parent :: getPageTitle();
- }
-
function getValue($i) {
$val = "";
if (isset($this->values[$i])) $val = $this->values[$i];
diff --git a/library/WT/Controller/Ancestry.php b/library/WT/Controller/Ancestry.php
index a4984d8e21..715f283226 100644
--- a/library/WT/Controller/Ancestry.php
+++ b/library/WT/Controller/Ancestry.php
@@ -47,6 +47,9 @@ class WT_Controller_Ancestry extends WT_Controller_Chart {
global $DEFAULT_PEDIGREE_GENERATIONS, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight;
global $show_full;
+ parent::__construct();
+ $this->setPageTitle(/* I18N: %s is a person's name */ WT_I18N::translate('Ancestors of %s', $this->name));
+
// Extract form parameters
$this->rootid =safe_GET_xref('rootid');
$this->show_full =safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
@@ -85,11 +88,6 @@ class WT_Controller_Ancestry extends WT_Controller_Chart {
else $this->cellwidth=(strlen($this->name)*14);
}
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
- return /* I18N: %s is a person's name */ WT_I18N::translate('Ancestors of %s', $this->name);
- }
-
/**
* print a child ascendancy
*
diff --git a/library/WT/Controller/Base.php b/library/WT/Controller/Base.php
index bc442421bd..17e1bac21c 100644
--- a/library/WT/Controller/Base.php
+++ b/library/WT/Controller/Base.php
@@ -29,7 +29,12 @@ if (!defined('WT_WEBTREES')) {
}
class WT_Controller_Base {
- private $page_header=false; // Used to automatically print the footer
+ // Page header information
+ const DOCTYPE ='<!DOCTYPE html>'; // HTML5
+ private $canonical_url='';
+ private $meta_robots ='noindex,nofollow'; // Most pages are not intended for robots
+ private $page_header =false; // Have we printed a page header?
+ private $page_title =WT_WEBTREES; // <head><title> $page_title </title></head>
// Startup activity
public function __construct() {
@@ -44,19 +49,22 @@ class WT_Controller_Base {
}
// What should this page show in the browser's title bar?
+ public function setPageTitle($page_title) {
+ $this->page_title=$page_title;
+ }
+ // Some pages will want to display this as <h2> $page_title </h2>
public function getPageTitle() {
- return '';
+ return $this->page_title;
}
// What is the preferred URL for this page?
- public function getCanonicalUrl() {
- return '';
+ public function setCanonicalUrl($canonical_url) {
+ $this->canonical_url=$canonical_url;
}
- // How should robots index this page?
- public function getMetaRobots() {
- // Most pages are not designed for search engines
- return 'noindex,nofollow';
+ // Should robots index this page?
+ public function setMetaRobots($meta_robots) {
+ $this->meta_robots=$meta_robots;
}
// Print the page header, using the theme
@@ -67,11 +75,11 @@ class WT_Controller_Base {
// The title often includes the names of records, which may have markup
// that cannot be used in the page title.
- $title=htmlspecialchars_decode(strip_tags($this->getPageTitle()));
+ $title=htmlspecialchars_decode(strip_tags($this->page_title));
// Initialise variables for the theme's header.php
- $LINK_CANONICAL =$this->getCanonicalUrl();
- $META_ROBOTS =$this->getMetaRobots();
+ $LINK_CANONICAL =$this->canonical_url;
+ $META_ROBOTS =$this->meta_robots;
$GEDCOM_TITLE =get_gedcom_setting(WT_GED_ID, 'title');
$META_DESCRIPTION=get_gedcom_setting(WT_GED_ID, 'META_DESCRIPTION', $GEDCOM_TITLE);
$META_GENERATOR =WT_WEBTREES.'-'.WT_VERSION_TEXT.' - '.WT_WEBTREES_URL;
diff --git a/library/WT/Controller/Descendancy.php b/library/WT/Controller/Descendancy.php
index b38011e9b6..647325b236 100644
--- a/library/WT/Controller/Descendancy.php
+++ b/library/WT/Controller/Descendancy.php
@@ -59,6 +59,9 @@ class WT_Controller_Descendancy extends WT_Controller_Chart {
function __construct() {
global $USE_RIN, $MAX_ALIVE_AGE, $bwidth, $bheight, $pbwidth, $pbheight, $GEDCOM, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full;
+ parent::__construct();
+ $this->setPageTitle(/* I18N: %s is a person's name */ WT_I18N::translate('Descendants of %s', $this->name));
+
// Extract parameters from form
$this->pid =safe_GET_xref('pid');
$this->show_full =safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
@@ -96,11 +99,6 @@ class WT_Controller_Descendancy extends WT_Controller_Chart {
$this->name=$this->descPerson->getFullName();
}
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
- return /* I18N: %s is a person's name */ WT_I18N::translate('Descendants of %s', $this->name);
- }
-
/**
* print a child family
*
diff --git a/library/WT/Controller/Family.php b/library/WT/Controller/Family.php
index ee37379368..4a572106a3 100644
--- a/library/WT/Controller/Family.php
+++ b/library/WT/Controller/Family.php
@@ -72,6 +72,8 @@ class WT_Controller_Family extends WT_Controller_GedcomRecord {
$this->record->diffMerge($this->diff_record);
}
}
+
+ parent::__construct();
}
// Get significant information from this page, to allow other pages such as
diff --git a/library/WT/Controller/GedcomRecord.php b/library/WT/Controller/GedcomRecord.php
index 27f9519b47..f58c49d1e5 100644
--- a/library/WT/Controller/GedcomRecord.php
+++ b/library/WT/Controller/GedcomRecord.php
@@ -28,33 +28,25 @@ if (!defined('WT_WEBTREES')) {
class WT_Controller_GedcomRecord extends WT_Controller_Base {
public $record; // individual, source, repository, etc.
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
+ public function __construct() {
+ parent::__construct();
+
+ // We want robots to index this page
+ $this->setMetaRobots('index,follow');
+
+ // Set a page title
if ($this->record) {
+ $this->setCanonicalUrl($this->record->getHtmlUrl());
if ($this->record->canDisplayName()) {
// e.g. "John Doe" or "1881 Census of Wales"
- return $this->record->getFullName();
+ $this->setPageTitle($this->record->getFullName());
} else {
// e.g. "Individual" or "Source"
- return WT_Gedcom_Tag::getLabel($this->record->getType());
+ $this->setPageTitle(WT_Gedcom_Tag::getLabel($this->record->getType()));
}
} else {
// No such record
- return WT_I18N::translate('Not found');
+ $this->setPageTitle(WT_I18N::translate('Not found'));
}
}
-
- // What is the preferred URL for this page?
- public function getCanonicalUrl() {
- if ($this->record) {
- return $this->record->getHtmlUrl();
- } else {
- return parent::getCanonicalUrl();
- }
- }
-
- // How should robots index this page?
- public function getMetaRobots() {
- return 'index,follow';
- }
}
diff --git a/library/WT/Controller/Hourglass.php b/library/WT/Controller/Hourglass.php
index 86f46514cb..8ad25762f1 100644
--- a/library/WT/Controller/Hourglass.php
+++ b/library/WT/Controller/Hourglass.php
@@ -65,6 +65,9 @@ class WT_Controller_Hourglass extends WT_Controller_Chart {
global $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $bheight, $bwidth, $bhalfheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS;
global $WT_IMAGES, $TEXT_DIRECTION, $show_full;
+ parent::__construct();
+ $this->setPageTitle(/* I18N: %s is a person's name */ WT_I18N::translate('Hourglass chart of %s', $this->name));
+
// Extract parameters from from
$this->pid =safe_GET_xref('pid');
$this->show_full =safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS);
@@ -108,11 +111,6 @@ class WT_Controller_Hourglass extends WT_Controller_Chart {
if ($this->dgenerations<1) $this->dgenerations=1;
}
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
- return /* I18N: %s is a person's name */ WT_I18N::translate('Hourglass chart of %s', $this->name);
- }
-
/**
* Prints pedigree of the person passed in. Which is the descendancy
*
diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php
index 90c46a2f09..1a24d31044 100644
--- a/library/WT/Controller/Individual.php
+++ b/library/WT/Controller/Individual.php
@@ -76,14 +76,13 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord {
}
$this->tabs=WT_Module::getActiveTabs();
- }
- // Page title
- function getPageTitle() {
+ // Our parent needs $this->record
+ parent::__construct();
+
+ // If we can display the details, add them to the page header
if ($this->record && $this->record->canDisplayDetails()) {
- return parent::getPageTitle().' '.$this->record->getLifespan();
- } else {
- return parent::getPageTitle();
+ $this->setPageTitle($this->record->getFullName().' '.$this->record->getLifespan());
}
}
diff --git a/library/WT/Controller/Lifespan.php b/library/WT/Controller/Lifespan.php
index 54ab1b114e..1aa314ae57 100644
--- a/library/WT/Controller/Lifespan.php
+++ b/library/WT/Controller/Lifespan.php
@@ -68,6 +68,10 @@ class WT_Controller_Lifespan extends WT_Controller_Chart {
function __construct() {
global $GEDCOM_ID_PREFIX;
+
+ parent::__construct();
+ $this->setPageTitle(WT_I18N::translate('Lifespans'));
+
$this->colorindex = 0;
$this->Fcolorindex = 0;
$this->Mcolorindex = 0;
@@ -194,11 +198,6 @@ class WT_Controller_Lifespan extends WT_Controller_Chart {
}
}
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
- return WT_I18N::translate('Lifespans');
- }
-
// Add a person (and optionally their immediate family members) to the pids array
function addFamily($person, $add_family) {
if ($person) {
diff --git a/library/WT/Controller/Media.php b/library/WT/Controller/Media.php
index de8d6e1c33..8d0a422dbc 100644
--- a/library/WT/Controller/Media.php
+++ b/library/WT/Controller/Media.php
@@ -90,6 +90,8 @@ class WT_Controller_Media extends WT_Controller_GedcomRecord {
if (is_null($this->record)) return false;
$this->record->ged_id=WT_GED_ID; // This record is from a file
+
+ parent::__construct();
}
/**
diff --git a/library/WT/Controller/Note.php b/library/WT/Controller/Note.php
index 360c0057cd..a03a1dedc5 100644
--- a/library/WT/Controller/Note.php
+++ b/library/WT/Controller/Note.php
@@ -61,6 +61,8 @@ class WT_Controller_Note extends WT_Controller_GedcomRecord {
$diff_record->setChanged(true);
$this->record->diffMerge($diff_record);
}
+
+ parent::__construct();
}
/**
diff --git a/library/WT/Controller/Pedigree.php b/library/WT/Controller/Pedigree.php
index 9a47c3e2b0..46fc1fc9e2 100644
--- a/library/WT/Controller/Pedigree.php
+++ b/library/WT/Controller/Pedigree.php
@@ -56,6 +56,9 @@ class WT_Controller_Pedigree extends WT_Controller_Chart {
global $bwidth, $bheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing;
global $TEXT_DIRECTION, $BROWSER_TYPE, $show_full, $talloffset;
+ parent::__construct();
+ $this->setPageTitle(/* I18N: %s is a person's name */ WT_I18N::translate('Pedigree tree of %s', $this->name));
+
$this->log2 = log(2);
$this->rootid =safe_GET_xref('rootid');
@@ -245,11 +248,6 @@ class WT_Controller_Pedigree extends WT_Controller_Chart {
$this->adjust_subtree(0, $ydiff);
}
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
- return /* I18N: %s is a person's name */ WT_I18N::translate('Pedigree tree of %s', $this->name);
- }
-
function getPersonName() {
if (is_null($this->rootPerson)) {
return WT_I18N::translate('unknown');
diff --git a/library/WT/Controller/Repository.php b/library/WT/Controller/Repository.php
index 5c69dbfaa6..55f3104c4e 100644
--- a/library/WT/Controller/Repository.php
+++ b/library/WT/Controller/Repository.php
@@ -61,6 +61,8 @@ class WT_Controller_Repository extends WT_Controller_GedcomRecord {
$diff_record->setChanged(true);
$this->record->diffMerge($diff_record);
}
+
+ parent::__construct();
}
/**
diff --git a/library/WT/Controller/Search.php b/library/WT/Controller/Search.php
index a5777a380b..52d3ae306d 100644
--- a/library/WT/Controller/Search.php
+++ b/library/WT/Controller/Search.php
@@ -87,6 +87,8 @@ class WT_Controller_Search extends WT_Controller_Base {
function __construct() {
global $GEDCOM;
+ parent::__construct();
+
if ($this->action=='') {
$this->action='general';
}
@@ -252,28 +254,20 @@ class WT_Controller_Search extends WT_Controller_Base {
// If we want to show associated persons, build the list
switch ($this->action) {
case 'general':
+ $this->setPageTitle(WT_I18N::translate('General search'));
$this->GeneralSearch();
break;
case 'soundex':
+ $this->setPageTitle(WT_I18N::translate('Phonetic search'));
$this->SoundexSearch();
break;
case 'replace':
+ $this->setPageTitle(WT_I18N::translate('Search and replace'));
$this->SearchAndReplace();
return;
}
}
- function getPageTitle() {
- switch ($this->action) {
- case 'general':
- return WT_I18N::translate('General search');
- case 'soundex':
- return WT_I18N::translate('Phonetic search');
- case 'replace':
- return WT_I18N::translate('Search and replace');
- }
- }
-
/**
* setRequestValues - Checks if the variable names ($varNames) are in
* the $_REQUEST and if so assigns their values to
diff --git a/library/WT/Controller/Source.php b/library/WT/Controller/Source.php
index ae43e8ee49..08b5b472d9 100644
--- a/library/WT/Controller/Source.php
+++ b/library/WT/Controller/Source.php
@@ -61,6 +61,8 @@ class WT_Controller_Source extends WT_Controller_GedcomRecord {
$diff_record->setChanged(true);
$this->record->diffMerge($diff_record);
}
+
+ parent::__construct();
}
/**
diff --git a/library/WT/Controller/Timeline.php b/library/WT/Controller/Timeline.php
index 6cae68d341..0ffa616295 100644
--- a/library/WT/Controller/Timeline.php
+++ b/library/WT/Controller/Timeline.php
@@ -48,6 +48,10 @@ class WT_Controller_Timeline extends WT_Controller_Chart {
var $nonfacts = array("BAPL","ENDL","SLGC","SLGS","_TODO","CHAN");
function __construct() {
+ parent::__construct();
+
+ $this->setPageTitle(WT_I18N::translate('Timeline'));
+
$this->baseyear = date("Y");
//-- new pid
$newpid=safe_GET_xref('newpid');
@@ -134,11 +138,6 @@ class WT_Controller_Timeline extends WT_Controller_Chart {
$this->topyear += 5;
}
- // What should this page show in the browser's title bar?
- public function getPageTitle() {
- return WT_I18N::translate('Timeline');
- }
-
/**
* check the privacy of the incoming people to make sure they can be shown
*/