-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpup.php
44 lines (37 loc) · 1 KB
/
pup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding("UTF-8");
$patsk = 'āēīōūaeiou';
$zilbe = '';
$txt = isset($_POST['txt']) ? $_POST['txt'] : false;
$out = '';
if ($txt) {
for ($i = 0; $i < mb_strlen($txt)+1; $i++) {
$char = mb_substr($txt, $i, 1);
if (mb_strpos($patsk, mb_convert_case($char, MB_CASE_LOWER)) !== false) {
$zilbe .= $char;
} else {
if (mb_strlen($zilbe)) {
$out .= $zilbe . 'p' . $zilbe;
$zilbe = '';
}
$out .= $char;
}
}
}
?>
<?='<?xml version="1.0" encoding="UTF-8"?>'?>
<!doctype html>
<html>
<head>
<title>Pupiņvaloda</title>
<meta charset="utf-8"/>
</head>
<body>
<p><?=nl2br(htmlspecialchars($out))?></p>
<form action="" method="post">
<textarea name="txt" id="txt" cols="80" rows="10"><?=htmlspecialchars($txt)?></textarea><br />
<input type="submit" name="ok" value=" Apaidāpā! " />
</form>
</body>
</html>