Jake Vanderwerf
2026-04-15 c4aa5cdb5e90ad4b420e22772797d16980232a2b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace JVBase\registrar\fields;
 
 
if (!defined('ABSPATH')) {
    exit;
}
 
class UploadField extends Field {
    protected bool $multiple = false;
    protected string $subtype;
 
    protected int $maxUploads;
 
    public function setMultiple(bool $set):void
    {
        $this->multiple = $set;
    }
    public function getMultiple():bool
    {
        return $this->multiple;
    }
 
    public function setMaxUploads(int $maxUploads):void
    {
        $max = 20;
        $this->maxUploads = min($maxUploads, $max);
    }
    public function getMaxUploads():int
    {
        return $this->maxUploads;
    }
 
    public function setSubtype(string $subtype):void
    {
        $allowed = ['document', 'video', 'image', 'all'];
        if (!in_array($subtype, $allowed)) {
            error_log('Invalid subtype for '.$this->name.' image field: '.$subtype);
            return;
        }
        $this->subtype = $subtype;
    }
    public function getSubtype():string
    {
        return $this->subtype;
    }
}