Completed
Push — master ( 6831db...b65ced )
by Jean-Christophe
03:10
created
Ajax/common/components/BaseComponent.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 	public function getParam($key) {
41 41
 		$value=null;
42
-		if (array_key_exists($key, $this->params))
43
-			$value=$this->params [$key];
42
+		if (array_key_exists($key, $this->params)) {
43
+					$value=$this->params [$key];
44
+		}
44 45
 		return $value;
45 46
 	}
46 47
 
@@ -49,16 +50,18 @@  discard block
 block discarded – undo
49 50
 	}
50 51
 
51 52
 	public function compile(JsUtils $js=NULL) {
52
-		if ($js==NULL)
53
-			$js=$this->js;
53
+		if ($js==NULL) {
54
+					$js=$this->js;
55
+		}
54 56
 		$script=$this->getScript();
55 57
 		$js->addToCompile($script);
56 58
 	}
57 59
 
58 60
 	protected function setParamCtrl($key, $value, $typeCtrl) {
59 61
 		if (\is_array($typeCtrl)) {
60
-			if (array_search($value, $typeCtrl)===false)
61
-				throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
62
+			if (array_search($value, $typeCtrl)===false) {
63
+							throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
64
+			}
62 65
 		} else {
63 66
 			if (!$typeCtrl($value)) {
64 67
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key);
@@ -70,9 +73,9 @@  discard block
 block discarded – undo
70 73
 	public function setParams($params) {
71 74
 		foreach ( $params as $k => $v ) {
72 75
 			$method="set".ucfirst($k);
73
-			if (method_exists($this, $method))
74
-				$this->$method($v);
75
-			else {
76
+			if (method_exists($this, $method)) {
77
+							$this->$method($v);
78
+			} else {
76 79
 				$this->setParam($k, $v);
77 80
 				trigger_error("`".$k."` property n'existe pas", E_USER_NOTICE);
78 81
 			}
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 			foreach ($items as $k=>$v){
23 23
 				$this->addItem([$k,$v]);
24 24
 			}
25
-		}else{
25
+		} else{
26 26
 			foreach ($items as $item){
27 27
 				$this->addItem($item);
28 28
 			}
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 * @return \Ajax\common\html\HtmlDoubleElement
71 71
 	 */
72 72
 	public function getItem($index) {
73
-		if (is_int($index))
74
-			return $this->content[$index];
75
-		else {
73
+		if (is_int($index)) {
74
+					return $this->content[$index];
75
+		} else {
76 76
 			$elm=$this->getElementById($index, $this->content);
77 77
 			return $elm;
78 78
 		}
@@ -134,10 +134,11 @@  discard block
 block discarded – undo
134 134
 		$i=0;
135 135
 		foreach ($properties as $k=>$v){
136 136
 			$c=$this->content[$i++];
137
-			if(isset($c))
138
-				$c->setProperty($k,$v);
139
-			else
140
-				return $this;
137
+			if(isset($c)) {
138
+							$c->setProperty($k,$v);
139
+			} else {
140
+							return $this;
141
+			}
141 142
 		}
142 143
 		return $this;
143 144
 	}
@@ -151,8 +152,7 @@  discard block
 block discarded – undo
151 152
 			$c=$this->content[$i++];
152 153
 			if(isset($c)){
153 154
 				$c->setProperty($property,$value);
154
-			}
155
-			else{
155
+			} else{
156 156
 				return $this;
157 157
 			}
158 158
 		}
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlTextarea.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,18 +12,21 @@
 block discarded – undo
12 12
 		$this->setProperty("name", $identifier);
13 13
 		$this->setValue($value);
14 14
 		$this->setPlaceholder($placeholder);
15
-		if(isset($rows))
16
-			$this->setRows($rows);
15
+		if(isset($rows)) {
16
+					$this->setRows($rows);
17
+		}
17 18
 	}
18 19
 	public function setValue($value) {
19
-		if(isset($value))
20
-			$this->setContent($value);
20
+		if(isset($value)) {
21
+					$this->setContent($value);
22
+		}
21 23
 		return $this;
22 24
 	}
23 25
 
24 26
 	public function setPlaceholder($value){
25
-		if(JString::isNotNull($value))
26
-			$this->setProperty("placeholder", $value);
27
+		if(JString::isNotNull($value)) {
28
+					$this->setProperty("placeholder", $value);
29
+		}
27 30
 		return $this;
28 31
 	}
29 32
 
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Braces   +26 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
 		}
47 47
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
48 48
 		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$jsCallback)."});\n";
49
-		if ($immediatly)
50
-			$this->jquery_code_for_compile[]=$retour;
49
+		if ($immediatly) {
50
+					$this->jquery_code_for_compile[]=$retour;
51
+		}
51 52
 			return $retour;
52 53
 	}
53 54
 
@@ -55,15 +56,17 @@  discard block
 block discarded – undo
55 56
 		$url=$this->_correctAjaxUrl($url);
56 57
 		$retour="url='".$url."';\n";
57 58
 		$slash="/";
58
-		if(JString::endswith($url, "/")===true)
59
-			$slash="";
59
+		if(JString::endswith($url, "/")===true) {
60
+					$slash="";
61
+		}
60 62
 		if(JString::isNotNull($attr)){
61
-			if ($attr==="value")
62
-				$retour.="url=url+'".$slash."'+$(this).val();\n";
63
-			elseif ($attr==="html")
64
-			$retour.="url=url+'".$slash."'+$(this).html();\n";
65
-			elseif($attr!=null && $attr!=="")
66
-					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
63
+			if ($attr==="value") {
64
+							$retour.="url=url+'".$slash."'+$(this).val();\n";
65
+			} elseif ($attr==="html") {
66
+						$retour.="url=url+'".$slash."'+$(this).html();\n";
67
+			} elseif($attr!=null && $attr!=="") {
68
+								$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
69
+			}
67 70
 		}
68 71
 		return $retour;
69 72
 	}
@@ -85,8 +88,9 @@  discard block
 block discarded – undo
85 88
 	}
86 89
 
87 90
 	protected function _correctAjaxUrl($url) {
88
-		if ($url!=="/" && JString::endsWith($url, "/")===true)
89
-			$url=substr($url, 0, strlen($url)-1);
91
+		if ($url!=="/" && JString::endsWith($url, "/")===true) {
92
+					$url=substr($url, 0, strlen($url)-1);
93
+		}
90 94
 		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
91 95
 			$url=$this->jsUtils->getUrl($url);
92 96
 		}
@@ -110,8 +114,9 @@  discard block
 block discarded – undo
110 114
 				$retour.="\t".$jsCallback."\n".
111 115
 						"\t$(document).trigger('jsonReady',[data]);\n".
112 116
 						"});\n";
113
-				if ($immediatly)
114
-					$this->jquery_code_for_compile[]=$retour;
117
+				if ($immediatly) {
118
+									$this->jquery_code_for_compile[]=$retour;
119
+				}
115 120
 					return $retour;
116 121
 	}
117 122
 
@@ -150,7 +155,7 @@  discard block
 block discarded – undo
150 155
 		if($context===null){
151 156
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
152 157
 			$newElm = "$('#'+newId)";
153
-		}else{
158
+		} else{
154 159
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
155 160
 			$newElm = $context.".find('#'+newId)";
156 161
 		}
@@ -160,8 +165,9 @@  discard block
 block discarded – undo
160 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";
161 166
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
162 167
 		$retour.="\t".$jsCallback."\n"."});\n";
163
-		if ($immediatly)
164
-			$this->jquery_code_for_compile[]=$retour;
168
+		if ($immediatly) {
169
+					$this->jquery_code_for_compile[]=$retour;
170
+		}
165 171
 			return $retour;
166 172
 	}
167 173
 	/**
@@ -202,8 +208,9 @@  discard block
 block discarded – undo
202 208
 			}});\n";
203 209
 			$retour.="$('#".$form."').submit();\n";
204 210
 		}
205
-		if ($immediatly)
206
-			$this->jquery_code_for_compile[]=$retour;
211
+		if ($immediatly) {
212
+					$this->jquery_code_for_compile[]=$retour;
213
+		}
207 214
 			return $retour;
208 215
 	}
209 216
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormInstanceViewer.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
 
34 34
 
35 35
 	public function addSeparatorAfter($fieldNum){
36
-		if(\array_search($fieldNum, $this->separators)===false)
37
-			$this->separators[]=$fieldNum;
36
+		if(\array_search($fieldNum, $this->separators)===false) {
37
+					$this->separators[]=$fieldNum;
38
+		}
38 39
 			return $this;
39 40
 	}
40 41
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlAbsractItem.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			$this->setTagName("div");
58 58
 			$this->removeProperty("href");
59 59
 			$this->addToPropertyCtrl("class", "active", array("active"));
60
-		}else{
60
+		} else{
61 61
 			$this->removePropertyValue("class", "active");
62 62
 		}
63 63
 		return $this;
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
 	public function asLink($href=NULL,$part=NULL){
67 67
 		$this->setTagName("a");
68
-		if(isset($href))
69
-			$this->setProperty("href", $href);
68
+		if(isset($href)) {
69
+					$this->setProperty("href", $href);
70
+		}
70 71
 		return $this;
71 72
 	}
72 73
 
@@ -77,8 +78,9 @@  discard block
 block discarded – undo
77 78
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
78 79
 	 */
79 80
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
80
-		if(\is_array($this->content) && JArray::isAssociative($this->content))
81
-			$this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]);
81
+		if(\is_array($this->content) && JArray::isAssociative($this->content)) {
82
+					$this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]);
83
+		}
82 84
 		return parent::compile($js, $view);
83 85
 	}
84 86
 }
85 87
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlGrid.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 			// }
33 33
 			$this->setWide($numCols);
34 34
 		}
35
-		if($createCols)
36
-			$this->setRowsCount($numRows, $numCols);
35
+		if($createCols) {
36
+					$this->setRowsCount($numRows, $numCols);
37
+		}
37 38
 	}
38 39
 
39 40
 	public function asSegment() {
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 	public function addCol($width=NULL) {
86 87
 		$colCount=$this->colCount() + 1;
87 88
 		$this->setColsCount($colCount, true, $width);
88
-		if ($this->hasOnlyCols($this->count()))
89
-			return $this->content[$colCount - 1];
89
+		if ($this->hasOnlyCols($this->count())) {
90
+					return $this->content[$colCount - 1];
91
+		}
90 92
 		return $this;
91 93
 	}
92 94
 
@@ -174,8 +176,9 @@  discard block
 block discarded – undo
174 176
 	 */
175 177
 	public function rowCount() {
176 178
 		$count=$this->count();
177
-		if ($this->hasOnlyCols($count))
178
-			return 0;
179
+		if ($this->hasOnlyCols($count)) {
180
+					return 0;
181
+		}
179 182
 		return $count;
180 183
 	}
181 184
 
@@ -185,10 +188,12 @@  discard block
 block discarded – undo
185 188
 	 */
186 189
 	public function colCount() {
187 190
 		$count=$this->count();
188
-		if ($this->hasOnlyCols($count))
189
-			return $count;
190
-		if ($count > 0)
191
-			return $this->getItem(0)->count();
191
+		if ($this->hasOnlyCols($count)) {
192
+					return $count;
193
+		}
194
+		if ($count > 0) {
195
+					return $this->getItem(0)->count();
196
+		}
192 197
 		return 0;
193 198
 	}
194 199
 
@@ -199,8 +204,9 @@  discard block
 block discarded – undo
199 204
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
200 205
 	 */
201 206
 	public function getCell($row, $col) {
202
-		if ($row < 2 && $this->hasOnlyCols($this->count()))
203
-			return $this->getItem($col);
207
+		if ($row < 2 && $this->hasOnlyCols($this->count())) {
208
+					return $this->getItem($col);
209
+		}
204 210
 		$row=$this->getItem($row);
205 211
 		if (isset($row)) {
206 212
 			$col=$row->getItem($col);
@@ -249,8 +255,9 @@  discard block
 block discarded – undo
249 255
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
250 256
 	 */
251 257
 	public function setPadded($value=NULL) {
252
-		if (isset($value))
253
-			$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
258
+		if (isset($value)) {
259
+					$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
260
+		}
254 261
 		return $this->addToProperty("class", "padded");
255 262
 	}
256 263
 
@@ -275,8 +282,9 @@  discard block
 block discarded – undo
275 282
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
276 283
 	 */
277 284
 	protected function createItem($value) {
278
-		if ($this->_createCols === false)
279
-			$value=null;
285
+		if ($this->_createCols === false) {
286
+					$value=null;
287
+		}
280 288
 		$item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows);
281 289
 		return $item;
282 290
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,14 +55,14 @@
 block discarded – undo
55 55
 			foreach ($values as $v){
56 56
 				$form->addField($v);
57 57
 			}
58
-		}else{
58
+		} else{
59 59
 			$separators[]=$count;
60 60
 			for($i=0;$i<$size;$i++){
61 61
 				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
62 62
 				//TODO check why $fields is empty
63 63
 				if(\sizeof($fields)===1){
64 64
 					$form->addField($fields[0]);
65
-				}elseif(\sizeof($fields)>1){
65
+				} elseif(\sizeof($fields)>1){
66 66
 					$form->addFields($fields);
67 67
 					$i+=\sizeof($fields)-1;
68 68
 				}
Please login to merge, or discard this patch.
Ajax/common/html/HtmlDoubleElement.php 1 patch
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,17 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function addContent($content,$before=false) {
31 31
 		if (!\is_array($this->content)) {
32
-			if(isset($this->content))
33
-				$this->content=array ($this->content);
34
-			else
35
-				$this->content=array();
32
+			if(isset($this->content)) {
33
+							$this->content=array ($this->content);
34
+			} else {
35
+							$this->content=array();
36
+			}
37
+		}
38
+		if($before) {
39
+					array_unshift($this->content,$content);
40
+		} else {
41
+					$this->content []=$content;
36 42
 		}
37
-		if($before)
38
-			array_unshift($this->content,$content);
39
-		else
40
-			$this->content []=$content;
41 43
 		return $this;
42 44
 	}
43 45
 
@@ -75,9 +77,9 @@  discard block
 block discarded – undo
75 77
 		$instances=[];
76 78
 		if($content instanceof $class){
77 79
 			$instances[]=$content;
78
-		}elseif($content instanceof HtmlDoubleElement){
80
+		} elseif($content instanceof HtmlDoubleElement){
79 81
 			$instances=\array_merge($instances,$content->getContentInstances($class));
80
-		}elseif (\is_array($content)){
82
+		} elseif (\is_array($content)){
81 83
 			foreach ($content as $element){
82 84
 				$instances=\array_merge($instances,$this->_getContentInstances($class, $element));
83 85
 			}
Please login to merge, or discard this patch.