Inject proper getFont() version depending on isMultiDomainSetup()
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 28 Jul 2020 12:18:10 +0000 (14:18 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 28 Jul 2020 12:18:10 +0000 (14:18 +0200)
wcfsetup/install/files/lib/system/style/StyleCompiler.class.php

index 5f52db634bf5020ff850813960db6bcc804c053f..499cefcf3443b3fb8f469d731233c7be131a2530 100644 (file)
@@ -274,24 +274,27 @@ class StyleCompiler extends SingletonFactory {
                        $content .= $this->prepareFile($mixin);
                }
                
-               // getFont helper
-               $content .= <<<'EOT'
-@function getFont($filename, $family: "/", $version: "") {
-       @if (1 == 1) {
-               @if ($family != "") {
-                       $family: "families/" + $family + "/";
-               }
-               @if ($version != "") {
-                       $version: "?v=" + $version;
+               if (ApplicationHandler::getInstance()->isMultiDomainSetup()) {
+                       $content .= <<<'EOT'
+                               @function getFont($filename, $family: "/", $version: "") {
+                                       @return "../font/getFont.php?family=" + $family + "&filename=" + $filename + "&v=" + $version;
+                               }
+EOT;
                }
-               
-               @return "../font/" + $family + $filename + $version;
-       }
-       @else {
-               @return "../font/getFont.php?family=" + $family + "&filename=" + $filename + "&v=" + $version;
-       }
-}
+               else {
+                       $content .= <<<'EOT'
+                               @function getFont($filename, $family: "/", $version: "") {
+                                       @if ($family != "") {
+                                               $family: "families/" + $family + "/";
+                                       }
+                                       @if ($version != "") {
+                                               $version: "?v=" + $version;
+                                       }
+                                       
+                                       @return "../font/" + $family + $filename + $version;
+                               }
 EOT;
+               }
                
                // add google fonts
                if (!empty($variables['wcfFontFamilyGoogle']) && PACKAGE_ID) {