diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php index 599e7107b..ee89aea75 100644 --- a/e107_core/shortcodes/batch/page_shortcodes.php +++ b/e107_core/shortcodes/batch/page_shortcodes.php @@ -58,7 +58,7 @@ class cpage_shortcodes extends e_shortcode function getChapter() { - $id = $this->var['page_chapter']; + $id = varset($this->var['page_chapter']); if(!empty($this->chapterData[$id]['chapter_id']) && $this->chapterData[$id]['chapter_parent'] > 0) { @@ -663,7 +663,8 @@ class cpage_shortcodes extends e_shortcode $action = varset($request['action']); $row = $this->getChapter(); - $brow = $this->getBook($row['chapter_parent']); + $parent = isset($row['chapter_parent']) ? (int) $row['chapter_parent'] : 0; + $brow = $this->getBook($parent); if(empty($brow['chapter_sef']) || $this->breadcrumbComplete === true || ($action === 'listBooks')) { diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 32c355aa1..b3d6d4e6e 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -191,6 +191,11 @@ class e_theme $ret = []; + if(empty($themeXMLData)) + { + return $ret; + } + foreach($themeXMLData as $info) { if(!isset($info['scope'])) diff --git a/e107_tests/tests/unit/e_parse_shortcodeTest.php b/e107_tests/tests/unit/e_parse_shortcodeTest.php index d9ea56d36..f9c081a08 100644 --- a/e107_tests/tests/unit/e_parse_shortcodeTest.php +++ b/e107_tests/tests/unit/e_parse_shortcodeTest.php @@ -438,6 +438,62 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit } + // "Next/Prev" + public function testPaginationShortCode() + { + require_once(e_CORE."shortcodes/single/nextprev.php"); + + $tests = array( + 0 => array( + 'parm' => array ( + 'nonavcount' => '', + 'bullet' => '', + 'caption' => '', + 'pagetitle' => 'Page 1|Page1|Page2|Page3', + 'tmpl_prefix' => 'page', + 'total' => '4', + 'amount' => '1', + 'current' => '0', + 'url' => '/new-page-test?page=--FROM--', + ), + 'expected' => ' + +
+ +'), + 1 => array( + 'parm' => array ( + 'nonavcount' => '', + 'bullet' => '', + 'caption' => '', + 'pagetitle' => 'Page 1|Page1|Page2|Page3', + 'tmpl_prefix' => 'dropdown', + 'total' => '4', + 'amount' => '1', + 'current' => '0', + 'url' => '/new-page-test?page=--FROM--', + ), + 'expected' => ' + + + +', + ), + + + ); + + foreach($tests as $item) + { + $result = nextprev_shortcode($item['parm']); + $this->assertSame($item['expected'], $result); + } + + + } + public function testNewsArchiveShortcodes() { diff --git a/page.php b/page.php index 3763eef50..e0c42c73d 100644 --- a/page.php +++ b/page.php @@ -38,6 +38,7 @@ if(!e_QUERY) } elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book { + e107::getDebug()->log("Page Mode: Display list of chapters within a book"); $id = $e107CorePage->setRequest('listChapters'); $e107CorePage->listChapters($id); e107::canonical('page/book/index', $e107CorePage->getChapterData($id)); @@ -50,6 +51,7 @@ elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book } elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter { + e107::getDebug()->log("Page Mode: Display list of pages within a chapter"); $id = $e107CorePage->setRequest('listPages'); $e107CorePage->listPages($id); $chData = $e107CorePage->getChapterData($id); @@ -64,6 +66,7 @@ elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter } else { + e107::getDebug()->log("Page Mode: Display page"); $e107CorePage->setRequest('showPage'); $e107CorePage->processViewPage(); $e107CorePage->setPage();