Implementation is as described in the issue description. The plugin can be defined in a package as in the following example:
First, declare the plugin by name (plugin_nginx
) in the package XML:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
<copyright>
</copyright>
<name>testnginx</name>
<title>testnginx</title>
<include_file>/usr/local/pkg/testnginx.inc</include_file>
<plugins>
<item>
<type>plugin_nginx</type>
</item>
</plugins>
</packagegui>
And then in the package code, implement a function called <packagename>_plugin_nginx
:
<?php
function testnginx_plugin_nginx($pluginparams) {
global $config;
/* Caller did not properly define data, exit early */
if (!is_array($pluginparams) ||
empty($pluginparams) ||
empty($pluginparams['section'])) {
return "";
}
$result = "";
switch ($pluginparams['section']) {
case 'location':
$result = " # This content is placed after the location stanzas of the main GUI server.";
break;
case 'server':
$result = " # This content is placed after the server stanza of the GUI server(s)";
break;
default:
$result = "# Nothing to do here, no section given.";
}
return $result;
}
The 'section'
parameter passed in from the caller will let the function know if it's being called for a location block in the main GUI server or for a server block that is separate. Be sure to indent the content appropriately (two tab levels for locations, one tab level for servers).
This function does not currently support captive portal but could be extended to do so in the future.