-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
63 lines (55 loc) · 3.22 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
include 'functions.php';
?>
<html>
<head>
<title>Feed creator</title>
<script type="text/javascript" src="//code.jquery.com/jquery.min.js"></script>
</head>
<body>
<h1>Feed Creator</h1>
<form method="get" id="form">
<label>URL: <input type="text" name="url" value="<?= htmlspecialchars($_GET['url'] ?? '') ?>"></label><br>
<label>Container: <input type="text" name="containersel" value="<?= htmlspecialchars($_GET['containersel'] ?? '') ?>" class="selector"></label><br>
<fieldset>
<legend>Relative to container</legend>
<label>Title: <input type="text" name="titlesel" value="<?= htmlspecialchars($_GET['titlesel'] ?? '') ?>" class="selector"></label><br>
<label>Date: <input type="text" name="datesel" value="<?= htmlspecialchars($_GET['datesel'] ?? '') ?>" class="selector"></label>
<label><a href="https://www.php.net/manual/en/datetime.createfromformat.php" target="_blank" title="PHP date format">Date format</a>: <input type="text" name="datefmt" value="<?= htmlspecialchars($_GET['datefmt'] ?? '') ?>"></label><br>
<label>Content: <input type="text" name="contentsel" value="<?= htmlspecialchars($_GET['contentsel'] ?? '') ?>" class="selector"></label> (blank for everything else)<br>
<label><input type="checkbox" name="usefirstlink" <?= isset($_GET['usefirstlink']) ? "checked" : "" ?> /> Use first <a> as the link</label><br>
<div id="removesels">
<?php if (isset($_GET['removesel']) && is_array($_GET['removesel'])) { foreach ($_GET['removesel'] as $rs) { ?>
<label class="removesel-label">Remove this: <input type="text" name="removesel[]" value="<?= htmlspecialchars($rs) ?>" class="selector removesel"></label> <input type="button" class="delremovesel" value="x"><br>
<?php }} ?>
</div>
<input type="button" id="addremovesel" value="add a removal selector"><br>
</fieldset>
<br>
<input type="submit" value="Apply"><br>
<!-- <input type="button" value="Preview" id="previewbtn"> -->
</form>
<?php if (isset($_GET['containersel']) && isset($_GET['url']) && !empty($_GET['containersel'])) { ?>
<!--<label>RSS link: <textarea rows="2" cols="80" readonly><?= htmlspecialchars(absurl("feed.php") . '?' . $_SERVER['QUERY_STRING']) ?></textarea></label> -->
<p><a href="<?= htmlspecialchars(absurl("feed.php") . '?' . $_SERVER['QUERY_STRING']) ?>" style="font-size: 150%;">RSS link</a></p>
<h2>RSS feed preview</h2>
<iframe id="previewframe" style="width: 100%; height: 50%;" src="feed.php?preview=1&<?= htmlspecialchars($_SERVER['QUERY_STRING'] ?? '') ?>"></iframe>
<?php } ?>
<br>
<?php if (isset($_GET['url'])) { ?>
<h2>Page preview</h2>
<iframe id="pageframe" style="width: 100%; height: 50%;" src="proxy.php?<?= htmlspecialchars($_SERVER['QUERY_STRING'] ?? '') ?>"></iframe>
<p>(hint: use inspect element and look at the <tt>data-selector</tt> attributes)</p>
<?php } ?>
<script type="text/javascript">
$("#addremovesel").click(function () {
$("#removesels").append('<label class="removesel-label">Remove this: <input type="text" name="removesel[]" class="selector removesel"></label> <input type="button" class="delremovesel" value="x"><br>');
});
$("#removesels").on('click', '.delremovesel', function () {
$(this).prev(".removesel-label").remove();
$(this).next("br").remove();
$(this).remove();
});
</script>
</body>
</html>