Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not really sure what parameters <code>EMBED</code> and <code>OBJECT</code> take as I've never really dealt with putting media on a page (which is actually kind of shocking to think about) but I would take a BB Code approach to it and do something like <code>[embed url="http://www.whatever.com/myvideo.whatever" ...]</code> and then you can parse out the URL and anything else, make sure they are legit and make your own <code>&lt;EMBED&gt;</code> tag.</p> <p><strong>edit:</strong> Alright, something like this should be fine:</p> <pre><code>$youtube = '&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Z75QSExE0jU&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt; &lt;/param&gt;&lt;embed src="http://www.youtube.com/v/Z75QSExE0jU&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;'; $blip = '&lt;embed src="http://blip.tv/play/AZ_iEoaIfA" type="application/x-shockwave-flash" width="640" height="510" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;'; preg_match_all("/([A-Za-z]*)\=\"(.+?)\"/", $youtube, $matches1); preg_match_all("/([A-Za-z]*)\=\"(.+?)\"/", $blip, $matches2); print '&lt;pre&gt;' . print_r($matches1, true). '&lt;/pre&gt;'; print '&lt;pre&gt;' . print_r($matches2, true). '&lt;/pre&gt;'; </code></pre> <p>This will output:</p> <pre><code>Array ( [0] =&gt; Array ( [0] =&gt; width="425" [1] =&gt; height="344" [2] =&gt; name="movie" [3] =&gt; value="http://www.youtube.com/v/Z75QSExE0jU&amp;hl=en&amp;fs=1" [4] =&gt; src="http://www.youtube.com/v/Z75QSExE0jU&amp;hl=en&amp;fs=1" [5] =&gt; type="application/x-shockwave-flash" [6] =&gt; allowfullscreen="true" [7] =&gt; width="425" [8] =&gt; height="344" ) [1] =&gt; Array ( [0] =&gt; width [1] =&gt; height [2] =&gt; name [3] =&gt; value [4] =&gt; src [5] =&gt; type [6] =&gt; allowfullscreen [7] =&gt; width [8] =&gt; height ) [2] =&gt; Array ( [0] =&gt; 425 [1] =&gt; 344 [2] =&gt; movie [3] =&gt; http://www.youtube.com/v/Z75QSExE0jU&amp;hl=en&amp;fs=1 [4] =&gt; http://www.youtube.com/v/Z75QSExE0jU&amp;hl=en&amp;fs=1 [5] =&gt; application/x-shockwave-flash [6] =&gt; true [7] =&gt; 425 [8] =&gt; 344 ) ) Array ( [0] =&gt; Array ( [0] =&gt; src="http://blip.tv/play/AZ_iEoaIfA" [1] =&gt; type="application/x-shockwave-flash" [2] =&gt; width="640" [3] =&gt; height="510" [4] =&gt; allowscriptaccess="always" [5] =&gt; allowfullscreen="true" ) [1] =&gt; Array ( [0] =&gt; src [1] =&gt; type [2] =&gt; width [3] =&gt; height [4] =&gt; allowscriptaccess [5] =&gt; allowfullscreen ) [2] =&gt; Array ( [0] =&gt; http://blip.tv/play/AZ_iEoaIfA [1] =&gt; application/x-shockwave-flash [2] =&gt; 640 [3] =&gt; 510 [4] =&gt; always [5] =&gt; true ) ) </code></pre> <p>From then on it's pretty straight forward. For things like width/height you can verify them with <a href="http://www.php.net/is_numeric" rel="nofollow noreferrer"><code>is_numeric</code></a> and with the rest you can run the values through <a href="http://www.php.net/htmlentities" rel="nofollow noreferrer"><code>htmlentities</code></a> and construct your own <code>&lt;embed&gt;</code> tag from the information. I am pretty certain this would be safe. You can even make the full-fledged <code>&lt;object&gt;</code> one like YouTube (which I assume works in more places) with links from blip.tv, since you would have all the required data.</p> <p>I am sure you may see some quirks with links from other video-sharing websites but this will hopefully get you started. Good luck.</p>
 

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