From 59aae20aea6b5b74b40297d2d9d7841274fb4b84 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 1 Dec 2016 19:04:29 -0800 Subject: 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. --- include/bbcode.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') 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) { -- cgit v1.2.3