22 lines
593 B
PHP
22 lines
593 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
defined('ABSPATH') || exit;
|
|
|
|
/**
|
|
* Shared sanitization helpers. All options/banners/QA go through these.
|
|
*/
|
|
|
|
function xshop_sanitize_url(?string $value): string {
|
|
$value = trim((string) $value);
|
|
return $value === '' ? '' : esc_url_raw($value);
|
|
}
|
|
|
|
function xshop_sanitize_banner_position(string $value): string {
|
|
$allowed = ['home_hero','home_strip','shop_top','product_sidebar','footer_top'];
|
|
return in_array($value, $allowed, true) ? $value : 'home_hero';
|
|
}
|
|
|
|
function xshop_sanitize_checkbox($value): string {
|
|
return $value ? '1' : '0';
|
|
}
|