mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Linting fixes
This commit is contained in:
parent
442db3050c
commit
bf90af4845
@ -51,7 +51,7 @@ class HTTP
|
||||
* @var array
|
||||
* @config
|
||||
*/
|
||||
private static $MimeTypes = array();
|
||||
private static $MimeTypes = [];
|
||||
|
||||
/**
|
||||
* List of names to add to the Cache-Control header.
|
||||
@ -60,7 +60,7 @@ class HTTP
|
||||
* @config
|
||||
* @var array Keys are cache control names, values are boolean flags
|
||||
*/
|
||||
private static $cache_control = array();
|
||||
private static $cache_control = [];
|
||||
|
||||
/**
|
||||
* Vary string; A comma separated list of var header names
|
||||
@ -146,7 +146,7 @@ class HTTP
|
||||
}
|
||||
|
||||
// Replace attributes
|
||||
$attribs = array("src", "background", "a" => "href", "link" => "href", "base" => "href");
|
||||
$attribs = ["src", "background", "a" => "href", "link" => "href", "base" => "href"];
|
||||
$regExps = [];
|
||||
foreach ($attribs as $tag => $attrib) {
|
||||
if (!is_numeric($tag)) {
|
||||
@ -161,7 +161,7 @@ class HTTP
|
||||
}
|
||||
// Replace css styles
|
||||
// @todo - http://www.css3.info/preview/multiple-backgrounds/
|
||||
$styles = array('background-image', 'background', 'list-style-image', 'list-style', 'content');
|
||||
$styles = ['background-image', 'background', 'list-style-image', 'list-style', 'content'];
|
||||
foreach ($styles as $style) {
|
||||
$regExps[] = "/($style:[^;]*url *\\(\")([^\"]+)(\"\\))/i";
|
||||
$regExps[] = "/($style:[^;]*url *\\(')([^']+)('\\))/i";
|
||||
@ -222,7 +222,7 @@ class HTTP
|
||||
}
|
||||
|
||||
// Parse params and add new variable
|
||||
$params = array();
|
||||
$params = [];
|
||||
if (isset($parts['query'])) {
|
||||
parse_str($parts['query'], $params);
|
||||
}
|
||||
@ -281,14 +281,14 @@ class HTTP
|
||||
*/
|
||||
public static function findByTagAndAttribute($content, $attributes)
|
||||
{
|
||||
$regexes = array();
|
||||
$regexes = [];
|
||||
|
||||
foreach ($attributes as $tag => $attribute) {
|
||||
$regexes[] = "/<{$tag} [^>]*$attribute *= *([\"'])(.*?)\\1[^>]*>/i";
|
||||
$regexes[] = "/<{$tag} [^>]*$attribute *= *([^ \"'>]+)/i";
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result = [];
|
||||
|
||||
if ($regexes) {
|
||||
foreach ($regexes as $regex) {
|
||||
@ -308,7 +308,7 @@ class HTTP
|
||||
*/
|
||||
public static function getLinksIn($content)
|
||||
{
|
||||
return self::findByTagAndAttribute($content, array("a" => "href"));
|
||||
return self::findByTagAndAttribute($content, ["a" => "href"]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -318,7 +318,7 @@ class HTTP
|
||||
*/
|
||||
public static function getImagesIn($content)
|
||||
{
|
||||
return self::findByTagAndAttribute($content, array("img" => "src"));
|
||||
return self::findByTagAndAttribute($content, ["img" => "src"]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,7 +444,7 @@ class HTTP
|
||||
}
|
||||
|
||||
// Populate $responseHeaders with all the headers that we want to build
|
||||
$responseHeaders = array();
|
||||
$responseHeaders = [];
|
||||
|
||||
// if no caching ajax requests, disable ajax if is ajax request
|
||||
if (!$config->get('cache_ajax_requests') && Director::is_ajax()) {
|
||||
@ -473,8 +473,7 @@ class HTTP
|
||||
$contentDisposition = $body->getHeader('Content-Disposition');
|
||||
}
|
||||
|
||||
if(
|
||||
$body &&
|
||||
if ($body &&
|
||||
Director::is_https() &&
|
||||
isset($_SERVER['HTTP_USER_AGENT']) &&
|
||||
strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') == true &&
|
||||
@ -550,7 +549,6 @@ class HTTP
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param HTTPResponse|string $response
|
||||
*
|
||||
@ -610,7 +608,7 @@ class HTTP
|
||||
*/
|
||||
protected static function combineVary($vary)
|
||||
{
|
||||
$varies = array();
|
||||
$varies = [];
|
||||
foreach (func_get_args() as $arg) {
|
||||
$argVaries = array_filter(preg_split("/\s*,\s*/", trim($arg)));
|
||||
if ($argVaries) {
|
||||
|
@ -132,7 +132,7 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
|
||||
* @config
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_directives = array(
|
||||
private static $allowed_directives = [
|
||||
'public',
|
||||
'private',
|
||||
'no-cache',
|
||||
@ -142,7 +142,7 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
|
||||
'proxy-revalidate',
|
||||
'no-store',
|
||||
'no-transform',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Set current state. Should only be invoked internally after processing precedence rules.
|
||||
@ -542,9 +542,9 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
|
||||
*/
|
||||
public function generateHeaders()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'Cache-Control' => $this->generateCacheHeader(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user