Source for file YouTube.php

Documentation is available at YouTube.php

  1. <?php
  2.  
  3. {
  4.     
  5.     public $name = 'YouTube';
  6.     
  7.     public function preFilter($html$config$context{
  8.         $pre_regex '#<object[^>]+>.+?'.
  9.             'http://www.youtube.com/v/([A-Za-z0-9\-_]+).+?</object>#s';
  10.         $pre_replace '<span class="youtube-embed">\1</span>';
  11.         return preg_replace($pre_regex$pre_replace$html);
  12.     }
  13.     
  14.     public function postFilter($html$config$context{
  15.         $post_regex '#<span class="youtube-embed">([A-Za-z0-9\-_]+)</span>#';
  16.         $post_replace '<object width="425" height="350" '.
  17.             'data="http://www.youtube.com/v/\1">'.
  18.             '<param name="movie" value="http://www.youtube.com/v/\1"></param>'.
  19.             '<param name="wmode" value="transparent"></param>'.
  20.             '<!--[if IE]>'.
  21.             '<embed src="http://www.youtube.com/v/\1"'.
  22.             'type="application/x-shockwave-flash"'.
  23.             'wmode="transparent" width="425" height="350" />'.
  24.             '<![endif]-->'.
  25.             '</object>';
  26.         return preg_replace($post_regex$post_replace$html);
  27.     }
  28.     
  29. }

Documentation generated on Thu, 19 Jun 2008 18:50:32 -0400 by phpDocumentor 1.4.2