diff options
author | zottel <github@zottel.net> | 2016-08-10 13:49:48 +0200 |
---|---|---|
committer | zottel <github@zottel.net> | 2016-08-10 13:49:48 +0200 |
commit | 8706cbe1c413ed8fcfb7dcb35c7b319d2d1116bb (patch) | |
tree | 499ab4cac571c35f6d0758f157ed85af46c8b57c /include/text.php | |
parent | 6ba142fd33a74a7bdb4f3dfc8c0c0f507c293a2e (diff) | |
parent | 7a557d31e026705fc3bd2d4f39c4c679449cef56 (diff) | |
download | volse-hubzilla-8706cbe1c413ed8fcfb7dcb35c7b319d2d1116bb.tar.gz volse-hubzilla-8706cbe1c413ed8fcfb7dcb35c7b319d2d1116bb.tar.bz2 volse-hubzilla-8706cbe1c413ed8fcfb7dcb35c7b319d2d1116bb.zip |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php index d508f8ab3..ac210b336 100644 --- a/include/text.php +++ b/include/text.php @@ -1179,6 +1179,7 @@ function smilies($s, $sample = false) { $s = preg_replace_callback('{<(pre|code)>.*?</\1>}ism', 'smile_shield', $s); $s = preg_replace_callback('/<[a-z]+ .*?>/ism', 'smile_shield', $s); + $params = list_smilies(); $params['string'] = $s; @@ -1192,6 +1193,7 @@ function smilies($s, $sample = false) { $s = str_replace($params['texts'],$params['icons'],$params['string']); } + $s = preg_replace_callback('/<!--base64:(.*?)-->/ism', 'smile_unshield', $s); return $s; @@ -1204,11 +1206,11 @@ function smilies($s, $sample = false) { * @return string */ function smile_shield($m) { - return '<!--base64:' . base64url_encode($m[0]) . '-->'; + return '<!--base64:' . base64special_encode($m[0]) . '-->'; } function smile_unshield($m) { - return base64url_decode($m[1]); + return base64special_decode($m[1]); } /** @@ -1603,7 +1605,9 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) { $s = bbcode($text,false,true,$cache); else $s = smilies(bbcode($text,false,true,$cache)); + $s = zidify_links($s); + break; } @@ -1853,6 +1857,26 @@ function base64url_decode($s) { return base64_decode(strtr($s,'-_','+/')); } + +function base64special_encode($s, $strip_padding = true) { + + $s = strtr(base64_encode($s),'+/',',.'); + + if($strip_padding) + $s = str_replace('=','',$s); + + return $s; +} + +function base64special_decode($s) { + if(is_array($s)) { + logger('base64url_decode: illegal input: ' . print_r(debug_backtrace(), true)); + return $s; + } + return base64_decode(strtr($s,',.','+/')); +} + + /** * @ Return a div to clear floats. * @@ -2824,6 +2848,12 @@ function expand_acl($s) { return $ret; } +function acl2json($s) { + $s = expand_acl($s); + $s = json_encode($s); + return $s; +} + // When editing a webpage - a dropdown is needed to select a page layout // On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in |