0) { return true; } if (!array_key_exists('REQUEST_METHOD', $_SERVER)) { return true; } return false; } if (is_cli() === false) { echo('Unable to Start'); exit(1); } function getOSInformation() { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { return ['name' => 'Windows']; } if (false == function_exists("shell_exec") || false == is_readable("/etc/os-release")) { return null; } $os = shell_exec('cat /etc/os-release'); $listIds = preg_match_all('/.*=/', $os, $matchListIds); $listIds = $matchListIds[0]; $listVal = preg_match_all('/=.*/', $os, $matchListVal); $listVal = $matchListVal[0]; array_walk($listIds, function(&$v, $k) { $v = strtolower(str_replace('=', '', $v)); }); array_walk($listVal, function(&$v, $k) { $v = preg_replace('/=|"/', '', $v); }); return array_combine($listIds, $listVal); } function is_string_found(string $data, string $find): bool { return (stripos($data, $find) !== false); } function get_left(string $str, int $length): string { return substr($str, 0, $length); } function get_right(string $str, int $length): string { return substr($str, -$length); } $os = getOSInformation(); $osVer = (isset($os['version_id'])) ? $os['version_id'] : false; $codeName = (isset($os['version_codename'])) ? $os['version_codename'] : false; $os_like = (isset($os['id_like'])) ? $os['id_like'] : false;