Passed
Push — master ( 216091...2aef24 )
by Jean-Christophe
02:22
created
Ajax/semantic/html/content/table/HtmlTableContent.php 2 patches
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class HtmlTableContent extends HtmlSemCollection {
17 17
 
18
-	protected $_focusable = false;
18
+	protected $_focusable=false;
19 19
 
20
-	protected $_tdTagNames = [
20
+	protected $_tdTagNames=[
21 21
 		"thead" => "th",
22 22
 		"tbody" => "td",
23 23
 		"tfoot" => "th"
24 24
 	];
25 25
 
26
-	protected $_merged = false;
26
+	protected $_merged=false;
27 27
 
28 28
 	/**
29 29
 	 *
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param int $rowCount
33 33
 	 * @param int $colCount
34 34
 	 */
35
-	public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) {
35
+	public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) {
36 36
 		parent::__construct($identifier, $tagName, "");
37 37
 		if (isset($rowCount) && isset($colCount))
38 38
 			$this->setRowCount($rowCount, $colCount);
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @return HtmlTableContent
46 46
 	 */
47 47
 	public function setRowCount($rowCount, $colCount) {
48
-		$count = $this->count();
49
-		for ($i = $count; $i < $rowCount; $i ++) {
48
+		$count=$this->count();
49
+		for ($i=$count; $i<$rowCount; $i++) {
50 50
 			$this->addItem($colCount);
51 51
 		}
52 52
 		return $this;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	}
58 58
 
59 59
 	public function refreshTR() {
60
-		$this->_template = "%wrapContentBefore%%content%%wrapContentAfter%";
60
+		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
61 61
 	}
62 62
 
63 63
 	/**
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 * @return HtmlTR
69 69
 	 */
70 70
 	protected function createItem($value) {
71
-		$count = $this->count();
72
-		$tr = new HtmlTR("");
71
+		$count=$this->count();
72
+		$tr=new HtmlTR("");
73 73
 		$tr->setContainer($this, $count);
74 74
 		if ($this->_focusable) {
75 75
 			$tr->setProperty('tabindex', $count);
76 76
 		}
77 77
 		$tr->setTdTagName($this->_tdTagNames[$this->tagName]);
78
-		if (isset($value) === true) {
78
+		if (isset($value)===true) {
79 79
 			$tr->setColCount($value);
80 80
 		}
81 81
 		return $tr;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		return $this->addItem($row);
104 104
 	}
105 105
 
106
-	public function addMergeRow($colCount, $value = null) {
107
-		$row = $this->addRow($colCount);
106
+	public function addMergeRow($colCount, $value=null) {
107
+		$row=$this->addRow($colCount);
108 108
 		$row->mergeCol();
109 109
 		if (isset($value)) {
110 110
 			$row->setValues([
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 * @return HtmlTD|HtmlDoubleElement
131 131
 	 */
132 132
 	public function getCell($row, $col) {
133
-		$row = $this->getItem($row);
133
+		$row=$this->getItem($row);
134 134
 		if (isset($row) && $row instanceof HtmlCollection) {
135
-			$col = $row->getItem($col);
135
+			$col=$row->getItem($col);
136 136
 		} else {
137
-			$col = $row;
137
+			$col=$row;
138 138
 		}
139 139
 		return $col;
140 140
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 * @param mixed $value
156 156
 	 * @return HtmlTableContent
157 157
 	 */
158
-	public function setCellValue($row, $col, $value = "") {
159
-		$cell = $this->getCell($row, $col);
160
-		if (isset($cell) === true) {
158
+	public function setCellValue($row, $col, $value="") {
159
+		$cell=$this->getCell($row, $col);
160
+		if (isset($cell)===true) {
161 161
 			$cell->setValue($value);
162 162
 		}
163 163
 		return $this;
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @param mixed $values
170 170
 	 */
171
-	public function setValues($values = array()) {
172
-		return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) {
171
+	public function setValues($values=array()) {
172
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {
173 173
 			$row->setValues($_values);
174 174
 		});
175 175
 	}
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @param mixed $values
181 181
 	 */
182
-	public function addValues($values = array()) {
183
-		return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) {
182
+	public function addValues($values=array()) {
183
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {
184 184
 			$row->addValues($_values);
185 185
 		});
186 186
 	}
@@ -192,42 +192,42 @@  discard block
 block discarded – undo
192 192
 	 * @param callable $callback
193 193
 	 */
194 194
 	protected function _addOrSetValues($values, $callback) {
195
-		$count = $this->count();
196
-		$isArray = true;
197
-		if (! \is_array($values)) {
198
-			$values = \array_fill(0, $count, $values);
199
-			$isArray = false;
195
+		$count=$this->count();
196
+		$isArray=true;
197
+		if (!\is_array($values)) {
198
+			$values=\array_fill(0, $count, $values);
199
+			$isArray=false;
200 200
 		}
201
-		if (JArray::dimension($values) == 1 && $isArray)
202
-			$values = [
201
+		if (JArray::dimension($values)==1 && $isArray)
202
+			$values=[
203 203
 				$values
204 204
 			];
205 205
 
206
-		$count = \min(\sizeof($values), $count);
206
+		$count=\min(\sizeof($values), $count);
207 207
 
208
-		for ($i = 0; $i < $count; $i ++) {
209
-			$row = $this->content[$i];
208
+		for ($i=0; $i<$count; $i++) {
209
+			$row=$this->content[$i];
210 210
 			$callback($row, $values[$i]);
211 211
 		}
212 212
 		return $this;
213 213
 	}
214 214
 
215
-	public function setColValues($colIndex, $values = array()) {
216
-		$count = $this->count();
217
-		if (! \is_array($values)) {
218
-			$values = \array_fill(0, $count, $values);
215
+	public function setColValues($colIndex, $values=array()) {
216
+		$count=$this->count();
217
+		if (!\is_array($values)) {
218
+			$values=\array_fill(0, $count, $values);
219 219
 		}
220
-		$count = \min(\sizeof($values), $count);
221
-		for ($i = 0; $i < $count; $i ++) {
220
+		$count=\min(\sizeof($values), $count);
221
+		for ($i=0; $i<$count; $i++) {
222 222
 			$this->getCell($i, $colIndex)->setValue($values[$i]);
223 223
 		}
224 224
 		return $this;
225 225
 	}
226 226
 
227
-	public function addColVariations($colIndex, $variations = array()) {
228
-		$count = $this->count();
229
-		for ($i = 0; $i < $count; $i ++) {
230
-			$cell = $this->getCell($i, $colIndex);
227
+	public function addColVariations($colIndex, $variations=array()) {
228
+		$count=$this->count();
229
+		for ($i=0; $i<$count; $i++) {
230
+			$cell=$this->getCell($i, $colIndex);
231 231
 			if ($cell instanceof BaseTrait)
232 232
 				$cell->addVariations($variations);
233 233
 		}
@@ -235,31 +235,31 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 
237 237
 	public function addPropertyCol($colIndex, $name, $value) {
238
-		$count = $this->count();
239
-		for ($i = 0; $i < $count; $i ++) {
240
-			$cell = $this->getCell($i, $colIndex);
238
+		$count=$this->count();
239
+		for ($i=0; $i<$count; $i++) {
240
+			$cell=$this->getCell($i, $colIndex);
241 241
 			if (isset($cell))
242 242
 				$cell->addToProperty($name, $value);
243 243
 		}
244 244
 		return $this;
245 245
 	}
246 246
 
247
-	public function setRowValues($rowIndex, $values = array()) {
248
-		$count = $this->count();
249
-		if (! \is_array($values)) {
250
-			$values = \array_fill(0, $count, $values);
247
+	public function setRowValues($rowIndex, $values=array()) {
248
+		$count=$this->count();
249
+		if (!\is_array($values)) {
250
+			$values=\array_fill(0, $count, $values);
251 251
 		}
252 252
 		$this->getItem($rowIndex)->setValues($values);
253 253
 		return $this;
254 254
 	}
255 255
 
256 256
 	private function colAlign($colIndex, $function) {
257
-		$count = $this->count();
258
-		for ($i = 0; $i < $count; $i ++) {
259
-			$index = $this->content[$i]->getColPosition($colIndex);
260
-			if ($index !== NULL) {
261
-				$cell = $this->getCell($i, $index);
262
-				if ($cell != NULL) {
257
+		$count=$this->count();
258
+		for ($i=0; $i<$count; $i++) {
259
+			$index=$this->content[$i]->getColPosition($colIndex);
260
+			if ($index!==NULL) {
261
+				$cell=$this->getCell($i, $index);
262
+				if ($cell!=NULL) {
263 263
 					$cell->$function();
264 264
 				}
265 265
 			}
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	}
269 269
 
270 270
 	private function colAlignFromRight($colIndex, $function) {
271
-		$count = $this->count();
272
-		for ($i = 0; $i < $count; $i ++) {
273
-			$maxRow = $this->content[$i]->count();
274
-			$index = $maxRow - $colIndex - 1;
275
-			if (($cell = $this->getCell($i, $index)) !== NULL) {
276
-				if ($cell->getColspan() == 1)
271
+		$count=$this->count();
272
+		for ($i=0; $i<$count; $i++) {
273
+			$maxRow=$this->content[$i]->count();
274
+			$index=$maxRow-$colIndex-1;
275
+			if (($cell=$this->getCell($i, $index))!==NULL) {
276
+				if ($cell->getColspan()==1)
277 277
 					$cell->$function();
278 278
 			}
279 279
 		}
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	 * @return int
320 320
 	 */
321 321
 	public function getColCount() {
322
-		$result = 0;
323
-		if ($this->count() > 0)
324
-			$result = $this->getItem(0)->count();
322
+		$result=0;
323
+		if ($this->count()>0)
324
+			$result=$this->getItem(0)->count();
325 325
 		return $result;
326 326
 	}
327 327
 
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
 	 * @param int $colIndex
333 333
 	 * @return HtmlTableContent
334 334
 	 */
335
-	public function delete($rowIndex, $colIndex = NULL) {
335
+	public function delete($rowIndex, $colIndex=NULL) {
336 336
 		if (isset($colIndex)) {
337
-			$row = $this->getItem($rowIndex);
338
-			if (isset($row) === true) {
337
+			$row=$this->getItem($rowIndex);
338
+			if (isset($row)===true) {
339 339
 				$row->delete($colIndex);
340 340
 			}
341 341
 		} else {
@@ -345,24 +345,24 @@  discard block
 block discarded – undo
345 345
 	}
346 346
 
347 347
 	public function toDelete($rowIndex, $colIndex) {
348
-		$row = $this->getItem($rowIndex);
349
-		if (isset($row) === true)
348
+		$row=$this->getItem($rowIndex);
349
+		if (isset($row)===true)
350 350
 			$row->toDelete($colIndex);
351 351
 		return $this;
352 352
 	}
353 353
 
354 354
 	public function toRowspanned($rowIndex, $colIndex) {
355
-		$row = $this->getItem($rowIndex);
356
-		if (isset($row) === true)
355
+		$row=$this->getItem($rowIndex);
356
+		if (isset($row)===true)
357 357
 			$row->toRowspanned($colIndex);
358 358
 		return $this;
359 359
 	}
360 360
 
361
-	public function mergeCol($rowIndex = 0, $colIndex = 0) {
361
+	public function mergeCol($rowIndex=0, $colIndex=0) {
362 362
 		return $this->getItem($rowIndex)->mergeCol($colIndex);
363 363
 	}
364 364
 
365
-	public function mergeRow($rowIndex = 0, $colIndex = 0) {
365
+	public function mergeRow($rowIndex=0, $colIndex=0) {
366 366
 		return $this->getItem($rowIndex)->mergeRow($colIndex);
367 367
 	}
368 368
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @return HtmlTableContent
383 383
 	 */
384 384
 	public function conditionalCellFormat($callback, $format) {
385
-		$rows = $this->content;
385
+		$rows=$this->content;
386 386
 		foreach ($rows as $row) {
387 387
 			$row->conditionalCellFormat($callback, $format);
388 388
 		}
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 	}
391 391
 
392 392
 	public function conditionalColFormat($colIndex, $callback, $format) {
393
-		$rows = $this->content;
393
+		$rows=$this->content;
394 394
 		foreach ($rows as $row) {
395
-			$cell = $row->getItem($colIndex);
395
+			$cell=$row->getItem($colIndex);
396 396
 			$cell->conditionnalCellFormat($callback, $format);
397 397
 		}
398 398
 		return $this;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @return HtmlTableContent
406 406
 	 */
407 407
 	public function conditionalRowFormat($callback, $format) {
408
-		$rows = $this->content;
408
+		$rows=$this->content;
409 409
 		foreach ($rows as $row) {
410 410
 			$row->conditionalRowFormat($callback, $format);
411 411
 		}
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 	}
414 414
 
415 415
 	public function hideColumn($colIndex) {
416
-		$rows = $this->content;
416
+		$rows=$this->content;
417 417
 		foreach ($rows as $row) {
418
-			$cell = $row->getItem($colIndex);
418
+			$cell=$row->getItem($colIndex);
419 419
 			$cell->addToProperty("style", "display:none;");
420 420
 		}
421 421
 		return $this;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * @return HtmlTableContent
428 428
 	 */
429 429
 	public function applyCells($callback) {
430
-		$rows = $this->content;
430
+		$rows=$this->content;
431 431
 		foreach ($rows as $row) {
432 432
 			$row->applyCells($callback);
433 433
 		}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @return HtmlTableContent
441 441
 	 */
442 442
 	public function applyRows($callback) {
443
-		$rows = $this->content;
443
+		$rows=$this->content;
444 444
 		foreach ($rows as $row) {
445 445
 			$row->apply($callback);
446 446
 		}
@@ -455,28 +455,28 @@  discard block
 block discarded – undo
455 455
 	 * @see https://fomantic-ui.com/collections/table.html#definition needs rowspanned class
456 456
 	 * @since fomantic-ui 2.4.8
457 457
 	 */
458
-	public function mergeIdentiqualValues($colIndex, $function = "strip_tags") {
459
-		$rows = $this->content;
460
-		$identiqual = null;
461
-		$counter = 0;
462
-		$cellToMerge = null;
463
-		$functionExists = \function_exists($function);
458
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
459
+		$rows=$this->content;
460
+		$identiqual=null;
461
+		$counter=0;
462
+		$cellToMerge=null;
463
+		$functionExists=\function_exists($function);
464 464
 		foreach ($rows as $row) {
465
-			$cell = $row->getItem($colIndex);
466
-			$value = $cell->getContent();
465
+			$cell=$row->getItem($colIndex);
466
+			$value=$cell->getContent();
467 467
 			if ($functionExists)
468
-				$value = \call_user_func($function, $value);
469
-			if ($value !== $identiqual) {
470
-				if ($counter > 0 && isset($cellToMerge)) {
468
+				$value=\call_user_func($function, $value);
469
+			if ($value!==$identiqual) {
470
+				if ($counter>0 && isset($cellToMerge)) {
471 471
 					$cellToMerge->setRowspanned($counter);
472 472
 				}
473
-				$counter = 0;
474
-				$cellToMerge = $cell;
475
-				$identiqual = $value;
473
+				$counter=0;
474
+				$cellToMerge=$cell;
475
+				$identiqual=$value;
476 476
 			}
477
-			$counter ++;
477
+			$counter++;
478 478
 		}
479
-		if ($counter > 0 && isset($cellToMerge)) {
479
+		if ($counter>0 && isset($cellToMerge)) {
480 480
 			$cellToMerge->setRowspanned($counter);
481 481
 		}
482 482
 		return $this;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	}
488 488
 
489 489
 	public function _setMerged($value) {
490
-		$this->_merged = $value;
490
+		$this->_merged=$value;
491 491
 		return $this;
492 492
 	}
493 493
 
@@ -496,6 +496,6 @@  discard block
 block discarded – undo
496 496
 	 * @param bool $focusable
497 497
 	 */
498 498
 	public function setFocusable(bool $focusable): void {
499
-		$this->_focusable = $focusable;
499
+		$this->_focusable=$focusable;
500 500
 	}
501 501
 }
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) {
36 36
 		parent::__construct($identifier, $tagName, "");
37
-		if (isset($rowCount) && isset($colCount))
38
-			$this->setRowCount($rowCount, $colCount);
37
+		if (isset($rowCount) && isset($colCount)) {
38
+					$this->setRowCount($rowCount, $colCount);
39
+		}
39 40
 	}
40 41
 
41 42
 	/**
@@ -198,10 +199,11 @@  discard block
 block discarded – undo
198 199
 			$values = \array_fill(0, $count, $values);
199 200
 			$isArray = false;
200 201
 		}
201
-		if (JArray::dimension($values) == 1 && $isArray)
202
-			$values = [
202
+		if (JArray::dimension($values) == 1 && $isArray) {
203
+					$values = [
203 204
 				$values
204 205
 			];
206
+		}
205 207
 
206 208
 		$count = \min(\sizeof($values), $count);
207 209
 
@@ -228,8 +230,9 @@  discard block
 block discarded – undo
228 230
 		$count = $this->count();
229 231
 		for ($i = 0; $i < $count; $i ++) {
230 232
 			$cell = $this->getCell($i, $colIndex);
231
-			if ($cell instanceof BaseTrait)
232
-				$cell->addVariations($variations);
233
+			if ($cell instanceof BaseTrait) {
234
+							$cell->addVariations($variations);
235
+			}
233 236
 		}
234 237
 		return $this;
235 238
 	}
@@ -238,8 +241,9 @@  discard block
 block discarded – undo
238 241
 		$count = $this->count();
239 242
 		for ($i = 0; $i < $count; $i ++) {
240 243
 			$cell = $this->getCell($i, $colIndex);
241
-			if (isset($cell))
242
-				$cell->addToProperty($name, $value);
244
+			if (isset($cell)) {
245
+							$cell->addToProperty($name, $value);
246
+			}
243 247
 		}
244 248
 		return $this;
245 249
 	}
@@ -273,8 +277,9 @@  discard block
 block discarded – undo
273 277
 			$maxRow = $this->content[$i]->count();
274 278
 			$index = $maxRow - $colIndex - 1;
275 279
 			if (($cell = $this->getCell($i, $index)) !== NULL) {
276
-				if ($cell->getColspan() == 1)
277
-					$cell->$function();
280
+				if ($cell->getColspan() == 1) {
281
+									$cell->$function();
282
+				}
278 283
 			}
279 284
 		}
280 285
 		return $this;
@@ -320,8 +325,9 @@  discard block
 block discarded – undo
320 325
 	 */
321 326
 	public function getColCount() {
322 327
 		$result = 0;
323
-		if ($this->count() > 0)
324
-			$result = $this->getItem(0)->count();
328
+		if ($this->count() > 0) {
329
+					$result = $this->getItem(0)->count();
330
+		}
325 331
 		return $result;
326 332
 	}
327 333
 
@@ -346,15 +352,17 @@  discard block
 block discarded – undo
346 352
 
347 353
 	public function toDelete($rowIndex, $colIndex) {
348 354
 		$row = $this->getItem($rowIndex);
349
-		if (isset($row) === true)
350
-			$row->toDelete($colIndex);
355
+		if (isset($row) === true) {
356
+					$row->toDelete($colIndex);
357
+		}
351 358
 		return $this;
352 359
 	}
353 360
 
354 361
 	public function toRowspanned($rowIndex, $colIndex) {
355 362
 		$row = $this->getItem($rowIndex);
356
-		if (isset($row) === true)
357
-			$row->toRowspanned($colIndex);
363
+		if (isset($row) === true) {
364
+					$row->toRowspanned($colIndex);
365
+		}
358 366
 		return $this;
359 367
 	}
360 368
 
@@ -464,8 +472,9 @@  discard block
 block discarded – undo
464 472
 		foreach ($rows as $row) {
465 473
 			$cell = $row->getItem($colIndex);
466 474
 			$value = $cell->getContent();
467
-			if ($functionExists)
468
-				$value = \call_user_func($function, $value);
475
+			if ($functionExists) {
476
+							$value = \call_user_func($function, $value);
477
+			}
469 478
 			if ($value !== $identiqual) {
470 479
 				if ($counter > 0 && isset($cellToMerge)) {
471 480
 					$cellToMerge->setRowspanned($counter);
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 2 patches
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -161,10 +161,11 @@  discard block
 block discarded – undo
161 161
 			} elseif (isset($this->ajaxTransition)) {
162 162
 				$call = $this->ajaxTransition;
163 163
 			}
164
-			if (\is_callable($call))
165
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
166
-			else
167
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
164
+			if (\is_callable($call)) {
165
+							$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
166
+			} else {
167
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
168
+			}
168 169
 		}
169 170
 		if (isset($history)) {
170 171
 			if ($this->params["autoActiveLinks"]) {
@@ -198,8 +199,9 @@  discard block
 block discarded – undo
198 199
 	}
199 200
 
200 201
 	protected function _correctAjaxUrl($url) {
201
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
202
-			$url = substr($url, 0, strlen($url) - 1);
202
+		if ($url !== "/" && JString::endsWith($url, "/") === true) {
203
+					$url = substr($url, 0, strlen($url) - 1);
204
+		}
203 205
 		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
204 206
 			$url = $this->getUrl($url);
205 207
 		}
@@ -223,8 +225,9 @@  discard block
 block discarded – undo
223 225
 	public static function _implodeParams($parameters) {
224 226
 		$allParameters = [];
225 227
 		foreach ($parameters as $params) {
226
-			if (isset($params))
227
-				$allParameters[] = self::_correctParams($params);
228
+			if (isset($params)) {
229
+							$allParameters[] = self::_correctParams($params);
230
+			}
228 231
 		}
229 232
 		return \implode("+'&'+", $allParameters);
230 233
 	}
@@ -258,8 +261,9 @@  discard block
 block discarded – undo
258 261
 
259 262
 	protected function setDefaultParameters(&$parameters, $default) {
260 263
 		foreach ($default as $k => $v) {
261
-			if (! isset($parameters[$k]))
262
-				$parameters[$k] = $v;
264
+			if (! isset($parameters[$k])) {
265
+							$parameters[$k] = $v;
266
+			}
263 267
 		}
264 268
 	}
265 269
 
@@ -833,8 +837,9 @@  discard block
 block discarded – undo
833 837
 			$retour .= "$('#'+" . $form . ").submit();\n";
834 838
 		}
835 839
 		$retour = $this->_addJsCondition($jsCondition, $retour);
836
-		if ($immediatly)
837
-			$this->jquery_code_for_compile[] = $retour;
840
+		if ($immediatly) {
841
+					$this->jquery_code_for_compile[] = $retour;
842
+		}
838 843
 		return $retour;
839 844
 	}
840 845
 
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -15,79 +15,79 @@  discard block
 block discarded – undo
15 15
 
16 16
 	protected $ajaxTransition;
17 17
 
18
-	protected $ajaxLoader = "<div class=\"ui active centered inline text loader\">Loading</div>";
18
+	protected $ajaxLoader="<div class=\"ui active centered inline text loader\">Loading</div>";
19 19
 
20 20
 	abstract public function getUrl($url);
21 21
 
22
-	abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn = false);
22
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false);
23 23
 
24
-	abstract public function interval($jsCode, $time, $globalName = null, $immediatly = true);
24
+	abstract public function interval($jsCode, $time, $globalName=null, $immediatly=true);
25 25
 
26
-	protected function _ajax($method, $url, $responseElement = '', $parameters = []) {
26
+	protected function _ajax($method, $url, $responseElement='', $parameters=[]) {
27 27
 		if (isset($this->params['ajax'])) {
28 28
 			extract($this->params['ajax']);
29 29
 		}
30 30
 		extract($parameters);
31 31
 
32
-		$jsCallback = isset($jsCallback) ? $jsCallback : '';
33
-		$retour = $this->_getAjaxUrl($url, $attr);
34
-		$originalSelector = $responseElement;
35
-		$responseElement = $this->_getResponseElement($responseElement);
36
-		$retour .= "self=this;\n";
37
-		$before = isset($before) ? $before : "";
38
-		$retour .= $before;
39
-		if ($hasLoader === true && JString::isNotNull($responseElement)) {
32
+		$jsCallback=isset($jsCallback) ? $jsCallback : '';
33
+		$retour=$this->_getAjaxUrl($url, $attr);
34
+		$originalSelector=$responseElement;
35
+		$responseElement=$this->_getResponseElement($responseElement);
36
+		$retour.="self=this;\n";
37
+		$before=isset($before) ? $before : "";
38
+		$retour.=$before;
39
+		if ($hasLoader===true && JString::isNotNull($responseElement)) {
40 40
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
41
-		} elseif ($hasLoader === 'response') {
41
+		} elseif ($hasLoader==='response') {
42 42
 			$this->addResponseLoading($retour, $responseElement, $ajaxLoader);
43
-		} elseif ($hasLoader === 'internal-x') {
43
+		} elseif ($hasLoader==='internal-x') {
44 44
 			$this->addLoading($retour, '$(this).closest(".item, .step")', $ajaxLoader);
45
-		} elseif ($hasLoader === 'internal') {
46
-			$retour .= "\n$(this).addClass('loading');";
45
+		} elseif ($hasLoader==='internal') {
46
+			$retour.="\n$(this).addClass('loading');";
47 47
 		} elseif (\is_string($hasLoader)) {
48 48
 			$this->addLoading($retour, $hasLoader, $ajaxLoader);
49 49
 		}
50
-		$ajaxParameters = [
50
+		$ajaxParameters=[
51 51
 			"url" => "url",
52
-			"method" => "'" . \strtoupper($method) . "'"
52
+			"method" => "'".\strtoupper($method)."'"
53 53
 		];
54 54
 
55
-		$ajaxParameters["async"] = ($async ? "true" : "false");
55
+		$ajaxParameters["async"]=($async ? "true" : "false");
56 56
 
57 57
 		if (isset($params)) {
58
-			$ajaxParameters["data"] = self::_correctParams($params, $parameters);
58
+			$ajaxParameters["data"]=self::_correctParams($params, $parameters);
59 59
 		}
60 60
 		if (isset($headers)) {
61
-			$ajaxParameters["headers"] = $headers;
61
+			$ajaxParameters["headers"]=$headers;
62 62
 		}
63 63
 		if ($csrf) {
64
-			$csrf = (is_string($csrf)) ? $csrf : 'csrf-token';
65
-			$parameters["beforeSend"] = "jqXHR.setRequestHeader('{$csrf}', $('meta[name=\"{$csrf}\"]').attr('content'));";
64
+			$csrf=(is_string($csrf)) ? $csrf : 'csrf-token';
65
+			$parameters["beforeSend"]="jqXHR.setRequestHeader('{$csrf}', $('meta[name=\"{$csrf}\"]').attr('content'));";
66 66
 		}
67 67
 		if (isset($partial)) {
68
-			$ajaxParameters["xhr"] = "xhrProvider";
69
-			$retour .= "let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
68
+			$ajaxParameters["xhr"]="xhrProvider";
69
+			$retour.="let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
70 70
 		} elseif (isset($upload)) {
71
-			$ajaxParameters["xhr"] = "xhrProvider";
72
-			$retour .= 'let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.upload.addEventListener("progress", function(event) {if (event.lengthComputable) {' . $upload . '}}, false);';
71
+			$ajaxParameters["xhr"]="xhrProvider";
72
+			$retour.='let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.upload.addEventListener("progress", function(event) {if (event.lengthComputable) {'.$upload.'}}, false);';
73 73
 		}
74 74
 		$this->createAjaxParameters($ajaxParameters, $parameters);
75
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
76
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, ($historize ? $originalSelector : null)) . "})";
75
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n";
76
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, ($historize ? $originalSelector : null))."})";
77 77
 		if (isset($error)) {
78
-			$retour .= '.fail(function( jqXHR, textStatus, errorThrown ){' . $error . '})';
78
+			$retour.='.fail(function( jqXHR, textStatus, errorThrown ){'.$error.'})';
79 79
 		}
80
-		$retour .= '.always(function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {' . ($always ?? '') . $this->removeLoader($hasLoader) . '})';
81
-		$retour .= ";\n";
82
-		$retour = $this->_addJsCondition($jsCondition, $retour);
80
+		$retour.='.always(function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {'.($always ?? '').$this->removeLoader($hasLoader).'})';
81
+		$retour.=";\n";
82
+		$retour=$this->_addJsCondition($jsCondition, $retour);
83 83
 		if ($immediatly) {
84
-			$this->jquery_code_for_compile[] = $retour;
84
+			$this->jquery_code_for_compile[]=$retour;
85 85
 		}
86 86
 		return $retour;
87 87
 	}
88 88
 
89 89
 	protected function createAjaxParameters(&$original, $parameters) {
90
-		$validParameters = [
90
+		$validParameters=[
91 91
 			"contentType" => "%value%",
92 92
 			"dataType" => "'%value%'",
93 93
 			"beforeSend" => "function(jqXHR,settings){%value%}",
@@ -96,21 +96,21 @@  discard block
 block discarded – undo
96 96
 		];
97 97
 		foreach ($validParameters as $param => $mask) {
98 98
 			if (isset($parameters[$param])) {
99
-				$original[$param] = \str_replace("%value%", $parameters[$param], $mask);
99
+				$original[$param]=\str_replace("%value%", $parameters[$param], $mask);
100 100
 			}
101 101
 		}
102 102
 	}
103 103
 
104 104
 	protected function implodeAjaxParameters($ajaxParameters) {
105
-		$s = '';
105
+		$s='';
106 106
 		foreach ($ajaxParameters as $k => $v) {
107
-			if ($s !== '') {
108
-				$s .= ',';
107
+			if ($s!=='') {
108
+				$s.=',';
109 109
 			}
110 110
 			if (is_array($v)) {
111
-				$s .= "'{$k}':{" . self::implodeAjaxParameters($v) . "}";
111
+				$s.="'{$k}':{".self::implodeAjaxParameters($v)."}";
112 112
 			} else {
113
-				$s .= "'{$k}':{$v}";
113
+				$s.="'{$k}':{$v}";
114 114
 			}
115 115
 		}
116 116
 		return $s;
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 
119 119
 	protected function _addJsCondition($jsCondition, $jsSource) {
120 120
 		if (isset($jsCondition)) {
121
-			return "if(" . $jsCondition . "){\n" . $jsSource . "\n}";
121
+			return "if(".$jsCondition."){\n".$jsSource."\n}";
122 122
 		}
123 123
 		return $jsSource;
124 124
 	}
125 125
 
126 126
 	protected function _getAjaxUrl($url, $attr) {
127
-		$url = $this->_correctAjaxUrl($url);
128
-		$retour = "url='" . $url . "';";
129
-		$slash = "/";
130
-		if (JString::endswith($url, "/") === true) {
131
-			$slash = "";
127
+		$url=$this->_correctAjaxUrl($url);
128
+		$retour="url='".$url."';";
129
+		$slash="/";
130
+		if (JString::endswith($url, "/")===true) {
131
+			$slash="";
132 132
 		}
133 133
 
134 134
 		if (JString::isNotNull($attr)) {
135
-			if ($attr === "value") {
136
-				$retour .= "url=url+'" . $slash . "'+$(this).val();\n";
137
-			} elseif ($attr === "html") {
138
-				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
139
-			} elseif (\substr($attr, 0, 3) === "js:") {
140
-				$retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n";
141
-			} elseif ($attr !== null && $attr !== "") {
142
-				$retour .= "let elmUrl=$(this).attr('" . $attr . "')||'';";
143
-				$retour .= "url=!(new RegExp('^((http|https|ftp):\/\/)')).test(elmUrl)?url+'" . $slash . "'+elmUrl:elmUrl;\n";
135
+			if ($attr==="value") {
136
+				$retour.="url=url+'".$slash."'+$(this).val();\n";
137
+			} elseif ($attr==="html") {
138
+				$retour.="url=url+'".$slash."'+$(this).html();\n";
139
+			} elseif (\substr($attr, 0, 3)==="js:") {
140
+				$retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n";
141
+			} elseif ($attr!==null && $attr!=="") {
142
+				$retour.="let elmUrl=$(this).attr('".$attr."')||'';";
143
+				$retour.="url=!(new RegExp('^((http|https|ftp):\/\/)')).test(elmUrl)?url+'".$slash."'+elmUrl:elmUrl;\n";
144 144
 			}
145 145
 		}
146 146
 		return $retour;
@@ -150,44 +150,44 @@  discard block
 block discarded – undo
150 150
 		return "window.onpopstate = function(e){if(e.state){let target=e.state.jqueryDone;$(e.state.selector)[target](e.state.html);}};";
151 151
 	}
152 152
 
153
-	protected function autoActiveLinks($previousURL = "window.location.href") {
154
-		$result = "\nif (typeof getHref !== 'function'){function getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}}";
155
-		$result .= "\nlet myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
153
+	protected function autoActiveLinks($previousURL="window.location.href") {
154
+		$result="\nif (typeof getHref !== 'function'){function getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}}";
155
+		$result.="\nlet myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
156 156
 		return $result;
157 157
 	}
158 158
 
159
-	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $history = null) {
160
-		$retour = "";
161
-		$call = null;
159
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $history=null) {
160
+		$retour="";
161
+		$call=null;
162 162
 		if (JString::isNotNull($responseElement)) {
163 163
 			if (isset($ajaxTransition)) {
164
-				$call = $this->setAjaxDataCall($ajaxTransition);
164
+				$call=$this->setAjaxDataCall($ajaxTransition);
165 165
 			} elseif (isset($this->ajaxTransition)) {
166
-				$call = $this->ajaxTransition;
166
+				$call=$this->ajaxTransition;
167 167
 			}
168 168
 			if (\is_callable($call))
169
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
169
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
170 170
 			else
171
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
171
+				$retour="\t{$responseElement}.{$jqueryDone}( data );\n";
172 172
 		}
173 173
 		if (isset($history)) {
174 174
 			if ($this->params["autoActiveLinks"]) {
175
-				$retour .= $this->autoActiveLinks("url");
175
+				$retour.=$this->autoActiveLinks("url");
176 176
 			}
177
-			$retour .= "\nwindow.history.pushState({'html':data,'selector':" . Javascript::prep_value($history) . ",'jqueryDone':'{$jqueryDone}'},'', url);";
177
+			$retour.="\nwindow.history.pushState({'html':data,'selector':".Javascript::prep_value($history).",'jqueryDone':'{$jqueryDone}'},'', url);";
178 178
 		}
179
-		$retour .= "\t" . $jsCallback . "\n";
179
+		$retour.="\t".$jsCallback."\n";
180 180
 		return $retour;
181 181
 	}
182 182
 
183 183
 	protected function removeLoader($hasLoader) {
184
-		if ($hasLoader === true) {
184
+		if ($hasLoader===true) {
185 185
 			return "\n$('body').find('.ajax-loader').remove();";
186 186
 		}
187
-		if ($hasLoader === 'internal') {
187
+		if ($hasLoader==='internal') {
188 188
 			return "\n$(self).removeClass('loading');";
189 189
 		}
190
-		if ($hasLoader === 'internal-x') {
190
+		if ($hasLoader==='internal-x') {
191 191
 			return "\n$(self).children('.ajax-loader').remove();";
192 192
 		}
193 193
 		return "\n$('body').find('.loading').removeClass('loading');";
@@ -195,71 +195,71 @@  discard block
 block discarded – undo
195 195
 
196 196
 	protected function _getResponseElement($responseElement) {
197 197
 		if (JString::isNotNull($responseElement)) {
198
-			$responseElement = Javascript::prep_jquery_selector($responseElement);
198
+			$responseElement=Javascript::prep_jquery_selector($responseElement);
199 199
 		}
200 200
 		return $responseElement;
201 201
 	}
202 202
 
203 203
 	protected function _getFormElement($formElement) {
204 204
 		if (JString::isNotNull($formElement)) {
205
-			$formElement = Javascript::prep_value($formElement);
205
+			$formElement=Javascript::prep_value($formElement);
206 206
 		}
207 207
 		return $formElement;
208 208
 	}
209 209
 
210 210
 	protected function _correctAjaxUrl($url) {
211
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
212
-			$url = substr($url, 0, strlen($url) - 1);
213
-		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
214
-			$url = $this->getUrl($url);
211
+		if ($url!=="/" && JString::endsWith($url, "/")===true)
212
+			$url=substr($url, 0, strlen($url)-1);
213
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
214
+			$url=$this->getUrl($url);
215 215
 		}
216 216
 		return $url;
217 217
 	}
218 218
 
219
-	public static function _correctParams($params, $ajaxParameters = []) {
219
+	public static function _correctParams($params, $ajaxParameters=[]) {
220 220
 		if (JString::isNull($params)) {
221 221
 			return "";
222 222
 		}
223 223
 		if (\preg_match("@^\{.*?\}$@", $params)) {
224
-			if (! isset($ajaxParameters['contentType']) || ! JString::contains($ajaxParameters['contentType'], 'json')) {
225
-				return '$.param(' . $params . ')';
224
+			if (!isset($ajaxParameters['contentType']) || !JString::contains($ajaxParameters['contentType'], 'json')) {
225
+				return '$.param('.$params.')';
226 226
 			} else {
227
-				return 'JSON.stringify(' . $params . ')';
227
+				return 'JSON.stringify('.$params.')';
228 228
 			}
229 229
 		}
230 230
 		return $params;
231 231
 	}
232 232
 
233 233
 	public static function _implodeParams($parameters) {
234
-		$allParameters = [];
234
+		$allParameters=[];
235 235
 		foreach ($parameters as $params) {
236 236
 			if (isset($params))
237
-				$allParameters[] = self::_correctParams($params);
237
+				$allParameters[]=self::_correctParams($params);
238 238
 		}
239 239
 		return \implode("+'&'+", $allParameters);
240 240
 	}
241 241
 
242
-	protected function addLoading(&$retour, $responseElement, $ajaxLoader = null) {
243
-		if (! isset($ajaxLoader)) {
244
-			$ajaxLoader = $this->ajaxLoader;
242
+	protected function addLoading(&$retour, $responseElement, $ajaxLoader=null) {
243
+		if (!isset($ajaxLoader)) {
244
+			$ajaxLoader=$this->ajaxLoader;
245 245
 		}
246
-		$loading_notifier = '<div class="ajax-loader ui active inverted dimmer">' . $ajaxLoader . '</div>';
247
-		$retour .= "\t\t{$responseElement}.append('{$loading_notifier}');\n";
246
+		$loading_notifier='<div class="ajax-loader ui active inverted dimmer">'.$ajaxLoader.'</div>';
247
+		$retour.="\t\t{$responseElement}.append('{$loading_notifier}');\n";
248 248
 	}
249 249
 
250
-	protected function addResponseLoading(&$retour, $responseElement, $ajaxLoader = null) {
251
-		if (! isset($ajaxLoader)) {
252
-			$ajaxLoader = $this->ajaxLoader;
250
+	protected function addResponseLoading(&$retour, $responseElement, $ajaxLoader=null) {
251
+		if (!isset($ajaxLoader)) {
252
+			$ajaxLoader=$this->ajaxLoader;
253 253
 		}
254
-		$loading_notifier = '<div class="ajax-loader">' . $ajaxLoader . '</div>';
255
-		$retour .= "{$responseElement}.empty();\n";
256
-		$retour .= "\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
254
+		$loading_notifier='<div class="ajax-loader">'.$ajaxLoader.'</div>';
255
+		$retour.="{$responseElement}.empty();\n";
256
+		$retour.="\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
257 257
 	}
258 258
 
259 259
 	protected function setAjaxDataCall($params) {
260
-		$result = null;
261
-		if (! \is_callable($params)) {
262
-			$result = function ($responseElement, $jqueryDone = 'html') use ($params) {
260
+		$result=null;
261
+		if (!\is_callable($params)) {
262
+			$result=function($responseElement, $jqueryDone='html') use ($params) {
263 263
 				return AjaxTransition::{$params}($responseElement, $jqueryDone);
264 264
 			};
265 265
 		}
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 
269 269
 	protected function setDefaultParameters(&$parameters, $default) {
270 270
 		foreach ($default as $k => $v) {
271
-			if (! isset($parameters[$k]))
272
-				$parameters[$k] = $v;
271
+			if (!isset($parameters[$k]))
272
+				$parameters[$k]=$v;
273 273
 		}
274 274
 	}
275 275
 
276 276
 	public function setAjaxLoader($loader) {
277
-		$this->ajaxLoader = $loader;
277
+		$this->ajaxLoader=$loader;
278 278
 	}
279 279
 
280 280
 	/**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @param string $responseElement
286 286
 	 *        	selector of the HTML element displaying the answer
287 287
 	 */
288
-	private function _get($url, $responseElement = '', $parameters = []) {
288
+	private function _get($url, $responseElement='', $parameters=[]) {
289 289
 		return $this->_ajax('get', $url, $responseElement, $parameters);
290 290
 	}
291 291
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 * @param array $parameters
300 300
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
301 301
 	 */
302
-	public function get($url, $responseElement = '', $parameters = []) {
303
-		$parameters['immediatly'] = true;
302
+	public function get($url, $responseElement='', $parameters=[]) {
303
+		$parameters['immediatly']=true;
304 304
 		return $this->_get($url, $responseElement, $parameters);
305 305
 	}
306 306
 
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
 	 * @param array $parameters
317 317
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
318 318
 	 */
319
-	public function ajax($method, $url, $responseElement = '', $parameters = []) {
320
-		$parameters['immediatly'] = true;
319
+	public function ajax($method, $url, $responseElement='', $parameters=[]) {
320
+		$parameters['immediatly']=true;
321 321
 		return $this->_ajax($method, $url, $responseElement, $parameters);
322 322
 	}
323 323
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 *        	$immediatly
340 340
 	 * @return string
341 341
 	 */
342
-	public function ajaxInterval($method, $url, $interval, $globalName = null, $responseElement = '', $parameters = [], $immediatly = true) {
342
+	public function ajaxInterval($method, $url, $interval, $globalName=null, $responseElement='', $parameters=[], $immediatly=true) {
343 343
 		return $this->interval($this->ajaxDeferred($method, $url, $responseElement, $parameters), $interval, $globalName, $immediatly);
344 344
 	}
345 345
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	 * @param array $parameters
356 356
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
357 357
 	 */
358
-	public function ajaxDeferred($method, $url, $responseElement = '', $parameters = []) {
359
-		$parameters['immediatly'] = false;
358
+	public function ajaxDeferred($method, $url, $responseElement='', $parameters=[]) {
359
+		$parameters['immediatly']=false;
360 360
 		return $this->_ajax($method, $url, $responseElement, $parameters);
361 361
 	}
362 362
 
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 	 * @param array $parameters
371 371
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
372 372
 	 */
373
-	private function _json($url, $method = "get", $parameters = []) {
374
-		$parameters = \array_merge($parameters, [
373
+	private function _json($url, $method="get", $parameters=[]) {
374
+		$parameters=\array_merge($parameters, [
375 375
 			"hasLoader" => false
376 376
 		]);
377
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
378
-		$context = isset($parameters['context']) ? $parameters['context'] : "document";
379
-		$retour = "\tdata=($.isPlainObject(data))?data:JSON.parse(data);\t" . $jsCallback . ";" . "\n\tfor(var key in data){" . "if($('#'+key," . $context . ").length){ if($('#'+key," . $context . ").is('[value]')) { $('#'+key," . $context . ").val(data[key]);} else { $('#'+key," . $context . ").html(data[key]); }}};\n";
380
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
381
-		$parameters["jsCallback"] = $retour;
377
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
378
+		$context=isset($parameters['context']) ? $parameters['context'] : "document";
379
+		$retour="\tdata=($.isPlainObject(data))?data:JSON.parse(data);\t".$jsCallback.";"."\n\tfor(var key in data){"."if($('#'+key,".$context.").length){ if($('#'+key,".$context.").is('[value]')) { $('#'+key,".$context.").val(data[key]);} else { $('#'+key,".$context.").html(data[key]); }}};\n";
380
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
381
+		$parameters["jsCallback"]=$retour;
382 382
 		return $this->_ajax($method, $url, null, $parameters);
383 383
 	}
384 384
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @param array $parameters
393 393
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
394 394
 	 */
395
-	public function json($url, $method = "get", $parameters = []) {
395
+	public function json($url, $method="get", $parameters=[]) {
396 396
 		return $this->_json($url, $method, $parameters);
397 397
 	}
398 398
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @param array $parameters
409 409
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true,"before"=>null,"listenerOn"=>false)
410 410
 	 */
411
-	public function jsonOn($event, $element, $url, $method = 'get', $parameters = array()) {
411
+	public function jsonOn($event, $element, $url, $method='get', $parameters=array()) {
412 412
 		$this->setDefaultParameters($parameters, [
413 413
 			'preventDefault' => true,
414 414
 			'stopPropagation' => true,
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @param array $parameters
429 429
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
430 430
 	 */
431
-	public function jsonDeferred($url, $method = 'get', $parameters = []) {
432
-		$parameters['immediatly'] = false;
431
+	public function jsonDeferred($url, $method='get', $parameters=[]) {
432
+		$parameters['immediatly']=false;
433 433
 		return $this->_json($url, $method, $parameters);
434 434
 	}
435 435
 
@@ -444,29 +444,29 @@  discard block
 block discarded – undo
444 444
 	 * @param array $parameters
445 445
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
446 446
 	 */
447
-	private function _jsonArray($maskSelector, $url, $method = 'get', $parameters = []) {
448
-		$parameters = \array_merge($parameters, [
447
+	private function _jsonArray($maskSelector, $url, $method='get', $parameters=[]) {
448
+		$parameters=\array_merge($parameters, [
449 449
 			"hasLoader" => false
450 450
 		]);
451
-		$rowClass = isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
452
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
453
-		$context = isset($parameters['context']) ? $parameters['context'] : null;
454
-		if ($context === null) {
455
-			$parent = "$('" . $maskSelector . "').parent()";
456
-			$newElm = "$('#'+newId)";
451
+		$rowClass=isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
452
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
453
+		$context=isset($parameters['context']) ? $parameters['context'] : null;
454
+		if ($context===null) {
455
+			$parent="$('".$maskSelector."').parent()";
456
+			$newElm="$('#'+newId)";
457 457
 		} else {
458
-			$parent = $context;
459
-			$newElm = $context . ".find('#'+newId)";
458
+			$parent=$context;
459
+			$newElm=$context.".find('#'+newId)";
460 460
 		}
461
-		$appendTo = "\t\tnewElm.appendTo(" . $parent . ");\n";
462
-		$retour = $parent . ".find('.{$rowClass}').remove();";
463
-		$retour .= "\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.each(data, function(index, value) {\n" . "\tlet created=false;let maskElm=$('" . $maskSelector . "').first();maskElm.hide();" . "\tlet newId=(maskElm.attr('id') || 'mask')+'-'+index;" . "\tlet newElm=" . $newElm . ";\n" . "\tif(!newElm.length){\n" . "\t\tnewElm=maskElm.clone();
461
+		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
462
+		$retour=$parent.".find('.{$rowClass}').remove();";
463
+		$retour.="\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.each(data, function(index, value) {\n"."\tlet created=false;let maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tlet newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tlet newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();
464 464
 		newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ let newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
465
-		$retour .= $appendTo;
466
-		$retour .= "\t}\n" . "\tfor(var key in value){\n" . "\t\t\tlet html = $('<div />').append($(newElm).clone()).html();\n" . "\t\t\tif(html.indexOf('__'+key+'__')>-1){\n" . "\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n" . "\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n" . "\t\t\t}\n" . "\t\tlet sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n" . "\t\t\tlet selElm=$(sel,newElm);\n" . "\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n" . "\t\t}\n" . "}\n" . "\t$(newElm).show(true);" . "\n" . "\t$(newElm).removeClass('hide');" . "});\n";
467
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
468
-		$retour .= "\t" . $jsCallback;
469
-		$parameters["jsCallback"] = $retour;
465
+		$retour.=$appendTo;
466
+		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tlet html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tlet sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tlet selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
467
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
468
+		$retour.="\t".$jsCallback;
469
+		$parameters["jsCallback"]=$retour;
470 470
 		return $this->_ajax($method, $url, null, $parameters);
471 471
 	}
472 472
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	 * @param array $parameters
482 482
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
483 483
 	 */
484
-	public function jsonArray($maskSelector, $url, $method = 'get', $parameters = []) {
484
+	public function jsonArray($maskSelector, $url, $method='get', $parameters=[]) {
485 485
 		return $this->_jsonArray($maskSelector, $url, $method, $parameters);
486 486
 	}
487 487
 
@@ -496,8 +496,8 @@  discard block
 block discarded – undo
496 496
 	 * @param array $parameters
497 497
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"rowClass"=>"_json","before"=>null)
498 498
 	 */
499
-	public function jsonArrayDeferred($maskSelector, $url, $method = 'get', $parameters = []) {
500
-		$parameters['immediatly'] = false;
499
+	public function jsonArrayDeferred($maskSelector, $url, $method='get', $parameters=[]) {
500
+		$parameters['immediatly']=false;
501 501
 		return $this->jsonArray($maskSelector, $url, $method, $parameters);
502 502
 	}
503 503
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	 * @param array $parameters
514 514
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true,"before"=>null,"listenerOn"=>false)
515 515
 	 */
516
-	public function jsonArrayOn($event, $element, $maskSelector, $url, $method = 'get', $parameters = array()) {
516
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $method='get', $parameters=array()) {
517 517
 		$this->setDefaultParameters($parameters, [
518 518
 			'preventDefault' => true,
519 519
 			'stopPropagation' => true,
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 	 * @param array $parameters
535 535
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
536 536
 	 */
537
-	public function getDeferred($url, $responseElement = "", $parameters = []) {
538
-		$parameters['immediatly'] = false;
537
+	public function getDeferred($url, $responseElement="", $parameters=[]) {
538
+		$parameters['immediatly']=false;
539 539
 		return $this->_get($url, $responseElement, $parameters);
540 540
 	}
541 541
 
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 	 * @param array $parameters
555 555
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
556 556
 	 */
557
-	public function getOn($event, $element, $url, $responseElement = "", $parameters = array()) {
558
-		$parameters['method'] = 'get';
557
+	public function getOn($event, $element, $url, $responseElement="", $parameters=array()) {
558
+		$parameters['method']='get';
559 559
 		return $this->ajaxOn($event, $element, $url, $responseElement, $parameters);
560 560
 	}
561 561
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 * @param array $parameters
575 575
 	 *        	default : array("method"=>"get","preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
576 576
 	 */
577
-	public function ajaxOn($event, $element, $url, $responseElement = '', $parameters = array()) {
577
+	public function ajaxOn($event, $element, $url, $responseElement='', $parameters=array()) {
578 578
 		$this->setDefaultParameters($parameters, [
579 579
 			'preventDefault' => true,
580 580
 			'stopPropagation' => true,
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	 * @param array $parameters
599 599
 	 *        	default : array("method"=>"get","preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
600 600
 	 */
601
-	public function ajaxOnClick($element, $url, $responseElement = '', $parameters = array()) {
601
+	public function ajaxOnClick($element, $url, $responseElement='', $parameters=array()) {
602 602
 		return $this->ajaxOn('click', $element, $url, $responseElement, $parameters);
603 603
 	}
604 604
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @param array $parameters
616 616
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
617 617
 	 */
618
-	public function getOnClick($element, $url, $responseElement = '', $parameters = array()) {
618
+	public function getOnClick($element, $url, $responseElement='', $parameters=array()) {
619 619
 		return $this->getOn('click', $element, $url, $responseElement, $parameters);
620 620
 	}
621 621
 
@@ -630,18 +630,18 @@  discard block
 block discarded – undo
630 630
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>true,"before"=>null,"listenerOn"=>false)
631 631
 	 * @return $this
632 632
 	 */
633
-	public function getHref($element, $responseElement = "", $parameters = array()) {
634
-		$parameters['attr'] = 'href';
633
+	public function getHref($element, $responseElement="", $parameters=array()) {
634
+		$parameters['attr']='href';
635 635
 		if (JString::isNull($responseElement)) {
636
-			$responseElement = '%$(self).attr("data-target")%';
636
+			$responseElement='%$(self).attr("data-target")%';
637 637
 		} else {
638
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
638
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
639 639
 		}
640
-		if (! isset($parameters['historize'])) {
641
-			$parameters['historize'] = true;
640
+		if (!isset($parameters['historize'])) {
641
+			$parameters['historize']=true;
642 642
 		}
643
-		if (! isset($parameters['jsCallback'])) {
644
-			$parameters['jsCallback'] = 'let event = jQuery.Event( "getHref" );event.url = url;$(self).trigger(event);';
643
+		if (!isset($parameters['jsCallback'])) {
644
+			$parameters['jsCallback']='let event = jQuery.Event( "getHref" );event.url = url;$(self).trigger(event);';
645 645
 		}
646 646
 		return $this->getOnClick($element, "", $responseElement, $parameters);
647 647
 	}
@@ -657,15 +657,15 @@  discard block
 block discarded – undo
657 657
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>true,"before"=>null,"listenerOn"=>false)
658 658
 	 * @return $this
659 659
 	 */
660
-	public function postHref($element, $responseElement = "", $parameters = array()) {
661
-		$parameters['attr'] = 'href';
660
+	public function postHref($element, $responseElement="", $parameters=array()) {
661
+		$parameters['attr']='href';
662 662
 		if (JString::isNull($responseElement)) {
663
-			$responseElement = '%$(this).attr("data-target")%';
663
+			$responseElement='%$(this).attr("data-target")%';
664 664
 		} else {
665
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
665
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
666 666
 		}
667
-		if (! isset($parameters['historize'])) {
668
-			$parameters['historize'] = true;
667
+		if (!isset($parameters['historize'])) {
668
+			$parameters['historize']=true;
669 669
 		}
670 670
 		return $this->postOnClick($element, '', '{}', $responseElement, $parameters);
671 671
 	}
@@ -681,29 +681,29 @@  discard block
 block discarded – undo
681 681
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>true,"before"=>null,"listenerOn"=>false)
682 682
 	 * @return $this
683 683
 	 */
684
-	public function postFormAction($element, $responseElement = "", $parameters = array()) {
685
-		$parameters['attr'] = 'action';
684
+	public function postFormAction($element, $responseElement="", $parameters=array()) {
685
+		$parameters['attr']='action';
686 686
 		if (JString::isNull($responseElement)) {
687
-			$responseElement = '%$(self).attr("data-target")%';
687
+			$responseElement='%$(self).attr("data-target")%';
688 688
 		} else {
689
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
689
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
690 690
 		}
691
-		$formId = '%$(this).attr("id")%';
692
-		if (! isset($parameters['historize'])) {
693
-			$parameters['historize'] = true;
691
+		$formId='%$(this).attr("id")%';
692
+		if (!isset($parameters['historize'])) {
693
+			$parameters['historize']=true;
694 694
 		}
695
-		$parameters['preventDefault'] = true;
696
-		if (! isset($parameters['hasLoader'])) {
697
-			$parameters['hasLoader'] = '$(self).find("button, input[type=submit], input[type=button]")';
695
+		$parameters['preventDefault']=true;
696
+		if (!isset($parameters['hasLoader'])) {
697
+			$parameters['hasLoader']='$(self).find("button, input[type=submit], input[type=button]")';
698 698
 		}
699
-		if (! isset($parameters['jsCallback'])) {
700
-			$parameters['jsCallback'] = 'let event = jQuery.Event( "postFormAction" );event.params = Object.fromEntries(new URLSearchParams(params));$(self).trigger(event);';
699
+		if (!isset($parameters['jsCallback'])) {
700
+			$parameters['jsCallback']='let event = jQuery.Event( "postFormAction" );event.params = Object.fromEntries(new URLSearchParams(params));$(self).trigger(event);';
701 701
 		}
702 702
 		return $this->postFormOn('submit', $element, '', $formId, $responseElement, $parameters);
703 703
 	}
704 704
 
705
-	private function _post($url, $params = '{}', $responseElement = '', $parameters = []) {
706
-		$parameters['params'] = $params;
705
+	private function _post($url, $params='{}', $responseElement='', $parameters=[]) {
706
+		$parameters['params']=$params;
707 707
 		return $this->_ajax('POST', $url, $responseElement, $parameters);
708 708
 	}
709 709
 
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
 	 * @param array $parameters
720 720
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
721 721
 	 */
722
-	public function post($url, $params = "{}", $responseElement = "", $parameters = []) {
723
-		$parameters['immediatly'] = true;
722
+	public function post($url, $params="{}", $responseElement="", $parameters=[]) {
723
+		$parameters['immediatly']=true;
724 724
 		return $this->_post($url, $params, $responseElement, $parameters);
725 725
 	}
726 726
 
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 	 * @param array $parameters
738 738
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
739 739
 	 */
740
-	public function postDeferred($url, $params = "{}", $responseElement = "", $parameters = []) {
741
-		$parameters['immediatly'] = false;
740
+	public function postDeferred($url, $params="{}", $responseElement="", $parameters=[]) {
741
+		$parameters['immediatly']=false;
742 742
 		return $this->_post($url, $params, $responseElement, $parameters);
743 743
 	}
744 744
 
@@ -757,9 +757,9 @@  discard block
 block discarded – undo
757 757
 	 * @param array $parameters
758 758
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
759 759
 	 */
760
-	public function postOn($event, $element, $url, $params = "{}", $responseElement = "", $parameters = array()) {
761
-		$parameters['method'] = 'post';
762
-		$parameters['params'] = $params;
760
+	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
761
+		$parameters['method']='post';
762
+		$parameters['params']=$params;
763 763
 		return $this->ajaxOn($event, $element, $url, $responseElement, $parameters);
764 764
 	}
765 765
 
@@ -777,75 +777,75 @@  discard block
 block discarded – undo
777 777
 	 * @param array $parameters
778 778
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"before"=>null,"listenerOn"=>false)
779 779
 	 */
780
-	public function postOnClick($element, $url, $params = '{}', $responseElement = '', $parameters = array()) {
780
+	public function postOnClick($element, $url, $params='{}', $responseElement='', $parameters=array()) {
781 781
 		return $this->postOn('click', $element, $url, $params, $responseElement, $parameters);
782 782
 	}
783 783
 
784
-	private function _postForm($url, $form, $responseElement, $parameters = []) {
784
+	private function _postForm($url, $form, $responseElement, $parameters=[]) {
785 785
 		if (isset($this->params['ajax'])) {
786 786
 			extract($this->params['ajax']);
787 787
 		}
788
-		$params = '{}';
789
-		$validation = false;
788
+		$params='{}';
789
+		$validation=false;
790 790
 		\extract($parameters);
791
-		$async = ($async) ? 'true' : 'false';
792
-		$jsCallback = isset($jsCallback) ? $jsCallback : "";
793
-		$retour = $this->_getAjaxUrl($url, $attr);
794
-		$form = $this->_getFormElement($form);
795
-		$retour .= "\n$('#'+" . $form . ").trigger('ajaxSubmit');";
796
-		if (! isset($contentType) || $contentType != 'false') {
797
-			$retour .= "\nlet params=$('#'+" . $form . ").serialize();\n";
791
+		$async=($async) ? 'true' : 'false';
792
+		$jsCallback=isset($jsCallback) ? $jsCallback : "";
793
+		$retour=$this->_getAjaxUrl($url, $attr);
794
+		$form=$this->_getFormElement($form);
795
+		$retour.="\n$('#'+".$form.").trigger('ajaxSubmit');";
796
+		if (!isset($contentType) || $contentType!='false') {
797
+			$retour.="\nlet params=$('#'+".$form.").serialize();\n";
798 798
 			if (isset($params)) {
799
-				$retour .= "params+='&'+" . self::_correctParams($params) . ";\n";
799
+				$retour.="params+='&'+".self::_correctParams($params).";\n";
800 800
 			}
801 801
 		} else {
802
-			$retour .= "\nlet params=new FormData($('#'+" . $form . ")[0]);\n";
802
+			$retour.="\nlet params=new FormData($('#'+".$form.")[0]);\n";
803 803
 		}
804
-		$responseElement = $this->_getResponseElement($responseElement);
805
-		$retour .= "let self=this;\n";
806
-		$before = isset($before) ? $before : "";
807
-		$retour .= $before;
808
-		if ($hasLoader === true) {
804
+		$responseElement=$this->_getResponseElement($responseElement);
805
+		$retour.="let self=this;\n";
806
+		$before=isset($before) ? $before : "";
807
+		$retour.=$before;
808
+		if ($hasLoader===true) {
809 809
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
810
-		} elseif ($hasLoader === 'response') {
810
+		} elseif ($hasLoader==='response') {
811 811
 			$this->addResponseLoading($retour, $responseElement, $ajaxLoader);
812
-		} elseif ($hasLoader === 'internal-x') {
812
+		} elseif ($hasLoader==='internal-x') {
813 813
 			$this->addLoading($retour, '$(this).closest(".item, .step")', $ajaxLoader);
814
-		} elseif ($hasLoader === 'internal') {
815
-			$retour .= "\n$(this).addClass('loading');";
814
+		} elseif ($hasLoader==='internal') {
815
+			$retour.="\n$(this).addClass('loading');";
816 816
 		} elseif (\is_string($hasLoader)) {
817
-			$retour .= "\n$hasLoader.addClass('loading');";
817
+			$retour.="\n$hasLoader.addClass('loading');";
818 818
 		}
819
-		$ajaxParameters = [
819
+		$ajaxParameters=[
820 820
 			"url" => "url",
821 821
 			"method" => "'POST'",
822 822
 			"data" => "params",
823 823
 			"async" => $async
824 824
 		];
825 825
 		if (isset($headers)) {
826
-			$ajaxParameters["headers"] = $headers;
826
+			$ajaxParameters["headers"]=$headers;
827 827
 		}
828 828
 		if (isset($partial)) {
829
-			$ajaxParameters["xhr"] = "xhrProvider";
830
-			$retour .= "let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
829
+			$ajaxParameters["xhr"]="xhrProvider";
830
+			$retour.="let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
831 831
 		}
832 832
 		$this->createAjaxParameters($ajaxParameters, $parameters);
833
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data ) {\n";
834
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) . "})";
833
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data ) {\n";
834
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."})";
835 835
 		if (isset($error)) {
836
-			$retour .= '.fail(function( jqXHR, textStatus, errorThrown ){' . $error . '})';
836
+			$retour.='.fail(function( jqXHR, textStatus, errorThrown ){'.$error.'})';
837 837
 		}
838
-		$retour .= '.always(function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {' . ($always ?? '') . $this->removeLoader($hasLoader) . '})';
839
-		$retour .= ";\n";
838
+		$retour.='.always(function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {'.($always ?? '').$this->removeLoader($hasLoader).'})';
839
+		$retour.=";\n";
840 840
 		if ($validation) {
841
-			$retour = "$('#'+" . $form . ").validate({submitHandler: function(form) {
842
-			" . $retour . "
841
+			$retour="$('#'+".$form.").validate({submitHandler: function(form) {
842
+			" . $retour."
843 843
 			}});\n";
844
-			$retour .= "$('#'+" . $form . ").submit();\n";
844
+			$retour.="$('#'+".$form.").submit();\n";
845 845
 		}
846
-		$retour = $this->_addJsCondition($jsCondition, $retour);
846
+		$retour=$this->_addJsCondition($jsCondition, $retour);
847 847
 		if ($immediatly)
848
-			$this->jquery_code_for_compile[] = $retour;
848
+			$this->jquery_code_for_compile[]=$retour;
849 849
 		return $retour;
850 850
 	}
851 851
 
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	 * @param array $parameters
862 862
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
863 863
 	 */
864
-	public function postForm($url, $form, $responseElement, $parameters = []) {
865
-		$parameters['immediatly'] = true;
864
+	public function postForm($url, $form, $responseElement, $parameters=[]) {
865
+		$parameters['immediatly']=true;
866 866
 		return $this->_postForm($url, $form, $responseElement, $parameters);
867 867
 	}
868 868
 
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
 	 * @param array $parameters
880 880
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
881 881
 	 */
882
-	public function postFormDeferred($url, $form, $responseElement, $parameters = []) {
883
-		$parameters['immediatly'] = false;
882
+	public function postFormDeferred($url, $form, $responseElement, $parameters=[]) {
883
+		$parameters['immediatly']=false;
884 884
 		return $this->_postForm($url, $form, $responseElement, $parameters);
885 885
 	}
886 886
 
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @param array $parameters
898 898
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
899 899
 	 */
900
-	public function postFormOn($event, $element, $url, $form, $responseElement = "", $parameters = array()) {
900
+	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
901 901
 		$this->setDefaultParameters($parameters, [
902 902
 			'preventDefault' => true,
903 903
 			'stopPropagation' => true,
@@ -919,11 +919,11 @@  discard block
 block discarded – undo
919 919
 	 * @param array $parameters
920 920
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
921 921
 	 */
922
-	public function postFormOnClick($element, $url, $form, $responseElement = "", $parameters = array()) {
922
+	public function postFormOnClick($element, $url, $form, $responseElement="", $parameters=array()) {
923 923
 		return $this->postFormOn("click", $element, $url, $form, $responseElement, $parameters);
924 924
 	}
925 925
 
926
-	public function addCsrf($name = 'csrf-token') {
926
+	public function addCsrf($name='csrf-token') {
927 927
 		return "
928 928
 		$.ajaxSetup({
929 929
 			beforeSend: function(xhr, settings) {
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormInput.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@  discard block
 block discarded – undo
7 7
 class HtmlFormInput extends HtmlFormField {
8 8
 	use TextFieldsTrait;
9 9
 
10
-	const TOGGLE_CLICK = 0;
10
+	const TOGGLE_CLICK=0;
11 11
 
12
-	const TOGGLE_MOUSEDOWN = 1;
12
+	const TOGGLE_MOUSEDOWN=1;
13 13
 
14
-	const TOGGLE_INTERVAL = 2;
14
+	const TOGGLE_INTERVAL=2;
15 15
 
16
-	public function __construct($identifier, $label = NULL, $type = "text", $value = NULL, $placeholder = NULL) {
17
-		if (! isset($placeholder) && $type === "text")
18
-			$placeholder = $label;
19
-		parent::__construct("field-" . $identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
20
-		$this->_identifier = $identifier;
16
+	public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
17
+		if (!isset($placeholder) && $type==="text")
18
+			$placeholder=$label;
19
+		parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
20
+		$this->_identifier=$identifier;
21 21
 	}
22 22
 
23 23
 	public function getDataField() {
24
-		$field = $this->getField();
24
+		$field=$this->getField();
25 25
 		if ($field instanceof HtmlInput)
26
-			$field = $field->getDataField();
26
+			$field=$field->getDataField();
27 27
 		return $field;
28 28
 	}
29 29
 
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $keyIcon
34 34
 	 */
35
-	public function asPassword($keyIcon = 'key') {
35
+	public function asPassword($keyIcon='key') {
36 36
 		$this->setInputType('password');
37
-		if ($keyIcon != '') {
37
+		if ($keyIcon!='') {
38 38
 			$this->addIcon($keyIcon);
39 39
 		}
40 40
 	}
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 	 *        	one of TOGGLE_CLICK, TOGGLE_MOUSEDOWN, TOGGLE_INTERVAL
50 50
 	 * @return mixed|\Ajax\semantic\html\elements\HtmlButton
51 51
 	 */
52
-	public function addTogglePasswordAction($buttonIcon = 'eye', $keyIcon = 'key', $slashIcon = 'slash', $type = 0) {
52
+	public function addTogglePasswordAction($buttonIcon='eye', $keyIcon='key', $slashIcon='slash', $type=0) {
53 53
 		$this->asPassword($keyIcon);
54
-		$action = $this->addAction('see');
54
+		$action=$this->addAction('see');
55 55
 		$action->asIcon($buttonIcon);
56 56
 		switch ($type) {
57 57
 			case self::TOGGLE_CLICK:
58
-				$action->onClick('let th=$(this);' . $this->getJsToggle($slashIcon, '(_,attr)=>(attr=="text")?"password":"text"', 'toggle'));
58
+				$action->onClick('let th=$(this);'.$this->getJsToggle($slashIcon, '(_,attr)=>(attr=="text")?"password":"text"', 'toggle'));
59 59
 				break;
60 60
 			case self::TOGGLE_MOUSEDOWN:
61 61
 				$action->onClick('');
62
-				$action->addEvent('mousedown', 'let th=$(this);' . $this->getJsToggle($slashIcon, '"text"', 'add'));
63
-				$action->addEvent('mouseup', 'let th=$(this);' . $this->getJsToggle($slashIcon, '"password"', 'remove'));
64
-				$action->addEvent('mouseout', 'let th=$(this);' . $this->getJsToggle($slashIcon, '"password"', 'remove'));
62
+				$action->addEvent('mousedown', 'let th=$(this);'.$this->getJsToggle($slashIcon, '"text"', 'add'));
63
+				$action->addEvent('mouseup', 'let th=$(this);'.$this->getJsToggle($slashIcon, '"password"', 'remove'));
64
+				$action->addEvent('mouseout', 'let th=$(this);'.$this->getJsToggle($slashIcon, '"password"', 'remove'));
65 65
 				break;
66 66
 			case self::TOGGLE_INTERVAL:
67
-				$action->onClick('let th=$(this);' . $this->getJsToggle($slashIcon, '"text"', 'add') . 'setTimeout(function(){ ' . $this->getJsToggle($slashIcon, '"password"', 'remove') . ' }, 5000);');
67
+				$action->onClick('let th=$(this);'.$this->getJsToggle($slashIcon, '"text"', 'add').'setTimeout(function(){ '.$this->getJsToggle($slashIcon, '"password"', 'remove').' }, 5000);');
68 68
 				break;
69 69
 		}
70 70
 		return $action;
71 71
 	}
72 72
 
73 73
 	private function getJsToggle($slashIcon, $type, $actionClass) {
74
-		return 'th.find(".icon").' . $actionClass . 'Class("' . $slashIcon . '");th.closest(".field").find("input").attr("type",' . $type . ');';
74
+		return 'th.find(".icon").'.$actionClass.'Class("'.$slashIcon.'");th.closest(".field").find("input").attr("type",'.$type.');';
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,16 +14,18 @@
 block discarded – undo
14 14
 	const TOGGLE_INTERVAL = 2;
15 15
 
16 16
 	public function __construct($identifier, $label = NULL, $type = "text", $value = NULL, $placeholder = NULL) {
17
-		if (! isset($placeholder) && $type === "text")
18
-			$placeholder = $label;
17
+		if (! isset($placeholder) && $type === "text") {
18
+					$placeholder = $label;
19
+		}
19 20
 		parent::__construct("field-" . $identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
20 21
 		$this->_identifier = $identifier;
21 22
 	}
22 23
 
23 24
 	public function getDataField() {
24 25
 		$field = $this->getField();
25
-		if ($field instanceof HtmlInput)
26
-			$field = $field->getDataField();
26
+		if ($field instanceof HtmlInput) {
27
+					$field = $field->getDataField();
28
+		}
27 29
 		return $field;
28 30
 	}
29 31
 
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 2 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,15 +112,18 @@  discard block
 block discarded – undo
112 112
 			$flag = false;
113 113
 			$index = 0;
114 114
 			while (! $flag && $index < sizeof($elements)) {
115
-				if ($elements[$index] instanceof BaseHtml)
116
-					$flag = ($callback($elements[$index]));
115
+				if ($elements[$index] instanceof BaseHtml) {
116
+									$flag = ($callback($elements[$index]));
117
+				}
117 118
 				$index ++;
118 119
 			}
119
-			if ($flag === true)
120
-				return $elements[$index - 1];
120
+			if ($flag === true) {
121
+							return $elements[$index - 1];
122
+			}
121 123
 		} elseif ($elements instanceof BaseHtml) {
122
-			if ($callback($elements))
123
-				return $elements;
124
+			if ($callback($elements)) {
125
+							return $elements;
126
+			}
124 127
 		}
125 128
 		return null;
126 129
 	}
@@ -146,8 +149,9 @@  discard block
 block discarded – undo
146 149
 
147 150
 	public function fromArray($array) {
148 151
 		foreach ($this as $key => $value) {
149
-			if (array_key_exists($key, $array) === true)
150
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
152
+			if (array_key_exists($key, $array) === true) {
153
+							$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
154
+			}
151 155
 		}
152 156
 		foreach ($array as $key => $value) {
153 157
 			if ($this->_callSetter($key, $key, $value, $array) === false) {
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
  * @version 1.3.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 
20 20
 	protected $_template;
21 21
 
22 22
 	protected $tagName;
23 23
 
24
-	protected $_wrapBefore = array();
24
+	protected $_wrapBefore=array();
25 25
 
26
-	protected $_wrapAfter = array();
26
+	protected $_wrapAfter=array();
27 27
 
28 28
 	protected $_bsComponent;
29 29
 
30
-	protected $_compiled = false;
30
+	protected $_compiled=false;
31 31
 
32
-	protected $_runned = false;
32
+	protected $_runned=false;
33 33
 
34 34
 	protected $_postCompile;
35 35
 
@@ -43,31 +43,31 @@  discard block
 block discarded – undo
43 43
 	abstract public function run(JsUtils $js);
44 44
 
45 45
 	private function _callSetter($setter, $key, $value, &$array) {
46
-		$result = false;
47
-		if (method_exists($this, $setter) && substr($setter, 0, 1) !== "_") {
46
+		$result=false;
47
+		if (method_exists($this, $setter) && substr($setter, 0, 1)!=="_") {
48 48
 			try {
49 49
 				$this->$setter($value);
50 50
 				unset($array[$key]);
51
-				$result = true;
52
-			} catch (\Exception $e) {
53
-				$result = false;
51
+				$result=true;
52
+			}catch (\Exception $e) {
53
+				$result=false;
54 54
 			}
55 55
 		}
56 56
 		return $result;
57 57
 	}
58 58
 
59
-	protected function getTemplate(JsUtils $js = NULL, $view = null) {
60
-		return PropertyWrapper::wrap($this->_wrapBefore, $js, $view) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js, $view);
59
+	protected function getTemplate(JsUtils $js=NULL, $view=null) {
60
+		return PropertyWrapper::wrap($this->_wrapBefore, $js, $view).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js, $view);
61 61
 	}
62 62
 
63 63
 	protected function ctrl($name, $value, $typeCtrl) {
64 64
 		if (\is_array($typeCtrl)) {
65
-			if (array_search($value, $typeCtrl) === false) {
66
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
65
+			if (array_search($value, $typeCtrl)===false) {
66
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
67 67
 			}
68 68
 		} else {
69
-			if (! $typeCtrl($value)) {
70
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
69
+			if (!$typeCtrl($value)) {
70
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
71 71
 			}
72 72
 		}
73 73
 		return true;
@@ -75,49 +75,49 @@  discard block
 block discarded – undo
75 75
 
76 76
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
77 77
 		$this->ctrl($name, $value, $typeCtrl);
78
-		$name = $value;
78
+		$name=$value;
79 79
 		return $this;
80 80
 	}
81 81
 
82
-	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator = " ") {
82
+	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
83 83
 		if (\is_array($typeCtrl)) {
84 84
 			$this->removeOldValues($name, $typeCtrl);
85
-			$name .= $separator . $value;
85
+			$name.=$separator.$value;
86 86
 		}
87 87
 		return $this;
88 88
 	}
89 89
 
90
-	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator = " ") {
90
+	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
91 91
 		$this->ctrl($name, $value, $typeCtrl);
92 92
 		if (\is_array($typeCtrl)) {
93 93
 			$this->removeOldValues($name, $typeCtrl);
94 94
 		}
95
-		$name .= $separator . $value;
95
+		$name.=$separator.$value;
96 96
 		return $this;
97 97
 	}
98 98
 
99
-	protected function addToMember(&$name, $value, $separator = ' ') {
100
-		$name = \str_ireplace($value, '', $name??'') . $separator . $value;
99
+	protected function addToMember(&$name, $value, $separator=' ') {
100
+		$name=\str_ireplace($value, '', $name ?? '').$separator.$value;
101 101
 		return $this;
102 102
 	}
103 103
 
104 104
 	protected function removeOldValues(&$oldValue, $allValues) {
105
-		$oldValue = \str_ireplace($allValues, '', $oldValue??'');
106
-		$oldValue = \trim($oldValue);
105
+		$oldValue=\str_ireplace($allValues, '', $oldValue ?? '');
106
+		$oldValue=\trim($oldValue);
107 107
 	}
108 108
 
109 109
 	protected function _getElementBy($callback, $elements) {
110 110
 		if (\is_array($elements)) {
111
-			$elements = \array_values($elements);
112
-			$flag = false;
113
-			$index = 0;
114
-			while (! $flag && $index < sizeof($elements)) {
111
+			$elements=\array_values($elements);
112
+			$flag=false;
113
+			$index=0;
114
+			while (!$flag && $index<sizeof($elements)) {
115 115
 				if ($elements[$index] instanceof BaseHtml)
116
-					$flag = ($callback($elements[$index]));
117
-				$index ++;
116
+					$flag=($callback($elements[$index]));
117
+				$index++;
118 118
 			}
119
-			if ($flag === true)
120
-				return $elements[$index - 1];
119
+			if ($flag===true)
120
+				return $elements[$index-1];
121 121
 		} elseif ($elements instanceof BaseHtml) {
122 122
 			if ($callback($elements))
123 123
 				return $elements;
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	protected function setWrapBefore($wrapBefore) {
129
-		$this->_wrapBefore = $wrapBefore;
129
+		$this->_wrapBefore=$wrapBefore;
130 130
 		return $this;
131 131
 	}
132 132
 
133 133
 	protected function setWrapAfter($wrapAfter) {
134
-		$this->_wrapAfter = $wrapAfter;
134
+		$this->_wrapAfter=$wrapAfter;
135 135
 		return $this;
136 136
 	}
137 137
 
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 	public function setTagName($tagName) {
143
-		$this->tagName = $tagName;
143
+		$this->tagName=$tagName;
144 144
 		return $this;
145 145
 	}
146 146
 
147 147
 	public function fromArray($array) {
148 148
 		foreach ($this as $key => $value) {
149
-			if (array_key_exists($key, $array) === true)
150
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
149
+			if (array_key_exists($key, $array)===true)
150
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
151 151
 		}
152 152
 		foreach ($array as $key => $value) {
153
-			if ($this->_callSetter($key, $key, $value, $array) === false) {
154
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
153
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
154
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
155 155
 			}
156 156
 		}
157 157
 		return $array;
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 
169 169
 	public function fromDatabaseObject($object, $function) {}
170 170
 
171
-	public function wrap($before, $after = "") {
171
+	public function wrap($before, $after="") {
172 172
 		if (isset($before)) {
173 173
 			array_unshift($this->_wrapBefore, $before);
174 174
 		}
175
-		$this->_wrapAfter[] = $after;
175
+		$this->_wrapAfter[]=$after;
176 176
 		return $this;
177 177
 	}
178 178
 
179 179
 	public function getElementById($identifier, $elements) {
180
-		return $this->_getElementBy(function (BaseWidget $element) use ($identifier) {
181
-			return $element->getIdentifier() === $identifier;
180
+		return $this->_getElementBy(function(BaseWidget $element) use ($identifier) {
181
+			return $element->getIdentifier()===$identifier;
182 182
 		}, $elements);
183 183
 	}
184 184
 
@@ -187,50 +187,50 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	public function setBsComponent($bsComponent) {
190
-		$this->_bsComponent = $bsComponent;
190
+		$this->_bsComponent=$bsComponent;
191 191
 		return $this;
192 192
 	}
193 193
 
194
-	protected function compile_once(JsUtils $js = NULL, &$view = NULL) {
195
-		if (! $this->_compiled) {
194
+	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
195
+		if (!$this->_compiled) {
196 196
 			if (isset($js)) {
197
-				$beforeCompile = $js->getParam("beforeCompileHtml");
197
+				$beforeCompile=$js->getParam("beforeCompileHtml");
198 198
 				if (\is_callable($beforeCompile)) {
199 199
 					$beforeCompile($this, $js, $view);
200 200
 				}
201 201
 			}
202 202
 			$this->callCallback($this->_preCompile);
203 203
 			unset($this->properties["jsCallback"]);
204
-			$this->_compiled = true;
204
+			$this->_compiled=true;
205 205
 		}
206 206
 	}
207 207
 
208
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
208
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
209 209
 		$this->compile_once($js, $view);
210
-		$result = $this->getTemplate($js, $view);
210
+		$result=$this->getTemplate($js, $view);
211 211
 		foreach ($this as $key => $value) {
212
-			if (\strstr($result, "%{$key}%") !== false) {
212
+			if (\strstr($result, "%{$key}%")!==false) {
213 213
 				if (\is_array($value)) {
214
-					$v = PropertyWrapper::wrap($value, $js, $view);
214
+					$v=PropertyWrapper::wrap($value, $js, $view);
215 215
 				} elseif ($value instanceof \stdClass) {
216
-					$v = \print_r($value, true);
216
+					$v=\print_r($value, true);
217 217
 				} elseif ($value instanceof BaseHtml) {
218
-					$v = $value->compile($js, $view);
218
+					$v=$value->compile($js, $view);
219 219
 				} else {
220
-					$v = $value;
220
+					$v=$value;
221 221
 				}
222
-				$result = \str_replace("%{$key}%", $v ?? '', $result);
222
+				$result=\str_replace("%{$key}%", $v ?? '', $result);
223 223
 			}
224 224
 		}
225
-		if (isset($js) === true) {
225
+		if (isset($js)===true) {
226 226
 			$this->run($js);
227
-			if (isset($view) === true) {
227
+			if (isset($view)===true) {
228 228
 				$js->addViewElement($this->getLibraryId(), $result, $view);
229 229
 			}
230 230
 		}
231 231
 
232 232
 		if (\is_callable($this->_postCompile)) {
233
-			$pc = $this->_postCompile;
233
+			$pc=$this->_postCompile;
234 234
 			$pc($this);
235 235
 		}
236 236
 		return $result;
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
 	 *        	default: ["jsCallback"=>"","jqueryDone"=>"append"]
248 248
 	 * @return \Ajax\common\html\BaseHtml
249 249
 	 */
250
-	public function setDraggable($attr = "id", $dropZone = null, $parameters = []) {
250
+	public function setDraggable($attr="id", $dropZone=null, $parameters=[]) {
251 251
 		$this->setProperty("draggable", "true");
252 252
 		$this->addEvent("dragstart", Javascript::draggable($attr));
253 253
 		if (isset($dropZone) && $dropZone instanceof BaseHtml) {
254
-			$jqueryDone = "append";
255
-			$jsCallback = "";
254
+			$jqueryDone="append";
255
+			$jsCallback="";
256 256
 			extract($parameters);
257 257
 			$dropZone->asDropZone($jsCallback, $jqueryDone, $parameters);
258 258
 		}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 	 * @param array $parameters
268 268
 	 * @return \Ajax\common\html\BaseHtml
269 269
 	 */
270
-	public function asDropZone($jsCallback = "", $jqueryDone = "append", $parameters = []) {
271
-		$stopPropagation = false;
270
+	public function asDropZone($jsCallback="", $jqueryDone="append", $parameters=[]) {
271
+		$stopPropagation=false;
272 272
 		$this->addEvent("dragover", '', $stopPropagation, true);
273 273
 		extract($parameters);
274 274
 		$this->addEvent("drop", Javascript::dropZone($jqueryDone, $jsCallback), $stopPropagation, true);
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 * @param array $parameters
286 286
 	 * @return \Ajax\common\html\BaseHtml
287 287
 	 */
288
-	public function asFileDropZone($responseElement = null, $url = null, $progress = null, $jsCallback = "", $parameters = []) {
289
-		$stopPropagation = false;
290
-		$defaultAjaxAttributes = [
288
+	public function asFileDropZone($responseElement=null, $url=null, $progress=null, $jsCallback="", $parameters=[]) {
289
+		$stopPropagation=false;
290
+		$defaultAjaxAttributes=[
291 291
 			'contentType' => 'false',
292 292
 			'processData' => 'false'
293 293
 		];
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 		extract($parameters);
296 296
 		$this->addEvent("drop", Javascript::fileDropZone($jsCallback), $stopPropagation, true);
297 297
 		if (isset($ajaxAttributes)) {
298
-			$ajaxAttributes += $defaultAjaxAttributes;
298
+			$ajaxAttributes+=$defaultAjaxAttributes;
299 299
 		} else {
300
-			$ajaxAttributes = $defaultAjaxAttributes;
300
+			$ajaxAttributes=$defaultAjaxAttributes;
301 301
 		}
302 302
 		if (isset($progress)) {
303
-			$progress = new HtmlProgress($this->_identifier . '-pg', 0, $progress);
303
+			$progress=new HtmlProgress($this->_identifier.'-pg', 0, $progress);
304 304
 			$progress->setTotal(100);
305 305
 			$this->wrap('', $progress);
306
-			$ajaxAttributes['upload'] = "$('#" . $this->_identifier . "-pg').progress('set percent', Math.ceil(event.loaded/event.total)*100);";
306
+			$ajaxAttributes['upload']="$('#".$this->_identifier."-pg').progress('set percent', Math.ceil(event.loaded/event.total)*100);";
307 307
 		}
308 308
 		if (isset($url)) {
309 309
 			$this->postOn('upload', $url, 'event.target.upload', $responseElement, $ajaxAttributes);
@@ -316,21 +316,21 @@  discard block
 block discarded – undo
316 316
 	}
317 317
 
318 318
 	public function onPostCompile($callback) {
319
-		$this->_postCompile = $callback;
319
+		$this->_postCompile=$callback;
320 320
 	}
321 321
 
322 322
 	public function onPreCompile($callback) {
323
-		$this->_preCompile = $this->addCallback($this->_preCompile, $callback);
323
+		$this->_preCompile=$this->addCallback($this->_preCompile, $callback);
324 324
 	}
325 325
 
326 326
 	private function addCallback($originalValue, $callback) {
327 327
 		if (isset($originalValue)) {
328
-			if (! is_array($originalValue)) {
329
-				$result = [
328
+			if (!is_array($originalValue)) {
329
+				$result=[
330 330
 					$originalValue
331 331
 				];
332 332
 			}
333
-			$result[] = $callback;
333
+			$result[]=$callback;
334 334
 			return $result;
335 335
 		}
336 336
 		return $callback;
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsInternalTrait.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 	 * @param mixed $view
20 20
 	 */
21 21
 	protected function _compileLibrary(BaseGui $library, &$view = NULL) {
22
-		if (isset($view))
23
-			$library->compileHtml($this, $view);
22
+		if (isset($view)) {
23
+					$library->compileHtml($this, $view);
24
+		}
24 25
 		if ($library->isAutoCompile()) {
25 26
 			$library->compile(true);
26 27
 		}
@@ -39,8 +40,9 @@  discard block
 block discarded – undo
39 40
 	}
40 41
 
41 42
 	protected function minify($input) {
42
-		if (trim($input) === "")
43
-			return $input;
43
+		if (trim($input) === "") {
44
+					return $input;
45
+		}
44 46
 		$input = preg_replace(array(
45 47
 			// Remove comment(s)
46 48
 			'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
 
6 6
 trait JsUtilsInternalTrait {
7 7
 
8
-	protected $jquery_code_for_compile = array();
8
+	protected $jquery_code_for_compile=array();
9 9
 
10
-	protected $jquery_code_for_compile_at_last = array();
10
+	protected $jquery_code_for_compile_at_last=array();
11 11
 
12 12
 	protected function _addToCompile($jsScript) {
13
-		$this->jquery_code_for_compile[] = $jsScript;
13
+		$this->jquery_code_for_compile[]=$jsScript;
14 14
 	}
15 15
 
16 16
 	/**
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param BaseGui $library
19 19
 	 * @param mixed $view
20 20
 	 */
21
-	protected function _compileLibrary(BaseGui $library, &$view = NULL) {
21
+	protected function _compileLibrary(BaseGui $library, &$view=NULL) {
22 22
 		if (isset($view))
23 23
 			$library->compileHtml($this, $view);
24 24
 		if ($library->isAutoCompile()) {
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 	}
28 28
 
29 29
 	protected function defer($script) {
30
-		$result = "(function(){window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { window.defer(method); }, 50);};";
31
-		$result .= "window.defer(function(){" . $script . "})})()";
30
+		$result="(function(){window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { window.defer(method); }, 50);};";
31
+		$result.="window.defer(function(){".$script."})})()";
32 32
 		return $result;
33 33
 	}
34 34
 
35 35
 	protected function ready($script) {
36
-		$result = '$(function() {' . "\n";
37
-		$result .= $script . '});';
36
+		$result='$(function() {'."\n";
37
+		$result.=$script.'});';
38 38
 		return $result;
39 39
 	}
40 40
 
41 41
 	protected function minify($input) {
42
-		if (trim($input) === "")
42
+		if (trim($input)==="")
43 43
 			return $input;
44
-		$input = preg_replace(array(
44
+		$input=preg_replace(array(
45 45
 			// Remove comment(s)
46 46
 			'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
47 47
 			// Remove white-space(s) outside the string and regex
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			'$1$3',
60 60
 			'$1.$3'
61 61
 		), $input);
62
-		$input = str_replace("}$", "};$", $input);
62
+		$input=str_replace("}$", "};$", $input);
63 63
 		return $input;
64 64
 	}
65 65
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param string $src
70 70
 	 * @return string
71 71
 	 */
72
-	protected function _open_script($src = '') {
73
-		$str = '<script ';
74
-		$str .= ($src == '') ? '>' : ' src="' . $src . '">';
72
+	protected function _open_script($src='') {
73
+		$str='<script ';
74
+		$str.=($src=='') ? '>' : ' src="'.$src.'">';
75 75
 		return $str;
76 76
 	}
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param string $extra
82 82
 	 * @return string
83 83
 	 */
84
-	protected function _close_script($extra = "\n") {
84
+	protected function _close_script($extra="\n") {
85 85
 		return "</script>$extra";
86 86
 	}
87 87
 
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/FieldValidation.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected $customRules;
32 32
 
33
-	protected $hasCustomRules = false;
33
+	protected $hasCustomRules=false;
34 34
 
35 35
 	/**
36 36
 	 *
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	protected $optional;
42 42
 
43 43
 	public function __construct($identifier) {
44
-		$this->identifier = $identifier;
45
-		$this->rules = [];
44
+		$this->identifier=$identifier;
45
+		$this->rules=[];
46 46
 	}
47 47
 
48 48
 	public function getIdentifier() {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	public function setIdentifier($identifier) {
53
-		$this->identifier = $identifier;
53
+		$this->identifier=$identifier;
54 54
 		return $this;
55 55
 	}
56 56
 
@@ -65,47 +65,47 @@  discard block
 block discarded – undo
65 65
 	 * @param string $value
66 66
 	 * @return Rule
67 67
 	 */
68
-	public function addRule($type, $prompt = NULL, $value = NULL) {
68
+	public function addRule($type, $prompt=NULL, $value=NULL) {
69 69
 		if ($type instanceof Rule) {
70
-			$rule = $type;
70
+			$rule=$type;
71 71
 			if ($type instanceof CustomRule) {
72
-				$this->customRules[] = $type;
73
-				$this->hasCustomRules = true;
72
+				$this->customRules[]=$type;
73
+				$this->hasCustomRules=true;
74 74
 			}
75 75
 		} elseif (\is_array($type)) {
76
-			$value = JArray::getValue($type, "value", 2);
77
-			$prompt = JArray::getValue($type, "prompt", 1);
78
-			$type = JArray::getValue($type, "type", 0);
79
-			$rule = new Rule($type, $prompt, $value);
76
+			$value=JArray::getValue($type, "value", 2);
77
+			$prompt=JArray::getValue($type, "prompt", 1);
78
+			$type=JArray::getValue($type, "type", 0);
79
+			$rule=new Rule($type, $prompt, $value);
80 80
 		} else {
81
-			$rule = new Rule($type, $prompt, $value);
81
+			$rule=new Rule($type, $prompt, $value);
82 82
 		}
83
-		$this->rules[] = $rule;
83
+		$this->rules[]=$rule;
84 84
 		return $rule;
85 85
 	}
86 86
 
87 87
 	#[\ReturnTypeWillChange]
88 88
 	public function jsonSerialize() {
89
-		$result = [
89
+		$result=[
90 90
 			"identifier" => $this->identifier,
91 91
 			"rules" => $this->rules
92 92
 		];
93 93
 		if ($this->optional) {
94
-			$result["optional"] = true;
94
+			$result["optional"]=true;
95 95
 		}
96 96
 		if (isset($this->depends)) {
97
-			$result["depends"] = $this->depends;
97
+			$result["depends"]=$this->depends;
98 98
 		}
99 99
 		return $result;
100 100
 	}
101 101
 
102 102
 	public function setDepends($depends) {
103
-		$this->depends = $depends;
103
+		$this->depends=$depends;
104 104
 		return $this;
105 105
 	}
106 106
 
107 107
 	public function setOptional($optional) {
108
-		$this->optional = $optional;
108
+		$this->optional=$optional;
109 109
 		return $this;
110 110
 	}
111 111
 
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/Rule.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,10 +59,12 @@  discard block
 block discarded – undo
59 59
 	#[\ReturnTypeWillChange]
60 60
 	public function jsonSerialize() {
61 61
 		$result= ["type"=>$this->type];
62
-		if(isset($this->prompt))
63
-			$result["prompt"]=$this->prompt;
64
-		if(isset($this->value))
65
-			$result["value"]=$this->value;
62
+		if(isset($this->prompt)) {
63
+					$result["prompt"]=$this->prompt;
64
+		}
65
+		if(isset($this->value)) {
66
+					$result["value"]=$this->value;
67
+		}
66 68
 		return $result;
67 69
 	}
68 70
 
@@ -94,8 +96,9 @@  discard block
 block discarded – undo
94 96
 	 * @return \Ajax\semantic\components\validation\Rule
95 97
 	 */
96 98
 	public static function integer($min=NULL,$max=NULL,$prompt=NULL){
97
-		if(\is_int($min) && \is_int($max))
98
-			return new Rule("integer[{$min}..{$max}]",$prompt);
99
+		if(\is_int($min) && \is_int($max)) {
100
+					return new Rule("integer[{$min}..{$max}]",$prompt);
101
+		}
99 102
 		return new Rule("integer",$prompt);
100 103
 	}
101 104
 
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.001
9 9
  * Generates a JSON Rule for the validation of a field
10 10
  */
11
-class Rule implements \JsonSerializable{
11
+class Rule implements \JsonSerializable {
12 12
 	/**
13 13
 	 * @var string
14 14
 	 */
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	private $value;
25 25
 
26
-	public function __construct($type,$prompt=NULL,$value=NULL){
26
+	public function __construct($type, $prompt=NULL, $value=NULL) {
27 27
 		$this->type=$type;
28 28
 		$this->prompt=$prompt;
29 29
 		$this->value=$value;
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 
59 59
 	#[\ReturnTypeWillChange]
60 60
 	public function jsonSerialize() {
61
-		$result= ["type"=>$this->type];
62
-		if(isset($this->prompt))
61
+		$result=["type"=>$this->type];
62
+		if (isset($this->prompt))
63 63
 			$result["prompt"]=$this->prompt;
64
-		if(isset($this->value))
64
+		if (isset($this->value))
65 65
 			$result["value"]=$this->value;
66 66
 		return $result;
67 67
 	}
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param string $prompt
73 73
 	 * @return \Ajax\semantic\components\validation\Rule
74 74
 	 */
75
-	public static function match($name,$prompt=NULL){
76
-		return new Rule("match[".$name."]",$prompt);
75
+	public static function match($name, $prompt=NULL){
76
+		return new Rule("match[".$name."]", $prompt);
77 77
 	}
78 78
 
79 79
 	/**
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param string $prompt
83 83
 	 * @return \Ajax\semantic\components\validation\Rule
84 84
 	 */
85
-	public static function different($name,$prompt=NULL){
86
-		return new Rule("different[".$name."]",$prompt);
85
+	public static function different($name, $prompt=NULL) {
86
+		return new Rule("different[".$name."]", $prompt);
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,82 +93,82 @@  discard block
 block discarded – undo
93 93
 	 * @param string $prompt
94 94
 	 * @return \Ajax\semantic\components\validation\Rule
95 95
 	 */
96
-	public static function integer($min=NULL,$max=NULL,$prompt=NULL){
97
-		if(\is_int($min) && \is_int($max))
98
-			return new Rule("integer[{$min}..{$max}]",$prompt);
99
-		return new Rule("integer",$prompt);
96
+	public static function integer($min=NULL, $max=NULL, $prompt=NULL) {
97
+		if (\is_int($min) && \is_int($max))
98
+			return new Rule("integer[{$min}..{$max}]", $prompt);
99
+		return new Rule("integer", $prompt);
100 100
 	}
101 101
 
102
-	public static function decimal($prompt=NULL){
103
-		return new Rule("decimal",$prompt);
102
+	public static function decimal($prompt=NULL) {
103
+		return new Rule("decimal", $prompt);
104 104
 	}
105 105
 
106
-	public static function number($prompt=NULL){
107
-		return new Rule("number",$prompt);
106
+	public static function number($prompt=NULL) {
107
+		return new Rule("number", $prompt);
108 108
 	}
109 109
 
110
-	public static function is($value,$prompt=NULL){
111
-		return new Rule("is[".$value."]",$prompt);
110
+	public static function is($value, $prompt=NULL) {
111
+		return new Rule("is[".$value."]", $prompt);
112 112
 	}
113 113
 
114
-	public static function isExactly($value,$prompt=NULL){
115
-		return new Rule("isExactly[".$value."]",$prompt);
114
+	public static function isExactly($value, $prompt=NULL) {
115
+		return new Rule("isExactly[".$value."]", $prompt);
116 116
 	}
117 117
 
118
-	public static function not($value,$prompt=NULL){
119
-		return new Rule("not[".$value."]",$prompt);
118
+	public static function not($value, $prompt=NULL) {
119
+		return new Rule("not[".$value."]", $prompt);
120 120
 	}
121 121
 
122
-	public static function notExactly($value,$prompt=NULL){
123
-		return new Rule("notExactly[".$value."]",$prompt);
122
+	public static function notExactly($value, $prompt=NULL) {
123
+		return new Rule("notExactly[".$value."]", $prompt);
124 124
 	}
125 125
 
126
-	public static function contains($value,$prompt=NULL){
127
-		return new Rule("contains[".$value."]",$prompt);
126
+	public static function contains($value, $prompt=NULL) {
127
+		return new Rule("contains[".$value."]", $prompt);
128 128
 	}
129 129
 
130
-	public static function containsExactly($value,$prompt=NULL){
131
-		return new Rule("containsExactly[".$value."]",$prompt);
130
+	public static function containsExactly($value, $prompt=NULL) {
131
+		return new Rule("containsExactly[".$value."]", $prompt);
132 132
 	}
133 133
 
134
-	public static function doesntContain($value,$prompt=NULL){
135
-		return new Rule("doesntContain[".$value."]",$prompt);
134
+	public static function doesntContain($value, $prompt=NULL) {
135
+		return new Rule("doesntContain[".$value."]", $prompt);
136 136
 	}
137 137
 
138
-	public static function doesntContainExactly($value,$prompt=NULL){
139
-		return new Rule("doesntContainExactly[".$value."]",$prompt);
138
+	public static function doesntContainExactly($value, $prompt=NULL) {
139
+		return new Rule("doesntContainExactly[".$value."]", $prompt);
140 140
 	}
141 141
 
142
-	public static function minCount($value,$prompt=NULL){
143
-		return new Rule("minCount[".$value."]",$prompt);
142
+	public static function minCount($value, $prompt=NULL) {
143
+		return new Rule("minCount[".$value."]", $prompt);
144 144
 	}
145 145
 
146
-	public static function maxCount($value,$prompt=NULL){
147
-		return new Rule("maxCount[".$value."]",$prompt);
146
+	public static function maxCount($value, $prompt=NULL) {
147
+		return new Rule("maxCount[".$value."]", $prompt);
148 148
 	}
149 149
 
150
-	public static function exactCount($value,$prompt=NULL){
151
-		return new Rule("exactCount[".$value."]",$prompt);
150
+	public static function exactCount($value, $prompt=NULL) {
151
+		return new Rule("exactCount[".$value."]", $prompt);
152 152
 	}
153 153
 
154
-	public static function email($prompt=NULL){
155
-		return new Rule("email",$prompt);
154
+	public static function email($prompt=NULL) {
155
+		return new Rule("email", $prompt);
156 156
 	}
157 157
 
158
-	public static function url($prompt=NULL){
159
-		return new Rule("url",$prompt);
158
+	public static function url($prompt=NULL) {
159
+		return new Rule("url", $prompt);
160 160
 	}
161 161
 
162
-	public static function regExp($value,$prompt=NULL){
163
-		return new Rule("regExp",$prompt,$value);
162
+	public static function regExp($value, $prompt=NULL) {
163
+		return new Rule("regExp", $prompt, $value);
164 164
 	}
165 165
 
166
-	public static function custom($name,$jsFunction){
167
-		return "$.fn.form.settings.rules.".$name." =".$jsFunction ;
166
+	public static function custom($name, $jsFunction) {
167
+		return "$.fn.form.settings.rules.".$name." =".$jsFunction;
168 168
 	}
169 169
 
170
-	public static function ajax(JsUtils $js,$name,$url,$params,$jsCallback,$method="post",$parameters=[]){
171
-		$parameters=\array_merge(["async"=>false,"url"=>$url,"params"=>$params,"hasLoader"=>false,"jsCallback"=>$jsCallback,"dataType"=>"json","stopPropagation"=>false,"preventDefault"=>false,"responseElement"=>null],$parameters);
170
+	public static function ajax(JsUtils $js, $name, $url, $params, $jsCallback, $method="post", $parameters=[]) {
171
+		$parameters=\array_merge(["async"=>false, "url"=>$url, "params"=>$params, "hasLoader"=>false, "jsCallback"=>$jsCallback, "dataType"=>"json", "stopPropagation"=>false, "preventDefault"=>false, "responseElement"=>null], $parameters);
172 172
 		$ajax=new AjaxCall($method, $parameters);
173 173
 		return self::custom($name, "function(value,ruleValue){var result=true;".$ajax->compile($js)."return result;}");
174 174
 	}
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -3,36 +3,36 @@  discard block
 block discarded – undo
3 3
 
4 4
 class Javascript {
5 5
 
6
-	public static $preventDefault = "\nif(event && event.preventDefault) event.preventDefault();\n";
6
+	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 
8
-	public static $stopPropagation = "\nif(event && event.stopPropagation) event.stopPropagation();\n";
8
+	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
9 9
 
10
-	public static function draggable($attr = "id") {
11
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("' . $attr . '")}));';
10
+	public static function draggable($attr="id") {
11
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("'.$attr.'")}));';
12 12
 	}
13 13
 
14
-	public static function dropZone($jqueryDone, $jsCallback = "") {
15
-		$done = ($jqueryDone != null) ? '$(event.target).' . $jqueryDone . '($("#"+_data.id));' : '';
16
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));' . $done . 'var data=_data.data;' . $jsCallback;
14
+	public static function dropZone($jqueryDone, $jsCallback="") {
15
+		$done=($jqueryDone!=null) ? '$(event.target).'.$jqueryDone.'($("#"+_data.id));' : '';
16
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));'.$done.'var data=_data.data;'.$jsCallback;
17 17
 	}
18 18
 
19
-	public static function fileDropZone($jsCallback = "") {
20
-		$done = 'event.target.upload=formData;$(event.target).trigger("upload");';
21
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var files=dt.files;var formData = new FormData();for (var i = 0; i < files.length; i++) {formData.append("file-"+i,files[i]);}' . $done . $jsCallback;
19
+	public static function fileDropZone($jsCallback="") {
20
+		$done='event.target.upload=formData;$(event.target).trigger("upload");';
21
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var files=dt.files;var formData = new FormData();for (var i = 0; i < files.length; i++) {formData.append("file-"+i,files[i]);}'.$done.$jsCallback;
22 22
 	}
23 23
 
24 24
 	public static function containsCode($expression) {
25
-		if ($expression == null) {
25
+		if ($expression==null) {
26 26
 			return false;
27 27
 		}
28
-		return \strrpos($expression, 'this') !== false || \strrpos($expression, 'event') !== false || \strrpos($expression, 'self') !== false;
28
+		return \strrpos($expression, 'this')!==false || \strrpos($expression, 'event')!==false || \strrpos($expression, 'self')!==false;
29 29
 	}
30 30
 
31 31
 	public static function isFunction($jsCode) {
32 32
 		return JString::startswith($jsCode, "function");
33 33
 	}
34 34
 
35
-	public static function fileUploadBehavior($id = '') {
35
+	public static function fileUploadBehavior($id='') {
36 36
 		return "$('input:text, .ui.button', '#{$id}').on('click', function (e) {e.preventDefault();\$('input:file', '#{$id}').click();});
37 37
 				$('input:file', '#{$id}').on('change', function (e) {if(e.target.files.length){var name = e.target.files[0].name;$('input:text', $(e.target).parent()).val(name);}});";
38 38
 	}
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 * @return string
47 47
 	 */
48 48
 	public static function prep_element($element) {
49
-		if (self::containsCode($element) === false) {
50
-			$element = '"' . addslashes($element ?? '') . '"';
49
+		if (self::containsCode($element)===false) {
50
+			$element='"'.addslashes($element ?? '').'"';
51 51
 		}
52 52
 		return $element;
53 53
 	}
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public static function prep_value($value) {
64 64
 		if (\is_array($value)) {
65
-			$value = implode(",", $value);
65
+			$value=implode(",", $value);
66 66
 		}
67
-		if (self::containsCode($value) === false) {
68
-			$value = \str_replace([
67
+		if (self::containsCode($value)===false) {
68
+			$value=\str_replace([
69 69
 				"\\",
70 70
 				"\""
71 71
 			], [
72 72
 				"\\\\",
73 73
 				"\\\""
74 74
 			], $value);
75
-			$value = '"' . $value . '"';
75
+			$value='"'.$value.'"';
76 76
 		}
77 77
 		return trim($value, "%");
78 78
 	}
79 79
 
80 80
 	public static function prep_jquery_selector($value) {
81
-		if (JString::startswith($value, '$(') === false) {
82
-			return '$(' . self::prep_value($value) . ')';
81
+		if (JString::startswith($value, '$(')===false) {
82
+			return '$('.self::prep_value($value).')';
83 83
 		}
84 84
 		return $value;
85 85
 	}
Please login to merge, or discard this patch.
Ajax/common/Widget.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\common\html\traits\BaseHooksTrait;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait,BaseHooksTrait;
23
+	use FieldAsTrait, FormTrait, BaseHooksTrait;
24 24
 
25 25
 	/**
26 26
 	 *
@@ -66,27 +66,27 @@  discard block
 block discarded – undo
66 66
 
67 67
 	protected $_hasRules;
68 68
 
69
-	public function __construct($identifier, $model, $modelInstance = NULL) {
69
+	public function __construct($identifier, $model, $modelInstance=NULL) {
70 70
 		parent::__construct($identifier);
71
-		$this->_template = "%wrapContentBefore%%content%%wrapContentAfter%";
71
+		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
72 72
 		$this->setModel($model);
73 73
 		if (isset($modelInstance)) {
74 74
 			if (\is_object($modelInstance)) {
75
-				$this->_model = \get_class($modelInstance);
75
+				$this->_model=\get_class($modelInstance);
76 76
 			}
77 77
 			$this->show($modelInstance);
78 78
 		}
79
-		$this->_generated = false;
79
+		$this->_generated=false;
80 80
 	}
81 81
 
82 82
 	protected function _init($instanceViewer, $contentKey, $content, $edition) {
83
-		$this->_instanceViewer = $instanceViewer;
84
-		$this->content = [
83
+		$this->_instanceViewer=$instanceViewer;
84
+		$this->content=[
85 85
 			$contentKey => $content
86 86
 		];
87
-		$this->_self = $content;
88
-		$this->_toolbarPosition = PositionInTable::BEFORETABLE;
89
-		$this->_edition = $edition;
87
+		$this->_self=$content;
88
+		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
89
+		$this->_edition=$edition;
90 90
 	}
91 91
 
92 92
 	/**
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 * @return int|string|boolean
96 96
 	 */
97 97
 	protected function _getIndex($fieldName) {
98
-		$index = $fieldName;
98
+		$index=$fieldName;
99 99
 		if (\is_string($fieldName)) {
100
-			$fields = $this->_instanceViewer->getVisibleProperties();
101
-			$index = \array_search($fieldName, $fields);
100
+			$fields=$this->_instanceViewer->getVisibleProperties();
101
+			$index=\array_search($fieldName, $fields);
102 102
 		}
103 103
 		return $index;
104 104
 	}
105 105
 
106
-	protected function _getFieldIdentifier($prefix, $name = "") {
107
-		return $this->identifier . "-{$prefix}-" . $this->_instanceViewer->getIdentifier();
106
+	protected function _getFieldIdentifier($prefix, $name="") {
107
+		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
108 108
 	}
109 109
 
110 110
 	protected function _getFieldName($index) {
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 		return $this->_instanceViewer->getCaption($index);
116 116
 	}
117 117
 
118
-	abstract protected function _setToolbarPosition($table, $captions = NULL);
118
+	abstract protected function _setToolbarPosition($table, $captions=NULL);
119 119
 
120 120
 	public function show($modelInstance) {
121 121
 		if (\is_array($modelInstance)) {
122
-			$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
122
+			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
123 123
 		}
124
-		$this->_modelInstance = $modelInstance;
124
+		$this->_modelInstance=$modelInstance;
125 125
 	}
126 126
 
127 127
 	public function getModel() {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	public function setModel($_model) {
132
-		$this->_model = $_model;
132
+		$this->_model=$_model;
133 133
 		return $this;
134 134
 	}
135 135
 
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 	}
139 139
 
140 140
 	public function setInstanceViewer($_instanceViewer) {
141
-		$this->_instanceViewer = $_instanceViewer;
141
+		$this->_instanceViewer=$_instanceViewer;
142 142
 		return $this;
143 143
 	}
144 144
 
145 145
 	abstract public function getHtmlComponent();
146 146
 
147
-	public function setAttached($value = true) {
147
+	public function setAttached($value=true) {
148 148
 		return $this->getHtmlComponent()->setAttached($value);
149 149
 	}
150 150
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @return Widget
160 160
 	 */
161 161
 	public function afterCompile($index, $callback) {
162
-		$index = $this->_getIndex($index);
163
-		if ($index !== false) {
162
+		$index=$this->_getIndex($index);
163
+		if ($index!==false) {
164 164
 			$this->_instanceViewer->afterCompile($index, $callback);
165 165
 		}
166 166
 		return $this;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		return $this;
186 186
 	}
187 187
 
188
-	public function addField($field, $key = null) {
188
+	public function addField($field, $key=null) {
189 189
 		$this->_instanceViewer->addField($field, $key);
190 190
 		return $this;
191 191
 	}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 		return $this->_instanceViewer->visiblePropertiesCount();
200 200
 	}
201 201
 
202
-	public function addMessage($attributes = NULL, $fieldName = "message") {
202
+	public function addMessage($attributes=NULL, $fieldName="message") {
203 203
 		$this->_instanceViewer->addField($fieldName);
204
-		$count = $this->_instanceViewer->visiblePropertiesCount();
205
-		return $this->fieldAsMessage($count - 1, $attributes);
204
+		$count=$this->_instanceViewer->visiblePropertiesCount();
205
+		return $this->fieldAsMessage($count-1, $attributes);
206 206
 	}
207 207
 
208 208
 	public function addErrorMessage() {
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
 		], "message");
212 212
 	}
213 213
 
214
-	public function insertField($index, $field, $key = null) {
215
-		$index = $this->_getIndex($index);
214
+	public function insertField($index, $field, $key=null) {
215
+		$index=$this->_getIndex($index);
216 216
 		$this->_instanceViewer->insertField($index, $field, $key);
217 217
 		return $this;
218 218
 	}
219 219
 
220
-	public function insertInField($index, $field, $key = null) {
221
-		$index = $this->_getIndex($index);
222
-		if ($index !== false) {
220
+	public function insertInField($index, $field, $key=null) {
221
+		$index=$this->_getIndex($index);
222
+		if ($index!==false) {
223 223
 			$this->_instanceViewer->insertInField($index, $field, $key);
224 224
 		}
225 225
 		return $this;
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @return Widget
236 236
 	 */
237 237
 	public function setValueFunction($index, $callback) {
238
-		$index = $this->_getIndex($index);
239
-		if ($index !== false) {
238
+		$index=$this->_getIndex($index);
239
+		if ($index!==false) {
240 240
 			$this->_instanceViewer->setValueFunction($index, $callback);
241 241
 		}
242 242
 		return $this;
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
253 253
 	 */
254 254
 	public function getToolbar() {
255
-		if (isset($this->_toolbar) === false) {
256
-			$this->_toolbar = new HtmlMenu("toolbar-" . $this->identifier);
255
+		if (isset($this->_toolbar)===false) {
256
+			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
257 257
 		}
258 258
 		return $this->_toolbar;
259 259
 	}
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	 *        	function to call on $element
267 267
 	 * @return \Ajax\common\html\HtmlDoubleElement
268 268
 	 */
269
-	public function addInToolbar($element, $callback = NULL) {
270
-		$tb = $this->getToolbar();
269
+	public function addInToolbar($element, $callback=NULL) {
270
+		$tb=$this->getToolbar();
271 271
 		if ($element instanceof BaseWidget) {
272
-			if ($element->getIdentifier() === "") {
273
-				$element->setIdentifier("tb-item-" . $this->identifier . "-" . $tb->count());
272
+			if ($element->getIdentifier()==="") {
273
+				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
274 274
 			}
275 275
 		}
276 276
 		if (isset($callback)) {
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 *        	function($element)
290 290
 	 * @return \Ajax\common\html\HtmlDoubleElement
291 291
 	 */
292
-	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
293
-		$result = $this->addInToolbar($caption, $callback);
292
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
293
+		$result=$this->addInToolbar($caption, $callback);
294 294
 		if (isset($icon) && method_exists($result, "addIcon"))
295 295
 			$result->addIcon($icon);
296 296
 		return $result;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 *        	function($element)
304 304
 	 * @return \Ajax\common\Widget
305 305
 	 */
306
-	public function addItemsInToolbar(array $items, $callback = NULL) {
306
+	public function addItemsInToolbar(array $items, $callback=NULL) {
307 307
 		if (JArray::isAssociative($items)) {
308 308
 			foreach ($items as $icon => $item) {
309 309
 				$this->addItemInToolbar($item, $icon, $callback);
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 *        	function($element)
325 325
 	 * @return \Ajax\common\html\HtmlDoubleElement
326 326
 	 */
327
-	public function addDropdownInToolbar($value, $items, $callback = NULL) {
328
-		$dd = $value;
327
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
328
+		$dd=$value;
329 329
 		if (\is_string($value)) {
330
-			$dd = new HtmlDropdown("dropdown-" . $this->identifier . "-" . $value, $value, $items);
330
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
331 331
 		}
332 332
 		return $this->addInToolbar($dd, $callback);
333 333
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 *        	function($element)
341 341
 	 * @return \Ajax\common\html\HtmlDoubleElement
342 342
 	 */
343
-	public function addButtonInToolbar($caption, $cssStyle = null, $callback = NULL) {
344
-		$bt = new HtmlButton("bt-" . $caption, $caption, $cssStyle);
343
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
344
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
345 345
 		return $this->addInToolbar($bt, $callback);
346 346
 	}
347 347
 
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 *        	function($element)
354 354
 	 * @return \Ajax\common\html\HtmlDoubleElement
355 355
 	 */
356
-	public function addButtonsInToolbar(array $captions, $asIcon = false, $callback = NULL) {
357
-		$bts = new HtmlButtonGroups("", $captions, $asIcon);
356
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
357
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
358 358
 		return $this->addInToolbar($bts, $callback);
359 359
 	}
360 360
 
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 	 * @param boolean $labeled
367 367
 	 * @return \Ajax\common\html\HtmlDoubleElement
368 368
 	 */
369
-	public function addLabelledIconButtonInToolbar($caption, $icon, $before = true, $labeled = false) {
370
-		$bt = new HtmlButton("", $caption);
369
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
370
+		$bt=new HtmlButton("", $caption);
371 371
 		$bt->addIcon($icon, $before, $labeled);
372 372
 		return $this->addInToolbar($bt);
373 373
 	}
374 374
 
375
-	public function addSubmitInToolbar($identifier, $value, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $parameters = NULL) {
376
-		$button = new HtmlButton($identifier, $value, $cssStyle);
375
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
376
+		$button=new HtmlButton($identifier, $value, $cssStyle);
377 377
 		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
378 378
 		return $this->addInToolbar($button);
379 379
 	}
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	 * @param boolean $_edition
397 397
 	 * @return \Ajax\common\Widget
398 398
 	 */
399
-	public function setEdition($_edition = true) {
400
-		$this->_edition = $_edition;
399
+	public function setEdition($_edition=true) {
400
+		$this->_edition=$_edition;
401 401
 		return $this;
402 402
 	}
403 403
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @param string|boolean $disable
427 427
 	 * @return string
428 428
 	 */
429
-	public function jsDisabled($disable = true) {
430
-		return "$('#" . $this->identifier . " .ui.input,#" . $this->identifier . " .ui.dropdown,#" . $this->identifier . " .ui.checkbox').toggleClass('disabled'," . $disable . ");";
429
+	public function jsDisabled($disable=true) {
430
+		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
431 431
 	}
432 432
 
433 433
 	/**
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 	 *        	function($element)
438 438
 	 * @return \Ajax\common\html\HtmlDoubleElement
439 439
 	 */
440
-	public function addEditButtonInToolbar($caption, $callback = NULL) {
441
-		$bt = new HtmlButton($this->identifier . "-editBtn", $caption);
440
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
441
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
442 442
 		$bt->setToggle();
443 443
 		$bt->setActive($this->_edition);
444 444
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 	}
447 447
 
448 448
 	public function setToolbar(HtmlMenu $_toolbar) {
449
-		$this->_toolbar = $_toolbar;
449
+		$this->_toolbar=$_toolbar;
450 450
 		return $this;
451 451
 	}
452 452
 
453 453
 	public function setToolbarPosition($_toolbarPosition) {
454
-		$this->_toolbarPosition = $_toolbarPosition;
454
+		$this->_toolbarPosition=$_toolbarPosition;
455 455
 		return $this;
456 456
 	}
457 457
 
458 458
 	public function getForm() {
459
-		if (! isset($this->_form)) {
460
-			$this->_form = new HtmlForm("frm-" . $this->identifier);
459
+		if (!isset($this->_form)) {
460
+			$this->_form=new HtmlForm("frm-".$this->identifier);
461 461
 			$this->setEdition(true);
462 462
 		}
463 463
 		return $this->_form;
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	}
472 472
 
473 473
 	protected function runForm(JsUtils $js) {
474
-		$fields = $this->getContentInstances(HtmlFormField::class);
474
+		$fields=$this->getContentInstances(HtmlFormField::class);
475 475
 		foreach ($fields as $field) {
476 476
 			$this->_form->addField($field);
477 477
 		}
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 
481 481
 	protected function _compileForm() {
482 482
 		if (isset($this->_form)) {
483
-			$noValidate = "";
484
-			if (\sizeof($this->_form->getValidationParams()) > 0)
485
-				$noValidate = "novalidate";
486
-			$this->wrapContent("<form class='" . $this->_form->getProperty('class') . "' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
483
+			$noValidate="";
484
+			if (\sizeof($this->_form->getValidationParams())>0)
485
+				$noValidate="novalidate";
486
+			$this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
487 487
 		}
488 488
 	}
489 489
 
@@ -505,21 +505,21 @@  discard block
 block discarded – undo
505 505
 	}
506 506
 
507 507
 	public function swapFields($index1, $index2) {
508
-		$index1 = $this->_getIndex($index1);
509
-		$index2 = $this->_getIndex($index2);
508
+		$index1=$this->_getIndex($index1);
509
+		$index2=$this->_getIndex($index2);
510 510
 		return $this->_instanceViewer->swapFields($index1, $index2);
511 511
 	}
512 512
 
513 513
 	public function removeField($index) {
514
-		$index = $this->_getIndex($index);
515
-		if ($index !== false) {
514
+		$index=$this->_getIndex($index);
515
+		if ($index!==false) {
516 516
 			$this->_instanceViewer->removeField($index);
517 517
 		}
518 518
 		return $this;
519 519
 	}
520 520
 
521
-	public function asModal($header = null) {
522
-		$modal = new HtmlModal("modal-" . $this->identifier, $header);
521
+	public function asModal($header=null) {
522
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
523 523
 		$modal->setContent($this);
524 524
 		if (isset($this->_form)) {
525 525
 			$this->_form->onSuccess($modal->jsHide());
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		return $modal;
528 528
 	}
529 529
 
530
-	public function addToProperty($name, $value, $separator = " ") {
530
+	public function addToProperty($name, $value, $separator=" ") {
531 531
 		return $this->getHtmlComponent()->addToProperty($name, $value, $separator);
532 532
 	}
533 533
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -291,8 +291,9 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
293 293
 		$result = $this->addInToolbar($caption, $callback);
294
-		if (isset($icon) && method_exists($result, "addIcon"))
295
-			$result->addIcon($icon);
294
+		if (isset($icon) && method_exists($result, "addIcon")) {
295
+					$result->addIcon($icon);
296
+		}
296 297
 		return $result;
297 298
 	}
298 299
 
@@ -481,8 +482,9 @@  discard block
 block discarded – undo
481 482
 	protected function _compileForm() {
482 483
 		if (isset($this->_form)) {
483 484
 			$noValidate = "";
484
-			if (\sizeof($this->_form->getValidationParams()) > 0)
485
-				$noValidate = "novalidate";
485
+			if (\sizeof($this->_form->getValidationParams()) > 0) {
486
+							$noValidate = "novalidate";
487
+			}
486 488
 			$this->wrapContent("<form class='" . $this->_form->getProperty('class') . "' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
487 489
 		}
488 490
 	}
Please login to merge, or discard this patch.