Passed
Push — master ( ee7fc7...175902 )
by Jean-Christophe
03:49
created
Ajax/semantic/html/modules/checkbox/AbstractCheckbox.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 
8 8
 abstract class AbstractCheckbox extends HtmlSemDoubleElement {
9 9
 
10
-	protected $_params = [];
10
+	protected $_params=[];
11 11
 
12
-	public function __construct($identifier, $name = NULL, $label = NULL, $value = NULL, $inputType = "checkbox", $type = "checkbox") {
13
-		parent::__construct("ck-" . $identifier, "div", "ui " . $type);
14
-		$this->_identifier = $identifier;
15
-		$field = new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value);
12
+	public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") {
13
+		parent::__construct("ck-".$identifier, "div", "ui ".$type);
14
+		$this->_identifier=$identifier;
15
+		$field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value);
16 16
 		$field->setProperty("name", $name);
17 17
 		$this->setField($field);
18 18
 		if (isset($label))
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 		$this->setLibraryId($identifier);
21 21
 	}
22 22
 
23
-	public function setChecked($value = true) {
24
-		if ($value === true) {
23
+	public function setChecked($value=true) {
24
+		if ($value===true) {
25 25
 			$this->getField()->setProperty("checked", "checked");
26 26
 		} else {
27 27
 			$this->getField()->removeProperty("checked");
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		return $this;
30 30
 	}
31 31
 
32
-	public function forceValue($value = 'true') {
32
+	public function forceValue($value='true') {
33 33
 		$this->getField()->forceValue($value);
34 34
 		return $this;
35 35
 	}
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 		return $this->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants());
39 39
 	}
40 40
 
41
-	public function setLabel($label, $value = null) {
42
-		$labelO = $label;
41
+	public function setLabel($label, $value=null) {
42
+		$labelO=$label;
43 43
 		if (\is_string($label)) {
44
-			$labelO = new HtmlSemDoubleElement("", "label", "");
44
+			$labelO=new HtmlSemDoubleElement("", "label", "");
45 45
 			$labelO->setContent($label);
46 46
 			$labelO->setProperty("for", $this->getField()
47 47
 				->getIdentifier());
48 48
 			if (isset($value))
49 49
 				$labelO->setProperty("data-value", $value);
50 50
 		}
51
-		$this->content["label"] = $labelO;
51
+		$this->content["label"]=$labelO;
52 52
 	}
53 53
 
54 54
 	public function setField($field) {
55
-		$this->content["field"] = $field;
55
+		$this->content["field"]=$field;
56 56
 	}
57 57
 
58 58
 	/**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * puts the label before or behind
79 79
 	 */
80 80
 	public function swapLabel() {
81
-		$label = $this->getLabel();
81
+		$label=$this->getLabel();
82 82
 		unset($this->content["label"]);
83
-		$this->content["label"] = $label;
83
+		$this->content["label"]=$label;
84 84
 	}
85 85
 
86 86
 	public function setReadonly() {
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 	 *        	action to execute : check, uncheck or NULL for toggle
98 98
 	 * @return AbstractCheckbox
99 99
 	 */
100
-	public function attachEvent($selector, $action = NULL) {
101
-		if (isset($action) || \is_numeric($action) === true) {
102
-			$js = '$("#%identifier%").checkbox("attach events", "' . $selector . '", "' . $action . '");';
100
+	public function attachEvent($selector, $action=NULL) {
101
+		if (isset($action) || \is_numeric($action)===true) {
102
+			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");';
103 103
 		} else {
104
-			$js = '$("#%identifier%").checkbox("attach events", "' . $selector . '");';
104
+			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'");';
105 105
 		}
106
-		$js = \str_replace("%identifier%", $this->identifier, $js);
106
+		$js=\str_replace("%identifier%", $this->identifier, $js);
107 107
 		return $this->executeOnRun($js);
108 108
 	}
109 109
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *        	associative array of events to attach ex : ["#bt-toggle","check"=>"#bt-check","uncheck"=>"#bt-uncheck"]
115 115
 	 * @return AbstractCheckbox
116 116
 	 */
117
-	public function attachEvents($events = array()) {
117
+	public function attachEvents($events=array()) {
118 118
 		if (\is_array($events)) {
119 119
 			foreach ($events as $action => $selector) {
120 120
 				$this->attachEvent($selector, $action);
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	public function setOnChecked($jsCode) {
131
-		$this->_params["onChecked"] = $jsCode;
131
+		$this->_params["onChecked"]=$jsCode;
132 132
 		return $this;
133 133
 	}
134 134
 
135 135
 	public function setOnUnchecked($jsCode) {
136
-		$this->_params["onUnchecked"] = $jsCode;
136
+		$this->_params["onUnchecked"]=$jsCode;
137 137
 		return $this;
138 138
 	}
139 139
 
140 140
 	public function setOnChange($jsCode) {
141
-		$this->_params["onChange"] = $jsCode;
141
+		$this->_params["onChange"]=$jsCode;
142 142
 		return $this;
143 143
 	}
144 144
 
145 145
 	public function run(JsUtils $js) {
146
-		if (! isset($this->_bsComponent))
147
-			$this->_bsComponent = $js->semantic()->checkbox("#" . $this->identifier, $this->_params);
146
+		if (!isset($this->_bsComponent))
147
+			$this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params);
148 148
 		return parent::run($js);
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -13,17 +13,17 @@  discard block
 block discarded – undo
13 13
 use Ajax\service\JArray;
14 14
 
15 15
 class HtmlDropdown extends HtmlSemDoubleElement {
16
-	use FieldTrait,LabeledIconTrait {
16
+	use FieldTrait, LabeledIconTrait {
17 17
 		addIcon as addIconP;
18 18
 	}
19 19
 
20
-	protected $mClass = "menu";
20
+	protected $mClass="menu";
21 21
 
22
-	protected $mTagName = "div";
22
+	protected $mTagName="div";
23 23
 
24
-	protected $items = array();
24
+	protected $items=array();
25 25
 
26
-	protected $_params = array(
26
+	protected $_params=array(
27 27
 		"action" => "nothing",
28 28
 		"on" => "hover",
29 29
 		"showOnFocus" => true
@@ -37,26 +37,26 @@  discard block
 block discarded – undo
37 37
 
38 38
 	protected $_multiple;
39 39
 
40
-	public function __construct($identifier, $value = "", $items = array(), $associative = true) {
40
+	public function __construct($identifier, $value="", $items=array(), $associative=true) {
41 41
 		parent::__construct($identifier, "div");
42
-		$this->_template = include dirname(__FILE__) . '/../templates/tplDropdown.php';
42
+		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
43 43
 		$this->setProperty("class", "ui dropdown");
44
-		$this->_multiple = false;
45
-		$content = [];
44
+		$this->_multiple=false;
45
+		$content=[];
46 46
 		if ($value instanceof HtmlSemDoubleElement) {
47
-			$text = $value;
47
+			$text=$value;
48 48
 		} else {
49
-			$text = new HtmlSemDoubleElement("text-" . $this->identifier, "div");
49
+			$text=new HtmlSemDoubleElement("text-".$this->identifier, "div");
50 50
 			$text->setClass("text");
51 51
 			$this->setValue($value);
52 52
 		}
53
-		$content = [
53
+		$content=[
54 54
 			"text" => $text
55 55
 		];
56
-		$content["arrow"] = new HtmlIcon($identifier . "-icon", "dropdown");
57
-		$this->content = $content;
58
-		$this->tagName = "div";
59
-		$this->_associative = $associative;
56
+		$content["arrow"]=new HtmlIcon($identifier."-icon", "dropdown");
57
+		$this->content=$content;
58
+		$this->tagName="div";
59
+		$this->_associative=$associative;
60 60
 		$this->addItems($items);
61 61
 	}
62 62
 
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
 		return $this->input;
69 69
 	}
70 70
 
71
-	public function addItem($item, $value = NULL, $image = NULL, $description = NULL) {
72
-		$itemO = $this->beforeAddItem($item, $value, $image, $description);
73
-		$this->items[] = $itemO;
71
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
72
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
73
+		$this->items[]=$itemO;
74 74
 		return $itemO;
75 75
 	}
76 76
 
77
-	public function addIcon($icon, $before = true, $labeled = false) {
77
+	public function addIcon($icon, $before=true, $labeled=false) {
78 78
 		$this->removeArrow();
79 79
 		$this->addIconP($icon, $before, $labeled);
80
-		$elm = $this->getElementById("text-" . $this->identifier, $this->content);
80
+		$elm=$this->getElementById("text-".$this->identifier, $this->content);
81 81
 		if (isset($elm)) {
82 82
 			$elm->setWrapAfter("");
83 83
 		}
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 
87 87
 	public function addIcons($icons) {
88
-		$count = $this->count();
89
-		for ($i = 0; $i < \sizeof($icons) && $i < $count; $i ++) {
88
+		$count=$this->count();
89
+		for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) {
90 90
 			$this->getItem($i)->addIcon($icons[$i]);
91 91
 		}
92 92
 	}
@@ -98,32 +98,32 @@  discard block
 block discarded – undo
98 98
 	 * @param int $position
99 99
 	 * @return HtmlDropdownItem
100 100
 	 */
101
-	public function insertItem($item, $position = 0) {
102
-		$itemO = $this->beforeAddItem($item);
103
-		$start = array_slice($this->items, 0, $position);
104
-		$end = array_slice($this->items, $position);
105
-		$start[] = $item;
106
-		$this->items = array_merge($start, $end);
101
+	public function insertItem($item, $position=0) {
102
+		$itemO=$this->beforeAddItem($item);
103
+		$start=array_slice($this->items, 0, $position);
104
+		$end=array_slice($this->items, $position);
105
+		$start[]=$item;
106
+		$this->items=array_merge($start, $end);
107 107
 		return $itemO;
108 108
 	}
109 109
 
110 110
 	protected function removeArrow() {
111
-		if (\sizeof($this->content) > 1) {
111
+		if (\sizeof($this->content)>1) {
112 112
 			unset($this->content["arrow"]);
113
-			$this->content = \array_values($this->content);
113
+			$this->content=\array_values($this->content);
114 114
 		}
115 115
 	}
116 116
 
117
-	protected function beforeAddItem($item, $value = NULL, $image = NULL, $description = NULL) {
118
-		$itemO = $item;
117
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
118
+		$itemO=$item;
119 119
 		if (\is_array($item)) {
120
-			$description = JArray::getValue($item, "description", 3);
121
-			$value = JArray::getValue($item, "value", 1);
122
-			$image = JArray::getValue($item, "image", 2);
123
-			$item = JArray::getValue($item, "item", 0);
120
+			$description=JArray::getValue($item, "description", 3);
121
+			$value=JArray::getValue($item, "value", 1);
122
+			$image=JArray::getValue($item, "image", 2);
123
+			$item=JArray::getValue($item, "item", 0);
124 124
 		}
125
-		if (! $item instanceof HtmlDropdownItem) {
126
-			$itemO = new HtmlDropdownItem("dd-item-" . $this->identifier . "-" . \sizeof($this->items), $item, $value, $image, $description);
125
+		if (!$item instanceof HtmlDropdownItem) {
126
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
127 127
 		} elseif ($itemO instanceof HtmlDropdownItem) {
128 128
 			$this->addToProperty("class", "vertical");
129 129
 		}
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	}
140 140
 
141 141
 	public function addInput($name) {
142
-		if (! isset($name))
143
-			$name = "input-" . $this->identifier;
142
+		if (!isset($name))
143
+			$name="input-".$this->identifier;
144 144
 		$this->setAction("activate");
145
-		$this->input = new HtmlInput($name, "hidden");
146
-		$this->input->setIdentifier("input-" . $this->identifier);
145
+		$this->input=new HtmlInput($name, "hidden");
146
+		$this->input->setIdentifier("input-".$this->identifier);
147 147
 		return $this->input;
148 148
 	}
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string $icon
155 155
 	 * @return HtmlDropdownItem
156 156
 	 */
157
-	public function addSearchInputItem($placeHolder = NULL, $icon = NULL) {
157
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
158 158
 		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
159 159
 	}
160 160
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param string $icon
175 175
 	 * @return HtmlDropdownItem
176 176
 	 */
177
-	public function addHeaderItem($caption = NULL, $icon = NULL) {
177
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
178 178
 		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
179 179
 	}
180 180
 
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
 	 * @return $this
220 220
 	 */
221 221
 	public function setPropertyValues($property, $values) {
222
-		$i = 0;
223
-		if (\is_array($values) === false) {
224
-			$values = \array_fill(0, $this->count(), $values);
222
+		$i=0;
223
+		if (\is_array($values)===false) {
224
+			$values=\array_fill(0, $this->count(), $values);
225 225
 		}
226 226
 		foreach ($values as $value) {
227
-			$c = $this->items[$i ++];
227
+			$c=$this->items[$i++];
228 228
 			if (isset($c)) {
229 229
 				$c->setProperty($property, $value);
230 230
 			} else {
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	 * @param boolean $dropdown
259 259
 	 */
260 260
 	public function asDropdown($dropdown) {
261
-		if ($dropdown === false) {
262
-			$this->_template = include dirname(__FILE__) . '/../templates/tplDropdownMenu.php';
263
-			$dropdown = "menu";
261
+		if ($dropdown===false) {
262
+			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
263
+			$dropdown="menu";
264 264
 		} else {
265
-			$dropdown = "dropdown";
266
-			$this->mClass = "menu";
265
+			$dropdown="dropdown";
266
+			$this->mClass="menu";
267 267
 		}
268 268
 		return $this->addToPropertyCtrl("class", $dropdown, array(
269 269
 			"menu",
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		));
290 290
 	}
291 291
 
292
-	public function asButton($floating = false) {
292
+	public function asButton($floating=false) {
293 293
 		$this->removeArrow();
294 294
 		if ($floating)
295 295
 			$this->addToProperty("class", "floating");
@@ -297,15 +297,15 @@  discard block
 block discarded – undo
297 297
 		return $this->addToProperty("class", "button");
298 298
 	}
299 299
 
300
-	public function asSelect($name = NULL, $multiple = false, $selection = true) {
301
-		$this->_multiple = $multiple;
300
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
301
+		$this->_multiple=$multiple;
302 302
 		if (isset($name))
303 303
 			$this->addInput($name);
304 304
 		if ($multiple) {
305 305
 			$this->addToProperty("class", "multiple");
306 306
 		}
307 307
 		if ($selection) {
308
-			if ($this->propertyContains("class", "button") === false)
308
+			if ($this->propertyContains("class", "button")===false)
309 309
 				$this->addToPropertyCtrl("class", "selection", array(
310 310
 					"selection"
311 311
 				));
@@ -313,31 +313,31 @@  discard block
 block discarded – undo
313 313
 		return $this;
314 314
 	}
315 315
 
316
-	public function asSearch($name = NULL, $multiple = false, $selection = true) {
316
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
317 317
 		$this->asSelect($name, $multiple, $selection);
318 318
 		return $this->addToProperty("class", "search");
319 319
 	}
320 320
 
321
-	public function setSelect($name = NULL, $multiple = false) {
322
-		$this->_template = '<%tagName% id="%identifier%" %properties%>%items%</%tagName%>';
323
-		if (! isset($name))
324
-			$name = "select-" . $this->identifier;
325
-		$this->input = null;
321
+	public function setSelect($name=NULL, $multiple=false) {
322
+		$this->_template='<%tagName% id="%identifier%" %properties%>%items%</%tagName%>';
323
+		if (!isset($name))
324
+			$name="select-".$this->identifier;
325
+		$this->input=null;
326 326
 		if ($multiple) {
327 327
 			$this->setProperty("multiple", true);
328 328
 			$this->addToProperty("class", "multiple");
329 329
 		}
330 330
 		$this->setAction("activate");
331
-		$this->tagName = "select";
331
+		$this->tagName="select";
332 332
 		$this->setProperty("name", $name);
333
-		$this->content = null;
333
+		$this->content=null;
334 334
 		foreach ($this->items as $item) {
335 335
 			$item->asOption();
336 336
 		}
337 337
 		return $this;
338 338
 	}
339 339
 
340
-	public function asSubmenu($pointing = NULL) {
340
+	public function asSubmenu($pointing=NULL) {
341 341
 		$this->setClass("ui dropdown link item");
342 342
 		if (isset($pointing)) {
343 343
 			$this->setPointing($pointing);
@@ -345,29 +345,29 @@  discard block
 block discarded – undo
345 345
 		return $this;
346 346
 	}
347 347
 
348
-	public function setPointing($value = Direction::NONE) {
349
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
348
+	public function setPointing($value=Direction::NONE) {
349
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
350 350
 	}
351 351
 
352 352
 	public function setValue($value) {
353
-		$this->value = $value;
353
+		$this->value=$value;
354 354
 		return $this;
355 355
 	}
356 356
 
357 357
 	public function setDefaultText($text) {
358
-		$this->content["text"] = new HtmlSemDoubleElement("", "div", "default text", $text);
358
+		$this->content["text"]=new HtmlSemDoubleElement("", "div", "default text", $text);
359 359
 		return $this;
360 360
 	}
361 361
 
362 362
 	private function applyValue() {
363
-		$value = $this->value;
363
+		$value=$this->value;
364 364
 		if (isset($this->input) && isset($value)) {
365 365
 			$this->input->setProperty("value", $value);
366 366
 		} else {
367 367
 			$this->setProperty("value", $value);
368 368
 		}
369
-		$textElement = $this->getElementById("text-" . $this->identifier, $this->content);
370
-		if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple)
369
+		$textElement=$this->getElementById("text-".$this->identifier, $this->content);
370
+		if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
371 371
 			$textElement->setContent($value);
372 372
 		return $this;
373 373
 	}
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 	 * @see BaseHtml::run()
378 378
 	 */
379 379
 	public function run(JsUtils $js) {
380
-		if ($this->propertyContains("class", "simple") === false) {
381
-			if (isset($this->_bsComponent) === false) {
382
-				$this->_bsComponent = $js->semantic()->dropdown("#" . $this->identifier, $this->_params);
380
+		if ($this->propertyContains("class", "simple")===false) {
381
+			if (isset($this->_bsComponent)===false) {
382
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
383 383
 				$this->_bsComponent->setItemSelector(".item");
384 384
 			}
385 385
 			$this->addEventsOnRun($js);
@@ -394,31 +394,31 @@  discard block
 block discarded – undo
394 394
 	}
395 395
 
396 396
 	public function setAction($action) {
397
-		$this->_params["action"] = $action;
397
+		$this->_params["action"]=$action;
398 398
 		return $this;
399 399
 	}
400 400
 
401 401
 	public function setOn($on) {
402
-		$this->_params["on"] = $on;
402
+		$this->_params["on"]=$on;
403 403
 		return $this;
404 404
 	}
405 405
 
406 406
 	public function setShowOnFocus($value) {
407
-		$this->_params["showOnFocus"] = $value;
407
+		$this->_params["showOnFocus"]=$value;
408 408
 		return $this;
409 409
 	}
410 410
 
411 411
 	public function setAllowAdditions($value) {
412
-		$this->_params["allowAdditions"] = $value;
412
+		$this->_params["allowAdditions"]=$value;
413 413
 		return $this;
414 414
 	}
415 415
 
416 416
 	public function setFullTextSearch($value) {
417
-		$this->_params["fullTextSearch"] = $value;
417
+		$this->_params["fullTextSearch"]=$value;
418 418
 		return $this;
419 419
 	}
420 420
 
421
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
421
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
422 422
 		$this->applyValue();
423 423
 		return parent::compile($js, $view);
424 424
 	}
@@ -427,19 +427,19 @@  discard block
 block discarded – undo
427 427
 		return $this->input;
428 428
 	}
429 429
 
430
-	public function setIcon($icon = "dropdown") {
431
-		$this->content["arrow"] = new HtmlIcon($this->identifier . "-icon", $icon);
430
+	public function setIcon($icon="dropdown") {
431
+		$this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon);
432 432
 		return $this;
433 433
 	}
434 434
 
435
-	public function jsAddItem($caption, $value = null) {
436
-		$value = $value ?? $caption;
437
-		$js = "var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}";
435
+	public function jsAddItem($caption, $value=null) {
436
+		$value=$value ?? $caption;
437
+		$js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}";
438 438
 		return $js;
439 439
 	}
440 440
 
441 441
 	public function setClearable($value) {
442
-		$this->_params["clearable"] = $value;
442
+		$this->_params["clearable"]=$value;
443 443
 		return $this;
444 444
 	}
445 445
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * Parameters addedValue, addedText, $addedChoice
449 449
 	 */
450 450
 	public function setOnAdd($jsCode) {
451
-		$this->_params["onAdd"] = $jsCode;
451
+		$this->_params["onAdd"]=$jsCode;
452 452
 		return $this;
453 453
 	}
454 454
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * Parameters removedValue, removedText, $removedChoice
458 458
 	 */
459 459
 	public function setOnRemove($jsCode) {
460
-		$this->_params["onRemove"] = $jsCode;
460
+		$this->_params["onRemove"]=$jsCode;
461 461
 		return $this;
462 462
 	}
463 463
 }
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlInput.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	protected $_placeholder;
11 11
 
12
-	public function __construct($identifier, $type = "text", $value = NULL, $placeholder = NULL) {
12
+	public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) {
13 13
 		parent::__construct($identifier, "input");
14 14
 		$this->setProperty("name", $identifier);
15 15
 		$this->setValue($value);
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
 		return $this->setProperty("type", $value);
28 28
 	}
29 29
 
30
-	public function forceValue($value = 'true') {
31
-		$this->wrap('<input type="hidden" value="false" name="' . $this->identifier . '"/>');
30
+	public function forceValue($value='true') {
31
+		$this->wrap('<input type="hidden" value="false" name="'.$this->identifier.'"/>');
32 32
 		$this->setValue($value);
33 33
 		return $this;
34 34
 	}
35 35
 
36 36
 	public function setPlaceholder($value) {
37 37
 		if (JString::isNotNull($value))
38
-			$this->_placeholder = $value;
38
+			$this->_placeholder=$value;
39 39
 		return $this;
40 40
 	}
41 41
 
42
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
43
-		$value = $this->_placeholder;
42
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
43
+		$value=$this->_placeholder;
44 44
 		if (JString::isNull($value)) {
45 45
 			if (JString::isNotNull($this->getProperty("name")))
46
-				$value = \ucfirst($this->getProperty("name"));
46
+				$value=\ucfirst($this->getProperty("name"));
47 47
 		}
48 48
 		$this->setProperty("placeholder", $value);
49 49
 		return parent::compile($js, $view);
Please login to merge, or discard this patch.
Ajax/service/JString.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,64 +4,64 @@
 block discarded – undo
4 4
 class JString {
5 5
 
6 6
 	public static function contains($hay, $needle) {
7
-		return strpos($hay, "$needle") !== false;
7
+		return strpos($hay, "$needle")!==false;
8 8
 	}
9 9
 
10 10
 	public static function startswith($hay, $needle) {
11
-		return substr($hay, 0, strlen($needle)) === $needle;
11
+		return substr($hay, 0, strlen($needle))===$needle;
12 12
 	}
13 13
 
14 14
 	public static function endswith($hay, $needle) {
15
-		return substr($hay, - strlen($needle)) === $needle;
15
+		return substr($hay, - strlen($needle))===$needle;
16 16
 	}
17 17
 
18 18
 	public static function isNull($s) {
19
-		return (! isset($s) || NULL === $s || "" === $s);
19
+		return (!isset($s) || NULL===$s || ""===$s);
20 20
 	}
21 21
 
22 22
 	public static function isNotNull($s) {
23
-		return (isset($s) && NULL !== $s && "" !== $s);
23
+		return (isset($s) && NULL!==$s && ""!==$s);
24 24
 	}
25 25
 
26 26
 	public static function isBoolean($value) {
27
-		return \is_bool($value) || $value == 1 || $value == 0;
27
+		return \is_bool($value) || $value==1 || $value==0;
28 28
 	}
29 29
 
30 30
 	public static function isBooleanTrue($value) {
31
-		return $value == 1 || $value;
31
+		return $value==1 || $value;
32 32
 	}
33 33
 
34 34
 	public static function isBooleanFalse($value) {
35
-		return $value == 0 || ! $value;
35
+		return $value==0 || !$value;
36 36
 	}
37 37
 
38
-	public static function camelCaseToSeparated($input, $separator = " ") {
39
-		return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator . '$0', $input));
38
+	public static function camelCaseToSeparated($input, $separator=" ") {
39
+		return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input));
40 40
 	}
41 41
 
42 42
 	public static function replaceAtFirst($subject, $from, $to) {
43
-		$from = '/\A' . preg_quote($from, '/') . '/';
43
+		$from='/\A'.preg_quote($from, '/').'/';
44 44
 		return \preg_replace($from, $to, $subject, 1);
45 45
 	}
46 46
 
47 47
 	public static function replaceAtLast($subject, $from, $to) {
48
-		$from = '/' . preg_quote($from, '/') . '\z/';
48
+		$from='/'.preg_quote($from, '/').'\z/';
49 49
 		return \preg_replace($from, $to, $subject, 1);
50 50
 	}
51 51
 
52 52
 	public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) {
53
-		$s = self::replaceAtFirst($subject, $fromFirst, $toFirst);
53
+		$s=self::replaceAtFirst($subject, $fromFirst, $toFirst);
54 54
 		return self::replaceAtLast($s, $fromLast, $toLast);
55 55
 	}
56 56
 
57
-	public static function getValueBetween(&$str, $before = "{{", $after = "}}") {
58
-		$matches = [];
59
-		$result = null;
60
-		$_before = \preg_quote($before);
61
-		$_after = \preg_quote($after);
62
-		if (\preg_match('/' . $_before . '(.*?)' . $_after . '/s', $str, $matches) === 1) {
63
-			$result = $matches[1];
64
-			$str = \str_replace($before . $result . $after, "", $str);
57
+	public static function getValueBetween(&$str, $before="{{", $after="}}") {
58
+		$matches=[];
59
+		$result=null;
60
+		$_before=\preg_quote($before);
61
+		$_after=\preg_quote($after);
62
+		if (\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1) {
63
+			$result=$matches[1];
64
+			$str=\str_replace($before.$result.$after, "", $str);
65 65
 		}
66 66
 		return $result;
67 67
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlInput.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@  discard block
 block discarded – undo
13 13
 use Ajax\semantic\html\elements\html5\HtmlDatalist;
14 14
 
15 15
 class HtmlInput extends HtmlSemDoubleElement {
16
-	use IconTrait,TextFieldsTrait,FieldTrait;
16
+	use IconTrait, TextFieldsTrait, FieldTrait;
17 17
 
18
-	public function __construct($identifier, $type = "text", $value = "", $placeholder = "") {
19
-		parent::__construct("div-" . $identifier, "div", "ui input");
20
-		$this->_identifier = $identifier;
21
-		$this->_libraryId = $identifier;
22
-		$this->content = [
18
+	public function __construct($identifier, $type="text", $value="", $placeholder="") {
19
+		parent::__construct("div-".$identifier, "div", "ui input");
20
+		$this->_identifier=$identifier;
21
+		$this->_libraryId=$identifier;
22
+		$this->content=[
23 23
 			"field" => new HtmlInput5($identifier, $type, $value, $placeholder)
24 24
 		];
25
-		$this->_states = [
25
+		$this->_states=[
26 26
 			State::DISABLED,
27 27
 			State::FOCUS,
28 28
 			State::ERROR
29 29
 		];
30
-		$this->_variations = [
30
+		$this->_variations=[
31 31
 			Variation::TRANSPARENT
32 32
 		];
33 33
 	}
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 		return $this->content["field"];
41 41
 	}
42 42
 
43
-	public static function outline($identifier, $icon, $value = "", $placeholder = "") {
44
-		$result = new HtmlInput($identifier, "text", $value, $placeholder);
43
+	public static function outline($identifier, $icon, $value="", $placeholder="") {
44
+		$result=new HtmlInput($identifier, "text", $value, $placeholder);
45 45
 		$result->addToProperty("class", "transparent");
46 46
 		$result->addIcon($icon)->setOutline();
47 47
 		return $result;
48 48
 	}
49 49
 
50 50
 	public function run(JsUtils $js) {
51
-		$result = parent::run($js);
52
-		$result->attach("#" . $this->getDataField()
51
+		$result=parent::run($js);
52
+		$result->attach("#".$this->getDataField()
53 53
 			->getIdentifier());
54 54
 		return $result;
55 55
 	}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		return $this->addToProperty("class", "transparent");
59 59
 	}
60 60
 
61
-	public function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL) {
61
+	public function compile_once(\Ajax\JsUtils $js=NULL, &$view=NULL) {
62 62
 		parent::compile_once($js, $view);
63 63
 		if (isset($this->content['file'])) {
64 64
 			$this->onCreate(Javascript::fileUploadBehavior($this->identifier));
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public function addDataList($items) {
69
-		$dl = new HtmlDatalist('list-' . $this->identifier);
69
+		$dl=new HtmlDatalist('list-'.$this->identifier);
70 70
 		$dl->addItems($items);
71 71
 		$this->getDataField()->setProperty('list', $dl->getIdentifier());
72 72
 		$this->getDataField()->wrap($dl);
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/html5/HtmlDatalist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	protected function createItem($value) {
14
-		$elm = new HtmlDoubleElement("", "option");
14
+		$elm=new HtmlDoubleElement("", "option");
15 15
 		$elm->setProperty("value", $value);
16 16
 		$elm->setContent($value);
17 17
 		return $elm;
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -15,62 +15,62 @@  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);
22
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
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
-		$immediatly = false;
30
+		$immediatly=false;
31 31
 		extract($parameters);
32 32
 
33
-		$jsCallback = isset($jsCallback) ? $jsCallback : "";
34
-		$retour = $this->_getAjaxUrl($url, $attr);
35
-		$originalSelector = $responseElement;
36
-		$responseElement = $this->_getResponseElement($responseElement);
37
-		$retour .= "var self=this;\n";
38
-		$before = isset($before) ? $before : "";
39
-		$retour .= $before;
40
-		if ($hasLoader === true && JString::isNotNull($responseElement)) {
33
+		$jsCallback=isset($jsCallback) ? $jsCallback : "";
34
+		$retour=$this->_getAjaxUrl($url, $attr);
35
+		$originalSelector=$responseElement;
36
+		$responseElement=$this->_getResponseElement($responseElement);
37
+		$retour.="var self=this;\n";
38
+		$before=isset($before) ? $before : "";
39
+		$retour.=$before;
40
+		if ($hasLoader===true && JString::isNotNull($responseElement)) {
41 41
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
42
-		} elseif ($hasLoader === "internal") {
43
-			$retour .= "\n$(this).addClass('loading');";
42
+		} elseif ($hasLoader==="internal") {
43
+			$retour.="\n$(this).addClass('loading');";
44 44
 		}
45
-		$ajaxParameters = [
45
+		$ajaxParameters=[
46 46
 			"url" => "url",
47
-			"method" => "'" . \strtoupper($method) . "'"
47
+			"method" => "'".\strtoupper($method)."'"
48 48
 		];
49 49
 
50
-		$ajaxParameters["async"] = ($async ? "true" : "false");
50
+		$ajaxParameters["async"]=($async ? "true" : "false");
51 51
 
52 52
 		if (isset($params)) {
53
-			$ajaxParameters["data"] = self::_correctParams($params, $parameters);
53
+			$ajaxParameters["data"]=self::_correctParams($params, $parameters);
54 54
 		}
55 55
 		if (isset($headers)) {
56
-			$ajaxParameters["headers"] = $headers;
56
+			$ajaxParameters["headers"]=$headers;
57 57
 		}
58 58
 		if (isset($partial)) {
59
-			$ajaxParameters["xhr"] = "xhrProvider";
60
-			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
59
+			$ajaxParameters["xhr"]="xhrProvider";
60
+			$retour.="var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
61 61
 		}
62 62
 		$this->createAjaxParameters($ajaxParameters, $parameters);
63
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
64
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
63
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n";
64
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null))."});\n";
65 65
 
66
-		$retour = $this->_addJsCondition($jsCondition, $retour);
66
+		$retour=$this->_addJsCondition($jsCondition, $retour);
67 67
 		if ($immediatly)
68
-			$this->jquery_code_for_compile[] = $retour;
68
+			$this->jquery_code_for_compile[]=$retour;
69 69
 		return $retour;
70 70
 	}
71 71
 
72 72
 	protected function createAjaxParameters(&$original, $parameters) {
73
-		$validParameters = [
73
+		$validParameters=[
74 74
 			"contentType" => "%value%",
75 75
 			"dataType" => "'%value%'",
76 76
 			"beforeSend" => "function(jqXHR,settings){%value%}",
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 		];
80 80
 		foreach ($validParameters as $param => $mask) {
81 81
 			if (isset($parameters[$param])) {
82
-				$original[$param] = \str_replace("%value%", $parameters[$param], $mask);
82
+				$original[$param]=\str_replace("%value%", $parameters[$param], $mask);
83 83
 			}
84 84
 		}
85 85
 	}
86 86
 
87 87
 	protected function implodeAjaxParameters($ajaxParameters) {
88
-		$s = '';
88
+		$s='';
89 89
 		foreach ($ajaxParameters as $k => $v) {
90
-			if ($s !== '') {
91
-				$s .= ',';
90
+			if ($s!=='') {
91
+				$s.=',';
92 92
 			}
93 93
 			if (is_array($v)) {
94
-				$s .= "'{$k}':{" . self::implodeAjaxParameters($v) . "}";
94
+				$s.="'{$k}':{".self::implodeAjaxParameters($v)."}";
95 95
 			} else {
96
-				$s .= "'{$k}':{$v}";
96
+				$s.="'{$k}':{$v}";
97 97
 			}
98 98
 		}
99 99
 		return $s;
@@ -101,27 +101,27 @@  discard block
 block discarded – undo
101 101
 
102 102
 	protected function _addJsCondition($jsCondition, $jsSource) {
103 103
 		if (isset($jsCondition)) {
104
-			return "if(" . $jsCondition . "){\n" . $jsSource . "\n}";
104
+			return "if(".$jsCondition."){\n".$jsSource."\n}";
105 105
 		}
106 106
 		return $jsSource;
107 107
 	}
108 108
 
109 109
 	protected function _getAjaxUrl($url, $attr) {
110
-		$url = $this->_correctAjaxUrl($url);
111
-		$retour = "url='" . $url . "';";
112
-		$slash = "/";
113
-		if (JString::endswith($url, "/") === true) {
114
-			$slash = "";
110
+		$url=$this->_correctAjaxUrl($url);
111
+		$retour="url='".$url."';";
112
+		$slash="/";
113
+		if (JString::endswith($url, "/")===true) {
114
+			$slash="";
115 115
 		}
116 116
 		if (JString::isNotNull($attr)) {
117
-			if ($attr === "value") {
118
-				$retour .= "url=url+'" . $slash . "'+$(this).val();\n";
119
-			} elseif ($attr === "html") {
120
-				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
121
-			} elseif (\substr($attr, 0, 3) === "js:") {
122
-				$retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n";
123
-			} elseif ($attr !== null && $attr !== "")
124
-				$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
117
+			if ($attr==="value") {
118
+				$retour.="url=url+'".$slash."'+$(this).val();\n";
119
+			} elseif ($attr==="html") {
120
+				$retour.="url=url+'".$slash."'+$(this).html();\n";
121
+			} elseif (\substr($attr, 0, 3)==="js:") {
122
+				$retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n";
123
+			} elseif ($attr!==null && $attr!=="")
124
+				$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
125 125
 		}
126 126
 		return $retour;
127 127
 	}
@@ -130,91 +130,91 @@  discard block
 block discarded – undo
130 130
 		return "window.onpopstate = function(e){if(e.state){var target=e.state.jqueryDone;$(e.state.selector)[target](e.state.html);}};";
131 131
 	}
132 132
 
133
-	protected function autoActiveLinks($previousURL = "window.location.href") {
134
-		$result = "\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}";
135
-		$result .= "\nvar myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
133
+	protected function autoActiveLinks($previousURL="window.location.href") {
134
+		$result="\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}";
135
+		$result.="\nvar myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
136 136
 		return $result;
137 137
 	}
138 138
 
139
-	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader = false, $history = null) {
140
-		$retour = "";
141
-		$call = null;
139
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader=false, $history=null) {
140
+		$retour="";
141
+		$call=null;
142 142
 		if (JString::isNotNull($responseElement)) {
143 143
 			if (isset($ajaxTransition)) {
144
-				$call = $this->setAjaxDataCall($ajaxTransition);
144
+				$call=$this->setAjaxDataCall($ajaxTransition);
145 145
 			} elseif (isset($this->ajaxTransition)) {
146
-				$call = $this->ajaxTransition;
146
+				$call=$this->ajaxTransition;
147 147
 			}
148 148
 			if (\is_callable($call))
149
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
149
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
150 150
 			else
151
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
151
+				$retour="\t{$responseElement}.{$jqueryDone}( data );\n";
152 152
 		}
153 153
 		if (isset($history)) {
154 154
 			if ($this->params["autoActiveLinks"]) {
155
-				$retour .= $this->autoActiveLinks("url");
155
+				$retour.=$this->autoActiveLinks("url");
156 156
 			}
157
-			$retour .= "\nwindow.history.pushState({'html':data,'selector':" . Javascript::prep_value($history) . ",'jqueryDone':'{$jqueryDone}'},'', url);";
157
+			$retour.="\nwindow.history.pushState({'html':data,'selector':".Javascript::prep_value($history).",'jqueryDone':'{$jqueryDone}'},'', url);";
158 158
 		}
159
-		if ($hasLoader === "internal") {
160
-			$retour .= "\n$(self).removeClass('loading');";
159
+		if ($hasLoader==="internal") {
160
+			$retour.="\n$(self).removeClass('loading');";
161 161
 		}
162
-		$retour .= "\t" . $jsCallback . "\n";
162
+		$retour.="\t".$jsCallback."\n";
163 163
 		return $retour;
164 164
 	}
165 165
 
166 166
 	protected function _getResponseElement($responseElement) {
167 167
 		if (JString::isNotNull($responseElement)) {
168
-			$responseElement = Javascript::prep_jquery_selector($responseElement);
168
+			$responseElement=Javascript::prep_jquery_selector($responseElement);
169 169
 		}
170 170
 		return $responseElement;
171 171
 	}
172 172
 
173 173
 	protected function _correctAjaxUrl($url) {
174
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
175
-			$url = substr($url, 0, strlen($url) - 1);
176
-		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
177
-			$url = $this->getUrl($url);
174
+		if ($url!=="/" && JString::endsWith($url, "/")===true)
175
+			$url=substr($url, 0, strlen($url)-1);
176
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
177
+			$url=$this->getUrl($url);
178 178
 		}
179 179
 		return $url;
180 180
 	}
181 181
 
182
-	public static function _correctParams($params, $ajaxParameters = []) {
182
+	public static function _correctParams($params, $ajaxParameters=[]) {
183 183
 		if (JString::isNull($params)) {
184 184
 			return "";
185 185
 		}
186 186
 		if (\preg_match("@^\{.*?\}$@", $params)) {
187
-			if (! isset($ajaxParameters['contentType']) || ! JString::contains($ajaxParameters['contentType'], 'json')) {
188
-				return '$.param(' . $params . ')';
187
+			if (!isset($ajaxParameters['contentType']) || !JString::contains($ajaxParameters['contentType'], 'json')) {
188
+				return '$.param('.$params.')';
189 189
 			} else {
190
-				return 'JSON.stringify(' . $params . ')';
190
+				return 'JSON.stringify('.$params.')';
191 191
 			}
192 192
 		}
193 193
 		return $params;
194 194
 	}
195 195
 
196 196
 	public static function _implodeParams($parameters) {
197
-		$allParameters = [];
197
+		$allParameters=[];
198 198
 		foreach ($parameters as $params) {
199 199
 			if (isset($params))
200
-				$allParameters[] = self::_correctParams($params);
200
+				$allParameters[]=self::_correctParams($params);
201 201
 		}
202 202
 		return \implode("+'&'+", $allParameters);
203 203
 	}
204 204
 
205
-	protected function addLoading(&$retour, $responseElement, $ajaxLoader = null) {
206
-		if (! isset($ajaxLoader)) {
207
-			$ajaxLoader = $this->ajaxLoader;
205
+	protected function addLoading(&$retour, $responseElement, $ajaxLoader=null) {
206
+		if (!isset($ajaxLoader)) {
207
+			$ajaxLoader=$this->ajaxLoader;
208 208
 		}
209
-		$loading_notifier = '<div class="ajax-loader">' . $ajaxLoader . '</div>';
210
-		$retour .= "{$responseElement}.empty();\n";
211
-		$retour .= "\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
209
+		$loading_notifier='<div class="ajax-loader">'.$ajaxLoader.'</div>';
210
+		$retour.="{$responseElement}.empty();\n";
211
+		$retour.="\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
212 212
 	}
213 213
 
214 214
 	protected function setAjaxDataCall($params) {
215
-		$result = null;
216
-		if (! \is_callable($params)) {
217
-			$result = function ($responseElement, $jqueryDone = "html") use ($params) {
215
+		$result=null;
216
+		if (!\is_callable($params)) {
217
+			$result=function($responseElement, $jqueryDone="html") use ($params) {
218 218
 				return AjaxTransition::{$params}($responseElement, $jqueryDone);
219 219
 			};
220 220
 		}
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 
224 224
 	protected function setDefaultParameters(&$parameters, $default) {
225 225
 		foreach ($default as $k => $v) {
226
-			if (! isset($parameters[$k]))
227
-				$parameters[$k] = $v;
226
+			if (!isset($parameters[$k]))
227
+				$parameters[$k]=$v;
228 228
 		}
229 229
 	}
230 230
 
231 231
 	public function setAjaxLoader($loader) {
232
-		$this->ajaxLoader = $loader;
232
+		$this->ajaxLoader=$loader;
233 233
 	}
234 234
 
235 235
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @param string $responseElement
241 241
 	 *        	selector of the HTML element displaying the answer
242 242
 	 */
243
-	private function _get($url, $responseElement = "", $parameters = []) {
243
+	private function _get($url, $responseElement="", $parameters=[]) {
244 244
 		return $this->_ajax("get", $url, $responseElement, $parameters);
245 245
 	}
246 246
 
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 	 * @param array $parameters
255 255
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
256 256
 	 */
257
-	public function get($url, $responseElement = "", $parameters = []) {
258
-		$parameters["immediatly"] = true;
257
+	public function get($url, $responseElement="", $parameters=[]) {
258
+		$parameters["immediatly"]=true;
259 259
 		return $this->_get($url, $responseElement, $parameters);
260 260
 	}
261 261
 
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 	 * @param array $parameters
272 272
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
273 273
 	 */
274
-	public function ajax($method, $url, $responseElement = "", $parameters = []) {
275
-		$parameters["immediatly"] = true;
274
+	public function ajax($method, $url, $responseElement="", $parameters=[]) {
275
+		$parameters["immediatly"]=true;
276 276
 		return $this->_ajax($method, $url, $responseElement, $parameters);
277 277
 	}
278 278
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 *        	$immediatly
295 295
 	 * @return string
296 296
 	 */
297
-	public function ajaxInterval($method, $url, $interval, $globalName = null, $responseElement = "", $parameters = [], $immediatly = true) {
297
+	public function ajaxInterval($method, $url, $interval, $globalName=null, $responseElement="", $parameters=[], $immediatly=true) {
298 298
 		return $this->interval($this->ajaxDeferred($method, $url, $responseElement, $parameters), $interval, $globalName, $immediatly);
299 299
 	}
300 300
 
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 	 * @param array $parameters
311 311
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
312 312
 	 */
313
-	public function ajaxDeferred($method, $url, $responseElement = "", $parameters = []) {
314
-		$parameters["immediatly"] = false;
313
+	public function ajaxDeferred($method, $url, $responseElement="", $parameters=[]) {
314
+		$parameters["immediatly"]=false;
315 315
 		return $this->_ajax($method, $url, $responseElement, $parameters);
316 316
 	}
317 317
 
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @param array $parameters
326 326
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
327 327
 	 */
328
-	private function _json($url, $method = "get", $parameters = []) {
329
-		$parameters = \array_merge($parameters, [
328
+	private function _json($url, $method="get", $parameters=[]) {
329
+		$parameters=\array_merge($parameters, [
330 330
 			"hasLoader" => false
331 331
 		]);
332
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
333
-		$context = isset($parameters['context']) ? $parameters['context'] : "document";
334
-		$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";
335
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
336
-		$parameters["jsCallback"] = $retour;
332
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
333
+		$context=isset($parameters['context']) ? $parameters['context'] : "document";
334
+		$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";
335
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
336
+		$parameters["jsCallback"]=$retour;
337 337
 		return $this->_ajax($method, $url, null, $parameters);
338 338
 	}
339 339
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * @param array $parameters
348 348
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
349 349
 	 */
350
-	public function json($url, $method = "get", $parameters = []) {
350
+	public function json($url, $method="get", $parameters=[]) {
351 351
 		return $this->_json($url, $method, $parameters);
352 352
 	}
353 353
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @param array $parameters
364 364
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true,"before"=>null)
365 365
 	 */
366
-	public function jsonOn($event, $element, $url, $method = "get", $parameters = array()) {
366
+	public function jsonOn($event, $element, $url, $method="get", $parameters=array()) {
367 367
 		$this->setDefaultParameters($parameters, [
368 368
 			"preventDefault" => true,
369 369
 			"stopPropagation" => true,
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 * @param array $parameters
383 383
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
384 384
 	 */
385
-	public function jsonDeferred($url, $method = "get", $parameters = []) {
386
-		$parameters["immediatly"] = false;
385
+	public function jsonDeferred($url, $method="get", $parameters=[]) {
386
+		$parameters["immediatly"]=false;
387 387
 		return $this->_json($url, $method, $parameters);
388 388
 	}
389 389
 
@@ -398,29 +398,29 @@  discard block
 block discarded – undo
398 398
 	 * @param array $parameters
399 399
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
400 400
 	 */
401
-	private function _jsonArray($maskSelector, $url, $method = "get", $parameters = []) {
402
-		$parameters = \array_merge($parameters, [
401
+	private function _jsonArray($maskSelector, $url, $method="get", $parameters=[]) {
402
+		$parameters=\array_merge($parameters, [
403 403
 			"hasLoader" => false
404 404
 		]);
405
-		$rowClass = isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
406
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
407
-		$context = isset($parameters['context']) ? $parameters['context'] : null;
408
-		if ($context === null) {
409
-			$parent = "$('" . $maskSelector . "').parent()";
410
-			$newElm = "$('#'+newId)";
405
+		$rowClass=isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
406
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
407
+		$context=isset($parameters['context']) ? $parameters['context'] : null;
408
+		if ($context===null) {
409
+			$parent="$('".$maskSelector."').parent()";
410
+			$newElm="$('#'+newId)";
411 411
 		} else {
412
-			$parent = $context;
413
-			$newElm = $context . ".find('#'+newId)";
412
+			$parent=$context;
413
+			$newElm=$context.".find('#'+newId)";
414 414
 		}
415
-		$appendTo = "\t\tnewElm.appendTo(" . $parent . ");\n";
416
-		$retour = $parent . ".find('.{$rowClass}').remove();";
417
-		$retour .= "\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.each(data, function(index, value) {\n" . "\tvar created=false;var maskElm=$('" . $maskSelector . "').first();maskElm.hide();" . "\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;" . "\tvar newElm=" . $newElm . ";\n" . "\tif(!newElm.length){\n" . "\t\tnewElm=maskElm.clone();
415
+		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
416
+		$retour=$parent.".find('.{$rowClass}').remove();";
417
+		$retour.="\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();
418 418
 		newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
419
-		$retour .= $appendTo;
420
-		$retour .= "\t}\n" . "\tfor(var key in value){\n" . "\t\t\tvar 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\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n" . "\t\t\tvar 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";
421
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
422
-		$retour .= "\t" . $jsCallback;
423
-		$parameters["jsCallback"] = $retour;
419
+		$retour.=$appendTo;
420
+		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar 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\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar 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";
421
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
422
+		$retour.="\t".$jsCallback;
423
+		$parameters["jsCallback"]=$retour;
424 424
 		return $this->_ajax($method, $url, null, $parameters);
425 425
 	}
426 426
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 * @param array $parameters
436 436
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
437 437
 	 */
438
-	public function jsonArray($maskSelector, $url, $method = "get", $parameters = []) {
438
+	public function jsonArray($maskSelector, $url, $method="get", $parameters=[]) {
439 439
 		return $this->_jsonArray($maskSelector, $url, $method, $parameters);
440 440
 	}
441 441
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @param array $parameters
451 451
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"rowClass"=>"_json","before"=>null)
452 452
 	 */
453
-	public function jsonArrayDeferred($maskSelector, $url, $method = "get", $parameters) {
454
-		$parameters["immediatly"] = false;
453
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $parameters) {
454
+		$parameters["immediatly"]=false;
455 455
 		return $this->jsonArray($maskSelector, $url, $method, $parameters);
456 456
 	}
457 457
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @param array $parameters
468 468
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true,"before"=>null)
469 469
 	 */
470
-	public function jsonArrayOn($event, $element, $maskSelector, $url, $method = "get", $parameters = array()) {
470
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $method="get", $parameters=array()) {
471 471
 		$this->setDefaultParameters($parameters, [
472 472
 			"preventDefault" => true,
473 473
 			"stopPropagation" => true,
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
 	 * @param array $parameters
488 488
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
489 489
 	 */
490
-	public function getDeferred($url, $responseElement = "", $parameters = []) {
491
-		$parameters["immediatly"] = false;
490
+	public function getDeferred($url, $responseElement="", $parameters=[]) {
491
+		$parameters["immediatly"]=false;
492 492
 		return $this->_get($url, $responseElement, $parameters);
493 493
 	}
494 494
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 * @param array $parameters
508 508
 	 *        	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)
509 509
 	 */
510
-	public function getOn($event, $element, $url, $responseElement = "", $parameters = array()) {
510
+	public function getOn($event, $element, $url, $responseElement="", $parameters=array()) {
511 511
 		$this->setDefaultParameters($parameters, [
512 512
 			"preventDefault" => true,
513 513
 			"stopPropagation" => true,
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	 * @param array $parameters
532 532
 	 *        	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)
533 533
 	 */
534
-	public function ajaxOn($event, $element, $url, $responseElement = "", $parameters = array()) {
534
+	public function ajaxOn($event, $element, $url, $responseElement="", $parameters=array()) {
535 535
 		$this->setDefaultParameters($parameters, [
536 536
 			"preventDefault" => true,
537 537
 			"stopPropagation" => true,
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	 * @param array $parameters
555 555
 	 *        	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)
556 556
 	 */
557
-	public function ajaxOnClick($element, $url, $responseElement = "", $parameters = array()) {
557
+	public function ajaxOnClick($element, $url, $responseElement="", $parameters=array()) {
558 558
 		return $this->ajaxOn("click", $element, $url, $responseElement, $parameters);
559 559
 	}
560 560
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 	 * @param array $parameters
572 572
 	 *        	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)
573 573
 	 */
574
-	public function getOnClick($element, $url, $responseElement = "", $parameters = array()) {
574
+	public function getOnClick($element, $url, $responseElement="", $parameters=array()) {
575 575
 		return $this->getOn("click", $element, $url, $responseElement, $parameters);
576 576
 	}
577 577
 
@@ -586,15 +586,15 @@  discard block
 block discarded – undo
586 586
 	 *        	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)
587 587
 	 * @return $this
588 588
 	 */
589
-	public function getHref($element, $responseElement = "", $parameters = array()) {
590
-		$parameters["attr"] = "href";
589
+	public function getHref($element, $responseElement="", $parameters=array()) {
590
+		$parameters["attr"]="href";
591 591
 		if (JString::isNull($responseElement)) {
592
-			$responseElement = '%$(self).attr("data-target")%';
592
+			$responseElement='%$(self).attr("data-target")%';
593 593
 		} else {
594
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
594
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
595 595
 		}
596
-		if (! isset($parameters["historize"])) {
597
-			$parameters["historize"] = true;
596
+		if (!isset($parameters["historize"])) {
597
+			$parameters["historize"]=true;
598 598
 		}
599 599
 		return $this->getOnClick($element, "", $responseElement, $parameters);
600 600
 	}
@@ -610,21 +610,21 @@  discard block
 block discarded – undo
610 610
 	 *        	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)
611 611
 	 * @return $this
612 612
 	 */
613
-	public function postHref($element, $responseElement = "", $parameters = array()) {
614
-		$parameters["attr"] = "href";
613
+	public function postHref($element, $responseElement="", $parameters=array()) {
614
+		$parameters["attr"]="href";
615 615
 		if (JString::isNull($responseElement)) {
616
-			$responseElement = '%$(this).attr("data-target")%';
616
+			$responseElement='%$(this).attr("data-target")%';
617 617
 		} else {
618
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
618
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
619 619
 		}
620
-		if (! isset($parameters["historize"])) {
621
-			$parameters["historize"] = true;
620
+		if (!isset($parameters["historize"])) {
621
+			$parameters["historize"]=true;
622 622
 		}
623 623
 		return $this->postOnClick($element, "", "{}", $responseElement, $parameters);
624 624
 	}
625 625
 
626
-	private function _post($url, $params = "{}", $responseElement = "", $parameters = []) {
627
-		$parameters["params"] = $params;
626
+	private function _post($url, $params="{}", $responseElement="", $parameters=[]) {
627
+		$parameters["params"]=$params;
628 628
 		return $this->_ajax("POST", $url, $responseElement, $parameters);
629 629
 	}
630 630
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 * @param array $parameters
641 641
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
642 642
 	 */
643
-	public function post($url, $params = "{}", $responseElement = "", $parameters = []) {
643
+	public function post($url, $params="{}", $responseElement="", $parameters=[]) {
644 644
 		return $this->_post($url, $params, $responseElement, $parameters);
645 645
 	}
646 646
 
@@ -657,8 +657,8 @@  discard block
 block discarded – undo
657 657
 	 * @param array $parameters
658 658
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
659 659
 	 */
660
-	public function postDeferred($url, $params = "{}", $responseElement = "", $parameters = []) {
661
-		$parameters["immediatly"] = false;
660
+	public function postDeferred($url, $params="{}", $responseElement="", $parameters=[]) {
661
+		$parameters["immediatly"]=false;
662 662
 		return $this->_post($url, $params, $responseElement, $parameters);
663 663
 	}
664 664
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 * @param array $parameters
678 678
 	 *        	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)
679 679
 	 */
680
-	public function postOn($event, $element, $url, $params = "{}", $responseElement = "", $parameters = array()) {
680
+	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
681 681
 		$this->setDefaultParameters($parameters, [
682 682
 			"preventDefault" => true,
683 683
 			"stopPropagation" => true,
@@ -700,64 +700,64 @@  discard block
 block discarded – undo
700 700
 	 * @param array $parameters
701 701
 	 *        	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)
702 702
 	 */
703
-	public function postOnClick($element, $url, $params = "{}", $responseElement = "", $parameters = array()) {
703
+	public function postOnClick($element, $url, $params="{}", $responseElement="", $parameters=array()) {
704 704
 		return $this->postOn("click", $element, $url, $params, $responseElement, $parameters);
705 705
 	}
706 706
 
707
-	private function _postForm($url, $form, $responseElement, $parameters = []) {
707
+	private function _postForm($url, $form, $responseElement, $parameters=[]) {
708 708
 		if (isset($this->params["ajax"])) {
709 709
 			extract($this->params["ajax"]);
710 710
 		}
711
-		$params = "{}";
712
-		$validation = false;
711
+		$params="{}";
712
+		$validation=false;
713 713
 		\extract($parameters);
714
-		$async = ($async) ? "true" : "false";
715
-		$jsCallback = isset($jsCallback) ? $jsCallback : "";
716
-		$retour = $this->_getAjaxUrl($url, $attr);
717
-		$retour .= "\n$('#" . $form . "').trigger('ajaxSubmit');";
718
-		if (! isset($contentType) || $contentType != 'false') {
719
-			$retour .= "\nvar params=$('#" . $form . "').serialize();\n";
714
+		$async=($async) ? "true" : "false";
715
+		$jsCallback=isset($jsCallback) ? $jsCallback : "";
716
+		$retour=$this->_getAjaxUrl($url, $attr);
717
+		$retour.="\n$('#".$form."').trigger('ajaxSubmit');";
718
+		if (!isset($contentType) || $contentType!='false') {
719
+			$retour.="\nvar params=$('#".$form."').serialize();\n";
720 720
 			if (isset($params)) {
721
-				$retour .= "params+='&'+" . self::_correctParams($params) . ";\n";
721
+				$retour.="params+='&'+".self::_correctParams($params).";\n";
722 722
 			}
723 723
 		} else {
724
-			$retour .= "\nvar params=new FormData($('#" . $form . "')[0]);\n";
724
+			$retour.="\nvar params=new FormData($('#".$form."')[0]);\n";
725 725
 		}
726
-		$responseElement = $this->_getResponseElement($responseElement);
727
-		$retour .= "var self=this;\n";
728
-		$before = isset($before) ? $before : "";
729
-		$retour .= $before;
730
-		if ($hasLoader === true) {
726
+		$responseElement=$this->_getResponseElement($responseElement);
727
+		$retour.="var self=this;\n";
728
+		$before=isset($before) ? $before : "";
729
+		$retour.=$before;
730
+		if ($hasLoader===true) {
731 731
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
732
-		} elseif ($hasLoader === "internal") {
733
-			$retour .= "\n$(this).addClass('loading');";
732
+		} elseif ($hasLoader==="internal") {
733
+			$retour.="\n$(this).addClass('loading');";
734 734
 		}
735
-		$ajaxParameters = [
735
+		$ajaxParameters=[
736 736
 			"url" => "url",
737 737
 			"method" => "'POST'",
738 738
 			"data" => "params",
739 739
 			"async" => $async
740 740
 		];
741 741
 		if (isset($headers)) {
742
-			$ajaxParameters["headers"] = $headers;
742
+			$ajaxParameters["headers"]=$headers;
743 743
 		}
744 744
 		if (isset($partial)) {
745
-			$ajaxParameters["xhr"] = "xhrProvider";
746
-			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
745
+			$ajaxParameters["xhr"]="xhrProvider";
746
+			$retour.="var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
747 747
 		}
748 748
 		$this->createAjaxParameters($ajaxParameters, $parameters);
749
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data ) {\n";
750
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader) . "});\n";
749
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data ) {\n";
750
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader)."});\n";
751 751
 
752 752
 		if ($validation) {
753
-			$retour = "$('#" . $form . "').validate({submitHandler: function(form) {
754
-			" . $retour . "
753
+			$retour="$('#".$form."').validate({submitHandler: function(form) {
754
+			" . $retour."
755 755
 			}});\n";
756
-			$retour .= "$('#" . $form . "').submit();\n";
756
+			$retour.="$('#".$form."').submit();\n";
757 757
 		}
758
-		$retour = $this->_addJsCondition($jsCondition, $retour);
758
+		$retour=$this->_addJsCondition($jsCondition, $retour);
759 759
 		if ($immediatly)
760
-			$this->jquery_code_for_compile[] = $retour;
760
+			$this->jquery_code_for_compile[]=$retour;
761 761
 		return $retour;
762 762
 	}
763 763
 
@@ -773,8 +773,8 @@  discard block
 block discarded – undo
773 773
 	 * @param array $parameters
774 774
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
775 775
 	 */
776
-	public function postForm($url, $form, $responseElement, $parameters = []) {
777
-		$parameters["immediatly"] = true;
776
+	public function postForm($url, $form, $responseElement, $parameters=[]) {
777
+		$parameters["immediatly"]=true;
778 778
 		return $this->_postForm($url, $form, $responseElement, $parameters);
779 779
 	}
780 780
 
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
 	 * @param array $parameters
792 792
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
793 793
 	 */
794
-	public function postFormDeferred($url, $form, $responseElement, $parameters = []) {
795
-		$parameters["immediatly"] = false;
794
+	public function postFormDeferred($url, $form, $responseElement, $parameters=[]) {
795
+		$parameters["immediatly"]=false;
796 796
 		return $this->_postForm($url, $form, $responseElement, $parameters);
797 797
 	}
798 798
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 * @param array $parameters
810 810
 	 *        	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)
811 811
 	 */
812
-	public function postFormOn($event, $element, $url, $form, $responseElement = "", $parameters = array()) {
812
+	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
813 813
 		$this->setDefaultParameters($parameters, [
814 814
 			"preventDefault" => true,
815 815
 			"stopPropagation" => true,
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 * @param array $parameters
831 831
 	 *        	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)
832 832
 	 */
833
-	public function postFormOnClick($element, $url, $form, $responseElement = "", $parameters = array()) {
833
+	public function postFormOnClick($element, $url, $form, $responseElement="", $parameters=array()) {
834 834
 		return $this->postFormOn("click", $element, $url, $form, $responseElement, $parameters);
835 835
 	}
836 836
 }
Please login to merge, or discard this patch.