function _image_captcha_check_fonts in CAPTCHA 8
Same name and namespace in other branches
- 6.2 image_captcha/image_captcha.module \_image_captcha_check_fonts()
- 7 image_captcha/image_captcha.module \_image_captcha_check_fonts()
Helper function for checking if the specified fonts are available.
Parameters
array $fonts: Paths of fonts to check.
Return value
array List($readable_fonts, $problem_fonts).
2 calls to _image_captcha_check_fonts()
- ImageCaptchaSettingsForm::validateForm in image_captcha/
src/ Form/ ImageCaptchaSettingsForm.php - Form validation handler.
- _image_captcha_check_setup in image_captcha/
image_captcha.module - Helper function for checking the setup of the Image CAPTCHA.
File
- image_captcha/
image_captcha.module, line 115 - Implements image CAPTCHA for use with the CAPTCHA module.
Code
function _image_captcha_check_fonts(array $fonts) {
$readable_fonts = [];
$problem_fonts = [];
foreach ($fonts as $font) {
if ($font != 'BUILTIN' && (!is_file($font) || !is_readable($font))) {
$problem_fonts[] = $font;
}
else {
$readable_fonts[] = $font;
}
}
return [
$readable_fonts,
$problem_fonts,
];
}