Tidy removing img and link paths
am 27.09.2007 22:50:50 von Karl GrovesI 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 and within the 'href' attribute of is
being stripped to only "/". So, for example: "
src="/images/foo.gif">" is being changed to ""
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