}
            }
        }
        usort($init, "pluginsSort");
        $remoteRequests = array();
        foreach ($init as $plugin) {
            $jEnd = '';
            $pInfo = $plugin["info"];
            $jResult .= "(function () { var plugin = new rPlugin( '" . $plugin["name"] . "'," . $pInfo["version"] . ",'" . $pInfo["author"] . "','" . $pInfo["description"] . "'," . $pInfo["perms"] . " );\n";
            if ($plugin["php"]) {
                require_once $plugin["php"];
            } else {
                $theSettings->registerPlugin($plugin["name"]);
            }
            if ($plugin["js"]) {
                $jResult .= file_get_contents($plugin["js"]);
                $jResult .= "\n";
            }
            $jResult .= $jEnd;
            $jResult .= "\n})();";
        }
        $jResult .= testRemoteRequests($remoteRequests);
        $theSettings->store();
    }
    closedir($handle);
}
if (!ini_get("zlib.output_compression")) {
    header("Content-Length: " . strlen($jResult));
}
header("Content-Type: application/javascript; charset=UTF-8");
echo $jResult;