.
*/
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\Functions\Functions;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Theme;
/**
* Class PageController Controller for full-page, themed HTML responses
*/
class PageController extends BaseController {
/** @var string Some pages have multiple URLs (TODO really?) */
private $canonical_url = '';
/** @var string Most pages are not intended for robots */
private $meta_robots = 'noindex,nofollow';
/** @var string
$page_title */
private $page_title = WT_WEBTREES;
/** @var bool Is this a popup window? */
private $popup;
/**
* What should this page show in the browser’s title bar?
*
* @param string $page_title
*
* @return $this
*/
public function setPageTitle($page_title) {
$this->page_title = $page_title;
return $this;
}
/**
* Some pages will want to display this as $page_title
*
* @return string
*/
public function getPageTitle() {
return $this->page_title;
}
/**
* What is the preferred URL for this page?
*
* @param string $canonical_url
*
* @return $this
*/
public function setCanonicalUrl($canonical_url) {
$this->canonical_url = $canonical_url;
return $this;
}
/**
* What is the preferred URL for this page?
*
* @return string
*/
public function getCanonicalUrl() {
return $this->canonical_url;
}
/**
* Should robots index this page?
*
* @param string $meta_robots
*
* @return $this
*/
public function setMetaRobots($meta_robots) {
$this->meta_robots = $meta_robots;
return $this;
}
/**
* Should robots index this page?
*
* @return string
*/
public function getMetaRobots() {
return $this->meta_robots;
}
/**
* Restrict access
*
* @param bool $condition
*
* @return $this
*/
public function restrictAccess($condition) {
if ($condition !== true) {
header('Location: ' . WT_LOGIN_URL . '?url=' . rawurlencode(Functions::getQueryUrl()));
exit;
}
return $this;
}
/**
* Print the page footer, using the theme
*/
public function pageFooter() {
echo
Theme::theme()->footerContainer() .
'' .
'' .
'' .
'' .
$this->getJavascript() .
Theme::theme()->hookFooterExtraJavascript() .
(WT_DEBUG_SQL ? Database::getQueryLog() : '') .
'