diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39d2852..debc93f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,11 @@
-# Changelog
+# Changelog
All Notable changes to `x-prober` will be documented in this file
+## 1.3.1 - 2018-03-01
+### Fixed
+- Fixed disk display error in some OS
+- Fixed translation
## 1.3.0 - 2017-12-11
### Added
diff --git a/README.md b/README.md
index 551304a..af08e43 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[](https://wx3.sinaimg.cn/large/686ee05dly1fkvkxkwyhzj21gu0d2my8.jpg)
+[](https://wx3.sinaimg.cn/large/686ee05dly1fkvkxkwyhzj21gu0d2my8.jpg)
# 😎 x-prober
> This is a prober program for PHP environment. It can show your server information and readable easily. And most important is IT'S LIKE iPhone X!
@@ -21,7 +21,8 @@
## Compile and Usage
- Star and clone.
- Check the config ./src/Config/Api.php
-- Compile: php ./compile.php dev
+- Compile development: php ./compile.php dev
+- Compile production: php ./compile.php
- Access ./dist/prober.php
- Enjoy
diff --git a/dist/prober.php b/dist/prober.php
index 640f817..2eda86c 100644
--- a/dist/prober.php
+++ b/dist/prober.php
@@ -2,26 +2,26 @@
namespace InnStudio\Prober\PreDefine;
\define('TIMER', \microtime(true));
\define('DEBUG', false);
-\define('LANG', 'eyJodHRwczpcL1wvZ2l0aHViLmNvbVwva212YW5cL3gtcHJvYmVyIjp7InpoLUNOIjoiaHR0cDpcL1wvZ2l0aHViLmNvbVwva212YW5cL3gtcHJvYmVyIn0sIklOTiBTVFVESU8iOnsiemgtQ04iOiJJTk4gU1RVRElPIn0sImh0dHBzOlwvXC9pbm4tc3R1ZGlvLmNvbVwvcHJvYmVyIjp7InpoLUNOIjoiaHR0cHM6XC9cL2lubi1zdHVkaW8uY29tXC9wcm9iZXIifSwiWCBQcm9iZXIiOnsiemgtQ04iOiJYIFx1NjNhMlx1OTQ4OCJ9LCJGb3VuZCB1cGRhdGUhIHtBUFBfTkFNRX0gaGFzIG5ldyB2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UNOIjoiXHU3MGI5XHU1MWZiXHU2ZDRiXHU4YmQ1In0sIkFsaXl1blwvRUNTXC9QSFA3Ijp7InpoLUNOIjoiXHU5NjNmXHU5MWNjXHU0ZTkxXC9FQ1NcL1BIUDcifSwiVnVsdHJcL1BIUDciOnsiemgtQ04iOiJWdWx0clwvUEhQNyJ9LCJBbnlOb2RlXC9IRERcL1BIUDciOnsiemgtQ04iOiJBbnlOb2RlXC9IRERcL1BIUDcifSwiQWxpeXVuXC9JbnRcL1BIUDUiOnsiemgtQ04iOiJcdTk2M2ZcdTkxY2NcdTRlOTFcL1x1NTZmZFx1OTY0NVx1NzI0OFwvUEhQNSJ9LCJUZW5jZW50XC9QSFA3Ijp7InpoLUNOIjoiXHU4MTdlXHU4YmFmXHU0ZTkxXC9QSFA3In0sIk15IGluZm9ybWF0aW9uIjp7InpoLUNOIjoiXHU2MjExXHU3Njg0XHU0ZmUxXHU2MDZmIn0sIk15IElQIjp7InpoLUNOIjoiXHU2MjExXHU3Njg0IElQIn0sIk15IFVBIjp7InpoLUNOIjoiXHU2MjExXHU3Njg0IFVBIn0sIkdlbmVyYXRvciAlcyI6eyJ6aC1DTiI6Ilx1OGJlNVx1OTg3NVx1OTc2Mlx1NzUzMSAlcyBcdTc1MWZcdTYyMTAifSwiQXV0aG9yICVzIjp7InpoLUNOIjoiXHU0ZjVjXHU4MDA1XHU0ZTNhICVzIn19');
namespace InnStudio\Prober\Awesome; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\I18n\Api as I18n; class Awesome { private $ID = 'awesome'; private $ZH_CN_URL = 'https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css'; private $DEFAULT_URL = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'; public function __construct() { } public function filter() { ?>
ZH_CN_URL; } return $this->DEFAULT_URL; } }
namespace InnStudio\Prober\Benchmark; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; class Benchmark { public function __construct() { Events::on('init', array($this, 'filter')); } public function filter() { if ( ! Helper::isAction('benchmark')) { return; } $this->display(); } private function getPointsByTime($time) { return \pow(10, 3) - (int) ($time * \pow(10, 3)); } private function getHashPoints() { $data = 'inn-studio.com'; $hash = array('md5', 'sha512', 'sha256', 'crc32'); $count = \pow(10, 5); $start = \microtime(true); for ($i = 0; $i < $count; ++$i) { foreach ($hash as $v) { \hash($v, $data); } } return $this->getPointsByTime(\microtime(true) - $start); } private function getIntLoopPoints() { $j = 0; $count = \pow(10, 7); $start = \microtime(true); for ($i = 0; $i < $count; ++$i) { ++$j; } return $this->getPointsByTime(\microtime(true) - $start); } private function getFloatLoopPoints() { $j = 1 / 3; $count = \pow(10, 7); $start = \microtime(true); for ($i = 0; $i < $count; ++$i) { ++$j; } return $this->getPointsByTime(\microtime(true) - $start); } private function getIoLoopPoints() { $tmpDir = \sys_get_temp_dir(); if ( ! \is_writable($tmpDir)) { return 0; } $count = \pow(10, 4); $start = \microtime(true); for ($i = 0; $i < $count; ++$i) { $filePath = "{$tmpDir}/innStudioIoBenchmark-{$i}"; \file_put_contents($filePath, $filePath); \unlink($filePath); } return $this->getPointsByTime(\microtime(true) - $start); } private function getPoints() { return array( 'hash' => $this->getHashPoints(), 'intLoop' => $this->getIntLoopPoints(), 'floatLoop' => $this->getFloatLoopPoints(), 'ioLoop' => $this->getIoLoopPoints(), ); } private function display() { \set_time_limit(0); Helper::dieJson(array( 'code' => 0, 'data' => array( 'points' => $this->getPoints(), ), )); } }
-namespace InnStudio\Prober\Config; class Api { public static $APP_VERSION = '1.3.0'; public static $APP_NAME = 'X Prober'; public static $APP_URL = 'https://github.com/kmvan/x-prober'; public static $AUTHOR_URL = 'https://inn-studio.com/prober'; public static $AUTHOR_NAME = 'INN STUDIO'; public static $CHANGELOG_URL = 'https://raw.githubusercontent.com/kmvan/x-prober/master/CHANGELOG.md'; }
+namespace InnStudio\Prober\Config; class Api { public static $APP_VERSION = '1.3.1'; public static $APP_NAME = 'X Prober'; public static $APP_URL = 'https://github.com/kmvan/x-prober'; public static $AUTHOR_URL = 'https://inn-studio.com/prober'; public static $AUTHOR_NAME = 'INN STUDIO'; public static $CHANGELOG_URL = 'https://raw.githubusercontent.com/kmvan/x-prober/master/CHANGELOG.md'; }
namespace InnStudio\Prober\Database; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class Database { private $ID = 'database'; public function __construct() { Events::patch('mods', array($this, 'filter'), 500); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('Database'), 'tinyTitle' => I18n::_('DB'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
getContent(); ?>
I18n::_('SQLite3'), 'content' => $sqlite3Version, ), array( 'title' => 'sqlite_libversion', 'label' => I18n::_('SQLite'), 'content' => \function_exists('\sqlite_libversion') ? Helper::getIni(0, true) . ' ' . \sqlite_libversion() : Helper::getIni(0, false), ), array( 'title' => 'mysqli_get_client_version', 'label' => I18n::_('MySQLi client'), 'content' => Helper::getIni(0, true) . ' ' . \mysqli_get_client_version(), ), array( 'label' => I18n::_('Mongo'), 'content' => \class_exists('\Mongo') ? \MongoClient::VERSION : Helper::getIni(0, false), ), array( 'label' => I18n::_('MongoDB'), 'content' => \class_exists('\MongoDB') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('PostgreSQL'), 'content' => \function_exists('\pg_connect') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('Paradox'), 'content' => \function_exists('\px_new') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'title' => I18n::_('Microsoft SQL Server Driver for PHP'), 'label' => I18n::_('MS SQL'), 'content' => \function_exists('\sqlsrv_server_info') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('File Pro'), 'content' => \function_exists('\filepro') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('MaxDB client'), 'content' => \function_exists('\maxdb_get_client_version') ? \maxdb_get_client_version() : Helper::getIni(0, false), ), array( 'label' => I18n::_('MaxDB server'), 'content' => \function_exists('\maxdb_get_server_version') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; echo << I18n::_('SQLite3'), 'content' => $sqlite3Version, ), array( 'title' => 'sqlite_libversion', 'label' => I18n::_('SQLite'), 'content' => \function_exists('\sqlite_libversion') ? Helper::getIni(0, true) . ' ' . \sqlite_libversion() : Helper::getIni(0, false), ), array( 'title' => 'mysqli_get_client_version', 'label' => I18n::_('MySQLi client'), 'content' => Helper::getIni(0, true) . ' ' . \mysqli_get_client_version(), ), array( 'label' => I18n::_('Mongo'), 'content' => \class_exists('\Mongo') ? \MongoClient::VERSION : Helper::getIni(0, false), ), array( 'label' => I18n::_('MongoDB'), 'content' => \class_exists('\MongoDB') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('PostgreSQL'), 'content' => \function_exists('\pg_connect') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('Paradox'), 'content' => \function_exists('\px_new') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'title' => I18n::_('Microsoft SQL Server Driver for PHP'), 'label' => I18n::_('MS SQL'), 'content' => \function_exists('\sqlsrv_server_info') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('File Pro'), 'content' => \function_exists('\filepro') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), array( 'label' => I18n::_('MaxDB client'), 'content' => \function_exists('\maxdb_get_client_version') ? \maxdb_get_client_version() : Helper::getIni(0, false), ), array( 'label' => I18n::_('MaxDB server'), 'content' => \function_exists('\maxdb_get_server_version') ? Helper::getIni(0, true) : Helper::getIni(0, false), ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; echo <<
-EOT;
+HTML;
} } }
namespace InnStudio\Prober\Entry; use InnStudio\Prober\Config\Api as Config; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class Entry { public function __construct() { Events::emit('init'); if (DEBUG === true) { $this->display(); } else { \ob_start(); $this->display(); $content = \ob_get_contents(); \ob_end_clean(); echo Helper::htmlMinify($content); } } private function displayContent() { $mods = Events::apply('mods', array()); if ( ! $mods) { return; } foreach ($mods as $id => $mod) { ?>
@@ -93,9 +93,40 @@ text-decoration: underline;
execquery('SELECT LoadPercentage FROM Win32_Processor'); $cpus = array(); foreach ($server as $cpu) { $total += (int) $cpu->loadpercentage; } $total = (int) $total / \count($server); $cpus['idle'] = 100 - $total; $cpus['user'] = $total; } else { \exec('wmic cpu get LoadPercentage', $p); if (isset($p[1])) { $percent = (int) $p[1]; $cpus['idle'] = 100 - $percent; $cpus['user'] = $percent; } } return $cpus; } public static function getNetworkStats() { $filePath = '/proc/net/dev'; if ( ! \is_readable($filePath)) { return I18n::_('Unavailable'); } static $eths = null; if (null !== $eths) { return $eths; } $lines = \file($filePath); unset($lines[0], $lines[1]); $eths = array(); foreach ($lines as $line) { $line = \preg_replace('/\s+/', ' ', \trim($line)); $lineArr = \explode(':', $line); $numberArr = \explode(' ', \trim($lineArr[1])); $eths[$lineArr[0]] = array( 'rx' => (int) $numberArr[0], 'tx' => (int) $numberArr[8], ); } return $eths; } public static function getBtn($tx, $url) { return '' . $tx . ' '; } public static function getDiskTotalSpace($human = false) { static $space = null; if (null === $space) { $space = \disk_total_space('/'); } if ( ! $space) { return 0; } if (true === $human) { return self::formatBytes($space); } return $space; } public static function getDiskFreeSpace($human = false) { static $space = null; if (null === $space) { $space = \disk_free_space('/'); } if ( ! $space) { return 0; } if (true === $human) { return self::formatBytes($space); } return $space; } public static function getCpuModel() { $filePath = '/proc/cpuinfo'; if ( ! \is_readable($filePath)) { return I18n::_('Unavailable'); } $content = \file_get_contents($filePath); $cores = \substr_count($content, 'cache size'); $lines = \explode("\n", $content); $modelName = \explode(':', $lines[4]); $modelName = \trim($modelName[1]); $cacheSize = \explode(':', $lines[8]); $cacheSize = \trim($cacheSize[1]); return "{$cores} x {$modelName} / " . \sprintf(I18n::_('%s cache'), $cacheSize); } public static function getServerTime() { return \date('Y-m-d H:i:s'); } public static function getServerUpTime() { $filePath = '/proc/uptime'; if ( ! \is_readable($filePath)) { return I18n::_('Unavailable'); } $str = \file_get_contents($filePath); $num = (float) $str; $secs = \fmod($num, 60); $num = (int) ($num / 60); $mins = $num % 60; $num = (int) ($num / 60); $hours = $num % 24; $num = (int) ($num / 24); $days = $num; return \sprintf( I18n::_('%1$dd %2$dh %3$dm %4$ds'), $days, $hours, $mins, $secs ); } public static function getErrNameByCode($code) { switch ($code) { case E_ERROR: return 'E_ERROR'; case E_WARNING: return 'E_WARNING'; case E_PARSE: return 'E_PARSE'; case E_NOTICE: return 'E_NOTICE'; case E_CORE_ERROR: return 'E_CORE_ERROR'; case E_CORE_WARNING: return 'E_CORE_WARNING'; case E_COMPILE_ERROR: return 'E_COMPILE_ERROR'; case E_COMPILE_WARNING: return 'E_COMPILE_WARNING'; case E_USER_ERROR: return 'E_USER_ERROR'; case E_USER_WARNING: return 'E_USER_WARNING'; case E_USER_NOTICE: return 'E_USER_NOTICE'; case E_STRICT: return 'E_STRICT'; case E_RECOVERABLE_ERROR: return 'E_RECOVERABLE_ERROR'; case E_DEPRECATED: return 'E_DEPRECATED'; case E_USER_DEPRECATED: return 'E_USER_DEPRECATED'; case E_ALL: return 'E_ALL'; } return $code; } public static function getIni($id, $forceSet = null) { if (true === $forceSet) { $ini = 1; } elseif (false === $forceSet) { $ini = 0; } else { $ini = \ini_get($id); } if ( ! \is_numeric($ini) && '' !== (string) $ini) { return $ini; } if (1 === (int) $ini) { return '✓ '; } elseif (0 === (int) $ini) { return '× '; } return $ini; } public static function isWin() { return PHP_OS === 'WINNT'; } public static function htmlMinify($buffer) { \preg_match_all('#\.*\<\/textarea\>#Uis', $buffer, $foundTxt); \preg_match_all('#\.*\<\/pre\>#Uis', $buffer, $foundPre); $textareas = array(); foreach (\array_keys($foundTxt[0]) as $item) { $textareas[] = ''; } $pres = array(); foreach (\array_keys($foundPre[0]) as $item) { $pres[] = '' . $item . ' '; } $buffer = \str_replace($foundTxt[0], $textareas, $buffer); $buffer = \str_replace($foundPre[0], $pres, $buffer); $search = array( '/\>[^\S ]+/s', '/[^\S ]+\', '<', '\\1', ); $buffer = \preg_replace($search, $replace, $buffer); $textareas = array(); foreach (\array_keys($foundTxt[0]) as $item) { $textareas[] = ''; } $pres = array(); foreach (\array_keys($foundPre[0]) as $item) { $pres[] = '' . $item . ' '; } $buffer = \str_replace($textareas, $foundTxt[0], $buffer); $buffer = \str_replace($pres, $foundPre[0], $buffer); return $buffer; } public static function getClientIp() { $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REMOTE_ADDR'); foreach ($keys as $key) { if ( ! isset($_SERVER[$key])) { continue; } $ip = \array_filter(\explode(',', $_SERVER[$key])); $ip = \filter_var(\end($ip), FILTER_VALIDATE_IP); if ($ip) { return $ip; } } return ''; } public static function getCpuUsage() { static $cpu = null; if (null !== $cpu) { return $cpu; } if (self::isWin()) { $cpu = self::getWinCpuUsage(); return $cpu; } $filePath = ('/proc/stat'); if ( ! \is_readable($filePath)) { $cpu = array(); return $cpu; } $stat1 = \file($filePath); \sleep(1); $stat2 = \file($filePath); $info1 = \explode(' ', \preg_replace('!cpu +!', '', $stat1[0])); $info2 = \explode(' ', \preg_replace('!cpu +!', '', $stat2[0])); $dif = array(); $dif['user'] = $info2[0] - $info1[0]; $dif['nice'] = $info2[1] - $info1[1]; $dif['sys'] = $info2[2] - $info1[2]; $dif['idle'] = $info2[3] - $info1[3]; $total = \array_sum($dif); $cpu = array(); foreach ($dif as $x => $y) { $cpu[$x] = \round($y / $total * 100, 1); } return $cpu; } public static function getHumanCpuUsageDetail() { $cpu = self::getCpuUsage(); if ( ! $cpu) { return ''; } $html = ''; foreach ($cpu as $k => $v) { $html .= '' . $k . ' ' . $v . ' '; } return $html; } public static function getHumanCpuUsage() { $cpu = self::getCpuUsage(); return $cpu ?: array(); } public static function getSysLoadAvg() { if (self::isWin()) { return I18n::_('Not support on Windows'); } $avg = \sys_getloadavg(); $avg[0] = '' . I18n::_('1 min:') . " {$avg[0]} "; $avg[1] = '' . I18n::_('5 min:') . " {$avg[1]} "; $avg[2] = '' . I18n::_('15 min:') . " {$avg[2]} "; return \implode('', $avg); } public static function getMemoryUsage($key) { $key = \ucfirst($key); if (self::isWin()) { return 0; } static $memInfo = null; if (null === $memInfo) { $memInfoFile = '/proc/meminfo'; if ( ! \is_readable($memInfoFile)) { $memInfo = 0; return 0; } $memInfo = \file_get_contents($memInfoFile); $memInfo = \str_replace(array( ' kB', ' ', ), '', $memInfo); $lines = array(); foreach (\explode("\n", $memInfo) as $line) { if ( ! $line) { continue; } $line = \explode(':', $line); $lines[$line[0]] = (int) $line[1]; } $memInfo = $lines; } switch ($key) { case 'MemRealUsage': $memAvailable = 0; if (isset($memInfo['MemAvailable'])) { $memAvailable = $memInfo['MemAvailable']; } elseif (isset($memInfo['MemFree'])) { $memAvailable = $memInfo['MemFree']; } return $memInfo['MemTotal'] - $memAvailable; case 'SwapRealUsage': if ( ! isset($memInfo['SwapTotal']) || ! isset($memInfo['SwapFree']) || ! isset($memInfo['SwapCached'])) { return 0; } return $memInfo['SwapTotal'] - $memInfo['SwapFree'] - $memInfo['SwapCached']; } return isset($memInfo[$key]) ? (int) $memInfo[$key] : 0; } public static function formatBytes($bytes, $precision = 2) { if ( ! $bytes) { return 0; } $base = \log($bytes, 1024); $suffixes = array('', ' K', ' M', ' G', ' T'); return \round(\pow(1024, $base - \floor($base)), $precision) . $suffixes[\floor($base)]; } public static function getHumamMemUsage($key) { return self::formatBytes(self::getMemoryUsage($key) * 1024); } }
+namespace InnStudio\Prober\Helper; use InnStudio\Prober\I18n\Api as I18n; class Api { public static function dieJson($data) { \header('Content-Type: application/json'); die(\json_encode($data)); } public static function isAction($action) { return \filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING) === $action; } public static function getWinCpuUsage() { $cpus = array(); if (\class_exists('\COM')) { $wmi = new \COM('Winmgmts://'); $server = $wmi->execquery('SELECT LoadPercentage FROM Win32_Processor'); $cpus = array(); foreach ($server as $cpu) { $total += (int) $cpu->loadpercentage; } $total = (int) $total / \count($server); $cpus['idle'] = 100 - $total; $cpus['user'] = $total; } else { \exec('wmic cpu get LoadPercentage', $p); if (isset($p[1])) { $percent = (int) $p[1]; $cpus['idle'] = 100 - $percent; $cpus['user'] = $percent; } } return $cpus; } public static function getNetworkStats() { $filePath = '/proc/net/dev'; if ( ! \is_readable($filePath)) { return I18n::_('Unavailable'); } static $eths = null; if (null !== $eths) { return $eths; } $lines = \file($filePath); unset($lines[0], $lines[1]); $eths = array(); foreach ($lines as $line) { $line = \preg_replace('/\s+/', ' ', \trim($line)); $lineArr = \explode(':', $line); $numberArr = \explode(' ', \trim($lineArr[1])); $eths[$lineArr[0]] = array( 'rx' => (int) $numberArr[0], 'tx' => (int) $numberArr[8], ); } return $eths; } public static function getBtn($tx, $url) { return <<{$tx}
+HTML;
+} public static function getDiskTotalSpace($human = false) { static $space = null; if (null === $space) { $space = \disk_total_space('/'); } if ( ! $space) { return 0; } if (true === $human) { return self::formatBytes($space); } return $space; } public static function getDiskFreeSpace($human = false) { static $space = null; if (null === $space) { try { $space = \disk_free_space('/'); } catch (\Exception $e) { $space = 0; } } if ( ! $space) { return 0; } if (true === $human) { return self::formatBytes($space); } return $space; } public static function getCpuModel() { $filePath = '/proc/cpuinfo'; if ( ! \is_readable($filePath)) { return I18n::_('Unavailable'); } $content = \file_get_contents($filePath); $cores = \substr_count($content, 'cache size'); $lines = \explode("\n", $content); $modelName = \explode(':', $lines[4]); $modelName = \trim($modelName[1]); $cacheSize = \explode(':', $lines[8]); $cacheSize = \trim($cacheSize[1]); return "{$cores} x {$modelName} / " . \sprintf(I18n::_('%s cache'), $cacheSize); } public static function getServerTime() { return \date('Y-m-d H:i:s'); } public static function getServerUpTime() { $filePath = '/proc/uptime'; if ( ! \is_readable($filePath)) { return I18n::_('Unavailable'); } $str = \file_get_contents($filePath); $num = (float) $str; $secs = \fmod($num, 60); $num = (int) ($num / 60); $mins = $num % 60; $num = (int) ($num / 60); $hours = $num % 24; $num = (int) ($num / 24); $days = $num; return \sprintf( I18n::_('%1$dd %2$dh %3$dm %4$ds'), $days, $hours, $mins, $secs ); } public static function getErrNameByCode($code) { switch ($code) { case E_ERROR: return 'E_ERROR'; case E_WARNING: return 'E_WARNING'; case E_PARSE: return 'E_PARSE'; case E_NOTICE: return 'E_NOTICE'; case E_CORE_ERROR: return 'E_CORE_ERROR'; case E_CORE_WARNING: return 'E_CORE_WARNING'; case E_COMPILE_ERROR: return 'E_COMPILE_ERROR'; case E_COMPILE_WARNING: return 'E_COMPILE_WARNING'; case E_USER_ERROR: return 'E_USER_ERROR'; case E_USER_WARNING: return 'E_USER_WARNING'; case E_USER_NOTICE: return 'E_USER_NOTICE'; case E_STRICT: return 'E_STRICT'; case E_RECOVERABLE_ERROR: return 'E_RECOVERABLE_ERROR'; case E_DEPRECATED: return 'E_DEPRECATED'; case E_USER_DEPRECATED: return 'E_USER_DEPRECATED'; case E_ALL: return 'E_ALL'; } return $code; } public static function getIni($id, $forceSet = null) { if (true === $forceSet) { $ini = 1; } elseif (false === $forceSet) { $ini = 0; } else { $ini = \ini_get($id); } if ( ! \is_numeric($ini) && '' !== (string) $ini) { return $ini; } if (1 === (int) $ini) { return <<✓
+HTML;
+} elseif (0 === (int) $ini) { return <<×
+HTML;
+} return $ini; } public static function isWin() { return PHP_OS === 'WINNT'; } public static function htmlMinify($buffer) { \preg_match_all('#\.*\<\/textarea\>#Uis', $buffer, $foundTxt); \preg_match_all('#\.*\<\/pre\>#Uis', $buffer, $foundPre); $textareas = array(); foreach (\array_keys($foundTxt[0]) as $item) { $textareas[] = ''; } $pres = array(); foreach (\array_keys($foundPre[0]) as $item) { $pres[] = '' . $item . ' '; } $buffer = \str_replace($foundTxt[0], $textareas, $buffer); $buffer = \str_replace($foundPre[0], $pres, $buffer); $search = array( '/\>[^\S ]+/s', '/[^\S ]+\', '<', '\\1', ); $buffer = \preg_replace($search, $replace, $buffer); $textareas = array(); foreach (\array_keys($foundTxt[0]) as $item) { $textareas[] = ''; } $pres = array(); foreach (\array_keys($foundPre[0]) as $item) { $pres[] = '' . $item . ' '; } $buffer = \str_replace($textareas, $foundTxt[0], $buffer); $buffer = \str_replace($pres, $foundPre[0], $buffer); return $buffer; } public static function getClientIp() { $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REMOTE_ADDR'); foreach ($keys as $key) { if ( ! isset($_SERVER[$key])) { continue; } $ip = \array_filter(\explode(',', $_SERVER[$key])); $ip = \filter_var(\end($ip), FILTER_VALIDATE_IP); if ($ip) { return $ip; } } return ''; } public static function getCpuUsage() { static $cpu = null; if (null !== $cpu) { return $cpu; } if (self::isWin()) { $cpu = self::getWinCpuUsage(); return $cpu; } $filePath = ('/proc/stat'); if ( ! \is_readable($filePath)) { $cpu = array(); return $cpu; } $stat1 = \file($filePath); \sleep(1); $stat2 = \file($filePath); $info1 = \explode(' ', \preg_replace('!cpu +!', '', $stat1[0])); $info2 = \explode(' ', \preg_replace('!cpu +!', '', $stat2[0])); $dif = array(); $dif['user'] = $info2[0] - $info1[0]; $dif['nice'] = $info2[1] - $info1[1]; $dif['sys'] = $info2[2] - $info1[2]; $dif['idle'] = $info2[3] - $info1[3]; $total = \array_sum($dif); $cpu = array(); foreach ($dif as $x => $y) { $cpu[$x] = \round($y / $total * 100, 1); } return $cpu; } public static function getHumanCpuUsageDetail() { $cpu = self::getCpuUsage(); if ( ! $cpu) { return ''; } $html = ''; foreach ($cpu as $k => $v) { $html .= <<{$k}
+{$v}
+HTML;
+} return $html; } public static function getHumanCpuUsage() { $cpu = self::getCpuUsage(); return $cpu ?: array(); } public static function getSysLoadAvg() { if (self::isWin()) { return I18n::_('Not support on Windows'); } $avg = \sys_getloadavg(); $langMin = function ($n) { return \sprintf(I18n::_('%d min:'), $n); }; $avg[0] = <<
+{$langMin(1)}
+{$avg[0]}
+
+HTML;
+$avg[1] = <<
+{$langMin(5)}
+{$avg[1]}
+
+HTML;
+$avg[2] = <<
+{$langMin(15)}
+{$avg[2]}
+
+HTML;
+return \implode('', $avg); } public static function getMemoryUsage($key) { $key = \ucfirst($key); if (self::isWin()) { return 0; } static $memInfo = null; if (null === $memInfo) { $memInfoFile = '/proc/meminfo'; if ( ! \is_readable($memInfoFile)) { $memInfo = 0; return 0; } $memInfo = \file_get_contents($memInfoFile); $memInfo = \str_replace(array( ' kB', ' ', ), '', $memInfo); $lines = array(); foreach (\explode("\n", $memInfo) as $line) { if ( ! $line) { continue; } $line = \explode(':', $line); $lines[$line[0]] = (int) $line[1]; } $memInfo = $lines; } switch ($key) { case 'MemRealUsage': $memAvailable = 0; if (isset($memInfo['MemAvailable'])) { $memAvailable = $memInfo['MemAvailable']; } elseif (isset($memInfo['MemFree'])) { $memAvailable = $memInfo['MemFree']; } return $memInfo['MemTotal'] - $memAvailable; case 'SwapRealUsage': if ( ! isset($memInfo['SwapTotal']) || ! isset($memInfo['SwapFree']) || ! isset($memInfo['SwapCached'])) { return 0; } return $memInfo['SwapTotal'] - $memInfo['SwapFree'] - $memInfo['SwapCached']; } return isset($memInfo[$key]) ? (int) $memInfo[$key] : 0; } public static function formatBytes($bytes, $precision = 2) { if ( ! $bytes) { return 0; } $base = \log($bytes, 1024); $suffixes = array('', ' K', ' M', ' G', ' T'); return \round(\pow(1024, $base - \floor($base)), $precision) . $suffixes[\floor($base)]; } public static function getHumamMemUsage($key) { return self::formatBytes(self::getMemoryUsage($key) * 1024); } }
namespace InnStudio\Prober\I18n; class Api { public static function _($str) { static $preDefineLang = null; if (null === $preDefineLang) { $preDefineLang = \json_decode(\base64_decode(LANG), true); } if ( ! isset($preDefineLang[$str])) { return $str; } $lang = $preDefineLang[$str]; $clientLang = self::getClientLang(); return isset($lang[$clientLang]) ? $lang[$clientLang] : $str; } public static function getClientLang() { static $cache = null; if (null !== $cache) { return $cache; } if ( ! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $cache = ''; return $cache; } $client = \explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); if (isset($client[0])) { $cache = $client[0]; } else { $cache = ''; } return $cache; } }
-namespace InnStudio\Prober\MyInfo; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class MyInfo { private $ID = 'myInfo'; public function __construct() { Events::patch('mods', array($this, 'filter'), 900); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('My information'), 'tinyTitle' => I18n::_('Mine'), 'display' => array($this, 'display'), ); return $mods; } public function display() { echo $this->getContent(); } public function getContent() { $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; return <<ID] = array( 'title' => I18n::_('My information'), 'tinyTitle' => I18n::_('Mine'), 'display' => array($this, 'display'), ); return $mods; } public function display() { echo $this->getContent(); } public function getContent() { $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; return <<
{$this->_('My IP')}
{$this->getClientIp()}
@@ -104,9 +135,9 @@ namespace InnStudio\Prober\MyInfo; use InnStudio\Prober\Events\Api as Events; us
{$this->_('My UA')}
{$ua}
-EOT;
+HTML;
} private function getClientIp() { return Helper::getClientIp(); } private function _($str) { return I18n::_($str); } }
-namespace InnStudio\Prober\Nav; use InnStudio\Prober\Events\Api as Events; class Nav { private $ID = 'nav'; public function __construct() { Events::on('script', array($this, 'filterScript')); Events::on('style', array($this, 'filterStyle')); } public function filterStyle() { ?>
+namespace InnStudio\Prober\Nav; use InnStudio\Prober\Events\Api as Events; class Nav { private $ID = 'nav'; public function __construct() { Events::on('script', array($this, 'filterScript')); Events::on('style', array($this, 'filterStyle')); } public function filterStyle() { echo <<
.nav {
position: fixed;
@@ -152,8 +183,8 @@ padding: .3rem 1rem;
}
}
-
+HTML;
+} public function filterScript() { echo <<
(function(){
var fieldsets = document.querySelectorAll('fieldset');
@@ -172,7 +203,7 @@ nav.appendChild(a);
document.body.appendChild(nav);
})()
-ID] = array( 'title' => I18n::_('Network stats'), 'tinyTitle' => I18n::_('Net'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
@@ -188,54 +219,57 @@ text-align: center;
}
' . Helper::getNetworkStats() . '
'; } foreach (Helper::getNetworkStats() as $ethName => $item) { $rxHuman = Helper::formatBytes($item['rx']); $txHuman = Helper::formatBytes($item['tx']); $items[] = array( 'label' => $ethName, 'content' => "
-
-
{$rxHuman}
-
▼ 0 /s
+} private function getContent() { $items = array(); $stats = Helper::getNetworkStats(); if ( ! \is_array($stats)) { return '
' . Helper::getNetworkStats() . '
'; } foreach (Helper::getNetworkStats() as $ethName => $item) { $rxHuman = Helper::formatBytes($item['rx']); $txHuman = Helper::formatBytes($item['tx']); $items[] = array( 'label' => $ethName, 'content' => <<
+
-
", ); } $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-1'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= <<
+HTML
+); } $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-1'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= <<
-EOT;
+HTML;
} return $content; } }
-namespace InnStudio\Prober\PhpExtensionInfo; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class PhpExtensionInfo { private $ID = 'phpExtensionInfo'; public function __construct() { Events::patch('mods', array($this, 'filter'), 400); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('PHP extensions'), 'tinyTitle' => I18n::_('Ext'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
+namespace InnStudio\Prober\PhpExtensionInfo; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class PhpExtensionInfo { private $ID = 'phpExtensionInfo'; public function __construct() { Events::patch('mods', array($this, 'filter'), 400); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('PHP extensions'), 'tinyTitle' => I18n::_('Ext'), 'display' => array($this, 'display'), ); return $mods; } public function display() { echo <<
-getContent(); ?>
+{$this->getContent()}
- \sprintf(I18n::_('%s extension'), 'Memcache'), 'content' => Helper::getIni(0, \extension_loaded('memcache') && \class_exists('\Memcache')), ), array( 'label' => \sprintf(I18n::_('%s extension'), 'Memcached'), 'content' => Helper::getIni(0, \extension_loaded('memcached') && \class_exists('\Memcached')), ), array( 'label' => \sprintf(I18n::_('%s extension'), 'Redis'), 'content' => Helper::getIni(0, \extension_loaded('redis') && \class_exists('\Redis')), ), array( 'label' => \sprintf(I18n::_('%s extension'), 'Opcache'), 'content' => Helper::getIni(0, \function_exists('\opcache_get_configuration')), ), array( 'label' => \sprintf(I18n::_('%s enabled'), 'Opcache'), 'content' => Helper::getIni(0, $this->isOpcEnabled()), ), array( 'label' => I18n::_('Zend Optimizer'), 'content' => Helper::getIni(0, \function_exists('zend_optimizer_version')), ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= << \sprintf(I18n::_('%s extension'), 'Memcache'), 'content' => Helper::getIni(0, \extension_loaded('memcache') && \class_exists('\Memcache')), ), array( 'label' => \sprintf(I18n::_('%s extension'), 'Memcached'), 'content' => Helper::getIni(0, \extension_loaded('memcached') && \class_exists('\Memcached')), ), array( 'label' => \sprintf(I18n::_('%s extension'), 'Redis'), 'content' => Helper::getIni(0, \extension_loaded('redis') && \class_exists('\Redis')), ), array( 'label' => \sprintf(I18n::_('%s extension'), 'Opcache'), 'content' => Helper::getIni(0, \function_exists('\opcache_get_configuration')), ), array( 'label' => \sprintf(I18n::_('%s enabled'), 'Opcache'), 'content' => Helper::getIni(0, $this->isOpcEnabled()), ), array( 'label' => I18n::_('Zend Optimizer'), 'content' => Helper::getIni(0, \function_exists('zend_optimizer_version')), ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= <<
-EOT;
+HTML;
} return $content; } private function isOpcEnabled() { $isOpcEnabled = \function_exists('\opcache_get_configuration'); if ($isOpcEnabled) { $isOpcEnabled = \opcache_get_configuration(); $isOpcEnabled = isset($isOpcEnabled['directives']['opcache.enable']) && $isOpcEnabled['directives']['opcache.enable'] === true; } return $isOpcEnabled; } }
namespace InnStudio\Prober\PhpInfo; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class PhpInfo { private $ID = 'phpInfo'; public function __construct() { Events::patch('mods', array($this, 'filter'), 300); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('PHP information'), 'tinyTitle' => I18n::_('PHP'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
getContent(); ?>
$this->_('PHP info detail'), 'content' => '👆 ' . Helper::getBtn($this->_('Click to check'), '?action=phpInfo'), ), array( 'label' => $this->_('Version'), 'content' => PHP_VERSION, ), array( 'label' => $this->_('SAPI interface'), 'content' => PHP_SAPI, ), array( 'label' => $this->_('Error reporting'), 'title' => 'error_reporting', 'content' => Helper::getErrNameByCode(\ini_get('error_reporting')), ), array( 'label' => $this->_('Max memory limit'), 'title' => 'memory_limit', 'content' => \ini_get('memory_limit'), ), array( 'label' => $this->_('Max POST size'), 'title' => 'post_max_size', 'content' => \ini_get('post_max_size'), ), array( 'label' => $this->_('Max upload size'), 'title' => 'upload_max_filesize', 'content' => \ini_get('upload_max_filesize'), ), array( 'label' => $this->_('Max input variables'), 'title' => 'max_input_vars', 'content' => \ini_get('max_input_vars'), ), array( 'label' => $this->_('Max execution time'), 'title' => 'max_execution_time', 'content' => \ini_get('max_execution_time'), ), array( 'label' => $this->_('Timeout for socket'), 'title' => 'default_socket_timeout', 'content' => \ini_get('default_socket_timeout'), ), array( 'label' => $this->_('Display errors'), 'title' => 'display_errors', 'content' => Helper::getIni('display_errors'), ), array( 'label' => $this->_('Treatment URLs file'), 'title' => 'allow_url_fopen', 'content' => Helper::getIni('allow_url_fopen'), ), array( 'label' => $this->_('SMTP support'), 'title' => 'SMTP', 'content' => Helper::getIni('SMTP') ?: Helper::getIni(0, false), ), array( 'col' => '1-1', 'label' => $this->_('Disabled functions'), 'title' => 'disable_functions', 'content' => \implode(', ', \explode(',', Helper::getIni('disable_functions'))) ?: '-', ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= << $this->_('PHP info detail'), 'content' => '👆 ' . Helper::getBtn($this->_('Click to check'), '?action=phpInfo'), ), array( 'label' => $this->_('Version'), 'content' => PHP_VERSION, ), array( 'label' => $this->_('SAPI interface'), 'content' => PHP_SAPI, ), array( 'label' => $this->_('Error reporting'), 'title' => 'error_reporting', 'content' => Helper::getErrNameByCode(\ini_get('error_reporting')), ), array( 'label' => $this->_('Max memory limit'), 'title' => 'memory_limit', 'content' => \ini_get('memory_limit'), ), array( 'label' => $this->_('Max POST size'), 'title' => 'post_max_size', 'content' => \ini_get('post_max_size'), ), array( 'label' => $this->_('Max upload size'), 'title' => 'upload_max_filesize', 'content' => \ini_get('upload_max_filesize'), ), array( 'label' => $this->_('Max input variables'), 'title' => 'max_input_vars', 'content' => \ini_get('max_input_vars'), ), array( 'label' => $this->_('Max execution time'), 'title' => 'max_execution_time', 'content' => \ini_get('max_execution_time'), ), array( 'label' => $this->_('Timeout for socket'), 'title' => 'default_socket_timeout', 'content' => \ini_get('default_socket_timeout'), ), array( 'label' => $this->_('Display errors'), 'title' => 'display_errors', 'content' => Helper::getIni('display_errors'), ), array( 'label' => $this->_('Treatment URLs file'), 'title' => 'allow_url_fopen', 'content' => Helper::getIni('allow_url_fopen'), ), array( 'label' => $this->_('SMTP support'), 'title' => 'SMTP', 'content' => Helper::getIni('SMTP') ?: Helper::getIni(0, false), ), array( 'col' => '1-1', 'label' => $this->_('Disabled functions'), 'title' => 'disable_functions', 'content' => \implode(', ', \explode(',', Helper::getIni('disable_functions'))) ?: '-', ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= <<
-EOT;
+HTML;
} return $content; } private function _($str) { return I18n::_($str); } }
namespace InnStudio\Prober\PhpInfoDetail; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; class PhpInfoDetail { public function __construct() { Events::on('init', array($this, 'filter')); } public function filter() { if (Helper::isAction('phpInfo')) { \phpinfo(); die; } } }
-namespace InnStudio\Prober\Script; use InnStudio\Prober\Events\Api as Events; class Script { private $ID = 'script'; public function __construct() { Events::on('script', array($this, 'filter')); } public function filter() { ?>
+namespace InnStudio\Prober\Script; use InnStudio\Prober\Events\Api as Events; class Script { private $ID = 'script'; public function __construct() { Events::on('script', array($this, 'filter')); } public function filter() { echo <<
(function () {
var xhr = new XMLHttpRequest();
@@ -376,14 +410,14 @@ lastNetworkStats[k][type] = total;
request();
})();
-ID] = array( 'title' => I18n::_('Server Benchmark'), 'tinyTitle' => I18n::_('Benchmark'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
-= I18n::_('💡 Hight is better.'); ?>
+namespace InnStudio\Prober\ServerBenchmark; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\I18n\Api as I18n; class ServerBenchmark { private $ID = 'serverBenchmark'; public function __construct() { Events::patch('mods', array($this, 'filter'), 600); Events::on('script', array($this, 'filterJs')); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('Server Benchmark'), 'tinyTitle' => I18n::_('Benchmark'), 'display' => array($this, 'display'), ); return $mods; } public function display() { $lang = I18n::_('💡 Hight is better.'); echo <<{$lang}
-getContent(); ?>
+{$this->getContent()}
-
I18n::_('My server'), 'content' => '👆 ' . I18n::_('Click to test') . ' ', ), array( 'label' => '' . I18n::_('Aliyun/ECS/PHP7') . ' ', 'content' => 3302, ), array( 'label' => '' . I18n::_('Vultr/PHP7') . ' ', 'content' => 3182, ), array( 'label' => '' . I18n::_('Linode/PHP7') . ' ', 'content' => 3091, ), array( 'label' => I18n::_('Tencent/PHP7'), 'content' => 3055, ), array( 'label' => '' . I18n::_('AnyNode/HDD/PHP7') . ' ', 'content' => 2641, ), array( 'label' => '' . I18n::_('Vultr/PHP5') . ' ', 'content' => 2420, ), array( 'label' => '' . I18n::_('Aliyun/Int/PHP5') . ' ', 'content' => -7686, ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; echo << I18n::_('My server'), 'content' => '👆 ' . I18n::_('Click to test') . ' ', ), array( 'label' => '' . I18n::_('Aliyun/ECS/PHP7') . ' ', 'content' => 3302, ), array( 'label' => '' . I18n::_('Vultr/PHP7') . ' ', 'content' => 3182, ), array( 'label' => '' . I18n::_('Linode/PHP7') . ' ', 'content' => 3091, ), array( 'label' => I18n::_('Tencent/PHP7'), 'content' => 3055, ), array( 'label' => '' . I18n::_('AnyNode/HDD/PHP7') . ' ', 'content' => 2641, ), array( 'label' => '' . I18n::_('Vultr/PHP5') . ' ', 'content' => 2420, ), array( 'label' => '' . I18n::_('Aliyun/Int/PHP5') . ' ', 'content' => -7686, ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; $content .= <<
-EOT;
-} } }
+HTML;
+} return $content; } }
namespace InnStudio\Prober\ServerInfo; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class ServerInfo { private $ID = 'serverInfo'; public function __construct() { Events::patch('mods', array($this, 'filter'), 200); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('Server information'), 'tinyTitle' => I18n::_('Info'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
getContent(); ?>
{$percent}%
-{$hunamUsed}
-/
-{$hunamTotal}
+{$hunamUsed} / {$hunamTotal}
-EOT;
-} private function getContent() { $items = array( array( 'label' => $this->_('Server name'), 'content' => $this->getServerInfo('SERVER_NAME'), ), array( 'id' => 'serverInfoTime', 'label' => $this->_('Server time'), 'content' => Helper::getServerTime(), ), array( 'id' => 'serverUpTime', 'label' => $this->_('Server uptime'), 'content' => Helper::getServerUpTime(), ), array( 'label' => $this->_('Server IP'), 'content' => $this->getServerInfo('SERVER_ADDR'), ), array( 'label' => $this->_('Server software'), 'content' => $this->getServerInfo('SERVER_SOFTWARE'), ), array( 'label' => $this->_('PHP version'), 'content' => PHP_VERSION, ), array( 'col' => '1-1', 'label' => $this->_('CPU model'), 'content' => Helper::getCpuModel(), ), array( 'col' => '1-1', 'label' => $this->_('Server OS'), 'content' => \php_uname(), ), array( 'id' => 'scriptPath', 'col' => '1-1', 'label' => $this->_('Script path'), 'content' => __FILE__, ), array( 'col' => '1-1', 'label' => $this->_('Disk usage'), 'content' => $this->getDiskInfo(), ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; echo << $this->_('Server name'), 'content' => $this->getServerInfo('SERVER_NAME'), ), array( 'id' => 'serverInfoTime', 'label' => $this->_('Server time'), 'content' => Helper::getServerTime(), ), array( 'id' => 'serverUpTime', 'label' => $this->_('Server uptime'), 'content' => Helper::getServerUpTime(), ), array( 'label' => $this->_('Server IP'), 'content' => $this->getServerInfo('SERVER_ADDR'), ), array( 'label' => $this->_('Server software'), 'content' => $this->getServerInfo('SERVER_SOFTWARE'), ), array( 'label' => $this->_('PHP version'), 'content' => PHP_VERSION, ), array( 'col' => '1-1', 'label' => $this->_('CPU model'), 'content' => Helper::getCpuModel(), ), array( 'col' => '1-1', 'label' => $this->_('Server OS'), 'content' => \php_uname(), ), array( 'id' => 'scriptPath', 'col' => '1-1', 'label' => $this->_('Script path'), 'content' => __FILE__, ), array( 'col' => '1-1', 'label' => $this->_('Disk usage'), 'content' => $this->getDiskInfo(), ), ); $content = ''; foreach ($items as $item) { $title = isset($item['title']) ? "title=\"{$item['title']}\"" : ''; $col = isset($item['col']) ? $item['col'] : '1-3'; $id = isset($item['id']) ? "id=\"{$item['id']}\"" : ''; echo <<
-EOT;
+HTML;
} } private function _($str) { return I18n::_($str); } private function getServerInfo($key) { return isset($_SERVER[$key]) ? $_SERVER[$key] : ''; } }
namespace InnStudio\Prober\ServerStatus; use InnStudio\Prober\Events\Api as Events; use InnStudio\Prober\Helper\Api as Helper; use InnStudio\Prober\I18n\Api as I18n; class ServerStatus { private $ID = 'serverStatus'; public function __construct() { Events::patch('mods', array($this, 'filter')); Events::on('style', array($this, 'filterStyle')); } public function filter($mods) { $mods[$this->ID] = array( 'title' => I18n::_('Server status'), 'tinyTitle' => I18n::_('Status'), 'display' => array($this, 'display'), ); return $mods; } public function display() { ?>
-EOT;
+HTML;
}
}
}
diff --git a/src/Helper/Api.php b/src/Helper/Api.php
index eb8ddd3..09982e2 100644
--- a/src/Helper/Api.php
+++ b/src/Helper/Api.php
@@ -36,7 +36,7 @@ class Api
$total = (int) $total / \count($server);
$cpus['idle'] = 100 - $total;
$cpus['user'] = $total;
- // exec
+ // exec
} else {
\exec('wmic cpu get LoadPercentage', $p);
@@ -83,7 +83,9 @@ class Api
public static function getBtn($tx, $url)
{
- return '' . $tx . ' ';
+ return <<{$tx}
+HTML;
}
public static function getDiskTotalSpace($human = false)
@@ -110,7 +112,11 @@ class Api
static $space = null;
if (null === $space) {
- $space = \disk_free_space('/');
+ try {
+ $space = \disk_free_space('/');
+ } catch (\Exception $e) {
+ $space = 0;
+ }
}
if ( ! $space) {
@@ -215,9 +221,13 @@ class Api
}
if (1 === (int) $ini) {
- return '✓ ';
+ return <<✓
+HTML;
} elseif (0 === (int) $ini) {
- return '× ';
+ return <<×
+HTML;
}
return $ini;
@@ -357,7 +367,10 @@ class Api
$html = '';
foreach ($cpu as $k => $v) {
- $html .= '' . $k . ' ' . $v . ' ';
+ $html .= <<{$k}
+{$v}
+HTML;
}
return $html;
@@ -376,11 +389,29 @@ class Api
return I18n::_('Not support on Windows');
}
- $avg = \sys_getloadavg();
+ $avg = \sys_getloadavg();
+ $langMin = function ($n) {
+ return \sprintf(I18n::_('%d min:'), $n);
+ };
- $avg[0] = '' . I18n::_('1 min:') . " {$avg[0]} ";
- $avg[1] = '' . I18n::_('5 min:') . " {$avg[1]} ";
- $avg[2] = '' . I18n::_('15 min:') . " {$avg[2]} ";
+ $avg[0] = <<
+ {$langMin(1)}
+ {$avg[0]}
+
+HTML;
+ $avg[1] = <<
+ {$langMin(5)}
+ {$avg[1]}
+
+HTML;
+ $avg[2] = <<
+ {$langMin(15)}
+ {$avg[2]}
+
+HTML;
return \implode('', $avg);
}
diff --git a/src/MyInfo/MyInfo.php b/src/MyInfo/MyInfo.php
index f08ab2d..e26bcec 100644
--- a/src/MyInfo/MyInfo.php
+++ b/src/MyInfo/MyInfo.php
@@ -35,7 +35,7 @@ class MyInfo
{
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
- return <<
{$this->_('My IP')}
{$this->getClientIp()}
@@ -44,7 +44,7 @@ class MyInfo
{$this->_('My UA')}
{$ua}
-EOT;
+HTML;
}
private function getClientIp()
diff --git a/src/Nav/Nav.php b/src/Nav/Nav.php
index 453a68e..f5191c0 100644
--- a/src/Nav/Nav.php
+++ b/src/Nav/Nav.php
@@ -16,7 +16,7 @@ class Nav
public function filterStyle()
{
- ?>
+ echo <<
.nav {
position: fixed;
@@ -63,12 +63,12 @@ class Nav
}
}
-
+ echo <<
(function(){
var fieldsets = document.querySelectorAll('fieldset');
@@ -92,6 +92,6 @@ for(var i = 0; i < fieldsets.length; i++) {
document.body.appendChild(nav);
})()
- $ethName,
- 'content' => "",
+ 'content' => <<
+
+
+
+HTML
);
}
@@ -82,14 +84,14 @@ class NetworkStats
$title = isset($item['title']) ? "title=\"{$item['title']}\"" : '';
$col = isset($item['col']) ? $item['col'] : '1-1';
$id = isset($item['id']) ? "id=\"{$item['id']}\"" : '';
- $content .= <<
-EOT;
+HTML;
}
return $content;
diff --git a/src/PhpExtensionInfo/PhpExtensionInfo.php b/src/PhpExtensionInfo/PhpExtensionInfo.php
index 767f94c..fce39ed 100644
--- a/src/PhpExtensionInfo/PhpExtensionInfo.php
+++ b/src/PhpExtensionInfo/PhpExtensionInfo.php
@@ -28,11 +28,11 @@ class PhpExtensionInfo
public function display()
{
- ?>
+ echo <<
- getContent(); ?>
+ {$this->getContent()}
-
-EOT;
+HTML;
}
return $content;
diff --git a/src/PhpInfo/PhpInfo.php b/src/PhpInfo/PhpInfo.php
index 9acc6fe..0acf8a2 100644
--- a/src/PhpInfo/PhpInfo.php
+++ b/src/PhpInfo/PhpInfo.php
@@ -114,14 +114,14 @@ class PhpInfo
$title = isset($item['title']) ? "title=\"{$item['title']}\"" : '';
$col = isset($item['col']) ? $item['col'] : '1-3';
$id = isset($item['id']) ? "id=\"{$item['id']}\"" : '';
- $content .= <<
-EOT;
+HTML;
}
return $content;
diff --git a/src/Script/Script.php b/src/Script/Script.php
index ac59dd5..5f1710e 100644
--- a/src/Script/Script.php
+++ b/src/Script/Script.php
@@ -15,7 +15,7 @@ class Script
public function filter()
{
- ?>
+ echo <<
(function () {
var xhr = new XMLHttpRequest();
@@ -186,6 +186,6 @@ class Script
request();
})();
-
-= I18n::_('💡 Hight is better.'); ?>
+ $lang = I18n::_('💡 Hight is better.');
+ echo <<{$lang}
- getContent(); ?>
+ {$this->getContent()}
-
-EOT;
+HTML;
}
+
+ return $content;
}
}
diff --git a/src/ServerInfo/ServerInfo.php b/src/ServerInfo/ServerInfo.php
index 2aaa3ac..64114c8 100644
--- a/src/ServerInfo/ServerInfo.php
+++ b/src/ServerInfo/ServerInfo.php
@@ -45,21 +45,19 @@ class ServerInfo
$hunamUsed = Helper::formatBytes(Helper::getDiskTotalSpace() - Helper::getDiskFreeSpace());
$hunamTotal = Helper::getDiskTotalSpace(true);
- return <<
{$percent}%
- {$hunamUsed}
- /
- {$hunamTotal}
+ {$hunamUsed} / {$hunamTotal}
-EOT;
+HTML;
}
private function getContent()
@@ -121,14 +119,14 @@ EOT;
$col = isset($item['col']) ? $item['col'] : '1-3';
$id = isset($item['id']) ? "id=\"{$item['id']}\"" : '';
- echo <<
-EOT;
+HTML;
}
}