From: Tim Düsterhus Date: Wed, 3 Feb 2021 13:24:20 +0000 (+0100) Subject: Add StyleCompiler::writeCss() X-Git-Tag: 5.4.0_Alpha_1~316^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f06535bc47191e0df1c998ae602c6306b3e4c2d5;p=GitHub%2FWoltLab%2FWCF.git Add StyleCompiler::writeCss() --- diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 8c42a51c97..7c4ee85a80 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -552,15 +552,7 @@ EOT; $content = $callback($content); - // write stylesheet - \file_put_contents($filename . '.css', $content); - FileUtil::makeWritable($filename . '.css'); - - $content = $this->convertToRtl($content); - - // write stylesheet for RTL - \file_put_contents($filename . '-rtl.css', $content); - FileUtil::makeWritable($filename . '-rtl.css'); + $this->writeCss($filename, $content); } /** @@ -585,6 +577,18 @@ EOT; return $css; } + /** + * Writes the given css into the file with the given prefix. + */ + private function writeCss(string $filePrefix, string $css): void + { + \file_put_contents($filePrefix . '.css', $css); + FileUtil::makeWritable($filePrefix . '.css'); + + \file_put_contents($filePrefix . '-rtl.css', $this->convertToRtl($css)); + FileUtil::makeWritable($filePrefix . '-rtl.css'); + } + /** * Returns the name of the CSS file for a specific style. *