";
}
return "";
}
function urlForPage($page = '') : string {
if (!PP_MOD_REWRITE) {
$page .= '.php';
}
return (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/' . $page;
}
function urlForPaste(Paste $paste) : string {
if (PP_MOD_REWRITE) {
return "/{$paste->id}";
}
return "/paste.php?id={$paste->id}";
}
function urlForMember(User $user) : string {
if (PP_MOD_REWRITE) {
return '/user/' . urlencode($user->username);
}
return '/user.php?name=' . urlencode($user->username);
}
/**
* @throws Exception if the names and values aren't the same length
*/
function optionsForSelect(array $displays, array $values, string $currentSelection = null) : string {
$size = count($displays);
if (count($values) !== $size) {
throw new Exception('Option names and option values must be the same count');
}
$html = '';
for ($i = 0; $i < $size; $i++) {
$html .= '