From cb157a9d59eba1eca436730afe1b17b0703d1e38 Mon Sep 17 00:00:00 2001 From: Alan Jack Pippin Date: Sat, 23 Jun 2007 00:31:28 -0600 Subject: [PATCH] Fixed bug in override parameters not being read. Fixed bug with youtube url being too restrictive. --- ItemAddEmbedVideo.inc | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) 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 */ -- 2.34.1