Passed
Push — master ( 187fb8...8fc168 )
by Jean-Christophe
02:17
created
Ajax/service/Javascript.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -3,36 +3,36 @@  discard block
 block discarded – undo
3 3
 
4 4
 class Javascript {
5 5
 
6
-	public static $preventDefault = "\nif(event && event.preventDefault) event.preventDefault();\n";
6
+	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 
8
-	public static $stopPropagation = "\nif(event && event.stopPropagation) event.stopPropagation();\n";
8
+	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
9 9
 
10
-	public static function draggable($attr = "id") {
11
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("' . $attr . '")}));';
10
+	public static function draggable($attr="id") {
11
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("'.$attr.'")}));';
12 12
 	}
13 13
 
14
-	public static function dropZone($jqueryDone, $jsCallback = "") {
15
-		$done = ($jqueryDone != null) ? '$(event.target).' . $jqueryDone . '($("#"+_data.id));' : '';
16
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));' . $done . 'var data=_data.data;' . $jsCallback;
14
+	public static function dropZone($jqueryDone, $jsCallback="") {
15
+		$done=($jqueryDone!=null) ? '$(event.target).'.$jqueryDone.'($("#"+_data.id));' : '';
16
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));'.$done.'var data=_data.data;'.$jsCallback;
17 17
 	}
18 18
 
19
-	public static function fileDropZone($jsCallback = "") {
20
-		$done = 'event.target.upload=formData;$(event.target).trigger("upload");';
21
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var files=dt.files;var formData = new FormData();for (var i = 0; i < files.length; i++) {formData.append("file-"+i,files[i]);}' . $done . $jsCallback;
19
+	public static function fileDropZone($jsCallback="") {
20
+		$done='event.target.upload=formData;$(event.target).trigger("upload");';
21
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var files=dt.files;var formData = new FormData();for (var i = 0; i < files.length; i++) {formData.append("file-"+i,files[i]);}'.$done.$jsCallback;
22 22
 	}
23 23
 
24 24
 	public static function containsCode($expression) {
25
-		if ($expression == null) {
25
+		if ($expression==null) {
26 26
 			return false;
27 27
 		}
28
-		return \strrpos($expression, 'this') !== false || \strrpos($expression, 'event') !== false || \strrpos($expression, 'self') !== false;
28
+		return \strrpos($expression, 'this')!==false || \strrpos($expression, 'event')!==false || \strrpos($expression, 'self')!==false;
29 29
 	}
30 30
 
31 31
 	public static function isFunction($jsCode) {
32 32
 		return JString::startswith($jsCode, "function");
33 33
 	}
34 34
 
35
-	public static function fileUploadBehavior($id = '') {
35
+	public static function fileUploadBehavior($id='') {
36 36
 		return "$('input:text, .ui.button', '#{$id}').on('click', function (e) {e.preventDefault();\$('input:file', '#{$id}').click();});
37 37
 				$('input:file', '#{$id}').on('change', function (e) {if(e.target.files.length){var name = e.target.files[0].name;$('input:text', $(e.target).parent()).val(name);}});";
38 38
 	}
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 * @return string
47 47
 	 */
48 48
 	public static function prep_element($element) {
49
-		if (self::containsCode($element) === false) {
50
-			$element = '"' . addslashes($element ?? '') . '"';
49
+		if (self::containsCode($element)===false) {
50
+			$element='"'.addslashes($element ?? '').'"';
51 51
 		}
52 52
 		return $element;
53 53
 	}
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public static function prep_value($value) {
64 64
 		if (\is_array($value)) {
65
-			$value = implode(",", $value);
65
+			$value=implode(",", $value);
66 66
 		}
67
-		if (self::containsCode($value) === false) {
68
-			$value = \str_replace([
67
+		if (self::containsCode($value)===false) {
68
+			$value=\str_replace([
69 69
 				"\\",
70 70
 				"\""
71 71
 			], [
72 72
 				"\\\\",
73 73
 				"\\\""
74 74
 			], $value);
75
-			$value = '"' . $value . '"';
75
+			$value='"'.$value.'"';
76 76
 		}
77 77
 		return trim($value, "%");
78 78
 	}
79 79
 
80 80
 	public static function prep_jquery_selector($value) {
81
-		if (JString::startswith($value, '$(') === false) {
82
-			return '$(' . self::prep_value($value) . ')';
81
+		if (JString::startswith($value, '$(')===false) {
82
+			return '$('.self::prep_value($value).')';
83 83
 		}
84 84
 		return $value;
85 85
 	}
Please login to merge, or discard this patch.
Ajax/common/Widget.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\common\html\traits\BaseHooksTrait;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait,BaseHooksTrait;
23
+	use FieldAsTrait, FormTrait, BaseHooksTrait;
24 24
 
25 25
 	/**
26 26
 	 *
@@ -66,27 +66,27 @@  discard block
 block discarded – undo
66 66
 
67 67
 	protected $_hasRules;
68 68
 
69
-	public function __construct($identifier, $model, $modelInstance = NULL) {
69
+	public function __construct($identifier, $model, $modelInstance=NULL) {
70 70
 		parent::__construct($identifier);
71
-		$this->_template = "%wrapContentBefore%%content%%wrapContentAfter%";
71
+		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
72 72
 		$this->setModel($model);
73 73
 		if (isset($modelInstance)) {
74 74
 			if (\is_object($modelInstance)) {
75
-				$this->_model = \get_class($modelInstance);
75
+				$this->_model=\get_class($modelInstance);
76 76
 			}
77 77
 			$this->show($modelInstance);
78 78
 		}
79
-		$this->_generated = false;
79
+		$this->_generated=false;
80 80
 	}
81 81
 
82 82
 	protected function _init($instanceViewer, $contentKey, $content, $edition) {
83
-		$this->_instanceViewer = $instanceViewer;
84
-		$this->content = [
83
+		$this->_instanceViewer=$instanceViewer;
84
+		$this->content=[
85 85
 			$contentKey => $content
86 86
 		];
87
-		$this->_self = $content;
88
-		$this->_toolbarPosition = PositionInTable::BEFORETABLE;
89
-		$this->_edition = $edition;
87
+		$this->_self=$content;
88
+		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
89
+		$this->_edition=$edition;
90 90
 	}
91 91
 
92 92
 	/**
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 * @return int|string|boolean
96 96
 	 */
97 97
 	protected function _getIndex($fieldName) {
98
-		$index = $fieldName;
98
+		$index=$fieldName;
99 99
 		if (\is_string($fieldName)) {
100
-			$fields = $this->_instanceViewer->getVisibleProperties();
101
-			$index = \array_search($fieldName, $fields);
100
+			$fields=$this->_instanceViewer->getVisibleProperties();
101
+			$index=\array_search($fieldName, $fields);
102 102
 		}
103 103
 		return $index;
104 104
 	}
105 105
 
106
-	protected function _getFieldIdentifier($prefix, $name = "") {
107
-		return $this->identifier . "-{$prefix}-" . $this->_instanceViewer->getIdentifier();
106
+	protected function _getFieldIdentifier($prefix, $name="") {
107
+		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
108 108
 	}
109 109
 
110 110
 	protected function _getFieldName($index) {
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 		return $this->_instanceViewer->getCaption($index);
116 116
 	}
117 117
 
118
-	abstract protected function _setToolbarPosition($table, $captions = NULL);
118
+	abstract protected function _setToolbarPosition($table, $captions=NULL);
119 119
 
120 120
 	public function show($modelInstance) {
121 121
 		if (\is_array($modelInstance)) {
122
-			$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
122
+			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
123 123
 		}
124
-		$this->_modelInstance = $modelInstance;
124
+		$this->_modelInstance=$modelInstance;
125 125
 	}
126 126
 
127 127
 	public function getModel() {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	public function setModel($_model) {
132
-		$this->_model = $_model;
132
+		$this->_model=$_model;
133 133
 		return $this;
134 134
 	}
135 135
 
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 	}
139 139
 
140 140
 	public function setInstanceViewer($_instanceViewer) {
141
-		$this->_instanceViewer = $_instanceViewer;
141
+		$this->_instanceViewer=$_instanceViewer;
142 142
 		return $this;
143 143
 	}
144 144
 
145 145
 	abstract public function getHtmlComponent();
146 146
 
147
-	public function setAttached($value = true) {
147
+	public function setAttached($value=true) {
148 148
 		return $this->getHtmlComponent()->setAttached($value);
149 149
 	}
150 150
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @return Widget
160 160
 	 */
161 161
 	public function afterCompile($index, $callback) {
162
-		$index = $this->_getIndex($index);
163
-		if ($index !== false) {
162
+		$index=$this->_getIndex($index);
163
+		if ($index!==false) {
164 164
 			$this->_instanceViewer->afterCompile($index, $callback);
165 165
 		}
166 166
 		return $this;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		return $this;
186 186
 	}
187 187
 
188
-	public function addField($field, $key = null) {
188
+	public function addField($field, $key=null) {
189 189
 		$this->_instanceViewer->addField($field, $key);
190 190
 		return $this;
191 191
 	}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 		return $this->_instanceViewer->visiblePropertiesCount();
200 200
 	}
201 201
 
202
-	public function addMessage($attributes = NULL, $fieldName = "message") {
202
+	public function addMessage($attributes=NULL, $fieldName="message") {
203 203
 		$this->_instanceViewer->addField($fieldName);
204
-		$count = $this->_instanceViewer->visiblePropertiesCount();
205
-		return $this->fieldAsMessage($count - 1, $attributes);
204
+		$count=$this->_instanceViewer->visiblePropertiesCount();
205
+		return $this->fieldAsMessage($count-1, $attributes);
206 206
 	}
207 207
 
208 208
 	public function addErrorMessage() {
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
 		], "message");
212 212
 	}
213 213
 
214
-	public function insertField($index, $field, $key = null) {
215
-		$index = $this->_getIndex($index);
214
+	public function insertField($index, $field, $key=null) {
215
+		$index=$this->_getIndex($index);
216 216
 		$this->_instanceViewer->insertField($index, $field, $key);
217 217
 		return $this;
218 218
 	}
219 219
 
220
-	public function insertInField($index, $field, $key = null) {
221
-		$index = $this->_getIndex($index);
222
-		if ($index !== false) {
220
+	public function insertInField($index, $field, $key=null) {
221
+		$index=$this->_getIndex($index);
222
+		if ($index!==false) {
223 223
 			$this->_instanceViewer->insertInField($index, $field, $key);
224 224
 		}
225 225
 		return $this;
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @return Widget
236 236
 	 */
237 237
 	public function setValueFunction($index, $callback) {
238
-		$index = $this->_getIndex($index);
239
-		if ($index !== false) {
238
+		$index=$this->_getIndex($index);
239
+		if ($index!==false) {
240 240
 			$this->_instanceViewer->setValueFunction($index, $callback);
241 241
 		}
242 242
 		return $this;
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
253 253
 	 */
254 254
 	public function getToolbar() {
255
-		if (isset($this->_toolbar) === false) {
256
-			$this->_toolbar = new HtmlMenu("toolbar-" . $this->identifier);
255
+		if (isset($this->_toolbar)===false) {
256
+			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
257 257
 		}
258 258
 		return $this->_toolbar;
259 259
 	}
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	 *        	function to call on $element
267 267
 	 * @return \Ajax\common\html\HtmlDoubleElement
268 268
 	 */
269
-	public function addInToolbar($element, $callback = NULL) {
270
-		$tb = $this->getToolbar();
269
+	public function addInToolbar($element, $callback=NULL) {
270
+		$tb=$this->getToolbar();
271 271
 		if ($element instanceof BaseWidget) {
272
-			if ($element->getIdentifier() === "") {
273
-				$element->setIdentifier("tb-item-" . $this->identifier . "-" . $tb->count());
272
+			if ($element->getIdentifier()==="") {
273
+				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
274 274
 			}
275 275
 		}
276 276
 		if (isset($callback)) {
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 *        	function($element)
290 290
 	 * @return \Ajax\common\html\HtmlDoubleElement
291 291
 	 */
292
-	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
293
-		$result = $this->addInToolbar($caption, $callback);
292
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
293
+		$result=$this->addInToolbar($caption, $callback);
294 294
 		if (isset($icon) && method_exists($result, "addIcon"))
295 295
 			$result->addIcon($icon);
296 296
 		return $result;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 *        	function($element)
304 304
 	 * @return \Ajax\common\Widget
305 305
 	 */
306
-	public function addItemsInToolbar(array $items, $callback = NULL) {
306
+	public function addItemsInToolbar(array $items, $callback=NULL) {
307 307
 		if (JArray::isAssociative($items)) {
308 308
 			foreach ($items as $icon => $item) {
309 309
 				$this->addItemInToolbar($item, $icon, $callback);
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 *        	function($element)
325 325
 	 * @return \Ajax\common\html\HtmlDoubleElement
326 326
 	 */
327
-	public function addDropdownInToolbar($value, $items, $callback = NULL) {
328
-		$dd = $value;
327
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
328
+		$dd=$value;
329 329
 		if (\is_string($value)) {
330
-			$dd = new HtmlDropdown("dropdown-" . $this->identifier . "-" . $value, $value, $items);
330
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
331 331
 		}
332 332
 		return $this->addInToolbar($dd, $callback);
333 333
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 *        	function($element)
341 341
 	 * @return \Ajax\common\html\HtmlDoubleElement
342 342
 	 */
343
-	public function addButtonInToolbar($caption, $cssStyle = null, $callback = NULL) {
344
-		$bt = new HtmlButton("bt-" . $caption, $caption, $cssStyle);
343
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
344
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
345 345
 		return $this->addInToolbar($bt, $callback);
346 346
 	}
347 347
 
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 *        	function($element)
354 354
 	 * @return \Ajax\common\html\HtmlDoubleElement
355 355
 	 */
356
-	public function addButtonsInToolbar(array $captions, $asIcon = false, $callback = NULL) {
357
-		$bts = new HtmlButtonGroups("", $captions, $asIcon);
356
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
357
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
358 358
 		return $this->addInToolbar($bts, $callback);
359 359
 	}
360 360
 
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 	 * @param boolean $labeled
367 367
 	 * @return \Ajax\common\html\HtmlDoubleElement
368 368
 	 */
369
-	public function addLabelledIconButtonInToolbar($caption, $icon, $before = true, $labeled = false) {
370
-		$bt = new HtmlButton("", $caption);
369
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
370
+		$bt=new HtmlButton("", $caption);
371 371
 		$bt->addIcon($icon, $before, $labeled);
372 372
 		return $this->addInToolbar($bt);
373 373
 	}
374 374
 
375
-	public function addSubmitInToolbar($identifier, $value, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $parameters = NULL) {
376
-		$button = new HtmlButton($identifier, $value, $cssStyle);
375
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
376
+		$button=new HtmlButton($identifier, $value, $cssStyle);
377 377
 		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
378 378
 		return $this->addInToolbar($button);
379 379
 	}
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	 * @param boolean $_edition
397 397
 	 * @return \Ajax\common\Widget
398 398
 	 */
399
-	public function setEdition($_edition = true) {
400
-		$this->_edition = $_edition;
399
+	public function setEdition($_edition=true) {
400
+		$this->_edition=$_edition;
401 401
 		return $this;
402 402
 	}
403 403
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @param string|boolean $disable
427 427
 	 * @return string
428 428
 	 */
429
-	public function jsDisabled($disable = true) {
430
-		return "$('#" . $this->identifier . " .ui.input,#" . $this->identifier . " .ui.dropdown,#" . $this->identifier . " .ui.checkbox').toggleClass('disabled'," . $disable . ");";
429
+	public function jsDisabled($disable=true) {
430
+		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
431 431
 	}
432 432
 
433 433
 	/**
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 	 *        	function($element)
438 438
 	 * @return \Ajax\common\html\HtmlDoubleElement
439 439
 	 */
440
-	public function addEditButtonInToolbar($caption, $callback = NULL) {
441
-		$bt = new HtmlButton($this->identifier . "-editBtn", $caption);
440
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
441
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
442 442
 		$bt->setToggle();
443 443
 		$bt->setActive($this->_edition);
444 444
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 	}
447 447
 
448 448
 	public function setToolbar(HtmlMenu $_toolbar) {
449
-		$this->_toolbar = $_toolbar;
449
+		$this->_toolbar=$_toolbar;
450 450
 		return $this;
451 451
 	}
452 452
 
453 453
 	public function setToolbarPosition($_toolbarPosition) {
454
-		$this->_toolbarPosition = $_toolbarPosition;
454
+		$this->_toolbarPosition=$_toolbarPosition;
455 455
 		return $this;
456 456
 	}
457 457
 
458 458
 	public function getForm() {
459
-		if (! isset($this->_form)) {
460
-			$this->_form = new HtmlForm("frm-" . $this->identifier);
459
+		if (!isset($this->_form)) {
460
+			$this->_form=new HtmlForm("frm-".$this->identifier);
461 461
 			$this->setEdition(true);
462 462
 		}
463 463
 		return $this->_form;
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	}
472 472
 
473 473
 	protected function runForm(JsUtils $js) {
474
-		$fields = $this->getContentInstances(HtmlFormField::class);
474
+		$fields=$this->getContentInstances(HtmlFormField::class);
475 475
 		foreach ($fields as $field) {
476 476
 			$this->_form->addField($field);
477 477
 		}
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 
481 481
 	protected function _compileForm() {
482 482
 		if (isset($this->_form)) {
483
-			$noValidate = "";
484
-			if (\sizeof($this->_form->getValidationParams()) > 0)
485
-				$noValidate = "novalidate";
486
-			$this->wrapContent("<form class='" . $this->_form->getProperty('class') . "' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
483
+			$noValidate="";
484
+			if (\sizeof($this->_form->getValidationParams())>0)
485
+				$noValidate="novalidate";
486
+			$this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
487 487
 		}
488 488
 	}
489 489
 
@@ -505,21 +505,21 @@  discard block
 block discarded – undo
505 505
 	}
506 506
 
507 507
 	public function swapFields($index1, $index2) {
508
-		$index1 = $this->_getIndex($index1);
509
-		$index2 = $this->_getIndex($index2);
508
+		$index1=$this->_getIndex($index1);
509
+		$index2=$this->_getIndex($index2);
510 510
 		return $this->_instanceViewer->swapFields($index1, $index2);
511 511
 	}
512 512
 
513 513
 	public function removeField($index) {
514
-		$index = $this->_getIndex($index);
515
-		if ($index !== false) {
514
+		$index=$this->_getIndex($index);
515
+		if ($index!==false) {
516 516
 			$this->_instanceViewer->removeField($index);
517 517
 		}
518 518
 		return $this;
519 519
 	}
520 520
 
521
-	public function asModal($header = null) {
522
-		$modal = new HtmlModal("modal-" . $this->identifier, $header);
521
+	public function asModal($header=null) {
522
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
523 523
 		$modal->setContent($this);
524 524
 		if (isset($this->_form)) {
525 525
 			$this->_form->onSuccess($modal->jsHide());
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		return $modal;
528 528
 	}
529 529
 
530
-	public function addToProperty($name, $value, $separator = " ") {
530
+	public function addToProperty($name, $value, $separator=" ") {
531 531
 		return $this->getHtmlComponent()->addToProperty($name, $value, $separator);
532 532
 	}
533 533
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -291,8 +291,9 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
293 293
 		$result = $this->addInToolbar($caption, $callback);
294
-		if (isset($icon) && method_exists($result, "addIcon"))
295
-			$result->addIcon($icon);
294
+		if (isset($icon) && method_exists($result, "addIcon")) {
295
+					$result->addIcon($icon);
296
+		}
296 297
 		return $result;
297 298
 	}
298 299
 
@@ -481,8 +482,9 @@  discard block
 block discarded – undo
481 482
 	protected function _compileForm() {
482 483
 		if (isset($this->_form)) {
483 484
 			$noValidate = "";
484
-			if (\sizeof($this->_form->getValidationParams()) > 0)
485
-				$noValidate = "novalidate";
485
+			if (\sizeof($this->_form->getValidationParams()) > 0) {
486
+							$noValidate = "novalidate";
487
+			}
486 488
 			$this->wrapContent("<form class='" . $this->_form->getProperty('class') . "' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
487 489
 		}
488 490
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormField.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,38 +19,38 @@  discard block
 block discarded – undo
19 19
 
20 20
 	protected $_validation;
21 21
 
22
-	public function __construct($identifier, $field, $label = NULL) {
22
+	public function __construct($identifier, $field, $label=NULL) {
23 23
 		parent::__construct($identifier, "div", "field");
24
-		$this->content = array();
25
-		$this->_states = [
24
+		$this->content=array();
25
+		$this->_states=[
26 26
 			State::ERROR,
27 27
 			State::DISABLED
28 28
 		];
29
-		if (isset($label) && $label !== "")
29
+		if (isset($label) && $label!=="")
30 30
 			$this->setLabel($label);
31 31
 		$this->setField($field);
32
-		$this->_validation = NULL;
32
+		$this->_validation=NULL;
33 33
 	}
34 34
 
35
-	public function addPointingLabel($label, $pointing = Direction::NONE) {
36
-		$labelO = new HtmlLabel("", $label);
35
+	public function addPointingLabel($label, $pointing=Direction::NONE) {
36
+		$labelO=new HtmlLabel("", $label);
37 37
 		$labelO->setPointing($pointing);
38
-		$this->addContent($labelO, $pointing === "below" || $pointing === "right");
38
+		$this->addContent($labelO, $pointing==="below" || $pointing==="right");
39 39
 		return $labelO;
40 40
 	}
41 41
 
42 42
 	public function setLabel($label) {
43
-		$labelO = $label;
43
+		$labelO=$label;
44 44
 		if (\is_string($label)) {
45
-			$labelO = new HtmlSemDoubleElement("", "label", "");
45
+			$labelO=new HtmlSemDoubleElement("", "label", "");
46 46
 			$labelO->setContent($label);
47 47
 			$labelO->setProperty("for", \str_replace("field-", "", $this->identifier));
48 48
 		}
49
-		$this->content["label"] = $labelO;
49
+		$this->content["label"]=$labelO;
50 50
 	}
51 51
 
52 52
 	public function setField($field) {
53
-		$this->content["field"] = $field;
53
+		$this->content["field"]=$field;
54 54
 	}
55 55
 
56 56
 	/**
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 * puts the label before or behind
86 86
 	 */
87 87
 	public function swapLabel() {
88
-		$label = $this->getLabel();
88
+		$label=$this->getLabel();
89 89
 		unset($this->content["label"]);
90
-		$this->content["label"] = $label;
90
+		$this->content["label"]=$label;
91 91
 	}
92 92
 
93 93
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function setWidth($width) {
100 100
 		if (\is_int($width)) {
101
-			$width = Wide::getConstants()["W" . $width];
101
+			$width=Wide::getConstants()["W".$width];
102 102
 		}
103 103
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
104 104
 		if (isset($this->_container)) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	public function setContainer($_container) {
130
-		$this->_container = $_container;
130
+		$this->_container=$_container;
131 131
 		return $this;
132 132
 	}
133 133
 
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 		$this->getDataField()->setProperty("readonly", "");
136 136
 	}
137 137
 
138
-	public function addRule($type, $prompt = NULL, $value = NULL) {
139
-		$field = $this->getDataField();
138
+	public function addRule($type, $prompt=NULL, $value=NULL) {
139
+		$field=$this->getDataField();
140 140
 		if (isset($field)) {
141
-			if (! isset($this->_validation)) {
142
-				$this->_validation = new FieldValidation($field->getIdentifier());
141
+			if (!isset($this->_validation)) {
142
+				$this->_validation=new FieldValidation($field->getIdentifier());
143 143
 			}
144
-			if($type instanceof Rule){
145
-				if($type->getType()=='empty'){
144
+			if ($type instanceof Rule) {
145
+				if ($type->getType()=='empty') {
146 146
 					$this->addToProperty('class', 'required');
147 147
 				}
148
-			}elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
148
+			}elseif ($type==='empty' || ($type['type'] ?? '')==='empty') {
149 149
 				$this->addToProperty('class', 'required');
150 150
 			}
151 151
 			$this->_validation->addRule($type, $prompt, $value);
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function setOptional($optional = true) {
157
-		$field = $this->getDataField();
156
+	public function setOptional($optional=true) {
157
+		$field=$this->getDataField();
158 158
 		if (isset($field)) {
159
-			if (! isset($this->_validation)) {
160
-				$this->_validation = new FieldValidation($field->getIdentifier());
159
+			if (!isset($this->_validation)) {
160
+				$this->_validation=new FieldValidation($field->getIdentifier());
161 161
 			}
162 162
 			$this->_validation->setOptional($optional);
163 163
 		}
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	public function setRules(array $rules) {
174
-		$this->_validation = null;
174
+		$this->_validation=null;
175 175
 		return $this->addRules($rules);
176 176
 	}
177 177
 
178
-	public function addIcon($icon, $direction = Direction::LEFT) {
179
-		$field = $this->getField();
178
+	public function addIcon($icon, $direction=Direction::LEFT) {
179
+		$field=$this->getField();
180 180
 		return $field->addIcon($icon, $direction);
181 181
 	}
182 182
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 			State::ERROR,
27 27
 			State::DISABLED
28 28
 		];
29
-		if (isset($label) && $label !== "")
30
-			$this->setLabel($label);
29
+		if (isset($label) && $label !== "") {
30
+					$this->setLabel($label);
31
+		}
31 32
 		$this->setField($field);
32 33
 		$this->_validation = NULL;
33 34
 	}
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 	 * @return mixed
60 61
 	 */
61 62
 	public function getLabel() {
62
-		if (\array_key_exists("label", $this->content))
63
-			return $this->content["label"];
63
+		if (\array_key_exists("label", $this->content)) {
64
+					return $this->content["label"];
65
+		}
64 66
 	}
65 67
 
66 68
 	/**
@@ -145,7 +147,7 @@  discard block
 block discarded – undo
145 147
 				if($type->getType()=='empty'){
146 148
 					$this->addToProperty('class', 'required');
147 149
 				}
148
-			}elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
150
+			} elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
149 151
 				$this->addToProperty('class', 'required');
150 152
 			}
151 153
 			$this->_validation->addRule($type, $prompt, $value);
Please login to merge, or discard this patch.
Ajax/semantic/components/SimpleSemExtComponent.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 		return $this;
18 18
 	}
19 19
 	
20
-	protected function generateParamParts(){
20
+	protected function generateParamParts() {
21 21
 		$results=[];
22
-		foreach ($this->paramParts as $paramPart){
22
+		foreach ($this->paramParts as $paramPart) {
23 23
 			$results[]="{$this->uiName}(".\implode(",", $paramPart).")";
24 24
 		}
25 25
 		return \implode(".", $results);
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function getScript() {
29 29
 		$allParams=$this->params;
30
-		$this->jquery_code_for_compile=array ();
30
+		$this->jquery_code_for_compile=array();
31 31
 		$this->compileJsCodes();
32 32
 		$paramParts="";
33
-		if(\sizeof($this->paramParts)>0){
33
+		if (\sizeof($this->paramParts)>0) {
34 34
 			$paramParts=".".$this->generateParamParts();
35 35
 		}
36 36
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).")".$paramParts.";";
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 		return $this;
44 44
 	}
45 45
 
46
-	public function addComponentEvent($event,$jsCode){
47
-		$jsCode=\str_ireplace("\"","%quote%", $jsCode);
46
+	public function addComponentEvent($event, $jsCode) {
47
+		$jsCode=\str_ireplace("\"", "%quote%", $jsCode);
48 48
 		return $this->setParam($event, "%function(module){".$jsCode."}%");
49 49
 	}
50 50
 	
51
-	public function setJs(JsUtils $js){
51
+	public function setJs(JsUtils $js) {
52 52
 		$this->js=$js;
53 53
 		$js->semantic()->addComponent($this, $this->attachTo, $this->params);
54 54
 	}
Please login to merge, or discard this patch.
Ajax/semantic/components/Toast.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,75 +19,75 @@
 block discarded – undo
19 19
 		$this->uiName='toast';
20 20
 	}
21 21
 
22
-	public function close(){
22
+	public function close() {
23 23
 		return $this->addBehavior('close');
24 24
 	}
25 25
 
26
-	public function setClass($value){
26
+	public function setClass($value) {
27 27
 		$this->params['class']=$value;
28 28
 		return $this;
29 29
 	}
30 30
 	
31
-	public function setCloseIcon(){
31
+	public function setCloseIcon() {
32 32
 		$this->params['closeIcon']=true;
33 33
 		return $this;
34 34
 	}
35 35
 	
36
-	public function setShowIcon($value=false){
36
+	public function setShowIcon($value=false) {
37 37
 		$this->params['showIcon']=$value;
38 38
 		return $this;
39 39
 	}
40 40
 
41
-	public function setPreserveHTML($value=false){
41
+	public function setPreserveHTML($value=false) {
42 42
 		$this->params['preserveHTML']=$value;
43 43
 		return $this;
44 44
 	}
45 45
 	
46
-	public function setCloseOnClick($value){
46
+	public function setCloseOnClick($value) {
47 47
 		$this->params['closeOnClick']=$value;
48 48
 		return $this;
49 49
 	}
50 50
 	
51
-	public function setTitle($title){
51
+	public function setTitle($title) {
52 52
 		$this->params['title']=$title;
53 53
 		return $this;
54 54
 	}
55 55
 
56
-	public function setActions(array $actions){
57
-		foreach ($actions as &$action){
58
-			if(isset($action['click'])){
59
-				$js=\str_ireplace("\"","%quote%", $action['click']);
56
+	public function setActions(array $actions) {
57
+		foreach ($actions as &$action) {
58
+			if (isset($action['click'])) {
59
+				$js=\str_ireplace("\"", "%quote%", $action['click']);
60 60
 				$action['click']="%function(){".$js."}%";
61 61
 			}
62 62
 		}
63 63
 		$this->params['actions']=$actions;
64
-		if(count($actions)>0) {
65
-			$this->params['displayTime'] = 0;
64
+		if (count($actions)>0) {
65
+			$this->params['displayTime']=0;
66 66
 		}
67 67
 		return $this;
68 68
 	}
69 69
 	
70
-	public function setMessage($message){
70
+	public function setMessage($message) {
71 71
 		$this->params['message']=$message;
72 72
 		return $this;
73 73
 	}
74 74
 	
75
-	public function setPosition($position){
75
+	public function setPosition($position) {
76 76
 		$this->params['position']=$position;
77 77
 		return $this;
78 78
 	}
79 79
 	
80
-	public function setDisplayTime($time){
80
+	public function setDisplayTime($time) {
81 81
 		$this->params['displayTime']=$time;
82 82
 		return $this;
83 83
 	}
84 84
 	
85
-	public function setShowProgress($value='top'){
85
+	public function setShowProgress($value='top') {
86 86
 		$this->params['showProgress']=$value;
87 87
 		return $this;
88 88
 	}
89 89
 	
90
-	public function setClassProgress($value){
90
+	public function setClassProgress($value) {
91 91
 		$this->params['classProgress']=$value;
92 92
 		return $this;
93 93
 	}
Please login to merge, or discard this patch.