Test Failed
Push — develop ( ff58ad...b8f9b2 )
by steve
13:44 queued 12s
created
neon/cms/controllers/RenderController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * slug it uses - without this property the canonical function will return the url of the first blog-post
83 83
 	 * (collection page) it finds.
84 84
 	 */
85
-	public function actionPage($nice_id, $slug='')
85
+	public function actionPage($nice_id, $slug = '')
86 86
 	{
87 87
 		\Neon::beginProfile('COBE::RENDER_ACTION', 'cobe');
88 88
 		$cms = $this->getCms();
89 89
 		$page = $cms->getPage();
90 90
 		// check the page with the nice_id exists
91
-		if (! $page->setById($nice_id)) {
91
+		if (!$page->setById($nice_id)) {
92 92
 			$this->pageNotFound();
93 93
 		}
94 94
 		//return neon()->view->injectHtml('');
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		}
104 104
 
105 105
 		// Don't display draft pages unless in edit mode.
106
-		if ($page->isStatusDraft() && ! $page->isInEditMode()) {
106
+		if ($page->isStatusDraft() && !$page->isInEditMode()) {
107 107
 			$this->pageNotFound();
108 108
 		}
109 109
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 			->innerJoin(CmsPage::tableName(), 'cms_page.nice_id = cms_url.nice_id')
136 136
 			->where("status='PUBLISHED'")
137 137
 			->all()
138
-		)->reduce(function($carry, $url){
139
-			return $carry . "\t<url>\n\t\t<loc>" . url($url['url'], true) . "</loc>\n\t</url>" . "\n";
138
+		)->reduce(function($carry, $url) {
139
+			return $carry."\t<url>\n\t\t<loc>".url($url['url'], true)."</loc>\n\t</url>"."\n";
140 140
 		});
141 141
 		header('Content-Type:application/rss+xml');
142 142
 		echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
 		}
109 109
 
110 110
 		$render = $page->render();
111
-		if ($render === false)
112
-			throw new \yii\web\HttpException(404, 'No template found');
111
+		if ($render === false) {
112
+					throw new \yii\web\HttpException(404, 'No template found');
113
+		}
113 114
 
114 115
 		\Neon::endProfile('COBE::RENDER_ACTION', 'cobe');
115 116
 
@@ -153,10 +154,12 @@  discard block
 block discarded – undo
153 154
 	{
154 155
 		$request = neon()->request;
155 156
 		$url = $request->get('page');
156
-		if (!$url)
157
-			$this->pageNotFound();
158
-		if (($urlEntry = CmsUrl::findByUrl($url)))
159
-			return $this->actionPage($urlEntry['nice_id']);
157
+		if (!$url) {
158
+					$this->pageNotFound();
159
+		}
160
+		if (($urlEntry = CmsUrl::findByUrl($url))) {
161
+					return $this->actionPage($urlEntry['nice_id']);
162
+		}
160 163
 		$this->pageNotFound();
161 164
 	}
162 165
 
Please login to merge, or discard this patch.
neon/core/web/UrlManager.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	public function getCanonical()
23 23
 	{
24 24
 		$params = neon()->controller->actionParams;
25
-        $params[0] = neon()->controller->getRoute();
25
+		$params[0] = neon()->controller->getRoute();
26 26
 		$urlManager = neon()->getUrlManager();
27 27
 		$url = $urlManager->createUrl($params);
28 28
 		if (strpos($url, '://') === false) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 		if (strpos($url, '://') === false) {
29 29
 			$hostInfo = setting('cms', 'canonical', $urlManager->getHostInfo());
30 30
 			if (strncmp($url, '//', 2) === 0) {
31
-				$url = substr($hostInfo, 0, strpos($hostInfo, '://')) . ':' . $url;
31
+				$url = substr($hostInfo, 0, strpos($hostInfo, '://')).':'.$url;
32 32
 			} else {
33
-				$url = $hostInfo . $url;
33
+				$url = $hostInfo.$url;
34 34
 			}
35 35
 		}
36 36
 		return Url::ensureScheme($url, null);
Please login to merge, or discard this patch.
neon/core/view/SmartySharedPlugins.php 5 patches
Indentation   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -923,7 +923,4 @@
 block discarded – undo
923 923
 		if (!empty($params['assign'])) {
924 924
 			$smarty->assign($params['assign'], $output);
925 925
 		} else {
926
-			return $output;
927
-		}
928
-	}
929
-}
926
+			return $output
930 927
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -923,7 +923,4 @@
 block discarded – undo
923 923
 		if (!empty($params['assign'])) {
924 924
 			$smarty->assign($params['assign'], $output);
925 925
 		} else {
926
-			return $output;
927
-		}
928
-	}
929
-}
926
+			return $output
930 927
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,7 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function googleCode($params)
127 127
 	{
128 128
 		$id = setting('cms', 'google_code');
129
-		if (empty($id)) return '';
129
+		if (empty($id)) {
130
+			return '';
131
+		}
130 132
 		// if using google tag manager
131 133
 		if (substr($id, 0, 3) === 'GTM') {
132 134
 			$head = <<<HEADJS
@@ -923,7 +925,4 @@  discard block
 block discarded – undo
923 925
 		if (!empty($params['assign'])) {
924 926
 			$smarty->assign($params['assign'], $output);
925 927
 		} else {
926
-			return $output;
927
-		}
928
-	}
929
-}
928
+			return $output
930 929
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -923,7 +923,4 @@
 block discarded – undo
923 923
 		if (!empty($params['assign'])) {
924 924
 			$smarty->assign($params['assign'], $output);
925 925
 		} else {
926
-			return $output;
927
-		}
928
-	}
929
-}
926
+			return $output
930 927
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
neon/cms/components/CmsUrlRule.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
 	 */
31 31
 	public function parseRequest($manager, $request)
32 32
 	{
33
-		$pathInfo = '/' . $request->getPathInfo();
33
+		$pathInfo = '/'.$request->getPathInfo();
34 34
 		$url = CmsUrl::find()->where(['url' => $pathInfo])->limit(1)->one();
35 35
 		// if the url is not in the url table then return false to continue processing other route rules
36 36
 		// typically in a neon setup the module/controller/action rule
37
-		if (! $url) return false;
37
+		if (!$url) return false;
38 38
 		// check if the url found represents a redirect
39 39
 		if ($url['redirect'] !== null) {
40 40
 			neon()->response->redirect($url['redirect'], 301)->send();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
 		$url = CmsUrl::find()->where(['url' => $pathInfo])->limit(1)->one();
35 35
 		// if the url is not in the url table then return false to continue processing other route rules
36 36
 		// typically in a neon setup the module/controller/action rule
37
-		if (! $url) return false;
37
+		if (! $url) {
38
+			return false;
39
+		}
38 40
 		// check if the url found represents a redirect
39 41
 		if ($url['redirect'] !== null) {
40 42
 			neon()->response->redirect($url['redirect'], 301)->send();
Please login to merge, or discard this patch.
neon/core/form/fields/el/SwitchInput.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	public function getComponentDetails()
41 41
 	{
42 42
 		return [
43
-			'name' => 'switch',  'icon' => 'fa fa-toggle-on', 'group' => 'element ui',
43
+			'name' => 'switch', 'icon' => 'fa fa-toggle-on', 'group' => 'element ui',
44 44
 		];
45 45
 	}
46 46
 
Please login to merge, or discard this patch.
neon/core/helpers/Html.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	public static function displayAsTags($tagsArray, $class = 'label label-info')
20 20
 	{
21 21
 		$out = '';
22
-		foreach($tagsArray as $tag) {
22
+		foreach ($tagsArray as $tag) {
23 23
 			$out .= "<span class=\"$class\">$tag</span>";
24 24
 		}
25 25
 		return $out;
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 *  - specify $options['icon']
37 37
 	 * @return string Html for the custom button
38 38
 	 */
39
-	public static function buttonCustom($url, $text, array $options=[])
39
+	public static function buttonCustom($url, $text, array $options = [])
40 40
 	{
41
-		$options['class'] = 'btn '. Arr::get($options, 'class', '');
41
+		$options['class'] = 'btn '.Arr::get($options, 'class', '');
42 42
 		$icon = Arr::remove($options, 'icon', '');
43 43
 		return self::a("<i class=\"$icon\"></i> ".$text, $url, $options);
44 44
 	}
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @param string $text - button text
51 51
 	 * @return string Html for an edit button
52 52
 	 */
53
-	public static function buttonEdit($url, $text='Edit', $options=[])
53
+	public static function buttonEdit($url, $text = 'Edit', $options = [])
54 54
 	{
55 55
 		$options['icon'] = 'fa fa-pencil';
56
-		$options['class'] = 'btn-default ' . Arr::get($options, 'class', '');
56
+		$options['class'] = 'btn-default '.Arr::get($options, 'class', '');
57 57
 		return self::buttonCustom($url, $text, $options);
58 58
 	}
59 59
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 * @see \yii\helpers\Url::to
66 66
 	 * @return string Html
67 67
 	 */
68
-	public static function buttonDelete($url, $text='Delete', $options=[])
68
+	public static function buttonDelete($url, $text = 'Delete', $options = [])
69 69
 	{
70 70
 		$options['icon'] = 'fa fa-trash';
71
-		$options['class'] =  'btn-danger ' . Arr::get($options, 'class', '');
71
+		$options['class'] = 'btn-danger '.Arr::get($options, 'class', '');
72 72
 		return self::buttonCustom($url, $text, $options);
73 73
 	}
74 74
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @see \yii\helpers\Url::to
81 81
 	 * @return string Html
82 82
 	 */
83
-	public static function buttonAdd($url, $text='Add', $options=[])
83
+	public static function buttonAdd($url, $text = 'Add', $options = [])
84 84
 	{
85 85
 		$options['icon'] = 'fa fa-plus';
86 86
 		$options['class'] = 'btn-primary btn-add';
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param string $text button text
95 95
 	 * @return string Html
96 96
 	 */
97
-	public static function buttonCancel($url='', $text='Cancel', $options=[])
97
+	public static function buttonCancel($url = '', $text = 'Cancel', $options = [])
98 98
 	{
99 99
 		$options['icon'] = 'fa fa-arrow-left';
100 100
 		$options['class'] = 'btn-default btn-cancel';
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public static function checkbox($name, $checked = false, $options = [])
131 131
 	{
132 132
 		$checkbox = parent::checkbox($name, $checked, $options);
133
-		return '<div class="checkbox">' . $checkbox . '</div>';
133
+		return '<div class="checkbox">'.$checkbox.'</div>';
134 134
 	}
135 135
 
136 136
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	public static function radio($name, $checked = false, $options = [])
140 140
 	{
141 141
 		$radio = parent::radio($name, $checked, $options);
142
-		return '<div class="radio">' . $radio . '</div>';
142
+		return '<div class="radio">'.$radio.'</div>';
143 143
 	}
144 144
 
145 145
 	/**
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 	protected static function processTags($openingTags, &$tagsProcessed)
240 240
 	{
241 241
 		// append the closing tags to the list and add a comma for splitting later
242
-		$tagsStr = str_replace('>','>,',($openingTags.str_replace('<','</',$openingTags)));
242
+		$tagsStr = str_replace('>', '>,', ($openingTags.str_replace('<', '</', $openingTags)));
243 243
 		// create the replacement code with a highly unlikely set of strings
244 244
 		$replaceStr = str_replace(['</', '<', '/>', '>'], ['__NEWICON_CLOSELT__', '__NEWICON_LT__', '__NEWICON_CLOSERT__', '__NEWICON_RT__'], $tagsStr);
245 245
 
246 246
 		// now create the replacement and returned tags
247
-		$replaceTags = explode(',', substr($replaceStr,0,-1)); // ignore trailing comma
248
-		$returnTags = explode(',', substr($tagsStr,0,-1)); // ignore trailing comma
247
+		$replaceTags = explode(',', substr($replaceStr, 0, -1)); // ignore trailing comma
248
+		$returnTags = explode(',', substr($tagsStr, 0, -1)); // ignore trailing comma
249 249
 		$tagsProcessed[$openingTags] = ['replace'=>$replaceTags, 'return'=>$returnTags];
250 250
 	}
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @param string $empty - what to show if the field is empty
259 259
 	 * @return string html
260 260
 	 */
261
-	public static function highlight($search, $html, $empty='')
261
+	public static function highlight($search, $html, $empty = '')
262 262
 	{
263 263
 		if ($html === null)
264 264
 			return neon()->formatter->nullDisplay;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				// loadHtml seems to ignore the LIBXML_ERR_NONE setting
281 281
 				// we don;t care if we are not given perfectly formed html
282 282
 				// Even if we have serious issues in the html `$dom->saveHtml` makes a good expected effort
283
-				@$dom->loadHTML('<?xml encoding="utf-8" ?>' . $html, LIBXML_HTML_NOIMPLIED + LIBXML_HTML_NODEFDTD + LIBXML_NONET + LIBXML_ERR_NONE);
283
+				@$dom->loadHTML('<?xml encoding="utf-8" ?>'.$html, LIBXML_HTML_NOIMPLIED + LIBXML_HTML_NODEFDTD + LIBXML_NONET + LIBXML_ERR_NONE);
284 284
 				$xpath = new DOMXPath($dom);
285 285
 				$s = htmlentities($s);
286 286
 				$findStack = [];
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
 					// appendXml is useless and will break easily when exposed to characters
291 291
 					// preg_replace is a million times more robust....
292 292
 					// So keep the dom parser happy by replacing its internal text with an md5 key
293
-					$replace = preg_replace('/(' . preg_quote($s) . ')/i', '<span class="neonSearchHighlight">$1</span>', htmlentities($node->nodeValue));
294
-					$key = '{[' . md5($replace) . ']}';
293
+					$replace = preg_replace('/('.preg_quote($s).')/i', '<span class="neonSearchHighlight">$1</span>', htmlentities($node->nodeValue));
294
+					$key = '{['.md5($replace).']}';
295 295
 					$findStack[$key] = $replace;
296 296
 					$f->appendXML($key);
297 297
 					$node->parentNode->replaceChild($f, $node);
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -157,8 +157,9 @@  discard block
 block discarded – undo
157 157
 			self::processTags($allowableTags, $tagsProcessed);
158 158
 		}
159 159
 		if (is_array($value)) {
160
-			foreach ($value as $k => $v)
161
-				$value[$k] = static::sanitise($v, $allowableTags);
160
+			foreach ($value as $k => $v) {
161
+							$value[$k] = static::sanitise($v, $allowableTags);
162
+			}
162 163
 		} else {
163 164
 			if (!is_null($value)) {
164 165
 				if (isset($tagsProcessed[$allowableTags])) {
@@ -192,8 +193,9 @@  discard block
 block discarded – undo
192 193
 	{
193 194
 		profile_begin('Html::purify', 'html');
194 195
 		if (is_array($value)) {
195
-			foreach ($value as $k => $v)
196
-				$value[$k] = static::purify($v, $allowedTags);
196
+			foreach ($value as $k => $v) {
197
+							$value[$k] = static::purify($v, $allowedTags);
198
+			}
197 199
 		} else {
198 200
 			if (!is_null($value)) {
199 201
 				if ($allowedTags === false) {
@@ -223,8 +225,9 @@  discard block
 block discarded – undo
223 225
 	public static function encodeEntities($value, $entities = ENT_QUOTES)
224 226
 	{
225 227
 		if (is_array($value)) {
226
-			foreach ($value as $k => $v)
227
-				$value[$k] = static::encodeEntities($v, $entities);
228
+			foreach ($value as $k => $v) {
229
+							$value[$k] = static::encodeEntities($v, $entities);
230
+			}
228 231
 		} else {
229 232
 			$value = htmlentities($value, $entities);
230 233
 		}
@@ -260,18 +263,22 @@  discard block
 block discarded – undo
260 263
 	 */
261 264
 	public static function highlight($search, $html, $empty='')
262 265
 	{
263
-		if ($html === null)
264
-			return neon()->formatter->nullDisplay;
265
-		if ($html === '')
266
-			return $empty;
267
-		if (empty($search))
268
-			return $html;
266
+		if ($html === null) {
267
+					return neon()->formatter->nullDisplay;
268
+		}
269
+		if ($html === '') {
270
+					return $empty;
271
+		}
272
+		if (empty($search)) {
273
+					return $html;
274
+		}
269 275
 
270 276
 		profile_begin('Html::Highlight');
271 277
 		// escape search and html entities as otherwise the loadHTML or appendXML
272 278
 		// can blow up if there are < & > in the data
273
-		if (!is_array($search))
274
-			$search = [$search];
279
+		if (!is_array($search)) {
280
+					$search = [$search];
281
+		}
275 282
 		try {
276 283
 			foreach ($search as $s) {
277 284
 				// now search and rebuild the data
Please login to merge, or discard this patch.
neon/core/grid/column/Column.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		return $this->_width;
174 174
 	}
175 175
 
176
-	public function __construct($config=[])
176
+	public function __construct($config = [])
177 177
 	{
178 178
 		parent::__construct($config);
179 179
 		if (!isset($config['key'])) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	/**
274 274
 	 * @inheritDoc
275 275
 	 */
276
-	public function setIsSortable($sortable=true)
276
+	public function setIsSortable($sortable = true)
277 277
 	{
278 278
 		$this->_sortable = $sortable;
279 279
 		return $this;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		return $this->_sortable;
288 288
 	}
289 289
 
290
-	public function setAsIndex($bool=true)
290
+	public function setAsIndex($bool = true)
291 291
 	{
292 292
 		$this->grid->setIndexedByColumn($this->key);
293 293
 		// thi is a bit gnarly but tests for yii Active record data providers specifically
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			return $this->_dataCellContentFunction;
356 356
 		}
357 357
 		// check for convention
358
-		$functionName = 'render' . $this->key;
358
+		$functionName = 'render'.$this->key;
359 359
 		if (method_exists($this->grid, $functionName) && $functionName !== 'renderfile') {
360 360
 			return $functionName;
361 361
 		}
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	/**
427 427
 	 * @inheritDoc
428 428
 	 */
429
-	public function setDbField($field){
429
+	public function setDbField($field) {
430 430
 		$this->_dbField = $field;
431 431
 		return $this;
432 432
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	/**
435 435
 	 * @inheritDoc
436 436
 	 */
437
-	public function getDbField(){
438
-		if ($this->_dbField === null){
437
+	public function getDbField() {
438
+		if ($this->_dbField === null) {
439 439
 			// set to be the key
440 440
 			$this->_dbField = $this->key;
441 441
 		}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * @inheritDoc
454 454
 	 */
455
-	public function setDbSortField($field){
455
+	public function setDbSortField($field) {
456 456
 		$this->_dbSortField = $field;
457 457
 		return $this;
458 458
 	}
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 	/**
461 461
 	 * @inheritDoc
462 462
 	 */
463
-	public function getDbSortField(){
464
-		if ($this->_dbSortField === null){
463
+	public function getDbSortField() {
464
+		if ($this->_dbSortField === null) {
465 465
 			// set to be the key
466 466
 			$this->_dbSortField = $this->dbField;
467 467
 		}
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 		if ($this->grid->hasSort($this->key)) {
511 511
 			$sort = $this->grid->hasSortDescending() ? ' - ' : ' + ';
512 512
 		}
513
-		$sortParam = $this->grid->hasSortDescending() ? $this->key : '-' . $this->key;
513
+		$sortParam = $this->grid->hasSortDescending() ? $this->key : '-'.$this->key;
514 514
 		$url = neon()->getUrlManager()->createUrl([\Yii::$app->controller->getRoute(), $this->grid->id => ['sort' => $sortParam]]);
515
-		return Html::a($this->getTitle() . $sort, $url, ['data-sort'=>$sortParam]);
515
+		return Html::a($this->getTitle().$sort, $url, ['data-sort'=>$sortParam]);
516 516
 	}
517 517
 
518 518
 	/**
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	public function getFilterField()
567 567
 	{
568 568
 		$field = $this->getBaseFilterField();
569
-		foreach($this->filterFieldConfig as $key => $value)
569
+		foreach ($this->filterFieldConfig as $key => $value)
570 570
 			$field[$key] = $value;
571 571
 		return $field;
572 572
 	}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 
583 583
 	public function setMemberConfig($config)
584 584
 	{
585
-		foreach($config as $key => $value) {
585
+		foreach ($config as $key => $value) {
586 586
 			if (isset($this->member->$key))
587 587
 				$this->member->$key = $value;
588 588
 		}
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	/**
593 593
 	 * @inheritDoc
594 594
 	 */
595
-	public function getCellData($row, $noValue='-')
595
+	public function getCellData($row, $noValue = '-')
596 596
 	{
597 597
 		$data = null;
598 598
 		$key = $this->getKey();
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 			if (is_array($display)) {
644 644
 				$display = implode(',', $display);
645 645
 			}
646
-			return "<span title=\"".str_replace('"',"'", html_entity_decode(strip_tags($display)))."\">$out</span>";
646
+			return "<span title=\"".str_replace('"', "'", html_entity_decode(strip_tags($display)))."\">$out</span>";
647 647
 		}
648 648
 		return $this->getCellData($model);
649 649
 	}
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 */
654 654
 	public function getFieldName()
655 655
 	{
656
-		return $this->getGrid()->getId() . '[' . $this->key . '][search]';
656
+		return $this->getGrid()->getId().'['.$this->key.'][search]';
657 657
 	}
658 658
 
659 659
 	/**
@@ -727,12 +727,12 @@  discard block
 block discarded – undo
727 727
 		throw new \Exception('Unable to call a valid search function');
728 728
 	}
729 729
 
730
-	protected $_actions =[];
730
+	protected $_actions = [];
731 731
 
732 732
 	/**
733 733
 	 * @inheritDoc
734 734
 	 */
735
-	public function addRowAction($key, $text, $linkOptions=[])
735
+	public function addRowAction($key, $text, $linkOptions = [])
736 736
 	{
737 737
 		$linkOptions['text'] = $text;
738 738
 		$linkOptions['data-action'] = $key;
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		}
759 759
 		$out = '<div class="neonGrid_rowActions">';
760 760
 		$i = 0;
761
-		foreach($this->_actions as $actionKey => $linkOptions) {
761
+		foreach ($this->_actions as $actionKey => $linkOptions) {
762 762
 			if ($i > 0) $out .= ' | ';
763 763
 			if (isset($linkOptions['function'])) {
764 764
 				$func = $linkOptions['function'];
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 	 * @param array $arguments of arguments
786 786
 	 * @return mixed
787 787
 	 */
788
-	public function callFunction($function, $arguments=[])
788
+	public function callFunction($function, $arguments = [])
789 789
 	{
790 790
 		if (is_string($function)) {
791 791
 			return call_user_func_array([$this->grid, $function], $arguments);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 			if (count($columnData)) {
811 811
 				$this->member->dataMapFilters = ['uuid' => $columnData];
812 812
 			}
813
-			foreach($models as $model) {
813
+			foreach ($models as $model) {
814 814
 				$this->member->makeMapRequest($this->getCellData($model, null));
815 815
 			}
816 816
 		}
Please login to merge, or discard this patch.
Braces   +27 added lines, -17 removed lines patch added patch discarded remove patch
@@ -105,8 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getEmptyCellDisplay()
107 107
 	{
108
-		if ($this->_emptyCellDisplay !== null)
109
-			return $this->_emptyCellDisplay;
108
+		if ($this->_emptyCellDisplay !== null) {
109
+					return $this->_emptyCellDisplay;
110
+		}
110 111
 		return $this->getGrid()->emptyCellDisplay;
111 112
 	}
112 113
 
@@ -490,10 +491,12 @@  discard block
 block discarded – undo
490 491
 	public function renderHeaderCell()
491 492
 	{
492 493
 		$options = $this->getHeaderCellAttributes();
493
-		if ($this->grid->hasSort($this->key))
494
-			Html::addCssClass($options, ($this->grid->hasSortDescending() ? 'desc' : 'asc'));
495
-		if (trim($this->width) != '')
496
-			Html::addCssStyle($options, ["width" => $this->width]);
494
+		if ($this->grid->hasSort($this->key)) {
495
+					Html::addCssClass($options, ($this->grid->hasSortDescending() ? 'desc' : 'asc'));
496
+		}
497
+		if (trim($this->width) != '') {
498
+					Html::addCssStyle($options, ["width" => $this->width]);
499
+		}
497 500
 		Html::addCssStyle($options, $this->_style);
498 501
 
499 502
 		return Html::tag('th', $this->renderHeaderCellContent(), $options);
@@ -504,8 +507,9 @@  discard block
 block discarded – undo
504 507
 	 */
505 508
 	public function renderHeaderCellContent()
506 509
 	{
507
-		if (!$this->isSortable)
508
-			return $this->getTitle();
510
+		if (!$this->isSortable) {
511
+					return $this->getTitle();
512
+		}
509 513
 		$sort = '';
510 514
 		if ($this->grid->hasSort($this->key)) {
511 515
 			$sort = $this->grid->hasSortDescending() ? ' - ' : ' + ';
@@ -535,10 +539,12 @@  discard block
 block discarded – undo
535 539
 	 */
536 540
 	public function renderFilterCellContent()
537 541
 	{
538
-		if ($this->filter === false)
539
-			return '';
540
-		if (!$this->getGrid()->getFilterForm()->hasField($this->getKey()))
541
-			return '';
542
+		if ($this->filter === false) {
543
+					return '';
544
+		}
545
+		if (!$this->getGrid()->getFilterForm()->hasField($this->getKey())) {
546
+					return '';
547
+		}
542 548
 		$field = $this->getGrid()->getFilterForm()->getField($this->getKey());
543 549
 		// remove any automatic validators
544 550
 		$field->setValidators([], true);
@@ -566,8 +572,9 @@  discard block
 block discarded – undo
566 572
 	public function getFilterField()
567 573
 	{
568 574
 		$field = $this->getBaseFilterField();
569
-		foreach($this->filterFieldConfig as $key => $value)
570
-			$field[$key] = $value;
575
+		foreach($this->filterFieldConfig as $key => $value) {
576
+					$field[$key] = $value;
577
+		}
571 578
 		return $field;
572 579
 	}
573 580
 
@@ -583,8 +590,9 @@  discard block
 block discarded – undo
583 590
 	public function setMemberConfig($config)
584 591
 	{
585 592
 		foreach($config as $key => $value) {
586
-			if (isset($this->member->$key))
587
-				$this->member->$key = $value;
593
+			if (isset($this->member->$key)) {
594
+							$this->member->$key = $value;
595
+			}
588 596
 		}
589 597
 		return $this;
590 598
 	}
@@ -759,7 +767,9 @@  discard block
 block discarded – undo
759 767
 		$out = '<div class="neonGrid_rowActions">';
760 768
 		$i = 0;
761 769
 		foreach($this->_actions as $actionKey => $linkOptions) {
762
-			if ($i > 0) $out .= ' | ';
770
+			if ($i > 0) {
771
+				$out .= ' | ';
772
+			}
763 773
 			if (isset($linkOptions['function'])) {
764 774
 				$func = $linkOptions['function'];
765 775
 				$out .= $this->callFunction($func, [$model, $key, $index]);
Please login to merge, or discard this patch.
neon/core/grid/column/IColumn.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 
15 15
 interface IColumn
16 16
 {
17
-	public function __construct($config=[]);
17
+	public function __construct($config = []);
18 18
 
19
-	public function renderDataCell($model, $key, $index);  // GRID: called by grid
19
+	public function renderDataCell($model, $key, $index); // GRID: called by grid
20 20
 
21 21
 	/**
22 22
 	 * Renders the contents of the cell (can be overriden by setting self::setDataCellContentFunction)
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @param bool $sortable
154 154
 	 * @return $this
155 155
 	 */
156
-	public function setIsSortable($sortable=true);
156
+	public function setIsSortable($sortable = true);
157 157
 
158 158
 	/**
159 159
 	 * Is the column sortable
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @param boolean $bool
256 256
 	 */
257
-	public function setAsIndex($bool=true);
257
+	public function setAsIndex($bool = true);
258 258
 
259 259
 	/**
260 260
 	 * Set the title of the column
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return null|callable
305 305
 	 */
306
-	public function getSearchFunction();  // GRID: called by grid
306
+	public function getSearchFunction(); // GRID: called by grid
307 307
 
308 308
 	/**
309 309
 	 * Set the database field name. This is used to lookup the row data, and in filters and ordering
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @param array $linkOptions
367 367
 	 * @return mixed
368 368
 	 */
369
-	public function addRowAction($key, $text, $linkOptions=[]);
369
+	public function addRowAction($key, $text, $linkOptions = []);
370 370
 
371 371
 	public function renderRowActions($model, $key, $index);
372 372
 
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
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -123,8 +123,9 @@  discard block
 block discarded – undo
123 123
 			}
124 124
  		}
125 125
 		 
126
-		if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class']))
127
-			Daedalus::buildDataFromDdsAttributes($params);
126
+		if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class'])) {
127
+					Daedalus::buildDataFromDdsAttributes($params);
128
+		}
128 129
 		$resolvedParams = Arr::merge($defaults, $params);
129 130
 		return $widget->render($resolvedParams, $template);
130 131
 	}
@@ -171,8 +172,9 @@  discard block
 block discarded – undo
171 172
 		}
172 173
 		// scb = static content block
173 174
 		$params['type'] = '_scb';
174
-		if (isset($params['key']))
175
-			self::buildDataFromCmsKeyAttributes($params);
175
+		if (isset($params['key'])) {
176
+					self::buildDataFromCmsKeyAttributes($params);
177
+		}
176 178
 		$params['content'] = $content;
177 179
 		$params['wys'] = (isset($params['wys']) ? $params['wys'] : true);
178 180
 		return $widget->render($params, $template);
@@ -208,8 +210,9 @@  discard block
 block discarded – undo
208 210
 		$data = [];
209 211
 		if (($dataRequest = $this->getDataRequest()) !== null) {
210 212
 			$id = $meta = null;
211
-			if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta))
212
-				return $id;
213
+			if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta)) {
214
+							return $id;
215
+			}
213 216
 			$this->saveData($data);
214 217
 			$this->saveDataMetaInformation($meta);
215 218
 		}
@@ -239,8 +242,9 @@  discard block
 block discarded – undo
239 242
 			$this->params['meta'] = $this->meta;
240 243
 
241 244
 			// createTemplate is an expensive call so only call it once per file and reset all variables on the stored template.
242
-			if (!isset($templates[$file]))
243
-				$templates[$file] = $this->renderer->createTemplate($file);
245
+			if (!isset($templates[$file])) {
246
+							$templates[$file] = $this->renderer->createTemplate($file);
247
+			}
244 248
 			$tpl = $templates[$file];
245 249
 			$tpl->tpl_vars = $tpl->config_vars = [];
246 250
 
@@ -258,8 +262,9 @@  discard block
 block discarded – undo
258 262
 	 */
259 263
 	protected function getDataRequest()
260 264
 	{
261
-		if (isset($this->params['data']))
262
-			return Daedalus::convertDataRequestToJson($this->params['data']);
265
+		if (isset($this->params['data'])) {
266
+					return Daedalus::convertDataRequestToJson($this->params['data']);
267
+		}
263 268
 		return null;
264 269
 	}
265 270
 
@@ -315,15 +320,17 @@  discard block
 block discarded – undo
315 320
 	 */
316 321
 	protected static function buildDataFromCmsKeyAttributes(&$params)
317 322
 	{
318
-		if (!isset($params['type'], $params['key']))
319
-			return;
323
+		if (!isset($params['type'], $params['key'])) {
324
+					return;
325
+		}
320 326
 		$key = "$params[type]_$params[key]";
321 327
 		$pageId = isset($params['page']) ? self::$page->getId() : null;
322 328
 		$params['data-key'] = $key;
323 329
 		$params['data-page-id'] = $pageId;
324 330
 		$params['data'] = "'key':'$key','pageId':'$pageId'";
325
-		if (!isset($params['content']))
326
-			$params['content'] = "Add Content for $params[key] here";
331
+		if (!isset($params['content'])) {
332
+					$params['content'] = "Add Content for $params[key] here";
333
+		}
327 334
 		$params['is_static'] = true;
328 335
 	}
329 336
 
@@ -339,10 +346,11 @@  discard block
 block discarded – undo
339 346
 		if ($this->getPage()->isInEditMode()) {
340 347
 			$dataKey = $this->params['data-key'];
341 348
 			$dataPageId = $this->params['data-page-id'];
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>';
344
-			else
345
-				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
+			}
346 354
 		} else {
347 355
 			return $value;
348 356
 		}
Please login to merge, or discard this patch.