Commit 4b61811b authored by Franco Fichtner's avatar Franco Fichtner

src: style sweep

parent c2cd032c
...@@ -42,7 +42,7 @@ $di->set('view', function () use ($config) { ...@@ -42,7 +42,7 @@ $di->set('view', function () use ($config) {
'compiledSeparator' => '_' 'compiledSeparator' => '_'
)); ));
// register additional volt template functions // register additional volt template functions
$volt->getCompiler()->addFunction('javascript_include_when_exists', function($local_url) { $volt->getCompiler()->addFunction('javascript_include_when_exists', function ($local_url) {
$chk_path = "str_replace('/ui/','/usr/local/opnsense/www/',".$local_url.")"; $chk_path = "str_replace('/ui/','/usr/local/opnsense/www/',".$local_url.")";
$js_tag = "'<script type=\"text/javascript\" src=\"'.$local_url.'\"></script>'"; $js_tag = "'<script type=\"text/javascript\" src=\"'.$local_url.'\"></script>'";
return "file_exists(".$chk_path.") ? ".$js_tag." :''"; return "file_exists(".$chk_path.") ? ".$js_tag." :''";
......
...@@ -76,7 +76,7 @@ class FilterRule ...@@ -76,7 +76,7 @@ class FilterRule
* @param int $maxsize maximum size, cut when longer * @param int $maxsize maximum size, cut when longer
* @return string * @return string
*/ */
private function parsePlain($value, $prefix="", $suffix="", $maxsize=null) private function parsePlain($value, $prefix = "", $suffix = "", $maxsize = null)
{ {
if (!empty($maxsize) && strlen($value) > $maxsize) { if (!empty($maxsize) && strlen($value) > $maxsize) {
$value = substr($value, 0, $maxsize); $value = substr($value, 0, $maxsize);
...@@ -90,7 +90,7 @@ class FilterRule ...@@ -90,7 +90,7 @@ class FilterRule
* @param string $map * @param string $map
* @return string * @return string
*/ */
private function parseReplaceSimple($value, $map, $prefix="", $suffix="") private function parseReplaceSimple($value, $map, $prefix = "", $suffix = "")
{ {
$retval = $value; $retval = $value;
foreach (explode('|', $map) as $item) { foreach (explode('|', $map) as $item) {
...@@ -145,7 +145,7 @@ class FilterRule ...@@ -145,7 +145,7 @@ class FilterRule
* @param string $value field value * @param string $value field value
* @return string * @return string
*/ */
private function parseBool($value, $valueTrue, $valueFalse="") private function parseBool($value, $valueTrue, $valueFalse = "")
{ {
if (!empty($value)) { if (!empty($value)) {
return !empty($valueTrue) ? $valueTrue . " " : ""; return !empty($valueTrue) ? $valueTrue . " " : "";
...@@ -201,21 +201,21 @@ class FilterRule ...@@ -201,21 +201,21 @@ class FilterRule
} }
if (!isset($tmp['quick'])) { if (!isset($tmp['quick'])) {
// all rules are quick by default except floating // all rules are quick by default except floating
$tmp['quick'] = !isset($rule['floating']) ? true : false ; $tmp['quick'] = !isset($rule['floating']) ? true : false;
} }
// restructure state settings for easier output parsing // restructure state settings for easier output parsing
if (!empty($tmp['statetype'])) { if (!empty($tmp['statetype'])) {
$tmp['state'] = array('type' => 'keep', 'options' => array()); $tmp['state'] = array('type' => 'keep', 'options' => array());
switch ($tmp['statetype']) { switch ($tmp['statetype']) {
case 'none': case 'none':
$tmp['state']['type'] = 'no'; $tmp['state']['type'] = 'no';
break; break;
case 'sloppy state': case 'sloppy state':
$tmp['state']['type'] = 'keep'; $tmp['state']['type'] = 'keep';
$tmp['state']['options'][] = "sloppy "; $tmp['state']['options'][] = "sloppy ";
break; break;
default: default:
$tmp['state']['type'] = explode(' ', $tmp['statetype'])[0]; $tmp['state']['type'] = explode(' ', $tmp['statetype'])[0];
} }
if (!empty($tmp['nopfsync'])) { if (!empty($tmp['nopfsync'])) {
$tmp['state']['options'][] = "no-sync "; $tmp['state']['options'][] = "no-sync ";
...@@ -254,7 +254,7 @@ class FilterRule ...@@ -254,7 +254,7 @@ class FilterRule
* output rule as string * output rule as string
* @return string ruleset * @return string ruleset
*/ */
public function __toString() public function __toString()
{ {
$ruleTxt = ''; $ruleTxt = '';
foreach ($this->fetchActualRules() as $rule) { foreach ($this->fetchActualRules() as $rule) {
......
...@@ -74,7 +74,7 @@ class Plugin ...@@ -74,7 +74,7 @@ class Plugin
* @param string $placement placement head,tail * @param string $placement placement head,tail
* @return null * @return null
*/ */
public function registerAnchor($name, $type="fw", $priority=0, $placement="tail") public function registerAnchor($name, $type = "fw", $priority = 0, $placement = "tail")
{ {
$anchorKey = sprintf("%s.%s.%08d.%08d", $type, $placement, $priority, count($this->anchors)); $anchorKey = sprintf("%s.%s.%08d.%08d", $type, $placement, $priority, count($this->anchors));
$this->anchors[$anchorKey] = $name; $this->anchors[$anchorKey] = $name;
...@@ -87,7 +87,7 @@ class Plugin ...@@ -87,7 +87,7 @@ class Plugin
* @param string $placement placement head,tail * @param string $placement placement head,tail
* @return string * @return string
*/ */
public function anchorToText($types="fw", $placement="tail") public function anchorToText($types = "fw", $placement = "tail")
{ {
$result = ""; $result = "";
foreach (explode(',', $types) as $type) { foreach (explode(',', $types) as $type) {
...@@ -107,7 +107,7 @@ class Plugin ...@@ -107,7 +107,7 @@ class Plugin
* @param array $conf configuration * @param array $conf configuration
* @param array $defaults merge these defaults when provided * @param array $defaults merge these defaults when provided
*/ */
public function registerFilterRule($prio, $conf, $defaults=null) public function registerFilterRule($prio, $conf, $defaults = null)
{ {
if ($defaults != null) { if ($defaults != null) {
$conf = array_merge($defaults, $conf); $conf = array_merge($defaults, $conf);
......
...@@ -469,7 +469,7 @@ abstract class BaseModel ...@@ -469,7 +469,7 @@ abstract class BaseModel
if ($messages->count() > 0) { if ($messages->count() > 0) {
$exception_msg = ""; $exception_msg = "";
foreach ($messages as $msg) { foreach ($messages as $msg) {
$exception_msg_part = "[".str_replace("\\", ".", get_class($this)).".".$msg-> getField(). "] " ; $exception_msg_part = "[".str_replace("\\", ".", get_class($this)).".".$msg-> getField(). "] ";
$exception_msg_part .= $msg->getMessage(); $exception_msg_part .= $msg->getMessage();
$exception_msg .= "$exception_msg_part\n"; $exception_msg .= "$exception_msg_part\n";
// always log validation errors // always log validation errors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment