$current_q) {
$current_lang = strtolower (join ('-', $lang_code));
$current_q = $lang_quality;
break;
}
}
if ($strict_mode) {
break;
}
array_pop ($lang_code);
}
}
return $current_lang;
}
function print_tree_rec($tree, $level) {
$output = '
' . "\n";
foreach ($tree as $node) {
$output .= '- ' . $node['value'] . '';
if ($node['children']) {
$output .= "\n" . print_tree_rec($node['children'], $level+1);
}
$output .= "
\n";
}
$output .= "
\n";
return $output;
}
function print_tree($params, &$smarty) {
if (empty($params['level'])) {
$level = 0;
} else {
$level = $params['level'];
}
if (empty($params['tree'])) {
return '';
} else {
return print_tree_rec($params['tree'], $level);
}
}
?>