Fixed bug in override parameters not being read.
authorAlan Jack Pippin <ajp@pippin.(none)>
Sat, 23 Jun 2007 06:31:28 +0000 (00:31 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Sat, 23 Jun 2007 06:31:28 +0000 (00:31 -0600)
Fixed bug with youtube url being too restrictive.

ItemAddEmbedVideo.inc

index a6cb38c5aad7092791554c75e110d47ba4e69492..7b79cc28c737b462202c1aa0db93e46de9a9e355 100644 (file)
@@ -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 <br>"; */
                   }
               }
           }
           
           /* 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
   */