Passed
Push — releases ( 51c2cc...e1d10c )
by steve
39:06 queued 13:38
created
neon/cms/components/Theme.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param array &$read - the set of read components to prevent infinite looping
67 67
 	 * @return array  the set of components
68 68
 	 */
69
-	private static function &getComponents($path, &$components=[], &$read=[])
69
+	private static function &getComponents($path, &$components = [], &$read = [])
70 70
 	{
71 71
 		$root = self::getRoot();
72 72
 		$configFile = $root.$path.'/_config.php';
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 					}
92 92
 				}
93 93
 			} catch (\Exception $e) {
94
-				throw new \InvalidArgumentException("Something went wrong when trying to parse the config file $configFile. The error was ".$e->getMessage(). ". The file contained <pre>".print_r($config,true)."</pre>.");
94
+				throw new \InvalidArgumentException("Something went wrong when trying to parse the config file $configFile. The error was ".$e->getMessage().". The file contained <pre>".print_r($config, true)."</pre>.");
95 95
 			}
96 96
 		}
97 97
 		return $components;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 			if (is_string($root) && count($themes)) {
30 30
 				foreach ($themes as $theme) {
31 31
 					$themePath = $root.$theme;
32
-					if (!isset($hierarchy[$theme]))
33
-						$hierarchy[$theme] = [];
32
+					if (!isset($hierarchy[$theme])) {
33
+											$hierarchy[$theme] = [];
34
+					}
34 35
 
35 36
 					// add the default template and plugin directories
36 37
 					$hierarchy[$theme]['templates'][] = $themePath;
@@ -104,8 +105,9 @@  discard block
 block discarded – undo
104 105
 	private static function getRoot()
105 106
 	{
106 107
 		static $root = null;
107
-		if ($root === null)
108
-			$root = Neon::getAlias('@root/themes/');
108
+		if ($root === null) {
109
+					$root = Neon::getAlias('@root/themes/');
110
+		}
109 111
 		return $root;
110 112
 	}
111 113
 }
Please login to merge, or discard this patch.
neon/cms/components/Widget.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		if (isset($params['type'])) {
117 117
 			$defaults['type'] = $params['type'];
118 118
 			// path to the file is determined by the theme hierarchy
119
-			$defaults['file'] = $params['type'] . '.tpl';
119
+			$defaults['file'] = $params['type'].'.tpl';
120 120
 			if (isset($params['key']))
121 121
 				self::buildDataFromCmsKeyAttributes($params);
122 122
  		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			return $this->createStaticEditable($content);
232 232
 		} else {
233 233
 			$file = $this->params['file'];
234
-			$this->params['hasData'] = count($this->data)>0;
234
+			$this->params['hasData'] = count($this->data) > 0;
235 235
 			$this->params['hasResponse'] = true;
236 236
 			$this->params['data'] = $this->data;
237 237
 			$this->params['edit'] = $this->createDynamicEditable();
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	public function getId()
298 298
 	{
299 299
 		if ($this->_id === null) {
300
-			$this->_id = $this->getPage()->getId() . '_' . static::$autoIdPrefix . static::$counter++;
300
+			$this->_id = $this->getPage()->getId().'_'.static::$autoIdPrefix.static::$counter++;
301 301
 		}
302 302
 		return $this->_id;
303 303
 	}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			$dataKey = $this->params['data-key'];
340 340
 			$dataPageId = $this->params['data-page-id'];
341 341
 			if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0)))
342
-				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>';
342
+				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 343
 			else
344 344
 				return "<div style='display:inline-block;' class='cobe-editable cobe-static'  data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</div>";
345 345
 		} else {
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -117,11 +117,13 @@  discard block
 block discarded – undo
117 117
 			$defaults['type'] = $params['type'];
118 118
 			// path to the file is determined by the theme hierarchy
119 119
 			$defaults['file'] = $params['type'] . '.tpl';
120
-			if (isset($params['key']))
121
-				self::buildDataFromCmsKeyAttributes($params);
120
+			if (isset($params['key'])) {
121
+							self::buildDataFromCmsKeyAttributes($params);
122
+			}
122 123
  		}
123
-		if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class']))
124
-			Daedalus::buildDataFromDdsAttributes($params);
124
+		if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class'])) {
125
+					Daedalus::buildDataFromDdsAttributes($params);
126
+		}
125 127
 		$resolvedParams = ArrayHelper::merge($defaults, $params);
126 128
 		$out = $widget->render($resolvedParams, $template);
127 129
 		return $out;
@@ -170,8 +172,9 @@  discard block
 block discarded – undo
170 172
 		}
171 173
 		// scb = static content block
172 174
 		$params['type'] = '_scb';
173
-		if (isset($params['key']))
174
-			self::buildDataFromCmsKeyAttributes($params);
175
+		if (isset($params['key'])) {
176
+					self::buildDataFromCmsKeyAttributes($params);
177
+		}
175 178
 		$params['content'] = $content;
176 179
 		$params['wys'] = (isset($params['wys']) ? $params['wys'] : true);
177 180
 		return $widget->render($params, $template);
@@ -207,8 +210,9 @@  discard block
 block discarded – undo
207 210
 		$data = [];
208 211
 		if (($dataRequest = $this->getDataRequest()) !== null) {
209 212
 			$id = $meta = null;
210
-			if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta))
211
-				return $id;
213
+			if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta)) {
214
+							return $id;
215
+			}
212 216
 			$this->saveData($data);
213 217
 			$this->saveDataMetaInformation($meta);
214 218
 		}
@@ -238,8 +242,9 @@  discard block
 block discarded – undo
238 242
 			$this->params['meta'] = $this->meta;
239 243
 
240 244
 			// createTemplate is an expensive call so only call it once per file and reset all variables on the stored template.
241
-			if (!isset($templates[$file]))
242
-				$templates[$file] = $this->renderer->createTemplate($file);
245
+			if (!isset($templates[$file])) {
246
+							$templates[$file] = $this->renderer->createTemplate($file);
247
+			}
243 248
 			$tpl = $templates[$file];
244 249
 			$tpl->tpl_vars = $tpl->config_vars = [];
245 250
 
@@ -257,8 +262,9 @@  discard block
 block discarded – undo
257 262
 	 */
258 263
 	protected function getDataRequest()
259 264
 	{
260
-		if (isset($this->params['data']))
261
-			return Daedalus::convertDataRequestToJson($this->params['data']);
265
+		if (isset($this->params['data'])) {
266
+					return Daedalus::convertDataRequestToJson($this->params['data']);
267
+		}
262 268
 		return null;
263 269
 	}
264 270
 
@@ -314,15 +320,17 @@  discard block
 block discarded – undo
314 320
 	 */
315 321
 	protected static function buildDataFromCmsKeyAttributes(&$params)
316 322
 	{
317
-		if (!isset($params['type'], $params['key']))
318
-			return;
323
+		if (!isset($params['type'], $params['key'])) {
324
+					return;
325
+		}
319 326
 		$key = "$params[type]_$params[key]";
320 327
 		$pageId = isset($params['page']) ? self::$page->getId() : null;
321 328
 		$params['data-key'] = $key;
322 329
 		$params['data-page-id'] = $pageId;
323 330
 		$params['data'] = "'key':'$key','pageId':'$pageId'";
324
-		if (!isset($params['content']))
325
-			$params['content'] = "Add Content for $params[key] here";
331
+		if (!isset($params['content'])) {
332
+					$params['content'] = "Add Content for $params[key] here";
333
+		}
326 334
 		$params['is_static'] = true;
327 335
 	}
328 336
 
@@ -338,10 +346,11 @@  discard block
 block discarded – undo
338 346
 		if ($this->getPage()->isInEditMode()) {
339 347
 			$dataKey = $this->params['data-key'];
340 348
 			$dataPageId = $this->params['data-page-id'];
341
-			if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0)))
342
-				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
-			else
344
-				return "<div style='display:inline-block;' class='cobe-editable cobe-static'  data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</div>";
349
+			if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0))) {
350
+							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>';
351
+			} else {
352
+							return "<div style='display:inline-block;' class='cobe-editable cobe-static'  data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</div>";
353
+			}
345 354
 		} else {
346 355
 			return $value;
347 356
 		}
Please login to merge, or discard this patch.
neon/cms/components/Daedalus.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * @param array $params  any paramters from @see dds and dds_choice
174 174
 	 * @param object $renderer  the render object
175 175
 	 */
176
-	public function __construct($params, $renderer=null)
176
+	public function __construct($params, $renderer = null)
177 177
 	{
178 178
 		$this->params = $params;
179 179
 		$this->renderer = $renderer;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			$request = self::convertDataRequestToJson($this->params['data']);
199 199
 			$responded = self::$page->requestWidgetData($request, $data, $id, false, $meta);
200 200
 			if ($responded) {
201
-				$result['hasData'] = count($data)>0;
201
+				$result['hasData'] = count($data) > 0;
202 202
 				$result['hasResponse'] = true;
203 203
 				$result['data'] = $data;
204 204
 				$result['meta'] = $meta;
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
 	 * @return null|errors|data  returns errors if not valid, null if called
224 224
 	 *   from within a template and the data if from within a plugin
225 225
 	 */
226
-	protected function queryChoice($template=true)
226
+	protected function queryChoice($template = true)
227 227
 	{
228 228
 		// check usage
229 229
 		if (!isset($this->params['member']))
230
-			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
230
+			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params, true);
231 231
 		if ($this->renderer && !isset($this->params['assign']))
232
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
233
-		if (strpos($this->params['member'],':') === false && !isset($this->params['class']))
232
+			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params, true);
233
+		if (strpos($this->params['member'], ':') === false && !isset($this->params['class']))
234 234
 			return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
235 235
 
236 236
 		// extract out class and member
237 237
 		$class = null;
238 238
 		$member = null;
239
-		if (strpos($this->params['member'],':') !== false)
240
-			list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
239
+		if (strpos($this->params['member'], ':') !== false)
240
+			list ($class, $member) = explode(':', str_replace('::', ':', $this->params['member']));
241 241
 		else {
242 242
 			$class = $this->params['class'];
243 243
 			$member = $this->params['member'];
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	{
286 286
 		// check usage
287 287
 		if (!isset($this->params['class']))
288
-			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
288
+			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params, true);
289 289
 
290 290
 		if ($this->renderer && !isset($this->params['assign']))
291
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
291
+			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params, true);
292 292
 
293 293
 		$fields = isset($this->params['fields']) ? $this->params['fields'] : [];
294 294
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 				if (is_array($dps['dds_filter']))
386 386
 					$filters[] = json_encode($dps['dds_filter']);
387 387
 				// else deprecated json approach
388
-				else if (strpos(trim($dps['dds_filter']), '[')!==0)
388
+				else if (strpos(trim($dps['dds_filter']), '[') !== 0)
389 389
 					$filters[] = "[$dps[dds_filter]]";
390 390
 				else
391 391
 					$filters[] = $dps['dds_filter'];
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
 			// create the filters clause
395 395
 			if (count($filters))
396
-				$data[] = "'filters':".implode(',',$filters);
396
+				$data[] = "'filters':".implode(',', $filters);
397 397
 
398 398
 			// sort out the order
399 399
 			if (isset($dps['dds_order'])) {
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 				$classType = $d['_class_type'];
459 459
 				foreach ($d as $field=>$value) {
460 460
 					// ignore all bookkeeping fields
461
-					if (strpos($field, '_')===0)
461
+					if (strpos($field, '_') === 0)
462 462
 						continue;
463 463
 					$edit[$i][$field] = self::createFieldEditable($classType, $field, $d['_uuid'], $value);
464 464
 				}
Please login to merge, or discard this patch.
Braces   +94 added lines, -68 removed lines patch added patch discarded remove patch
@@ -205,10 +205,11 @@  discard block
 block discarded – undo
205 205
 				$result['edit'] = $this->createEditable($data);
206 206
 			}
207 207
 		}
208
-		if ($this->renderer)
209
-			$this->renderer->assign($this->params['assign'], $result);
210
-		else
211
-			return $result;
208
+		if ($this->renderer) {
209
+					$this->renderer->assign($this->params['assign'], $result);
210
+		} else {
211
+					return $result;
212
+		}
212 213
 	}
213 214
 
214 215
 	/**
@@ -226,19 +227,22 @@  discard block
 block discarded – undo
226 227
 	protected function queryChoice($template=true)
227 228
 	{
228 229
 		// check usage
229
-		if (!isset($this->params['member']))
230
-			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
231
-		if ($this->renderer && !isset($this->params['assign']))
232
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
233
-		if (strpos($this->params['member'],':') === false && !isset($this->params['class']))
234
-			return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
230
+		if (!isset($this->params['member'])) {
231
+					return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
232
+		}
233
+		if ($this->renderer && !isset($this->params['assign'])) {
234
+					return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
235
+		}
236
+		if (strpos($this->params['member'],':') === false && !isset($this->params['class'])) {
237
+					return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
238
+		}
235 239
 
236 240
 		// extract out class and member
237 241
 		$class = null;
238 242
 		$member = null;
239
-		if (strpos($this->params['member'],':') !== false)
240
-			list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
241
-		else {
243
+		if (strpos($this->params['member'],':') !== false) {
244
+					list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
245
+		} else {
242 246
 			$class = $this->params['class'];
243 247
 			$member = $this->params['member'];
244 248
 		}
@@ -250,10 +254,11 @@  discard block
 block discarded – undo
250 254
 		if (!isset(self::$_choices[$key])) {
251 255
 			$dds = neon('dds')->iDdsClassManagement;
252 256
 			$result = $dds->getMember($class, $member, ['choices']);
253
-			if (!empty($result) && isset($result['choices']))
254
-				self::$_choices[$key] = $result['choices'];
255
-			else
256
-				self::$_choices[$key] = [];
257
+			if (!empty($result) && isset($result['choices'])) {
258
+							self::$_choices[$key] = $result['choices'];
259
+			} else {
260
+							self::$_choices[$key] = [];
261
+			}
257 262
 		}
258 263
 		$choices = self::$_choices[$key];
259 264
 		if (isset($this->params['order'])) {
@@ -263,10 +268,11 @@  discard block
 block discarded – undo
263 268
 				asort($choices);
264 269
 			}
265 270
 		}
266
-		if ($this->renderer)
267
-			$this->renderer->assign($this->params['assign'], $choices);
268
-		else
269
-			return $choices;
271
+		if ($this->renderer) {
272
+					$this->renderer->assign($this->params['assign'], $choices);
273
+		} else {
274
+					return $choices;
275
+		}
270 276
 	}
271 277
 
272 278
 	/**
@@ -284,11 +290,13 @@  discard block
 block discarded – undo
284 290
 	protected function queryMap()
285 291
 	{
286 292
 		// check usage
287
-		if (!isset($this->params['class']))
288
-			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
293
+		if (!isset($this->params['class'])) {
294
+					return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
295
+		}
289 296
 
290
-		if ($this->renderer && !isset($this->params['assign']))
291
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
297
+		if ($this->renderer && !isset($this->params['assign'])) {
298
+					return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
299
+		}
292 300
 
293 301
 		$fields = isset($this->params['fields']) ? $this->params['fields'] : [];
294 302
 
@@ -307,11 +315,13 @@  discard block
 block discarded – undo
307 315
 			self::$_maps[$class] = $result;
308 316
 		}
309 317
 		$map = self::$_maps[$class];
310
-		if (isset($this->params['flip']))
311
-			$map = array_flip($map);
318
+		if (isset($this->params['flip'])) {
319
+					$map = array_flip($map);
320
+		}
312 321
 
313
-		if ($this->renderer)
314
-			$this->renderer->assign($this->params['assign'], $map);
322
+		if ($this->renderer) {
323
+					$this->renderer->assign($this->params['assign'], $map);
324
+		}
315 325
 
316 326
 		return $map;
317 327
 	}
@@ -328,11 +338,13 @@  discard block
 block discarded – undo
328 338
 		$json = trim(str_replace("'", '"', $data));
329 339
 		if (strlen($json) > 0) {
330 340
 			// for convenience the beginning and ending brackets are optional so add if not supplied
331
-			if (strpos($json, '{') !== 0)
332
-				$json = '{'.$json.'}';
341
+			if (strpos($json, '{') !== 0) {
342
+							$json = '{'.$json.'}';
343
+			}
333 344
 			$request = json_decode($json, true);
334
-			if ($request === null)
335
-				throw new \Exception("Failing to json decode the data request: $json converted from $data. ");
345
+			if ($request === null) {
346
+							throw new \Exception("Failing to json decode the data request: $json converted from $data. ");
347
+			}
336 348
 		}
337 349
 		return $request;
338 350
 	}
@@ -357,10 +369,12 @@  discard block
 block discarded – undo
357 369
 		$dps = array_intersect_key($params, array_flip($dpa));
358 370
 		if (count($dps)) {
359 371
 			$data = [];
360
-			if ((isset($dps['dds']) || isset($dps['dds_page'])) && empty($dps['dds_class']))
361
-				$dps['dds_class'] = $params['type'];
362
-			if (isset($dps['dds_class']))
363
-				$data[] = "'class':'$dps[dds_class]'";
372
+			if ((isset($dps['dds']) || isset($dps['dds_page'])) && empty($dps['dds_class'])) {
373
+							$dps['dds_class'] = $params['type'];
374
+			}
375
+			if (isset($dps['dds_class'])) {
376
+							$data[] = "'class':'$dps[dds_class]'";
377
+			}
364 378
 
365 379
 			// create the filters
366 380
 			$filters = [];
@@ -368,51 +382,60 @@  discard block
 block discarded – undo
368 382
 			// create the page specific filter
369 383
 			if (!empty($dps['dds_page'])) {
370 384
 				$pageId = null;
371
-				if ($dps['dds_page'] === true || $dps['dds_page'] === 'true')
372
-					$pageId = self::$page->getId();
373
-				else {
385
+				if ($dps['dds_page'] === true || $dps['dds_page'] === 'true') {
386
+									$pageId = self::$page->getId();
387
+				} else {
374 388
 					// either a nice id or a page id
375 389
 					$pageId = self::$page->niceId2PageId($dps['dds_page']);
376
-					if (!$pageId)
377
-						$pageId = $dps['dds_page'];
390
+					if (!$pageId) {
391
+											$pageId = $dps['dds_page'];
392
+					}
393
+				}
394
+				if ($pageId) {
395
+									$filters[] = "['page_id','=','$pageId']";
378 396
 				}
379
-				if ($pageId)
380
-					$filters[] = "['page_id','=','$pageId']";
381 397
 			}
382 398
 
383 399
 			// add other filters
384 400
 			if (isset($dps['dds_filter']) && !empty($dps['dds_filter'])) {
385
-				if (is_array($dps['dds_filter']))
386
-					$filters[] = json_encode($dps['dds_filter']);
401
+				if (is_array($dps['dds_filter'])) {
402
+									$filters[] = json_encode($dps['dds_filter']);
403
+				}
387 404
 				// else deprecated json approach
388
-				else if (strpos(trim($dps['dds_filter']), '[')!==0)
389
-					$filters[] = "[$dps[dds_filter]]";
390
-				else
391
-					$filters[] = $dps['dds_filter'];
405
+				else if (strpos(trim($dps['dds_filter']), '[')!==0) {
406
+									$filters[] = "[$dps[dds_filter]]";
407
+				} else {
408
+									$filters[] = $dps['dds_filter'];
409
+				}
392 410
 			}
393 411
 
394 412
 			// create the filters clause
395
-			if (count($filters))
396
-				$data[] = "'filters':".implode(',',$filters);
413
+			if (count($filters)) {
414
+							$data[] = "'filters':".implode(',',$filters);
415
+			}
397 416
 
398 417
 			// sort out the order
399 418
 			if (isset($dps['dds_order'])) {
400
-				if (is_array($dps['dds_order']))
401
-					$data[] = "'order':".json_encode($dps['dds_order']);
419
+				if (is_array($dps['dds_order'])) {
420
+									$data[] = "'order':".json_encode($dps['dds_order']);
421
+				}
402 422
 				// else deprecated json approach
403
-				else
404
-					$data[] = "'order':{".$dps['dds_order']."}";
423
+				else {
424
+									$data[] = "'order':{".$dps['dds_order']."}";
425
+				}
405 426
 			}
406 427
 
407 428
 			// sort out the limit
408 429
 			if (isset($dps['dds_limit'])) {
409
-				if (is_numeric($dps['dds_limit']))
410
-					$data[] = "'limit':{'length':$dps[dds_limit]}";
411
-				else if (is_array($dps['dds_limit']))
412
-					$data[] = "'limit':".json_encode($dps['dds_limit']);
430
+				if (is_numeric($dps['dds_limit'])) {
431
+									$data[] = "'limit':{'length':$dps[dds_limit]}";
432
+				} else if (is_array($dps['dds_limit'])) {
433
+									$data[] = "'limit':".json_encode($dps['dds_limit']);
434
+				}
413 435
 				// else deprecated json approach
414
-				else
415
-					$data[] = "'limit':{".$dps['dds_limit']."}";
436
+				else {
437
+									$data[] = "'limit':{".$dps['dds_limit']."}";
438
+				}
416 439
 			}
417 440
 			$params['data'] = '{'.implode(', ', $data).'}';
418 441
 		}
@@ -429,8 +452,9 @@  discard block
 block discarded – undo
429 452
 	protected function canonicalise($params)
430 453
 	{
431 454
 		$canon = [];
432
-		if (empty($params['assign']) && $this->renderer !== null)
433
-			throw new \InvalidArgumentException("You must set an 'assign' parameter when using the 'dds' tag");
455
+		if (empty($params['assign']) && $this->renderer !== null) {
456
+					throw new \InvalidArgumentException("You must set an 'assign' parameter when using the 'dds' tag");
457
+		}
434 458
 		foreach ($params as $k => $v) {
435 459
 			if ($k == 'assign') {
436 460
 				$canon[$k] = $v;
@@ -458,8 +482,9 @@  discard block
 block discarded – undo
458 482
 				$classType = $d['_class_type'];
459 483
 				foreach ($d as $field=>$value) {
460 484
 					// ignore all bookkeeping fields
461
-					if (strpos($field, '_')===0)
462
-						continue;
485
+					if (strpos($field, '_')===0) {
486
+											continue;
487
+					}
463 488
 					$edit[$i][$field] = self::createFieldEditable($classType, $field, $d['_uuid'], $value);
464 489
 				}
465 490
 			}
@@ -477,8 +502,9 @@  discard block
 block discarded – undo
477 502
 	 */
478 503
 	public static function createFieldEditable($classType, $field, $key, $value)
479 504
 	{
480
-		if (is_array($value))
481
-			return $value;
505
+		if (is_array($value)) {
506
+					return $value;
507
+		}
482 508
 
483 509
 		/**
484 510
 		 * This needs to be changed to generate an appropriate form to edit the
Please login to merge, or discard this patch.
neon/cms/grid/PageGrid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 
51 51
 
52 52
 		$this->addButtonColumn('edit')
53
-			->addButton('edit', ['/cms/editor/index' , 'id' => '{{nice_id}}'], '', '', '', ['data-toggle' => 'tooltip', 'title'=>'Edit']);
53
+			->addButton('edit', ['/cms/editor/index', 'id' => '{{nice_id}}'], '', '', '', ['data-toggle' => 'tooltip', 'title'=>'Edit']);
54 54
 
55 55
 		$this->addScope('published', 'Published');
56 56
 		$this->addScope('draft', 'Draft');
Please login to merge, or discard this patch.
neon/cms/services/cmsManager/CmsManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 	public function bulkStaticContentRequest($requests)
44 44
 	{
45 45
 		$requestedData = [];
46
-		if (count($requests)>0) {
46
+		if (count($requests) > 0) {
47 47
 			$query = CmsStaticContent::find()
48 48
 				->select("`key`, `page_id` as `pageId`, `content`");
49 49
 			foreach ($requests as $id => $request) {
Please login to merge, or discard this patch.
neon/cms/form/Page.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$theme = neon()->getAlias(neon()->cms->getThemeAlias());
112 112
 		$templates = [];
113
-		foreach(File::findFiles("$theme", ['only' => ['*.tpl', '*.twig']]) as $file) {
113
+		foreach (File::findFiles("$theme", ['only' => ['*.tpl', '*.twig']]) as $file) {
114 114
 			$path = str_replace("$theme/", '', $file);
115 115
 			if (Str::startsWith($path, 'pages/') || Str::startsWith($path, 'partials/')) {
116 116
 				$templates[$path] = $path;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		// create a migration file
178 178
 		$templateFile = __DIR__.'/templates/ddsMigration.php';
179 179
 		$input = file_get_contents($templateFile);
180
-		$output = str_replace('__MIGRATION__',$this->_classname,$input);
180
+		$output = str_replace('__MIGRATION__', $this->_classname, $input);
181 181
 		file_put_contents($this->_file, $output, LOCK_EX);
182 182
 		return $this->_filename;
183 183
 
Please login to merge, or discard this patch.
neon/cms/controllers/DataController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	 * Update a static content widget
60 60
 	 * @return void
61 61
 	 */
62
-	public function actionUpdateContentWidget($content=null)
62
+	public function actionUpdateContentWidget($content = null)
63 63
 	{
64 64
 		$key = neon()->request->post('key');
65 65
 		$content = $content ? $content : neon()->request->postUnsafe('content');
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,17 +39,19 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		// see if we have a key and if not we can do nothing
41 41
 		$key = neon()->request->post('key');
42
-		if (empty($key))
43
-			return;
42
+		if (empty($key)) {
43
+					return;
44
+		}
44 45
 		$content = neon()->request->postUnsafe('content');
45 46
 		$content = Html::sanitise($content, $this->inlineAllowedTags);
46 47
 		$pageId = neon()->request->post('pageId', null);
47 48
 		try {
48 49
 			$result = neon('cms')->getICmsStaticData()->editStaticContent($key, $pageId, $content);
49
-			if ($result === true)
50
-				return ['success'=>true, 'saved'=>$content];
51
-			else
52
-				return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
50
+			if ($result === true) {
51
+							return ['success'=>true, 'saved'=>$content];
52
+			} else {
53
+							return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
54
+			}
53 55
 		} catch (\Exception $e) {
54 56
 			return neon()->debug ? ['success'=>false, 'errors'=>$e->getMessage()] : ['success'=>false];
55 57
 		}
@@ -67,10 +69,11 @@  discard block
 block discarded – undo
67 69
 		$pageId = neon()->request->post('pageId', null);
68 70
 		try {
69 71
 			$result = neon()->cms->getICmsStaticData()->editStaticContent($key, $pageId, $content);
70
-			if ($result === true)
71
-				return ['success'=>true, 'saved'=>$content];
72
-			else if (neon()->debug)
73
-				return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
72
+			if ($result === true) {
73
+							return ['success'=>true, 'saved'=>$content];
74
+			} else if (neon()->debug) {
75
+							return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
76
+			}
74 77
 		} catch (\Exception $e) {
75 78
 			return neon()->debug ? ['success'=>false, 'errors'=>$e->getMessage()] : ['success'=>false];
76 79
 		}
Please login to merge, or discard this patch.
neon/cms/controllers/EditorController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
 	public $layout = '/admin-workbench';
17 17
 
18
-	public function actionIndex($id=null)
18
+	public function actionIndex($id = null)
19 19
 	{
20 20
 		$grid = new \neon\cms\grid\PageGrid();
21 21
 		$pages = $grid->getRows();
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		if ($pageForm->processRequest()) {
41 41
 			if (!$pageForm->save($errors)) {
42 42
 				// something went wrong
43
-				throw new \Exception( 'Something went wrong ' . print_r($errors, true));
43
+				throw new \Exception('Something went wrong '.print_r($errors, true));
44 44
 			}
45 45
 			$data = $pageForm->getData();
46 46
 			return $this->redirect(['/cms/editor/index', 'id' => $data['nice_id']]);
Please login to merge, or discard this patch.
neon/cms/controllers/RenderController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,8 +97,9 @@  discard block
 block discarded – undo
97 97
 		}
98 98
 
99 99
 		$render = $page->render();
100
-		if ($render === false)
101
-			throw new \yii\web\HttpException(404, 'No template found');
100
+		if ($render === false) {
101
+					throw new \yii\web\HttpException(404, 'No template found');
102
+		}
102 103
 
103 104
 		\Neon::endProfile('COBE::RENDER_ACTION', 'cobe');
104 105
 		return $render;
@@ -112,8 +113,9 @@  discard block
 block discarded – undo
112 113
 	{
113 114
 		$request = neon()->request;
114 115
 		$url = $request->get('page');
115
-		if (!$url)
116
-			$this->pageNotFound();
116
+		if (!$url) {
117
+					$this->pageNotFound();
118
+		}
117 119
 		\Neon::app('cms')->page->setByUrl($url);
118 120
 		$pageData = neon()->getCms()->getPage()->getPageData();
119 121
 		return $this->actionPage($pageData['nice_id']);
Please login to merge, or discard this patch.