1<?php
2if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
3if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
4require_once(DOKU_PLUGIN.'syntax.php');
5
6// compare
7// https://github.com/splitbrain/dokuwiki/pull/3798/files#diff-04c8b615576808e5dc67098f688fe22149d1413014752bf15234c0569690e984
8
9function confightmlok_default_sanitizer ($text) {
10	return $text;
11}
12
13// from Html.php
14
15class HtmlOK_addendum extends DokuWiki_Syntax_Plugin {
16	//public $sanitizer= null;
17
18    function getSort() { return 190;  }
19    function getType() { return 'disabled';  }
20    function getAllowedTypes() { return array(); }
21	//! check if we really, REALLY want to enable HTML
22	function htmlok_but_truly_ok () {
23		// are you sure?
24		if (intval($this->getConf('use_sure')) < 1) return false;
25		// are you *really* sure?
26		if (intval($this->getConf('use_really_sure')) < 1) return false;
27		return true;
28	}
29
30	function html_sanitize ($html, $mode, $wrapper='code') {
31		$select_sanitizer= '';
32		if ($this->getConf('sanitizer') === '') {
33			// nothing to do
34		} else if (preg_match('/^[a-zA-Z\-_0-9]+$/', $this->getConf('sanitizer'))) {
35			$select_sanitizer= $this->getConf('sanitizer');
36			$html= $select_sanitizer($html);
37		} else {
38			msg('HTML: Invalid sanitizer function: ignored', -1);
39		}
40		return $html;
41	}
42
43    function handle ($match, $state, $pos, Doku_Handler $handler) {
44		switch ($state) {
45			case DOKU_LEXER_ENTER : {
46				return array($state, $match);
47			}
48			case DOKU_LEXER_UNMATCHED : {
49				$match= $this->html_sanitize($match, 'code');
50				return array($state, $match);
51			}
52			case DOKU_LEXER_EXIT : {
53				return array($state, $match);
54			}
55			case DOKU_LEXER_SPECIAL :
56				return array($state, $match);
57		}
58		return array();
59    }
60
61    function render ($mode, Doku_Renderer $renderer, $data) { }
62
63};
64
65?>
66