Passed
Push — master ( 87cc87...bd8ea3 )
by Jean-Christophe
02:03
created
Ajax/semantic/components/Sidebar.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class Sidebar extends SimpleSemExtComponent {
16 16
 
17
-	public function __construct(JsUtils $js = NULL) {
17
+	public function __construct(JsUtils $js=NULL) {
18 18
 		parent::__construct($js);
19
-		$this->uiName = 'sidebar';
19
+		$this->uiName='sidebar';
20 20
 	}
21 21
 
22 22
 	public function show() {
@@ -46,32 +46,32 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	public function setContext($value) {
49
-		$this->params['context'] = $value;
49
+		$this->params['context']=$value;
50 50
 		return $this;
51 51
 	}
52 52
 
53
-	public function setExclusive($value = true) {
54
-		$this->params['exclusive'] = true;
53
+	public function setExclusive($value=true) {
54
+		$this->params['exclusive']=true;
55 55
 		return $this;
56 56
 	}
57 57
 
58
-	public function setClosable($value = true) {
59
-		$this->params['closable'] = $value;
58
+	public function setClosable($value=true) {
59
+		$this->params['closable']=$value;
60 60
 		return $this;
61 61
 	}
62 62
 
63
-	public function setDimPage($value = true) {
64
-		$this->params['dimPage'] = $value;
63
+	public function setDimPage($value=true) {
64
+		$this->params['dimPage']=$value;
65 65
 		return $this;
66 66
 	}
67 67
 
68
-	public function setScrollLock($value = false) {
69
-		$this->params['scrollLock'] = $value;
68
+	public function setScrollLock($value=false) {
69
+		$this->params['scrollLock']=$value;
70 70
 		return $this;
71 71
 	}
72 72
 
73
-	public function setReturnScroll($value = false) {
74
-		$this->params['returnScroll'] = $value;
73
+	public function setReturnScroll($value=false) {
74
+		$this->params['returnScroll']=$value;
75 75
 		return $this;
76 76
 	}
77 77
 
Please login to merge, or discard this patch.
Ajax/common/BaseGui.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	protected $js;
31 31
 
32
-	public function __construct($autoCompile = true) {
33
-		$this->autoCompile = $autoCompile;
34
-		$this->components = array();
35
-		$this->htmlComponents = array();
32
+	public function __construct($autoCompile=true) {
33
+		$this->autoCompile=$autoCompile;
34
+		$this->components=array();
35
+		$this->htmlComponents=array();
36 36
 	}
37 37
 
38 38
 	public function isAutoCompile() {
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	public function setAutoCompile($autoCompile) {
43
-		$this->autoCompile = $autoCompile;
43
+		$this->autoCompile=$autoCompile;
44 44
 		return $this;
45 45
 	}
46 46
 
47
-	public function compile($internal = false) {
48
-		if ($internal === false && $this->autoCompile === true)
47
+	public function compile($internal=false) {
48
+		if ($internal===false && $this->autoCompile===true)
49 49
 			throw new \Exception("Impossible to compile if autoCompile is set to 'true'");
50 50
 		foreach ($this->components as $component) {
51 51
 			$component->compile();
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	public function setJs(JsUtils $js) {
56
-		$this->js = $js;
56
+		$this->js=$js;
57 57
 	}
58 58
 
59 59
 	public function addComponent(SimpleComponent $component, $attachTo, $params) {
60 60
 		if ($this->autoCompile) {
61
-			if ($attachTo != null) {
62
-				if (! isset($this->components[$attachTo])) {
63
-					$this->components[$attachTo] = $component;
61
+			if ($attachTo!=null) {
62
+				if (!isset($this->components[$attachTo])) {
63
+					$this->components[$attachTo]=$component;
64 64
 				} else {
65
-					$this->components[] = $component;
65
+					$this->components[]=$component;
66 66
 				}
67 67
 				$component->attach($attachTo);
68 68
 			} else {
69
-				$this->components[] = $component;
69
+				$this->components[]=$component;
70 70
 			}
71 71
 		}
72 72
 		if (isset($params))
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 	}
77 77
 
78 78
 	public function addHtmlComponent(BaseHtml $htmlComponent) {
79
-		$this->htmlComponents[$htmlComponent->getIdentifier()] = $htmlComponent;
79
+		$this->htmlComponents[$htmlComponent->getIdentifier()]=$htmlComponent;
80 80
 		return $htmlComponent;
81 81
 	}
82 82
 
83
-	public function compileHtml(JsUtils $js = NULL, &$view = NULL) {
83
+	public function compileHtml(JsUtils $js=NULL, &$view=NULL) {
84 84
 		foreach ($this->htmlComponents as $htmlComponent) {
85 85
 			$htmlComponent->compile($js, $view);
86 86
 		}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		return array_filter($this->htmlComponents, $callback);
91 91
 	}
92 92
 	
93
-	public function getHtmlComponent($identifier){
94
-		return $this->htmlComponents[$identifier]??'';
93
+	public function getHtmlComponent($identifier) {
94
+		return $this->htmlComponents[$identifier] ?? '';
95 95
 	}
96 96
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  */
26 26
 class DataTable extends Widget {
27
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait;
27
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait;
28 28
 
29 29
 	protected $_searchField;
30 30
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 	protected $_displayBehavior;
42 42
 
43
-	protected $_visibleHover = false;
43
+	protected $_visibleHover=false;
44 44
 
45 45
 	protected $_targetSelector;
46 46
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 	protected $_json;
52 52
 
53
-	protected $_rowClass = "_element";
53
+	protected $_rowClass="_element";
54 54
 
55 55
 	protected $_sortable;
56 56
 
@@ -58,25 +58,25 @@  discard block
 block discarded – undo
58 58
 
59 59
 	protected $_colWidths;
60 60
 
61
-	public function __construct($identifier, $model, $modelInstance = NULL) {
61
+	public function __construct($identifier, $model, $modelInstance=NULL) {
62 62
 		parent::__construct($identifier, $model, $modelInstance);
63 63
 		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
64
-		$this->_urls = [];
65
-		$this->_emptyMessage = new HtmlMessage("", "nothing to display");
64
+		$this->_urls=[];
65
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
66 66
 		$this->_emptyMessage->setIcon("info circle");
67 67
 	}
68 68
 
69 69
 	public function run(JsUtils $js) {
70
-		$offset = $js->scriptCount();
70
+		$offset=$js->scriptCount();
71 71
 		if ($this->_hasCheckboxes && isset($js)) {
72 72
 			$this->_runCheckboxes($js);
73 73
 		}
74 74
 		if ($this->_visibleHover) {
75
-			$js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
75
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
76 76
 				"preventDefault" => false,
77 77
 				"stopPropagation" => true
78 78
 			]);
79
-			$js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
79
+			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
80 80
 				"preventDefault" => false,
81 81
 				"stopPropagation" => true
82 82
 			]);
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 
97 97
 	protected function _generateBehavior($op, $params, JsUtils $js) {
98 98
 		if (isset($this->_urls[$op])) {
99
-			$params = \array_merge($params, [
99
+			$params=\array_merge($params, [
100 100
 				"attr" => "data-ajax"
101 101
 			]);
102
-			$js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params);
102
+			$js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params);
103 103
 		}
104 104
 	}
105 105
 
@@ -118,21 +118,21 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	public function refreshTD($fieldName, $jquery, $view) {
121
-		$index = $this->_getIndex($fieldName);
121
+		$index=$this->_getIndex($fieldName);
122 122
 		$this->compile($jquery, $view);
123 123
 		return $this->refreshTR()
124 124
 			->getTable()
125 125
 			->getCell(0, $index);
126 126
 	}
127 127
 
128
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
129
-		if (! $this->_generated) {
128
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
129
+		if (!$this->_generated) {
130 130
 			if (isset($this->_buttonsColumn)) {
131 131
 				$this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons);
132 132
 			}
133 133
 			$this->_instanceViewer->setInstance($this->_model);
134
-			$captions = $this->_instanceViewer->getCaptions();
135
-			$table = $this->content["table"];
134
+			$captions=$this->_instanceViewer->getCaptions();
135
+			$table=$this->content["table"];
136 136
 			if ($this->_hasCheckboxes) {
137 137
 				$this->_generateMainCheckbox($captions);
138 138
 			}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 			$this->compileExtraElements($table, $captions);
148 148
 			$this->_compileSearchFieldBehavior($js);
149 149
 
150
-			$this->content = JArray::sortAssociative($this->content, [
150
+			$this->content=JArray::sortAssociative($this->content, [
151 151
 				PositionInTable::BEFORETABLE,
152 152
 				"table",
153 153
 				PositionInTable::AFTERTABLE
154 154
 			]);
155 155
 			$this->_compileForm();
156 156
 			$this->_applyStyleAttributes($table);
157
-			$this->_generated = true;
157
+			$this->_generated=true;
158 158
 		}
159 159
 		return parent::compile($js, $view);
160 160
 	}
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 	}
200 200
 
201 201
 	protected function _generateContent($table) {
202
-		$objects = $this->_modelInstance;
202
+		$objects=$this->_modelInstance;
203 203
 		if (isset($this->_pagination)) {
204
-			$objects = $this->_pagination->getObjects($this->_modelInstance);
204
+			$objects=$this->_pagination->getObjects($this->_modelInstance);
205 205
 		}
206 206
 		InstanceViewer::setIndex(0);
207
-		$fields = $this->_instanceViewer->getSimpleProperties();
208
-		$groupByFields = $this->_instanceViewer->getGroupByFields();
209
-		if (! is_array($groupByFields)) {
210
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) {
207
+		$fields=$this->_instanceViewer->getSimpleProperties();
208
+		$groupByFields=$this->_instanceViewer->getGroupByFields();
209
+		if (!is_array($groupByFields)) {
210
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) {
211 211
 				return $this->_generateRow($instance, $fields, $table);
212 212
 			});
213 213
 		} else {
214
-			$activeValues = array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null));
215
-			$uuids = [];
216
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) {
214
+			$activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null));
215
+			$uuids=[];
216
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) {
217 217
 				$this->_instanceViewer->setInstance($instance);
218 218
 				foreach ($groupByFields as $index => $gbField) {
219 219
 					$this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids);
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 				return $this->_generateRow($instance, $fields, $table, null, $uuids);
222 222
 			});
223 223
 		}
224
-		if ($table->getRowCount() == 0) {
225
-			$result = $table->addRow();
224
+		if ($table->getRowCount()==0) {
225
+			$result=$table->addRow();
226 226
 			$result->mergeRow();
227 227
 			$result->setValues([
228 228
 				$this->_emptyMessage
@@ -231,20 +231,20 @@  discard block
 block discarded – undo
231 231
 	}
232 232
 
233 233
 	protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) {
234
-		$newValue = $this->_instanceViewer->getValue($gbField);
235
-		if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) {
236
-			if ($index == 0) {
237
-				$uuids = [];
234
+		$newValue=$this->_instanceViewer->getValue($gbField);
235
+		if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) {
236
+			if ($index==0) {
237
+				$uuids=[];
238 238
 			}
239
-			$uuid = uniqid("grp");
240
-			$uuids[$gbField] = $uuid;
241
-			$id = $this->_instanceViewer->getIdentifier();
242
-			$result = $table->addMergeRow(sizeof($fields) + 1, $newValue);
243
-			$result->setIdentifier($this->identifier . "-tr-gb-" . $id);
239
+			$uuid=uniqid("grp");
240
+			$uuids[$gbField]=$uuid;
241
+			$id=$this->_instanceViewer->getIdentifier();
242
+			$result=$table->addMergeRow(sizeof($fields)+1, $newValue);
243
+			$result->setIdentifier($this->identifier."-tr-gb-".$id);
244 244
 			$result->setProperty("data-ajax", $id);
245 245
 			$result->setProperty("data-group", $uuid);
246 246
 			$result->addToProperty("class", $this->_rowClass);
247
-			$activeValues[$gbField] = $newValue;
247
+			$activeValues[$gbField]=$newValue;
248 248
 		}
249 249
 	}
250 250
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	}
257 257
 
258 258
 	public function getFieldValue($index) {
259
-		$index = $this->_getIndex($index);
259
+		$index=$this->_getIndex($index);
260 260
 		if (is_numeric($index)) {
261
-			$values = $this->_instanceViewer->getValues();
261
+			$values=$this->_instanceViewer->getValues();
262 262
 			if (isset($values[$index])) {
263 263
 				return $values[$index];
264 264
 			}
@@ -266,31 +266,31 @@  discard block
 block discarded – undo
266 266
 		return null;
267 267
 	}
268 268
 
269
-	protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) {
269
+	protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) {
270 270
 		$this->_instanceViewer->setInstance($instance);
271
-		InstanceViewer::$index ++;
272
-		$values = $this->_instanceViewer->getValues();
273
-		$id = $this->_instanceViewer->getIdentifier();
274
-		$dataAjax = $id;
275
-		$id = $this->cleanIdentifier($id);
271
+		InstanceViewer::$index++;
272
+		$values=$this->_instanceViewer->getValues();
273
+		$id=$this->_instanceViewer->getIdentifier();
274
+		$dataAjax=$id;
275
+		$id=$this->cleanIdentifier($id);
276 276
 		if ($this->_hasCheckboxes) {
277
-			$ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, "");
278
-			$checked = false;
277
+			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, "");
278
+			$checked=false;
279 279
 			if (isset($this->_checkedCallback)) {
280
-				$func = $this->_checkedCallback;
281
-				$checked = $func($instance);
280
+				$func=$this->_checkedCallback;
281
+				$checked=$func($instance);
282 282
 			}
283 283
 			$ck->setChecked($checked);
284 284
 			// $ck->setOnChange("event.stopPropagation();");
285
-			$field = $ck->getField();
285
+			$field=$ck->getField();
286 286
 			$field->setProperty("value", $dataAjax);
287 287
 			$field->setProperty("name", "selection[]");
288 288
 			if (isset($checkedClass))
289 289
 				$field->setClass($checkedClass);
290 290
 			\array_unshift($values, $ck);
291 291
 		}
292
-		$result = $table->newRow();
293
-		$result->setIdentifier($this->identifier . "-tr-" . $id);
292
+		$result=$table->newRow();
293
+		$result->setIdentifier($this->identifier."-tr-".$id);
294 294
 		$result->setProperty("data-ajax", $dataAjax);
295 295
 		$result->setValues($values);
296 296
 		$result->addToProperty("class", $this->_rowClass);
@@ -303,62 +303,62 @@  discard block
 block discarded – undo
303 303
 
304 304
 	protected function _generatePagination($table) {
305 305
 		if (isset($this->_toolbar)) {
306
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
306
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
307 307
 				$this->_toolbar->setFloated("left");
308 308
 		}
309
-		$footer = $table->getFooter();
309
+		$footer=$table->getFooter();
310 310
 		$footer->mergeCol();
311 311
 		$footer->addValues($this->_pagination->generateMenu($this->identifier));
312 312
 	}
313 313
 
314
-	protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) {
314
+	protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) {
315 315
 		if (isset($this->_urls["refresh"])) {
316
-			$menu = $this->_pagination->getMenu();
316
+			$menu=$this->_pagination->getMenu();
317 317
 			if (isset($menu) && isset($js)) {
318
-				$js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [
318
+				$js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [
319 319
 					"preventDefault" => false,
320 320
 					"jqueryDone" => "replaceWith",
321 321
 					"hasLoader" => false,
322
-					"jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");'
322
+					"jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");'
323 323
 				]);
324
-				$page = $_POST["p"] ?? null;
324
+				$page=$_POST["p"] ?? null;
325 325
 				if (isset($page)) {
326
-					$js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");');
326
+					$js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");');
327 327
 				}
328 328
 			}
329 329
 		}
330 330
 	}
331 331
 
332
-	protected function _compileSearchFieldBehavior(JsUtils $js = NULL) {
332
+	protected function _compileSearchFieldBehavior(JsUtils $js=NULL) {
333 333
 		if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) {
334
-			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [
334
+			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [
335 335
 				"preventDefault" => false,
336 336
 				"jqueryDone" => "replaceWith",
337 337
 				"hasLoader" => "internal",
338
-				"jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);'
338
+				"jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);'
339 339
 			]);
340 340
 		}
341 341
 	}
342 342
 
343
-	protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {}
343
+	protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {}
344 344
 
345 345
 	protected function _getFieldName($index) {
346
-		$fieldName = parent::_getFieldName($index);
346
+		$fieldName=parent::_getFieldName($index);
347 347
 		if (\is_object($fieldName))
348
-			$fieldName = "field-" . $index;
349
-		return $fieldName . "[]";
348
+			$fieldName="field-".$index;
349
+		return $fieldName."[]";
350 350
 	}
351 351
 
352 352
 	protected function _getFieldCaption($index) {
353 353
 		return null;
354 354
 	}
355 355
 
356
-	protected function _setToolbarPosition($table, $captions = NULL) {
356
+	protected function _setToolbarPosition($table, $captions=NULL) {
357 357
 		switch ($this->_toolbarPosition) {
358 358
 			case PositionInTable::BEFORETABLE:
359 359
 			case PositionInTable::AFTERTABLE:
360
-				if (isset($this->_compileParts) === false) {
361
-					$this->content[$this->_toolbarPosition] = $this->_toolbar;
360
+				if (isset($this->_compileParts)===false) {
361
+					$this->content[$this->_toolbarPosition]=$this->_toolbar;
362 362
 				}
363 363
 				break;
364 364
 			case PositionInTable::HEADER:
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
 	}
386 386
 
387 387
 	private function addToolbarRow($part, $table, $captions) {
388
-		$hasPart = $table->hasPart($part);
388
+		$hasPart=$table->hasPart($part);
389 389
 		if ($hasPart) {
390
-			$row = $table->getPart($part)->addRow(\sizeof($captions));
390
+			$row=$table->getPart($part)->addRow(\sizeof($captions));
391 391
 		} else {
392
-			$row = $table->getPart($part)->getRow(0);
392
+			$row=$table->getPart($part)->getRow(0);
393 393
 		}
394 394
 		$row->mergeCol();
395 395
 		$row->setValues([
@@ -421,12 +421,12 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function setUrls($urls) {
423 423
 		if (\is_array($urls)) {
424
-			$this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0);
425
-			$this->_urls["edit"] = JArray::getValue($urls, "edit", 1);
426
-			$this->_urls["delete"] = JArray::getValue($urls, "delete", 2);
427
-			$this->_urls["display"] = JArray::getValue($urls, "display", 3);
424
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
425
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
426
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
427
+			$this->_urls["display"]=JArray::getValue($urls, "display", 3);
428 428
 		} else {
429
-			$this->_urls = [
429
+			$this->_urls=[
430 430
 				"refresh" => $urls,
431 431
 				"edit" => $urls,
432 432
 				"delete" => $urls,
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 	 *        	The number of visible pages in the Pagination component
450 450
 	 * @return DataTable
451 451
 	 */
452
-	public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) {
453
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
452
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
453
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
454 454
 		return $this;
455 455
 	}
456 456
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 *        	The number of visible pages in the Pagination component
466 466
 	 * @return DataTable
467 467
 	 */
468
-	public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) {
469
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page);
468
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
469
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
470 470
 		return $this;
471 471
 	}
472 472
 
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 	 * @param array $compileParts
476 476
 	 * @return DataTable
477 477
 	 */
478
-	public function refresh($compileParts = [
478
+	public function refresh($compileParts=[
479 479
 		"tbody"
480 480
 	]) {
481
-		$this->_compileParts = $compileParts;
481
+		$this->_compileParts=$compileParts;
482 482
 		return $this;
483 483
 	}
484 484
 
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
 	 * @param string $position
489 489
 	 * @return \Ajax\common\html\HtmlDoubleElement
490 490
 	 */
491
-	public function addSearchInToolbar($position = Direction::RIGHT) {
491
+	public function addSearchInToolbar($position=Direction::RIGHT) {
492 492
 		return $this->addInToolbar($this->getSearchField())
493 493
 			->setPosition($position);
494 494
 	}
495 495
 
496 496
 	public function getSearchField() {
497
-		if (isset($this->_searchField) === false) {
498
-			$this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search...");
497
+		if (isset($this->_searchField)===false) {
498
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
499 499
 			$this->_searchField->addIcon("search", Direction::RIGHT);
500 500
 		}
501 501
 		return $this->_searchField;
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 	}
524 524
 
525 525
 	protected function getTargetSelector($op) {
526
-		$result = $this->_targetSelector;
527
-		if (! isset($result[$op]))
528
-			$result = "#" . $this->identifier;
526
+		$result=$this->_targetSelector;
527
+		if (!isset($result[$op]))
528
+			$result="#".$this->identifier;
529 529
 		return $result[$op];
530 530
 	}
531 531
 
@@ -537,20 +537,20 @@  discard block
 block discarded – undo
537 537
 	 * @return DataTable
538 538
 	 */
539 539
 	public function setTargetSelector($_targetSelector) {
540
-		if (! \is_array($_targetSelector)) {
541
-			$_targetSelector = [
540
+		if (!\is_array($_targetSelector)) {
541
+			$_targetSelector=[
542 542
 				"edit" => $_targetSelector,
543 543
 				"delete" => $_targetSelector
544 544
 			];
545 545
 		}
546
-		$this->_targetSelector = $_targetSelector;
546
+		$this->_targetSelector=$_targetSelector;
547 547
 		return $this;
548 548
 	}
549 549
 
550 550
 	public function getRefreshSelector() {
551 551
 		if (isset($this->_refreshSelector))
552 552
 			return $this->_refreshSelector;
553
-		return "#" . $this->identifier . " tbody";
553
+		return "#".$this->identifier." tbody";
554 554
 	}
555 555
 
556 556
 	/**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	 * @return DataTable
560 560
 	 */
561 561
 	public function setRefreshSelector($_refreshSelector) {
562
-		$this->_refreshSelector = $_refreshSelector;
562
+		$this->_refreshSelector=$_refreshSelector;
563 563
 		return $this;
564 564
 	}
565 565
 
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
 	public function show($modelInstance) {
572 572
 		if (\is_array($modelInstance)) {
573 573
 			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
574
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
574
+				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
575 575
 		}
576
-		$this->_modelInstance = $modelInstance;
576
+		$this->_modelInstance=$modelInstance;
577 577
 	}
578 578
 
579 579
 	public function getRowClass() {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 * @return DataTable
588 588
 	 */
589 589
 	public function setRowClass($_rowClass) {
590
-		$this->_rowClass = $_rowClass;
590
+		$this->_rowClass=$_rowClass;
591 591
 		return $this;
592 592
 	}
593 593
 
@@ -598,34 +598,34 @@  discard block
 block discarded – undo
598 598
 	 * @return DataTable
599 599
 	 */
600 600
 	public function setEmptyMessage($_emptyMessage) {
601
-		$this->_emptyMessage = $_emptyMessage;
601
+		$this->_emptyMessage=$_emptyMessage;
602 602
 		return $this;
603 603
 	}
604 604
 
605
-	public function setSortable($colIndex = NULL) {
606
-		$this->_sortable = $colIndex;
605
+	public function setSortable($colIndex=NULL) {
606
+		$this->_sortable=$colIndex;
607 607
 		return $this;
608 608
 	}
609 609
 
610
-	public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) {
610
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
611 611
 		$this->_self->setActiveRowSelector($class, $event, $multiple);
612 612
 		return $this;
613 613
 	}
614 614
 
615 615
 	public function hideColumn($colIndex) {
616
-		if (! \is_array($this->_hiddenColumns))
617
-			$this->_hiddenColumns = [];
618
-		$this->_hiddenColumns[] = $colIndex;
616
+		if (!\is_array($this->_hiddenColumns))
617
+			$this->_hiddenColumns=[];
618
+		$this->_hiddenColumns[]=$colIndex;
619 619
 		return $this;
620 620
 	}
621 621
 
622 622
 	public function setColWidth($colIndex, $width) {
623
-		$this->_colWidths[$colIndex] = $width;
623
+		$this->_colWidths[$colIndex]=$width;
624 624
 		return $this;
625 625
 	}
626 626
 
627 627
 	public function setColWidths($_colWidths) {
628
-		$this->_colWidths = $_colWidths;
628
+		$this->_colWidths=$_colWidths;
629 629
 		return $this;
630 630
 	}
631 631
 
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 		return $this;
635 635
 	}
636 636
 
637
-	public function trigger($event, $params = "[]") {
637
+	public function trigger($event, $params="[]") {
638 638
 		return $this->getHtmlComponent()->trigger($event, $params);
639 639
 	}
640 640
 
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 	 * @param mixed $_displayBehavior
673 673
 	 */
674 674
 	public function setDisplayBehavior($_displayBehavior) {
675
-		$this->_displayBehavior = $_displayBehavior;
675
+		$this->_displayBehavior=$_displayBehavior;
676 676
 	}
677 677
 
678 678
 	/**
@@ -696,6 +696,6 @@  discard block
 block discarded – undo
696 696
 	 * @param boolean $_visibleHover
697 697
 	 */
698 698
 	public function setVisibleHover($_visibleHover) {
699
-		$this->_visibleHover = $_visibleHover;
699
+		$this->_visibleHover=$_visibleHover;
700 700
 	}
701 701
 }
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,28 +3,28 @@  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 19
 	public static function containsCode($expression) {
20
-		return strrpos($expression, 'this') !== false || strrpos($expression, 'event') !== false || strrpos($expression, 'self') !== false;
20
+		return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false;
21 21
 	}
22 22
 
23 23
 	public static function isFunction($jsCode) {
24 24
 		return JString::startswith($jsCode, "function");
25 25
 	}
26 26
 
27
-	public static function fileUploadBehavior($id = '') {
27
+	public static function fileUploadBehavior($id='') {
28 28
 		return "$('input:text, .ui.button', '#{$id}').on('click', function (e) {e.preventDefault();\$('input:file', '#{$id}').click();});
29 29
 				$('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);}});";
30 30
 	}
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return string
39 39
 	 */
40 40
 	public static function prep_element($element) {
41
-		if (self::containsCode($element) === false) {
42
-			$element = '"' . addslashes($element) . '"';
41
+		if (self::containsCode($element)===false) {
42
+			$element='"'.addslashes($element).'"';
43 43
 		}
44 44
 		return $element;
45 45
 	}
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public static function prep_value($value) {
56 56
 		if (\is_array($value)) {
57
-			$value = implode(",", $value);
57
+			$value=implode(",", $value);
58 58
 		}
59
-		if (self::containsCode($value) === false) {
60
-			$value = \str_replace([
59
+		if (self::containsCode($value)===false) {
60
+			$value=\str_replace([
61 61
 				"\\",
62 62
 				"\""
63 63
 			], [
64 64
 				"\\\\",
65 65
 				"\\\""
66 66
 			], $value);
67
-			$value = '"' . $value . '"';
67
+			$value='"'.$value.'"';
68 68
 		}
69 69
 		return trim($value, "%");
70 70
 	}
71 71
 
72 72
 	public static function prep_jquery_selector($value) {
73
-		if (JString::startswith($value, '$(') === false) {
74
-			return '$(' . self::prep_value($value) . ')';
73
+		if (JString::startswith($value, '$(')===false) {
74
+			return '$('.self::prep_value($value).')';
75 75
 		}
76 76
 		return $value;
77 77
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlMessage.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
  * @version 1.001
17 17
  */
18 18
 class HtmlMessage extends HtmlSemDoubleElement {
19
-	use AttachedTrait,HasTimeoutTrait;
19
+	use AttachedTrait, HasTimeoutTrait;
20 20
 
21 21
 	protected $icon;
22 22
 
23 23
 	protected $close;
24 24
 
25
-	public function __construct($identifier, $content = "") {
25
+	public function __construct($identifier, $content="") {
26 26
 		parent::__construct($identifier, "div");
27
-		$this->_template = '<%tagName% id="%identifier%" %properties%>%close%%icon%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>';
27
+		$this->_template='<%tagName% id="%identifier%" %properties%>%close%%icon%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>';
28 28
 		$this->setClass("ui message");
29 29
 		$this->setContent($content);
30 30
 	}
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 * @return \Ajax\semantic\html\collections\HtmlMessage
37 37
 	 */
38 38
 	public function addHeader($header) {
39
-		$headerO = $header;
39
+		$headerO=$header;
40 40
 		if (\is_string($header)) {
41
-			$headerO = new HtmlSemDoubleElement("header-" . $this->identifier, "div");
41
+			$headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div");
42 42
 			$headerO->setClass("header");
43 43
 			$headerO->setContent($header);
44 44
 		}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 		$this->addToProperty("class", "icon");
54 54
 		$this->wrapContent("<div class='content'>", "</div>");
55 55
 		if (\is_string($icon)) {
56
-			$this->icon = new HtmlIcon("icon-" . $this->identifier, $icon);
56
+			$this->icon=new HtmlIcon("icon-".$this->identifier, $icon);
57 57
 		} else {
58
-			$this->icon = $icon;
58
+			$this->icon=$icon;
59 59
 		}
60 60
 		return $this;
61 61
 	}
@@ -72,23 +72,23 @@  discard block
 block discarded – undo
72 72
 	 *        	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)
73 73
 	 * @return $this
74 74
 	 */
75
-	public function getOnClose($url, $responseElement = "", $parameters = array()) {
75
+	public function getOnClose($url, $responseElement="", $parameters=array()) {
76 76
 		if (isset($this->close)) {
77 77
 			$this->close->getOnClick($url, $responseElement, $parameters);
78 78
 		}
79 79
 	}
80 80
 
81
-	public function addLoader($loaderIcon = "notched circle") {
81
+	public function addLoader($loaderIcon="notched circle") {
82 82
 		$this->setIcon($loaderIcon);
83 83
 		$this->icon->addToIcon("loading");
84 84
 		return $this;
85 85
 	}
86 86
 
87
-	public function setDismissable($dismiss = true) {
88
-		if ($dismiss === true)
89
-			$this->close = new HtmlIcon("close-" . $this->identifier, "close");
87
+	public function setDismissable($dismiss=true) {
88
+		if ($dismiss===true)
89
+			$this->close=new HtmlIcon("close-".$this->identifier, "close");
90 90
 		else
91
-			$this->close = NULL;
91
+			$this->close=NULL;
92 92
 		return $this;
93 93
 	}
94 94
 
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
99 99
 	 */
100 100
 	public function run(JsUtils $js) {
101
-		if (! isset($this->_bsComponent)) {
101
+		if (!isset($this->_bsComponent)) {
102 102
 			if (isset($this->close)) {
103
-				$js->execOn("click", "#" . $this->identifier . " .close", "$(this).closest('.message').transition({$this->_closeTransition}).trigger('close-message');");
103
+				$js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition}).trigger('close-message');");
104 104
 			}
105 105
 			if (isset($this->_timeout)) {
106 106
 				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}).trigger('close-message'); }, {$this->_timeout});", true);
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 		return parent::run($js);
110 110
 	}
111 111
 
112
-	public function setState($visible = true) {
113
-		$visible = ($visible === true) ? "visible" : "hidden";
112
+	public function setState($visible=true) {
113
+		$visible=($visible===true) ? "visible" : "hidden";
114 114
 		return $this->addToPropertyCtrl("class", $visible, array(
115 115
 			"visible",
116 116
 			"hidden"
117 117
 		));
118 118
 	}
119 119
 
120
-	public function setVariation($value = "floating") {
120
+	public function setVariation($value="floating") {
121 121
 		return $this->addToPropertyCtrl("class", $value, array(
122 122
 			"floating",
123 123
 			"compact"
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 	public function setMessage($message) {
140 140
 		if (\is_array($this->content)) {
141
-			$this->content[\sizeof($this->content) - 1] = $message;
141
+			$this->content[\sizeof($this->content)-1]=$message;
142 142
 		} else
143 143
 			$this->setContent($message);
144 144
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -15,63 +15,63 @@  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 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 .= "var 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.="var 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') {
44
-			$retour .= "\n$(this).addClass('loading');";
43
+		} elseif ($hasLoader==='internal') {
44
+			$retour.="\n$(this).addClass('loading');";
45 45
 		}
46
-		$ajaxParameters = [
46
+		$ajaxParameters=[
47 47
 			"url" => "url",
48
-			"method" => "'" . \strtoupper($method) . "'"
48
+			"method" => "'".\strtoupper($method)."'"
49 49
 		];
50 50
 
51
-		$ajaxParameters["async"] = ($async ? "true" : "false");
51
+		$ajaxParameters["async"]=($async ? "true" : "false");
52 52
 
53 53
 		if (isset($params)) {
54
-			$ajaxParameters["data"] = self::_correctParams($params, $parameters);
54
+			$ajaxParameters["data"]=self::_correctParams($params, $parameters);
55 55
 		}
56 56
 		if (isset($headers)) {
57
-			$ajaxParameters["headers"] = $headers;
57
+			$ajaxParameters["headers"]=$headers;
58 58
 		}
59 59
 		if (isset($partial)) {
60
-			$ajaxParameters["xhr"] = "xhrProvider";
61
-			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
60
+			$ajaxParameters["xhr"]="xhrProvider";
61
+			$retour.="var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
62 62
 		}
63 63
 		$this->createAjaxParameters($ajaxParameters, $parameters);
64
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
65
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
64
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n";
65
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null))."});\n";
66 66
 
67
-		$retour = $this->_addJsCondition($jsCondition, $retour);
67
+		$retour=$this->_addJsCondition($jsCondition, $retour);
68 68
 		if ($immediatly)
69
-			$this->jquery_code_for_compile[] = $retour;
69
+			$this->jquery_code_for_compile[]=$retour;
70 70
 		return $retour;
71 71
 	}
72 72
 
73 73
 	protected function createAjaxParameters(&$original, $parameters) {
74
-		$validParameters = [
74
+		$validParameters=[
75 75
 			"contentType" => "%value%",
76 76
 			"dataType" => "'%value%'",
77 77
 			"beforeSend" => "function(jqXHR,settings){%value%}",
@@ -80,21 +80,21 @@  discard block
 block discarded – undo
80 80
 		];
81 81
 		foreach ($validParameters as $param => $mask) {
82 82
 			if (isset($parameters[$param])) {
83
-				$original[$param] = \str_replace("%value%", $parameters[$param], $mask);
83
+				$original[$param]=\str_replace("%value%", $parameters[$param], $mask);
84 84
 			}
85 85
 		}
86 86
 	}
87 87
 
88 88
 	protected function implodeAjaxParameters($ajaxParameters) {
89
-		$s = '';
89
+		$s='';
90 90
 		foreach ($ajaxParameters as $k => $v) {
91
-			if ($s !== '') {
92
-				$s .= ',';
91
+			if ($s!=='') {
92
+				$s.=',';
93 93
 			}
94 94
 			if (is_array($v)) {
95
-				$s .= "'{$k}':{" . self::implodeAjaxParameters($v) . "}";
95
+				$s.="'{$k}':{".self::implodeAjaxParameters($v)."}";
96 96
 			} else {
97
-				$s .= "'{$k}':{$v}";
97
+				$s.="'{$k}':{$v}";
98 98
 			}
99 99
 		}
100 100
 		return $s;
@@ -102,27 +102,27 @@  discard block
 block discarded – undo
102 102
 
103 103
 	protected function _addJsCondition($jsCondition, $jsSource) {
104 104
 		if (isset($jsCondition)) {
105
-			return "if(" . $jsCondition . "){\n" . $jsSource . "\n}";
105
+			return "if(".$jsCondition."){\n".$jsSource."\n}";
106 106
 		}
107 107
 		return $jsSource;
108 108
 	}
109 109
 
110 110
 	protected function _getAjaxUrl($url, $attr) {
111
-		$url = $this->_correctAjaxUrl($url);
112
-		$retour = "url='" . $url . "';";
113
-		$slash = "/";
114
-		if (JString::endswith($url, "/") === true) {
115
-			$slash = "";
111
+		$url=$this->_correctAjaxUrl($url);
112
+		$retour="url='".$url."';";
113
+		$slash="/";
114
+		if (JString::endswith($url, "/")===true) {
115
+			$slash="";
116 116
 		}
117 117
 		if (JString::isNotNull($attr)) {
118
-			if ($attr === "value") {
119
-				$retour .= "url=url+'" . $slash . "'+$(this).val();\n";
120
-			} elseif ($attr === "html") {
121
-				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
122
-			} elseif (\substr($attr, 0, 3) === "js:") {
123
-				$retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n";
124
-			} elseif ($attr !== null && $attr !== "")
125
-				$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
118
+			if ($attr==="value") {
119
+				$retour.="url=url+'".$slash."'+$(this).val();\n";
120
+			} elseif ($attr==="html") {
121
+				$retour.="url=url+'".$slash."'+$(this).html();\n";
122
+			} elseif (\substr($attr, 0, 3)==="js:") {
123
+				$retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n";
124
+			} elseif ($attr!==null && $attr!=="")
125
+				$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
126 126
 		}
127 127
 		return $retour;
128 128
 	}
@@ -131,99 +131,99 @@  discard block
 block discarded – undo
131 131
 		return "window.onpopstate = function(e){if(e.state){var target=e.state.jqueryDone;$(e.state.selector)[target](e.state.html);}};";
132 132
 	}
133 133
 
134
-	protected function autoActiveLinks($previousURL = "window.location.href") {
135
-		$result = "\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}";
136
-		$result .= "\nvar myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
134
+	protected function autoActiveLinks($previousURL="window.location.href") {
135
+		$result="\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}";
136
+		$result.="\nvar myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
137 137
 		return $result;
138 138
 	}
139 139
 
140
-	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader = false, $history = null) {
141
-		$retour = "";
142
-		$call = null;
140
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader=false, $history=null) {
141
+		$retour="";
142
+		$call=null;
143 143
 		if (JString::isNotNull($responseElement)) {
144 144
 			if (isset($ajaxTransition)) {
145
-				$call = $this->setAjaxDataCall($ajaxTransition);
145
+				$call=$this->setAjaxDataCall($ajaxTransition);
146 146
 			} elseif (isset($this->ajaxTransition)) {
147
-				$call = $this->ajaxTransition;
147
+				$call=$this->ajaxTransition;
148 148
 			}
149 149
 			if (\is_callable($call))
150
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
150
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
151 151
 			else
152
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
152
+				$retour="\t{$responseElement}.{$jqueryDone}( data );\n";
153 153
 		}
154 154
 		if (isset($history)) {
155 155
 			if ($this->params["autoActiveLinks"]) {
156
-				$retour .= $this->autoActiveLinks("url");
156
+				$retour.=$this->autoActiveLinks("url");
157 157
 			}
158
-			$retour .= "\nwindow.history.pushState({'html':data,'selector':" . Javascript::prep_value($history) . ",'jqueryDone':'{$jqueryDone}'},'', url);";
158
+			$retour.="\nwindow.history.pushState({'html':data,'selector':".Javascript::prep_value($history).",'jqueryDone':'{$jqueryDone}'},'', url);";
159 159
 		}
160
-		if ($hasLoader === "internal") {
161
-			$retour .= "\n$(self).removeClass('loading');";
160
+		if ($hasLoader==="internal") {
161
+			$retour.="\n$(self).removeClass('loading');";
162 162
 		}
163
-		$retour .= "\t" . $jsCallback . "\n";
163
+		$retour.="\t".$jsCallback."\n";
164 164
 		return $retour;
165 165
 	}
166 166
 
167 167
 	protected function _getResponseElement($responseElement) {
168 168
 		if (JString::isNotNull($responseElement)) {
169
-			$responseElement = Javascript::prep_jquery_selector($responseElement);
169
+			$responseElement=Javascript::prep_jquery_selector($responseElement);
170 170
 		}
171 171
 		return $responseElement;
172 172
 	}
173 173
 
174 174
 	protected function _correctAjaxUrl($url) {
175
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
176
-			$url = substr($url, 0, strlen($url) - 1);
177
-		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
178
-			$url = $this->getUrl($url);
175
+		if ($url!=="/" && JString::endsWith($url, "/")===true)
176
+			$url=substr($url, 0, strlen($url)-1);
177
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
178
+			$url=$this->getUrl($url);
179 179
 		}
180 180
 		return $url;
181 181
 	}
182 182
 
183
-	public static function _correctParams($params, $ajaxParameters = []) {
183
+	public static function _correctParams($params, $ajaxParameters=[]) {
184 184
 		if (JString::isNull($params)) {
185 185
 			return "";
186 186
 		}
187 187
 		if (\preg_match("@^\{.*?\}$@", $params)) {
188
-			if (! isset($ajaxParameters['contentType']) || ! JString::contains($ajaxParameters['contentType'], 'json')) {
189
-				return '$.param(' . $params . ')';
188
+			if (!isset($ajaxParameters['contentType']) || !JString::contains($ajaxParameters['contentType'], 'json')) {
189
+				return '$.param('.$params.')';
190 190
 			} else {
191
-				return 'JSON.stringify(' . $params . ')';
191
+				return 'JSON.stringify('.$params.')';
192 192
 			}
193 193
 		}
194 194
 		return $params;
195 195
 	}
196 196
 
197 197
 	public static function _implodeParams($parameters) {
198
-		$allParameters = [];
198
+		$allParameters=[];
199 199
 		foreach ($parameters as $params) {
200 200
 			if (isset($params))
201
-				$allParameters[] = self::_correctParams($params);
201
+				$allParameters[]=self::_correctParams($params);
202 202
 		}
203 203
 		return \implode("+'&'+", $allParameters);
204 204
 	}
205 205
 
206
-	protected function addLoading(&$retour, $responseElement, $ajaxLoader = null) {
207
-		if (! isset($ajaxLoader)) {
208
-			$ajaxLoader = $this->ajaxLoader;
206
+	protected function addLoading(&$retour, $responseElement, $ajaxLoader=null) {
207
+		if (!isset($ajaxLoader)) {
208
+			$ajaxLoader=$this->ajaxLoader;
209 209
 		}
210
-		$loading_notifier = '<div class="ajax-loader ui active inverted dimmer">' . $ajaxLoader . '</div>';
211
-		$retour .= "\t\t{$responseElement}.append('{$loading_notifier}');\n";
210
+		$loading_notifier='<div class="ajax-loader ui active inverted dimmer">'.$ajaxLoader.'</div>';
211
+		$retour.="\t\t{$responseElement}.append('{$loading_notifier}');\n";
212 212
 	}
213 213
 
214
-	protected function addResponseLoading(&$retour, $responseElement, $ajaxLoader = null) {
215
-		if (! isset($ajaxLoader)) {
216
-			$ajaxLoader = $this->ajaxLoader;
214
+	protected function addResponseLoading(&$retour, $responseElement, $ajaxLoader=null) {
215
+		if (!isset($ajaxLoader)) {
216
+			$ajaxLoader=$this->ajaxLoader;
217 217
 		}
218
-		$loading_notifier = '<div class="ajax-loader">' . $ajaxLoader . '</div>';
219
-		$retour .= "{$responseElement}.empty();\n";
220
-		$retour .= "\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
218
+		$loading_notifier='<div class="ajax-loader">'.$ajaxLoader.'</div>';
219
+		$retour.="{$responseElement}.empty();\n";
220
+		$retour.="\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
221 221
 	}
222 222
 
223 223
 	protected function setAjaxDataCall($params) {
224
-		$result = null;
225
-		if (! \is_callable($params)) {
226
-			$result = function ($responseElement, $jqueryDone = "html") use ($params) {
224
+		$result=null;
225
+		if (!\is_callable($params)) {
226
+			$result=function($responseElement, $jqueryDone="html") use ($params) {
227 227
 				return AjaxTransition::{$params}($responseElement, $jqueryDone);
228 228
 			};
229 229
 		}
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 
233 233
 	protected function setDefaultParameters(&$parameters, $default) {
234 234
 		foreach ($default as $k => $v) {
235
-			if (! isset($parameters[$k]))
236
-				$parameters[$k] = $v;
235
+			if (!isset($parameters[$k]))
236
+				$parameters[$k]=$v;
237 237
 		}
238 238
 	}
239 239
 
240 240
 	public function setAjaxLoader($loader) {
241
-		$this->ajaxLoader = $loader;
241
+		$this->ajaxLoader=$loader;
242 242
 	}
243 243
 
244 244
 	/**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * @param string $responseElement
250 250
 	 *        	selector of the HTML element displaying the answer
251 251
 	 */
252
-	private function _get($url, $responseElement = "", $parameters = []) {
252
+	private function _get($url, $responseElement="", $parameters=[]) {
253 253
 		return $this->_ajax("get", $url, $responseElement, $parameters);
254 254
 	}
255 255
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 * @param array $parameters
264 264
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
265 265
 	 */
266
-	public function get($url, $responseElement = "", $parameters = []) {
267
-		$parameters["immediatly"] = true;
266
+	public function get($url, $responseElement="", $parameters=[]) {
267
+		$parameters["immediatly"]=true;
268 268
 		return $this->_get($url, $responseElement, $parameters);
269 269
 	}
270 270
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 	 * @param array $parameters
281 281
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
282 282
 	 */
283
-	public function ajax($method, $url, $responseElement = "", $parameters = []) {
284
-		$parameters["immediatly"] = true;
283
+	public function ajax($method, $url, $responseElement="", $parameters=[]) {
284
+		$parameters["immediatly"]=true;
285 285
 		return $this->_ajax($method, $url, $responseElement, $parameters);
286 286
 	}
287 287
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 *        	$immediatly
304 304
 	 * @return string
305 305
 	 */
306
-	public function ajaxInterval($method, $url, $interval, $globalName = null, $responseElement = "", $parameters = [], $immediatly = true) {
306
+	public function ajaxInterval($method, $url, $interval, $globalName=null, $responseElement="", $parameters=[], $immediatly=true) {
307 307
 		return $this->interval($this->ajaxDeferred($method, $url, $responseElement, $parameters), $interval, $globalName, $immediatly);
308 308
 	}
309 309
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @param array $parameters
320 320
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
321 321
 	 */
322
-	public function ajaxDeferred($method, $url, $responseElement = "", $parameters = []) {
323
-		$parameters["immediatly"] = false;
322
+	public function ajaxDeferred($method, $url, $responseElement="", $parameters=[]) {
323
+		$parameters["immediatly"]=false;
324 324
 		return $this->_ajax($method, $url, $responseElement, $parameters);
325 325
 	}
326 326
 
@@ -334,15 +334,15 @@  discard block
 block discarded – undo
334 334
 	 * @param array $parameters
335 335
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
336 336
 	 */
337
-	private function _json($url, $method = "get", $parameters = []) {
338
-		$parameters = \array_merge($parameters, [
337
+	private function _json($url, $method="get", $parameters=[]) {
338
+		$parameters=\array_merge($parameters, [
339 339
 			"hasLoader" => false
340 340
 		]);
341
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
342
-		$context = isset($parameters['context']) ? $parameters['context'] : "document";
343
-		$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";
344
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
345
-		$parameters["jsCallback"] = $retour;
341
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
342
+		$context=isset($parameters['context']) ? $parameters['context'] : "document";
343
+		$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";
344
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
345
+		$parameters["jsCallback"]=$retour;
346 346
 		return $this->_ajax($method, $url, null, $parameters);
347 347
 	}
348 348
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 * @param array $parameters
357 357
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
358 358
 	 */
359
-	public function json($url, $method = "get", $parameters = []) {
359
+	public function json($url, $method="get", $parameters=[]) {
360 360
 		return $this->_json($url, $method, $parameters);
361 361
 	}
362 362
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @param array $parameters
373 373
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true,"before"=>null)
374 374
 	 */
375
-	public function jsonOn($event, $element, $url, $method = "get", $parameters = array()) {
375
+	public function jsonOn($event, $element, $url, $method="get", $parameters=array()) {
376 376
 		$this->setDefaultParameters($parameters, [
377 377
 			"preventDefault" => true,
378 378
 			"stopPropagation" => true,
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 	 * @param array $parameters
392 392
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
393 393
 	 */
394
-	public function jsonDeferred($url, $method = "get", $parameters = []) {
395
-		$parameters["immediatly"] = false;
394
+	public function jsonDeferred($url, $method="get", $parameters=[]) {
395
+		$parameters["immediatly"]=false;
396 396
 		return $this->_json($url, $method, $parameters);
397 397
 	}
398 398
 
@@ -407,29 +407,29 @@  discard block
 block discarded – undo
407 407
 	 * @param array $parameters
408 408
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
409 409
 	 */
410
-	private function _jsonArray($maskSelector, $url, $method = "get", $parameters = []) {
411
-		$parameters = \array_merge($parameters, [
410
+	private function _jsonArray($maskSelector, $url, $method="get", $parameters=[]) {
411
+		$parameters=\array_merge($parameters, [
412 412
 			"hasLoader" => false
413 413
 		]);
414
-		$rowClass = isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
415
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
416
-		$context = isset($parameters['context']) ? $parameters['context'] : null;
417
-		if ($context === null) {
418
-			$parent = "$('" . $maskSelector . "').parent()";
419
-			$newElm = "$('#'+newId)";
414
+		$rowClass=isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
415
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
416
+		$context=isset($parameters['context']) ? $parameters['context'] : null;
417
+		if ($context===null) {
418
+			$parent="$('".$maskSelector."').parent()";
419
+			$newElm="$('#'+newId)";
420 420
 		} else {
421
-			$parent = $context;
422
-			$newElm = $context . ".find('#'+newId)";
421
+			$parent=$context;
422
+			$newElm=$context.".find('#'+newId)";
423 423
 		}
424
-		$appendTo = "\t\tnewElm.appendTo(" . $parent . ");\n";
425
-		$retour = $parent . ".find('.{$rowClass}').remove();";
426
-		$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();
424
+		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
425
+		$retour=$parent.".find('.{$rowClass}').remove();";
426
+		$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();
427 427
 		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";
428
-		$retour .= $appendTo;
429
-		$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";
430
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
431
-		$retour .= "\t" . $jsCallback;
432
-		$parameters["jsCallback"] = $retour;
428
+		$retour.=$appendTo;
429
+		$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";
430
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
431
+		$retour.="\t".$jsCallback;
432
+		$parameters["jsCallback"]=$retour;
433 433
 		return $this->_ajax($method, $url, null, $parameters);
434 434
 	}
435 435
 
@@ -444,7 +444,7 @@  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
-	public function jsonArray($maskSelector, $url, $method = "get", $parameters = []) {
447
+	public function jsonArray($maskSelector, $url, $method="get", $parameters=[]) {
448 448
 		return $this->_jsonArray($maskSelector, $url, $method, $parameters);
449 449
 	}
450 450
 
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 	 * @param array $parameters
460 460
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"rowClass"=>"_json","before"=>null)
461 461
 	 */
462
-	public function jsonArrayDeferred($maskSelector, $url, $method = "get", $parameters) {
463
-		$parameters["immediatly"] = false;
462
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $parameters) {
463
+		$parameters["immediatly"]=false;
464 464
 		return $this->jsonArray($maskSelector, $url, $method, $parameters);
465 465
 	}
466 466
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	 * @param array $parameters
477 477
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true,"before"=>null)
478 478
 	 */
479
-	public function jsonArrayOn($event, $element, $maskSelector, $url, $method = "get", $parameters = array()) {
479
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $method="get", $parameters=array()) {
480 480
 		$this->setDefaultParameters($parameters, [
481 481
 			"preventDefault" => true,
482 482
 			"stopPropagation" => true,
@@ -496,8 +496,8 @@  discard block
 block discarded – undo
496 496
 	 * @param array $parameters
497 497
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
498 498
 	 */
499
-	public function getDeferred($url, $responseElement = "", $parameters = []) {
500
-		$parameters["immediatly"] = false;
499
+	public function getDeferred($url, $responseElement="", $parameters=[]) {
500
+		$parameters["immediatly"]=false;
501 501
 		return $this->_get($url, $responseElement, $parameters);
502 502
 	}
503 503
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @param array $parameters
517 517
 	 *        	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)
518 518
 	 */
519
-	public function getOn($event, $element, $url, $responseElement = "", $parameters = array()) {
519
+	public function getOn($event, $element, $url, $responseElement="", $parameters=array()) {
520 520
 		$this->setDefaultParameters($parameters, [
521 521
 			"preventDefault" => true,
522 522
 			"stopPropagation" => true,
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 * @param array $parameters
541 541
 	 *        	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)
542 542
 	 */
543
-	public function ajaxOn($event, $element, $url, $responseElement = "", $parameters = array()) {
543
+	public function ajaxOn($event, $element, $url, $responseElement="", $parameters=array()) {
544 544
 		$this->setDefaultParameters($parameters, [
545 545
 			"preventDefault" => true,
546 546
 			"stopPropagation" => true,
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @param array $parameters
564 564
 	 *        	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)
565 565
 	 */
566
-	public function ajaxOnClick($element, $url, $responseElement = "", $parameters = array()) {
566
+	public function ajaxOnClick($element, $url, $responseElement="", $parameters=array()) {
567 567
 		return $this->ajaxOn("click", $element, $url, $responseElement, $parameters);
568 568
 	}
569 569
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 * @param array $parameters
581 581
 	 *        	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)
582 582
 	 */
583
-	public function getOnClick($element, $url, $responseElement = "", $parameters = array()) {
583
+	public function getOnClick($element, $url, $responseElement="", $parameters=array()) {
584 584
 		return $this->getOn("click", $element, $url, $responseElement, $parameters);
585 585
 	}
586 586
 
@@ -595,15 +595,15 @@  discard block
 block discarded – undo
595 595
 	 *        	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)
596 596
 	 * @return $this
597 597
 	 */
598
-	public function getHref($element, $responseElement = "", $parameters = array()) {
599
-		$parameters["attr"] = "href";
598
+	public function getHref($element, $responseElement="", $parameters=array()) {
599
+		$parameters["attr"]="href";
600 600
 		if (JString::isNull($responseElement)) {
601
-			$responseElement = '%$(self).attr("data-target")%';
601
+			$responseElement='%$(self).attr("data-target")%';
602 602
 		} else {
603
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
603
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
604 604
 		}
605
-		if (! isset($parameters["historize"])) {
606
-			$parameters["historize"] = true;
605
+		if (!isset($parameters["historize"])) {
606
+			$parameters["historize"]=true;
607 607
 		}
608 608
 		return $this->getOnClick($element, "", $responseElement, $parameters);
609 609
 	}
@@ -619,21 +619,21 @@  discard block
 block discarded – undo
619 619
 	 *        	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)
620 620
 	 * @return $this
621 621
 	 */
622
-	public function postHref($element, $responseElement = "", $parameters = array()) {
623
-		$parameters["attr"] = "href";
622
+	public function postHref($element, $responseElement="", $parameters=array()) {
623
+		$parameters["attr"]="href";
624 624
 		if (JString::isNull($responseElement)) {
625
-			$responseElement = '%$(this).attr("data-target")%';
625
+			$responseElement='%$(this).attr("data-target")%';
626 626
 		} else {
627
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
627
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
628 628
 		}
629
-		if (! isset($parameters["historize"])) {
630
-			$parameters["historize"] = true;
629
+		if (!isset($parameters["historize"])) {
630
+			$parameters["historize"]=true;
631 631
 		}
632 632
 		return $this->postOnClick($element, "", "{}", $responseElement, $parameters);
633 633
 	}
634 634
 
635
-	private function _post($url, $params = "{}", $responseElement = "", $parameters = []) {
636
-		$parameters["params"] = $params;
635
+	private function _post($url, $params="{}", $responseElement="", $parameters=[]) {
636
+		$parameters["params"]=$params;
637 637
 		return $this->_ajax("POST", $url, $responseElement, $parameters);
638 638
 	}
639 639
 
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
 	 * @param array $parameters
650 650
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
651 651
 	 */
652
-	public function post($url, $params = "{}", $responseElement = "", $parameters = []) {
653
-		$parameters['immediatly'] = true;
652
+	public function post($url, $params="{}", $responseElement="", $parameters=[]) {
653
+		$parameters['immediatly']=true;
654 654
 		return $this->_post($url, $params, $responseElement, $parameters);
655 655
 	}
656 656
 
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	 * @param array $parameters
668 668
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
669 669
 	 */
670
-	public function postDeferred($url, $params = "{}", $responseElement = "", $parameters = []) {
671
-		$parameters["immediatly"] = false;
670
+	public function postDeferred($url, $params="{}", $responseElement="", $parameters=[]) {
671
+		$parameters["immediatly"]=false;
672 672
 		return $this->_post($url, $params, $responseElement, $parameters);
673 673
 	}
674 674
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	 * @param array $parameters
688 688
 	 *        	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)
689 689
 	 */
690
-	public function postOn($event, $element, $url, $params = "{}", $responseElement = "", $parameters = array()) {
690
+	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
691 691
 		$this->setDefaultParameters($parameters, [
692 692
 			"preventDefault" => true,
693 693
 			"stopPropagation" => true,
@@ -710,66 +710,66 @@  discard block
 block discarded – undo
710 710
 	 * @param array $parameters
711 711
 	 *        	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)
712 712
 	 */
713
-	public function postOnClick($element, $url, $params = "{}", $responseElement = "", $parameters = array()) {
713
+	public function postOnClick($element, $url, $params="{}", $responseElement="", $parameters=array()) {
714 714
 		return $this->postOn("click", $element, $url, $params, $responseElement, $parameters);
715 715
 	}
716 716
 
717
-	private function _postForm($url, $form, $responseElement, $parameters = []) {
717
+	private function _postForm($url, $form, $responseElement, $parameters=[]) {
718 718
 		if (isset($this->params["ajax"])) {
719 719
 			extract($this->params["ajax"]);
720 720
 		}
721
-		$params = "{}";
722
-		$validation = false;
721
+		$params="{}";
722
+		$validation=false;
723 723
 		\extract($parameters);
724
-		$async = ($async) ? "true" : "false";
725
-		$jsCallback = isset($jsCallback) ? $jsCallback : "";
726
-		$retour = $this->_getAjaxUrl($url, $attr);
727
-		$retour .= "\n$('#" . $form . "').trigger('ajaxSubmit');";
728
-		if (! isset($contentType) || $contentType != 'false') {
729
-			$retour .= "\nvar params=$('#" . $form . "').serialize();\n";
724
+		$async=($async) ? "true" : "false";
725
+		$jsCallback=isset($jsCallback) ? $jsCallback : "";
726
+		$retour=$this->_getAjaxUrl($url, $attr);
727
+		$retour.="\n$('#".$form."').trigger('ajaxSubmit');";
728
+		if (!isset($contentType) || $contentType!='false') {
729
+			$retour.="\nvar params=$('#".$form."').serialize();\n";
730 730
 			if (isset($params)) {
731
-				$retour .= "params+='&'+" . self::_correctParams($params) . ";\n";
731
+				$retour.="params+='&'+".self::_correctParams($params).";\n";
732 732
 			}
733 733
 		} else {
734
-			$retour .= "\nvar params=new FormData($('#" . $form . "')[0]);\n";
734
+			$retour.="\nvar params=new FormData($('#".$form."')[0]);\n";
735 735
 		}
736
-		$responseElement = $this->_getResponseElement($responseElement);
737
-		$retour .= "var self=this;\n";
738
-		$before = isset($before) ? $before : "";
739
-		$retour .= $before;
740
-		if ($hasLoader === true) {
736
+		$responseElement=$this->_getResponseElement($responseElement);
737
+		$retour.="var self=this;\n";
738
+		$before=isset($before) ? $before : "";
739
+		$retour.=$before;
740
+		if ($hasLoader===true) {
741 741
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
742
-		} elseif ($hasLoader === 'response') {
742
+		} elseif ($hasLoader==='response') {
743 743
 			$this->addResponseLoading($retour, $responseElement, $ajaxLoader);
744
-		} elseif ($hasLoader === 'internal') {
745
-			$retour .= "\n$(this).addClass('loading');";
744
+		} elseif ($hasLoader==='internal') {
745
+			$retour.="\n$(this).addClass('loading');";
746 746
 		}
747
-		$ajaxParameters = [
747
+		$ajaxParameters=[
748 748
 			"url" => "url",
749 749
 			"method" => "'POST'",
750 750
 			"data" => "params",
751 751
 			"async" => $async
752 752
 		];
753 753
 		if (isset($headers)) {
754
-			$ajaxParameters["headers"] = $headers;
754
+			$ajaxParameters["headers"]=$headers;
755 755
 		}
756 756
 		if (isset($partial)) {
757
-			$ajaxParameters["xhr"] = "xhrProvider";
758
-			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
757
+			$ajaxParameters["xhr"]="xhrProvider";
758
+			$retour.="var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
759 759
 		}
760 760
 		$this->createAjaxParameters($ajaxParameters, $parameters);
761
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data ) {\n";
762
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader) . "});\n";
761
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data ) {\n";
762
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader)."});\n";
763 763
 
764 764
 		if ($validation) {
765
-			$retour = "$('#" . $form . "').validate({submitHandler: function(form) {
766
-			" . $retour . "
765
+			$retour="$('#".$form."').validate({submitHandler: function(form) {
766
+			" . $retour."
767 767
 			}});\n";
768
-			$retour .= "$('#" . $form . "').submit();\n";
768
+			$retour.="$('#".$form."').submit();\n";
769 769
 		}
770
-		$retour = $this->_addJsCondition($jsCondition, $retour);
770
+		$retour=$this->_addJsCondition($jsCondition, $retour);
771 771
 		if ($immediatly)
772
-			$this->jquery_code_for_compile[] = $retour;
772
+			$this->jquery_code_for_compile[]=$retour;
773 773
 		return $retour;
774 774
 	}
775 775
 
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
 	 * @param array $parameters
786 786
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
787 787
 	 */
788
-	public function postForm($url, $form, $responseElement, $parameters = []) {
789
-		$parameters["immediatly"] = true;
788
+	public function postForm($url, $form, $responseElement, $parameters=[]) {
789
+		$parameters["immediatly"]=true;
790 790
 		return $this->_postForm($url, $form, $responseElement, $parameters);
791 791
 	}
792 792
 
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	 * @param array $parameters
804 804
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
805 805
 	 */
806
-	public function postFormDeferred($url, $form, $responseElement, $parameters = []) {
807
-		$parameters["immediatly"] = false;
806
+	public function postFormDeferred($url, $form, $responseElement, $parameters=[]) {
807
+		$parameters["immediatly"]=false;
808 808
 		return $this->_postForm($url, $form, $responseElement, $parameters);
809 809
 	}
810 810
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	 * @param array $parameters
822 822
 	 *        	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)
823 823
 	 */
824
-	public function postFormOn($event, $element, $url, $form, $responseElement = "", $parameters = array()) {
824
+	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
825 825
 		$this->setDefaultParameters($parameters, [
826 826
 			"preventDefault" => true,
827 827
 			"stopPropagation" => true,
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 	 * @param array $parameters
843 843
 	 *        	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)
844 844
 	 */
845
-	public function postFormOnClick($element, $url, $form, $responseElement = "", $parameters = array()) {
845
+	public function postFormOnClick($element, $url, $form, $responseElement="", $parameters=array()) {
846 846
 		return $this->postFormOn("click", $element, $url, $form, $responseElement, $parameters);
847 847
 	}
848 848
 }
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,50 +10,50 @@  discard block
 block discarded – undo
10 10
 	private $parameters;
11 11
 
12 12
 	public function __construct($method, $parameters) {
13
-		$this->method = $method;
14
-		$this->parameters = $parameters;
13
+		$this->method=$method;
14
+		$this->parameters=$parameters;
15 15
 	}
16 16
 
17
-	public function compile(JsUtils $js = null) {
18
-		if ($js === null)
17
+	public function compile(JsUtils $js=null) {
18
+		if ($js===null)
19 19
 			return;
20
-		$params = "{}";
21
-		$stopPropagation = true;
22
-		$preventDefault = true;
23
-		$method = "get";
24
-		$this->parameters["immediatly"] = false;
20
+		$params="{}";
21
+		$stopPropagation=true;
22
+		$preventDefault=true;
23
+		$method="get";
24
+		$this->parameters["immediatly"]=false;
25 25
 		extract($this->parameters);
26
-		$result = $this->_eventPreparing($preventDefault, $stopPropagation);
26
+		$result=$this->_eventPreparing($preventDefault, $stopPropagation);
27 27
 		switch ($this->method) {
28 28
 			case "get":
29
-				$result .= $js->getDeferred($url, $responseElement, $this->parameters);
29
+				$result.=$js->getDeferred($url, $responseElement, $this->parameters);
30 30
 				break;
31 31
 			case "post":
32
-				$result .= $js->postDeferred($url, $params, $responseElement, $this->parameters);
32
+				$result.=$js->postDeferred($url, $params, $responseElement, $this->parameters);
33 33
 				break;
34 34
 			case "postForm":
35
-				$result .= $js->postFormDeferred($url, $form, $responseElement, $this->parameters);
35
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters);
36 36
 				break;
37 37
 			case "json":
38
-				$result .= $js->jsonDeferred($url, $method, $this->parameters);
38
+				$result.=$js->jsonDeferred($url, $method, $this->parameters);
39 39
 				break;
40 40
 			case "jsonArray":
41
-				$result .= $js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters);
41
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters);
42 42
 				break;
43 43
 			default:
44
-				$result .= $js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters);
44
+				$result.=$js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters);
45 45
 				break;
46 46
 		}
47 47
 		return $result;
48 48
 	}
49 49
 
50 50
 	protected function _eventPreparing($preventDefault, $stopPropagation) {
51
-		$result = "";
52
-		if ($preventDefault === true) {
53
-			$result .= Javascript::$preventDefault;
51
+		$result="";
52
+		if ($preventDefault===true) {
53
+			$result.=Javascript::$preventDefault;
54 54
 		}
55
-		if ($stopPropagation === true) {
56
-			$result .= Javascript::$stopPropagation;
55
+		if ($stopPropagation===true) {
56
+			$result.=Javascript::$stopPropagation;
57 57
 		}
58 58
 		return $result;
59 59
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	public function setMethod($method) {
66
-		$this->method = $method;
66
+		$this->method=$method;
67 67
 		return $this;
68 68
 	}
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	public function setParameters($parameters) {
75
-		$this->parameters = $parameters;
75
+		$this->parameters=$parameters;
76 76
 		return $this;
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.