X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=0e277a490427e598fda49ef8a32c2473ca12118b;hb=8a4f854fa696366b1708d46faa24995e6895004f;hp=6bb160fbc5b7ebaff3e94f00b1d1b6e0ece01a08;hpb=c89207ee0c133a7176a21d0bca5d452a17977488;p=embedvideo%2F.git diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index 6bb160f..0e277a4 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -161,6 +161,9 @@ class ItemAddEmbedVideo extends ItemAddPlugin { $myspaceUrlPattern="vids.myspace.com"; $myspaceUrlPattern2="myspacetv.com"; $myspaceThumbnailUrl="http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID="; + + /* vimeo */ + $vimeoUrlPattern="www.vimeo.com"; /* Gallery2 specific paths and variables */ $urlGenerator =& $gallery->getUrlGenerator(); @@ -781,7 +784,72 @@ class ItemAddEmbedVideo extends ItemAddPlugin { return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, "Unable to extract embedded video information from url: $url"),NULL,NULL); } - + + /* + ********************************** + * Embed a Vimeo Video + ********************************** + */ + } else if(preg_match("/$vimeoUrlPattern/",$url)) { + + /* Make sure we can extract a docID */ + if(preg_match("/$vimeoUrlPattern\/(.*)/",$url,$matches)) { + $video_id = $matches[1]; + } else { + return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__, + "Unable to extract video id from url: $url"),null,null); + } + + /* Grab the contents of the webpage used to display the video on video.google.com */ + list ($successfullyCopied, $contents, $response, $headers) = + GalleryCoreApi::fetchWebPage($url, $extraHeaders); + if (!$successfullyCopied) { + return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, + "Unable to get video information at url: $url - $response"),NULL,NULL); + } + + /* Extract the summary from the webpage contents */ + preg_match('/