metadata = $metadata;
}
public function render($bEcho = true) {
$str = "
";
if ($bEcho) {
echo $str;
} else {
return $str;
}
}
protected function renderHelper($metadata) {
foreach ($metadata as $key => $values) {
if ( !empty($values) ) {
// Build nested metadata tables recursively
$r .= "{$key} | ";
// Associative array means met contains subkeys
if (is_array($values) && self::is_assoc($values)) {
$r .= "";
$r .= "";
}
// Numeric array means met has multiple values
else if (is_array($values)) {
$r .= " | ";
$r .= "";
}
// Scalar value means met has one value
else {
$r .= " | ";
$r .= " {$values} ";
}
$r .= " |
";
}
}
return $r;
}
protected static function is_assoc($array) {
return (is_array($array) &&
(count($array)==0 ||
0 !== count(array_diff_key($array, array_keys(array_keys($array))) )));
}
}