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        "\'a", "\'e", "\'i", "\'o", "\'u",		// acute
17        "\'A", "\'E", "\'I", "\'O", "\'U",
18        '\`a', '\`e', '\`i', '\`o', '\`u',		// grave
19        '\`A', '\`E', '\`I', '\`O', '\`U',
20        '\^a', '\^e', '\^i', '\^o', '\^u',		// circumflex
21        '\^A', '\^E', '\^I', '\^O', '\^U',
22        '\"a', '\"e', '\"i', '\"o', '\"u',		// umlaut
23        '\"A', '\"E', '\"I', '\"O', '\"U',
24        '\~n',						// tilde
25        '\~N',
26        '\cc', '\cC',
27        '\$', '\&', '\%', '\#', '\_', '\{', '\}',	// specials
28        '~', '\,', '\\'					// space
29    );
30    $replace_array = array(
31        'á', 'é', 'í', 'ó', 'ú',
32        'Á', 'É', 'Í', 'Ó', 'Ú',
33        'à', 'è', 'ì', 'ò', 'ù',
34        'À', 'È', 'Ì', 'Ò', 'Ù',
35        'â', 'ê', 'î', 'ô', 'û',
36        'Â', 'Ê', 'Î', 'Ô', 'Û',
37        'ä', 'ë', 'ï', 'ö', 'ü',
38        'Ä', 'Ë', 'Ï', 'Ö', 'Ü',
39        'ñ',
40        'Ñ',
41        'ç', 'Ç',
42        '$', '&', '%', '#', '_', '{', '}',
43        "\xC2\xA0", ' ', ' '
44    );
45    $outputstr = str_replace($search_array, $replace_array, $inputstr);
46    return $outputstr;
47}
48
49// vim:ts=4:sw=4:et:enc=utf-8:
50?>
51