Jake Vanderwerf
2026-03-08 c19264ac916707096fe294d996a1b7fb85206b34
inc/meta/Sanitizer.php
@@ -31,11 +31,9 @@
           MetaTypeManager::getSanitizeCallback($field_config['type']);
    }
    protected static function sanitizeTaxonomy(array|string $values, array $field_config):string
    protected static function sanitizeTaxonomy(string $values, array $field_config):string
    {
        if (!is_array($values)) {
            $values = explode(',', $values);
        }
      $values = array_map('absint', explode(',', $values));
        // Ensure taxonomy starts with BASE
        $taxonomy = (str_starts_with($field_config['taxonomy'], BASE))
@@ -47,17 +45,21 @@
        return implode(',', $values);
    }
    protected static function sanitizeUser(array|string $values, array $field_config):string
    protected static function sanitizeUser(string $values, array $field_config):string
    {
        if (!is_array($values)) {
            $values = explode(',', $values);
        }
      $values = array_map('absint', explode(',', $values));
        $values = array_filter($values, fn($value) => (bool)get_userdata((int)$value));
        return implode(',', $values);
    }
   protected static function sanitizePost(string $values, array $config):string
   {
      $values = array_map('absint', explode(',', $values));
      return implode(',', array_filter($values, fn($value) => (bool)get_post((int)$value)));
   }
   protected static function sanitizeTagList(array $values, array $field_config): array
   {
      if (empty(array_filter($values, fn($value) => !empty($value)))) {
@@ -171,6 +173,18 @@
      return $sanitized;
   }
   protected static function sanitizeSelector(string $value, array $config):string
   {
      if (array_key_exists('type', $config)) {
         return match ($config['type']) {
            'user' => self::sanitizeUser($value, $config),
            'taxonomy'=> self::sanitizeTaxonomy($value, $config),
            'post'   => self::sanitizePost($value, $config),
         };
      }
      return implode(',',array_map('absint', explode(',',$value)));
   }
    protected static function sanitizeUpload(array|string $value):string
    {
        if (empty($value)) {