aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-12-01 19:04:29 -0800
committerzotlabs <mike@macgirvin.com>2016-12-01 19:04:29 -0800
commit59aae20aea6b5b74b40297d2d9d7841274fb4b84 (patch)
tree9b379c999b02c50ca5b26f8b080af6c6480f5793
parent97f9dedaa6d2e4b2b4492bf42f53f516b275e2c7 (diff)
downloadvolse-hubzilla-59aae20aea6b5b74b40297d2d9d7841274fb4b84.tar.gz
volse-hubzilla-59aae20aea6b5b74b40297d2d9d7841274fb4b84.tar.bz2
volse-hubzilla-59aae20aea6b5b74b40297d2d9d7841274fb4b84.zip
bb_highlight: if somebody enters an unsupported language for code syntax highlighting (like fortran or cobol or whatever) use 'php' instead of returning a completely unformatted code block. This choice was somewhat arbitrary. It could be difficult to analyse the intention which could be literally anything and provide the closest match.
-rw-r--r--include/bbcode.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 8ee1f0da1..6794fca96 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -512,10 +512,10 @@ function bb_code($match) {
}
function bb_highlight($match) {
- if(in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby',
+ $lang = ((in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby',
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','json','sh']))
- return text_highlight($match[2],strtolower($match[1]));
- return $match[0];
+ ? strtolower($match[1]) : 'php' );
+ return text_highlight($match[2],$lang);
}
function bb_fixtable_lf($match) {