-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
47 lines (46 loc) · 1.33 KB
/
index.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
45
46
47
<?php
require_once 'GenderFlip.php';
if (isset($_GET['url']) && filter_var($_GET['url'], FILTER_VALIDATE_URL)) {
$genderFlip = new GenderFlip(file_get_contents($_GET['url']));
echo $genderFlip->flip();
exit;
} elseif (isset($_GET['example'])) {
switch ($_GET['example']) {
case 'alice-in-wonderland':
$path = 'examples/11-h.htm';
break;
case 'peter-pan':
$path = 'examples/16-h.htm';
break;
case 'the-yellow-wallpaper':
$path = 'examples/1952-h.htm';
break;
case 'pride-and-prejudice':
default:
$path = 'examples/1342-h.htm';
}
$genderFlip = new GenderFlip(file_get_contents($path));
echo $genderFlip->flip();
exit;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Gender Flip</title>
</head>
<body>
<h1>Gender Flip</h1>
<h2>By URL</h2>
<form>
<input type="url" name="url" placeholder="Enter a URL">
<input type="submit" value="Submit">
</form>
<h2>By Example</h2>
<a href="?example=pride-and-prejudice">Pride and Prejudice</a><br>
<a href="?example=peter-pan">Peter Pan</a><br>
<a href="?example=alice-in-wonderland">Alice in Wonderland</a><br>
<a href="?example=the-yellow-wallpaper">The Yellow Wallpaper</a>
</body>
</html>