* [MOD] Improved plugins manager

* [MOD] Code refactoring and cleanup
* [MOD] Make classes final for performance improvements and avoid some side behaviours
This commit is contained in:
nuxsmin
2018-07-28 21:45:49 +02:00
parent 3e26a1df71
commit cd2c0379db
90 changed files with 517 additions and 1071 deletions

View File

@@ -53,49 +53,6 @@ final class HttpUtil
}
}
/**
* Devolver las cabeceras enviadas desde el cliente.
*
* @param string $header nombre de la cabecera a devolver
*
* @return array|string
*/
public static function getRequestHeaders($header = '')
{
if (!empty($header)) {
$header = strpos($header, 'HTTP_') === false ? 'HTTP_' . str_replace('-', '_', strtoupper($header)) : $header;
return isset($_SERVER[$header]) ? $_SERVER[$header] : '';
}
return self::getApacheHeaders();
}
/**
* Función que sustituye a apache_request_headers
*
* @return array
*/
private static function getApacheHeaders()
{
if (function_exists('\apache_request_headers')) {
return apache_request_headers();
}
$headers = [];
foreach ($_SERVER as $key => $value) {
if (strpos($key, 'HTTP_') === 0) {
$key = ucwords(strtolower(str_replace('_', '-', substr($key, 5))), '-');
$headers[$key] = $value;
} else {
$headers[$key] = $value;
}
}
return $headers;
}
/**
* Comprobar si existen parámetros pasados por POST para enviarlos por GET
*/