Fixed Add "rich" to the default value of "allowedCodeLanguages"?

Steffen

Well-known member
Affected version
2.0.4
Then the intended phrase "Rich (BB code)" (code_language.rich) will be used for such code blocks instead of just "Code". :)

Rich (BB code):
Rich
code
 
I don't think that's the right approach as generally we have no intention of preventing its usage, but I have gone with another approach that works.
 
Thank you but to be honest I don't understand. Why would adding "rich" to the default value of "allowedCodeLanguages" "prevent its usage"? :)

Which approach have you taken?
 
Well, to put it another way, it would allow a user to remove it from the allowedCodeLanguages list where it would be the intention for that "language" to no longer be used, but "rich" is really a very special case, it's not a language itself and it would require extra code in order for it to be disabled if removed from the allowedCodeLanguages option value.

Which approach have you taken?
Diff:
Index: src/XF/BbCode/Renderer/Html.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/XF/BbCode/Renderer/Html.php    (date 1523458134000)
+++ src/XF/BbCode/Renderer/Html.php    (date 1523458487000)
@@ -431,6 +431,10 @@
         else
         {
             $config = [];
+            if ($language == 'rich')
+            {
+                $config['phrase'] = \XF::phrase('code_language.rich');
+            }
             $language = '';
         }
 
Back
Top Bottom