@@ -94,10 +94,12 @@ |
||
| 94 | 94 | if (count($this->_buttons)) { |
| 95 | 95 | $buttons = []; |
| 96 | 96 | foreach ($this->_buttons as $buttonKey => $btnOps) { |
| 97 | - if (!isset($btnOps['data'])) |
|
| 98 | - $btnOps['data'] = []; |
|
| 99 | - if ($this->getGrid()->hasIndexColumn()) |
|
| 100 | - $btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ]; |
|
| 97 | + if (!isset($btnOps['data'])) { |
|
| 98 | + $btnOps['data'] = []; |
|
| 99 | + } |
|
| 100 | + if ($this->getGrid()->hasIndexColumn()) { |
|
| 101 | + $btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ]; |
|
| 102 | + } |
|
| 101 | 103 | $func = 'buttonCustom'; |
| 102 | 104 | if ($buttonKey === 'delete') { |
| 103 | 105 | $func = 'buttonDelete'; |
@@ -154,8 +154,9 @@ discard block |
||
| 154 | 154 | self::processTags($allowableTags, $tagsProcessed); |
| 155 | 155 | } |
| 156 | 156 | if (is_array($value)) { |
| 157 | - foreach ($value as $k => $v) |
|
| 158 | - $value[$k] = static::sanitise($v, $allowableTags); |
|
| 157 | + foreach ($value as $k => $v) { |
|
| 158 | + $value[$k] = static::sanitise($v, $allowableTags); |
|
| 159 | + } |
|
| 159 | 160 | } else { |
| 160 | 161 | if (!is_null($value)) { |
| 161 | 162 | if (isset($tagsProcessed[$allowableTags])) { |
@@ -189,14 +190,16 @@ discard block |
||
| 189 | 190 | { |
| 190 | 191 | profile_begin('Html::purify', 'html'); |
| 191 | 192 | if (is_array($value)) { |
| 192 | - foreach ($value as $k => $v) |
|
| 193 | - $value[$k] = static::purify($v, $allowedTags); |
|
| 193 | + foreach ($value as $k => $v) { |
|
| 194 | + $value[$k] = static::purify($v, $allowedTags); |
|
| 195 | + } |
|
| 194 | 196 | } else { |
| 195 | 197 | if (!is_null($value)) { |
| 196 | - if ($allowedTags === false) |
|
| 197 | - $value = trim(HtmlPurifier::process($value)); |
|
| 198 | - else |
|
| 199 | - $value = trim(HtmlPurifier::process(strip_tags($value, $allowedTags))); |
|
| 198 | + if ($allowedTags === false) { |
|
| 199 | + $value = trim(HtmlPurifier::process($value)); |
|
| 200 | + } else { |
|
| 201 | + $value = trim(HtmlPurifier::process(strip_tags($value, $allowedTags))); |
|
| 202 | + } |
|
| 200 | 203 | } |
| 201 | 204 | } |
| 202 | 205 | profile_end('Html::purify', 'html'); |
@@ -214,8 +217,9 @@ discard block |
||
| 214 | 217 | public static function encodeEntities($value, $entities = ENT_QUOTES) |
| 215 | 218 | { |
| 216 | 219 | if (is_array($value)) { |
| 217 | - foreach ($value as $k => $v) |
|
| 218 | - $value[$k] = static::encodeEntities($v, $entities); |
|
| 220 | + foreach ($value as $k => $v) { |
|
| 221 | + $value[$k] = static::encodeEntities($v, $entities); |
|
| 222 | + } |
|
| 219 | 223 | } else { |
| 220 | 224 | $value = htmlentities($value, $entities); |
| 221 | 225 | } |
@@ -251,18 +255,22 @@ discard block |
||
| 251 | 255 | */ |
| 252 | 256 | public static function highlight($search, $html, $empty='') |
| 253 | 257 | { |
| 254 | - if ($html === null) |
|
| 255 | - return neon()->formatter->nullDisplay; |
|
| 256 | - if ($html === '') |
|
| 257 | - return $empty; |
|
| 258 | - if (empty($search)) |
|
| 259 | - return $html; |
|
| 258 | + if ($html === null) { |
|
| 259 | + return neon()->formatter->nullDisplay; |
|
| 260 | + } |
|
| 261 | + if ($html === '') { |
|
| 262 | + return $empty; |
|
| 263 | + } |
|
| 264 | + if (empty($search)) { |
|
| 265 | + return $html; |
|
| 266 | + } |
|
| 260 | 267 | |
| 261 | 268 | profile_begin('Html::Highlight'); |
| 262 | 269 | // escape search and html entities as otherwise the loadHTML or appendXML |
| 263 | 270 | // can blow up if there are < & > in the data |
| 264 | - if (!is_array($search)) |
|
| 265 | - $search = [$search]; |
|
| 271 | + if (!is_array($search)) { |
|
| 272 | + $search = [$search]; |
|
| 273 | + } |
|
| 266 | 274 | try { |
| 267 | 275 | foreach ($search as $s) { |
| 268 | 276 | // now search and rebuild the data |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | public function editObject($changes) |
| 42 | 42 | { |
| 43 | 43 | // check if there's anything to do |
| 44 | - if (empty($changes) || $changes == $this->data) |
|
| 45 | - return true; |
|
| 44 | + if (empty($changes) || $changes == $this->data) { |
|
| 45 | + return true; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | // extract the data and save appropriately to |
| 48 | 49 | // the associated database tables ... if any |
@@ -59,8 +60,9 @@ discard block |
||
| 59 | 60 | public function setDataSources($sources) |
| 60 | 61 | { |
| 61 | 62 | foreach ($sources as $key=>$value) { |
| 62 | - if (empty($value)) |
|
| 63 | - unset($sources[$key]); |
|
| 63 | + if (empty($value)) { |
|
| 64 | + unset($sources[$key]); |
|
| 65 | + } |
|
| 64 | 66 | } |
| 65 | 67 | $this->dataSourceIds = $sources; |
| 66 | 68 | } |
@@ -97,8 +99,9 @@ discard block |
||
| 97 | 99 | */ |
| 98 | 100 | protected function getDataSources() |
| 99 | 101 | { |
| 100 | - foreach ($this->dataSourceIds as $key=>$id) |
|
| 101 | - $this->dataSourceObjects[$key] = $this->getDds()->getObject($id); |
|
| 102 | + foreach ($this->dataSourceIds as $key=>$id) { |
|
| 103 | + $this->dataSourceObjects[$key] = $this->getDds()->getObject($id); |
|
| 104 | + } |
|
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | /** |
@@ -118,8 +121,9 @@ discard block |
||
| 118 | 121 | $object = array_merge($this->getAllowedFieldsForClass($object['_classType']), $object); |
| 119 | 122 | // now update the object with the data from daedalus |
| 120 | 123 | $data = $dds->getObject($object['_uuid']); |
| 121 | - if ($data) |
|
| 122 | - $object = array_replace($object, array_intersect_key($data, $object)); |
|
| 124 | + if ($data) { |
|
| 125 | + $object = array_replace($object, array_intersect_key($data, $object)); |
|
| 126 | + } |
|
| 123 | 127 | } |
| 124 | 128 | // recursively update if this is in a tree structure |
| 125 | 129 | if ($isTree && is_array($object)) { |
@@ -179,8 +183,9 @@ discard block |
||
| 179 | 183 | } |
| 180 | 184 | } |
| 181 | 185 | } |
| 182 | - if (count($relations)) |
|
| 183 | - $this->saveLinkedObjects($relations); |
|
| 186 | + if (count($relations)) { |
|
| 187 | + $this->saveLinkedObjects($relations); |
|
| 188 | + } |
|
| 184 | 189 | } |
| 185 | 190 | |
| 186 | 191 | /** |
@@ -216,8 +221,9 @@ discard block |
||
| 216 | 221 | $relations = $renderables[$subRenderable]['relations']; |
| 217 | 222 | foreach ($relations as $relation) { |
| 218 | 223 | $memberRef = $relation['memberRef']; |
| 219 | - if (!isset($extracted['__relations'][$objId][$memberRef])) |
|
| 220 | - $extracted['__relations'][$objId][$memberRef] = []; |
|
| 224 | + if (!isset($extracted['__relations'][$objId][$memberRef])) { |
|
| 225 | + $extracted['__relations'][$objId][$memberRef] = []; |
|
| 226 | + } |
|
| 221 | 227 | $extracted['__relations'][$objId][$memberRef] = array_merge($extracted['__relations'][$objId][$memberRef], $newObjectIds); |
| 222 | 228 | } |
| 223 | 229 | } |
@@ -259,8 +265,9 @@ discard block |
||
| 259 | 265 | if (empty($fieldsForClass[$classType])) { |
| 260 | 266 | $definition = $this->getDefinition(); |
| 261 | 267 | foreach ($definition['renderables'] as $r) { |
| 262 | - if ($r['type'] == 'MemberComponent') |
|
| 263 | - $fieldsForClass[$r['class_type']][$r['member_ref']] = null; |
|
| 268 | + if ($r['type'] == 'MemberComponent') { |
|
| 269 | + $fieldsForClass[$r['class_type']][$r['member_ref']] = null; |
|
| 270 | + } |
|
| 264 | 271 | } |
| 265 | 272 | } |
| 266 | 273 | return $fieldsForClass[$classType]; |
@@ -322,8 +329,9 @@ discard block |
||
| 322 | 329 | if (isset($renderables[$phoebeKey])) { |
| 323 | 330 | // check the renderable exists and is a class component |
| 324 | 331 | $ren = $renderables[$phoebeKey]; |
| 325 | - if ($ren['type'] != 'ClassComponent') |
|
| 326 | - continue; |
|
| 332 | + if ($ren['type'] != 'ClassComponent') { |
|
| 333 | + continue; |
|
| 334 | + } |
|
| 327 | 335 | |
| 328 | 336 | // create the object and any required data params |
| 329 | 337 | $object = [ |
@@ -334,8 +342,9 @@ discard block |
||
| 334 | 342 | foreach ($ren['items'] as $item) { |
| 335 | 343 | if (isset($renderables[$item])) { |
| 336 | 344 | $iRen = $renderables[$item]; |
| 337 | - if ($iRen['type'] != 'MemberComponent') |
|
| 338 | - continue; |
|
| 345 | + if ($iRen['type'] != 'MemberComponent') { |
|
| 346 | + continue; |
|
| 347 | + } |
|
| 339 | 348 | $object[$iRen['member_ref']] = null; |
| 340 | 349 | } |
| 341 | 350 | } |
@@ -455,8 +464,9 @@ discard block |
||
| 455 | 464 | private $_class = null; |
| 456 | 465 | private function getClass() |
| 457 | 466 | { |
| 458 | - if (!$this->_class) |
|
| 459 | - $this->_class = neon('phoebe')->getIPhoebeType($this->phoebeType)->getClass($this->classType); |
|
| 467 | + if (!$this->_class) { |
|
| 468 | + $this->_class = neon('phoebe')->getIPhoebeType($this->phoebeType)->getClass($this->classType); |
|
| 469 | + } |
|
| 460 | 470 | return $this->_class; |
| 461 | 471 | } |
| 462 | 472 | |
@@ -469,8 +479,9 @@ discard block |
||
| 469 | 479 | private $_dds = null; |
| 470 | 480 | private function getDds() |
| 471 | 481 | { |
| 472 | - if (!$this->_dds) |
|
| 473 | - $this->_dds = neon('dds')->getIDdsObjectManagement(); |
|
| 482 | + if (!$this->_dds) { |
|
| 483 | + $this->_dds = neon('dds')->getIDdsObjectManagement(); |
|
| 484 | + } |
|
| 474 | 485 | return $this->_dds; |
| 475 | 486 | } |
| 476 | 487 | |