Note that there are some explanatory texts on larger screens.

plurals
  1. POphp tidy strange behaviour
    primarykey
    data
    text
    <p>I'm using php's tidy library to "clean and repair" some html coming from user input.</p> <p>Everything works fine, but i'm running into a problem that I can't figure out what its cause is. My code is like this:</p> <pre><code>$tidy = new tidy(); $tidy_options = array( 'hide-comments' =&gt; true,'tidy-mark' =&gt; false, 'indent' =&gt; false, 'new-blocklevel-tags' =&gt; 'article,footer,header,hgroup,output,progress,section,video', 'new-inline-tags' =&gt; 'audio,details,time,ruby,rt,rp', 'drop-empty-paras' =&gt; false, 'doctype' =&gt; '&lt;!DOCTYPE HTML&gt;', 'sort-attributes' =&gt; 'none', 'vertical-space' =&gt; false, 'output-xhtml' =&gt; true,'wrap' =&gt; 180, 'wrap-attributes' =&gt; false, 'break-before-br' =&gt; false, 'show-body-only' =&gt; true ); $data = $tidy-&gt;repairString($data, $tidy_options, 'UTF8'); echo $data; </code></pre> <p>This works for all kinds of input, except when i'm trying to use html for embeding swf files.<br> So , i try this code: </p> <pre><code>&lt;object data="http://the_swf_file_url" type="application/x-shockwave-flash" width="853" height="520"&gt; &lt;param name="movie" value="http://the_swf_file_url"&gt; &lt;/object&gt; </code></pre> <p>but repairString stripes off all of it, and returns an empty string.<br> <strong>The strangest thing is that:</strong><br> <strong>-If</strong> i enter some text along with the above, so the input is like <code>Hello world&lt;object...&gt;...&lt;/object&gt;</code> then it works fine.<br> <strong>-Or if</strong> i specify <code>'show-body-only' =&gt; false</code> it also works fine! </p> <p>Any clue Why this is happening? Thanks in advance.</p> <p>Edit: tried pankar's suggestion with setting preserve-entities to true but had no luck...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload