From: Alan Jack Pippin Date: Sat, 23 Jun 2007 06:31:28 +0000 (-0600) Subject: Fixed bug in override parameters not being read. X-Git-Tag: 1_0_4~9 X-Git-Url: http://git.pippins.net/embedvideo/images/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/static/%3C?a=commitdiff_plain;h=cb157a9d59eba1eca436730afe1b17b0703d1e38;p=embedvideo%2F.git Fixed bug in override parameters not being read. Fixed bug with youtube url being too restrictive. --- diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index a6cb38c..7b79cc2 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -58,22 +58,27 @@ class ItemAddEmbedVideo extends ItemAddPlugin { foreach ($variablesArray as $variable) { list ($name, $value) = explode('=', $variable); $ItemAddEmbedVideo[$type][$name] = $value; + /* print "type: $type name: $name value: $value
"; */ } } } /* Store any Parameters into some simpler, shorter, local variables */ - $debugOutput = $ItemAddEmbedVideo['default']['debugOutput']; - $useInternalFlvPlayer = $ItemAddEmbedVideo['default']['useInternalFlvPlayer']; - $youtubeDevId = $ItemAddEmbedVideo['default']['youtubeDevId']; - $width=$ItemAddEmbedVideo['default']['width']; - $height=$ItemAddEmbedVideo['default']['height']; - $externalFlvPlayer = $ItemAddEmbedVideo['default']['externalFlvPlayer']; - $externalFlvPlayerVars = $ItemAddEmbedVideo['default']['externalFlvPlayerVars']; - $flvThumbnail = $ItemAddEmbedVideo['default']['flvThumbnail']; + global $debugOutput, $useInternalFlvPlayer, $youtubeDevId; + global $width, $height, $externalFlvPlayer, $externalFlvPlayerVars; + global $flvThumbnail; + + $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'); /* Store other string constants we'll use later */ - $youtubeUrlPattern="www.youtube.com"; + $youtubeUrlPattern="youtube.com"; $youtubeApiUrl="http://www.youtube.com/api2_rest"; $googleUrlPattern="video.google.com"; $googlePlayer="http://video.google.com/googleplayer.swf"; @@ -388,6 +393,18 @@ class ItemAddEmbedVideo extends ItemAddPlugin { return array(null, $error, $status); } + /** + * A simple function to resolve the value of a parameter from + * the default or override value if it exists. + */ + function getParameter($params, $name) { + if(isset($params['override'][$name])) { + return($params['override'][$name]); + } else { + return($params['default'][$name]); + } + } + /** * @see ItemAdd:loadTemplate */