forked from bbarke/brp-fpp-voting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.inc
49 lines (43 loc) · 1.4 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
<?php
# $menuEntries is an array of menu entries for this plugin
# text - menu entry text
# type - status/content/output/help (main menu area)
# page - PHP file to display for this menu item
# wrap - 0/1 to hide or display the FPP header, menu, and footer on this page.
# This does not apply for pages which begin with http:// or https://
# Comment out sub arrays to not display an item under a menu or add your own
# entries to display additional menu items such as the 3 items under the
# help menu in this example template.
$menuEntries = Array(
Array(
'text' => 'BRP Voting',
'type' => 'status',
'page' => 'vote.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']);
}
}
?>