Welcome to BlogDogIt Monday, July 16 2018 @ 10:30 AM EDT

Embed Archive.org iFrames in SMF Forum Hack

  • Contributed by:
  • Views: 899
masodo's musings

At Archive.orgIn order to embed video in a Simple Machines Forum (SMF) installation I added the Embed BBCode v.2.0 plugin to my site and was happy enough until the time came where I wanted to embed a PDF hosted by Archive.org.

These PDFs are delivered via "<iframe>" and are not compatible with the plugin. I was able to hack my install to allow safe and effective inclusion of Archive.org hosted PDFs to my site.

Here is how I did it...

First, save a back-up of /Sources/Subs.php

Then Modify ==>  /Sources/Subs.php  

after line 1226,  before:

1227                     else
1228                              $tag['content'] = '$1';

insert the following code (watch the word-wrap - this is two lines between the comments):

// begin masodos MOD to embed Archive.org iFrames
elseif (preg_match('~iframe.+src=(?:&quot;|[\'"])(?:https?:)?//archive.org/stream/(.*?)(?:&quot;|[\'"])~i'.($context['utf8'] ? 'u' : ''), $data[0], $matches))
$tag['content'] = '<iframe src=https://archive.org/stream/' . $matches[1] . ' width=$2 height=$3 frameborder=0 allowfullscreen></iframe>';

// end masodos MOD to embed Archive.org iFrames

 

Of course you will make this modification at your own peril and will not hold me responsible for any ills that may befall you as a result of utilizing this hack but I wish this was available sooner, I would have tried it.

 

I'm using it with much success - See it in action here:
http://www.mtzionindy.org/vestibule/index.php?topic=93.0
Read the popular "Earth's Earliest Ages" by George H. Pember  free online

 

Share
  • Facebook
  • Google Bookmarks
  • Digg
  • Twitter
  • Reddit