Completed
Push — master ( f99fed...57dceb )
by Jean-Christophe
03:29
created
Ajax/common/Widget.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\semantic\html\modules\HtmlModal;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait;
23
+	use FieldAsTrait, FormTrait;
24 24
 
25 25
 	/**
26 26
 	 * @var string classname
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	protected $_generated;
54 54
 
55 55
 
56
-	public function __construct($identifier,$model,$modelInstance=NULL) {
56
+	public function __construct($identifier, $model, $modelInstance=NULL) {
57 57
 		parent::__construct($identifier);
58 58
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
59 59
 		$this->setModel($model);
60
-		if(isset($modelInstance)){
60
+		if (isset($modelInstance)) {
61 61
 			$this->show($modelInstance);
62 62
 		}
63 63
 		$this->_generated=false;
64 64
 	}
65 65
 
66
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
66
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
67 67
 		$this->_instanceViewer=$instanceViewer;
68 68
 		$this->content=[$contentKey=>$content];
69 69
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
@@ -74,26 +74,26 @@  discard block
 block discarded – undo
74 74
 	 * @param int|string $fieldName
75 75
 	 * @return int|string
76 76
 	 */
77
-	protected function _getIndex($fieldName){
77
+	protected function _getIndex($fieldName) {
78 78
 		return $fieldName;
79 79
 	}
80 80
 
81
-	protected function _getFieldIdentifier($prefix,$name=""){
81
+	protected function _getFieldIdentifier($prefix, $name="") {
82 82
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
83 83
 	}
84 84
 
85
-	protected function _getFieldName($index){
85
+	protected function _getFieldName($index) {
86 86
 		return $this->_instanceViewer->getFieldName($index);
87 87
 	}
88 88
 
89
-	protected function _getFieldCaption($index){
89
+	protected function _getFieldCaption($index) {
90 90
 		return $this->_instanceViewer->getCaption($index);
91 91
 	}
92 92
 
93
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
93
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
94 94
 
95
-	public function show($modelInstance){
96
-		if(\is_array($modelInstance)){
95
+	public function show($modelInstance) {
96
+		if (\is_array($modelInstance)) {
97 97
 			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
98 98
 		}
99 99
 		$this->_modelInstance=$modelInstance;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	abstract public function getHtmlComponent();
121 121
 
122
-	public function setAttached($value=true){
122
+	public function setAttached($value=true) {
123 123
 		return $this->getHtmlComponent()->setAttached($value);
124 124
 	}
125 125
 
@@ -130,66 +130,66 @@  discard block
 block discarded – undo
130 130
 	 * @param callable $callback function called after the field compilation
131 131
 	 * @return Widget
132 132
 	 */
133
-	public function afterCompile($index,$callback){
133
+	public function afterCompile($index, $callback) {
134 134
 		$index=$this->_getIndex($index);
135 135
 		$this->_instanceViewer->afterCompile($index, $callback);
136 136
 		return $this;
137 137
 	}
138 138
 
139
-	public function setColor($color){
139
+	public function setColor($color) {
140 140
 		return $this->getHtmlComponent()->setColor($color);
141 141
 	}
142 142
 
143 143
 
144
-	public function setCaptions($captions){
144
+	public function setCaptions($captions) {
145 145
 		$this->_instanceViewer->setCaptions($captions);
146 146
 		return $this;
147 147
 	}
148 148
 
149
-	public function setCaption($index,$caption){
149
+	public function setCaption($index, $caption) {
150 150
 		$this->_instanceViewer->setCaption($this->_getIndex($index), $caption);
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	public function setFields($fields){
154
+	public function setFields($fields) {
155 155
 		$this->_instanceViewer->setVisibleProperties($fields);
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	public function addField($field){
159
+	public function addField($field) {
160 160
 		$this->_instanceViewer->addField($field);
161 161
 		return $this;
162 162
 	}
163 163
 
164
-	public function addMessage($attributes=NULL,$fieldName="message"){
164
+	public function addMessage($attributes=NULL, $fieldName="message") {
165 165
 		$this->_instanceViewer->addField($fieldName);
166 166
 		$count=$this->_instanceViewer->visiblePropertiesCount();
167
-		return $this->fieldAsMessage($count-1,$attributes);
167
+		return $this->fieldAsMessage($count-1, $attributes);
168 168
 	}
169 169
 
170
-	public function addErrorMessage(){
171
-		return $this->addMessage(["error"=>true],"message");
170
+	public function addErrorMessage() {
171
+		return $this->addMessage(["error"=>true], "message");
172 172
 	}
173 173
 
174
-	public function insertField($index,$field){
174
+	public function insertField($index, $field) {
175 175
 		$index=$this->_getIndex($index);
176 176
 		$this->_instanceViewer->insertField($index, $field);
177 177
 		return $this;
178 178
 	}
179 179
 
180
-	public function insertInField($index,$field){
180
+	public function insertInField($index, $field) {
181 181
 		$index=$this->_getIndex($index);
182 182
 		$this->_instanceViewer->insertInField($index, $field);
183 183
 		return $this;
184 184
 	}
185 185
 
186
-	public function setValueFunction($index,$callback){
186
+	public function setValueFunction($index, $callback) {
187 187
 		$index=$this->_getIndex($index);
188 188
 		$this->_instanceViewer->setValueFunction($index, $callback);
189 189
 		return $this;
190 190
 	}
191 191
 
192
-	public function setIdentifierFunction($callback){
192
+	public function setIdentifierFunction($callback) {
193 193
 		$this->_instanceViewer->setIdentifierFunction($callback);
194 194
 		return $this;
195 195
 	}
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
199 199
 	 */
200
-	public function getToolbar(){
201
-		if(isset($this->_toolbar)===false){
200
+	public function getToolbar() {
201
+		if (isset($this->_toolbar)===false) {
202 202
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
203 203
 		}
204 204
 		return $this->_toolbar;
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	 * @param callable $callback function to call on $element
211 211
 	 * @return \Ajax\common\html\HtmlDoubleElement
212 212
 	 */
213
-	public function addInToolbar($element,$callback=NULL){
213
+	public function addInToolbar($element, $callback=NULL) {
214 214
 		$tb=$this->getToolbar();
215
-		if($element instanceof BaseWidget){
216
-			if($element->getIdentifier()===""){
215
+		if ($element instanceof BaseWidget) {
216
+			if ($element->getIdentifier()==="") {
217 217
 				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
218 218
 			}
219 219
 		}
220
-		if(isset($callback)){
221
-			if(\is_callable($callback)){
220
+		if (isset($callback)) {
221
+			if (\is_callable($callback)) {
222 222
 				$callback($element);
223 223
 			}
224 224
 		}
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 	 * @param callable $callback function($element)
232 232
 	 * @return \Ajax\common\html\HtmlDoubleElement
233 233
 	 */
234
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
235
-		$result=$this->addInToolbar($caption,$callback);
236
-		if(isset($icon))
234
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
235
+		$result=$this->addInToolbar($caption, $callback);
236
+		if (isset($icon))
237 237
 			$result->addIcon($icon);
238 238
 		return $result;
239 239
 	}
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 	 * @param callable $callback function($element)
244 244
 	 * @return \Ajax\common\Widget
245 245
 	 */
246
-	public function addItemsInToolbar(array $items,$callback=NULL){
247
-		if(JArray::isAssociative($items)){
248
-			foreach ($items as $icon=>$item){
249
-				$this->addItemInToolbar($item,$icon,$callback);
246
+	public function addItemsInToolbar(array $items, $callback=NULL) {
247
+		if (JArray::isAssociative($items)) {
248
+			foreach ($items as $icon=>$item) {
249
+				$this->addItemInToolbar($item, $icon, $callback);
250 250
 			}
251
-		}else{
252
-			foreach ($items as $item){
253
-				$this->addItemInToolbar($item,null,$callback);
251
+		} else {
252
+			foreach ($items as $item) {
253
+				$this->addItemInToolbar($item, null, $callback);
254 254
 			}
255 255
 		}
256 256
 		return $this;
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 	 * @param callable $callback function($element)
263 263
 	 * @return \Ajax\common\html\HtmlDoubleElement
264 264
 	 */
265
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
265
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
266 266
 		$dd=$value;
267 267
 		if (\is_string($value)) {
268
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
268
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
269 269
 		}
270
-		return $this->addInToolbar($dd,$callback);
270
+		return $this->addInToolbar($dd, $callback);
271 271
 	}
272 272
 
273 273
 	/**
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	 * @param callable $callback function($element)
277 277
 	 * @return \Ajax\common\html\HtmlDoubleElement
278 278
 	 */
279
-	public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){
280
-		$bt=new HtmlButton("bt-".$caption,$caption,$cssStyle);
281
-		return $this->addInToolbar($bt,$callback);
279
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
280
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
281
+		return $this->addInToolbar($bt, $callback);
282 282
 	}
283 283
 
284 284
 	/**
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 	 * @param callable $callback function($element)
288 288
 	 * @return \Ajax\common\html\HtmlDoubleElement
289 289
 	 */
290
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
291
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
292
-		return $this->addInToolbar($bts,$callback);
290
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
291
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
292
+		return $this->addInToolbar($bts, $callback);
293 293
 	}
294 294
 
295 295
 	/**
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 	 * @param boolean $labeled
300 300
 	 * @return \Ajax\common\html\HtmlDoubleElement
301 301
 	 */
302
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
303
-		$bt=new HtmlButton("",$caption);
304
-		$bt->addIcon($icon,$before,$labeled);
302
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
303
+		$bt=new HtmlButton("", $caption);
304
+		$bt->addIcon($icon, $before, $labeled);
305 305
 		return $this->addInToolbar($bt);
306 306
 	}
307 307
 
308
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
309
-		$button=new HtmlButton($identifier,$value,$cssStyle);
310
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters);
308
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
309
+		$button=new HtmlButton($identifier, $value, $cssStyle);
310
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
311 311
 		return $this->addInToolbar($button);
312 312
 	}
313 313
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
338 338
 	 * @return \Ajax\common\Widget
339 339
 	 */
340
-	public function setDefaultValueFunction($defaultValueFunction){
340
+	public function setDefaultValueFunction($defaultValueFunction) {
341 341
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
342 342
 		return $this;
343 343
 	}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 * @param string|boolean $disable
347 347
 	 * @return string
348 348
 	 */
349
-	public function jsDisabled($disable=true){
349
+	public function jsDisabled($disable=true) {
350 350
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
351 351
 	}
352 352
 
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 	 * @param callable $callback function($element)
356 356
 	 * @return \Ajax\common\html\HtmlDoubleElement
357 357
 	 */
358
-	public function addEditButtonInToolbar($caption,$callback=NULL){
359
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
358
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
359
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
360 360
 		$bt->setToggle();
361 361
 		$bt->setActive($this->_edition);
362 362
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
363
-		return $this->addInToolbar($bt,$callback);
363
+		return $this->addInToolbar($bt, $callback);
364 364
 	}
365 365
 
366 366
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -374,35 +374,35 @@  discard block
 block discarded – undo
374 374
 	}
375 375
 
376 376
 	public function getForm() {
377
-		if(!isset($this->_form)){
377
+		if (!isset($this->_form)) {
378 378
 			$this->_form=new HtmlForm("frm-".$this->identifier);
379 379
 			$this->setEdition(true);
380 380
 		}
381 381
 		return $this->_form;
382 382
 	}
383 383
 
384
-	public function run(JsUtils $js){
384
+	public function run(JsUtils $js) {
385 385
 		$result=parent::run($js);
386
-		if(isset($this->_form)){
386
+		if (isset($this->_form)) {
387 387
 			$result=$this->runForm($js);
388 388
 		}
389 389
 		return $result;
390 390
 	}
391 391
 
392
-	protected function runForm(JsUtils $js){
392
+	protected function runForm(JsUtils $js) {
393 393
 		$fields=$this->getContentInstances(HtmlFormField::class);
394
-		foreach ($fields as $field){
394
+		foreach ($fields as $field) {
395 395
 			$this->_form->addField($field);
396 396
 		}
397 397
 		return $this->_form->run($js);
398 398
 	}
399 399
 
400
-	protected function _compileForm(){
401
-		if(isset($this->_form)){
400
+	protected function _compileForm() {
401
+		if (isset($this->_form)) {
402 402
 			$noValidate="";
403
-			if(\sizeof($this->_form->getValidationParams())>0)
403
+			if (\sizeof($this->_form->getValidationParams())>0)
404 404
 				$noValidate="novalidate";
405
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
405
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
406 406
 		}
407 407
 	}
408 408
 
@@ -411,26 +411,26 @@  discard block
 block discarded – undo
411 411
 		return $this;
412 412
 	}
413 413
 
414
-	public function moveFieldTo($from,$to){
414
+	public function moveFieldTo($from, $to) {
415 415
 		return $this->_instanceViewer->moveFieldTo($from, $to);
416 416
 	}
417 417
 
418
-	public function swapFields($index1,$index2){
418
+	public function swapFields($index1, $index2) {
419 419
 		$index1=$this->_getIndex($index1);
420 420
 		$index2=$this->_getIndex($index2);
421 421
 		return $this->_instanceViewer->swapFields($index1, $index2);
422 422
 	}
423 423
 
424
-	public function removeField($index){
424
+	public function removeField($index) {
425 425
 		$index=$this->_getIndex($index);
426 426
 		$this->_instanceViewer->removeField($index);
427 427
 		return $this;
428 428
 	}
429 429
 
430
-	public function asModal($header){
431
-		$modal=new HtmlModal("modal-".$this->identifier,$header);
430
+	public function asModal($header) {
431
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
432 432
 		$modal->setContent($this);
433
-		if(isset($this->_form)){
433
+		if (isset($this->_form)) {
434 434
 			$this->_form->onSuccess($modal->jsHide());
435 435
 		}
436 436
 		return $modal;
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	protected $ajaxTransition;
18 18
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
19 19
 
20
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
20
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
21 21
 	protected function addLoading(&$retour, $responseElement) {
22 22
 		$loading_notifier='<div class="ajax-loader">';
23 23
 		if ($this->ajaxLoader=='') {
@@ -30,66 +30,66 @@  discard block
 block discarded – undo
30 30
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
31 31
 	}
32 32
 
33
-	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
34
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
33
+	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
34
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
35 35
 	}
36
-	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
37
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
36
+	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
37
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
38 38
 	}
39 39
 
40
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
41
-		if(JString::isNull($params)){$params="{}";}
40
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
41
+		if (JString::isNull($params)) {$params="{}"; }
42 42
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
43 43
 		$retour=$this->_getAjaxUrl($url, $attr);
44 44
 		$responseElement=$this->_getResponseElement($responseElement);
45 45
 		$retour.="var self=this;\n";
46
-		if($hasLoader===true){
46
+		if ($hasLoader===true) {
47 47
 			$this->addLoading($retour, $responseElement);
48 48
 		}
49 49
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
50
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
50
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
51 51
 		if ($immediatly)
52 52
 			$this->jquery_code_for_compile[]=$retour;
53 53
 		return $retour;
54 54
 	}
55 55
 
56
-	protected function setAjaxDataCall($params){
56
+	protected function setAjaxDataCall($params) {
57 57
 		$result=null;
58
-		if(!\is_callable($params)){
59
-			$result=function ($responseElement,$jqueryDone="html") use($params){
60
-				return AjaxTransition::{$params}($responseElement,$jqueryDone);
58
+		if (!\is_callable($params)) {
59
+			$result=function($responseElement, $jqueryDone="html") use($params){
60
+				return AjaxTransition::{$params}($responseElement, $jqueryDone);
61 61
 			};
62 62
 		}
63 63
 		return $result;
64 64
 	}
65 65
 
66
-	protected function _getAjaxUrl($url,$attr){
66
+	protected function _getAjaxUrl($url, $attr) {
67 67
 		$url=$this->_correctAjaxUrl($url);
68 68
 		$retour="url='".$url."';";
69 69
 		$slash="/";
70
-		if(JString::endswith($url, "/")===true)
70
+		if (JString::endswith($url, "/")===true)
71 71
 			$slash="";
72
-		if(JString::isNotNull($attr)){
72
+		if (JString::isNotNull($attr)) {
73 73
 			if ($attr==="value")
74 74
 				$retour.="url=url+'".$slash."'+$(this).val();\n";
75 75
 			elseif ($attr==="html")
76 76
 			$retour.="url=url+'".$slash."'+$(this).html();\n";
77
-			elseif($attr!=null && $attr!=="")
77
+			elseif ($attr!=null && $attr!=="")
78 78
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
79 79
 		}
80 80
 		return $retour;
81 81
 	}
82 82
 
83
-	protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){
84
-		$retour="";$call=null;
83
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) {
84
+		$retour=""; $call=null;
85 85
 		if ($responseElement!=="") {
86
-			if(isset($ajaxTransition)){
86
+			if (isset($ajaxTransition)) {
87 87
 				$call=$this->setAjaxDataCall($ajaxTransition);
88
-			}elseif(isset($this->ajaxTransition)){
88
+			}elseif (isset($this->ajaxTransition)) {
89 89
 				$call=$this->ajaxTransition;
90 90
 			}
91
-			if(\is_callable($call))
92
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
91
+			if (\is_callable($call))
92
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
93 93
 			else
94 94
 				$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
95 95
 		}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		return $retour;
98 98
 	}
99 99
 
100
-	protected function _getResponseElement($responseElement){
100
+	protected function _getResponseElement($responseElement) {
101 101
 		if ($responseElement!=="") {
102 102
 			$responseElement=Javascript::prep_value($responseElement);
103 103
 		}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	protected function _correctAjaxUrl($url) {
108 108
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
109 109
 			$url=substr($url, 0, strlen($url)-1);
110
-		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
110
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
111 111
 			$url=$this->jsUtils->getUrl($url);
112 112
 		}
113 113
 		return $url;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @param string $jsCallback javascript code to execute after the request
122 122
 	 * @param boolean $immediatly
123 123
 	 */
124
-	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
124
+	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
125 125
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
126 126
 		$retour=$this->_getAjaxUrl($url, $attr);
127 127
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param string $url the request address
143 143
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
144 144
 	 */
145
-	public function _jsonOn($event,$element, $url,$parameters=array()) {
145
+	public function _jsonOn($event, $element, $url, $parameters=array()) {
146 146
 		$preventDefault=true;
147 147
 		$stopPropagation=true;
148 148
 		$jsCallback=null;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		$params="{}";
153 153
 		$immediatly=true;
154 154
 		extract($parameters);
155
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
155
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
156 156
 	}
157 157
 
158 158
 	/**
@@ -164,22 +164,22 @@  discard block
 block discarded – undo
164 164
 	 * @param string $context jquery DOM element, array container.
165 165
 	 * @param boolean $immediatly
166 166
 	 */
167
-	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) {
167
+	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) {
168 168
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
169 169
 		$retour=$this->_getAjaxUrl($url, $attr);
170
-		if($context===null){
170
+		if ($context===null) {
171 171
 			$parent="$('".$maskSelector."').parent()";
172
-			$newElm = "$('#'+newId)";
173
-		}else{
172
+			$newElm="$('#'+newId)";
173
+		} else {
174 174
 			$parent=$context;
175
-			$newElm = $context.".find('#'+newId)";
175
+			$newElm=$context.".find('#'+newId)";
176 176
 		}
177 177
 		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
178 178
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
179 179
 		$retour.=$parent.".find('._json').remove();";
180 180
 		$retour.="\tdata=$.parseJSON(data);$.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();
181 181
 				newElm.attr('id',newId);\n;newElm.addClass('_json').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
182
-		$retour.= $appendTo;
182
+		$retour.=$appendTo;
183 183
 		$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";
184 184
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
185 185
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -194,30 +194,30 @@  discard block
 block discarded – undo
194 194
 	 * @param string $url the request address
195 195
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
196 196
 	 */
197
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
197
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
198 198
 		$preventDefault=true;
199 199
 		$stopPropagation=true;
200 200
 		$jsCallback=null;
201 201
 		$attr="id";
202 202
 		$method="get";
203
-		$context = null;
203
+		$context=null;
204 204
 		$params="{}";
205 205
 		$immediatly=true;
206 206
 		extract($parameters);
207
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
207
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
208 208
 	}
209 209
 
210
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
210
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
211 211
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
212 212
 		$retour=$this->_getAjaxUrl($url, $attr);
213 213
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
214 214
 		$responseElement=$this->_getResponseElement($responseElement);
215 215
 		$retour.="var self=this;\n";
216
-		if($hasLoader===true){
216
+		if ($hasLoader===true) {
217 217
 			$this->addLoading($retour, $responseElement);
218 218
 		}
219 219
 		$retour.="$.post(url,params).done(function( data ) {\n";
220
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
220
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
221 221
 
222 222
 		if ($validation) {
223 223
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @param string $responseElement
241 241
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"jqueryDone"=>"html")
242 242
 	 */
243
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
243
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
244 244
 		$preventDefault=true;
245 245
 		$stopPropagation=true;
246 246
 		$jsCallback=null;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		$jqueryDone="html";
251 251
 		$ajaxTransition=null;
252 252
 		extract($parameters);
253
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
253
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
254 254
 	}
255 255
 
256 256
 	/**
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @param string $responseElement
264 264
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null)
265 265
 	 */
266
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
266
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
267 267
 		$preventDefault=true;
268 268
 		$stopPropagation=true;
269 269
 		$jsCallback=null;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$jqueryDone="html";
274 274
 		$ajaxTransition=null;
275 275
 		extract($parameters);
276
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
276
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
277 277
 	}
278 278
 
279 279
 	/**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @param string $responseElement
287 287
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"immediatly"=>true)
288 288
 	 */
289
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
289
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
290 290
 		$preventDefault=true;
291 291
 		$stopPropagation=true;
292 292
 		$validation=false;
@@ -297,6 +297,6 @@  discard block
 block discarded – undo
297 297
 		$jqueryDone="html";
298 298
 		$ajaxTransition=null;
299 299
 		extract($parameters);
300
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
300
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
301 301
 	}
302 302
 }
303 303
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
26 26
 	 * @param string|callable $ajaxTransition
27 27
 	 */
28
-	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
29
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
28
+	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
29
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
30 30
 	}
31 31
 
32 32
 	/**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param string $jsCallback javascript code to execute after the request
38 38
 	 * @param boolean $immediatly
39 39
 	 */
40
-	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
41
-		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly);
40
+	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
41
+		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly);
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string $url the request address
49 49
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
50 50
 	 */
51
-	public function jsonOn($event,$element, $url,$parameters=array()) {
52
-		return $this->js->_jsonOn($event, $element, $url,$parameters);
51
+	public function jsonOn($event, $element, $url, $parameters=array()) {
52
+		return $this->js->_jsonOn($event, $element, $url, $parameters);
53 53
 	}
54 54
 
55 55
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @param string $jsCallback javascript code to execute after the request
72 72
 	 */
73 73
 	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL) {
74
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL,true);
74
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, true);
75 75
 	}
76 76
 
77 77
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param string $jsCallback javascript code to execute after the request
84 84
 	 */
85 85
 	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL) {
86
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL, false);
86
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, false);
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * @param string $url the request url
94 94
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
95 95
 	 */
96
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
97
-		return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters);
96
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
97
+		return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters);
98 98
 	}
99 99
 
100 100
 	/**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
109 109
 	 * @param string|callable $ajaxTransition
110 110
 	 */
111
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
112
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition);
111
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
112
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
113 113
 	}
114 114
 
115 115
 	/**
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
149 149
 	 * @param string|callable $ajaxTransition
150 150
 	 */
151
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
152
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
151
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
152
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
153 153
 	}
154 154
 
155 155
 	/**
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
165 165
 	 * @param string|callable $ajaxTransition
166 166
 	 */
167
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
168
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
167
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
168
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
169 169
 	}
170 170
 
171 171
 	/**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
180 180
 	 */
181 181
 	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
182
-		return $this->js->_postOn($event, $element,  $url, $params, $responseElement, $parameters);
182
+		return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters);
183 183
 	}
184 184
 
185 185
 	/**
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
206 206
 	 * @param string|callable $ajaxTransition
207 207
 	 */
208
-	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
209
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
208
+	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
209
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
210 210
 	}
211 211
 
212 212
 	/**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
222 222
 	 * @param string|callable $ajaxTransition
223 223
 	 */
224
-	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
225
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
224
+	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
225
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
226 226
 	}
227 227
 
228 228
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
237 237
 	 */
238 238
 	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
239
-		return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters);
239
+		return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters);
240 240
 	}
241 241
 
242 242
 	/**
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@
 block discarded – undo
34 34
 		if ($stopPropagation===true) {
35 35
 			$result.=Javascript::$stopPropagation;
36 36
 		}
37
-		switch($this->method) {
37
+		switch ($this->method) {
38 38
 			case "get":
39
-				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr,$jqueryDone,$ajaxTransition);
39
+				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr, $jqueryDone, $ajaxTransition);
40 40
 				break;
41 41
 			case "post":
42
-				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
42
+				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
43 43
 				break;
44 44
 			case "postForm":
45
-				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
45
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
46 46
 				break;
47 47
 			case "json":
48
-				$result.=$js->jsonDeferred($url,$method,$params,$jsCallback);
48
+				$result.=$js->jsonDeferred($url, $method, $params, $jsCallback);
49 49
 				break;
50 50
 			case "jsonArray":
51
-				$result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback);
51
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $params, $jsCallback);
52 52
 				break;
53 53
 		}
54 54
 		return $result;
Please login to merge, or discard this patch.
Ajax/service/JReflection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,31 +3,31 @@
 block discarded – undo
3 3
 namespace Ajax\service;
4 4
 
5 5
 class JReflection {
6
-	public static function shortClassName($object){
7
-		$classNameWithNamespace = get_class($object);
6
+	public static function shortClassName($object) {
7
+		$classNameWithNamespace=get_class($object);
8 8
 		return substr($classNameWithNamespace, strrpos($classNameWithNamespace, '\\')+1);
9 9
 	}
10 10
 
11
-	public static function jsonObject($classname){
11
+	public static function jsonObject($classname) {
12 12
 		$object=new $classname();
13
-		$class = new \ReflectionClass($classname);
13
+		$class=new \ReflectionClass($classname);
14 14
 		$methods=$class->getMethods(\ReflectionMethod::IS_PUBLIC);
15
-		foreach ($methods as $method){
15
+		foreach ($methods as $method) {
16 16
 			$name=$method->getName();
17
-			if(JString::startswith($name, "set")){
17
+			if (JString::startswith($name, "set")) {
18 18
 				$property=\strtolower(JString::replaceAtFirst($name, "set", ""));
19 19
 				$value="__".$property."__";
20
-				try{
21
-					if($class->getProperty($property)!==null){
22
-						\call_user_func_array([$object,$name],[$value]);
20
+				try {
21
+					if ($class->getProperty($property)!==null) {
22
+						\call_user_func_array([$object, $name], [$value]);
23 23
 					}
24
-				}catch(\Exception $e){}
24
+				}catch (\Exception $e) {}
25 25
 			}
26 26
 		}
27 27
 		return $object;
28 28
 	}
29 29
 
30
-	public static function callMethod($object,$callback,array $values){
31
-		return \call_user_func_array([$object,$callback],$values);
30
+	public static function callMethod($object, $callback, array $values) {
31
+		return \call_user_func_array([$object, $callback], $values);
32 32
 	}
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/Jquery.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
  * @license Apache 2 http://www.apache.org/licenses/
16 16
  **/
17 17
 class Jquery {
18
-	use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait;
18
+	use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait;
19 19
 	protected $_ui;
20 20
 	protected $_bootstrap;
21 21
 	protected $_semantic;
22
-	protected $jquery_code_for_compile=array ();
22
+	protected $jquery_code_for_compile=array();
23 23
 	protected $jsUtils;
24 24
 	protected $params;
25 25
 
26
-	protected $jquery_events=array (
27
-			"bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload"
26
+	protected $jquery_events=array(
27
+			"bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload"
28 28
 	);
29 29
 
30 30
 	public function ui($ui=NULL) {
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		return $this->_semantic;
49 49
 	}
50 50
 
51
-	public function __construct($params,$jsUtils) {
51
+	public function __construct($params, $jsUtils) {
52 52
 		$this->params=array();
53
-		foreach ( $params as $key => $val ) {
53
+		foreach ($params as $key => $val) {
54 54
 				$this->params[$key]=$params[$key];
55 55
 		}
56 56
 		$this->jsUtils=$jsUtils;
57
-		if(isset($params["ajaxTransition"]))
57
+		if (isset($params["ajaxTransition"]))
58 58
 			$this->ajaxTransition=$this->setAjaxDataCall($params["ajaxTransition"]);
59 59
 	}
60 60
 
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function _output($array_js='') {
118 118
 		if (!is_array($array_js)) {
119
-			$array_js=array (
119
+			$array_js=array(
120 120
 					$array_js
121 121
 			);
122 122
 		}
123 123
 
124
-		foreach ( $array_js as $js ) {
124
+		foreach ($array_js as $js) {
125 125
 			$this->jquery_code_for_compile[]="\t$js\n";
126 126
 		}
127 127
 	}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param string $param
134 134
 	 * @param boolean $immediatly delayed if false
135 135
 	 */
136
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
136
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
137 137
 		$element=Javascript::prep_element($element);
138 138
 		if (isset($param)) {
139 139
 			$param=Javascript::prep_value($param);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param boolean $immediatly delayed if false
153 153
 	 * @return string
154 154
 	 */
155
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
155
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
156 156
 		$to=Javascript::prep_element($to);
157 157
 		$element=Javascript::prep_element($element);
158 158
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function sortable($element, $options=array()) {
172 172
 		if (count($options)>0) {
173
-			$sort_options=array ();
174
-			foreach ( $options as $k => $v ) {
173
+			$sort_options=array();
174
+			foreach ($options as $k => $v) {
175 175
 				$sort_options[]="\n\t\t".$k.': '.$v."";
176 176
 			}
177 177
 			$sort_options=implode(",", $sort_options);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
204 204
 	 * @return string
205 205
 	 */
206
-	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
206
+	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
207 207
 		if (\is_array($js)) {
208 208
 			$js=implode("\n\t\t", $js);
209 209
 		}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
218 218
 		else
219 219
 			$event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
220
-		if($immediatly)
220
+		if ($immediatly)
221 221
 			$this->jquery_code_for_compile[]=$event;
222 222
 		return $event;
223 223
 	}
@@ -243,40 +243,40 @@  discard block
 block discarded – undo
243 243
 		$script='$(document).ready(function() {'."\n";
244 244
 		$script.=implode('', $this->jquery_code_for_compile);
245 245
 		$script.='})';
246
-		if($this->params["defer"]){
246
+		if ($this->params["defer"]) {
247 247
 			$script=$this->defer($script);
248 248
 		}
249 249
 		$script.=";";
250 250
 		$this->jquery_code_for_compile=array();
251
-		if($this->params["debug"]===false){
251
+		if ($this->params["debug"]===false) {
252 252
 			$script=$this->minify($script);
253 253
 		}
254 254
 		$output=($script_tags===FALSE) ? $script : $this->inline($script);
255 255
 
256
-		if ($view!==NULL){
257
-			$this->jsUtils->createScriptVariable($view,$view_var, $output);
256
+		if ($view!==NULL) {
257
+			$this->jsUtils->createScriptVariable($view, $view_var, $output);
258 258
 		}
259 259
 		return $output;
260 260
 	}
261 261
 
262
-	public function getScript($offset=0){
262
+	public function getScript($offset=0) {
263 263
 		$code=$this->jquery_code_for_compile;
264
-		if($offset>0)
264
+		if ($offset>0)
265 265
 			$code=\array_slice($code, $offset);
266 266
 		return implode('', $code);
267 267
 	}
268 268
 
269
-	public function scriptCount(){
269
+	public function scriptCount() {
270 270
 		return \sizeof($this->jquery_code_for_compile);
271 271
 	}
272 272
 
273
-	private function defer($script){
273
+	private function defer($script) {
274 274
 		$result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};";
275 275
 		$result.="window.defer(function(){".$script."})";
276 276
 		return $result;
277 277
 	}
278 278
 
279
-	private function _compileLibrary($library){
279
+	private function _compileLibrary($library) {
280 280
 		if ($library!=NULL) {
281 281
 			if ($library->isAutoCompile()) {
282 282
 				$library->compile(true);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * @return void
295 295
 	 */
296 296
 	public function _clear_compile() {
297
-		$this->jquery_code_for_compile=array ();
297
+		$this->jquery_code_for_compile=array();
298 298
 	}
299 299
 
300 300
 	/**
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	public function _document_ready($js) {
305 305
 		if (!is_array($js)) {
306
-			$js=array (
306
+			$js=array(
307 307
 					$js
308 308
 			);
309 309
 		}
310 310
 
311
-		foreach ( $js as $script ) {
311
+		foreach ($js as $script) {
312 312
 			$this->jquery_code_for_compile[]=$script;
313 313
 		}
314 314
 	}
315 315
 
316 316
 	private function minify($input) {
317
-	if(trim($input) === "") return $input;
317
+	if (trim($input)==="") return $input;
318 318
 	return preg_replace(
319 319
 			array(
320 320
 					// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTD.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use Ajax\semantic\html\elements\html5\HtmlLink;
11 11
 
12 12
 class HtmlTD extends HtmlSemDoubleElement {
13
-	use TextAlignmentTrait,TableElementTrait;
13
+	use TextAlignmentTrait, TableElementTrait;
14 14
 	private $_container;
15 15
 	private $_row;
16 16
 	private $_col;
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function __construct($identifier, $content=NULL, $tagName="td") {
27 27
 		parent::__construct($identifier, $tagName, "", $content);
28
-		$this->_variations=[ Variation::COLLAPSING ];
29
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
28
+		$this->_variations=[Variation::COLLAPSING];
29
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
30 30
 	}
31 31
 
32 32
 	public function setContainer($container, $row, $col) {
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	public function setRowspan($rowspan) {
49
-		$to=min($this->_container->count(), $this->_row + $rowspan - 1);
50
-		for($i=$to; $i > $this->_row; $i--) {
49
+		$to=min($this->_container->count(), $this->_row+$rowspan-1);
50
+		for ($i=$to; $i>$this->_row; $i--) {
51 51
 			$this->_container->delete($i, $this->_col);
52 52
 		}
53 53
 		$this->setProperty("rowspan", $rowspan);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function mergeRow() {
58
-		if(!$this->_rowMerged){
58
+		if (!$this->_rowMerged) {
59 59
 			$this->_rowMerged=true;
60 60
 			return $this->setRowspan($this->_container->count());
61 61
 		}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	public function mergeCol() {
66
-		if(!$this->_colMerged){
66
+		if (!$this->_colMerged) {
67 67
 			$this->_colMerged=true;
68 68
 			return $this->setColspan($this->_container->getRow($this->_row)->count());
69 69
 		}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	public function setColspan($colspan) {
74
-		$to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1);
75
-		for($i=$to; $i > $this->_col; $i--) {
76
-			$this->_container->delete($this->_row, $this->_col + 1);
74
+		$to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1);
75
+		for ($i=$to; $i>$this->_col; $i--) {
76
+			$this->_container->delete($this->_row, $this->_col+1);
77 77
 		}
78 78
 		$this->setProperty("colspan", $colspan);
79 79
 		return $this->_container;
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTableContent.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  *
12 12
  */
13 13
 class HtmlTableContent extends HtmlSemCollection {
14
-	protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ];
14
+	protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"];
15 15
 
16 16
 	/**
17 17
 	 *
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function setRowCount($rowCount, $colCount) {
36 36
 		$count=$this->count();
37
-		for($i=$count; $i < $rowCount; $i++) {
37
+		for ($i=$count; $i<$rowCount; $i++) {
38 38
 			$this->addItem($colCount);
39 39
 		}
40 40
 		return $this;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$tr=new HtmlTR("", $value);
57 57
 		$tr->setContainer($this, $count);
58 58
 		$tr->setTdTagName($this->_tdTagNames[$this->tagName]);
59
-		if (isset($value) === true) {
59
+		if (isset($value)===true) {
60 60
 			$tr->setColCount($value);
61 61
 		}
62 62
 		return $tr;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setCellValue($row, $col, $value="") {
116 116
 		$cell=$this->getCell($row, $col);
117
-		if (isset($cell) === true) {
117
+		if (isset($cell)===true) {
118 118
 			$cell->setValue($value);
119 119
 		}
120 120
 		return $this;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param mixed $values
126 126
 	 */
127 127
 	public function setValues($values=array()) {
128
-		return $this->_addOrSetValues($values, function($row,$_values){$row->setValues($_values);});
128
+		return $this->_addOrSetValues($values, function($row, $_values) {$row->setValues($_values); });
129 129
 	}
130 130
 
131 131
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param mixed $values
134 134
 	 */
135 135
 	public function addValues($values=array()) {
136
-		return $this->_addOrSetValues($values, function($row,$_values){$row->addValues($_values);});
136
+		return $this->_addOrSetValues($values, function($row, $_values) {$row->addValues($_values); });
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
 	 * @param mixed $values
142 142
 	 * @param callable $callback
143 143
 	 */
144
-	protected function _addOrSetValues($values,$callback) {
144
+	protected function _addOrSetValues($values, $callback) {
145 145
 		$count=$this->count();
146 146
 		$isArray=true;
147 147
 		if (!\is_array($values)) {
148 148
 			$values=\array_fill(0, $count, $values);
149 149
 			$isArray=false;
150 150
 		}
151
-		if (JArray::dimension($values) == 1 && $isArray)
152
-			$values=[ $values ];
151
+		if (JArray::dimension($values)==1 && $isArray)
152
+			$values=[$values];
153 153
 
154 154
 		$count=\min(\sizeof($values), $count);
155 155
 
156
-		for($i=0; $i < $count; $i++) {
156
+		for ($i=0; $i<$count; $i++) {
157 157
 			$row=$this->content[$i];
158
-			$callback($row,$values[$i]);
158
+			$callback($row, $values[$i]);
159 159
 		}
160 160
 		return $this;
161 161
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			$values=\array_fill(0, $count, $values);
167 167
 		}
168 168
 		$count=\min(\sizeof($values), $count);
169
-		for($i=0; $i < $count; $i++) {
169
+		for ($i=0; $i<$count; $i++) {
170 170
 			$this->getCell($i, $colIndex)->setValue($values[$i]);
171 171
 		}
172 172
 		return $this;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public function addColVariations($colIndex, $variations=array()) {
176 176
 		$count=$this->count();
177
-		for($i=0; $i < $count; $i++) {
177
+		for ($i=0; $i<$count; $i++) {
178 178
 			$this->getCell($i, $colIndex)->addVariations($variations);
179 179
 		}
180 180
 		return $this;
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 
192 192
 	private function colAlign($colIndex, $function) {
193 193
 		$count=$this->count();
194
-		for($i=0; $i < $count; $i++) {
194
+		for ($i=0; $i<$count; $i++) {
195 195
 			$index=$this->content[$i]->getColPosition($colIndex);
196
-			if ($index !== NULL)
196
+			if ($index!==NULL)
197 197
 				$this->getCell($i, $index)->$function();
198 198
 		}
199 199
 		return $this;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function getColCount() {
227 227
 		$result=0;
228
-		if ($this->count() > 0)
228
+		if ($this->count()>0)
229 229
 			$result=$this->getItem(0)->getColCount();
230 230
 		return $result;
231 231
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	public function delete($rowIndex, $colIndex=NULL) {
240 240
 		if (isset($colIndex)) {
241 241
 			$row=$this->getItem($rowIndex);
242
-			if (isset($row) === true) {
242
+			if (isset($row)===true) {
243 243
 				$row->delete($colIndex);
244 244
 			}
245 245
 		} else {
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function conditionalCellFormat($callback, $format) {
273 273
 		$rows=$this->content;
274
-		foreach ( $rows as $row ) {
274
+		foreach ($rows as $row) {
275 275
 			$row->conditionalCellFormat($callback, $format);
276 276
 		}
277 277
 		return $this;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function conditionalRowFormat($callback, $format) {
286 286
 		$rows=$this->content;
287
-		foreach ( $rows as $row ) {
287
+		foreach ($rows as $row) {
288 288
 			$row->conditionalRowFormat($callback, $format);
289 289
 		}
290 290
 		return $this;
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function applyCells($callback) {
298 298
 		$rows=$this->content;
299
-		foreach ( $rows as $row ) {
299
+		foreach ($rows as $row) {
300 300
 			$row->applyCells($callback);
301 301
 		}
302 302
 		return $this;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 */
309 309
 	public function applyRows($callback) {
310 310
 		$rows=$this->content;
311
-		foreach ( $rows as $row ) {
311
+		foreach ($rows as $row) {
312 312
 			$row->apply($callback);
313 313
 		}
314 314
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param mixed $values
65 65
 	 */
66 66
 	public function setValues($values=array()) {
67
-		return $this->_addOrSetValues($values, function(&$cell,$value){$cell->setValue($value);});
67
+		return $this->_addOrSetValues($values, function(&$cell, $value) {$cell->setValue($value); });
68 68
 	}
69 69
 
70 70
 	/**
@@ -72,27 +72,27 @@  discard block
 block discarded – undo
72 72
 	 * @param mixed $values
73 73
 	 */
74 74
 	public function addValues($values=array()) {
75
-		return $this->_addOrSetValues($values, function(&$cell,$value){$cell->addValue($value);});
75
+		return $this->_addOrSetValues($values, function(&$cell, $value) {$cell->addValue($value); });
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * Sets or adds values to the row cols
80 80
 	 * @param mixed $values
81 81
 	 */
82
-	protected function _addOrSetValues($values,$callback) {
82
+	protected function _addOrSetValues($values, $callback) {
83 83
 		$count=$this->count();
84 84
 		if (!\is_array($values)) {
85 85
 			$values=\array_fill(0, $count, $values);
86 86
 		} else {
87
-			if (JArray::isAssociative($values) === true) {
87
+			if (JArray::isAssociative($values)===true) {
88 88
 				$values=\array_values($values);
89 89
 			}
90 90
 		}
91 91
 		$count=\min(\sizeof($values), $count);
92 92
 
93
-		for($i=0; $i < $count; $i++) {
93
+		for ($i=0; $i<$count; $i++) {
94 94
 			$cell=$this->content[$i];
95
-			$callback($cell,$values[$i]);
95
+			$callback($cell, $values[$i]);
96 96
 		}
97 97
 		return $this;
98 98
 	}
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	public function getColPosition($colIndex) {
119 119
 		$pos=0;
120 120
 		$rows=$this->_container->getContent();
121
-		for($i=0; $i < $this->_row; $i++) {
121
+		for ($i=0; $i<$this->_row; $i++) {
122 122
 			$max=\min($colIndex, $rows[$i]->count());
123
-			for($j=0; $j < $max; $j++) {
123
+			for ($j=0; $j<$max; $j++) {
124 124
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
125
-				if ($rowspan + $i > $this->_row)
125
+				if ($rowspan+$i>$this->_row)
126 126
 					$pos++;
127 127
 			}
128 128
 		}
129
-		if ($pos > $colIndex)
129
+		if ($pos>$colIndex)
130 130
 			return NULL;
131 131
 		$count=$this->count();
132
-		for($i=0; $i < $count; $i++) {
132
+		for ($i=0; $i<$count; $i++) {
133 133
 			$pos+=$this->content[$i]->getColspan();
134
-			if ($pos >= $colIndex + 1)
134
+			if ($pos>=$colIndex+1)
135 135
 				return $i;
136 136
 		}
137 137
 		return null;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 	public function conditionalCellFormat($callback, $format) {
141 141
 		$cells=$this->content;
142
-		foreach ( $cells as $cell ) {
142
+		foreach ($cells as $cell) {
143 143
 			$cell->conditionalCellFormat($callback, $format);
144 144
 		}
145 145
 		return $this;
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 
155 155
 	public function containsStr($needle) {
156 156
 		$cells=$this->content;
157
-		foreach ( $cells as $cell ) {
158
-			if (\strpos($cell->getContent(), $needle) !== false)
157
+		foreach ($cells as $cell) {
158
+			if (\strpos($cell->getContent(), $needle)!==false)
159 159
 				return true;
160 160
 		}
161 161
 		return false;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 	public function applyCells($callback) {
170 170
 		$cells=$this->content;
171
-		foreach ( $cells as $cell ) {
171
+		foreach ($cells as $cell) {
172 172
 			$cell->apply($callback);
173 173
 		}
174 174
 		return $this;
Please login to merge, or discard this patch.