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=983ec79d041f82e00dcbb2c4968928f06d7ade98;hb=26f4eaa28c1a947b5e1f8f58f1cd653596e2253d;hp=e5eecd1552acde47caac0a76b47401ee4c5086a8;hpb=f61667e91c20c89758911f384ec30ff9f92c49e1;p=embedvideo%2F.git
diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc
index e5eecd1..983ec79 100644
--- a/ItemAddEmbedVideo.inc
+++ b/ItemAddEmbedVideo.inc
@@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+GalleryCoreApi::requireOnce('modules/gd/classes/GdToolkitHelper.class');
+
+
/**
* This plugin will handle the addition of embedded video objects
* @package embedVideo
@@ -66,27 +69,56 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
/* Store any Parameters into some simpler, shorter, local variables */
global $debugOutput, $useInternalFlvPlayer, $youtubeDevId;
global $width, $height, $externalFlvPlayer, $externalFlvPlayerVars;
- global $flvThumbnail;
+ global $flvThumbnail, $useRemoteSize, $autoStart;
- $debugOutput = $this->getParameter($ItemAddEmbedVideo, 'debugOutput');
- $useInternalFlvPlayer = $this->getParameter($ItemAddEmbedVideo, 'useInternalFlvPlayer');
- $youtubeDevId = $this->getParameter($ItemAddEmbedVideo, 'youtubeDevId');
- $width = $this->getParameter($ItemAddEmbedVideo, 'width');
- $height = $this->getParameter($ItemAddEmbedVideo, 'height');
- $externalFlvPlayer = $this->getParameter($ItemAddEmbedVideo, 'externalFlvPlayer');
- $externalFlvPlayerVars = $this->getParameter($ItemAddEmbedVideo, 'externalFlvPlayerVars');
- $flvThumbnail = $this->getParameter($ItemAddEmbedVideo, 'flvThumbnail');
+ /* 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
+ * defined in either of these 2 places, pass in a default value to set them to
+ */
+ $debugOutput = $this->getParameter($ItemAddEmbedVideo, 'debugOutput', "false");
+ $useInternalFlvPlayer = $this->getParameter($ItemAddEmbedVideo, 'useInternalFlvPlayer', "true");
+ $youtubeDevId = $this->getParameter($ItemAddEmbedVideo, 'youtubeDevId', "");
+ $width = $this->getParameter($ItemAddEmbedVideo, 'width', "320");
+ $height = $this->getParameter($ItemAddEmbedVideo, 'height', "240");
+ $externalFlvPlayer = $this->getParameter($ItemAddEmbedVideo, 'externalFlvPlayer', "");
+ $externalFlvPlayerVars = $this->getParameter($ItemAddEmbedVideo, 'externalFlvPlayerVars', "");
+ $flvThumbnail = $this->getParameter($ItemAddEmbedVideo, 'flvThumbnail', "");
+ $useRemoteSize = $this->getParameter($ItemAddEmbedVideo, 'useRemoteSize', "false");
+ $autoStart = $this->getParameter($ItemAddEmbedVideo, 'autoStart', "false");
+
+ /* Print our stored/set Parameters */
+ if(!strcmp($debugOutput,"true")) {
+ print "
";
+ print "
Variable Parameters
";
+ print "debugOutput=$debugOutput ";
+ print "useInternalFlvPlayer=$useInternalFlvPlayer ";
+ print "youtubeDevId=$youtubeDevId ";
+ 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";
+
/* yahoo */
$yahooUrlPattern="video.yahoo.com";
$yahooThumbnailUrl="http://thmg01.video.search.yahoo.com/image/";
@@ -138,9 +170,10 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
"Unable to get video information at url: $url - $response"),null,null);
}
-
if(!strcmp($debugOutput,"true")) {
+ print "
Youtube XML Dump
";
print "$xml";
+ print "";
}
/* Extract certain information from the xml feed */
@@ -163,12 +196,24 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$summary = $description[0][0];
$thumbnail = $thumbnail[0][0];
+ /* Determine what our width and height should be based on our useRemoteSize parameter */
+ if(!strcmp($useRemoteSize,"true")) {
+ $width = $youtubeWidth;
+ $height = $youtubeHeight;
+ }
+
+ /* Determine if the video should autoplay or not based on the autoStart parameter */
+ $autoStartStr="";
+ if(!strcmp($autoStart,"true")) {
+ $autoStartStr="&autoplay=1";
+ }
+
/* Format the description to hold a reference to the embedded video */
$description = '';
$description.= " $summary";
@@ -215,11 +260,23 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$thumbnail=$matches[1];
$thumbnail=preg_replace("/offsetms=0/","offsetms=0",$thumbnail);
+ /* Determine what our width and height should be based on our useRemoteSize parameter */
+ if(!strcmp($useRemoteSize,"true")) {
+ $width = $googleWidth;
+ $height = $googleHeight;
+ }
+
+ /* Determine if the video should autoplay or not based on the autoStart parameter */
+ $autoStartStr="";
+ if(!strcmp($autoStart,"true")) {
+ $autoStartStr="&autoplay=1";
+ }
+
/* Format the description to hold a reference to the embedded video */
- $description = '';
$description.= " $summary";
@@ -227,6 +284,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
**********************************
* Embed a Yahoo Video
**********************************
+ * TODO: The autoStart parameter doesn't work with the yahoo video player
*/
} else if(preg_match("/$yahooUrlPattern/",$url)) {
@@ -264,8 +322,10 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
/* Format the description to hold a reference to the embedded video */
preg_match('/(";
$description.= " $summary";
@@ -372,7 +437,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
if(!preg_match("/\w+/",$externalFlvPlayerVars)) {
/* Format the flashvars for the internal G2 flv player */
- $description.= '&showdigits=true&autostart=false&showfsbutton=true&';
+ $description.= '&showdigits=true&autostart='.$autoStart.'&showfsbutton=true&';
$description.= '&repeat=false&lightcolor=0x9999FF';
$description.= '&backcolor=0x888888&frontcolor=0x000000"';
} else {
@@ -401,7 +466,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$description.= '';
$description.= '';
$description.= '';
$description.= '';
@@ -411,7 +476,7 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$description.= '