note 46217 deleted from function.file by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 02 Oct 2004 18:30:16 +0000 |
| Subject: | note 46217 deleted from function.file by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77758@lists.php.net to get a copy of this message | ||
Note Submitter: maxvalde at fis dot unam dot mx
----
I found a nice way to get rid of all the nasty html trash comming from a doc or sxw (oowriter) file
converted to html.
Using the kses functions (http://sourceforge.net/projects/kses):
<pre>
<?php
include 'kses.php';
$val = implode('',file ('file.html'));
$allowed = array('b' => array(),
'i' => array(),
'a' => array('href' => 1, 'title' => 1),
'p' => array('align' => 1),
'br' => array());
if (get_magic_quotes_gpc())
$val = stripslashes($val);
$body = kses($val, $allowed); # The filtering takes place here.
print_r($body);
?>
</pre>