More codacy fixes (#256)

* single quotes to double

* Avoid variables with short names like $a. Configured minimum length is 3.

* list_type > listType https://www.codacy.com/app/Pi-hole/AdminLTE/file/4753758893/issues/source?bid=3919163&fileBranchId=3919163#l30

* define `refresh` before it is used

* single to double quotes

* EsLint expects `{}` after `if`

* singlequotes to doublequotes

* https://www.codacy.com/app/Pi-hole/AdminLTE/file/4753758894/issues/source?bid=3919163&fileBranchId=3919163#l49

* Copy filterArray Function from api.php

* missed a single-quote

* single>double

* `===`, `==`

* single to double

* Usages come AFTER declarations

* missing semi

* function delcaration order change

* more codacy complaints
This commit is contained in:
Adam Warner
2016-12-16 13:52:51 +00:00
committed by GitHub
parent ff5fbfa4bd
commit ee41a78bdd
6 changed files with 185 additions and 170 deletions

14
api.php
View File

@@ -80,16 +80,16 @@
$data = array_merge($data, getGravityDomains($gravity));
}
function filterArray(&$a) {
$sanArray = array();
foreach ($a as $k=>$v) {
if (is_array($v)) {
$sanArray[htmlspecialchars($k)] = filterArray($v);
function filterArray(&$inArray) {
$outArray = array();
foreach ($inArray as $key=>$value) {
if (is_array($value)) {
$outArray[htmlspecialchars($key)] = filterArray($value);
} else {
$sanArray[htmlspecialchars($k)] = htmlspecialchars($v);
$outArray[htmlspecialchars($key)] = htmlspecialchars($value);
}
}
return $sanArray;
return $outArray;
}
$data = filterArray($data);