changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / linking / titlefix.php
1 <?php
2
3 /*
4    Current markup allows to use [Title | ForPageName] to create a link
5    to a page, but use a different title. However other Wikis have the
6    meaning swapped [PageName|title], and this often confuses people.
7
8    Therefore this plugin provides an (unreliable) workaround, that checks
9    for existing of a page which the name of either side of the dash |
10    in square brackets, and then decides wich side contained the PageName
11    and which the title.
12 */
13
14
15
16 $ewiki_plugins["link_notfound"][] = "ewiki_linking_titlefix";
17
18
19 function ewiki_linking_titlefix(&$title, &$href, &$href2, &$type) {
20
21    global $ewiki_links;
22
23    $find = ewiki_db::FIND(array($title));
24    if ($find[$title]) {
25
26       $uu = $href;
27       $href = $title;
28       $title = $uu;
29
30       $str = '<a href="' . ewiki_script("", $href) . htmlentities($href2)
31            . '">' . $title . '</a>';
32       $type = array("wikipage", "title-swapped");
33       return($str);
34    }
35
36 }
37
38
39 ?>