1<?php
2/**
3 * DokuWiki Plugin publist (Sanitiser Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Jorge Juan <jjchico@gmail.com>
7 */
8
9// Simple latex to utf8 sanitiser. Extend as needed.
10
11// Rename (or copy) this file to "sanitiser.php" and it will be automatically
12// used by publist.
13
14$sanitiser = function ($inputstr) {
15    $search_array = array(
16        '\$', '\&', '\%', '\#', '\_', '\{', '\}',   // specials
17        '{', '}',                                   // emphasizers
18        "\'a", "\'e", "\'i", "\'o", "\'u",		// acute
19        "\'A", "\'E", "\'I", "\'O", "\'U",
20        '\`a', '\`e', '\`i', '\`o', '\`u',		// grave
21        '\`A', '\`E', '\`I', '\`O', '\`U',
22        '\^a', '\^e', '\^i', '\^o', '\^u',		// circumflex
23        '\^A', '\^E', '\^I', '\^O', '\^U',
24        '\"a', '\"e', '\"i', '\"o', '\"u',		// umlaut
25        '\"A', '\"E', '\"I', '\"O', '\"U',
26        '\vc', '\vs',
27        "\'y",
28        '\~n',						// tilde
29        '\~N',
30        '\cc', '\cC',
31        '~', '\,', '\\'				        // space
32    );
33    $replace_array = array(
34        '$', '&', '%', '#', '_', '<html>&#123;</html>', '<html>&#125;</html>',
35        '','',
36        'á', 'é', 'í', 'ó', 'ú',
37        'Á', 'É', 'Í', 'Ó', 'Ú',
38        'à', 'è', 'ì', 'ò', 'ù',
39        'À', 'È', 'Ì', 'Ò', 'Ù',
40        'â', 'ê', 'î', 'ô', 'û',
41        'Â', 'Ê', 'Î', 'Ô', 'Û',
42        'ä', 'ë', 'ï', 'ö', 'ü',
43        'Ä', 'Ë', 'Ï', 'Ö', 'Ü',
44        'č', 'š',
45        'ý',
46        'ñ',
47        'Ñ',
48        'ç', 'Ç',
49        "\xC2\xA0", ' ', ' '
50    );
51    $outputstr = str_replace($search_array, $replace_array, $inputstr);
52    return $outputstr;
53}
54
55// vim:ts=4:sw=4:et:enc=utf-8:
56?>
57