200, $colconf['target'], filemtime($colconf['target'])
);
}
- print "<input";
- if (empty($colconf['target'])) print ' readonly';
- printf(' type="%s" name="%s" id="%2$s" value="%s"',
- @$colconf['type'] ?: 'text',
- $col,
- htmlspecialchars(@$colconf['value'])
- );
- if (@$colconf['type'] == 'file') {
- printf(' accept="%s"', 'image/jpeg');
+
+ {
+ $attrs = [
+ 'type' => @$colconf['type'] ?: 'text',
+ 'name' => $col,
+ 'id' => $col,
+ 'value' => htmlspecialchars(@$colconf['value']),
+ 'placeholder' => "Niet ingesteld",
+ 'readonly' => empty($colconf['target']),
+ ];
+ if (@$colconf['type'] == 'file') {
+ $attrs['accept'] = "image/jpeg";
+ }
+
+ print '<input';
+ foreach ($attrs as $attr => $attrval) {
+ if ($attrval === FALSE) {
+ continue;
+ }
+ print ' ' . $attr;
+ if ($attrval !== TRUE) {
+ printf('="%s"', $attrval);
+ }
+ }
+ print ' />';
}
- print ' placeholder="Niet ingesteld"';
- print " />";
if ($error = @$colwarn[$col]) {
print " <span class=warn>$error</span>\n";