1171a9bf306b5a89a12d284a8cf4cbbd88ddb4ed
[atutor.git] / mods / wiki / plugins / markup / fix_source_mangling.php
1 <?php
2
3 /*
4    Multiple other markup plugins implement features by running a regex
5    on the whole source of a Wiki page. This may sometimes interfer with
6    content inside page blocks (like <code> or <html>).
7    If this plugin however is loaded, all old-style markup plugins instead
8    run on the Wiki text page parts only, and further won't clash in other
9    parts. This may be little slower.
10
11    include() this plugin AFTER any markup plugins, which you think may
12    cause problems:
13       ...
14       include("plugins/markup/foreign_stuff.php");
15       include("plugins/markup/an_older_plugin.php");
16       ...
17       include("plugins/markup/fix_source_mangling.php");
18       ...
19    Plugins, which you believe won't cause harm to a wiki pages source
20    ares, can be loaded AFTER _this_ plugin.
21 */
22
23
24 #-- store current ["format_source"] plugin list, and clean it up
25 $ewiki_plugins["singleblock_fmt_src"] = $ewiki_plugins["format_source"];
26 $ewiki_plugins["format_source"] = array();
27
28 #-- register ours instead (for all real Wiki text blocks)
29 $ewiki_plugins["block"]["core"][] = "ewiki_format_block_wiki_text_source_mangling";
30
31
32 #-- calls source code mangling plugins on current block
33 function ewiki_format_block_wiki_text_source_mangling(&$c, &$in, &$ooo, &$s) {
34
35    global $ewiki_plugins;
36
37    if ($pf_a = $ewiki_plugins["singleblock_fmt_src"]) {
38       foreach ($pf_a as $pf) {
39          $pf($c);
40    }  }
41 }
42
43
44 ?>