]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4713 from MrPetovan/bug/suppress-profile-message-follow
authorMichael Vogel <icarus@dabo.de>
Fri, 30 Mar 2018 05:39:00 +0000 (07:39 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Mar 2018 05:39:00 +0000 (07:39 +0200)
Suppress confusing error message in mod/follow

include/text.php
src/Content/Text/BBCode.php

index 67ce7e65e83df258ae041296b951478453066ca6..311422c5751d9af55f2399298a1b4543f94e0c50 100644 (file)
@@ -2030,6 +2030,10 @@ function text_highlight($s, $lang) {
                $lang = 'javascript';
        }
 
+       if ($lang === 'bash') {
+               $lang = 'sh';
+       }
+
        // @TODO: Replace Text_Highlighter_Renderer_Html by scrivo/highlight.php
 
        // Autoload the library to make constants available
index 7d1c429765337e48d374f07c223eff9c18e7d0ed..5b0aa2cff60d196a169dbd71acce2e9334f8f300 100644 (file)
@@ -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'])
+                               '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;
        }
 
        /**