-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhtpasswd-options-page.php
66 lines (58 loc) · 1.63 KB
/
htpasswd-options-page.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
<?php
include 'htpasswd-options-ftp-page.php';
include 'htpasswd-options-generic-config-page.php';
class HtpasswdSettingsPage
{
private $page_id = 'htpasswd-generator-options';
/**
* Option group
*/
private $option_group = 'htpasswd_option_group';
private $ftp_page_section;
private $generic_page_section;
/**
* Start up
*/
public function __construct()
{
$this->generic_page_section = new GenericSettingsPage($this->page_id, $this->option_group);
$this->ftp_page_section = new FtpSettingsPage($this->page_id, $this->option_group);
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
}
/**
* Add options page
*/
public function add_plugin_page()
{
// This page will be under "Settings"
add_options_page(
'Htpasswd Generator Options',
'Htpasswd Generator',
'manage_options',
$this->page_id,
array( $this, 'create_admin_page' )
);
}
/**
* Options page callback
*/
public function create_admin_page()
{
?>
<div class="wrap">
<h2>Htpasswd Generator Settings</h2>
<form method="post" action="options.php">
<?php
// This prints out all hidden setting fields
settings_fields($this->option_group);
do_settings_sections($this->page_id);
submit_button();
?>
</form>
</div>
<?php
}
}
if( is_admin() ) {
$htpasswd_settings_page = new HtpasswdSettingsPage();
}