Add fallback to regular code if language doesn't exist
This commit is contained in:
parent
586b0b6e57
commit
80b6dc5787
|
@ -1292,13 +1292,17 @@ class BBCode extends BaseObject
|
||||||
|
|
||||||
private static function textHighlightCallback($match)
|
private static function textHighlightCallback($match)
|
||||||
{
|
{
|
||||||
|
// Fallback in case the language doesn't exist
|
||||||
|
$return = '[code]' . $match[2] . '[/code]';
|
||||||
|
|
||||||
if (in_array(strtolower($match[1]),
|
if (in_array(strtolower($match[1]),
|
||||||
['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby',
|
['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby',
|
||||||
'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh', 'bash'])
|
'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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user