Htmlpurifier you tube + allowed tags troubles

Hi,


function cleanComments($dirtyHtml)
{
  // load the config and overide defaults as necessary
  $config = HTMLPurifier_Config::createDefault();
  $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
  $config->set('HTML.AllowedElements', 'a,em,blockquote,p,strong,pre,code');
  $config->set('HTML.AllowedAttributes', 'a.href,a.title');
  $config->set('Filter.YouTube', true);
  $config->set('HTML.TidyLevel', 'light'); 
  $htmlpurifier = new HTMLPurifier($config);
  $cleanHtml = $htmlpurifier->purify($dirtyHtml);;
  return $cleanHtml;
}
$html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/BdU--T8rLns"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/BdU--T8rLns" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><a>';
$html .= ' kkkk <a href="http://www.google.it/">pippo</a><p>pippo</p><em>ddd</em><div>pippo</div>'; 
echo(cleanComments($html));

Well I’m just waiting my you tube object
but I only get BdU–T8rLns

What’s the trouble ?

Bye

You will need to be a LOT more descriptive. I have no idea what you want or what the problem is, or what your code does.

Sorry I made a mistake to post in this section

I’m working on an user form which allows
strong em p a tags
and youtube object.
So with the snippet I want the you tube object
like
<object width=“425” height=“350” type=“application/x-shockwave-flash” data=“http://www.youtube.com/v/BdU-&#45;T8rLns”><param name=“movie” value=“http://www.youtube.com/v/BdU-&#45;T8rLns”></param><!–[if IE]><embed src=“http://www.youtube.com/v/BdU-&#45;T8rLns"type="application/x-shockwave-flash"wmode="transparent” width=“425” height=“350” /><![endif]–></object><a> kkkk </a><a href=“http://www.google.it/”>pippo</a><p>pippo</p><em>ddd</em><div>pippo</div>

Thanks to the html purifier folks :slight_smile:
I worked out with
Replace %HTML.Allowed with %HTML.AllowedElements