|
Posted by Karl Groves on 09/27/07 20:50
I created a quick function I can call to clean up stuff input into forms
with tidy. The problem I'm having at the moment is that everything within
the 'src' attribute of <img> and within the 'href' attribute of <a> is
being stripped to only "/". So, for example: "<img
src="/images/foo.gif">" is being changed to "<img src="/">"
Any idea what's causing this?
Here's the function. Nothing special, really.
function tidystring($string){
/* here we're going to use Tidy for the additiontal cleanup */
$config = array(
"bare" => true,
"clean" => true,
"doctype" => "omit",
"logical-emphasis" => true,
"quote-ampersand" => true,
"quote-marks" => true,
"quote-nbsp" => true,
"show-body-only" => true,
"word-2000" => true,
"drop-proprietary-attributes" => true,
"drop-font-tags" => true,
"drop-empty-paras" => true,
"hide-comments" => true,
"join-classes" => true,
"join-styles" => true
);
$tidy = new tidy;
$tidy->parseString($string, $config, 'utf8');
$tidy->cleanRepair();
return $tidy;
}
--
Karl Groves
[Back to original message]
|