mirror of
https://github.com/moparisthebest/moparscape.org-smf
synced 2024-11-21 08:15:09 -05:00
Added Youtube Embedder mod
This commit is contained in:
parent
4dccad1423
commit
a7287c3e60
BIN
Packages/Simple_Youtube_Video_Embedder_BBC_v1.1.tar.gz
Normal file
BIN
Packages/Simple_Youtube_Video_Embedder_BBC_v1.1.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
1391538208
|
1391538735
|
@ -1531,7 +1531,7 @@ function Post2()
|
|||||||
preparsecode($_POST['message']);
|
preparsecode($_POST['message']);
|
||||||
|
|
||||||
// Let's see if there's still some content left without the tags.
|
// Let's see if there's still some content left without the tags.
|
||||||
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
|
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<object><embed><iframe><object><embed><iframe><img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
|
||||||
$post_errors[] = 'no_message';
|
$post_errors[] = 'no_message';
|
||||||
}
|
}
|
||||||
if (isset($_POST['calendar']) && !isset($_REQUEST['deleteevent']) && $smcFunc['htmltrim']($_POST['evtitle']) === '')
|
if (isset($_POST['calendar']) && !isset($_REQUEST['deleteevent']) && $smcFunc['htmltrim']($_POST['evtitle']) === '')
|
||||||
|
@ -1610,6 +1610,18 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
|
|||||||
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
|
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
|
||||||
'disabled_after' => ' ($1)',
|
'disabled_after' => ' ($1)',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'tag' => 'youtube',
|
||||||
|
'type' => 'unparsed_content',
|
||||||
|
'content' => '<iframe style="border:0;" width="642" height="392" src="http://www.youtube.com/embed/$1" allowfullscreen></iframe>',
|
||||||
|
'validate' => create_function('&$tag, &$data, $disabled', '
|
||||||
|
if (isset($disabled[\'url\']))
|
||||||
|
$tag[\'content\'] = \'http://www.youtube.com/watch?v=$1\';
|
||||||
|
$pattern = \'~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i\';
|
||||||
|
if (preg_match($pattern, $data, $matches))
|
||||||
|
$data = $matches[1];'),
|
||||||
|
'disabled_content' => 'http://www.youtube.com/watch?v=$1',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'tag' => 'white',
|
'tag' => 'white',
|
||||||
'before' => '<span style="color: white;" class="bbc_color">',
|
'before' => '<span style="color: white;" class="bbc_color">',
|
||||||
@ -1853,11 +1865,14 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
|
|||||||
$data = strtr($data, array(''' => '\'', ' ' => $context['utf8'] ? "\xC2\xA0" : "\xA0", '"' => '>">', '"' => '<"<', '<' => '<lt<'));
|
$data = strtr($data, array(''' => '\'', ' ' => $context['utf8'] ? "\xC2\xA0" : "\xA0", '"' => '>">', '"' => '<"<', '<' => '<lt<'));
|
||||||
|
|
||||||
// Only do this if the preg survives.
|
// Only do this if the preg survives.
|
||||||
|
//First line in each array added by "Simple_Youtube_Video_Embed_BBC" mod to parse youtube videos automatically
|
||||||
if (is_string($result = preg_replace(array(
|
if (is_string($result = preg_replace(array(
|
||||||
|
'~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i',
|
||||||
'~(?<=[\s>\.(;\'"]|^)((?:http|https)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@!,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i',
|
'~(?<=[\s>\.(;\'"]|^)((?:http|https)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@!,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i',
|
||||||
'~(?<=[\s>\.(;\'"]|^)((?:ftp|ftps)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i',
|
'~(?<=[\s>\.(;\'"]|^)((?:ftp|ftps)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i',
|
||||||
'~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@!,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'
|
'~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@!,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'
|
||||||
), array(
|
), array(
|
||||||
|
'[youtube]$1[/youtube]',
|
||||||
'[url]$1[/url]',
|
'[url]$1[/url]',
|
||||||
'[ftp]$1[/ftp]',
|
'[ftp]$1[/ftp]',
|
||||||
'[url=http://$1]$1[/url]'
|
'[url=http://$1]$1[/url]'
|
||||||
|
Loading…
Reference in New Issue
Block a user