/**
 * change_plugin
 * 
 * Enable/Disable a plugin
 *
 * @since 2.04
 * @uses $live_plugins
 *
 * @param $name
 */
function change_plugin($name)
{
    global $live_plugins;
    if ($live_plugins[$name] == "true") {
        $live_plugins[$name] = "false";
    } else {
        $live_plugins[$name] = "true";
    }
    create_pluginsxml();
}
/**
 * change_plugin
 * 
 * Enable/Disable a plugin
 *
 * @since 2.04
 * @uses $live_plugins
 *
 * @param $name
 * @param $active bool default=null, sets plugin active | inactive else toggle
 */
function change_plugin($name, $active = null)
{
    global $live_plugins;
    if (isset($live_plugins[$name])) {
        // set plugin active | inactive
        if (isset($active) and is_bool($active)) {
            $live_plugins[$name] = $active ? 'true' : 'false';
            create_pluginsxml(true);
            return;
        }
        // else we toggle
        if ($live_plugins[$name] == "true") {
            $live_plugins[$name] = "false";
        } else {
            $live_plugins[$name] = "true";
        }
        create_pluginsxml(true);
    }
}
/**
 * change_plugin
 * 
 * Enable/Disable a plugin
 *
 * @since 2.04
 * @uses $live_plugins
 *
 * @param str  $name pluginid
 * @param bool $active default=null, sets plugin active or inactive, default=toggle
 */
function change_plugin($name, $active = null)
{
    global $live_plugins;
    $name = pathinfo_filename($name) . '.php';
    // normalize to pluginid
    if (isset($live_plugins[$name])) {
        // set plugin active | inactive
        if (isset($active) and is_bool($active)) {
            $live_plugins[$name] = $active ? 'true' : 'false';
            create_pluginsxml(true);
            return;
        }
        // else we toggle
        if ($live_plugins[$name] == "true") {
            $live_plugins[$name] = "false";
        } else {
            $live_plugins[$name] = "true";
        }
        create_pluginsxml(true);
        // save change; @todo, currently reloads all files and recreates entire xml not just node, is wasteful
    }
}