1 #!/usr/local/bin/php -qC
4 # This generates a list (printed to stdout) of available plugins/,
5 # which can then be used for the "plugins/pluginloader.php" extension.
10 #-- read from directory
11 ($bdir = @$_SERVER["argv"][1])
12 or ($bdir = "plugins/");
13 $bdir = rtrim($bdir, "/");
15 #-- those plugins cannot be scanned
17 "phplib", "you", "db_", "spell",
18 "spages", "mpi", "alias", "email_protect",
19 "auth", "db/", "imagegall", "debug",
20 "deletebutton.js", "log.php", "pageima",
21 "templ", "imgresiz", "forum", "phprequ",
22 "subpage", "lib/", "zero_p", "markup/",
25 $skip = implode("|", $skip);
28 ini_set("html_errors", falqse);
31 $found["action"][]=array("view", "", "", 0);
32 $found["action"][]=array("links", "", "", 0);
33 $found["action"][]=array("info", "", "", 0);
34 $found["action"][]=array("edit", "spellcheck.php", "", 0);
42 function mkpm_dir($dir) {
45 while ($dh && ($fn = readdir($dh))) {
50 elseif (is_dir("$dir/$fn")) {
63 function mkpm_add($fn) {
64 global $ewiki_plugins, $ewiki_config;
65 global $found, $bdir, $skip;
67 $ewiki_plugins = array();
70 if (!strpos($fn, ".php")) {
73 if (preg_match("#$skip#", $fn)) {
80 $fn = substr($fn, strlen($bdir) + 1);
81 foreach (array("page", "action", "action_always") as $sect) {
83 if ($a = $ewiki_plugins[$sect]) {
84 #<off># $sect = strtok($sect, "_");
85 foreach ($a as $name=>$pf) {
86 $found[$sect][] = array($name, $fn, $pf, 0);
95 function mkpm_dump($found) {
97 foreach (array("action", "action_always", "page") as $sect) {
98 if ($list = @$found[$sect]) {
99 echo "\$ewiki_plugins[\"dl\"][\"{$sect}\"] = array(\n";
100 foreach ($list as $a) {
101 echo "#\t\"{$a[0]}\" => array(\"{$a[1]}\", \"{$a[2]}\", {$a[3]}),\n";
106 foreach ($ewiki_config["action_links"] as $where=>$a) {
107 foreach ($a as $action=>$title) {
108 echo "\$ewiki_config[\"dl\"][\"action_links\"][\"$where\"][\"$action\"] = \"$title\";\n";
116 function ewiki_t($a,$b=0) {