foreach($mixed as $key => $value) { if (in_array($key, $this->option_flags)) { if (is_bool($value)) { $_indexed_attr[$key] = $value; } elseif (is_string(value) && in_array(trim($value, '\'"'), array('true', 'false'))) { if (trim($value) == 'true') { $_indexed_attr[$key] = true; } else { $_indexed_attr[$key] = false; } } elseif (is_numeric($value) && in_array($value, array(0, 1))) { if ($value == 1) { $_indexed_attr[$key] = true; } else { $_indexed_attr[$key] = false; } } else { $compiler->trigger_template_error("illegal value of option flag \"{$key}\"", null, true); } // must be named attribute } else { reset($mixed); $_indexed_attr[key($mixed)] = $mixed[key($mixed)]; } }