Advertisement:

Author Topic: Embed BBCode  (Read 54083 times)

Offline ivanTW

  • Semi-Newbie
  • *
  • Posts: 30
Re: Embed BBCode
« Reply #100 on: March 02, 2015, 06:34:23 PM »
Thanks for the help Nikan. Will do!

Offline halpaslan

  • Newbie
  • *
  • Posts: 5
Re: Embed BBCode
« Reply #101 on: March 12, 2015, 04:42:31 PM »
Is it possible to use this mod with onedrive embedded links?
Bump!

Offline FragaCampos

  • Sophist Member
  • *****
  • Posts: 1,281
  • Gender: Male
    • docsPT
Re: Embed BBCode
« Reply #102 on: October 31, 2015, 04:59:25 PM »
Hi there.
What's the difference between this mod and using html tags?

Offline PracticalLightning

  • Newbie
  • *
  • Posts: 2
Re: Embed BBCode
« Reply #103 on: August 31, 2018, 02:41:10 PM »
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)
Code: [Select]
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 Archive.org streams and Real.video iframes)
Code: [Select]
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)
Code: [Select]
array(
'code' => 'table',
'description' => $editortxt['table']
),
array(
'code' => 'code',
'description' => $editortxt['bbc_code']
),

Code (Add After)
Code: [Select]
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]

Offline njtweb

  • Full Member
  • ***
  • Posts: 572
Re: Embed BBCode
« Reply #104 on: August 31, 2018, 08:56:02 PM »
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?