From d0dffff25484011828f8149951eaad840e9163c7 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 29 Apr 2020 02:55:31 +0200 Subject: fix default thumbnail and lewline errors --- app/class/Optlist.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/app/class/Optlist.php b/app/class/Optlist.php index 32107d7..408c1c6 100644 --- a/app/class/Optlist.php +++ b/app/class/Optlist.php @@ -30,8 +30,13 @@ class Optlist extends Opt return '%LIST?' . $this->getquery() . '%'; } - - public function listhtml(array $pagelist, Page $actualpage, Modelrender $render) + /** + * @param Page[] $pagelist + * @param Page $currentpage + * @param Modelrender $render + * @retrun string HTML formated string + */ + public function listhtml(array $pagelist, Page $currentpage, Modelrender $render): string { $this->render = $render; @@ -40,7 +45,7 @@ class Optlist extends Opt foreach ($pagelist as $page) { // ================= Class ============= $classdata = []; - if ($page->id() === $actualpage->id()) { + if ($page->id() === $currentpage->id()) { $classdata['actual'] = 'current_page'; } $classdata['secure'] = $page->secure('string'); @@ -56,16 +61,24 @@ class Optlist extends Opt $content .= '' . $page->description() . ''; } if ($this->date()) { - $content .= '\n'; + $date = $page->date('pdate'); + $content .= "\n"; } if ($this->time()) { - $content .= '\n'; + $time = $page->date('ptime'); + $content .= "\n"; } if ($this->author()) { $content .= $page->authors('string') . PHP_EOL; } if ($this->thumbnail) { - $src = Model::thumbnailpath() . $page->thumbnail(); + if (!empty($page->thumbnail())) { + $src = Model::thumbnailpath() . $page->thumbnail(); + } elseif (!empty(Config::defaultthumbnail())) { + $src = Model::thumbnailpath() . Config::defaultthumbnail(); + } else { + $src = ""; + } $content .= '' . $page->title() . ''; } @@ -89,17 +102,17 @@ class Optlist extends Opt public function ul(string $content) { - return ''; + return '' . PHP_EOL; } public function li(string $content, string $id) { - return '
  • ' . PHP_EOL . $content . PHP_EOL . '
  • \n'; + return '
  • ' . PHP_EOL . $content . PHP_EOL . '
  • ' . PHP_EOL; } public function a(string $content, string $class, string $id) { - return '' . $content . '\n'; + return '' . $content . ''; } public function spandescription(Page $page) -- cgit v1.2.3