diff options
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php index e894c5ce5..c4f253a27 100644 --- a/include/text.php +++ b/include/text.php @@ -3251,17 +3251,17 @@ function cleanup_bbcode($body) { * First protect any url inside certain bbcode tags so we don't double link it. */ - $body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body); - $body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\ +\,\(\)]+)/ismu", '\nakedoembed', $body); + $body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\ +\,\(\)]+)/ismu", '\red_zrl_callback', $body); + $body = preg_replace_callback('/\[\$b64zrl(.*?)\[\/(zrl)\]/ism','\red_unescape_codeblock',$body); $body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','\red_unescape_codeblock',$body); $body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','\red_unescape_codeblock',$body); @@ -3412,3 +3412,41 @@ function get_forum_channels($uid) { return $r; } + +function print_array($arr, $level = 0) { + + $o = EMPTY_STR; + $tabs = EMPTY_STR; + + if(is_array($arr)) { + for($x = 0; $x <= $level; $x ++) { + $tabs .= "\t"; + } + $o .= '[' . "\n"; + if(count($arr)) { + foreach($arr as $k => $v) { + if(is_array($v)) { + $o .= $tabs . '[' . $k . '] => ' . print_array($v, $level + 1) . "\n"; + } + else { + $o .= $tabs . '[' . $k . '] => ' . print_val($v) . ",\n"; + } + } + } + $o .= substr($tabs,0,-1) . ']' . (($level) ? ',' : ';' ). "\n"; + return $o; + } + +} + +function print_val($v) { + if(is_bool($v)) { + if($v) return 'true'; + return 'false'; + } + if(is_string($v)) { + return "'" . $v . "'"; + } + return $v; + +} |