Convert [table] BBCode (vB 5)
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 25 Sep 2020 07:38:50 +0000 (09:38 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 7 Oct 2020 07:47:14 +0000 (09:47 +0200)
files/lib/system/exporter/VB5xExporter.class.php

index c4c45f0b2e3cab17ff99508b9ff9c9d34ba9e754..e1c37db9001d9646cb2f2e27cff55947e72e3588 100644 (file)
@@ -1125,6 +1125,7 @@ class VB5xExporter extends AbstractExporter {
                static $img2Callback = null;
                static $attachRegex = null;
                static $attachCallback = null;
+               static $tableRegex = null;
                
                if ($quoteRegex === null) {
                        $quoteRegex = new Regex('\[quote=(.*?);n(\d+)\]', Regex::CASE_INSENSITIVE);
@@ -1196,6 +1197,8 @@ class VB5xExporter extends AbstractExporter {
                                        return "";
                                }
                        };
+                       
+                       $tableRegex = new Regex('\[TABLE(?:="[a-z0-9_-]+:\s*[a-z0-9_-]+(?:,\s*[a-z0-9_-]+:\s*[a-z0-9_-]+)*")?\]', Regex::CASE_INSENSITIVE);
                }
                
                // use proper WCF 2 bbcode
@@ -1227,6 +1230,9 @@ class VB5xExporter extends AbstractExporter {
                // attach
                $message = $attachRegex->replace($message, $attachCallback);
                
+               // tables
+               $message = $tableRegex->replace($message, '[table]');
+               
                // fix size bbcodes
                $message = preg_replace_callback('/\[size=\'?(\d+)(px)?\'?\]/i', function ($matches) {
                        $unit = 'scalar';