From: Tim Düsterhus Date: Wed, 15 Jul 2020 09:38:07 +0000 (+0200) Subject: Download Google Fonts on style import X-Git-Tag: 5.3.0_Alpha_1~120^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=22299c832ff62cd52d0e969866917f8ed12123dd;p=GitHub%2FWoltLab%2FWCF.git Download Google Fonts on style import see #3394 --- diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index c3a4c1fb70..276d5fc7f7 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -21,6 +21,8 @@ use wcf\system\package\PackageArchive; use wcf\system\style\StyleCompiler; use wcf\system\style\StyleHandler; use wcf\system\Regex; +use wcf\system\style\exception\FontDownloadFailed; +use wcf\system\style\FontManager; use wcf\system\WCF; use wcf\util\DateUtil; use wcf\util\FileUtil; @@ -657,6 +659,16 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject } } + // download google fonts + $fontManager = FontManager::getInstance(); + $family = $style->getVariable('wcfFontFamilyGoogle'); + try { + $fontManager->downloadFamily($family); + } + catch (FontDownloadFailed $e) { + // ignore + } + $tar->close(); return $style;