-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.php
92 lines (80 loc) · 3.28 KB
/
options.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?
function boposts_request($name, $default=null)
{
if (!isset($_REQUEST[$name])) return $default;
if (get_magic_quotes_gpc()) return boposts_stripslashes($_REQUEST[$name]);
else return $_REQUEST[$name];
}
function boposts_stripslashes($value)
{
$value = is_array($value) ? array_map('boposts_stripslashes', $value) : stripslashes($value);
return $value;
}
if (isset($_POST['defaults']))
{
@include(dirname(__FILE__) . '/en_US_options.php');
if (WPLANG != '') @include(dirname(__FILE__) . '/' . WPLANG . '_options.php');
update_option('boposts', $boposts_options);
}
if (isset($_POST['save']))
{
$options = boposts_request('options');
update_option('boposts', $options);
}
else
{
@include(dirname(__FILE__) . '/en_US_options.php');
if (WPLANG != '') @include(dirname(__FILE__) . '/' . WPLANG . '_options.php');
$options = array_merge($boposts_default_options, array_filter(get_option('boposts')));
}
?>
<div class="wrap">
<form method="post">
<h2>Best Related Posts</h2>
<p>Here you can configure the layout of the related posts list. To add the list after a posts
use this code: <?php boposts_show(); ?>.</p>
<h2>Template</h2>
<table class="form-table">
<tr valign="top">
<th scope="row"><label>Header</label></th>
<td>
<textarea name="options[header]" wrap="off" rows="5" cols="75"><?php echo htmlspecialchars($options['header'])?></textarea>
</td>
</tr>
<tr valign="top">
<th scope="row"><label>Body</label></th>
<td>
<textarea name="options[body]" wrap="off" rows="5" cols="75"><?php echo htmlspecialchars($options['body'])?></textarea>
<br />
{title} for the post title, {link} for the post permalink, {excerpt} for the content excerpt, {image} for
the first post image url
</td>
</tr>
<tr valign="top">
<th scope="row"><label>Footer</label></th>
<td>
<textarea name="options[footer]" wrap="off" rows="5" cols="75"><?php echo htmlspecialchars($options['footer'])?></textarea>
</td>
</tr>
</table>
<h2>Configuration</h2>
<table class="form-table">
<tr valign="top">
<th scope="row"><label>Max posts to show</label></th>
<td>
<input name="options[max]" type="text" size="10" value="<?php echo htmlspecialchars($options['max'])?>"/>
</td>
</tr>
<tr valign="top">
<th scope="row"><label>Excerpt length</label></th>
<td>
<input name="options[excerpt]" type="text" size="10" value="<?php echo htmlspecialchars($options['excerpt'])?>"/>
</td>
</tr>
</table>
<p class="submit">
<input type="submit" name="save" value="Save"/>
<input type="submit" name="defaults" value="Revert to Defaults" onclick="return confirm('Are you sure?')"/>
</p>
</form>
</div>