";
+ print "debugOutput=$debugOutput ";
+ print "useInternalFlvPlayer=$useInternalFlvPlayer ";
+ print "youtubeDevId=$youtubeDevId ";
+ print "youtubeShowRelated=$youtubeShowRelated ";
+ print "width=$width ";
+ print "height=$height ";
+ print "externalFlvPlayer=$externalFlvPlayer ";
+ print "externalFlvPlayerVars=$externalFlvPlayerVars ";
+ print "flvThumbnail=$flvThumbnail ";
+ print "useRemoteSize=$useRemoteSize ";
+ print "autoStart=$autoStart ";
+ print "";
+ }
+
/* Store other string constants we'll use later */
/* youtube */
$youtubeUrlPattern="youtube.com";
$youtubeApiUrl="http://www.youtube.com/api2_rest";
+ /* We can't extract the server size from youtube */
$youtubeWidth="425";
$youtubeHeight="350";
/* google */
$googleUrlPattern="video.google.com";
$googlePlayer="http://video.google.com/googleplayer.swf";
+ /* We can't extract the server size from google video */
$googleWidth="400";
$googleHeight="326";
@@ -151,8 +172,16 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
"Unable to get video information at url: $url - $response"),null,null);
}
+ if(preg_match("/This video is private/",$xml)) {
+ return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__,
+ "Unable to retrieve video information from youtube.".
+ "You cannot embed a private youtube video: $url"),null,null);
+ }
+
if(!strcmp($debugOutput,"true")) {
+ print "
Youtube XML Dump
";
print "$xml";
+ print "";
}
/* Extract certain information from the xml feed */
@@ -186,14 +215,21 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
if(!strcmp($autoStart,"true")) {
$autoStartStr="&autoplay=1";
}
+
+ /* Determine if the video should show related videos or not based on the youtubeShowRelated parameter */
+ $youtubeShowRelatedStr="";
+ if(!strcmp($youtubeShowRelated,"false")) {
+ $youtubeShowRelatedStr="&rel=0";
+ }
/* Format the description to hold a reference to the embedded video */
$description = '';
$description.= " $summary";
@@ -252,10 +288,10 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
}
/* Format the description to hold a reference to the embedded video */
- $description = '';
$description.= " $summary";
@@ -354,7 +390,48 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
}
$description.= "";
$description.= " $summary";
-
+
+
+ /*
+ **********************************
+ * Embed a remote .swf file
+ **********************************
+ */
+ } else if(preg_match("/.*\/(.+?)\.swf/i",$url,$matches)) {
+
+ /* Set the title and summary to the name of the file */
+ $title = $matches[1];
+ $summary = $matches[1];
+
+ /*
+ * Set the thumbnail to some generic jpg image,
+ * since we can't extract it from the remote swf file.
+ * If no parameter is set, set it to a default value.
+ */
+ if(preg_match("/\w+/", $flvThumbnail)) {
+ $thumbnail = $flvThumbnail;
+ } else {
+ $thumbnail = $gallery2_url.$gallery2_flv_thumbnail;
+ }
+
+ /*
+ * Check to make sure the URL to the remote swf file is valid
+ * (That the file exists at the URL given)
+ */
+ list ($successfullyCopied, $response, $headers) =
+ $this->fetchWebFileHeaders($url, $extraHeaders);
+ if (!$successfullyCopied) {
+ return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__,
+ "Unable to find the video at url: $url - $response"),NULL,NULL);
+ }
+
+ /*
+ * Format the description to hold a reference to the embedded video
+ */
+
+ /* Format the description to hold a reference to the embedded video */
+ $description ='