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

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 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 iFrames
elseif (preg_match('~iframe.+src=(?:&quot;|[\'"])(?:https?:)?//*?)(?:&quot;|[\'"])~i'.($context['utf8'] ? 'u' : ''), $data[0], $matches))
$tag['content'] = '<iframe src=' . $matches[1] . ' width=$2 height=$3 frameborder=0 allowfullscreen></iframe>';

// end masodos MOD to embed 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:
Read the popular "Earth's Earliest Ages" by George H. Pember  free online


Comments (0)