\r\n" : "\r\n"; } function html_charset(string $charset = 'utf-8', ?int $version = null): string { return html_old_browser() ? "\r\n" : "\r\n"; } function html_stylesheet(string $name, array $params = [], ?int $version = null): string { if(html_modern()) $cssFormat = '/css/%s'; else { $cssFormat = '/css.php?path=%s'; if(empty($params['accent'])) $params['accent'] = html_default_mode() === FWH_JVDG ? '#2d9940' : '#4a3650'; if(!empty($params)) { foreach($params as $key => $val) $cssFormat .= '&' . rawurlencode($key) . '=' . str_replace('%', '%%', rawurlencode($val)); } } return "\r\n"; } function html_script(string $path, string $charset = 'utf-8', string $language = 'javascript', ?int $version = null): string { if($path[0] === '/' && $path[1] !== '/') $path = html_baseurl() . $path; $html = "\r\n"; } function html_meta(?int $version = null): string { $meta = "\r\n"; if(html_default_mode() === FWH_JVDG) $meta .= " \r\n"; return $meta; } function html_open(?int $version = null): string { return html_doctype($version) . (($version ?? html_default_ver()) < FWH_2020 ? "" : ''); } function html_close(?int $version = null): string { return ($version ?? html_default_ver()) < FWH_2020 ? "" : ''; } function html_head(string $title, array $vars = [], ?int $version = null): string { $version = $version ?? html_default_ver(); $accentColour = $vars['accent_colour'] ?? '#555'; $html = html_charset(); $html .= "{$title}"; switch ($version) { case FWH_2016: return $html . html_stylesheet('2016.css', ['accent' => $accentColour], $version) . html_meta($version); case FWH_2019: $html .= html_stylesheet('2019.css', ['accent' => $accentColour], $version); if (!empty($vars['transitional'])) $html .= html_stylesheet('2016-lite.css', ['accent' => $accentColour], $version); $html .= html_meta($version); if(html_modern()) { $html .= << :root { --accent-colour: {$accentColour}; } HTML; } return $html; } return ''; } function html_navigation(array $navigation, array $vars = [], ?int $version = null): string { $home = html_local_url($navigation[0]['link'] ?? $vars['link'] ?? '/'); if(html_old_browser()) { $title = !empty($vars['title1']) ? ($vars['title1'] . ($vars['title2'] ?? '')) : $vars['title'] ?? 'flashwave'; $html = ''; foreach ($navigation as $item) { $item['link'] = html_local_url($item['link']); $html .= ""; } return $html . '

' . $title . '

{$item['title']}
'; } switch ($version ?? html_default_ver()) { case FWH_2016: $title = $vars['title'] ?? 'flash.moe'; $html = <<
HTML; foreach ($navigation as $item) { $item['link'] = html_local_url($item['link']); $html .= sprintf(' %s ', $item['link'], $item['mdi-icon'] ?? 'mdi-link-variant', $item['title']); } $html .= <<
HTML; return $html; case FWH_2019: $title1 = $vars['title1'] ?? 'flash'; $title2 = $vars['title2'] ?? 'wave'; $html = <<
HTML; foreach ($navigation as $item) { $item['link'] = html_local_url($item['link']); $html .= "{$item['title']}"; } $html .= '
'; $html .= << HTML; return $html; } return ''; } function html_footer(?int $version = null): string { $currentYear = date('Y'); if(html_old_browser()) { return << © Flashwave 2010-{$currentYear}
HTML; } switch ($version ?? html_default_ver()) { case FWH_2016: return << © Flashwave 2010-{$currentYear} HTML; case FWH_2019: return << HTML; } return ''; } function html_sidebar(?int $version = null, ?array $links = null, ?array $accounts = null): string { $version = $version ?? html_default_ver(); if($version < FWH_2020) return ''; $isJvdg = html_default_mode() === FWH_JVDG; $links = $links ?? [ [ 'title' => 'Home', 'desc' => 'Index with latest blog posts', 'dest' => html_local_url('/'), 'hide' => $isJvdg, ], [ 'title' => 'Projects', 'desc' => 'List of things I\'ve made or am making', 'dest' => html_local_url('/projects'), 'hide' => $isJvdg, ], [ 'title' => 'Forum', 'desc' => 'Feature requests and bug reports for some projects', 'dest' => '//forum.flash.moe', 'hide' => $isJvdg, ], [ 'title' => 'Flashii', 'desc' => 'Community site I run and develop', 'dest' => '//flashii.net', 'hide' => $isJvdg, ], [ 'title' => 'Railgun', 'desc' => 'Chat server and chat protocols I work on', 'dest' => '//railgun.sh', 'hide' => $isJvdg, ], ]; $accounts = $accounts ?? [ [ 'title' => 'E-mail', 'url' => 'mailto:me+contact@flash.moe', 'image' => html_baseurl() . '/assets/icons/email.png', ], [ 'title' => 'Flashii', 'url' => '//flashii.net/profile.php?u=1', 'image' => html_baseurl() . '/assets/icons/flashii.png', 'hide' => $isJvdg, ], [ 'title' => 'Github', 'url' => '//github.com/flashwave', 'image' => html_baseurl() . '/assets/icons/github.png', ], [ 'title' => 'YouTube', 'url' => '//youtube.com/c/flashwave', 'image' => html_baseurl() . '/assets/icons/youtube.png', 'hide' => $isJvdg, ], [ 'title' => 'Twitch', 'url' => '//twitch.tv/flashwave0', 'image' => html_baseurl() . '/assets/icons/twitch.png', 'hide' => $isJvdg, ], [ 'title' => 'Steam', 'url' => '//steamcommunity.com/id/flashwave_', 'image' => html_baseurl() . '/assets/icons/steam.png', 'hide' => $isJvdg, ], [ 'title' => 'Twitter', 'url' => 'javascript:confirm(\'Proceed with caution.\') ? location.assign(\'//twitter.com/smugwave\') : void(0);', 'image' => html_baseurl() . '/assets/icons/twitter.png', 'hide' => $isJvdg, ], [ 'title' => 'last.fm', 'url' => '//www.last.fm/user/flashwave_', 'image' => html_baseurl() . '/assets/icons/lastfm.png', 'hide' => $isJvdg, ], [ 'title' => 'Nintendo', 'url' => '/nintendo', 'image' => html_baseurl() . '/assets/icons/ninswitch.png', 'hide' => $isJvdg, ], [ 'title' => 'Donate', 'url' => '//paypal.me/flashwave', 'image' => html_baseurl() . '/assets/icons/paypal.png', 'hide' => $isJvdg, ], ]; $title1 = $isJvdg ? 'julian' : 'flash'; $title2 = $isJvdg ? 'vdg' : 'wave'; $avatar = $isJvdg ? '//julianvdg.nl/avatar.php' : '//flashii.net/user-assets.php?m=avatar&u=1&r=120'; $avatarHTML = $isJvdg ? '' : ''; $html = << \r\n HTML; $name = $isJvdg ? 'Julian van de Groep' : 'Flashwave'; $year = date('Y'); if(!$isJvdg) $html .= <<
\r\n HTML; else $html .= ''; return $html; }