Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- P@r0L#5687function _video($value)
- {
- $re1='.*?'; # Non-greedy match on filler
- $re2='(youtube)'; # Word 1
- $re4='(youtu)'; # Word 1
- $re3='(vimeo)'; # Word 2
- if ($c=preg_match_all ("/".$re1.$re2."/is", $value, $matches))
- {
- $video = str_replace('http://www.youtube.com/watch?v=', '', $value);
- $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>';
- }elseif ($c=preg_match_all ("/".$re1.$re4."/is", $value, $matches)) {
- $video = str_replace('http://youtu.be/', '', $value);
- $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>';
- }
- elseif ($c=preg_match_all ("/".$re1.$re3."/is", $value, $matches)) {
- $video = str_replace('https://vimeo.com/', '', $value);
- $vimeo_link = '<iframe src="//player.vimeo.com/video/'. $video .'" width="500" height="313" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
- }else{
- return 'error';
- }
- return $vimeo_link;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement