<span>{lang}wcf.acp.style.globals.useGoogleFont{/lang}</span>
</label></dd>
</dl>
- <dl id="wcfFontFamilyGoogleContainer">
+ <dl id="wcfFontFamilyGoogleContainer"{if $errorField == 'wcfFontFamilyGoogle'} class="formError"{/if}>
<dt><label for="wcfFontFamilyGoogle">{lang}wcf.acp.style.globals.fontFamilyGoogle{/lang}</label></dt>
<dd>
<input type="text" id="wcfFontFamilyGoogle" name="wcfFontFamilyGoogle" value="{$variables[wcfFontFamilyGoogle]}" class="medium">
+ <small>{lang}wcf.acp.style.globals.fontFamilyGoogle.description{/lang}</small>
+ {if $errorField == 'wcfFontFamilyGoogle'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.style.globals.fontFamilyGoogle.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
</dd>
</dl>
<dl>
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
use wcf\system\Regex;
+use wcf\system\style\exception\FontDownloadFailed;
+use wcf\system\style\FontManager;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
use wcf\util\DateUtil;
if (isset($_POST['scrollOffsets']) && is_array($_POST['scrollOffsets'])) $this->scrollOffsets = ArrayUtil::toIntegerArray($_POST['scrollOffsets']);
}
+ /**
+ * @since 5.3
+ */
+ protected function downloadGoogleFont() {
+ $fontManager = FontManager::getInstance();
+ $family = $this->variables['wcfFontFamilyGoogle'];
+ if ($family) {
+ if (!$fontManager->isFamilyDownloaded($family)) {
+ try {
+ $fontManager->downloadFamily($family);
+ }
+ catch (FontDownloadFailed $e) {
+ throw new UserInputException('wcfFontFamilyGoogle', 'downloadFailed'.($e->getReason() ? '.'.$e->getReason() : ''));
+ }
+ }
+ }
+ }
+
/**
* @inheritDoc
*/
}
$this->validateApiVersion();
+
+ $this->downloadGoogleFont();
}
/**
<item name="wcf.acp.style.globals.fontSizeTitle"><![CDATA[Schriftgröße (Seiten-Titel)]]></item>
<item name="wcf.acp.style.globals.useGoogleFont"><![CDATA[Google-Schriftart aktivieren]]></item>
<item name="wcf.acp.style.globals.fontFamilyGoogle"><![CDATA[Schriftart]]></item>
+ <item name="wcf.acp.style.globals.fontFamilyGoogle.description"><![CDATA[Die angegebene Schriftart wird beim Speichern des Stils heruntergeladen und anschließend den Benutzern anschließend ohne externe Verbindungen als Webfont zur Verfügung gestellt.]]></item>
+ <item name="wcf.acp.style.globals.fontFamilyGoogle.error.downloadFailed"><![CDATA[Der Download der Schriftart ist fehlgeschlagen.]]></item>
+ <item name="wcf.acp.style.globals.fontFamilyGoogle.error.downloadFailed.notFound"><![CDATA[Die angegebene Schriftart konnte nicht gefunden werden.]]></item>
<item name="wcf.acp.style.globals.fontFamilyFallback"><![CDATA[Schriftart (Fallback)]]></item>
<item name="wcf.acp.style.general.favicon"><![CDATA[Favicon]]></item>
<item name="wcf.acp.style.favicon"><![CDATA[Individuelles Favicon]]></item>
<item name="wcf.acp.style.globals.fontSizeTitle"><![CDATA[Font Size (Page Title)]]></item>
<item name="wcf.acp.style.globals.useGoogleFont"><![CDATA[Use Google font face]]></item>
<item name="wcf.acp.style.globals.fontFamilyGoogle"><![CDATA[Font Face]]></item>
+ <item name="wcf.acp.style.globals.fontFamilyGoogle.description"><![CDATA[The given font face will be downloaded when saving the style and afterwards will be delivered as a web font without connecting to external services.]]></item>
+ <item name="wcf.acp.style.globals.fontFamilyGoogle.error.downloadFailed"><![CDATA[Downloading the given font face failed.]]></item>
+ <item name="wcf.acp.style.globals.fontFamilyGoogle.error.downloadFailed.notFound"><![CDATA[The given font face could not be found.]]></item>
<item name="wcf.acp.style.globals.fontFamilyFallback"><![CDATA[Font Face (Fallback)]]></item>
<item name="wcf.acp.style.favicon"><![CDATA[Individual Favicon]]></item>
<item name="wcf.acp.style.favicon.description"><![CDATA[Upload an 256×256 pixels image, acceptable image types are JPG and PNG. The uploaded image will be used to derive all required favicon sizes.]]></item>