From: Hypolite Petovan Date: Thu, 29 Mar 2018 23:29:36 +0000 (-0400) Subject: Add fallback to regular code if language doesn't exist X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=80b6dc5787a6da176f1906132e8b520b5aa2db43;p=friendica.git Add fallback to regular code if language doesn't exist --- diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index d545492bb0..5b0aa2cff6 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1292,13 +1292,17 @@ class BBCode extends BaseObject private static function textHighlightCallback($match) { + // Fallback in case the language doesn't exist + $return = '[code]' . $match[2] . '[/code]'; + if (in_array(strtolower($match[1]), ['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby', 'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh', 'bash']) ) { - return text_highlight($match[2], strtolower($match[1])); + $return = text_highlight($match[2], strtolower($match[1])); } - return $match[0]; + + return $return; } /**