コード例 #1
0
/**
 * \brief Initialize every plugin in the global $Plugins array.
 *        plugin_sort() is called followed by the plugin
 *        PostInitialize() if PLUGIN_STATE_VALID,
 *        and RegisterMenus() if PLUGIN_STATE_READY.
 **/
function plugin_init()
{
    global $Plugins;
    /* Now activate the plugins */
    plugin_sort();
    $Count = count($Plugins);
    for ($Key = 0; $Key < $Count; $Key++) {
        $P =& $Plugins[$Key];
        if ($P->State == PLUGIN_STATE_VALID) {
            $P->PostInitialize();
        }
        if ($P->State == PLUGIN_STATE_READY) {
            $P->RegisterMenus();
        }
    }
}
コード例 #2
0
ファイル: html.inc.php プロジェクト: Wide-Net/CGP
function graphs_from_plugin($host, $plugin, $overview = false)
{
    global $CONFIG;
    if (!($plugindata = collectd_plugindata($host, $plugin))) {
        return false;
    }
    if (!($plugindata = group_plugindata($plugindata))) {
        return false;
    }
    if (!($plugindata = plugin_sort($plugindata))) {
        return false;
    }
    foreach ($plugindata as $items) {
        if ($overview && isset($CONFIG['overview_filter'][$plugin]) && $CONFIG['overview_filter'][$plugin] !== array_intersect_assoc($CONFIG['overview_filter'][$plugin], $items)) {
            continue;
        }
        $items['h'] = $host;
        $time = array_key_exists($plugin, $CONFIG['time_range']) ? $CONFIG['time_range'][$plugin] : $CONFIG['time_range']['default'];
        if ($CONFIG['graph_type'] == 'canvas') {
            chdir($CONFIG['webdir']);
            isset($items['p']) ? $_GET['p'] = $items['p'] : ($_GET['p'] = '');
            isset($items['pi']) ? $_GET['pi'] = $items['pi'] : ($_GET['pi'] = '');
            isset($items['t']) ? $_GET['t'] = $items['t'] : ($_GET['t'] = '');
            isset($items['ti']) ? $_GET['ti'] = $items['ti'] : ($_GET['ti'] = '');
            $_GET['s'] = $time;
            include $CONFIG['webdir'] . '/graph.php';
        } else {
            printf('<a href="%1$s%2$s"><img src="%1$s%3$s"></a>' . "\n", htmlentities($CONFIG['weburl']), htmlentities(build_url('detail.php', $items, $time)), htmlentities(build_url('graph.php', $items, $time)));
        }
    }
}
コード例 #3
0
/**
 * \brief Initialize every plugin in the global $Plugins array.
 *        plugin_sort() is called followed by the plugin
 *        PostInitialize() if PLUGIN_STATE_VALID,
 *        and RegisterMenus() if PLUGIN_STATE_READY.
 **/
function plugin_preinstall()
{
    /** @var Plugin[] $Plugins */
    global $Plugins;
    plugin_sort();
    foreach (array_keys($Plugins) as $pluginName) {
        if (array_key_exists($pluginName, $Plugins)) {
            $Plugins[$pluginName]->preInstall();
        }
    }
}