From: Tim Düsterhus Date: Thu, 6 Feb 2020 12:12:53 +0000 (+0100) Subject: Add support for rgb() colors (XF 2) X-Git-Tag: 5.2.4~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=972ab1179accddcbed5326ba8125e0ca69548060;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.exporter.git Add support for rgb() colors (XF 2) --- diff --git a/files/lib/system/exporter/XF2xExporter.class.php b/files/lib/system/exporter/XF2xExporter.class.php index 327a590..3164cc0 100644 --- a/files/lib/system/exporter/XF2xExporter.class.php +++ b/files/lib/system/exporter/XF2xExporter.class.php @@ -1723,6 +1723,13 @@ class XF2xExporter extends AbstractExporter { $message = $userRegex->replace($message, $userCallback); $message = $quoteRegex->replace($message, $quoteCallback); + // fix color bbcodes + $message = preg_replace_callback('/\[color=rgb\((\d+),\s*(\d+),\s*(\d+)\)\]/i', function ($matches) { + list(, $r, $g, $b) = $matches; + + return sprintf('[color=#%02X%02X%02X]', $r, $g, $b); + }, $message); + // fix size bbcodes $message = preg_replace_callback('/\[size=\'?(\d+)(px)?\'?\]/i', function ($matches) { $unit = 'scalar';