console.log('.json_encode($obj).');'; } function get_page_header( ?string $page_title = null, bool $include_app_name = true, array $scripts = [] ): string { global $api; $greeting = ''; $logout_link = ''; if ($api->isAuthenticated(false, true)) { $u = $api->getAuthorizedUser(); $greeting = 'Welcome, ' . ($u->name ?? '@'.$u->username); $logout_link = 'Logout'; } else { $greeting = 'Login with pnut'; } $title = ''; if ($include_app_name) { $title = $api->app_name; } if (!empty($page_title)) { $title .= $include_app_name ? ' > ' : ''; $title .= $page_title; } $script_str = ''; foreach ($scripts as $script) { $script_str .= ''; } return '