1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Issue #4352 - Canonical added for page, forum and download. Replaced some e_PAGETITLE with e107::title()

This commit is contained in:
Cameron
2021-01-19 09:50:02 -08:00
parent 76144e6b4f
commit f091709847
10 changed files with 128 additions and 55 deletions

View File

@@ -19,6 +19,7 @@ if(!e_QUERY)
$e107CorePage->setRequest('listBooks');
$e107CorePage->listBooks();
e107::canonical('page/list/index');
require_once(HEADERF);
e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], "cpage-full-list");
@@ -36,8 +37,9 @@ if(!e_QUERY)
}
elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book
{
$e107CorePage->setRequest('listChapters');
$e107CorePage->listChapters($_GET['bk']);
$id = $e107CorePage->setRequest('listChapters');
$e107CorePage->listChapters($id);
e107::canonical('page/book/index', $e107CorePage->getChapterData($id));
require_once(HEADERF);
e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage-chapter-list');
@@ -46,9 +48,10 @@ elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book
}
elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter
{
$e107CorePage->setRequest('listPages');
$e107CorePage->listPages($_GET['ch']);
$id = $e107CorePage->setRequest('listPages');
$e107CorePage->listPages($id);
e107::canonical('page/chapter/index', $e107CorePage->getChapterData($id));
unset($row);
require_once(HEADERF);
e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage-page-list');
require_once(FOOTERF);
@@ -60,6 +63,7 @@ else
$e107CorePage->processViewPage();
$e107CorePage->setPage();
e107::canonical('page/view', $e107CorePage->page);
require_once(HEADERF);
$ns = e107::getRender();
@@ -164,7 +168,6 @@ class pageClass
}
// XXX temporary solution - upcoming page rewrite
public function setRequest($request)
{
switch ($request)
@@ -187,9 +190,33 @@ class pageClass
break;
}
e107::setRegistry('core/page/request', array('action' => $request, 'id' => $id));
return $id;
}
/**
* @param $chapter
* @return array|mixed
*/
public function getChapterData($chapter)
{
if(!isset($this->chapterData[$chapter]))
{
return array();
}
$row = $this->chapterData[$chapter];
$row['book_sef'] = $this->getSef($row['chapter_id']);
$row['book_id'] = (int) $row['chapter_parent'];
$row['book_name'] = $this->getName($row['chapter_parent']);
$row['book_icon'] = $this->getIcon($row['chapter_parent']);
$row['book_description'] = $this->getDescription($row['chapter_parent']);
return $row;
}
private function getSef($chapter)
{
@@ -311,14 +338,21 @@ class pageClass
{
$layout = $brow['chapter_template'];
}
if($this->displayAllMode === true)
{
$layout = e107::getPref('listBooksTemplate');
}
if(empty($layout) && ADMIN)
{
e107::getMessage()->addError("Admin Only Message: The chapter template is empty. Reverting to 'default'."); // NO LAN
$layout = 'default';
}
$tml = e107::getCoreTemplate('chapter','', true, true); // always merge
$error = array('listChapters' => array('start'=>"Chapter template not found: ".$layout));
@@ -454,7 +488,7 @@ class pageClass
'book_id' => $row['chapter_parent']
);
//print_a($this->chapterData);
$tml = e107::getCoreTemplate('chapter','', true, true); // always merge
@@ -692,8 +726,9 @@ class pageClass
$this->batch->setVars($this->page);
$this->batch->breadcrumb();
define('e_PAGETITLE', eHelper::formatMetaTitle($this->page['page_title']));
e107::title(eHelper::formatMetaTitle($this->page['page_title']));
if($this->page['page_metadscr']) define('META_DESCRIPTION', eHelper::formatMetaDescription($this->page['page_metadscr']));
if(!empty($this->page['page_metakeys']))
{
@@ -1098,4 +1133,4 @@ class pageClass
}
}
?>