-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmenu.inc
54 lines (48 loc) · 1.37 KB
/
menu.inc
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
<?php
# $menuEntries is an array of menu entries for this plugin
# type is an enum of status/content/output/help (main menu area)
$menuEntries = Array(
Array(
'text' => 'Zettle - Status',
'type' => 'status',
'page' => 'status.php',
'wrap' => 1
),
Array(
'text' => 'Zettle - Setup',
'type' => 'content',
'page' => 'setup.php',
'wrap' => 1
),
Array(
'text' => 'Zettle - Help',
'type' => 'help',
'page' => 'help.php',
'wrap' => 1
)
);
##############################################################################
# Display the menu entries for this plugin.
#
# It is expected that two variables are already set:
# $plugin - contains the name of the current plugin directory/repoName
# $menu - contains the name of the menu section/type
foreach ($menuEntries as $entry)
{
if ($entry['type'] != $menu)
continue;
if (preg_match('/^http.?:\/\//', $entry['page']))
{
printf("<li><a href='%s' target='_blank'>%s</a></li>\n",
$entry['page'], $entry['text']);
}
else
{
$nopage = '';
if (isset($entry['wrap']) && ($entry['wrap'] == 0))
$nopage = '&nopage=1';
printf("<li><a href='plugin.php?plugin=%s&page=%s%s'>%s</a></li>\n",
$plugin, $entry['page'], $nopage, $entry['text']);
}
}
?>