['alt' => true, 'class' => true, 'src' => true, 'style' => true]];
/** The logo ahead of a screen's heading, or nothing. */
public static function logoTag(): string
{
$logo = self::logo();
return $logo === '' ? '' : '
';
}
/** "%s Assistant", "%s Inbox": the product's screens under the brand's name. */
public static function screen(string $screen): string
{
return self::name() . ' ' . $screen;
}
/**
* Stores what Sarcio handed over, or clears the label when every field is
* null. Ignored when the fields are not there at all (an older server).
*
* @param array|null $branding
*/
public static function store(?array $branding): void
{
if ($branding === null) {
return;
}
Options::update([
'brand_color' => is_string($branding['color'] ?? null) ? (string) sanitize_hex_color($branding['color']) : '',
'brand_logo' => is_string($branding['logoUrl'] ?? null) ? esc_url_raw($branding['logoUrl'], ['https']) : '',
'brand_name' => is_string($branding['name'] ?? null) ? mb_substr(sanitize_text_field($branding['name']), 0, 80) : '',
]);
}
}