Completed
Push — master ( e06bda...71a3fd )
by Jean-Christophe
03:12
created
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,19 +164,19 @@  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
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
172
-			$newElm = "$('#'+newId)";
173
-		}else{
172
+			$newElm="$('#'+newId)";
173
+		} else {
174 174
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
175
-			$newElm = $context.".find('#'+newId)";
175
+			$newElm=$context.".find('#'+newId)";
176 176
 		}
177 177
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
178 178
 		$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();newElm.attr('id',newId);\n";
179
-		$retour.= $appendTo;
179
+		$retour.=$appendTo;
180 180
 		$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";
181 181
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
182 182
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -191,30 +191,30 @@  discard block
 block discarded – undo
191 191
 	 * @param string $url the request address
192 192
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
193 193
 	 */
194
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
194
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
195 195
 		$preventDefault=true;
196 196
 		$stopPropagation=true;
197 197
 		$jsCallback=null;
198 198
 		$attr="id";
199 199
 		$method="get";
200
-		$context = null;
200
+		$context=null;
201 201
 		$params="{}";
202 202
 		$immediatly=true;
203 203
 		extract($parameters);
204
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
204
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
205 205
 	}
206 206
 
207
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
207
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
208 208
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
209 209
 		$retour=$this->_getAjaxUrl($url, $attr);
210 210
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
211 211
 		$responseElement=$this->_getResponseElement($responseElement);
212 212
 		$retour.="var self=this;\n";
213
-		if($hasLoader===true){
213
+		if ($hasLoader===true) {
214 214
 			$this->addLoading($retour, $responseElement);
215 215
 		}
216 216
 		$retour.="$.post(url,params).done(function( data ) {\n";
217
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
217
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
218 218
 
219 219
 		if ($validation) {
220 220
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @param string $responseElement
238 238
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"jqueryDone"=>"html")
239 239
 	 */
240
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
240
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
241 241
 		$preventDefault=true;
242 242
 		$stopPropagation=true;
243 243
 		$jsCallback=null;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		$jqueryDone="html";
248 248
 		$ajaxTransition=null;
249 249
 		extract($parameters);
250
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
250
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
251 251
 	}
252 252
 
253 253
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @param string $responseElement
261 261
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null)
262 262
 	 */
263
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
263
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
264 264
 		$preventDefault=true;
265 265
 		$stopPropagation=true;
266 266
 		$jsCallback=null;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		$jqueryDone="html";
271 271
 		$ajaxTransition=null;
272 272
 		extract($parameters);
273
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
273
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
274 274
 	}
275 275
 
276 276
 	/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @param string $responseElement
284 284
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"immediatly"=>true)
285 285
 	 */
286
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
286
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
287 287
 		$preventDefault=true;
288 288
 		$stopPropagation=true;
289 289
 		$validation=false;
@@ -294,6 +294,6 @@  discard block
 block discarded – undo
294 294
 		$jqueryDone="html";
295 295
 		$ajaxTransition=null;
296 296
 		extract($parameters);
297
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
297
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
298 298
 	}
299 299
 }
300 300
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/service/JString.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,51 +2,51 @@
 block discarded – undo
2 2
 namespace Ajax\service;
3 3
 class JString {
4 4
 
5
-	public static function contains($hay,$needle){
6
-		return strpos($hay, $needle) !== false;
5
+	public static function contains($hay, $needle) {
6
+		return strpos($hay, $needle)!==false;
7 7
 	}
8 8
 	public static function startswith($hay, $needle) {
9
-		return substr($hay, 0, strlen($needle)) === $needle;
9
+		return substr($hay, 0, strlen($needle))===$needle;
10 10
 	}
11 11
 
12 12
 	public static function endswith($hay, $needle) {
13
-		return substr($hay, -strlen($needle)) === $needle;
13
+		return substr($hay, -strlen($needle))===$needle;
14 14
 	}
15 15
 
16
-	public static function isNull($s){
16
+	public static function isNull($s) {
17 17
 		return (!isset($s) || NULL===$s || ""===$s);
18 18
 	}
19
-	public static function isNotNull($s){
19
+	public static function isNotNull($s) {
20 20
 		return (isset($s) && NULL!==$s && ""!==$s);
21 21
 	}
22 22
 
23
-	public static function isBoolean($value){
23
+	public static function isBoolean($value) {
24 24
 		return \is_bool($value) || $value==1 || $value==0;
25 25
 	}
26 26
 
27
-	public static function isBooleanTrue($value){
27
+	public static function isBooleanTrue($value) {
28 28
 		return $value==1 || $value;
29 29
 	}
30 30
 
31
-	public static function isBooleanFalse($value){
31
+	public static function isBooleanFalse($value) {
32 32
 		return $value==0 || !$value;
33 33
 	}
34 34
 
35
-	public static function camelCaseToSeparated($input,$separator=" "){
35
+	public static function camelCaseToSeparated($input, $separator=" ") {
36 36
 		return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input));
37 37
 	}
38 38
 
39
-	public static function replaceAtFirst($subject,$from, $to){
40
-		$from = '/\A'.preg_quote($from, '/').'/';
39
+	public static function replaceAtFirst($subject, $from, $to) {
40
+		$from='/\A'.preg_quote($from, '/').'/';
41 41
 		return \preg_replace($from, $to, $subject, 1);
42 42
 	}
43 43
 
44
-	public static function replaceAtLast($subject,$from, $to){
45
-		$from = '/'.preg_quote($from, '/').'\z/';
44
+	public static function replaceAtLast($subject, $from, $to) {
45
+		$from='/'.preg_quote($from, '/').'\z/';
46 46
 		return \preg_replace($from, $to, $subject, 1);
47 47
 	}
48 48
 
49
-	public static function replaceAtFirstAndLast($subject,$fromFirst,$toFirst,$fromLast,$toLast){
49
+	public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) {
50 50
 		$s=self::replaceAtFirst($subject, $fromFirst, $toFirst);
51 51
 		return self::replaceAtLast($s, $fromLast, $toLast);
52 52
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/business/BusinessForm.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 	 *
17 17
 	 * @see \Ajax\semantic\widgets\dataform\DataForm::__construct()
18 18
 	 */
19
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]) {
20
-		if(!isset($modelInstance)){
19
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) {
20
+		if (!isset($modelInstance)) {
21 21
 			$modelInstance=$this->getDefaultModelInstance();
22 22
 		}
23
-		parent::__construct($identifier,$modelInstance);
24
-		$this->_initForm($fieldsOrder, $fieldsDefinition,$fields,$captions,$separators);
23
+		parent::__construct($identifier, $modelInstance);
24
+		$this->_initForm($fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
25 25
 	}
26 26
 
27 27
 	abstract protected function getDefaultModelInstance();
28 28
 
29
-	protected function _initForm($fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]){
29
+	protected function _initForm($fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) {
30 30
 		$this->_fieldsOrder=$fieldsOrder;
31 31
 		$this->setFields($fields);
32 32
 		$this->setSeparators($separators);
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
 		$this->setCaptions($captions);
35 35
 	}
36 36
 
37
-	protected function _getIndex($fieldName){
37
+	protected function _getIndex($fieldName) {
38 38
 		$index=$fieldName;
39
-		if(\is_string($fieldName)){
39
+		if (\is_string($fieldName)) {
40 40
 			$index=\array_search($fieldName, $this->_fieldsOrder);
41 41
 		}
42 42
 		return $index;
43 43
 	}
44
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
44
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
45 45
 		$index=$this->_getIndex($index);
46
-		return parent::_fieldAs($elementCallback, $index,$attributes,$prefix);
46
+		return parent::_fieldAs($elementCallback, $index, $attributes, $prefix);
47 47
 	}
48 48
 
49 49
 
50
-	public function removeField($fieldName){
50
+	public function removeField($fieldName) {
51 51
 		parent::removeField($fieldName);
52
-		\array_splice($this->_fieldsOrder,$this->_getIndex($fieldName),1);
52
+		\array_splice($this->_fieldsOrder, $this->_getIndex($fieldName), 1);
53 53
 		return $this;
54 54
 	}
55 55
 
56
-	public function compile(JsUtils $js=NULL,&$view=NULL){
57
-		return parent::compile($js,$view);
56
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
57
+		return parent::compile($js, $view);
58 58
 	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormInstanceViewer.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,51 +10,51 @@  discard block
 block discarded – undo
10 10
 	protected $separators;
11 11
 	protected $headers;
12 12
 
13
-	public function __construct($identifier,$instance=NULL, $captions=NULL) {
14
-		parent::__construct($identifier,$instance=NULL, $captions=NULL);
13
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
14
+		parent::__construct($identifier, $instance=NULL, $captions=NULL);
15 15
 		$this->separators=[-1];
16 16
 		$this->headers=[];
17
-		$this->defaultValueFunction=function($name,$value,$index){
17
+		$this->defaultValueFunction=function($name, $value, $index) {
18 18
 			$caption=$this->getCaption($index);
19
-			$input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value);
19
+			$input=new HtmlFormInput($this->widgetIdentifier."-".$name, $caption, "text", $value);
20 20
 			$input->setName($name);
21 21
 			return $input;
22 22
 		};
23 23
 	}
24 24
 
25
-	protected function _beforeAddProperty($index,&$field){
26
-		if(JString::endswith($field, "\n")===true){
25
+	protected function _beforeAddProperty($index, &$field) {
26
+		if (JString::endswith($field, "\n")===true) {
27 27
 			$this->addSeparatorAfter($index);
28 28
 		}
29
-		if($index>1 && JString::startswith($field, "\n")===true){
29
+		if ($index>1 && JString::startswith($field, "\n")===true) {
30 30
 			$this->addSeparatorAfter($index-1);
31 31
 		}
32 32
 		$field=\str_replace("\n", "", $field);
33
-		if(($header=$this->hasHeader($field))!==false){
33
+		if (($header=$this->hasHeader($field))!==false) {
34 34
 			$this->addHeaderDividerBefore($index, $header);
35 35
 		}
36 36
 	}
37 37
 
38
-	protected function hasHeader(&$field){
39
-		$matches=[];$result=false;
40
-		if(\preg_match('/\{(.*?)\}/s', $field, $matches)===1){
38
+	protected function hasHeader(&$field) {
39
+		$matches=[]; $result=false;
40
+		if (\preg_match('/\{(.*?)\}/s', $field, $matches)===1) {
41 41
 			$result=$matches[1];
42
-			$field=\str_replace("{".$result."}","", $field);
42
+			$field=\str_replace("{".$result."}", "", $field);
43 43
 		}
44 44
 		return $result;
45 45
 	}
46 46
 
47 47
 
48 48
 
49
-	public function addSeparatorAfter($fieldNum){
50
-		if(\array_search($fieldNum, $this->separators)===false)
49
+	public function addSeparatorAfter($fieldNum) {
50
+		if (\array_search($fieldNum, $this->separators)===false)
51 51
 			$this->separators[]=$fieldNum;
52 52
 		return $this;
53 53
 	}
54 54
 
55
-	public function addHeaderDividerBefore($fieldNum,$header){
55
+	public function addHeaderDividerBefore($fieldNum, $header) {
56 56
 		$this->headers[$fieldNum]=$header;
57
-		if($fieldNum>0)
57
+		if ($fieldNum>0)
58 58
 			$this->addSeparatorAfter($fieldNum-1);
59 59
 		return $this;
60 60
 	}
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 		return $this->separators;
64 64
 	}
65 65
 
66
-	public function removeSeparator($index){
67
-		\array_splice($this->separators,$index,1);
66
+	public function removeSeparator($index) {
67
+		\array_splice($this->separators, $index, 1);
68 68
 	}
69 69
 
70
-	public function removeField($index){
70
+	public function removeField($index) {
71 71
 		parent::removeField($index);
72 72
 		$pos=\array_search($index, $this->separators);
73
-		if($pos!==false){
74
-			for($i=$pos+1;$i<\sizeof($this->separators);$i++){
73
+		if ($pos!==false) {
74
+			for ($i=$pos+1; $i<\sizeof($this->separators); $i++) {
75 75
 				$this->separators[$i]--;
76 76
 			}
77 77
 			\array_splice($this->separators, $pos, 1);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -19,55 +19,55 @@  discard block
 block discarded – undo
19 19
 class DataForm extends Widget {
20 20
 
21 21
 	public function __construct($identifier, $modelInstance=NULL) {
22
-		parent::__construct($identifier, null,$modelInstance);
22
+		parent::__construct($identifier, null, $modelInstance);
23 23
 		$this->_form=new HtmlForm($identifier);
24 24
 		$this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true);
25 25
 	}
26 26
 
27
-	protected function _getFieldIdentifier($prefix,$name=""){
27
+	protected function _getFieldIdentifier($prefix, $name="") {
28 28
 		return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier();
29 29
 	}
30 30
 
31
-	public function compile(JsUtils $js=NULL,&$view=NULL){
32
-		if(!$this->_generated){
31
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
32
+		if (!$this->_generated) {
33 33
 			$this->_instanceViewer->setInstance($this->_modelInstance);
34 34
 
35 35
 			$form=$this->content["form"];
36 36
 			$this->_generateContent($form);
37 37
 
38
-			if(isset($this->_toolbar)){
38
+			if (isset($this->_toolbar)) {
39 39
 				$this->_setToolbarPosition($form);
40 40
 			}
41
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]);
41
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]);
42 42
 			$this->_generated=true;
43 43
 		}
44
-		return parent::compile($js,$view);
44
+		return parent::compile($js, $view);
45 45
 	}
46 46
 
47 47
 	/**
48 48
 	 * @param HtmlForm $form
49 49
 	 */
50
-	protected function _generateContent($form){
51
-		$values= $this->_instanceViewer->getValues();
50
+	protected function _generateContent($form) {
51
+		$values=$this->_instanceViewer->getValues();
52 52
 		$count=$this->_instanceViewer->count();
53 53
 		$separators=$this->_instanceViewer->getSeparators();
54 54
 		$headers=$this->_instanceViewer->getHeaders();
55 55
 		\sort($separators);
56 56
 		$size=\sizeof($separators);
57
-		if($size===1){
58
-			foreach ($values as $v){
57
+		if ($size===1) {
58
+			foreach ($values as $v) {
59 59
 				$form->addField($v);
60 60
 			}
61
-		}else{
61
+		} else {
62 62
 			$separators[]=$count;
63
-			for($i=0;$i<$size;$i++){
64
-				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
65
-				if(isset($headers[$separators[$i]+1]))
66
-					$form->addHeader($headers[$separators[$i]+1],4,true);
63
+			for ($i=0; $i<$size; $i++) {
64
+				$fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]);
65
+				if (isset($headers[$separators[$i]+1]))
66
+					$form->addHeader($headers[$separators[$i]+1], 4, true);
67 67
 				//TODO check why $fields is empty
68
-				if(\sizeof($fields)===1){
68
+				if (\sizeof($fields)===1) {
69 69
 					$form->addField($fields[0]);
70
-				}elseif(\sizeof($fields)>1){
70
+				}elseif (\sizeof($fields)>1) {
71 71
 					$form->addFields($fields);
72 72
 				}
73 73
 			}
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	 * {@inheritDoc}
79 79
 	 * @see \Ajax\common\Widget::getForm()
80 80
 	 */
81
-	public function getForm(){
81
+	public function getForm() {
82 82
 		return $this->content["form"];
83 83
 	}
84 84
 
85
-	public function addSeparatorAfter($fieldNum){
85
+	public function addSeparatorAfter($fieldNum) {
86 86
 		$fieldNum=$this->_getIndex($fieldNum);
87 87
 		$this->_instanceViewer->addSeparatorAfter($fieldNum);
88 88
 		return $this;
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 		return $this;
98 98
 	}
99 99
 
100
-	public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){
101
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
102
-			$button=new HtmlButton($id,$value,$cssStyle);
100
+	public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) {
101
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
102
+			$button=new HtmlButton($id, $value, $cssStyle);
103 103
 			$button->setProperty("type", "reset");
104 104
 			return $button;
105
-		}, $index,$attributes);
105
+		}, $index, $attributes);
106 106
 	}
107 107
 
108 108
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 		$this->content[$this->_toolbarPosition]=$this->_toolbar;
122 122
 	}
123 123
 
124
-	public function addDividerBefore($index,$title){
124
+	public function addDividerBefore($index, $title) {
125 125
 		$index=$this->_getIndex($index);
126 126
 		$this->_instanceViewer->addHeaderDividerBefore($index, $title);
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function run(JsUtils $js){
130
+	public function run(JsUtils $js) {
131 131
 		return parent::run($js);
132 132
 	}
133 133
 }
134 134
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlModal.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,117 +15,117 @@  discard block
 block discarded – undo
15 15
 	protected $_paramParts=array();
16 16
 
17 17
 	public function __construct($identifier, $header="", $content="", $actions=null) {
18
-		parent::__construct($identifier, "div","ui modal");
19
-		if(isset($header)){
18
+		parent::__construct($identifier, "div", "ui modal");
19
+		if (isset($header)) {
20 20
 			$this->setHeader($header);
21 21
 		}
22
-		if(isset($content)){
22
+		if (isset($content)) {
23 23
 			$this->setContent($content);
24 24
 		}
25
-		if(isset($actions)){
25
+		if (isset($actions)) {
26 26
 			$this->setActions($actions);
27 27
 		}
28 28
 	}
29 29
 
30 30
 	public function setHeader($value) {
31
-		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
31
+		$this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value);
32 32
 		return $this;
33 33
 	}
34 34
 
35 35
 	public function setContent($value) {
36
-		$this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value);
36
+		$this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value);
37 37
 		return $this;
38 38
 	}
39 39
 
40 40
 	public function setActions($actions) {
41
-		$this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions");
42
-		if(\is_array($actions)){
43
-			foreach ($actions as $action){
41
+		$this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions");
42
+		if (\is_array($actions)) {
43
+			foreach ($actions as $action) {
44 44
 				$this->addAction($action);
45 45
 			}
46 46
 		}
47
-		else{
47
+		else {
48 48
 			$this->addAction($actions);
49 49
 		}
50 50
 		return $this;
51 51
 	}
52 52
 
53
-	public function addAction($action){
54
-		if(!$action instanceof BaseHtml){
53
+	public function addAction($action) {
54
+		if (!$action instanceof BaseHtml) {
55 55
 			$class="";
56
-			if(\array_search($action, ["Okay","Yes"])!==false){
56
+			if (\array_search($action, ["Okay", "Yes"])!==false) {
57 57
 				$class="approve";
58 58
 			}
59
-			if(\array_search($action, ["Cancel","No"])!==false){
59
+			if (\array_search($action, ["Cancel", "No"])!==false) {
60 60
 				$class="cancel";
61 61
 			}
62
-			$action=new HtmlButton("action-".$this->identifier,$action);
63
-			if($class!=="")
62
+			$action=new HtmlButton("action-".$this->identifier, $action);
63
+			if ($class!=="")
64 64
 				$action->addToProperty("class", $class);
65 65
 		}
66 66
 		return $this->addElementInPart($action, "actions");
67 67
 	}
68 68
 
69
-	public function addContent($content,$before=false){
70
-		$this->content["content"]->addContent($content,$before);
69
+	public function addContent($content, $before=false) {
70
+		$this->content["content"]->addContent($content, $before);
71 71
 		return $this;
72 72
 	}
73 73
 
74
-	public function addImageContent($image,$description=NULL){
74
+	public function addImageContent($image, $description=NULL) {
75 75
 		$content=$this->content["content"];
76
-		if(isset($description)){
77
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
78
-			$content->addContent($description,true);
76
+		if (isset($description)) {
77
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
78
+			$content->addContent($description, true);
79 79
 		}
80
-		if($image!==""){
81
-			$img=new HtmlImage("image-".$this->identifier,$image,"","medium");
82
-			$content->addContent($img,true);
83
-			$content->addToProperty("class","image");
80
+		if ($image!=="") {
81
+			$img=new HtmlImage("image-".$this->identifier, $image, "", "medium");
82
+			$content->addContent($img, true);
83
+			$content->addToProperty("class", "image");
84 84
 		}
85 85
 		return $this;
86 86
 	}
87 87
 
88
-	public function addIconContent($icon,$description=NULL){
88
+	public function addIconContent($icon, $description=NULL) {
89 89
 		$content=$this->content["content"];
90
-		if(isset($description)){
91
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
92
-			$content->addContent($description,true);
90
+		if (isset($description)) {
91
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
92
+			$content->addContent($description, true);
93 93
 		}
94
-		if($icon!==""){
95
-			$img=new HtmlIcon("image-".$this->identifier,$icon);
96
-			$content->addContent($img,true);
97
-			$content->addToProperty("class","image");
94
+		if ($icon!=="") {
95
+			$img=new HtmlIcon("image-".$this->identifier, $icon);
96
+			$content->addContent($img, true);
97
+			$content->addToProperty("class", "image");
98 98
 		}
99 99
 		return $this;
100 100
 	}
101 101
 
102
-	private function addContentInPart($content,$uiClass,$part) {
103
-		return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part);
102
+	private function addContentInPart($content, $uiClass, $part) {
103
+		return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part);
104 104
 	}
105 105
 
106
-	private function addElementInPart($element,$part) {
106
+	private function addElementInPart($element, $part) {
107 107
 		$this->content[$part]->addContent($element);
108 108
 		return $element;
109 109
 	}
110 110
 
111
-	public function showDimmer($value){
112
-		$value=$value?"show":"hide";
111
+	public function showDimmer($value) {
112
+		$value=$value ? "show" : "hide";
113 113
 		$this->_paramParts[]=["'".$value." dimmer'"];
114 114
 		return $this;
115 115
 	}
116 116
 
117
-	public function setInverted(){
117
+	public function setInverted() {
118 118
 		$this->_params["inverted"]=true;
119 119
 		return $this;
120 120
 	}
121 121
 
122
-	public function setBasic(){
122
+	public function setBasic() {
123 123
 		return $this->addToProperty("class", "basic");
124 124
 	}
125 125
 
126 126
 
127
-	public function setTransition($value){
128
-		$this->_paramParts[]=["'setting'","'transition'","'".$value."'"];
127
+	public function setTransition($value) {
128
+		$this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"];
129 129
 	}
130 130
 
131 131
 	/**
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 * @param string $viewName
136 136
 	 * @param $params The parameters to pass to the view
137 137
 	 */
138
-	public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) {
139
-		return $this->setContent($js->renderContent($initialController, $viewName,$params));
138
+	public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) {
139
+		return $this->setContent($js->renderContent($initialController, $viewName, $params));
140 140
 	}
141 141
 
142 142
 	/**
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param string $actionName the action name
148 148
 	 * @param array $params
149 149
 	 */
150
-	public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){
151
-		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params));
150
+	public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) {
151
+		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params));
152 152
 	}
153 153
 
154 154
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
159 159
 	 */
160 160
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
161
-		$this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]);
161
+		$this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]);
162 162
 		return parent::compile($js, $view);
163 163
 	}
164 164
 	/*
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 * @see BaseHtml::run()
167 167
 	 */
168 168
 	public function run(JsUtils $js) {
169
-		if(isset($this->_bsComponent)===false)
170
-			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts);
169
+		if (isset($this->_bsComponent)===false)
170
+			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts);
171 171
 		$this->addEventsOnRun($js);
172 172
 		return $this->_bsComponent;
173 173
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlProgress.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 		$this->createBar();
18 18
 		if (isset($label))
19 19
 			$this->setLabel($label);
20
-		$this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ];
20
+		$this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED];
21 21
 		$this->addToProperty("class", $attributes);
22 22
 	}
23 23
 
24 24
 	public function setLabel($label) {
25
-		$this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label);
25
+		$this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label);
26 26
 		return $this;
27 27
 	}
28 28
 
29 29
 	private function createBar() {
30
-		$bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress"));
30
+		$bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress"));
31 31
 		$this->content["bar"]=$bar;
32 32
 		return $this;
33 33
 	}
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
64 64
 	 */
65 65
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
66
-		$this->content=JArray::sortAssociative($this->content, [ "bar","label" ]);
66
+		$this->content=JArray::sortAssociative($this->content, ["bar", "label"]);
67 67
 		return parent::compile($js, $view);
68 68
 	}
69 69
 
70 70
 	public function jsSetValue($value) {
71
-		return '$("#' . $this->identifier . '").progress({value:' . $value . '});';
71
+		return '$("#'.$this->identifier.'").progress({value:'.$value.'});';
72 72
 	}
73 73
 
74 74
 	public function jsIncValue() {
75
-		return '$("#' . $this->identifier . '").progress("increment");';
75
+		return '$("#'.$this->identifier.'").progress("increment");';
76 76
 	}
77 77
 
78 78
 	public function jsDecValue() {
79
-		return '$("#' . $this->identifier . '").progress("decrement");';
79
+		return '$("#'.$this->identifier.'").progress("decrement");';
80 80
 	}
81 81
 
82 82
 	/**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 			$percent=JArray::getDefaultValue($array, "percent", $percent);
99 99
 			$ratio=JArray::getDefaultValue($array, "ratio", $ratio);
100 100
 		}
101
-		$this->_params["text"]="%{active  : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio   : " . \var_export($ratio, true) . "}%";
101
+		$this->_params["text"]="%{active  : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio   : ".\var_export($ratio, true)."}%";
102 102
 		return $this;
103 103
 	}
104 104
 
105 105
 	public function onChange($jsCode) {
106
-		$this->addBehavior($this->_params, "onChange", $jsCode,"%function(percent, value, total){","}%");
106
+		$this->addBehavior($this->_params, "onChange", $jsCode, "%function(percent, value, total){", "}%");
107 107
 		return $this;
108 108
 	}
109 109
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @see BaseHtml::run()
113 113
 	 */
114 114
 	public function run(JsUtils $js) {
115
-		if (isset($this->_bsComponent) === false)
116
-			$this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params);
115
+		if (isset($this->_bsComponent)===false)
116
+			$this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params);
117 117
 		$this->addEventsOnRun($js);
118 118
 		return $this->_bsComponent;
119 119
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
  * @property string $identifier
14 14
  */
15 15
 trait BaseTrait {
16
-	protected $_variations=[ ];
17
-	protected $_states=[ ];
16
+	protected $_variations=[];
17
+	protected $_states=[];
18 18
 	protected $_baseClass;
19 19
 
20 20
 	abstract protected function setPropertyCtrl($name, $value, $typeCtrl);
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	abstract public function setProperty($name, $value);
29 29
 
30
-	abstract public function addContent($content,$before=false);
30
+	abstract public function addContent($content, $before=false);
31 31
 
32 32
 	abstract public function onCreate($jsCode);
33 33
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		$this->setProperty("class", $this->_baseClass);
49 49
 		if (\is_string($variations))
50 50
 			$variations=\explode(" ", $variations);
51
-		foreach ( $variations as $variation ) {
51
+		foreach ($variations as $variation) {
52 52
 			$this->addVariation($variation);
53 53
 		}
54 54
 		return $this;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	public function addVariations($variations=array()) {
63 63
 		if (\is_string($variations))
64 64
 			$variations=\explode(" ", $variations);
65
-		foreach ( $variations as $variation ) {
65
+		foreach ($variations as $variation) {
66 66
 			$this->addVariation($variation);
67 67
 		}
68 68
 		return $this;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	public function addStates($states=array()) {
72 72
 		if (\is_string($states))
73 73
 			$states=\explode(" ", $states);
74
-		foreach ( $states as $state ) {
74
+		foreach ($states as $state) {
75 75
 			$this->addState($state);
76 76
 		}
77 77
 		return $this;
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 		$this->setProperty("class", $this->_baseClass);
82 82
 		if (\is_string($states))
83 83
 			$states=\explode(" ", $states);
84
-		foreach ( $states as $state ) {
84
+		foreach ($states as $state) {
85 85
 			$this->addState($state);
86 86
 		}
87 87
 		return $this;
88 88
 	}
89 89
 
90 90
 	public function addIcon($icon, $before=true) {
91
-		return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before);
91
+		return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before);
92 92
 	}
93 93
 
94
-	public function addSticky($context="body"){
94
+	public function addSticky($context="body") {
95 95
 		$this->onCreate("$('#".$this->identifier."').sticky({ context: '".$context."'});");
96 96
 		return $this;
97 97
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement
113 113
 	 */
114 114
 	public function setDisabled($disable=true) {
115
-		if($disable)
115
+		if ($disable)
116 116
 			$this->addToProperty("class", "disabled");
117 117
 		return $this;
118 118
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
140 140
 	 */
141
-	public function asHeader(){
141
+	public function asHeader() {
142 142
 		return $this->addToProperty("class", "header");
143 143
 	}
144 144
 
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 	 * show it is currently the active user selection
147 147
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
148 148
 	 */
149
-	public function setActive($value=true){
150
-		if($value)
149
+	public function setActive($value=true) {
150
+		if ($value)
151 151
 			$this->addToProperty("class", "active");
152 152
 		return $this;
153 153
 	}
154 154
 
155
-	public function setAttached($value=true){
156
-		if($value)
157
-			$this->addToPropertyCtrl("class", "attached", array ("attached" ));
155
+	public function setAttached($value=true) {
156
+		if ($value)
157
+			$this->addToPropertyCtrl("class", "attached", array("attached"));
158 158
 		return $this;
159 159
 	}
160 160
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	public function setFloated($direction="right") {
173
-		return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated"));
173
+		return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated"));
174 174
 	}
175 175
 
176 176
 	public function floatRight() {
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 		return $this->_baseClass;
186 186
 	}
187 187
 
188
-	protected function addBehavior(&$array,$key,$value,$before="",$after=""){
189
-		if(\is_string($value)){
190
-			if(isset($array[$key])){
188
+	protected function addBehavior(&$array, $key, $value, $before="", $after="") {
189
+		if (\is_string($value)) {
190
+			if (isset($array[$key])) {
191 191
 				$p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, "");
192 192
 				$array[$key]=$before.$p.$value.$after;
193
-			}else
193
+			} else
194 194
 				$array[$key]=$before.$value.$after;
195
-		}else
195
+		} else
196 196
 			$array[$key]=$value;
197 197
 		return $this;
198 198
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class HtmlForm extends HtmlSemCollection {
23 23
 
24
-	use FieldsTrait,FormTrait;
24
+	use FieldsTrait, FormTrait;
25 25
 	/**
26 26
 	 * @var array
27 27
 	 */
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 
35 35
 	public function __construct($identifier, $elements=array()) {
36 36
 		parent::__construct($identifier, "form", "ui form");
37
-		$this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ];
37
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
38 38
 		$this->setProperty("name", $this->identifier);
39
-		$this->_fields=array ();
39
+		$this->_fields=array();
40 40
 		$this->addItems($elements);
41 41
 		$this->_validationParams=[];
42 42
 	}
43 43
 
44
-	protected function getForm(){
44
+	protected function getForm() {
45 45
 		return $this;
46 46
 	}
47 47
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param string $caption
63 63
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
64 64
 	 */
65
-	public function addDivider($caption=NULL){
66
-		return $this->addContent(new HtmlDivider("",$caption));
65
+	public function addDivider($caption=NULL) {
66
+		return $this->addContent(new HtmlDivider("", $caption));
67 67
 	}
68 68
 
69 69
 	public function addFields($fields=NULL, $label=NULL) {
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 						$label=NULL;
80 80
 				}
81 81
 				$this->_fields=\array_merge($this->_fields, $fields);
82
-				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
82
+				$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
83 83
 			}
84 84
 			if (isset($label))
85 85
 				$fields=new HtmlFormField("", $fields, $label);
86 86
 		} else {
87
-			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
87
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count());
88 88
 		}
89 89
 		$this->addItem($fields);
90 90
 		return $fields;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	public function addItem($item) {
94 94
 		$item=parent::addItem($item);
95
-		if (\is_subclass_of($item, HtmlFormField::class) === true) {
95
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
96 96
 			$this->_fields[]=$item;
97 97
 		}
98 98
 		return $item;
@@ -146,39 +146,39 @@  discard block
 block discarded – undo
146 146
 
147 147
 
148 148
 
149
-	public function compile(JsUtils $js=NULL,&$view=NULL){
150
-		if(\sizeof($this->_validationParams)>0)
149
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
150
+		if (\sizeof($this->_validationParams)>0)
151 151
 			$this->setProperty("novalidate", "");
152
-		return parent::compile($js,$view);
152
+		return parent::compile($js, $view);
153 153
 	}
154 154
 
155 155
 	public function run(JsUtils $js) {
156
-		if(isset($js)){
156
+		if (isset($js)) {
157 157
 			$compo=$js->semantic()->form("#".$this->identifier);
158
-		}else{
158
+		} else {
159 159
 			$compo=new Form();
160 160
 			$compo->attach("#".$this->identifier);
161 161
 		}
162
-		foreach ($this->_fields as $field){
163
-			if($field instanceof HtmlFormField){
162
+		foreach ($this->_fields as $field) {
163
+			if ($field instanceof HtmlFormField) {
164 164
 				$compo=$this->addCompoValidation($compo, $field);
165 165
 			}
166 166
 		}
167
-		foreach ($this->content as $field){
168
-			if($field instanceof HtmlFormFields){
167
+		foreach ($this->content as $field) {
168
+			if ($field instanceof HtmlFormFields) {
169 169
 				$items=$field->getItems();
170
-				foreach ($items as $_field){
171
-					if($_field instanceof HtmlFormField)
170
+				foreach ($items as $_field) {
171
+					if ($_field instanceof HtmlFormField)
172 172
 						$compo=$this->addCompoValidation($compo, $_field);
173 173
 				}
174 174
 			}
175 175
 		}
176
-		$this->_runValidationParams($compo,$js);
176
+		$this->_runValidationParams($compo, $js);
177 177
 		return $this->_bsComponent;
178 178
 	}
179 179
 
180
-	public function addValidationParam($paramName,$paramValue,$before="",$after=""){
181
-		$this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after);
180
+	public function addValidationParam($paramName, $paramValue, $before="", $after="") {
181
+		$this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after);
182 182
 		return $this;
183 183
 	}
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		return $this->_validationParams;
192 192
 	}
193 193
 
194
-	public function removeValidationParam($param){
194
+	public function removeValidationParam($param) {
195 195
 		unset($this->_validationParams[$param]);
196 196
 		return $this;
197 197
 	}
Please login to merge, or discard this patch.