Advertisement
kotvalera83

CI Video

Dec 3rd, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. P@r0L#5687function _video($value)
  2.    {
  3.           $re1='.*?';   # Non-greedy match on filler
  4.           $re2='(youtube)'; # Word 1
  5.           $re4='(youtu)';   # Word 1
  6.           $re3='(vimeo)';   # Word 2
  7.  
  8.           if ($c=preg_match_all ("/".$re1.$re2."/is", $value, $matches))
  9.           {
  10.               $video = str_replace('http://www.youtube.com/watch?v=', '', $value);
  11.               $vimeo_link = '<object width="425" height="350" data="http://www.youtube.com/v/'.$video.'" type="application/x-shockwave-flash"><param name="src" value="'.$value.'" /></object>';
  12.           }elseif ($c=preg_match_all ("/".$re1.$re4."/is", $value, $matches)) {
  13.             $video = str_replace('http://youtu.be/', '', $value);
  14.               $vimeo_link = '<object width="425" height="350" data="http://www.youtube.com/v/'.$video.'" type="application/x-shockwave-flash"><param name="src" value="'.$value.'" /></object>';
  15.           }
  16.           elseif ($c=preg_match_all ("/".$re1.$re3."/is", $value, $matches)) {
  17.             $video = str_replace('https://vimeo.com/', '', $value);
  18.             $vimeo_link = '<iframe src="//player.vimeo.com/video/'. $video .'" width="500" height="313" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
  19.           }else{
  20.             return 'error';
  21.           }
  22.           return $vimeo_link;
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement