27 protected $testFunc =
'';
31 $func = $this->testFunc;
32 if (!tests::$func($this->value)) {
46 protected $trim = TRUE;
47 protected $testFunc =
'is_email';
48 protected $inputType =
'email';
56 protected $testFunc =
'is_valid_hostname';
64 protected $testFunc =
'is_uid';
72 protected $trim = TRUE;
74 protected $testFunc =
'is_path';
82 protected $trim = TRUE;
83 protected $testFunc =
'is_url';
84 protected $inputType =
'url';
92 protected $trim = TRUE;
94 protected $testFunc =
'is_ip';
102 protected $trim = TRUE;
104 protected $testFunc =
'is_ipv4';
112 protected $trim = TRUE;
114 protected $testFunc =
'is_ipv6';
122 protected $trim = TRUE;
124 function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue =
'', $acl =
'')
126 parent::__construct($label, $description, $ldapName, $required, $defaultValue, $acl,
'/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/',
'5E:FF:56:A2:AF:15');
129 function setValue ($value)
131 return parent::setValue(strtolower($value));
142 function __construct ($description, $ldapName, $attributes, $sep, $acl =
"", $label =
"Composite attribute")
144 parent::__construct($description, $ldapName, $attributes,
'',
'', $acl, $label);
148 function readValues (
string $value): array
150 return explode($this->sep, $value);
153 function writeValues (array $values)
155 return join($this->sep, $values);
164 function __construct ($description, $ldapName, $attributes, $acl =
"", $label =
"Composite attribute")
166 parent::__construct($description, $ldapName, $attributes,
'|', $acl, $label);
177 function __construct ($ldapName, $attribute, $sep =
',')
180 $attribute->getDescription(), $ldapName,
188 function readValues (
string $value): array
193 return [explode($this->sep, $value)];
197 function writeValues (array $values)
199 return join($this->sep, $values[0]);
209 function __construct ($label, $description, $ldapName, $required, $units, $min = FALSE, $max = FALSE, $defaultValue =
"", $acl =
"")
211 parent::__construct($description, $ldapName,
213 new IntAttribute(
'',
'', $ldapName.
'_int', $required, $min, $max, $defaultValue),
214 new SelectAttribute(
'',
'', $ldapName.
'_select', TRUE, array_keys($units),
'', array_values($units)),
218 $this->setLinearRendering(TRUE);
219 $this->setRequired($required);
222 function readValues (
string $value): array
224 $choices = $this->attributes[1]->getChoices();
226 if (($value ===
'') || ($value == 0)) {
227 return [$value, $choices[0]];
231 $i = (count($choices) - 1);
232 ($value % $choices[$i] != 0) && ($i > 0);
235 return [$value / $choices[$i], $choices[$i]];
238 function writeValues (array $values)
240 if ($values[0] ===
'') {
243 return $values[0] * $values[1];
246 function displayValue ($value):
string 248 $values = $this->readValues($value);
249 return $values[0].$this->attributes[1]->displayValue($values[1]);
258 function __construct ($label, $description, $ldapName, $required, $min = FALSE, $max = FALSE, $defaultValue =
"", $acl =
"")
262 1024 ** 1 => _(
'KiB'),
263 1024 ** 2 => _(
'MiB'),
264 1024 ** 3 => _(
'GiB'),
265 1024 ** 4 => _(
'TiB'),
267 parent::__construct($label, $description, $ldapName, $required, $units, $min, $max, $defaultValue, $acl);
276 function __construct ($label, $description, $ldapName, $required, $min = FALSE, $max = FALSE, $defaultValue =
"", $acl =
"")
284 parent::__construct($label, $description, $ldapName, $required, $units, $min, $max, $defaultValue, $acl);
This class allow to handle easily a Select LDAP attribute with a set of choices.
Attribute storing its values as a comma-separated list.
CompositeAttribute of which values are joined using a character as separator.
This class allow to handle easily a String LDAP attribute that contains an uid.
This class allow to handle easily a String LDAP attribute that contains a path.
This class allow to handle easily a composite attribute.
This class allow to handle easily a String LDAP attribute that needs to be validated by a test from c...
This class allow to handle easily a String LDAP attribute that contains a mac address.
This class allow to handle easily a String LDAP attribute that contains a host name.
Attribute storing a time duration as seconds.
This class allow to handle easily a String LDAP attribute that contains an IP (v4 or v6) ...
static invalidValue(string $error)
Format error message for invalid value.
Attribute for storing a size in bytes.
Error returned by check method of SimplePlugin.
CharSeparatedCompositeAttribute where the separator is the pipe character.
This class allow to handle easily a String LDAP attribute that contains a IPv6.
Generic attribute for storing an integer allowing to chose between units.
This class allow to handle easily a String LDAP attribute that contains an IPv4.
This class allow to handle easily an Integer LDAP attribute.
This class allow to handle easily a String LDAP attribute that contains an URL.
__construct($label, $description, $ldapName, $required=FALSE, $defaultValue="", $acl="", $regexp="", $example=NULL)
The constructor of StringAttribute.
This class allow to handle easily a String LDAP attribute that contains a mail address.
This class allow to handle easily a String LDAP attribute.