note 46217 added to function.file
| From: | maxvalde at fis dot unam dot mx | Date: | Sat, 02 Oct 2004 18:19:33 +0000 |
| Subject: | note 46217 added to function.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77757@lists.php.net to get a copy of this message | ||
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>
----
Manual Page -- http://www.php.net/manual/en/function.file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46217
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46217&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46217&report=yes
Search -- http://master.php.net/manage/user-notes.php