[Home]WikiPatches/UploadFlashbox

UseModWiki | WikiPatches | RecentChanges | Preferences

This allows you to embed offsite-hosted by GoogleVideo, YouTube, and SlideShare. Suggestions are welcome.
sub InitLinkPatterns {
...
   $UploadPattern = "upload:([^\\]\\s\"<>$FS]+)$QDelim";
   + $GoogleVideoPattern ="googlevideo:([0-9-]+)";
   + $SlideSharePattern ="slideshare:([A-Za-z0-9-]+)";
   + $YouTubePattern ="youtube:(-?[^\\]\\s\"<>$FS]+)$QDelim";
}

sub CommonMarkup {
...
  s/$UploadPattern/&StoreUpload($1)/geo;
  + s/$GoogleVideoPattern/&StoreGoogleVideo($1)/geo;
  + s/$SlideSharePattern/&StoreSlideShare($1)/geo;
  + s/$YouTubePattern/&StoreYouTube($1)/geo;
  if ($WikiLinks) {
...
}

sub StoreGoogleVideo {
  my ($flashbox) = @_;

  return &StoreRaw(&GoogleVideoLink($flashbox));
}

sub StoreSlideShare {
  my ($flashbox) = @_;

  return &StoreRaw(&SlideShareLink($flashbox));
}

sub StoreYouTube {
  my ($flashbox) = @_;

  return &StoreRaw(&YouTubeLink($flashbox));
}

sub GoogleVideoLink {
  my ($googlevideo) = @_;
  
  return &FlashboxHtml('googlevideo',
                      "http://video.google.com/googleplayer.swf?docId=$googlevideo&hl=en");
}

sub SlideShareLink {
  my ($slideshare) = @_;
  
  return &FlashboxHtml('slideshare',
                      "http://static.slideshare.net/swf/ssplayer2.swf?doc=$slideshare");
}

sub YouTubeLink {
  my ($youtube) = @_;
  my (@youtube, @code, $VIDEO_ID, @alignment, $alignment, $caption, $i);

  @youtube = split (/:/, $youtube);
  @alignment = qw(left right center);
  foreach $i (@alignment) {if ($youtube[0] eq $i) {$alignment = $i;}}
  if ($alignment eq '') {$alignment = 'left';}
  $caption = $youtube[1];
  $caption =~ s/_/ /g;
  if (grep /youtube/, $youtube[3]) { 
    @code = split (/=/, $youtube[3]);
    $VIDEO_ID = $code[1];
  }
  if (grep /youtu.be/, $youtube[3]) {
    @code = split (/\//, $youtube[3]);
    $VIDEO_ID = $code[3];
  }
  return "<div class=$alignment>"
         . &FlashboxHtml('youtube', 
                         "http://www.youtube.com/v/$VIDEO_ID&rel=0&fs=1&cc_load_policy=1")
         # . "<iframe width=330 height=197 
                      # src=//www.youtube.com/v/$code[1]&rel=0&fs=1&cc_load_policy=1>
             # </iframe>"
         . '<p class=' . $alignment . '>'. $caption
         . ' ' . &MacroFootNote("<a href=\"http:youtube[3]\">http:$youtube[3]</a>")
         . '</p></div>';
}
--JuanmaMP


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited March 29, 2012 12:15 pm by JuanmaMP (diff)
Search: