X-Git-Url: http://git.pippins.net/embedvideo/.git/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/jquery.tablesorter.css%27%29.%27?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=bbb941d3a6562f6d652a62af5ef336cd66f8f6a4;hb=ebec4ad4f9051c9101dfb1ff331ea5a1a1832094;hp=ac7b1cf05dde317810575fc2f0820a8e02d77503;hpb=bbe9d512174553b9b410742bb82c69ffa67911f5;p=embedvideo%2F.git
diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc
index ac7b1cf..bbb941d 100644
--- a/ItemAddEmbedVideo.inc
+++ b/ItemAddEmbedVideo.inc
@@ -71,6 +71,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
global $width, $height, $externalFlvPlayer, $externalFlvPlayerVars;
global $flvThumbnail, $useRemoteSize, $autoStart;
global $watermarkVideos, $watermarkImage, $watermarkAlignment;
+ global $unsupported_url;
/* Find out what value our parameters should have by looking to see if they
* are defined in our overrides section or default section. If they are not
@@ -117,7 +118,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
/* Store other string constants we'll use later */
/* youtube */
- $youtubeUrlPattern="youtube.com";
+ $youtubeUrlPattern="youtube";
$youtubeApiUrl="http://gdata.youtube.com/feeds/api/";
$youtubeThumbnailUrl="http://img.youtube.com/vi/";
/* We can't extract the server size from youtube */
@@ -125,43 +126,43 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$youtubeHeight="350";
/* google */
- $googleUrlPattern="video.google.com";
+ $googleUrlPattern="video.google";
$googlePlayer="http://video.google.com/googleplayer.swf";
/* We can't extract the server size from google video */
$googleWidth="400";
$googleHeight="326";
/* yahoo */
- $yahooUrlPattern="video.yahoo.com";
+ $yahooUrlPattern="video.yahoo";
$yahooThumbnailUrl="http://thmg01.video.search.yahoo.com/image/";
/* metacafe */
- $metacafeUrlPattern="metacafe.com";
+ $metacafeUrlPattern="metacafe";
$metacafeThumbnailUrl="http://www.metacafe.com/thumb/";
/* revver */
- $revverUrlPattern="revver.com";
+ $revverUrlPattern="revver";
$revverThumbnailUrl="http://frame.revver.com/frame/120x90/";
/* dailymotion */
- $dailymotionUrlPattern="dailymotion.com";
+ $dailymotionUrlPattern="dailymotion";
$dailymotionThumbnailUrl="http://www.dailymotion.com/thumbnail/160x120/video/";
/* divshare */
- $divshareUrlPattern="divshare.com";
+ $divshareUrlPattern="divshare";
$divshareThumbnailUrl="http://www.divshare.com/direct/video_thumb/";
/* stickam */
- $stickamUrlPattern="stickam.com";
+ $stickamUrlPattern="stickam";
$stickamThumbnailUrl="http://static.stickam.com/";
/* myspace */
- $myspaceUrlPattern="vids.myspace.com";
- $myspaceUrlPattern2="myspacetv.com";
+ $myspaceUrlPattern="vids.myspace";
+ $myspaceUrlPattern2="myspacetv";
$myspaceThumbnailUrl="http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=";
/* vimeo */
- $vimeoUrlPattern="www.vimeo.com";
+ $vimeoUrlPattern="vimeo.com";
/* Gallery2 specific paths and variables */
$urlGenerator =& $gallery->getUrlGenerator();
@@ -169,10 +170,17 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$gallery2_flv_thumbnail = "modules/embedvideo/images/G2video_thumbnail.jpg";
$gallery2_video_watermark = "modules/embedvideo/images/G2video_watermark1.png";
$gallery2_flv_player = "modules/flashvideo/lib/G2flv.swf";
+
+ /* Unsupported URLs */
+ $unsupported_url=0;
/* Store the passed URL in a shorter local variable */
+ /* Strip trailing whitespace in the url, this will cause problems later */
$url = $form['webPage']['URL'];
-
+ if(preg_match("/(.*?)\s+/",$url,$matches)) {
+ $url = $matches[1];
+ }
+
/*
*****************************
* Embed a Youtube Video
@@ -187,6 +195,8 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$extra_params = $matches[2];
} else if (preg_match("/watch\?v=(.*)/",$url,$matches)) {
$video_id = $matches[1];
+ } else if (preg_match("/v\/(.*)/",$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);
@@ -194,7 +204,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
/* If extra params were given, handle them here */
if(strcmp($extra_params,"")) {
- /* Handle the HD format information */
+ /* Handle the high quality format information */
if(preg_match("/fmt=(\d+)/",$extra_params,$matches)) {
$extra_params="&ap=%2526fmt%3D".$matches[1];
}
@@ -325,10 +335,11 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
}
/* Extract the thumbnail URL from the webpage contents */
- preg_match('/';
- $description.= '';
+ $description = '';
-
+ $description.= '';
+ $description.= '';
+ $description.= '';
+
/*
**********************************
* Embed a remote .swf file
@@ -836,11 +857,12 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
/*
**********************************
- * Embed a remote .flv file
+ * Embed a remote .flv or .mp4 file
**********************************
*/
- } else if(preg_match("/.*\/(.+?)\.flv/i",$url,$matches)) {
-
+ } else if(preg_match("/.*\/(.+?)\.flv/i",$url,$matches) ||
+ preg_match("/.*\/(.+?)\.mp4/i",$url,$matches)) {
+
/* Set the title and summary to the name of the file */
$title = $matches[1];
$summary = $matches[1];
@@ -942,15 +964,71 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$description.= 'pluginspage="http://www.macromedia.com/go/getflashplayer"/>';
$description.= '';
}
-
+
+ /*
+ **********************************
+ * Embed a generic