46 $value = ($value===
false) ?
'0' : $value;
47 $value = ($value===
true) ?
'1' : $value;
48 $this->attributes[htmlspecialchars(
$name, ENT_QUOTES)] = $value;
60 unset($this->attributes[htmlspecialchars(
$name, ENT_QUOTES)]);
72 if (!empty($values)) {
73 foreach ($values as
$name => $value) {
90 if (isset($this->attributes[
$name])) {
91 $value = $this->attributes[
$name];
106 return array_key_exists(
$name, $this->attributes);
119 if (is_scalar($value)) {
120 $value = explode(
' ', (
string) $value);
124 $this->attributes[
$name] = array();
126 foreach ($value as $v) {
127 if (!in_array($v, $this->attributes[
$name])) {
128 $this->attributes[
$name][] = $v;
141 foreach ($this->attributes as
$name => $value) {
144 && substr($value, -2) !=
'[]'
148 if (is_array($value)) {
150 $set =
'="' . htmlspecialchars(implode(
' ', $value), ENT_QUOTES) .
'"';
151 } elseif ($value===null) {
155 $set =
'="' . htmlspecialchars($value, ENT_QUOTES) .
'"';
157 $rendered .=
$name . $set .
' ';
setAttribute($name, $value=null)
addAttribute($name, $value)