Passed
Push — master ( 858380...1fb59e )
by Jean-Christophe
01:48
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -61,16 +61,19 @@  discard block
 block discarded – undo
61 61
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
62 62
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
63 63
 		}
64
-		if(\is_array($this->_deleteBehavior))
65
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
66
-		if(\is_array($this->_editBehavior))
67
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
64
+		if(\is_array($this->_deleteBehavior)) {
65
+					$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
66
+		}
67
+		if(\is_array($this->_editBehavior)) {
68
+					$this->_generateBehavior("edit",$this->_editBehavior,$js);
69
+		}
68 70
 		if(\is_array($this->_displayBehavior)){
69 71
 			$this->_generateBehavior("display",$this->_displayBehavior,$js);
70 72
 		}
71 73
 		parent::run($js);
72
-		if(isset($this->_pagination))
73
-			$this->_associatePaginationBehavior($js,$offset);
74
+		if(isset($this->_pagination)) {
75
+					$this->_associatePaginationBehavior($js,$offset);
76
+		}
74 77
 		$this->_associateSearchFieldBehavior($js,$offset);
75 78
 			
76 79
 	}
@@ -105,8 +108,9 @@  discard block
 block discarded – undo
105 108
 			$table->setRowCount(0, \sizeof($captions));
106 109
 			$this->_generateHeader($table,$captions);
107 110
 
108
-			if(isset($this->_compileParts))
109
-				$table->setCompileParts($this->_compileParts);
111
+			if(isset($this->_compileParts)) {
112
+							$table->setCompileParts($this->_compileParts);
113
+			}
110 114
 
111 115
 			$this->_generateContent($table);
112 116
 
@@ -136,8 +140,9 @@  discard block
 block discarded – undo
136 140
 	}
137 141
 
138 142
 	protected function _applyStyleAttributes($table){
139
-		if(isset($this->_hiddenColumns))
140
-			$this->_hideColumns();
143
+		if(isset($this->_hiddenColumns)) {
144
+					$this->_hideColumns();
145
+		}
141 146
 			if(isset($this->_colWidths)){
142 147
 				foreach ($this->_colWidths as $colIndex=>$width){
143 148
 					$table->setColWidth($colIndex,$width);
@@ -173,7 +178,7 @@  discard block
 block discarded – undo
173 178
 				$table->fromDatabaseObjects($objects, function($instance) use($table,$fields){
174 179
 					return $this->_generateRow($instance, $fields,$table);
175 180
 				});
176
-			}else{
181
+			} else{
177 182
 				$activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null));
178 183
 				$uuids=[];
179 184
 				$table->fromDatabaseObjects($objects, function($instance) use($table,$fields,&$activeValues,$groupByFields,&$uuids){
@@ -235,8 +240,9 @@  discard block
 block discarded – undo
235 240
 			$field=$ck->getField();
236 241
 			$field->setProperty("value",$dataAjax);
237 242
 			$field->setProperty("name", "selection[]");
238
-			if(isset($checkedClass))
239
-				$field->setClass($checkedClass);
243
+			if(isset($checkedClass)) {
244
+							$field->setClass($checkedClass);
245
+			}
240 246
 			\array_unshift($values, $ck);
241 247
 		}
242 248
 		$result=$table->newRow();
@@ -253,8 +259,9 @@  discard block
 block discarded – undo
253 259
 
254 260
 	protected function _generatePagination($table){
255 261
 		if(isset($this->_toolbar)){
256
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
257
-				$this->_toolbar->setFloated("left");
262
+			if($this->_toolbarPosition==PositionInTable::FOOTER) {
263
+							$this->_toolbar->setFloated("left");
264
+			}
258 265
 		}
259 266
 		$footer=$table->getFooter();
260 267
 		$footer->mergeCol();
@@ -286,8 +293,9 @@  discard block
 block discarded – undo
286 293
 
287 294
 	protected function _getFieldName($index){
288 295
 		$fieldName=parent::_getFieldName($index);
289
-		if(\is_object($fieldName))
290
-			$fieldName="field-".$index;
296
+		if(\is_object($fieldName)) {
297
+					$fieldName="field-".$index;
298
+		}
291 299
 		return $fieldName."[]";
292 300
 	}
293 301
 
@@ -327,7 +335,7 @@  discard block
 block discarded – undo
327 335
 		$hasPart=$table->hasPart($part);
328 336
 		if($hasPart){
329 337
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
330
-		}else{
338
+		} else{
331 339
 			$row=$table->getPart($part)->getRow(0);
332 340
 		}
333 341
 		$row->mergeCol();
@@ -359,7 +367,7 @@  discard block
 block discarded – undo
359 367
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
360 368
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
361 369
 			$this->_urls["display"]=JArray::getValue($urls, "display",3);
362
-		}else{
370
+		} else{
363 371
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls];
364 372
 		}
365 373
 		return $this;
@@ -442,8 +450,9 @@  discard block
 block discarded – undo
442 450
 
443 451
 	protected function getTargetSelector($op) {
444 452
 		$result=$this->_targetSelector;
445
-		if(!isset($result[$op]))
446
-			$result="#".$this->identifier;
453
+		if(!isset($result[$op])) {
454
+					$result="#".$this->identifier;
455
+		}
447 456
 		return $result[$op];
448 457
 	}
449 458
 
@@ -461,8 +470,9 @@  discard block
 block discarded – undo
461 470
 	}
462 471
 
463 472
 	public function getRefreshSelector() {
464
-		if(isset($this->_refreshSelector))
465
-			return $this->_refreshSelector;
473
+		if(isset($this->_refreshSelector)) {
474
+					return $this->_refreshSelector;
475
+		}
466 476
 		return "#".$this->identifier." tbody";
467 477
 	}
468 478
 
@@ -481,8 +491,9 @@  discard block
 block discarded – undo
481 491
 	 */
482 492
 	public function show($modelInstance){
483 493
 		if(\is_array($modelInstance)){
484
-			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
485
-				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
494
+			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
495
+							$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
496
+			}
486 497
 		}
487 498
 		$this->_modelInstance=$modelInstance;
488 499
 	}
@@ -522,8 +533,9 @@  discard block
 block discarded – undo
522 533
 	}
523 534
 
524 535
 	public function hideColumn($colIndex){
525
-		if(!\is_array($this->_hiddenColumns))
526
-			$this->_hiddenColumns=[];
536
+		if(!\is_array($this->_hiddenColumns)) {
537
+					$this->_hiddenColumns=[];
538
+		}
527 539
 		$this->_hiddenColumns[]=$colIndex;
528 540
 		return $this;
529 541
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTableContent.php 1 patch
Braces   +28 added lines, -19 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) {
28 28
 		parent::__construct($identifier, $tagName, "");
29
-		if (isset($rowCount) && isset($colCount))
30
-			$this->setRowCount($rowCount, $colCount);
29
+		if (isset($rowCount) && isset($colCount)) {
30
+					$this->setRowCount($rowCount, $colCount);
31
+		}
31 32
 	}
32 33
 
33 34
 	/**
@@ -112,7 +113,7 @@  discard block
 block discarded – undo
112 113
 		$row=$this->getItem($row);
113 114
 		if (isset($row) && $row instanceof HtmlCollection) {
114 115
 			$col=$row->getItem($col);
115
-		}else{
116
+		} else{
116 117
 			$col=$row;
117 118
 		}
118 119
 		return $col;
@@ -170,8 +171,9 @@  discard block
 block discarded – undo
170 171
 			$values=\array_fill(0, $count, $values);
171 172
 			$isArray=false;
172 173
 		}
173
-		if (JArray::dimension($values) == 1 && $isArray)
174
-			$values=[ $values ];
174
+		if (JArray::dimension($values) == 1 && $isArray) {
175
+					$values=[ $values ];
176
+		}
175 177
 
176 178
 		$count=\min(\sizeof($values), $count);
177 179
 
@@ -198,8 +200,9 @@  discard block
 block discarded – undo
198 200
 		$count=$this->count();
199 201
 		for($i=0; $i < $count; $i++) {
200 202
 			$cell=$this->getCell($i, $colIndex);
201
-			if($cell instanceof BaseTrait)
202
-				$cell->addVariations($variations);
203
+			if($cell instanceof BaseTrait) {
204
+							$cell->addVariations($variations);
205
+			}
203 206
 		}
204 207
 		return $this;
205 208
 	}
@@ -208,8 +211,9 @@  discard block
 block discarded – undo
208 211
 		$count=$this->count();
209 212
 		for($i=0; $i < $count; $i++) {
210 213
 			$cell=$this->getCell($i, $colIndex);
211
-			if(isset($cell))
212
-				$cell->addToProperty($name,$value);
214
+			if(isset($cell)) {
215
+							$cell->addToProperty($name,$value);
216
+			}
213 217
 		}
214 218
 		return $this;
215 219
 	}
@@ -227,8 +231,9 @@  discard block
 block discarded – undo
227 231
 		$count=$this->count();
228 232
 		for($i=0; $i < $count; $i++) {
229 233
 			$index=$this->content[$i]->getColPosition($colIndex);
230
-			if ($index !== NULL)
231
-				$this->getCell($i, $index)->$function();
234
+			if ($index !== NULL) {
235
+							$this->getCell($i, $index)->$function();
236
+			}
232 237
 		}
233 238
 		return $this;
234 239
 	}
@@ -239,8 +244,9 @@  discard block
 block discarded – undo
239 244
 			$maxRow=$this->content[$i]->count();
240 245
 			$index=$maxRow-$colIndex-1;
241 246
 			if (($cell=$this->getCell($i, $index))!== NULL){
242
-				if($cell->getColspan()==1)
243
-					$cell->$function();
247
+				if($cell->getColspan()==1) {
248
+									$cell->$function();
249
+				}
244 250
 			}
245 251
 		}
246 252
 		return $this;
@@ -284,8 +290,9 @@  discard block
 block discarded – undo
284 290
 	 */
285 291
 	public function getColCount() {
286 292
 		$result=0;
287
-		if ($this->count() > 0)
288
-			$result=$this->getItem(0)->count();
293
+		if ($this->count() > 0) {
294
+					$result=$this->getItem(0)->count();
295
+		}
289 296
 		return $result;
290 297
 	}
291 298
 
@@ -309,8 +316,9 @@  discard block
 block discarded – undo
309 316
 
310 317
 	public function toDelete($rowIndex, $colIndex){
311 318
 		$row=$this->getItem($rowIndex);
312
-		if (isset($row) === true)
313
-			$row->toDelete($colIndex);
319
+		if (isset($row) === true) {
320
+					$row->toDelete($colIndex);
321
+		}
314 322
 		return $this;
315 323
 	}
316 324
 
@@ -408,8 +416,9 @@  discard block
 block discarded – undo
408 416
 		foreach ( $rows as $row ) {
409 417
 			$cell=$row->getItem($colIndex);
410 418
 			$value=$cell->getContent();
411
-			if($functionExists)
412
-				$value=\call_user_func($function,$value);
419
+			if($functionExists) {
420
+							$value=\call_user_func($function,$value);
421
+			}
413 422
 			if($value!==$identiqual){
414 423
 				if($counter>0 && isset($cellToMerge)){
415 424
 					$cellToMerge->setRowspan($counter);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +47 added lines, -41 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 		$this->widgetIdentifier=$identifier;
26 26
 		$this->values=[];
27 27
 		$this->afterCompile=[];
28
-		if(isset($instance))
29
-			$this->setInstance($instance);
28
+		if(isset($instance)) {
29
+					$this->setInstance($instance);
30
+		}
30 31
 		$this->setCaptions($captions);
31 32
 		$this->captionCallback=NULL;
32 33
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -62,7 +63,7 @@  discard block
 block discarded – undo
62 63
 			while($index<$count){
63 64
 					$values[]=$this->getValue($index++);
64 65
 			}
65
-		}else{
66
+		} else{
66 67
 			while($index<$count){
67 68
 				if(array_search($index, $this->groupByFields)===false){
68 69
 					$values[]=$this->getValue($index);
@@ -74,14 +75,16 @@  discard block
 block discarded – undo
74 75
 	}
75 76
 
76 77
 	public function getIdentifier($index=NULL){
77
-		if(!isset($index))
78
-			$index=self::$index;
78
+		if(!isset($index)) {
79
+					$index=self::$index;
80
+		}
79 81
 		$value=$index;
80 82
 		if(isset($this->values["identifier"])){
81
-			if(\is_string($this->values["identifier"]))
82
-				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
83
-			else
84
-				$value=$this->values["identifier"]($index,$this->instance);
83
+			if(\is_string($this->values["identifier"])) {
84
+							$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
85
+			} else {
86
+							$value=$this->values["identifier"]($index,$this->instance);
87
+			}
85 88
 		}
86 89
 		return $value;
87 90
 	}
@@ -111,16 +114,16 @@  discard block
 block discarded – undo
111 114
 		if($property instanceof \ReflectionProperty){
112 115
 			$value=$this->_getPropertyValue($property);
113 116
 			$propertyName=$property->getName();
114
-		}elseif(\is_callable($property) && array_search($property, ["system"])===false)
115
-			$value=$property($this->instance);
116
-		elseif(\is_array($property)){
117
+		} elseif(\is_callable($property) && array_search($property, ["system"])===false) {
118
+					$value=$property($this->instance);
119
+		} elseif(\is_array($property)){
117 120
 			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
118 121
 			$value=\implode("", $values);
119
-		}elseif(\is_string($property)){
122
+		} elseif(\is_string($property)){
120 123
 			$value=$property;
121 124
 			if(isset($this->instance->{$property})){
122 125
 				$value=$this->instance->{$property};
123
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
126
+			} elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
124 127
 				$value=JReflection::callMethod($this->instance, $getter, []);
125 128
 			}
126 129
 		}
@@ -130,7 +133,7 @@  discard block
 block discarded – undo
130 133
 	protected function _postGetValue($index,$propertyName,$value){
131 134
 		if(isset($this->values[$index])){
132 135
 			$value= $this->values[$index]($value,$this->instance,$index,self::$index);
133
-		}else{
136
+		} else{
134 137
 			$value=$this->_getDefaultValue($propertyName,$value, $index);
135 138
 		}
136 139
 		if(isset($this->afterCompile[$index])){
@@ -144,7 +147,7 @@  discard block
 block discarded – undo
144 147
 	public function insertField($index,$field,$key=null){
145 148
 		if(isset($key)){
146 149
 			array_splice( $this->visibleProperties, $index, 0, [$key=>$field] );
147
-		}else{
150
+		} else{
148 151
 			array_splice( $this->visibleProperties, $index, 0, $field );
149 152
 		}
150 153
 		return $this;
@@ -165,17 +168,17 @@  discard block
 block discarded – undo
165 168
 			if(isset($key)){
166 169
 				if(\is_array($vb[$index])){
167 170
 					$this->visibleProperties[$index][$key]=$field;
168
-				}else{
171
+				} else{
169 172
 					$this->visibleProperties[$index]=[$vb[$index],$key=>$field];
170 173
 				}
171
-			}else{
174
+			} else{
172 175
 				if(\is_array($vb[$index])){
173 176
 					$this->visibleProperties[$index][]=$field;
174
-				}else{
177
+				} else{
175 178
 					$this->visibleProperties[$index]=[$vb[$index],$field];
176 179
 				}
177 180
 			}
178
-		}else{
181
+		} else{
179 182
 			return $this->insertField($index, $field);
180 183
 		}
181 184
 		return $this;
@@ -184,7 +187,7 @@  discard block
 block discarded – undo
184 187
 	public function addField($field,$key=null){
185 188
 		if(isset($key)){
186 189
 			$this->visibleProperties[]=[$key=>$field];
187
-		}else{
190
+		} else{
188 191
 			$this->visibleProperties[]=$field;
189 192
 		}
190 193
 		return $this;
@@ -211,9 +214,9 @@  discard block
 block discarded – undo
211 214
 		$property=$this->getProperty($index);
212 215
 		if($property instanceof \ReflectionProperty){
213 216
 			$result=$property->getName();
214
-		}elseif(\is_callable($property)){
217
+		} elseif(\is_callable($property)){
215 218
 			$result=$this->visibleProperties[$index];
216
-		}else{
219
+		} else{
217 220
 			$result=$property;
218 221
 		}
219 222
 		return $result;
@@ -233,7 +236,7 @@  discard block
 block discarded – undo
233 236
 		$this->reflect=new \ReflectionClass($instance);
234 237
 		if(JArray::count($this->visibleProperties)===0){
235 238
 			$this->properties=$this->getDefaultProperties();
236
-		}else{
239
+		} else{
237 240
 			foreach ($this->visibleProperties as $property){
238 241
 				$this->setInstanceProperty($property);
239 242
 			}
@@ -244,22 +247,23 @@  discard block
 block discarded – undo
244 247
 	private function setInstanceProperty($property){
245 248
 		if(\is_callable($property)){
246 249
 			$this->properties[]=$property;
247
-		}elseif(\is_string($property)){
250
+		} elseif(\is_string($property)){
248 251
 			try{
249 252
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
250 253
 				$rProperty=$this->reflect->getProperty($property);
251 254
 				$this->properties[]=$rProperty;
252
-			}catch(\Exception $e){
255
+			} catch(\Exception $e){
253 256
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
254 257
 				$this->properties[]=$property;
255 258
 			}
256
-		}elseif(\is_int($property)){
259
+		} elseif(\is_int($property)){
257 260
 			$props=$this->getDefaultProperties();
258
-			if(isset($props[$property]))
259
-				$this->properties[]=$props[$property];
260
-				else
261
-					$this->properties[]=$property;
262
-		}else{
261
+			if(isset($props[$property])) {
262
+							$this->properties[]=$props[$property];
263
+			} else {
264
+									$this->properties[]=$property;
265
+				}
266
+		} else{
263 267
 			$this->properties[]=$property;
264 268
 		}
265 269
 	}
@@ -303,12 +307,13 @@  discard block
 block discarded – undo
303 307
 		if(isset($this->captions[$index])){
304 308
 			return $this->captions[$index];
305 309
 		}
306
-		if($this->properties[$index] instanceof \ReflectionProperty)
307
-			return $this->properties[$index]->getName();
308
-		elseif(\is_callable($this->properties[$index]))
309
-			return "";
310
-		else
311
-			return $this->properties[$index];
310
+		if($this->properties[$index] instanceof \ReflectionProperty) {
311
+					return $this->properties[$index]->getName();
312
+		} elseif(\is_callable($this->properties[$index])) {
313
+					return "";
314
+		} else {
315
+					return $this->properties[$index];
316
+		}
312 317
 	}
313 318
 
314 319
 	public function getCaptions(){
@@ -323,7 +328,7 @@  discard block
 block discarded – undo
323 328
 				$captions[]="";
324 329
 				$moreAdded=true;
325 330
 			}
326
-		}else{
331
+		} else{
327 332
 			$captions=[];
328 333
 			$index=0;
329 334
 			while($index<$count){
@@ -341,8 +346,9 @@  discard block
 block discarded – undo
341 346
 	}
342 347
 
343 348
 	public function setCaption($index,$caption){
344
-		if(isset($this->captions)===false)
345
-			$this->captions=[];
349
+		if(isset($this->captions)===false) {
350
+					$this->captions=[];
351
+		}
346 352
 		$this->captions[$index]=$caption;
347 353
 		return $this;
348 354
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Braces   +22 added lines, -17 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	private function afterInsert($item) {
65
-		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
66
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
67
-		else {
65
+		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) {
66
+					$item->addToPropertyCtrl("class", "item", array ("item" ));
67
+		} else {
68 68
 			$this->setSecondary();
69 69
 		}
70 70
 		return $item;
@@ -79,8 +79,9 @@  discard block
 block discarded – undo
79 79
 	public function addItem($item) {
80 80
 		$number=$item;
81 81
 		$item=parent::addItem($this->getItemToInsert($item));
82
-		if(\is_int($number))
83
-			$item->setProperty("data-page", $number);
82
+		if(\is_int($number)) {
83
+					$item->setProperty("data-page", $number);
84
+		}
84 85
 		return $this->afterInsert($item);
85 86
 	}
86 87
 
@@ -149,10 +150,11 @@  discard block
 block discarded – undo
149 150
 	}
150 151
 
151 152
 	public function setSecondary($value=true) {
152
-		if($value)
153
-			$this->addToProperty("class", "secondary");
154
-		else
155
-			$this->removePropertyValue("class", "secondary");
153
+		if($value) {
154
+					$this->addToProperty("class", "secondary");
155
+		} else {
156
+					$this->removePropertyValue("class", "secondary");
157
+		}
156 158
 		return $this;
157 159
 	}
158 160
 
@@ -172,8 +174,9 @@  discard block
 block discarded – undo
172 174
 		$this->apply(function (HtmlDoubleElement &$item) {
173 175
 			$item->setTagName("a");
174 176
 		});
175
-		if ($vertical === true)
176
-			$this->setVertical();
177
+		if ($vertical === true) {
178
+					$this->setVertical();
179
+		}
177 180
 		return $this->addToProperty("class", "tabular");
178 181
 	}
179 182
 
@@ -202,10 +205,11 @@  discard block
 block discarded – undo
202 205
 	 */
203 206
 	public function fromDatabaseObject($object, $function) {
204 207
 		$return=$function($object);
205
-		if (\is_array($return))
206
-			$this->addItems($return);
207
-		else
208
-			$this->addItem($return);
208
+		if (\is_array($return)) {
209
+					$this->addItems($return);
210
+		} else {
211
+					$this->addItem($return);
212
+		}
209 213
 	}
210 214
 
211 215
 	/**
@@ -238,8 +242,9 @@  discard block
 block discarded – undo
238 242
 	}
239 243
 
240 244
 	public function run(JsUtils $js){
241
-		if($this->identifier!=="" && !isset($this->_bsComponent))
242
-			$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
245
+		if($this->identifier!=="" && !isset($this->_bsComponent)) {
246
+					$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
247
+		}
243 248
 		$result= parent::run($js);
244 249
 		return $result->setItemSelector(">.item");
245 250
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Braces   +24 added lines, -19 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		if(isset($value)){
36 36
 			if($value instanceof HtmlSemDoubleElement){
37 37
 				$text=$value;
38
-			}else{
38
+			} else{
39 39
 				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
40 40
 				$text->setClass("text");
41 41
 				$this->setValue($value);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 		if(!$item instanceof HtmlDropdownItem){
114 114
 			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
115
-		}elseif($itemO instanceof HtmlDropdownItem){
115
+		} elseif($itemO instanceof HtmlDropdownItem){
116 116
 			$this->addToProperty("class", "vertical");
117 117
 		}
118 118
 		return $itemO;
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	public function addInput($name){
129
-		if(!isset($name))
130
-			$name="input-".$this->identifier;
129
+		if(!isset($name)) {
130
+					$name="input-".$this->identifier;
131
+		}
131 132
 		$this->setAction("activate");
132 133
 		$this->input=new HtmlInput($name,"hidden");
133 134
 		$this->input->setIdentifier("input-".$this->identifier);
@@ -186,7 +187,7 @@  discard block
 block discarded – undo
186 187
 			foreach ($items as $k=>$v){
187 188
 				$this->addItem($v)->setData($k);
188 189
 			}
189
-		}else{
190
+		} else{
190 191
 			foreach ($items as $item){
191 192
 				$this->addItem($item);
192 193
 			}
@@ -208,8 +209,7 @@  discard block
 block discarded – undo
208 209
 			$c=$this->items[$i++];
209 210
 			if(isset($c)){
210 211
 				$c->setProperty($property,$value);
211
-			}
212
-			else{
212
+			} else{
213 213
 				return $this;
214 214
 			}
215 215
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		if($dropdown===false){
241 241
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
242 242
 			$dropdown="menu";
243
-		}else{
243
+		} else{
244 244
 			$dropdown="dropdown";
245 245
 			$this->mClass="menu";
246 246
 		}
@@ -261,22 +261,25 @@  discard block
 block discarded – undo
261 261
 
262 262
 	public function asButton($floating=false){
263 263
 		$this->removeArrow();
264
-		if($floating)
265
-			$this->addToProperty("class", "floating");
264
+		if($floating) {
265
+					$this->addToProperty("class", "floating");
266
+		}
266 267
 		$this->removePropertyValue("class", "selection");
267 268
 		return $this->addToProperty("class", "button");
268 269
 	}
269 270
 
270 271
 	public function asSelect($name=NULL,$multiple=false,$selection=true){
271 272
 		$this->_multiple=$multiple;
272
-		if(isset($name))
273
-			$this->addInput($name);
273
+		if(isset($name)) {
274
+					$this->addInput($name);
275
+		}
274 276
 		if($multiple){
275 277
 			$this->addToProperty("class", "multiple");
276 278
 		}
277 279
 		if ($selection){
278
-			if($this->propertyContains("class", "button")===false)
279
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
280
+			if($this->propertyContains("class", "button")===false) {
281
+							$this->addToPropertyCtrl("class", "selection",array("selection"));
282
+			}
280 283
 		}
281 284
 		return $this;
282 285
 	}
@@ -288,8 +291,9 @@  discard block
 block discarded – undo
288 291
 
289 292
 	public function setSelect($name=NULL,$multiple=false){
290 293
 		$this->_template='<%tagName% id="%identifier%" %properties%>%items%</%tagName%>';
291
-		if(!isset($name))
292
-			$name="select-".$this->identifier;
294
+		if(!isset($name)) {
295
+					$name="select-".$this->identifier;
296
+		}
293 297
 		$this->input=null;
294 298
 		if($multiple){
295 299
 			$this->setProperty("multiple", true);
@@ -330,12 +334,13 @@  discard block
 block discarded – undo
330 334
 		$value=$this->value;
331 335
 		if(isset($this->input) && isset($value)){
332 336
 			$this->input->setProperty("value", $value);
333
-		}else{
337
+		} else{
334 338
 			$this->setProperty("value", $value);
335 339
 		}
336 340
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
337
-			if(isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
338
-				$textElement->setContent($value);
341
+			if(isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple) {
342
+							$textElement->setContent($value);
343
+			}
339 344
 		return $this;
340 345
 	}
341 346
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormFields.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,12 +29,14 @@  discard block
 block discarded – undo
29 29
 				if (\is_string($end)) {
30 30
 					$label=$end;
31 31
 					\array_pop($fields);
32
-				} else
33
-					$label=NULL;
32
+				} else {
33
+									$label=NULL;
34
+				}
34 35
 			}
35 36
 		}
36
-		if (isset($label))
37
-			$this->setLabel($label);
37
+		if (isset($label)) {
38
+					$this->setLabel($label);
39
+		}
38 40
 		foreach ( $fields as $field ) {
39 41
 			$this->addItem($field);
40 42
 		}
@@ -57,8 +59,9 @@  discard block
 block discarded – undo
57 59
 
58 60
 	public function addItem($item) {
59 61
 		$item=parent::addItem($item);
60
-		if($item instanceof HtmlFormField)
61
-			$item->setContainer($this);
62
+		if($item instanceof HtmlFormField) {
63
+					$item->setContainer($this);
64
+		}
62 65
 		return $item;
63 66
 	}
64 67
 	
@@ -73,8 +76,9 @@  discard block
 block discarded – undo
73 76
 		if ($this->_equalWidth) {
74 77
 			$count=$this->count();
75 78
 			$this->addToProperty("class", Wide::getConstants()["W".$count]." fields");
76
-		} else
77
-			$this->addToProperty("class", "fields");
79
+		} else {
80
+					$this->addToProperty("class", "fields");
81
+		}
78 82
 		return parent::compile($js, $view);
79 83
 	}
80 84
 
@@ -115,8 +119,9 @@  discard block
 block discarded – undo
115 119
 			$fields[]=$itemO;
116 120
 		}
117 121
 		$radios=new HtmlFormFields($identifier, $fields);
118
-		if (isset($label))
119
-			$radios->setLabel($label)->setProperty("for", $name);
122
+		if (isset($label)) {
123
+					$radios->setLabel($label)->setProperty("for", $name);
124
+		}
120 125
 		return $radios;
121 126
 	}
122 127
 
@@ -132,8 +137,9 @@  discard block
 block discarded – undo
132 137
 			$fields[]=$itemO;
133 138
 		}
134 139
 		$radios=new HtmlFormFields($identifier, $fields);
135
-		if (isset($label))
136
-			$radios->setLabel($label)->setProperty("for", $name);
140
+		if (isset($label)) {
141
+					$radios->setLabel($label)->setProperty("for", $name);
142
+		}
137 143
 		return $radios;
138 144
 	}
139 145
 
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsActionsTrait.php 1 patch
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 			$callback=", function(){\n{$callback}\n}";
30 30
 		}
31 31
 		$str="$({$element}).{$action}({$speed}{$callback});";
32
-		if ($immediatly)
33
-			$this->jquery_code_for_compile[]=$str;
32
+		if ($immediatly) {
33
+					$this->jquery_code_for_compile[]=$str;
34
+		}
34 35
 			return $str;
35 36
 	}
36 37
 	/**
@@ -62,10 +63,12 @@  discard block
 block discarded – undo
62 63
 		if (isset($param)) {
63 64
 			$param=Javascript::prep_value($param);
64 65
 			$str="$({$element}).{$jQueryCall}({$param});";
65
-		} else
66
-			$str="$({$element}).{$jQueryCall}();";
67
-		if ($immediatly)
68
-			$this->jquery_code_for_compile[]=$str;
66
+		} else {
67
+					$str="$({$element}).{$jQueryCall}();";
68
+		}
69
+		if ($immediatly) {
70
+					$this->jquery_code_for_compile[]=$str;
71
+		}
69 72
 		return $str;
70 73
 	}
71 74
 
@@ -81,8 +84,9 @@  discard block
 block discarded – undo
81 84
 		$to=Javascript::prep_element($to);
82 85
 		$element=Javascript::prep_element($element);
83 86
 		$str="$({$to}).{$jQueryCall}({$element});";
84
-		if ($immediatly)
85
-			$this->jquery_code_for_compile[]=$str;
87
+		if ($immediatly) {
88
+					$this->jquery_code_for_compile[]=$str;
89
+		}
86 90
 		return $str;
87 91
 	}
88 92
 	/**
@@ -131,10 +135,12 @@  discard block
 block discarded – undo
131 135
 		if (isset($value)) {
132 136
 			$value=Javascript::prep_value($value);
133 137
 			$str="$({$element}).attr(\"$attributeName\",{$value});";
134
-		} else
135
-			$str="$({$element}).attr(\"$attributeName\");";
136
-		if ($immediatly)
137
-			$this->jquery_code_for_compile[]=$str;
138
+		} else {
139
+					$str="$({$element}).attr(\"$attributeName\");";
140
+		}
141
+		if ($immediatly) {
142
+					$this->jquery_code_for_compile[]=$str;
143
+		}
138 144
 		return $str;
139 145
 	}
140 146
 
@@ -190,8 +196,9 @@  discard block
 block discarded – undo
190 196
 
191 197
 		$str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
192 198
 
193
-		if ($immediatly)
194
-			$this->jquery_code_for_compile[]=$str;
199
+		if ($immediatly) {
200
+					$this->jquery_code_for_compile[]=$str;
201
+		}
195 202
 		return $str;
196 203
 	}
197 204
 
@@ -342,8 +349,9 @@  discard block
 block discarded – undo
342 349
 		$element=Javascript::prep_element($element);
343 350
 		$str="$({$element}).trigger(\"$event\");";
344 351
 
345
-		if ($immediatly)
346
-			$this->jquery_code_for_compile[]=$str;
352
+		if ($immediatly) {
353
+					$this->jquery_code_for_compile[]=$str;
354
+		}
347 355
 		return $str;
348 356
 	}
349 357
 
@@ -405,8 +413,9 @@  discard block
 block discarded – undo
405 413
 			$str.="else{".$jsCodeIfFalse."}";
406 414
 		}
407 415
 
408
-		if ($immediatly)
409
-			$this->jquery_code_for_compile[]=$str;
416
+		if ($immediatly) {
417
+					$this->jquery_code_for_compile[]=$str;
418
+		}
410 419
 		return $str;
411 420
 	}
412 421
 
@@ -422,11 +431,13 @@  discard block
 block discarded – undo
422 431
 	private function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) {
423 432
 		$param=Javascript::prep_value($param);
424 433
 		$callback="";
425
-		if ($jsCallback!="")
426
-			$callback=", function(event){\n{$jsCallback}\n}";
434
+		if ($jsCallback!="") {
435
+					$callback=", function(event){\n{$jsCallback}\n}";
436
+		}
427 437
 			$script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n";
428
-			if ($immediatly)
429
-				$this->jquery_code_for_compile[]=$script;
438
+			if ($immediatly) {
439
+							$this->jquery_code_for_compile[]=$script;
440
+			}
430 441
 				return $script;
431 442
 	}
432 443
 
@@ -497,8 +508,9 @@  discard block
 block discarded – undo
497 508
 	 */
498 509
 	public function exec($js, $immediatly=false) {
499 510
 		$script=$js."\n";
500
-		if ($immediatly)
501
-			$this->jquery_code_for_compile[]=$script;
511
+		if ($immediatly) {
512
+					$this->jquery_code_for_compile[]=$script;
513
+		}
502 514
 		return $script;
503 515
 	}
504 516
 
@@ -587,7 +599,7 @@  discard block
 block discarded – undo
587 599
 		}
588 600
 		if(isset($globalName)){
589 601
 			$script="if(window.{$globalName}){clearInterval(window.{$globalName});}\nwindow.{$globalName}=setInterval({$jsCode},{$time});";
590
-		}else{
602
+		} else{
591 603
 			$script="setInterval({$jsCode},{$time});";
592 604
 		}
593 605
 		return $this->exec($script,$immediatly);
@@ -617,7 +629,7 @@  discard block
 block discarded – undo
617 629
 		$stop="";
618 630
 		if($countDown){
619 631
 			$stop="if (--timer < ".$limit.") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:".$limit."});}";
620
-		}else{
632
+		} else{
621 633
 			if($limit!=0){
622 634
 				$stop="if (++timer > ".$limit.") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:".$limit."});}";
623 635
 			}
Please login to merge, or discard this patch.
Ajax/common/html/HtmlDoubleElement.php 1 patch
Braces   +19 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,15 +32,17 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function addContent($content,$before=false) {
34 34
 		if (!\is_array($this->content)) {
35
-			if(isset($this->content))
36
-				$this->content=array ($this->content);
37
-			else
38
-				$this->content=array();
35
+			if(isset($this->content)) {
36
+							$this->content=array ($this->content);
37
+			} else {
38
+							$this->content=array();
39
+			}
40
+		}
41
+		if($before) {
42
+					array_unshift($this->content,$content);
43
+		} else {
44
+					$this->content []=$content;
39 45
 		}
40
-		if($before)
41
-			array_unshift($this->content,$content);
42
-		else
43
-			$this->content []=$content;
44 46
 		return $this;
45 47
 	}
46 48
 
@@ -78,9 +80,9 @@  discard block
 block discarded – undo
78 80
 		$instances=[];
79 81
 		if($content instanceof $class){
80 82
 			$instances[]=$content;
81
-		}elseif($content instanceof HtmlDoubleElement){
83
+		} elseif($content instanceof HtmlDoubleElement){
82 84
 			$instances=\array_merge($instances,$content->getContentInstances($class));
83
-		}elseif (\is_array($content)){
85
+		} elseif (\is_array($content)){
84 86
 			foreach ($content as $element){
85 87
 				$instances=\array_merge($instances,$this->_getContentInstances($class, $element));
86 88
 			}
@@ -93,10 +95,12 @@  discard block
 block discarded – undo
93 95
 	 * @return HtmlDoubleElement
94 96
 	 */
95 97
 	public function asLink($href=NULL,$target=NULL) {
96
-		if (isset($href))
97
-			$this->setProperty("href", $href);
98
-		if(isset($target))
99
-			$this->setProperty("target", $target);
98
+		if (isset($href)) {
99
+					$this->setProperty("href", $href);
100
+		}
101
+		if(isset($target)) {
102
+					$this->setProperty("target", $target);
103
+		}
100 104
 		return $this->setTagName("a");
101 105
 	}
102 106
 	
@@ -121,7 +125,7 @@  discard block
 block discarded – undo
121 125
 			$this->_editableContent=$frm;
122 126
 			$keypress="";
123 127
 			$focusOut="";
124
-		}else{
128
+		} else{
125 129
 			$focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');";
126 130
 			$this->_editableContent=$field;
127 131
 			$keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});";
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				$this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++);
65 65
 				$i++;
66 66
 			}
67
-		}else{
67
+		} else{
68 68
 			$separators[]=$count;
69 69
 			for($i=0;$i<$size;$i++){
70 70
 				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
@@ -78,17 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 	protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers,$nb){
80 80
 		$wrapper=null;
81
-		if(isset($headers[$sepFirst+1]))
82
-			$form->addHeader($headers[$sepFirst+1],4,true);
81
+		if(isset($headers[$sepFirst+1])) {
82
+					$form->addHeader($headers[$sepFirst+1],4,true);
83
+		}
83 84
 		if(isset($wrappers[$sepFirst+1])){
84 85
 			$wrapper=$wrappers[$sepFirst+1];
85 86
 		}
86 87
 		if(\sizeof($values)===1){
87 88
 			$added=$form->addField($values[0]);
88
-		}elseif(\sizeof($values)>1){
89
+		} elseif(\sizeof($values)>1){
89 90
 			$added=$form->addFields($values);
90
-		}else
91
-			return;
91
+		} else {
92
+					return;
93
+		}
92 94
 		if(isset($wrapper)){
93 95
 			$added->wrap($wrapper[0],$wrapper[1]);
94 96
 		}
Please login to merge, or discard this patch.