Completed
Push — master ( e5e3c8...8b49e3 )
by Jean-Christophe
03:02
created
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
17 17
 
18
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
18
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
19 19
 	protected function addLoading(&$retour, $responseElement) {
20 20
 		$loading_notifier='<div class="ajax-loader">';
21 21
 		if ($this->ajaxLoader=='') {
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
29 29
 	}
30 30
 
31
-	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
32
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly);
31
+	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
32
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly);
33 33
 	}
34
-	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
35
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly);
34
+	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
35
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly);
36 36
 	}
37 37
 
38
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
39
-		if(JString::isNull($params)){$params="{}";}
38
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
39
+		if (JString::isNull($params)) {$params="{}"; }
40 40
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
41 41
 		$retour=$this->_getAjaxUrl($url, $attr);
42 42
 		$responseElement=$this->_getResponseElement($responseElement);
43 43
 		$retour.="var self=this;\n";
44
-		if($hasLoader===true){
44
+		if ($hasLoader===true) {
45 45
 			$this->addLoading($retour, $responseElement);
46 46
 		}
47 47
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
@@ -51,30 +51,30 @@  discard block
 block discarded – undo
51 51
 			return $retour;
52 52
 	}
53 53
 
54
-	protected function _getAjaxUrl($url,$attr){
54
+	protected function _getAjaxUrl($url, $attr) {
55 55
 		$url=$this->_correctAjaxUrl($url);
56 56
 		$retour="url='".$url."';\n";
57 57
 		$slash="/";
58
-		if(JString::endswith($url, "/")===true)
58
+		if (JString::endswith($url, "/")===true)
59 59
 			$slash="";
60
-		if(JString::isNotNull($attr)){
60
+		if (JString::isNotNull($attr)) {
61 61
 			if ($attr==="value")
62 62
 				$retour.="url=url+'".$slash."'+$(this).val();\n";
63 63
 			elseif ($attr==="html")
64 64
 			$retour.="url=url+'".$slash."'+$(this).html();\n";
65
-			elseif($attr!=null && $attr!=="")
65
+			elseif ($attr!=null && $attr!=="")
66 66
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
67 67
 		}
68 68
 		return $retour;
69 69
 	}
70 70
 
71
-	protected function _getOnAjaxDone($responseElement,$jsCallback){
71
+	protected function _getOnAjaxDone($responseElement, $jsCallback) {
72 72
 		$retour="";
73 73
 		if ($responseElement!=="") {
74
-			if(JString::startswith($responseElement, "\"-")===true){
74
+			if (JString::startswith($responseElement, "\"-")===true) {
75 75
 				$responseElement=\str_replace("\"-", "\"", $responseElement);
76 76
 				$retour="\t$({$responseElement}).replaceWith( data );\n";
77
-			}else{
77
+			} else {
78 78
 				$retour="\t$({$responseElement}).html( data );\n";
79 79
 			}
80 80
 		}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		return $retour;
83 83
 	}
84 84
 
85
-	protected function _getResponseElement($responseElement){
85
+	protected function _getResponseElement($responseElement) {
86 86
 		if ($responseElement!=="") {
87 87
 			$responseElement=Javascript::prep_value($responseElement);
88 88
 		}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	protected function _correctAjaxUrl($url) {
93 93
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
94 94
 			$url=substr($url, 0, strlen($url)-1);
95
-		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
95
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
96 96
 			$url=$this->jsUtils->getUrl($url);
97 97
 		}
98 98
 		return $url;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param string $jsCallback javascript code to execute after the request
107 107
 	 * @param boolean $immediatly
108 108
 	 */
109
-	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
109
+	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
110 110
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
111 111
 		$retour=$this->_getAjaxUrl($url, $attr);
112 112
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string $url the request address
128 128
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
129 129
 	 */
130
-	public function _jsonOn($event,$element, $url,$parameters=array()) {
130
+	public function _jsonOn($event, $element, $url, $parameters=array()) {
131 131
 		$preventDefault=true;
132 132
 		$stopPropagation=true;
133 133
 		$jsCallback=null;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		$params="{}";
138 138
 		$immediatly=true;
139 139
 		extract($parameters);
140
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
140
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
141 141
 	}
142 142
 
143 143
 	/**
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
 	 * @param string $context jquery DOM element, array container.
150 150
 	 * @param boolean $immediatly
151 151
 	 */
152
-	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) {
152
+	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) {
153 153
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
154 154
 		$retour=$this->_getAjaxUrl($url, $attr);
155
-		if($context===null){
155
+		if ($context===null) {
156 156
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
157
-			$newElm = "$('#'+newId)";
158
-		}else{
157
+			$newElm="$('#'+newId)";
158
+		} else {
159 159
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
160
-			$newElm = $context.".find('#'+newId)";
160
+			$newElm=$context.".find('#'+newId)";
161 161
 		}
162 162
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
163 163
 		$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";
164
-		$retour.= $appendTo;
164
+		$retour.=$appendTo;
165 165
 		$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";
166 166
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
167 167
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -176,26 +176,26 @@  discard block
 block discarded – undo
176 176
 	 * @param string $url the request address
177 177
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
178 178
 	 */
179
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
179
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
180 180
 		$preventDefault=true;
181 181
 		$stopPropagation=true;
182 182
 		$jsCallback=null;
183 183
 		$attr="id";
184 184
 		$method="get";
185
-		$context = null;
185
+		$context=null;
186 186
 		$params="{}";
187 187
 		$immediatly=true;
188 188
 		extract($parameters);
189
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
189
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
190 190
 	}
191 191
 
192
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
192
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
193 193
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
194 194
 		$retour=$this->_getAjaxUrl($url, $attr);
195 195
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
196 196
 		$responseElement=$this->_getResponseElement($responseElement);
197 197
 		$retour.="var self=this;\n";
198
-		if($hasLoader===true){
198
+		if ($hasLoader===true) {
199 199
 			$this->addLoading($retour, $responseElement);
200 200
 		}
201 201
 		$retour.="$.post(url,params).done(function( data ) {\n";
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @param string $responseElement
223 223
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true)
224 224
 	 */
225
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
225
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
226 226
 		$preventDefault=true;
227 227
 		$stopPropagation=true;
228 228
 		$jsCallback=null;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$hasLoader=true;
231 231
 		$immediatly=true;
232 232
 		extract($parameters);
233
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly);
233
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly);
234 234
 	}
235 235
 
236 236
 	/**
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @param string $responseElement
244 244
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true)
245 245
 	 */
246
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
246
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
247 247
 		$preventDefault=true;
248 248
 		$stopPropagation=true;
249 249
 		$jsCallback=null;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		$hasLoader=true;
252 252
 		$immediatly=true;
253 253
 		extract($parameters);
254
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly);
254
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @param string $responseElement
265 265
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
266 266
 	 */
267
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
267
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
268 268
 		$preventDefault=true;
269 269
 		$stopPropagation=true;
270 270
 		$validation=false;
@@ -273,6 +273,6 @@  discard block
 block discarded – undo
273 273
 		$hasLoader=true;
274 274
 		$immediatly=true;
275 275
 		extract($parameters);
276
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly);
276
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly);
277 277
 	}
278 278
 }
279 279
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryEventsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 trait JqueryEventsTrait {
13
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
13
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
14 14
 
15 15
 	/**
16 16
 	 * Blur
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function _click($element='this', $js=array(), $ret_false=TRUE) {
54 54
 		if (!is_array($js)) {
55
-			$js=array (
55
+			$js=array(
56 56
 					$js
57 57
 			);
58 58
 		}
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryActionsTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 trait JqueryActionsTrait {
13
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
13
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
14 14
 
15 15
 	/**
16 16
 	 * Get or set the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param boolean $immediatly defers the execution if set to false
39 39
 	 * @return string
40 40
 	 */
41
-	public function after($element='this', $value='', $immediatly=false){
41
+	public function after($element='this', $value='', $immediatly=false) {
42 42
 		$element=Javascript::prep_element($element);
43 43
 		$value=Javascript::prep_value($value);
44 44
 		$str="$({$element}).after({$value});";
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 		$animations="\t\t\t";
65 65
 		if (is_array($params)) {
66
-			foreach ( $params as $param => $value ) {
66
+			foreach ($params as $param => $value) {
67 67
 				$animations.=$param.': \''.$value.'\', ';
68 68
 			}
69 69
 		}
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
 	 * @param boolean $immediatly
357 357
 	 * @return string
358 358
 	 */
359
-	public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) {
360
-		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly);
359
+	public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) {
360
+		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly);
361 361
 	}
362 362
 
363 363
 	/**
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	 * @param boolean $immediatly
384 384
 	 * @return String
385 385
 	 */
386
-	public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
387
-		return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly);
386
+	public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
387
+		return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly);
388 388
 	}
389 389
 
390 390
 	/**
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @return string
394 394
 	 */
395 395
 	private function _validate_speed($speed) {
396
-		if (in_array($speed, array (
397
-				'slow','normal','fast'
396
+		if (in_array($speed, array(
397
+				'slow', 'normal', 'fast'
398 398
 		))) {
399 399
 			$speed='"'.$speed.'"';
400 400
 		} elseif (preg_match("/[^0-9]/", $speed)) {
Please login to merge, or discard this patch.
Ajax/bootstrap/html/base/HtmlNavElement.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	protected $attr;
20 20
 
21 21
 
22
-	public function __construct($identifier,$tagName){
23
-		parent::__construct($identifier,$tagName);
22
+	public function __construct($identifier, $tagName) {
23
+		parent::__construct($identifier, $tagName);
24 24
 		$this->root="";
25 25
 		$this->attr="data-ajax";
26 26
 	}
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 * @param string $attr the html attribute used to build the elements url
33 33
 	 * @return HtmlNavElement
34 34
 	 */
35
-	public function autoGetOnClick($targetSelector){
36
-		return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr));
35
+	public function autoGetOnClick($targetSelector) {
36
+		return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr));
37 37
 	}
38 38
 
39
-	public function contentAsString(){
39
+	public function contentAsString() {
40 40
 		return implode("", $this->content);
41 41
 	}
42 42
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
 	 * Generate the jquery script to set the elements to the HtmlNavElement
45 45
 	 * @param JsUtils $jsUtils
46 46
 	 */
47
-	public function jsSetContent(JsUtils $jsUtils){
48
-		$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
47
+	public function jsSetContent(JsUtils $jsUtils) {
48
+		$jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true);
49 49
 	}
50 50
 
51 51
 	public function getRoot() {
52 52
 		return $this->root;
53 53
 	}
54 54
 	public function setRoot($root) {
55
-		$this->root = $root;
55
+		$this->root=$root;
56 56
 		return $this;
57 57
 	}
58 58
 	public function getAttr() {
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 * @return HtmlNavElement
66 66
 	 */
67 67
 	public function setAttr($attr) {
68
-		$this->attr = $attr;
68
+		$this->attr=$attr;
69 69
 		return $this;
70 70
 	}
71 71
 
72 72
 	public function __call($method, $args) {
73
-		if(isset($this->$method) && is_callable($this->$method)) {
73
+		if (isset($this->$method) && is_callable($this->$method)) {
74 74
 			return call_user_func_array(
75 75
 					$this->$method,
76 76
 					$args
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
 		}
79 79
 	}
80 80
 
81
-	abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0);
81
+	abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0);
82 82
 
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/HtmlSemNavElement.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	protected $_contentSeparator="";
26 26
 
27 27
 
28
-	public function __construct($identifier,$tagName,$baseClass){
29
-		parent::__construct($identifier,$tagName,$baseClass);
28
+	public function __construct($identifier, $tagName, $baseClass) {
29
+		parent::__construct($identifier, $tagName, $baseClass);
30 30
 		$this->root="";
31 31
 		$this->attr="data-ajax";
32 32
 	}
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 * @param string $targetSelector the target of the get
37 37
 	 * @return HtmlNavElement
38 38
 	 */
39
-	public function autoGetOnClick($targetSelector){
40
-		return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr));
39
+	public function autoGetOnClick($targetSelector) {
40
+		return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr));
41 41
 	}
42 42
 
43
-	public function contentAsString(){
43
+	public function contentAsString() {
44 44
 		return JArray::implode($this->_contentSeparator, $this->content);
45 45
 	}
46 46
 
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
 	 * Generate the jquery script to set the elements to the HtmlNavElement
49 49
 	 * @param JsUtils $jsUtils
50 50
 	 */
51
-	public function jsSetContent(JsUtils $jsUtils){
52
-		$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
51
+	public function jsSetContent(JsUtils $jsUtils) {
52
+		$jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true);
53 53
 	}
54 54
 
55 55
 	public function getRoot() {
56 56
 		return $this->root;
57 57
 	}
58 58
 	public function setRoot($root) {
59
-		$this->root = $root;
59
+		$this->root=$root;
60 60
 		return $this;
61 61
 	}
62 62
 	public function getAttr() {
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 	 * @return HtmlNavElement
70 70
 	 */
71 71
 	public function setAttr($attr) {
72
-		$this->attr = $attr;
72
+		$this->attr=$attr;
73 73
 		return $this;
74 74
 	}
75 75
 
76 76
 	public function __call($method, $args) {
77
-		if(isset($this->$method) && is_callable($this->$method)) {
77
+		if (isset($this->$method) && is_callable($this->$method)) {
78 78
 			return call_user_func_array(
79 79
 					$this->$method,
80 80
 					$args
@@ -82,32 +82,32 @@  discard block
 block discarded – undo
82 82
 		}
83 83
 	}
84 84
 
85
-	abstract public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0);
85
+	abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0);
86 86
 
87 87
 
88
-	public function setContentDivider($divider,$index=NULL) {
88
+	public function setContentDivider($divider, $index=NULL) {
89 89
 		$divider="<div class='divider'> {$divider} </div>";
90 90
 		return $this->setDivider($divider, $index);
91 91
 	}
92 92
 
93
-	public function setIconContentDivider($iconContentDivider,$index=NULL) {
93
+	public function setIconContentDivider($iconContentDivider, $index=NULL) {
94 94
 		$contentDivider="<i class='".$iconContentDivider." icon divider'></i>";
95 95
 		return $this->setDivider($contentDivider, $index);
96 96
 	}
97 97
 
98
-	protected function setDivider($divider,$index){
99
-		if(isset($index)){
100
-			if(\is_array($this->_contentSeparator)===false)
101
-				$this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator);
98
+	protected function setDivider($divider, $index) {
99
+		if (isset($index)) {
100
+			if (\is_array($this->_contentSeparator)===false)
101
+				$this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator);
102 102
 			$this->_contentSeparator[$index]=$divider;
103
-		}else{
103
+		} else {
104 104
 			$this->_contentSeparator=$divider;
105 105
 		}
106 106
 		return $this;
107 107
 	}
108 108
 
109
-	protected function getContentDivider($index){
110
-		if(\is_array($this->_contentSeparator)===true){
109
+	protected function getContentDivider($index) {
110
+		if (\is_array($this->_contentSeparator)===true) {
111 111
 			return @$this->_contentSeparator[$index];
112 112
 		}
113 113
 		return $this->_contentSeparator;
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/IconTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,18 +15,18 @@  discard block
 block discarded – undo
15 15
 	private $_hasIcon=false;
16 16
 
17 17
 	abstract protected function addToPropertyCtrl($name, $value, $typeCtrl);
18
-	abstract public function addContent($content,$before=false);
18
+	abstract public function addContent($content, $before=false);
19 19
 
20
-	public function addIcon($icon,$direction=Direction::LEFT){
21
-		if($this->_hasIcon===false){
20
+	public function addIcon($icon, $direction=Direction::LEFT) {
21
+		if ($this->_hasIcon===false) {
22 22
 			$iconO=$icon;
23
-			if(\is_string($icon)){
23
+			if (\is_string($icon)) {
24 24
 				$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
25 25
 			}
26 26
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
27
-			$this->addContent($iconO,$direction===Direction::LEFT);
27
+			$this->addContent($iconO, $direction===Direction::LEFT);
28 28
 			$this->_hasIcon=true;
29
-		}else{
29
+		} else {
30 30
 			$iconO=$this->getIcon();
31 31
 			$iconO->setIcon($icon);
32 32
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 		return $iconO;
35 35
 	}
36 36
 
37
-	public function getIcon(){
38
-		if(\is_array($this->content)){
39
-			foreach ($this->content as $item){
40
-				if($item instanceof HtmlIcon)
37
+	public function getIcon() {
38
+		if (\is_array($this->content)) {
39
+			foreach ($this->content as $item) {
40
+				if ($item instanceof HtmlIcon)
41 41
 					return $item;
42 42
 			}
43 43
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldsTrait.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,46 +15,46 @@  discard block
 block discarded – undo
15 15
  * @property string $identifier
16 16
  */
17 17
 trait FieldsTrait {
18
-	abstract public function addFields($fields=NULL,$label=NULL);
18
+	abstract public function addFields($fields=NULL, $label=NULL);
19 19
 	abstract public function addItem($item);
20 20
 
21
-	protected function createItem($value){
22
-		if(\is_array($value)){
23
-			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null)));
21
+	protected function createItem($value) {
22
+		if (\is_array($value)) {
23
+			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null)));
24 24
 			return $itemO;
25
-		}elseif(\is_object($value)){
25
+		}elseif (\is_object($value)) {
26 26
 			$itemO=new HtmlFormField("field-".$this->identifier, $value);
27 27
 			return $itemO;
28
-		}else
28
+		} else
29 29
 			return new HtmlFormInput($value);
30 30
 	}
31 31
 
32
-	protected function createCondition($value){
32
+	protected function createCondition($value) {
33 33
 		return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput;
34 34
 	}
35 35
 
36
-	public function addInputs($inputs,$fieldslabel=null){
36
+	public function addInputs($inputs, $fieldslabel=null) {
37 37
 		$fields=array();
38
-		foreach ($inputs as $input){
38
+		foreach ($inputs as $input) {
39 39
 			\extract($input);
40
-			$f=new HtmlFormInput("","");
40
+			$f=new HtmlFormInput("", "");
41 41
 			$f->fromArray($input);
42 42
 			$fields[]=$f;
43 43
 		}
44
-		return $this->addFields($fields,$fieldslabel);
44
+		return $this->addFields($fields, $fieldslabel);
45 45
 	}
46 46
 
47
-	public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){
47
+	public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) {
48 48
 		$field=$this->getItem($index);
49
-		if(isset($field)){
50
-			$field->addRule($type,$prompt,$value);
49
+		if (isset($field)) {
50
+			$field->addRule($type, $prompt, $value);
51 51
 		}
52 52
 		return $this;
53 53
 	}
54 54
 
55
-	public function addFieldRules($index,$rules){
55
+	public function addFieldRules($index, $rules) {
56 56
 		$field=$this->getItem($index);
57
-		if(isset($field)){
57
+		if (isset($field)) {
58 58
 			$field->addRules($rules);
59 59
 		}
60 60
 		return $this;
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @param boolean $multiple
69 69
 	 * @return \Ajax\common\html\HtmlDoubleElement
70 70
 	 */
71
-	public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){
72
-		return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple));
71
+	public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) {
72
+		return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple));
73 73
 	}
74 74
 
75 75
 	/**
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 	 * @param string $placeholder
81 81
 	 * @return HtmlFormInput
82 82
 	 */
83
-	public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){
84
-		return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder));
83
+	public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
84
+		return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder));
85 85
 	}
86 86
 
87
-	public function addPassword($identifier, $label=NULL){
88
-		return $this->addItem(new HtmlFormInput($identifier,$label,"password","",""));
87
+	public function addPassword($identifier, $label=NULL) {
88
+		return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", ""));
89 89
 	}
90 90
 
91
-	public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){
92
-		return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick));
91
+	public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) {
92
+		return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick));
93 93
 	}
94 94
 
95
-	public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){
96
-		return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type));
95
+	public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) {
96
+		return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type));
97 97
 	}
98 98
 
99
-	public function addRadio($identifier, $name,$label=NULL,$value=NULL){
100
-		return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value));
99
+	public function addRadio($identifier, $name, $label=NULL, $value=NULL) {
100
+		return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value));
101 101
 	}
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.