" . PHP_EOL .
"" . PHP_EOL .
"
" . PHP_EOL .
" " . PHP_EOL .
" " . PHP_EOL .
" " . PHP_EOL .
" " . $title . "" . PHP_EOL .
" " . PHP_EOL .
" " . PHP_EOL;
$post =
" " . PHP_EOL .
"" . PHP_EOL;
$html5 = $pre . $html_data . $post;
return $html5;
}
/*
* Writes HTML table with the following info:
* Token + shortened pubkey | Name | Description | Users | View Links(?) | Join URL
*/
function get_table_html($info_arrays) {
$table_lines = array();
foreach($info_arrays as $id => $content) {
/*
* $id is "room token+shortened_pubkey", e.g. "example+09af"
* Each $content looks like this:
* $info_array = array(
* "name" => "Name of the room",
* "language" => "🇩🇪",
* "description" => "Some text that describes the community",
* "active_users" => 1234,
* "preview_link" => "https://example.com/r/example",
* "join_link" => "https://example.com/example?public_key=[64_hex_chars]"
* );
*/
$exploded = explode("/", $content["join_link"]); // https: + "" + 1.2.3.4:56789 + token?public_key=0123456789abcdef
$server_url = $exploded[0] . "//" . $exploded[2]; // extract server_url
$token = explode("?", $exploded[3])[0]; // extract token
$line =
" " . PHP_EOL .
" " . $id . " | " . PHP_EOL .
" " . $content["language"] . " | " . PHP_EOL .
" " . $content["name"] . " | " . PHP_EOL .
" " . $content["description"] . " | " . PHP_EOL .
" " . $content["active_users"] . " | " . PHP_EOL .
" " . $content["preview_link"] . " | " . PHP_EOL .
/*" " . substr($content["join_link"], 0, 32) . "..." . PHP_EOL .
" " . PHP_EOL .
" | " . PHP_EOL .*/
" " . $content["join_link"] . " | " . PHP_EOL .
"
" . PHP_EOL;
$table_lines[] = $line;
}
// prefix
$prefix =
"Session Communities
" . PHP_EOL .
"" . PHP_EOL .
" " . PHP_EOL .
" Identifier | " . PHP_EOL .
" L | " . PHP_EOL .
" Name | " . PHP_EOL .
" Description | " . PHP_EOL .
" Users | " . PHP_EOL .
" Preview | " . PHP_EOL .
" Join URL | " . PHP_EOL .
"
" . PHP_EOL;
// suffix
$suffix =
"
" . PHP_EOL .
"" . PHP_EOL;
// concatenate html
$html = $prefix;
foreach($table_lines as $line) {
$html = $html . $line;
}
$html = $html . $suffix;
return $html;
}
?>