changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / mpi / mpi_embed.php
1 <?php
2
3 /*
4    This allows to embed a dynamic page, like the PowerSearch plugin,
5    into an ordinary wiki page. So this is similar to the Insert mpi.
6
7    <?plugin embed PageIndex ?>
8    <?plugin embed page=PowerSearch real=1 ?>
9
10    The real=1 tells to use "PowerSearch" as the embeded pages title,
11    a page name can be given as first parameter or as id= or page=
12    parameter.
13 */
14
15 $ewiki_plugins["mpi"]["embed"] = "ewiki_mpi_embed";
16
17
18 function ewiki_mpi_embed($action="html", $args, &$iii, &$s) {
19
20    global $ewiki_plugins, $ewiki_id, $ewiki_action;
21
22    if ($action == "html") {
23       $o = "";
24
25       #-- get page name
26       ($get = $args["id"]) or ($get = $args["page"]);
27       if (!$get) {
28          $get = array_keys($args);
29          $get = array_shift($get);
30       }
31
32       #-- params
33       $id = $ewiki_id;
34       if ($args["real"]) {
35          $id = $get;
36       }
37
38       #-- plugin function
39       $pf = ewiki_array($ewiki_plugins["page"], $get);
40
41       #-- exec dynamic page plugin
42       if ($get && function_exists($pf)) {
43          $uu = array();
44          $o .= $pf($id, $uu, $ewiki_action);
45       }
46    }
47
48    return($o);
49 }
50
51 ?>