From 9970343fe5c8226f25234addc6b80836c092fe1f Mon Sep 17 00:00:00 2001 From: ShevAbam Date: Tue, 7 Jul 2015 15:57:41 +0200 Subject: General : cleaning and optimizing CSS General : responsive design General : reload button now spins when you reload block General : update jQuery plugin Knob to 1.2.11 General : optimizing security (config file esm.config.json is now in the conf/ folder with an htaccess) CPU : retrieves correctly CPU frequency for Raspberry Pi CPU : add CPU temperature (+ option to enable/disable) System : little correction for getting distro name Swap : fix if swap is disabled Services status : adds protocol TCP or UDP for checking service status Services status : new option to hide port number (see show_port in services section) --- libs/Utils/Misc.class.php | 102 ---------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 libs/Utils/Misc.class.php (limited to 'libs/Utils/Misc.class.php') diff --git a/libs/Utils/Misc.class.php b/libs/Utils/Misc.class.php deleted file mode 100644 index e2fe7cb..0000000 --- a/libs/Utils/Misc.class.php +++ /dev/null @@ -1,102 +0,0 @@ - $unit) - { - if ($filesize > 1024) - $filesize /= 1024; - else - break; - } - - return round($filesize, $precision).' '.$units[$idUnit].'B'; - } - - - /** - * Returns hostname - */ - public static function getHostname() - { - return php_uname('n'); - } - - - /** - * Returns CPU cores number - */ - public static function getCpuCoresNumber() - { - if (!($num_cores = shell_exec('/bin/grep -c ^processor /proc/cpuinfo'))) - { - if (!($num_cores = trim(shell_exec('/usr/bin/nproc')))) - { - $num_cores = 1; - } - } - - if ((int)$num_cores <= 0) - $num_cores = 1; - - return (int)$num_cores; - } - - - /** - * Returns server IP - */ - public static function getLanIp() - { - return $_SERVER['SERVER_ADDR']; - } - - - /** - * Returns a command that exists in the system among $cmds - */ - public static function whichCommand($cmds, $args = '', $returnWithArgs = true) - { - $return = ''; - - foreach ($cmds as $cmd) - { - if (trim(shell_exec($cmd.$args)) != '') - { - $return = $cmd; - - if ($returnWithArgs) - $return .= $args; - - break; - } - } - - return $return; - } - - - /** - * Allows to pluralize a word based on a number - * Ex : echo 'mot'.Misc::pluralize(5); ==> prints mots - * Ex : echo 'cheva'.Misc::pluralize(5, 'ux', 'l'); ==> prints chevaux - * Ex : echo 'cheva'.Misc::pluralize(1, 'ux', 'l'); ==> prints cheval - * - * @param int $nb - * @param string $plural - * @param string $singular - * - * @return string - */ - public static function pluralize($nb, $plural = 's', $singular = '') - { - return $nb > 1 ? $plural : $singular; - } -} \ No newline at end of file -- cgit v1.3