-
Notifications
You must be signed in to change notification settings - Fork 3
/
menu.inc
79 lines (73 loc) · 1.99 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
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
<?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' => 'Template - Status',
# 'type' => 'status',
# 'page' => 'status.php',
# 'wrap' => 1
# ),
Array(
'text' => 'Show On Demand',
'type' => 'content',
'page' => 'show_on_demand.php',
'wrap' => 1
),
# Array(
# 'text' => 'Show On Demand',
# 'type' => 'output',
# 'page' => 'output.php',
# 'wrap' => 1
# ),
# Array(
# 'text' => 'Template - Help',
# 'type' => 'help',
# 'page' => 'help/help.php',
# 'wrap' => 1
# ),
# Array(
# 'text' => 'Template - Home',
# 'type' => 'help',
# 'page' => 'https://github.com/FalconChristmas/fpp-plugin-Template',
# 'wrap' => 1
# ),
# Array(
# 'text' => 'Template - About',
# 'type' => 'help',
# 'page' => 'about.php',
# 'wrap' => 1
# )
);
##############################################################################
# Display the menu entries for this plugin.
#
# It is expected that two variables are alread 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']);
}
}
?>