diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-05-09 09:26:38 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-05-09 09:26:38 +0200 |
commit | c8f686b8a553586a65e5bb4ceda5d1016d1c15be (patch) | |
tree | 7bb4ab1659e7a90c38a30a6925a0ec698867e4f5 /include/text.php | |
parent | 75128e8f68e829ad9e3670dac82f075d9632dba4 (diff) | |
parent | 94accd8a4c7500ee4f5c268fe7e84ad3ed9a6675 (diff) | |
download | volse-hubzilla-c8f686b8a553586a65e5bb4ceda5d1016d1c15be.tar.gz volse-hubzilla-c8f686b8a553586a65e5bb4ceda5d1016d1c15be.tar.bz2 volse-hubzilla-c8f686b8a553586a65e5bb4ceda5d1016d1c15be.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/include/text.php b/include/text.php index a3826de49..a2c0a3209 100644 --- a/include/text.php +++ b/include/text.php @@ -1895,32 +1895,15 @@ function cleardiv() { function bb_translate_video($s) { - - $matches = null; - $r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER); - if($r) { - foreach($matches as $mtch) { - if((stristr($mtch[1],'youtube')) || (stristr($mtch[1],'youtu.be'))) - $s = str_replace($mtch[0],'[youtube]' . $mtch[1] . '[/youtube]',$s); - elseif(stristr($mtch[1],'vimeo')) - $s = str_replace($mtch[0],'[vimeo]' . $mtch[1] . '[/vimeo]',$s); - } - } - return $s; + $arr = array('string' => $s); + call_hooks('bb_translate_video',$arr); + return $arr['string']; } function html2bb_video($s) { - - $s = preg_replace('#<object[^>]+>(.*?)https?://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)</object>#ism', - '[youtube]$2[/youtube]', $s); - - $s = preg_replace('#<iframe[^>](.*?)https?://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)</iframe>#ism', - '[youtube]$2[/youtube]', $s); - - $s = preg_replace('#<iframe[^>](.*?)https?://player.vimeo.com/video/([0-9]+)(.*?)</iframe>#ism', - '[vimeo]$2[/vimeo]', $s); - - return $s; + $arr = array('string' => $s); + call_hooks('html2bb_video',$arr); + return $arr['string']; } /** |