Adding unity to flash node module

In drupal 6, there is a very nice module for flash content. Called Flash node http://drupal.org/project/flashnode which does everything you need for flash files swf (not flv or mp3, you need swf tools for that). But as I have games site I wanted to add unity files to my nodes. As unity files are integrated very similar to flash, just different object values in html. I just hacked flash node and add one If to check if file is .unity3d and then if it is, just construct the object and embed tags differently and you have a unity node aswell.

So around line 1136 in flashnode.module we add this If, Else statment, Where we check if files is unity, if it is not, then we use regular flash inclusion of files.


   // Do something with unity files
 if (preg_match('@unity3d$@i', $flashnode['filepath'])) {  
 $output = 	t('<div class="flashnode"><object id="UnityObject" classid="clsid:444785F1-DE89-4295-863A-D46C3A781394" codebase="http://webplayer.unity3d.com/download_webplayer/UnityWebPlayer.cab#version=2,0,0,0" width="!width" height="!height" id="myMovieName"><param name="!filepath" value="!filepath" /><embed id="UnityEmbed"  src="!filepath" width="!width" height="!height" type="application/vnd.unity"   pluginspage="http://www.unity3d.com/unity-web-player-2.x" /></object></div>',
    array(
      '!height' => $flashnode['height'],
      '!width' => $flashnode['width'],
      '!filepath' => $filepath,
      '!flashvars' => $flashnode['flashvars'],
      '!base' => $basepath,
    )
  );
	
 }else {
  // Use t() to substitute parameters in to basic Flash markup
  $output = t('<div class="flashnode"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="!width" height="!height" id="myMovieName"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="movie" value="!filepath" /><param name="quality" value="high" /><param name="flashvars" value="!flashvars" /><param name="base" value="!base" /><embed src="!filepath" allowScriptAccess="sameDomain" allowFullScreen="true" quality="high" width="!width" height="!height" flashvars="!flashvars" name="myMovieName" align="" type="application/x-shockwave-flash" base="!base" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></div>',
    array(
      '!height' => $flashnode['height'],
      '!width' => $flashnode['width'],
      '!filepath' => $filepath,
      '!flashvars' => $flashnode['flashvars'],
      '!base' => $basepath,
    )
  );
 }
  return $output;