@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | if (isset($params['type'])) { |
| 118 | 118 | $defaults['type'] = $params['type']; |
| 119 | 119 | // path to the file is determined by the theme hierarchy |
| 120 | - $defaults['file'] = $params['type'] . '.tpl'; |
|
| 120 | + $defaults['file'] = $params['type'].'.tpl'; |
|
| 121 | 121 | if (isset($params['key'])) { |
| 122 | 122 | self::buildDataFromCmsKeyAttributes($params); |
| 123 | 123 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | return $this->createStaticEditable($content); |
| 233 | 233 | } else { |
| 234 | 234 | $file = $this->params['file']; |
| 235 | - $this->params['hasData'] = count($this->data)>0; |
|
| 235 | + $this->params['hasData'] = count($this->data) > 0; |
|
| 236 | 236 | $this->params['hasResponse'] = true; |
| 237 | 237 | $this->params['data'] = $this->data; |
| 238 | 238 | $this->params['edit'] = $this->createDynamicEditable(); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | public function getId() |
| 299 | 299 | { |
| 300 | 300 | if ($this->_id === null) { |
| 301 | - $this->_id = $this->getPage()->getId() . '_' . static::$autoIdPrefix . static::$counter++; |
|
| 301 | + $this->_id = $this->getPage()->getId().'_'.static::$autoIdPrefix.static::$counter++; |
|
| 302 | 302 | } |
| 303 | 303 | return $this->_id; |
| 304 | 304 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $dataKey = $this->params['data-key']; |
| 341 | 341 | $dataPageId = $this->params['data-page-id']; |
| 342 | 342 | if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0))) |
| 343 | - return '<div id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block" contenteditable="true">' . $value . '</div>'; |
|
| 343 | + return '<div id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block" contenteditable="true">'.$value.'</div>'; |
|
| 344 | 344 | else |
| 345 | 345 | return "<div style='display:inline-block;' class='cobe-editable cobe-static' data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</div>"; |
| 346 | 346 | } else { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public static function render($vdom) |
| 42 | 42 | { |
| 43 | - foreach($vdom as $element) { |
|
| 43 | + foreach ($vdom as $element) { |
|
| 44 | 44 | $element[1]($element[2], $element['children']); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | // dd($domArray); |
| 69 | 69 | // Editor::vdom($domArray); |
| 70 | 70 | |
| 71 | - $ele=dom_import_simplexml($x); |
|
| 71 | + $ele = dom_import_simplexml($x); |
|
| 72 | 72 | $dom = new DOMDocument('1.0', 'utf-8'); |
| 73 | - $element=$dom->importNode($ele,true); |
|
| 73 | + $element = $dom->importNode($ele, true); |
|
| 74 | 74 | $element->normalize(); |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | $vdom = []; |
| 78 | - foreach($x as $n) { |
|
| 78 | + foreach ($x as $n) { |
|
| 79 | 79 | Editor::node($vdom, $n); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $props = '{"components":null, "contentKey": "'.$id.'"}'; |
| 96 | 96 | if ($content !== null) { |
| 97 | 97 | // read the json data serialised inside the <!-- ni:editor {json data} --> tag |
| 98 | - $pattern = '/<!--\s+(?P<closer>\/)?ni:editor\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s'; |
|
| 98 | + $pattern = '/<!--\s+(?P<closer>\/)?ni:editor\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s'; |
|
| 99 | 99 | preg_match($pattern, $content, $matches); |
| 100 | 100 | if ($matches) { |
| 101 | 101 | $props = $matches['attrs']; |
@@ -182,18 +182,18 @@ discard block |
||
| 182 | 182 | * [children] => Array |
| 183 | 183 | * [props] => Array |
| 184 | 184 | */ |
| 185 | - public static function renderAsSmarty($node, &$depth=0) |
|
| 185 | + public static function renderAsSmarty($node, &$depth = 0) |
|
| 186 | 186 | { |
| 187 | 187 | $depth++; |
| 188 | 188 | $cmp = $node['cmp']; |
| 189 | 189 | $uuid = $node['uuid']; |
| 190 | 190 | $children = $node['children']; |
| 191 | 191 | $props = $node['props']; |
| 192 | - $out = '{'."$cmp " . static::formatProps($props) . " uuid=\"$uuid\" }\n"; |
|
| 193 | - foreach($children as $child) { |
|
| 194 | - $out .= str_repeat(' ', $depth) . static::renderAsSmarty($child, $depth); |
|
| 192 | + $out = '{'."$cmp ".static::formatProps($props)." uuid=\"$uuid\" }\n"; |
|
| 193 | + foreach ($children as $child) { |
|
| 194 | + $out .= str_repeat(' ', $depth).static::renderAsSmarty($child, $depth); |
|
| 195 | 195 | } |
| 196 | - $out .= str_repeat(' ', $depth-1) . '{/'.$cmp."}\n"; |
|
| 196 | + $out .= str_repeat(' ', $depth - 1).'{/'.$cmp."}\n"; |
|
| 197 | 197 | $depth--; |
| 198 | 198 | return $out; |
| 199 | 199 | } |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | unset($props['children']); |
| 204 | 204 | $formatParams = ''; |
| 205 | - foreach($props as $key => $value) { |
|
| 205 | + foreach ($props as $key => $value) { |
|
| 206 | 206 | if (is_array($value)) $value = var_export($value, true); |
| 207 | - $formatParams .= $key.'="'. $value .'" '; |
|
| 207 | + $formatParams .= $key.'="'.$value.'" '; |
|
| 208 | 208 | } |
| 209 | 209 | return $formatParams; |
| 210 | 210 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public static function createFromTree($cmpIndex, $root) { |
| 220 | 220 | $out = $root; |
| 221 | - foreach($root['children'] as $key => $childId) { |
|
| 221 | + foreach ($root['children'] as $key => $childId) { |
|
| 222 | 222 | if (!empty($out['children'])) { |
| 223 | 223 | $out['children'][$key] = static::createFromTree($cmpIndex, $cmpIndex[$childId]); |
| 224 | 224 | } |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $html = []; |
| 540 | 540 | $params['loading'] = Arr::get($params, 'loading', 'lazy'); |
| 541 | - $params[Arr::get($params, 'srcset-name', 'srcset')] = Arr::get($params, 'srcset', $this->image_srcset(['src' => $id, 'quality'=> $quality, 'widths'=>$widths])); |
|
| 542 | - $params[Arr::get($params, 'src-name', 'src')] = $this->firefly_image(['id' => $id, 'w' => (int)$srcWidth, 'q' => $quality]); |
|
| 541 | + $params[Arr::get($params, 'srcset-name', 'srcset')] = Arr::get($params, 'srcset', $this->image_srcset(['src' => $id, 'quality'=> $quality, 'widths'=>$widths])); |
|
| 542 | + $params[Arr::get($params, 'src-name', 'src')] = $this->firefly_image(['id' => $id, 'w' => (int)$srcWidth, 'q' => $quality]); |
|
| 543 | 543 | |
| 544 | 544 | // alt |
| 545 | 545 | $params['alt'] = Arr::get($params, 'alt', $this->image_alt(['src' => $id])); |
@@ -897,7 +897,4 @@ discard block |
||
| 897 | 897 | if (!empty($params['assign'])) { |
| 898 | 898 | $smarty->assign($params['assign'], $output); |
| 899 | 899 | } else { |
| 900 | - return $output; |
|
| 901 | - } |
|
| 902 | - } |
|
| 903 | -} |
|
| 900 | + return $output |
|
| 904 | 901 | \ No newline at end of file |
@@ -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 | /** |