> */ public static function definitions(): array { return [ \ProCalendarWP\Maps\Location::KEY => \ProCalendarWP\Maps\Location::definition(), '_pcwp_schedule' => ['type' => 'object', 'default' => ['type' => 'continuous'], 'show_in_rest' => ['schema' => DailySchedule::schema()], 'sanitize_callback' => static fn (mixed $value): mixed => $value], '_pcwp_start' => ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field'], '_pcwp_end' => ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field'], '_pcwp_timezone' => ['type' => 'string', 'sanitize_callback' => [self::class, 'sanitizeTimezone']], '_pcwp_all_day' => ['type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean'], '_pcwp_status' => ['type' => 'string', 'sanitize_callback' => [self::class, 'sanitizeStatus']], '_pcwp_mode' => ['type' => 'string', 'sanitize_callback' => [self::class, 'sanitizeMode']], '_pcwp_featured' => ['type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean'], '_pcwp_cost' => ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field'], '_pcwp_currency' => ['type' => 'string', 'sanitize_callback' => [self::class, 'sanitizeCurrency']], '_pcwp_website' => ['type' => 'string', 'format' => 'uri', 'sanitize_callback' => 'esc_url_raw'], '_pcwp_virtual_url' => ['type' => 'string', 'format' => 'uri', 'sanitize_callback' => 'esc_url_raw'], '_pcwp_show_map' => ['type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean'], '_pcwp_latitude' => ['type' => 'number', 'sanitize_callback' => [self::class, 'sanitizeLatitude']], '_pcwp_longitude' => ['type' => 'number', 'sanitize_callback' => [self::class, 'sanitizeLongitude']], '_pcwp_series_id' => ['type' => 'integer', 'sanitize_callback' => 'absint'], '_pcwp_series_sequence' => ['type' => 'integer', 'sanitize_callback' => 'absint'], '_pcwp_series_overrides' => ['type' => 'array', 'sanitize_callback' => [self::class, 'sanitizeOverrides']], '_pcwp_recurrence_id' => ['type' => 'string', 'show_in_rest' => false, 'sanitize_callback' => 'sanitize_text_field'], '_pcwp_previous_start' => ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field'], '_pcwp_rsvp_enabled' => ['type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean'], '_pcwp_rsvp_capacity' => ['type' => 'integer', 'show_in_rest' => ['schema' => ['type' => 'integer', 'minimum' => 0, 'maximum' => 1000000]], 'sanitize_callback' => static fn (mixed $value): int => max(0, min(1000000, (int) $value))], ]; } public static function sanitizeTimezone(mixed $value): string { $value = sanitize_text_field((string) $value); return in_array($value, timezone_identifiers_list(), true) || preg_match('/^[+-](?:0\d|1[0-4]):[0-5]\d$/D', $value) ? $value : wp_timezone_string(); } public static function sanitizeStatus(mixed $value): string { $value = sanitize_key((string) $value); return in_array($value, ['scheduled', 'canceled', 'postponed', 'rescheduled', 'moved-online'], true) ? $value : 'scheduled'; } public static function sanitizeStatusFilter(mixed $value): string { $value = sanitize_key((string) $value); return in_array($value, ['scheduled', 'canceled', 'postponed', 'rescheduled', 'moved-online'], true) ? $value : ''; } public static function sanitizeMode(mixed $value): string { $value = sanitize_key((string) $value); return in_array($value, ['in-person', 'online', 'hybrid'], true) ? $value : 'in-person'; } public static function sanitizeModeFilter(mixed $value): string { $value = sanitize_key((string) $value); return in_array($value, ['in-person', 'online', 'hybrid'], true) ? $value : ''; } /** @return list */ public static function sanitizeOverrides(mixed $value): array { if (! is_array($value)) { return []; } return array_values(array_unique(array_filter(array_map('sanitize_key', $value)))); } public static function sanitizeCurrency(mixed $value): string { $value = strtoupper(sanitize_text_field((string) $value)); return preg_match('/^[A-Z]{3}$/', $value) ? $value : ''; } public static function sanitizeLatitude(mixed $value): float { return max(-90.0, min(90.0, (float) $value)); } public static function sanitizeLongitude(mixed $value): float { return max(-180.0, min(180.0, (float) $value)); } }