Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
declare(strict_types=1);
use ParagonIE\Ionizer\Filter\{
BoolFilter,
FloatFilter,
IntFilter,
StringFilter
};
use ParagonIE\Ionizer\GeneralFilterContainer;
$colorCallback = function ($input): int {
if ($input < 0 || $input > 255) {
throw new \TypeError();
}
return (int) $input;
};
$alphaCallback = function ($input): float {
if ($input < 0.0 || $input > 1.0) {
throw new \TypeError();
}
return (float) $input;
};
/**
* @return $motifInputFilter
*/
$motifInputFilter = (new GeneralFilterContainer())
->addFilter(
'motif_config.bridge.gradient',
new BoolFilter()
)
->addFilter(
'motif_config.hull.background.enabled',
new BoolFilter()
)
->addFilter(
'motif_config.hull.background.tile',
new BoolFilter()
)
->addFilter(
'motif_config.hull.background.image',
new StringFilter()
)
->addFilter(
'motif_config.hull.background.shade.red',
(new IntFilter())
->addCallback($colorCallback)
)
->addFilter(
'motif_config.hull.background.shade.green',
(new IntFilter())
->addCallback($colorCallback)
)
->addFilter(
'motif_config.hull.background.shade.blue',
(new IntFilter())
->addCallback($colorCallback)
)
->addFilter(
'motif_config.hull.background.shade.alpha',
(new FloatFilter())
->addCallback($alphaCallback)
)
->addFilter(
'motif_config.hull.footer.override',
new BoolFilter()
)
->addFilter(
'motif_config.hull.footer.html',
new StringFilter()
)
->addFilter(
'motif_config.hull.blog-header.enabled',
new BoolFilter()
)
->addFilter(
'motif_config.hull.blog-header.background-image',
new StringFilter()
)
->addFilter(
'motif_config.hull.blog-header.font.red',
(new IntFilter())
->addCallback($colorCallback)
)
->addFilter(
'motif_config.hull.blog-header.font.green',
(new IntFilter())
->addCallback($colorCallback)
)
->addFilter(
'motif_config.hull.blog-header.font.blue',
(new IntFilter())
->addCallback($colorCallback)
)
->addFilter(
'motif_config.hull.blog-header.color',
(new StringFilter())
->addCallback(
function ($input) {
if (!\preg_match('/^[0-9A-Fa-f]{3,6}$/', $input)) {
return null;
}
return $input;
}
)
->setDefault('181818')
)
;