@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function isInEditMode() |
81 | 81 | { |
82 | - if (neon()->session===null) return false; |
|
82 | + if (neon()->session === null) return false; |
|
83 | 83 | return neon()->session->get(self::COBE_EDITING, false); |
84 | 84 | } |
85 | 85 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $params = array_merge($data['page_params'], neon()->request->get(), neon()->request->post()); |
218 | 218 | unset($data['page_params']); |
219 | 219 | $data['params'] = Html::encodeEntities($params); |
220 | - $data['url'] = '/' . neon()->request->pathInfo; |
|
220 | + $data['url'] = '/'.neon()->request->pathInfo; |
|
221 | 221 | $data['uri'] = $_SERVER['REQUEST_URI']; |
222 | 222 | $data['host'] = Url::base(true); |
223 | 223 | $data['editing'] = $this->isInEditMode(); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | // If the number of renders are excessive (4+), issue a warning. |
361 | 361 | if ($numberOfRenders >= 4) |
362 | - \Neon::debug('Excessive number of renders (>=4): ' . $numberOfRenders); |
|
362 | + \Neon::debug('Excessive number of renders (>=4): '.$numberOfRenders); |
|
363 | 363 | |
364 | 364 | // inject assets into template |
365 | 365 | $html = neon()->view->injectHtml($html); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @param |
434 | 434 | * @return string |
435 | 435 | */ |
436 | - protected function canonicaliseRequest(&$dataRequest, $isStatic=false) |
|
436 | + protected function canonicaliseRequest(&$dataRequest, $isStatic = false) |
|
437 | 437 | { |
438 | 438 | if ($isStatic) { |
439 | 439 | $id = $this->createStaticContentId($dataRequest); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } else { |
442 | 442 | $request = array('class'=>null, 'filters'=>[], 'order'=>[], 'limit'=>[]); |
443 | 443 | $dataRequest = array_merge($request, $dataRequest); |
444 | - $id = md5(str_replace([' '],'', json_encode($dataRequest))); |
|
444 | + $id = md5(str_replace([' '], '', json_encode($dataRequest))); |
|
445 | 445 | } |
446 | 446 | return $id; |
447 | 447 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | */ |
467 | 467 | protected function makeDynamicDataRequests() |
468 | 468 | { |
469 | - if (count($this->dynamicDataRequests)>0) { |
|
469 | + if (count($this->dynamicDataRequests) > 0) { |
|
470 | 470 | $dds = $this->getIDdsObjectManagement(); |
471 | 471 | foreach ($this->dynamicDataRequests as $id=>$dr) { |
472 | 472 | $dds->addObjectRequest($dr['class'], $dr['filters'], $dr['order'], $dr['limit'], $id); |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | */ |
493 | 493 | protected function makeStaticDataRequests() |
494 | 494 | { |
495 | - if (count($this->staticDataRequests)>0) { |
|
495 | + if (count($this->staticDataRequests) > 0) { |
|
496 | 496 | $cms = $this->getICmsStaticData(); |
497 | 497 | $data = $cms->bulkStaticContentRequest($this->staticDataRequests); |
498 | 498 | foreach ($data as $i=>$d) |
499 | - $this->requestedData[$i] = ($d===null ? 'not found' : $d); |
|
499 | + $this->requestedData[$i] = ($d === null ? 'not found' : $d); |
|
500 | 500 | $this->staticDataRequests = []; |
501 | 501 | } |
502 | 502 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | protected function hasDataRequests() |
509 | 509 | { |
510 | - return (count($this->staticDataRequests)+count($this->dynamicDataRequests) > 0); |
|
510 | + return (count($this->staticDataRequests) + count($this->dynamicDataRequests) > 0); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -79,7 +79,9 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function isInEditMode() |
81 | 81 | { |
82 | - if (neon()->session===null) return false; |
|
82 | + if (neon()->session===null) { |
|
83 | + return false; |
|
84 | + } |
|
83 | 85 | return neon()->session->get(self::COBE_EDITING, false); |
84 | 86 | } |
85 | 87 | |
@@ -211,8 +213,9 @@ discard block |
||
211 | 213 | $data = $this->_page; |
212 | 214 | // add the nice_id as CmnUrRoute will add this on first parse through Cobe without gets but |
213 | 215 | // not on requests with get parameters which has led to hard-to-debug runtime coding errors |
214 | - if (!isset($data['page_params']['nice_id']) && isset($data['nice_id'])) |
|
215 | - $data['page_params']['nice_id'] = $data['nice_id']; |
|
216 | + if (!isset($data['page_params']['nice_id']) && isset($data['nice_id'])) { |
|
217 | + $data['page_params']['nice_id'] = $data['nice_id']; |
|
218 | + } |
|
216 | 219 | } |
217 | 220 | $params = array_merge($data['page_params'], neon()->request->get(), neon()->request->post()); |
218 | 221 | unset($data['page_params']); |
@@ -255,7 +258,9 @@ discard block |
||
255 | 258 | */ |
256 | 259 | public function getUrlOfPage($id) |
257 | 260 | { |
258 | - if (!$id) return ''; |
|
261 | + if (!$id) { |
|
262 | + return ''; |
|
263 | + } |
|
259 | 264 | return $url = url(['/cms/render/page', 'nice_id'=>$id]); |
260 | 265 | } |
261 | 266 | |
@@ -353,13 +358,15 @@ discard block |
||
353 | 358 | do { |
354 | 359 | $numberOfRenders++; |
355 | 360 | $html = $renderer->renderTemplate($template); |
356 | - if (($hasDataRequests = $this->hasDataRequests())) |
|
357 | - $this->makeDataRequests(); |
|
361 | + if (($hasDataRequests = $this->hasDataRequests())) { |
|
362 | + $this->makeDataRequests(); |
|
363 | + } |
|
358 | 364 | } while ($hasDataRequests == true); |
359 | 365 | |
360 | 366 | // If the number of renders are excessive (4+), issue a warning. |
361 | - if ($numberOfRenders >= 4) |
|
362 | - \Neon::debug('Excessive number of renders (>=4): ' . $numberOfRenders); |
|
367 | + if ($numberOfRenders >= 4) { |
|
368 | + \Neon::debug('Excessive number of renders (>=4): ' . $numberOfRenders); |
|
369 | + } |
|
363 | 370 | |
364 | 371 | // inject assets into template |
365 | 372 | $html = neon()->view->injectHtml($html); |
@@ -390,15 +397,17 @@ discard block |
||
390 | 397 | // see if we have the data |
391 | 398 | if (isset($this->requestedData[$id])) { |
392 | 399 | $data = $this->requestedData[$id]; |
393 | - if (!$isStatic && isset($this->requestedDataMeta[$id])) |
|
394 | - $meta = $this->requestedDataMeta[$id]; |
|
400 | + if (!$isStatic && isset($this->requestedDataMeta[$id])) { |
|
401 | + $meta = $this->requestedDataMeta[$id]; |
|
402 | + } |
|
395 | 403 | return true; |
396 | 404 | } |
397 | 405 | // if not then add it to the list of requested data |
398 | - if ($isStatic) |
|
399 | - $this->staticDataRequests[$id] = $dataRequest; |
|
400 | - else |
|
401 | - $this->dynamicDataRequests[$id] = $dataRequest; |
|
406 | + if ($isStatic) { |
|
407 | + $this->staticDataRequests[$id] = $dataRequest; |
|
408 | + } else { |
|
409 | + $this->dynamicDataRequests[$id] = $dataRequest; |
|
410 | + } |
|
402 | 411 | return false; |
403 | 412 | } |
404 | 413 | |
@@ -495,8 +504,9 @@ discard block |
||
495 | 504 | if (count($this->staticDataRequests)>0) { |
496 | 505 | $cms = $this->getICmsStaticData(); |
497 | 506 | $data = $cms->bulkStaticContentRequest($this->staticDataRequests); |
498 | - foreach ($data as $i=>$d) |
|
499 | - $this->requestedData[$i] = ($d===null ? 'not found' : $d); |
|
507 | + foreach ($data as $i=>$d) { |
|
508 | + $this->requestedData[$i] = ($d===null ? 'not found' : $d); |
|
509 | + } |
|
500 | 510 | $this->staticDataRequests = []; |
501 | 511 | } |
502 | 512 | } |
@@ -539,8 +549,9 @@ discard block |
||
539 | 549 | private $cmsStaticData = null; |
540 | 550 | private function getICmsStaticData() |
541 | 551 | { |
542 | - if ($this->cmsStaticData === null) |
|
543 | - $this->cmsStaticData = neon('cms')->ICmsStaticData; |
|
552 | + if ($this->cmsStaticData === null) { |
|
553 | + $this->cmsStaticData = neon('cms')->ICmsStaticData; |
|
554 | + } |
|
544 | 555 | return $this->cmsStaticData; |
545 | 556 | } |
546 | 557 |