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