* Link: http://seemslegit.com * License: GPLv2 * Description: A mashup of Default, Danbooru, the interface on qwebirc, and * some other sites, packaged in a light blue color. */ class Layout { public function display_page(Page $page, array $nav_links, array $sub_links) { global $config; $theme_name = $config->get_string(SetupConfig::THEME, 'lite'); $site_name = $config->get_string(SetupConfig::TITLE); $data_href = get_base_href(); $contact_link = contact_link(); $header_html = $page->get_all_html_headers(); $menu = ""; $left_block_html = ""; $main_block_html = ""; $sub_block_html = ""; $user_block_html = ""; foreach ($page->blocks as $block) { switch ($block->section) { case "left": $left_block_html .= $this->block_to_html($block, true, "left"); break; case "main": $main_block_html .= $this->block_to_html($block, false, "main"); break; case "user": $user_block_html .= $block->body; break; case "subheading": $sub_block_html .= $this->block_to_html($block, false, "main"); break; default: print "

error: {$block->header} using an unknown section ({$block->section})"; break; } } $custom_sublinks = ""; if (!empty($sub_links)) { $custom_sublinks = "

"; foreach ($sub_links as $nav_link) { $custom_sublinks .= $this->navlinks($nav_link->link, $nav_link->description, $nav_link->active); } $custom_sublinks .= "
"; } $debug = get_debug_info(); $contact = empty($contact_link) ? "" : "
Contact"; //$subheading = empty($page->subheading) ? "" : "
{$page->subheading}
"; /*$wrapper = ""; if(strlen($page->heading) > 100) { $wrapper = ' style="height: 3em; overflow: auto;"'; }*/ if ($page->left_enabled == false) { $left_block_html = ""; $main_block_html = "
{$main_block_html}
"; } else { $left_block_html = ""; $main_block_html = "
{$main_block_html}
"; } $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : ""; print << {$page->title} $header_html
$menu $custom_sublinks $sub_block_html
$left_block_html $flash_html $main_block_html EOD; } /* end of function display_page() */ public function block_to_html(Block $block, bool $hidable=false, string $salt=""): string { $h = $block->header; $b = $block->body; $i = str_replace(' ', '_', $h) . $salt; $html = "
"; if (!is_null($h)) { if ($salt == "main") { $html .= ""; } else { $html .= ""; } } if (!is_null($b)) { if ($salt =="main") { $html .= "
{$b}
"; } else { $html .= " "; } } $html .= "
"; return $html; } /** * #param string[] $pages_matched */ public function navlinks(Link $link, string $desc, bool $active): ?string { $html = null; if ($active) { $html = "{$desc}"; } else { $html = "{$desc}"; } return $html; } } /* end of class Layout */