function best_comment($ThisFileInfo, $tag, $default = '') { $cur = 0; $ret_string = $default; if (isset($ThisFileInfo['comments'][$tag])) { foreach ($ThisFileInfo['comments'][$tag] as $value) { $value = magic_decode($value); if (strlen($value) > $cur) { $ret_string = $value; $cur = strlen($value); } } } if (isset($ThisFileInfo['comments_html'][$tag])) { foreach ($ThisFileInfo['comments_html'][$tag] as $value) { $value = html2ASCII($value); if (strlen($value) > $cur) { $ret_string = $value; $cur = strlen($value); } } } return $ret_string; }
function magic_decode_r($arr, $strategy = -1, $max = 0.3, $utf = -1) { $new_arr = array(); foreach ($arr as $k => $v) { if (is_array($v)) { $v = magic_decode_r($v, $strategy, $max, $utf); } if (is_string($v)) { $v = magic_decode($v, $strategy, $max, $utf); } $new_arr[$k] = $v; } return $new_arr; }