\w+)\/(?[0-9.a-z]*)/"; if(isset($_SERVER[self::$_serverKey]) && preg_match_all($regex, $_SERVER[self::$_serverKey], $arr)) return array_merge(['software' => $arr['software'][0]], ['version' => $arr['version'][0]]); else return array(); } /** * Write a directive into .htacess * * * @access public * @static * @throws Exception */ public static function restrictAccessTo() { $file = '.htaccess'; if (is_dir(self::$path) && !is_file($file)) { $server = self::getWebserver(); if($server['software'] == "Apache") { if (version_compare($server['version'], '2.2') >= 0) { self::_store( $file, 'Allow from none' . PHP_EOL . 'Deny from all' . PHP_EOL, LOCK_EX ); } else { self::_store( $file, 'Require all denied' . PHP_EOL, LOCK_EX ); } } } } }