diff --git a/Packages/Simple_Youtube_Video_Embedder_BBC_v1.1.tar.gz b/Packages/Simple_Youtube_Video_Embedder_BBC_v1.1.tar.gz new file mode 100644 index 0000000..6fd9817 Binary files /dev/null and b/Packages/Simple_Youtube_Video_Embedder_BBC_v1.1.tar.gz differ diff --git a/Packages/backups/2014-02-04_before_Simple_Youtube_Video_Embedder_BBC_v1.tar.gz b/Packages/backups/2014-02-04_before_Simple_Youtube_Video_Embedder_BBC_v1.tar.gz new file mode 100644 index 0000000..6d4979a Binary files /dev/null and b/Packages/backups/2014-02-04_before_Simple_Youtube_Video_Embedder_BBC_v1.tar.gz differ diff --git a/Packages/installed.list b/Packages/installed.list index 0c048f7..5b8db9e 100644 --- a/Packages/installed.list +++ b/Packages/installed.list @@ -1 +1 @@ -1391538208 \ No newline at end of file +1391538735 \ No newline at end of file diff --git a/Sources/Post.php b/Sources/Post.php index 31a1acc..dce20fa 100644 --- a/Sources/Post.php +++ b/Sources/Post.php @@ -1531,7 +1531,7 @@ function Post2() preparsecode($_POST['message']); // Let's see if there's still some content left without the tags. - if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false)) + if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '', + '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( 'tag' => 'white', 'before' => '', @@ -1853,11 +1865,14 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra $data = strtr($data, array(''' => '\'', ' ' => $context['utf8'] ? "\xC2\xA0" : "\xA0", '"' => '>">', '"' => '<"<', '<' => '\.(;\'"]|^)((?:http|https)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@!,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>\.(;\'"]|^)((?:ftp|ftps)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@!,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i' ), array( + '[youtube]$1[/youtube]', '[url]$1[/url]', '[ftp]$1[/ftp]', '[url=http://$1]$1[/url]'