-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-options.php
120 lines (85 loc) · 2.89 KB
/
app-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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
if ( !defined( 'ABSPATH' ) ) die(); //keep from direct access
if (!function_exists('is_admin')) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit();
}
if (!class_exists("Gf_Frontend_Options")) {
class Gf_Frontend_Options extends Gf_Frontend
{
var $page = '';
var $message = 0;
function __construct()
{
}
/**
* Build options page
*/
function option_function()
{
$messages[1] = __('Action Taken.', parent::APP_SLUG);
if (isset($_GET['message']) && (int)$_GET['message']) {
$message = $messages[$_GET['message']];
$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
}
$title = __(parent::SETTINGS_PAGE_TITLE, parent::APP_SLUG);
?>
<div class="wrap">
<h2><?php echo esc_html($title); ?></h2>
<?php
if (!empty($message)) :
?>
<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
<?php
endif;
?>
<form method="post" action="options.php">
<?php
settings_fields(parent::OPTIONS_PAGE);
do_settings_sections(parent::SETTINGS_PAGE1);
?>
<p>
<input type="submit" class="button button-primary" name="save_options" value="<?php esc_attr_e('Save Options'); ?>"/>
</p>
</form>
<p class="note"><?php print parent::APP_NAME; ?> by Amir Meshkin
version <?php print parent::APP_VERSION; ?></p>
<span> debug: <?php print parent::APP_DEBUG; ?></span>
</div>
<?php
}
/**
* Main Plugin Settings page
*/
function admin_home()
{
$data['title'] = 'Gravity Forms Frontend Settings';
$active_tab = 'home';
include(WP_CONTENT_DIR . parent::PLUGIN_DIR . parent::APP_DIR . '/templates/admin/tabs.php');
include(WP_CONTENT_DIR . parent::PLUGIN_DIR . parent::APP_DIR . '/templates/admin/settings.php');
}
/**
* Themes Options
* Return items in themes directory
*/
function submenu1()
{
$data['title'] = "Gravity Forms Frontend Help";
$active_tab = 'submenu1';
// get number of forms and pass along
$forms = GFAPI::get_forms();
$num_forms = count($forms);
include(WP_CONTENT_DIR . parent::PLUGIN_DIR . parent::APP_DIR . '/templates/admin/tabs.php');
include(WP_CONTENT_DIR . parent::PLUGIN_DIR . parent::APP_DIR . '/templates/admin/help.php');
}
/**
* Not Using
*/
function submenu2() {
$active_tab = 'submenu2';
include(WP_CONTENT_DIR . parent::PLUGIN_DIR . parent::APP_DIR . '/templates/admin/tabs.php');
include(WP_CONTENT_DIR . parent::PLUGIN_DIR . parent::APP_DIR . '/templates/admin/submenu2.php');
}
}
}