您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

73 行
3.6KB

  1. <?php
  2. require_once 'common.php';
  3. echo '<?xml version="1.0" encoding="UTF-8" ?>';
  4. ?><!DOCTYPE html
  5. PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  6. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8. <head>
  9. <title>HTML Purifier Preserve YouTube Smoketest</title>
  10. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  11. </head>
  12. <body>
  13. <h1>HTML Purifier Preserve YouTube Smoketest</h1>
  14. <?php
  15. $string = '<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>
  16. <object width="416" height="337"><param name="movie" value="http://www.youtube.com/cp/vjVQa1PpcFNbP_fag8PvopkXZyiXyT0J8U47lw7x5Fc="></param><embed src="http://www.youtube.com/cp/vjVQa1PpcFNbP_fag8PvopkXZyiXyT0J8U47lw7x5Fc=" type="application/x-shockwave-flash" width="416" height="337"></embed></object>
  17. <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/uNxBeJNyAqA&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/uNxBeJNyAqA&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
  18. <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" height="385" width="480"><param name="width" value="480" /><param name="height" value="385" /><param name="src" value="http://www.youtube.com/p/E37ADDDFCA0FD050&amp;hl=en" /><embed height="385" src="http://www.youtube.com/p/E37ADDDFCA0FD050&amp;hl=en" type="application/x-shockwave-flash" width="480"></embed></object>
  19. <object
  20. classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  21. id="ooyalaPlayer_229z0_gbps1mrs" width="630" height="354"
  22. codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param
  23. name="movie" value="http://player.ooyala.com/player.swf?embedCode=FpZnZwMTo1wqBF-ed2__OUBb3V4HR6za&version=2"
  24. /><param name="bgcolor" value="#000000" /><param
  25. name="allowScriptAccess" value="always" /><param
  26. name="allowFullScreen" value="true" /><param name="flashvars"
  27. value="embedType=noscriptObjectTag&embedCode=pteGRrMTpcKMyQ052c8NwYZ5M5FdSV3j"
  28. /><embed src="http://player.ooyala.com/player.swf?embedCode=FpZnZwMTo1wqBF-ed2__OUBb3V4HR6za&version=2"
  29. bgcolor="#000000" width="630" height="354"
  30. name="ooyalaPlayer_229z0_gbps1mrs" align="middle" play="true"
  31. loop="false" allowscriptaccess="always" allowfullscreen="true"
  32. type="application/x-shockwave-flash"
  33. flashvars="&embedCode=FpZnZwMTo1wqBF-ed2__OUBb3V4HR6za"
  34. pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>
  35. ';
  36. $regular_purifier = new HTMLPurifier();
  37. $safeobject_purifier = new HTMLPurifier(array(
  38. 'HTML.SafeObject' => true,
  39. 'Output.FlashCompat' => true,
  40. ));
  41. ?>
  42. <h2>Unpurified</h2>
  43. <p><a href="?break">Click here to see the unpurified version (breaks validation).</a></p>
  44. <div><?php
  45. if (isset($_GET['break'])) echo $string;
  46. ?></div>
  47. <h2>Without YouTube exception</h2>
  48. <div><?php
  49. echo $regular_purifier->purify($string);
  50. ?></div>
  51. <h2>With SafeObject exception and flash compatibility</h2>
  52. <div><?php
  53. echo $safeobject_purifier->purify($string);
  54. ?></div>
  55. </body>
  56. </html>
  57. <?php
  58. // vim: et sw=4 sts=4