You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			91 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			91 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			PHP
		
	
<?php
 | 
						|
	require_once '+getenv.php';
 | 
						|
 | 
						|
	$instruction_files = glob("+instructions/*.txt");
 | 
						|
	function file_language($file) {
 | 
						|
		$filename = pathinfo($file)['filename'];
 | 
						|
		return explode(" ", $filename)[0];
 | 
						|
	}
 | 
						|
	function file_language_code($file) {
 | 
						|
		$filename = pathinfo($file)['filename'];
 | 
						|
		$code_in_brackets = explode(" ", $filename)[1];
 | 
						|
		return mb_substr($code_in_brackets, 1, mb_strlen($code_in_brackets) - 2);
 | 
						|
	}
 | 
						|
 | 
						|
	$languages = array_map('file_language', array_slice($instruction_files, 0, 10));
 | 
						|
	$language_enumeration = join(", ", $languages);
 | 
						|
?>
 | 
						|
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
	<head>
 | 
						|
		<?php include "+components/page-head.php" ?>
 | 
						|
 | 
						|
		<link rel="canonical" href="<?=$SITE_CANONICAL_URL?>/instructions/">
 | 
						|
		<link rel="stylesheet" href="/css/common-dark.css">
 | 
						|
		<link rel="stylesheet" href="/css/instructions.css">
 | 
						|
		<style type="text/css">
 | 
						|
<?php foreach ($instruction_files as $i => $file): ?>
 | 
						|
			#language-selection-<?=$i?>:checked ~
 | 
						|
			#instructions #instructions-<?=$i?> {
 | 
						|
				display: block;
 | 
						|
			}
 | 
						|
<?php endforeach; ?>
 | 
						|
		</style>
 | 
						|
		<meta name="description" content="
 | 
						|
			Issues joining Session Communities?<?php
 | 
						|
			?>Read guides by sessioncommunities.online contributors, available in <?=
 | 
						|
			$language_enumeration
 | 
						|
		?>">
 | 
						|
		<meta property="og:title" content="How to — sessioncommunities.online">
 | 
						|
		<meta property="og:description" content="Learn how to use sessioncommunities.online to join Communities in Session Messenger.">
 | 
						|
		<meta property="og:url" content="<?=$SITE_CANONICAL_URL?>/instructions/">
 | 
						|
		<meta property="og:type" content="article">
 | 
						|
		<title>Instructions — sessioncommunities.online</title>
 | 
						|
	</head>
 | 
						|
	<body>
 | 
						|
		<header>
 | 
						|
			<h1>Instructions for joining Session Communities</h1>
 | 
						|
		</header>
 | 
						|
		<main>
 | 
						|
			<p id="link-return">
 | 
						|
				<a href="/" title="Return to the Session Community listing">
 | 
						|
					Go back to Community list
 | 
						|
				</a>
 | 
						|
			</p>
 | 
						|
			<h2 id="language-selection-title">
 | 
						|
				Choose your language:
 | 
						|
			</h2>
 | 
						|
			<br>
 | 
						|
<?php foreach ($instruction_files as $i => $file): ?>
 | 
						|
			<input
 | 
						|
				id="language-selection-<?=$i?>"
 | 
						|
				class="language-selection"
 | 
						|
				name="language"
 | 
						|
				type="radio"
 | 
						|
				<?=file_language($file) == 'English' ? 'checked="checked"' : ''?>
 | 
						|
			><label for="language-selection-<?=$i?>"> <?=
 | 
						|
					file_language($file);
 | 
						|
			?></label>
 | 
						|
<?php endforeach; ?>
 | 
						|
 | 
						|
			<article id="instructions">
 | 
						|
<?php foreach ($instruction_files as $i => $file): ?>
 | 
						|
			<section id="instructions-<?=$i?>" class="instructions" lang="<?=file_language_code($file)?>"><?php
 | 
						|
				// Sanitization as second layer of protection
 | 
						|
				// for user-submitted instruction files.
 | 
						|
				// Should not ever have to be used.
 | 
						|
				$content = trim(file_get_contents($file));
 | 
						|
				$content = htmlentities($content);
 | 
						|
				// Minimal formatting so that contributions are easier
 | 
						|
				$content = str_replace("\n-", "\n\n•", $content);
 | 
						|
				$content = str_replace("\n\n\n", "<br><br>", $content);
 | 
						|
				$content = str_replace("\n\n", "<br>", $content);
 | 
						|
				echo $content;
 | 
						|
			?>
 | 
						|
			</section>
 | 
						|
<?php endforeach; ?>
 | 
						|
			</article>
 | 
						|
		</main>
 | 
						|
	</body>
 | 
						|
</html>
 |