I use php tidy library to "clean and restore" some html coming from user input.
Everything works fine, but I am facing a problem that I canβt understand what the reason is. My code is as follows:
$tidy = new tidy(); $tidy_options = array( 'hide-comments' => true,'tidy-mark' => false, 'indent' => false, 'new-blocklevel-tags' => 'article,footer,header,hgroup,output,progress,section,video', 'new-inline-tags' => 'audio,details,time,ruby,rt,rp', 'drop-empty-paras' => false, 'doctype' => '<!DOCTYPE HTML>', 'sort-attributes' => 'none', 'vertical-space' => false, 'output-xhtml' => true,'wrap' => 180, 'wrap-attributes' => false, 'break-before-br' => false, 'show-body-only' => true ); $data = $tidy->repairString($data, $tidy_options, 'UTF8'); echo $data;
This works for all kinds of input, except when I try to use html to embed swf files.
So, I am trying this code:
<object data="http://the_swf_file_url" type="application/x-shockwave-flash" width="853" height="520"> <param name="movie" value="http://the_swf_file_url"> </object>
but repairString removes everything from it and returns an empty string.
The strangest thing is that:
-If , I enter some text along with the above, so the input is similar to Hello world<object...>...</object> , then it works fine.
-Or, if I specify 'show-body-only' => false , it also works great!
Any clue Why is this happening? Thanks in advance.
Edit: I tried the pankar suggestion with setting save-objects to true, but no luck ...