function normalize_element(&$source, $from, &$dest, $to, $via = NULL)
{
if (isset($source[$from]) or isset($source["{$from}#"])) {
if (isset($source["{$from}#"])) {
$n = $source["{$from}#"];
$dest["{$to}#"] = $source["{$from}#"];
} else {
$n = 1;
}
for ($i = 1; $i <= $n; $i++) {
if (isset($via) and is_callable(array($this, $via))) {
// custom callback for ninja attacks
$this->{$via}($source, $from, $dest, $to, $i);
} else {
// just make it the same
$from_id = $this->element_id($from, $i);
$to_id = $this->element_id($to, $i);
if (isset($source[$from_id])) {
// Avoid PHP notice nastygrams
$dest[$to_id] = $source[$from_id];
}
}
}
}
}