|
1
|
|
|
<?php |
|
2
|
|
|
/****************************************************************** |
|
3
|
|
|
mod_html.php Muze Ariadne |
|
4
|
|
|
------------------------------------------------------------------ |
|
5
|
|
|
Author: Muze ([email protected]) |
|
6
|
|
|
Date: 26 november 2002 |
|
7
|
|
|
|
|
8
|
|
|
Copyright 2002 Muze |
|
9
|
|
|
|
|
10
|
|
|
This file is part of Ariadne. |
|
11
|
|
|
|
|
12
|
|
|
Ariadne is free software; you can redistribute it and/or modify |
|
13
|
|
|
it under the terms of the GNU General Public License as published |
|
14
|
|
|
by the Free Software Foundation; either version 2 of the License, |
|
15
|
|
|
or (at your option) any later version. |
|
16
|
|
|
|
|
17
|
|
|
Ariadne is distributed in the hope that it will be useful, |
|
18
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20
|
|
|
GNU General Public License for more details. |
|
21
|
|
|
|
|
22
|
|
|
You should have received a copy of the GNU General Public License |
|
23
|
|
|
along with Ariadne; if not, write to the Free Software |
|
24
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
25
|
|
|
02111-1307 USA |
|
26
|
|
|
|
|
27
|
|
|
------------------------------------------------------------------- |
|
28
|
|
|
|
|
29
|
|
|
Description: |
|
30
|
|
|
|
|
31
|
|
|
This module includes a number of usefull HTML related tools, |
|
32
|
|
|
e.g. a method to use htmltidy to clean/rewrite HTML, a word clean |
|
33
|
|
|
method, etc. |
|
34
|
|
|
This module calls the html tidy executable with the given |
|
35
|
|
|
options and returns 'clean' html. |
|
36
|
|
|
|
|
37
|
|
|
******************************************************************/ |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
class html { |
|
41
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
function tidy($html, $config) |
|
44
|
|
|
{ |
|
45
|
|
|
global $AR; |
|
46
|
|
|
require_once($AR->dir->install."/lib/modules/mod_tidy.php"); |
|
47
|
|
|
|
|
48
|
|
|
return ARtidy::clean($html, $config); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
function clean($html, $rules) { |
|
53
|
|
|
global $AR; |
|
54
|
|
|
require_once($AR->dir->install."/lib/modules/mod_htmlcleaner.php"); |
|
55
|
|
|
|
|
56
|
|
|
return htmlcleaner::clean($html, $rules); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
function cleanmsword($html) { |
|
60
|
|
|
/* |
|
61
|
|
|
rewrite : array with rewrite/remove rules |
|
62
|
|
|
preserve : array with exeptions on the rewrite rules |
|
63
|
|
|
rewrite : tag : attribute : value match = new value or false (remove) |
|
64
|
|
|
*/ |
|
65
|
|
|
$rules = array(); |
|
66
|
|
|
$rules['rewrite']['.*']['class']['mso.*']=false; // class="msoNormal" etc |
|
67
|
|
|
$rules['rewrite']['o:.*']=false; // <o:p style=".."></o> |
|
68
|
|
|
$rules['rewrite']['.*']['style']=false; // style="..." |
|
69
|
|
|
$rules['rewrite']['font']=false; // font tags begone |
|
70
|
|
|
$rules['rewrite']['.*']['v:.*']=false; // v:shape="..." |
|
71
|
|
|
return html::clean($html, $rules); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
} |
|
75
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.