-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
55 lines (47 loc) · 1.74 KB
/
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
<?php
if( !class_exists('VPBackupAdmin') ) {
final class VPBackupAdmin {
private $namespace;
public function __construct() {
$this->namespace = 'vpbackup';
add_action('admin_menu', array($this, 'addMenuPages'), 0);
// Make sure the helper functions have been included.
require_once(dirname(__file__) . '/helpers.php');
}
public function addMenuPages() {
// Register the main page (that appears in the sidebar)
$page_title = __('Volcanic Pixels Backup', 'vpbackup');
$menu_title = __('VP Backup', 'vpbackup');
$capability = 'manage_options';
$menu_slug = $this->namespace;
$function = array($this, 'mainPage');
add_menu_page(
$page_title,
$menu_title,
$capability,
$menu_slug,
$function
);
}
// Dispatches to relevant page depending on whether the plugin is
// configured or not.
// ?plugin_installed - shows the helpful getting started guide
public function mainPage() {
$getting_started = true;
if (array_key_exists('plugin_installed', $_GET)) {
$getting_started = true;
}
if ($getting_started) {
return $this->gettingStartedPage();
}
}
/**
* Displays the "Getting started" page that asks the user whether
* they want to "setup backup", "restore from a backup" or "try the plugin".
*/
public function gettingStartedPage() {
$page = new VPBackup_Pages_GettingStarted();
$page->render();
}
}
}