4 Using this plugin allows to have a page, which associates short
5 page titles to URLs. Whenever a page title occours on another page,
6 it will link directly to the given URL.
8 A definition page, can associate titles to URLs using either a
9 table or a definition list:
11 |Remote site| http://www.remote.org/|
12 |Second thing| http://www.example.com/|
14 :Partners: http://google.com/
16 So if you write on another page things like [Remote site], it will
17 directly link to the URL you defined somewhere else.
20 $ewiki_config["instant_url_pages"][] = "InstantURLs";
21 //$ewiki_config["instant_url_pages"][] = "MoreLinks";
24 $ewiki_plugins["format_prepare_linking"][] = "ewiki_linking_instanturls";
25 function ewiki_linking_instanturls(&$src) {
27 global $ewiki_links, $ewiki_config;
29 #-- get list of URL abbreviations
30 if (empty($ewiki_config["instant"])) {
31 ewiki_get_instanturls();
34 #-- scan for non-existent pages
35 foreach ($ewiki_links as $id=>$is) {
38 ($url = $ewiki_config["instant"][$id])
40 ($url = $ewiki_config["interwiki"][$id])
43 #-- use URL if defined
45 $ewiki_links[$id] = $url;
51 function ewiki_get_instanturls() {
54 $ewiki_config["instant"] = array();
55 $DL = '[:|]([^:|]+)[:|]([^|]+)';
57 #-- walk through URL definition pages
58 foreach ($ewiki_config["instant_url_pages"] as $id) {
61 $data = ewiki_db::GET($id);
63 preg_match_all("/^$DL/m", $data["content"], $uu);
65 foreach ($uu[1] as $i=>$name) {
66 $ewiki_config["instant"][trim($name)] = strtok(trim($uu[2][$i]), " ");