- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
function phpinfo_html() {
static $keywords = array(
'Configuration',
'Additional Modules',
'Environment',
'PHP Variables',
'PHP Credits',
'PHP License',
);
$modules = get_loaded_extensions();
ob_start();
phpinfo();
$lines = explode("\n", mb_convert_encoding(ob_get_clean(), 'cp1251', 'utf-8'));
$table_rows = 1;
$info = '<table '.DEFAULT_TABLE_ATTRS().'>';
foreach ($lines as $n => $line) {
if ($n === 0) // skip `phpinfo()` string
continue;
if (strlen(trim($line)) === 0) {
$info .= '</table> <table '.DEFAULT_TABLE_ATTRS().'>';
$table_rows = 1;
} else if (strpos($line, '=>') !== false) {
$rows = substr_count($line, '=>');
$table_rows = max($table_rows, $rows);
$rows = explode(' => ', $line);
if ($rows[0] == 'PHP Version' && $n < 10) {
$info .= '<tr class="h"><td><a href="http://www.php.net"><img border="0px" src="'.GET_LOGO_SRC().'"/></a><h1 class="p">'.$rows[0].' '.$rows[1].'</h1></td></tr>';
} else {
//$info .= '<tr><td>' . implode('</td><td>', $rows) . '</td></tr>';
$info .= '<tr><td class="e">'.array_shift($rows).'</td><td class="v">';
$info .= implode('</td><td class="v">', $rows).'</td></tr>';
}
} else if (trim($line) == '_______________________________________________________________________') {
$info .= '</table><hr><table '.DEFAULT_TABLE_ATTRS().'>';
$table_rows = 1;
} else {
$line = trim($line);
if (in_array($line, $keywords)) {
$info .= '</table><h1>' . $line . '</h1><table ' . DEFAULT_TABLE_ATTRS() . '>';
} else if (in_array($line, $modules)) {
$info .= '</table><h2>'.$line.'</h2><table '.DEFAULT_TABLE_ATTRS().'>';
} else {
$info .= '<tr class="h"><th colspan="' . 999 . '">' . trim($line) . '</th></tr>';
}
}
}
$info .= '</table>';
return $info;
}
Комментарии (0) RSS
Добавить комментарий