4 This mpi provides a tree of page backlinks from the current or any
5 given page. It's the opposite of mpi_localsitemap.
8 <?plugin BackTree page=ForThatPage depth=2 ?>
10 You shouldn't use depths greater than 3, else database walking would
11 take a while, and the result would be uglily long.
14 $ewiki_plugins["mpi"]["backtree"] = "mpi2_backtree";
17 function mpi2_backtree($action, &$args, &$iii, &$s) {
19 ($depth = $args["depth"]) or ($depth = 2);
23 ($id = $args["page"]) or ($id = $GLOBALS["ewiki_id"]);
25 $src = mpi2_backtree_revbl($id, "", $depth);
27 #-- throw output into _format() kernel buffer
38 function mpi2_backtree_revbl($id, $li, $depth) {
42 if ($refs = ewiki_get_backlinks($id)) {
43 foreach ($refs as $id) {
44 $src .= "$li [$id]\n";
45 $src .= mpi2_backtree_revbl($id, $li, $depth);