-
Notifications
You must be signed in to change notification settings - Fork 8
/
class.honnypotter-admin.php
75 lines (61 loc) · 2.18 KB
/
class.honnypotter-admin.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
<?php
class HonnyPotter_Admin
{
private static $initiated = false;
public static function init()
{
if ( ! self::$initiated ) {
self::init_hooks();
}
}
public static function init_hooks()
{
self::$initiated = true;
add_action('admin_menu', array( 'HonnyPotter_Admin', 'plugin_admin_add_page' ) );
add_action('admin_init', array( 'HonnyPotter_Admin', 'plugin_admin_init') );
}
public static function plugin_admin_add_page()
{
add_options_page('HonnyPotter', 'HonnyPotter', 'manage_options', 'honnypotter', array( 'HonnyPotter_Admin', 'plugin_options_page') );
}
public static function plugin_admin_init()
{
register_setting('honnypotter_options', 'honnypotter', array( 'HonnyPotter_Admin', 'honnypotter_validate' ) );
}
public static function honnypotter_validate($input)
{
return $input;
}
public static function plugin_options_page()
{
$options = get_option('honnypotter');
$logpath = plugin_dir_url(__FILE__) . $options['log_name'];
?>
<div class="wrap">
<?php if(!$options['wp_authenticate_override']){ ?>
<h1>Warning: You have other plugins trying to override the same functions as we use, this plugin may or may not work.</h1>
<?php } ?>
<h2>HonnyPotter</h2>
<p>
Your log-file is currently accessible via <a href="<?php echo $logpath; ?>"><code><?php echo $logpath; ?></code></a>.
</p>
<form action="options.php" method="post">
<?php
settings_fields('honnypotter_options'); ?>
<h3>Edit log name</h3>
<input type="text" size="50" name="honnypotter[log_name]" value="<?php echo $options['log_name']; ?>">
<br />
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
</form>
<br>
<br>
<hr />
<p>Created by Martin Ingesen.</p>
<p>
Please report any issues either via my <a href="https://twitter.com/Mrtn9">Twitter</a>, <a href="mailto:martin@ingesen.no">E-Mail</a> or via <a href="https://github.com/MartinIngesen/HonnyPotter">GitHub</a>.
</p>
<p>Read my blog at <a href="http://martin.ingesen.no">martin.ingesen.no</a>. Source code available at <a href="https://github.com/MartinIngesen/HonnyPotter">GitHub</a>.</p>
</div>
<?php
}
}