$val) {
$attr = strtolower($attr);
if ($val === TRUE) {
$attributes[] = $attr;
} elseif (!empty($val)) {
//allow multi-value attributes to be passed as array
if (is_array($val)) {
sort($val); //gzip?
$val = implode(' ', $val);
}
$val = htmlspecialchars($val, $quote_style, $charset, $double_encode);
$attributes[] = "$attr=\"$val\"";
}
}
sort($attributes); //gzip?
return implode(' ', $attributes);
}
// remove all the junk that elgg_view throws into $vars
function html5_clean_vars(array $vars = array()) {
unset($vars['config']);
unset($vars['url']);
unset($vars['page_owner']);
unset($vars['page_owner_user']);
foreach ($_SESSION as $key => $value) {
unset($vars[$key]);
}
// backwards compatibility code
if (isset($vars['internalname'])) {
$vars['name'] = $vars['internalname'];
unset($vars['internalname']);
}
if (isset($vars['internalid'])) {
$vars['id'] = $vars['internalid'];
unset($vars['internalid']);
}
return $vars;
}
register_elgg_event_handler('init', 'system', 'html5_init');