{$percent}
EOS;
}
function dir_head()
{
global $cycle;
$cycle = new Cycle('class="col1"', 'class="col2"');
$l_dir = _T("Directory");
$l_per = _T("Percent");
$l_hit = _T("Hits");
$l_lns = _T("Lines");
$l_tds = _T("TODO");
return <<
{$l_dir} | {$l_per} | {$l_hit} | {$l_lns} | {$l_tds} |
EOS;
}
function dir_row($info, $srcdir)
{
global $cycle;
if ($info['files'] || $info['todos']) {
$srcdir .= DIRECTORY_SEPARATOR;
$c = $cycle->next();
$srcdir_html = htmlspecialchars($srcdir);
$todos = number_format($info['todos']);
if ($info['total']) {
$srcdir_url = urlencode($srcdir);
$hits = number_format($info['hits']);
$total = number_format($info['total']);
calc_percent($info, $percent, $class);
$bar = bar($percent, $class);
return <<
{$srcdir_html} |
$bar |
{$hits} |
{$total} |
{$todos} |
EOS;
}
else {
return <<
{$srcdir_html} |
|
|
|
{$todos} |
EOS;
}
}
}
function dir_foot()
{
return <<
EOS;
}
function file_head()
{
global $cycle;
$cycle = new Cycle('class="col1"', 'class="col2"');
$l_fil = _T("File");
$l_per = _T("Percent");
$l_hit = _T("Hits");
$l_lns = _T("Lines");
return <<
{$l_fil} | {$l_per} | {$l_hit} | {$l_lns} |
EOS;
}
function file_row($info, $srcfile)
{
global $cycle;
$c = $cycle->next();
$srcfile_html = htmlspecialchars($srcfile);
$total = number_format($info['total']);
if ($info['total']) {
$hits = number_format($info['hits']);
$srcfile_url = urlencode($srcfile);
calc_percent($info, $percent, $class);
$bar = bar($percent, $class);
return <<
{$srcfile_html} |
$bar |
{$hits} |
{$total} |
EOS;
}
else {
return <<
{$srcfile_html} |
|
|
{$total} |
EOS;
}
}
function file_foot()
{
return <<
EOS;
}
$l_root = _T("root");
if ($action == 'dir') {
if (function_exists('ob_filter_path_nicer')) {
ob_start('ob_filter_path_nicer');
}
$path_html = htmlspecialchars($path);
echo <<
$l_root $path
EOS;
echo dir_head($dirinfo);
echo dir_row($dirinfo, $path);
echo dir_foot($dirinfo);
if ($dirinfo['subdirs']) {
echo dir_head();
foreach ($dirinfo['subdirs'] as $srcdir => $info) {
echo dir_row($info, $srcdir);
}
echo dir_foot();
}
if ($dirinfo['files']) {
echo file_head();
foreach ($dirinfo['files'] as $srcfile => $info) {
echo file_row($info, $srcfile);
}
echo file_foot();
}
}
else if ($action == 'file') {
if (function_exists('ob_filter_path_nicer')) {
ob_start('ob_filter_path_nicer');
}
$dir_url = urlencode($dir);
$dir_html = htmlspecialchars($dir);
echo <<
$l_root {$dir_html}/{$filename}
EOS;
echo file_head();
echo file_row($fileinfo, $path);
echo file_foot();
if ($tplfile) {
$tplfile_html = htmlspecialchars($tplfile);
echo <<
{$tplfile_html}
EOS;
}
if (function_exists('ob_filter_path_nicer')) {
ob_end_flush();
}
echo <<
{$filecov}
EOS;
if ($tplfile) {
echo <<{$tplfile}
EOS;
}
}
else {
$error_html = htmlspecialchars($error);
echo <<{$error_html}
EOS;
}
?>