aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2011-05-22 23:06:47 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-05-23 09:14:57 +0200
commitef64c5187df80da2065655726b8d05a9ce6b0e0a (patch)
tree6415d726afe1b6fd86b86ae63c461fd6f2370563 /include/bbcode.php
parent072e4146369ae8ec10af961b7e1b25dc491e8f07 (diff)
downloadvolse-hubzilla-ef64c5187df80da2065655726b8d05a9ce6b0e0a.tar.gz
volse-hubzilla-ef64c5187df80da2065655726b8d05a9ce6b0e0a.tar.bz2
volse-hubzilla-ef64c5187df80da2065655726b8d05a9ce6b0e0a.zip
add config [system][embed_all] to use oembed with links and youtube. Url parse fallback to default if url has not an oembed rappresentation.
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index c2d932674..b2e9cee6d 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -92,17 +92,22 @@ function bbcode($Text,$preserve_nl = false) {
// [img=widthxheight]image source[/img]
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" style="height:{$2}px; width:{$1}px;" >', $Text);
- // Youtube extensions
+ $a = get_app();
+ if ($a->config['system']['embed_all']){
+ // use oembed for youtube links
+ $Text = preg_replace("/\[youtube\]/",'[embed]',$Text);
+ $Text = preg_replace("/\[\/youtube\]/",'[/embed]',$Text);
+ } else {
+ // Youtube extensions
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
$Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
-
- $Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<br /><iframe style="width:425px;height:349px;padding:10px 0 10px 0;float:left;" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>', $Text);
-
-// $Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<br /><object style="width:425px;height:350px;" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" style="width:425px;height:350px;" /><![endif]--></object>', $Text);
+ $Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<iframe width="425" height="349" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>', $Text);
+ }
+// $Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
// oembed tag
$Text = oembed_bbcode2html($Text);
-
+
call_hooks('bbcode',$Text);
return $Text;