News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Embed BBCode

Started by nikan, June 02, 2011, 07:29:55 PM

Previous topic - Next topic

ivanTW

Thanks for the help Nikan. Will do!

halpaslan

Quote from: halpaslan on February 25, 2015, 03:32:38 AM
Is it possible to use this mod with onedrive embedded links?
Bump!

FragaCampos

Hi there.
What's the difference between this mod and using html tags?

PracticalLightning

I just got this running in SMF 2.1 Beta 3
I needed this to work because I was using it in a site that I upgraded when I changed servers.

Installing the MOD resulted in =>
    Execute Modification        ./Sources/Subs.php | successful | failed | successful |
    Execute Modification        ./Sources/Subs-Editor.php | successful | failed | successful |

So I had to manually do the following:

in ./Sources/Subs.php
Code (Find)
array(
'tag' => 'flash',
'type' => 'unparsed_commas_content',
'test' => '\d+,\d+\]',
'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
'validate' => function (&$tag, &$data, $disabled)
{
if (isset($disabled['url']))
$tag['content'] = '$1';
$scheme = parse_url($data[0], PHP_URL_SCHEME);
if (empty($scheme))
$data[0] = '//' . ltrim($data[0], ':/');
},
'disabled_content' => '<a href="$1" target="_blank" class="new_win">$1</a>',
),


Code (Add After) (NOTE: This includes my own mods to embed hxxp:archive.org [nonactive] streams and Real.video iframes)
array(
'tag' => 'embed',
'type' => 'unparsed_commas_content',
'test' => '\d+,\d+\]',
'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="$2" height="$3"><param name="movie" value="$1" /><param name="AllowScriptAccess" value="always" /><param name="AllowFullScreen" value="true" /><param name="wmode" value="transparent" /><a href="$1" target="_blank" class="new_win">$1</a></object>' : '<object type="application/x-shockwave-flash" data="$1" width="$2" height="$3"><param name="movie" value="$1" /><param name="AllowFullScreen" value="true" /><param name="AllowScriptAccess" value="always" /><param name="wmode" value="transparent" /><a href="$1" target="_blank" class="new_win">$1</a></object>'),
'validate' => create_function('&$tag, &$data, $disabled', '
if (isset($disabled[\'embed\']))
$tag[\'content\'] = \'$1\';
global $context;
if (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])(?:https?\:)?\/\/www\.(?:youtube|youtube\-nocookie)\.com\/embed\/(.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.youtube.com/v/\' . $matches[1] . \'?wmode=transparent\';
elseif (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])(?:https?\:)?\/\/www\.dailymotion\.com\/embed\/video\/(.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.dailymotion.com/swf/video/\' . $matches[1];
elseif (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])(?:https?\:)?\/\/player\.vimeo\.com\/video\/(.*?)\?.+(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://vimeo.com/moogaloop.swf?clip_id=\' . $matches[1];
elseif (preg_match(\'~http\:\/\/www.youtube.com\/watch[?]v=(.+)~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.youtube.com/v/\' . $matches[1] . \'&amp;fs=1&amp;wmode=transparent\';
elseif (preg_match(\'~http\:\/\/youtu\.be\/(.+)~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.youtube.com/v/\' . $matches[1] . \'&amp;fs=1&amp;wmode=transparent\';
elseif (preg_match(\'~embed.+src=(?:&quot;|[\\\'"])((?:https?\:)?\/\/(?:www\.)?(?:youtube|youtube-nocookie|dailymotion|vimeo|metacafe|megavideo|veoh)\.com\/.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = $matches[1];
// 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
// begin masodos MOD to embed real.video iFrames
elseif (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])(?:https?\:)?\/\/www\.real\.video\/embed\/(.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$tag[\'content\'] = \'<iframe src=https://www.real.video/embed/\' . $matches[1] . \' width=$2 height=$3 frameborder=0  allowfullscreen></iframe>\';
// end masodos MOD to embed real.video iFrames

else
$tag[\'content\'] = \'$1\';
'),
'disabled_content' => '<a href="$1" target="_blank" class="new_win">$1</a>',
),


~AND~

in ./Sources/Subs-Editor.php
Code (Find)
array(
'code' => 'table',
'description' => $editortxt['table']
),
array(
'code' => 'code',
'description' => $editortxt['bbc_code']
),


Code (Add After)
array(
'image' => 'embed',
'code' => 'embed',
'before' => '[embed=425,349]',
'after' => '[/embed]',
'description' => $txt['embed']
),


Last (and perhaps least) had to convert the "embed.gif" to "embed.png" so it shows on the toolbar in editor.

see in action: hxxp:deburger.com/vestibule/ [nonactive]

njtweb

I see you're running live. I have 32 mods on my 2.0.15 site. Did you have a lot of mods, if so was the transition successful for them, (besides this one) after upgrade?

Kellers

Does anyone know how to add Rumble to this mod list? Great mod but I need Rumble as well.

Advertisement: