@@ -96,8 +96,9 @@ discard block |
||
| 96 | 96 | public function getItems() |
| 97 | 97 | { |
| 98 | 98 | // if we haven't or can't map a map request we can't have any values |
| 99 | - if (empty($this->dataMapKey)) |
|
| 100 | - return []; |
|
| 99 | + if (empty($this->dataMapKey)) { |
|
| 100 | + return []; |
|
| 101 | + } |
|
| 101 | 102 | |
| 102 | 103 | $provider = $this->getProviderService(); |
| 103 | 104 | $format = false; |
@@ -119,8 +120,9 @@ discard block |
||
| 119 | 120 | $concat = isset($format['concat']) ? $format['concat'] : ' '; |
| 120 | 121 | $prefix = isset($format['prefix']) ? $format['prefix'] : ''; |
| 121 | 122 | $postfix = isset($format['postfix']) ? $format['postfix'] : ''; |
| 122 | - foreach ($items as $k=>$i) |
|
| 123 | - $items[$k] = $prefix.implode($concat, is_array($i) ? $i : [$i]).$postfix; |
|
| 123 | + foreach ($items as $k=>$i) { |
|
| 124 | + $items[$k] = $prefix.implode($concat, is_array($i) ? $i : [$i]).$postfix; |
|
| 125 | + } |
|
| 124 | 126 | } |
| 125 | 127 | return $items; |
| 126 | 128 | } |
@@ -184,8 +186,9 @@ discard block |
||
| 184 | 186 | public function setValueFromDb($value) |
| 185 | 187 | { |
| 186 | 188 | parent::setValueFromDb($value); |
| 187 | - if (!empty($value)) |
|
| 188 | - $this->makeMapRequest($value); |
|
| 189 | + if (!empty($value)) { |
|
| 190 | + $this->makeMapRequest($value); |
|
| 191 | + } |
|
| 189 | 192 | return $this; |
| 190 | 193 | } |
| 191 | 194 | |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | public function getValue() |
| 32 | 32 | { |
| 33 | 33 | $value = parent::getValue(); |
| 34 | - if (is_array($value)) |
|
| 35 | - return $value; |
|
| 34 | + if (is_array($value)) { |
|
| 35 | + return $value; |
|
| 36 | + } |
|
| 36 | 37 | return ['from' => '', 'to' => '']; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -61,8 +61,9 @@ discard block |
||
| 61 | 61 | // disallow any quotes in the URL to prevent a class of attacks |
| 62 | 62 | if (strpos($value, "'") === false && strpos($value,'"') === false) { |
| 63 | 63 | // prefix with the schema if not provided |
| 64 | - if ($value && $this->absolute && strpos($value, 'http')===false) |
|
| 65 | - $value = str_replace('///','//','https://'.$value); |
|
| 64 | + if ($value && $this->absolute && strpos($value, 'http')===false) { |
|
| 65 | + $value = str_replace('///','//','https://'.$value); |
|
| 66 | + } |
|
| 66 | 67 | // now turn into a link and run through purify to strip |
| 67 | 68 | // out any dodgy shenanigans |
| 68 | 69 | $link = '<a href="'.$value.'">'; |
@@ -71,8 +72,9 @@ discard block |
||
| 71 | 72 | $exploded = explode('"',$safeValue); |
| 72 | 73 | $this->_sanitisedValue = $exploded[1]; |
| 73 | 74 | } |
| 74 | - } else |
|
| 75 | - $this->_sanitisedValue = ''; |
|
| 75 | + } else { |
|
| 76 | + $this->_sanitisedValue = ''; |
|
| 77 | + } |
|
| 76 | 78 | } |
| 77 | 79 | return $this->_sanitisedValue; |
| 78 | 80 | } |
@@ -81,8 +81,9 @@ |
||
| 81 | 81 | $fullConfig = array_merge_recursive($defaultConfigSets, $additionalConfigSets); |
| 82 | 82 | // convert the extraPlugins into a comma separated list as required by ckeditor |
| 83 | 83 | foreach ($fullConfig as $set=>$config) { |
| 84 | - if (isset($config['extraPlugins'])) |
|
| 85 | - $fullConfig[$set]['extraPlugins'] = implode(',', $config['extraPlugins']); |
|
| 84 | + if (isset($config['extraPlugins'])) { |
|
| 85 | + $fullConfig[$set]['extraPlugins'] = implode(',', $config['extraPlugins']); |
|
| 86 | + } |
|
| 86 | 87 | } |
| 87 | 88 | return json_encode($fullConfig); |
| 88 | 89 | } |
@@ -26,7 +26,8 @@ |
||
| 26 | 26 | { |
| 27 | 27 | // do a query |
| 28 | 28 | $ids = neon()->db->query()->from('firefly_file_manager')->select('uuid')->where(['like', 'name', $searchData])->column(); |
| 29 | - if (!empty($ids)) |
|
| 30 | - $query->where($this->getDataKey(), '=', $ids); |
|
| 29 | + if (!empty($ids)) { |
|
| 30 | + $query->where($this->getDataKey(), '=', $ids); |
|
| 31 | + } |
|
| 31 | 32 | } |
| 32 | 33 | } |
| 33 | 34 | \ No newline at end of file |
@@ -352,8 +352,9 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | public function makeField($field, $defaults=[]) |
| 354 | 354 | { |
| 355 | - if (is_array($field)) |
|
| 356 | - $field = $this->createFieldObjectFromConfig($field, $defaults); |
|
| 355 | + if (is_array($field)) { |
|
| 356 | + $field = $this->createFieldObjectFromConfig($field, $defaults); |
|
| 357 | + } |
|
| 357 | 358 | |
| 358 | 359 | if (!($field instanceof IField || $field instanceof Form)) { |
| 359 | 360 | // add this form as the parent form reference |
@@ -422,8 +423,9 @@ discard block |
||
| 422 | 423 | */ |
| 423 | 424 | public function getFieldClassByAlias($alias) |
| 424 | 425 | { |
| 425 | - if (!$this->fieldAliasExists($alias)) |
|
| 426 | - throw new \InvalidArgumentException("There is no alias with the key '$alias' in the Forms fieldAliases array"); |
|
| 426 | + if (!$this->fieldAliasExists($alias)) { |
|
| 427 | + throw new \InvalidArgumentException("There is no alias with the key '$alias' in the Forms fieldAliases array"); |
|
| 428 | + } |
|
| 427 | 429 | return $this->fieldAliases[strtolower($alias)]; |
| 428 | 430 | } |
| 429 | 431 | |
@@ -180,8 +180,9 @@ |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // ignore if this is a deleted field |
| 183 | - if ($field->deleted == 1) |
|
| 184 | - return; |
|
| 183 | + if ($field->deleted == 1) { |
|
| 184 | + return; |
|
| 185 | + } |
|
| 185 | 186 | |
| 186 | 187 | // check if member exists |
| 187 | 188 | $memberRef = $field->getDdsName(); |
@@ -60,8 +60,9 @@ discard block |
||
| 60 | 60 | public function loadFromDb($data) |
| 61 | 61 | { |
| 62 | 62 | foreach ($data as $name => $value) { |
| 63 | - if (!$this->hasField($name)) |
|
| 64 | - $this->addInstance($name); |
|
| 63 | + if (!$this->hasField($name)) { |
|
| 64 | + $this->addInstance($name); |
|
| 65 | + } |
|
| 65 | 66 | $this->getField($name)->setValueFromDb($value); |
| 66 | 67 | } |
| 67 | 68 | } |
@@ -102,8 +103,9 @@ discard block |
||
| 102 | 103 | { |
| 103 | 104 | // throw an exception - should probably cope with this scenario but set |
| 104 | 105 | // a validation to fail rather than throwing toys out of the pram |
| 105 | - if (!is_array($value)) |
|
| 106 | - throw new \InvalidArgumentException('The value should be an array'); |
|
| 106 | + if (!is_array($value)) { |
|
| 107 | + throw new \InvalidArgumentException('The value should be an array'); |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | 110 | foreach($value as $position => $values) { |
| 109 | 111 | if (!$this->hasField($position)) { |
@@ -134,8 +136,9 @@ discard block |
||
| 134 | 136 | public function registerScripts($view=null, $mount=true) |
| 135 | 137 | { |
| 136 | 138 | $view = ($view === null) ? $this->getView() : $view; |
| 137 | - foreach ($this->getTemplate()->getFields() as $field) |
|
| 138 | - $field->registerScripts($view, $mount); |
|
| 139 | + foreach ($this->getTemplate()->getFields() as $field) { |
|
| 140 | + $field->registerScripts($view, $mount); |
|
| 141 | + } |
|
| 139 | 142 | } |
| 140 | 143 | |
| 141 | 144 | /** |
@@ -240,16 +243,18 @@ discard block |
||
| 240 | 243 | { |
| 241 | 244 | // the root path bit can be the the name or the id. |
| 242 | 245 | $bits = explode('.', $path); |
| 243 | - if (!($bits[0] === $this->name)) |
|
| 244 | - throw new \Exception("The first part of the path should be the current repeater name. Repeater form name=$this->name, id=$this->id, path=$path."); |
|
| 246 | + if (!($bits[0] === $this->name)) { |
|
| 247 | + throw new \Exception("The first part of the path should be the current repeater name. Repeater form name=$this->name, id=$this->id, path=$path."); |
|
| 248 | + } |
|
| 245 | 249 | |
| 246 | 250 | // if the repeater has an existing instance - then lets return that |
| 247 | 251 | if ($this->hasField($bits[1])) { |
| 248 | 252 | $field = $this->getField($bits[1]); |
| 249 | 253 | // fields within repeaters should always be forms - so this should never happen |
| 250 | 254 | // but just to ensure we trap the error - lets throw an exception |
| 251 | - if (!$field->isForm()) |
|
| 252 | - throw new \InvalidArgumentException('FormRepeaters should only contain form instances.'); |
|
| 255 | + if (!$field->isForm()) { |
|
| 256 | + throw new \InvalidArgumentException('FormRepeaters should only contain form instances.'); |
|
| 257 | + } |
|
| 253 | 258 | array_splice($bits, 0, 1); |
| 254 | 259 | return $field->getFieldByPath(implode('.', $bits)); |
| 255 | 260 | } |
@@ -83,8 +83,9 @@ discard block |
||
| 83 | 83 | $plugin = $block['plugin']; |
| 84 | 84 | $content = implode("\n",$block['content']); |
| 85 | 85 | $attributes = $block['attributes']; |
| 86 | - if (class_exists($plugin)) |
|
| 87 | - return $plugin::widget(array_merge($attributes, ['content' => $content])); |
|
| 86 | + if (class_exists($plugin)) { |
|
| 87 | + return $plugin::widget(array_merge($attributes, ['content' => $content])); |
|
| 88 | + } |
|
| 88 | 89 | return '<div class="alert alert-danger">unknown plugin: "' . $plugin . '"</div>'; |
| 89 | 90 | } |
| 90 | 91 | |
@@ -151,8 +152,9 @@ discard block |
||
| 151 | 152 | for ($i = $current + 1, $count = count($lines); $i < $count; $i++) { |
| 152 | 153 | $line = $lines[$i]; |
| 153 | 154 | // stop consuming lines if we find the closing tag |
| 154 | - if (strpos($line, $closingTag) !== false) |
|
| 155 | - break; |
|
| 155 | + if (strpos($line, $closingTag) !== false) { |
|
| 156 | + break; |
|
| 157 | + } |
|
| 156 | 158 | $content[] = $line; |
| 157 | 159 | } |
| 158 | 160 | return $content; |