diff options
author | friendica <info@friendica.com> | 2014-07-16 17:39:40 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-07-16 17:39:40 -0700 |
commit | bd75b68a7c6c9235033e418bcfe2d0df2dd34e6c (patch) | |
tree | 0fc91ada449d10292bc03bce53c57810fa77d8dd /include/bb2diaspora.php | |
parent | f11856f839994c00eae2fdffe3f6f7b21dcf87a3 (diff) | |
download | volse-hubzilla-bd75b68a7c6c9235033e418bcfe2d0df2dd34e6c.tar.gz volse-hubzilla-bd75b68a7c6c9235033e418bcfe2d0df2dd34e6c.tar.bz2 volse-hubzilla-bd75b68a7c6c9235033e418bcfe2d0df2dd34e6c.zip |
shield share meta info from markdown processing.
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r-- | include/bb2diaspora.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 41001d216..f15a34e99 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -67,6 +67,17 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) { return $string; } +function share_shield($m) { + return str_replace($m[1],'!=+=+=!' . base64url_encode($m[1]) . '=+!=+!=',$m[0]); +} + +function share_unshield($m) { + $x = str_replace(array('!=+=+=!','=+!=+!='),array('',''),$m[1]); + return str_replace($m[1], base64url_decode($x), $m[0]); +} + + + // we don't want to support a bbcode specific markdown interpreter // and the markdown library we have is pretty good, but provides HTML output. // So we'll use that to convert to HTML, then convert the HTML back to bbcode, @@ -93,6 +104,8 @@ function diaspora2bb($s,$use_zrl = false) { // This seems to work $s = preg_replace('/\#([^\s\#])/','#$1',$s); + $s = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$s); + $s = Markdown($s); $s = str_replace('#','#',$s); @@ -123,6 +136,10 @@ function diaspora2bb($s,$use_zrl = false) { // remove duplicate adjacent code tags $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); + + $s = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$s); + + // Don't show link to full picture (until it is fixed) $s = scale_external_images($s, false); |