Completed
Push — master ( b77ba2...042f42 )
by Jean-Christophe
03:22
created
Ajax/semantic/html/content/view/ContentPartTrait.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@
 block discarded – undo
18 18
 
19 19
 	public function getPart($partKey, $index=NULL,$force=false) {
20 20
 		if (\array_key_exists($partKey, $this->content)) {
21
-			if (isset($index))
22
-				return $this->content[$partKey][$index];
21
+			if (isset($index)) {
22
+							return $this->content[$partKey][$index];
23
+			}
23 24
 			return $this->content[$partKey];
24 25
 		}
25 26
 		if($force){
Please login to merge, or discard this patch.
Ajax/semantic/html/content/view/HtmlViewContent.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 				$this->addImage($image);
29 29
 			}
30 30
 			$this->addHeaderContent($header, $metas, $description,$extra);
31
-		} else
32
-			$this->addContent($value);
31
+		} else {
32
+					$this->addContent($value);
33
+		}
33 34
 	}
34 35
 
35 36
 	public function addElement($content, $baseClass="",$part=NULL) {
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
 
63 64
 	public function addImage($src="", $alt="", $size=NULL) {
64 65
 		$image=new HtmlImg("img-", $src, $alt);
65
-		if (isset($size))
66
-			$image->setSize($size);
66
+		if (isset($size)) {
67
+					$image->setSize($size);
68
+		}
67 69
 		$this->content['image']=$image;
68 70
 		return $image;
69 71
 	}
@@ -86,8 +88,9 @@  discard block
 block discarded – undo
86 88
 			foreach ( $metas as $meta ) {
87 89
 				$this->addMeta($meta);
88 90
 			}
89
-		} else
90
-			$this->addMeta($metas);
91
+		} else {
92
+					$this->addMeta($metas);
93
+		}
91 94
 		return $this;
92 95
 	}
93 96
 
@@ -114,8 +117,9 @@  discard block
 block discarded – undo
114 117
 			$result=new HtmlSemDoubleElement("", "span", "", $caption);
115 118
 			$this->addContent($result);
116 119
 			$result->setFloated($direction);
117
-		} else
118
-			$result=$this->addContent($caption);
120
+		} else {
121
+					$result=$this->addContent($caption);
122
+		}
119 123
 		return $result;
120 124
 	}
121 125
 
@@ -127,8 +131,9 @@  discard block
 block discarded – undo
127 131
 	}
128 132
 
129 133
 	public function addHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) {
130
-		if(isset($header))
131
-			$this->addElement($header, "header");
134
+		if(isset($header)) {
135
+					$this->addElement($header, "header");
136
+		}
132 137
 		$this->addMetas($metas);
133 138
 		if (isset($description)) {
134 139
 			$this->addElement($description, "description");
Please login to merge, or discard this patch.
Ajax/semantic/html/content/view/HtmlViewItem.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 	public function __construct($identifier,$baseClass,$content=NULL) {
20 20
 		parent::__construct($identifier, "div", $baseClass);
21 21
 		$this->content=["content"=>new HtmlViewContent("content-".$this->identifier)];
22
-		if(isset($content))
23
-			$this->setContent($content);
22
+		if(isset($content)) {
23
+					$this->setContent($content);
24
+		}
24 25
 	}
25 26
 
26 27
 	public function setContent($value){
@@ -31,10 +32,12 @@  discard block
 block discarded – undo
31 32
 			if (isset($image)) {
32 33
 				$this->addImage($image);
33 34
 			}
34
-			if(isset($content))
35
-				$this->content["content"]->setContent($content);
36
-			if(isset($extra))
37
-				$this->addExtraContent($extra);
35
+			if(isset($content)) {
36
+							$this->content["content"]->setContent($content);
37
+			}
38
+			if(isset($extra)) {
39
+							$this->addExtraContent($extra);
40
+			}
38 41
 		}
39 42
 	}
40 43
 
@@ -49,10 +52,11 @@  discard block
 block discarded – undo
49 52
 		if (\array_key_exists($key, $this->content) === false) {
50 53
 			$this->content[$key]=[];
51 54
 		}
52
-		if($this->content[$key] instanceof HtmlViewContent)
53
-			$this->content[$key]->addElement($element);
54
-		else
55
-			$this->content[$key][]=$element;
55
+		if($this->content[$key] instanceof HtmlViewContent) {
56
+					$this->content[$key]->addElement($element);
57
+		} else {
58
+					$this->content[$key][]=$element;
59
+		}
56 60
 		return $element;
57 61
 	}
58 62
 
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
 		$this->addToProperty("class", "link");
154 158
 		if ($href !== "") {
155 159
 			$this->setProperty("href", $href);
156
-			if (isset($target))
157
-				$this->setProperty("target", $target);
160
+			if (isset($target)) {
161
+							$this->setProperty("target", $target);
162
+			}
158 163
 		}
159 164
 		return $this;
160 165
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButton.php 1 patch
Braces   +14 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	public function setFocusable($value=true) {
59
-		if ($value === true)
60
-			$this->setProperty("tabindex", "0");
61
-		else {
59
+		if ($value === true) {
60
+					$this->setProperty("tabindex", "0");
61
+		} else {
62 62
 			$this->removeProperty("tabindex");
63 63
 		}
64 64
 		return $this;
@@ -106,8 +106,9 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function addLabel($label, $before=false, $icon=NULL) {
108 108
 		$this->tagName="div";$prefix="";
109
-		if($before)
110
-			$prefix="left ";
109
+		if($before) {
110
+					$prefix="left ";
111
+		}
111 112
 		$this->addToProperty("class", $prefix."labeled");
112 113
 		$this->content=new HtmlButton("button-" . $this->identifier, $this->content);
113 114
 		$this->content->setTagName("div");
@@ -141,12 +142,13 @@  discard block
 block discarded – undo
141 142
 		//TODO check button content
142 143
 		if(\is_array($this->content)){
143 144
 			foreach ($this->content as $content){
144
-				if($content instanceof HtmlButton)
145
-					$content->setColor($color);
145
+				if($content instanceof HtmlButton) {
146
+									$content->setColor($color);
147
+				}
146 148
 			}
149
+		} else {
150
+					parent::setColor($color);
147 151
 		}
148
-		else
149
-			parent::setColor($color);
150 152
 		return $this;
151 153
 	}
152 154
 
@@ -199,8 +201,9 @@  discard block
 block discarded – undo
199 201
 	 * @return HtmlButton
200 202
 	 */
201 203
 	public static function social($identifier, $social, $value=NULL) {
202
-		if ($value === NULL)
203
-			$value=\ucfirst($social);
204
+		if ($value === NULL) {
205
+					$value=\ucfirst($social);
206
+		}
204 207
 		$return=new HtmlButton($identifier, $value);
205 208
 		$return->addIcon($social);
206 209
 		return $return->addToPropertyCtrl("class", $social, Social::getConstants());
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
64 64
 			$rules=$attributes["rules"];
65 65
 			if(\is_array($rules)){
66 66
 				$element->addRules($rules);
67
-			}
68
-			else{
67
+			} else{
69 68
 				$element->addRule($rules);
70 69
 			}
71 70
 			unset($attributes["rules"]);
@@ -117,8 +116,9 @@  discard block
 block discarded – undo
117 116
 	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
118 117
 		return $this->_fieldAs(function($id,$name,$value) use($icon){
119 118
 			$lbl=new HtmlLabel($id,$value);
120
-			if(isset($icon))
121
-				$lbl->addIcon($icon);
119
+			if(isset($icon)) {
120
+							$lbl->addIcon($icon);
121
+			}
122 122
 				return $lbl;
123 123
 		}, $index,$attributes,"label");
124 124
 	}
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
127 127
 		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
128 128
 			$header=new HtmlHeader($id,$niveau,$value);
129
-			if(isset($icon))
130
-				$header->asIcon($icon, $value);
129
+			if(isset($icon)) {
130
+							$header->asIcon($icon, $value);
131
+			}
131 132
 			return $header;
132 133
 		}, $index,$attributes,"header");
133 134
 	}
@@ -135,7 +136,9 @@  discard block
 block discarded – undo
135 136
 
136 137
 	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
137 138
 		$this->setValueFunction($index,function($img) use($size,$circular){
138
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
139
+			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) {
140
+				$image->setCircular();
141
+			}
139 142
 			return $image;
140 143
 		});
141 144
 			return $this;
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
 
195 198
 	public function fieldAsCheckbox($index,$attributes=NULL){
196 199
 		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
197
-			if($caption===null || $caption==="")
198
-				$caption="";
200
+			if($caption===null || $caption==="") {
201
+							$caption="";
202
+			}
199 203
 			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
200 204
 			$input->setChecked(JString::isBooleanTrue($value));
201 205
 			return $this->_prepareFormFields($input, $name, $attributes);
@@ -232,14 +236,14 @@  discard block
 block discarded – undo
232 236
 		$i=0;
233 237
 		if(JArray::isAssociative($types)){
234 238
 			foreach ($types as $type=>$attributes){
235
-				if(\is_int($type))
236
-					$this->fieldAs($i++,$attributes,[]);
237
-				else{
239
+				if(\is_int($type)) {
240
+									$this->fieldAs($i++,$attributes,[]);
241
+				} else{
238 242
 					$type=preg_replace('/\d/', '', $type );
239 243
 					$this->fieldAs($i++,$type,$attributes);
240 244
 				}
241 245
 			}
242
-		}else{
246
+		} else{
243 247
 			foreach ($types as $type){
244 248
 				$this->fieldAs($i++,$type);
245 249
 			}
@@ -251,7 +255,7 @@  discard block
 block discarded – undo
251 255
 		if(\method_exists($this, $method)){
252 256
 			if(!\is_array($attributes)){
253 257
 				$attributes=[$index];
254
-			}else{
258
+			} else{
255 259
 				\array_unshift($attributes, $index);
256 260
 			}
257 261
 			\call_user_func_array([$this,$method], $attributes);
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlLabel.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 	public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") {
23 23
 		parent::__construct($identifier, $tagName, "ui label");
24 24
 		$this->content=$caption;
25
-		if (isset($icon))
26
-			$this->addIcon($icon);
25
+		if (isset($icon)) {
26
+					$this->addIcon($icon);
27
+		}
27 28
 	}
28 29
 
29 30
 	/**
@@ -32,10 +33,11 @@  discard block
 block discarded – undo
32 33
 	 * @return HtmlLabel
33 34
 	 */
34 35
 	public function setPointing($value=Direction::NONE) {
35
-		if($value==="left" || $value==="right")
36
-			return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
37
-		else
38
-			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
36
+		if($value==="left" || $value==="right") {
37
+					return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
38
+		} else {
39
+					return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
40
+		}
39 41
 	}
40 42
 
41 43
 	/**
@@ -129,10 +131,11 @@  discard block
 block discarded – undo
129 131
 	}
130 132
 
131 133
 	public function setAttached($side=Side::TOP,$direction=Direction::NONE){
132
-		if($direction!==Direction::NONE)
133
-			return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
134
-		else
135
-			return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
134
+		if($direction!==Direction::NONE) {
135
+					return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
136
+		} else {
137
+					return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
138
+		}
136 139
 	}
137 140
 
138 141
 	public static function ribbon($identifier, $caption) {
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Braces   +32 added lines, -24 removed lines patch added patch discarded remove patch
@@ -48,8 +48,9 @@  discard block
 block discarded – undo
48 48
 		}
49 49
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
50 50
 		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
51
-		if ($immediatly)
52
-			$this->jquery_code_for_compile[]=$retour;
51
+		if ($immediatly) {
52
+					$this->jquery_code_for_compile[]=$retour;
53
+		}
53 54
 		return $retour;
54 55
 	}
55 56
 
@@ -67,15 +68,17 @@  discard block
 block discarded – undo
67 68
 		$url=$this->_correctAjaxUrl($url);
68 69
 		$retour="url='".$url."';";
69 70
 		$slash="/";
70
-		if(JString::endswith($url, "/")===true)
71
-			$slash="";
71
+		if(JString::endswith($url, "/")===true) {
72
+					$slash="";
73
+		}
72 74
 		if(JString::isNotNull($attr)){
73
-			if ($attr==="value")
74
-				$retour.="url=url+'".$slash."'+$(this).val();\n";
75
-			elseif ($attr==="html")
76
-			$retour.="url=url+'".$slash."'+$(this).html();\n";
77
-			elseif($attr!==null && $attr!=="")
78
-					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
75
+			if ($attr==="value") {
76
+							$retour.="url=url+'".$slash."'+$(this).val();\n";
77
+			} elseif ($attr==="html") {
78
+						$retour.="url=url+'".$slash."'+$(this).html();\n";
79
+			} elseif($attr!==null && $attr!=="") {
80
+								$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
81
+			}
79 82
 		}
80 83
 		return $retour;
81 84
 	}
@@ -85,13 +88,14 @@  discard block
 block discarded – undo
85 88
 		if ($responseElement!=="") {
86 89
 			if(isset($ajaxTransition)){
87 90
 				$call=$this->setAjaxDataCall($ajaxTransition);
88
-			}elseif(isset($this->ajaxTransition)){
91
+			} elseif(isset($this->ajaxTransition)){
89 92
 				$call=$this->ajaxTransition;
90 93
 			}
91
-			if(\is_callable($call))
92
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
93
-			else
94
-				$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
94
+			if(\is_callable($call)) {
95
+							$retour="\t".$call($responseElement,$jqueryDone).";\n";
96
+			} else {
97
+							$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
98
+			}
95 99
 		}
96 100
 		$retour.="\t".$jsCallback."\n";
97 101
 		return $retour;
@@ -105,8 +109,9 @@  discard block
 block discarded – undo
105 109
 	}
106 110
 
107 111
 	protected function _correctAjaxUrl($url) {
108
-		if ($url!=="/" && JString::endsWith($url, "/")===true)
109
-			$url=substr($url, 0, strlen($url)-1);
112
+		if ($url!=="/" && JString::endsWith($url, "/")===true) {
113
+					$url=substr($url, 0, strlen($url)-1);
114
+		}
110 115
 		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
111 116
 			$url=$this->jsUtils->getUrl($url);
112 117
 		}
@@ -130,8 +135,9 @@  discard block
 block discarded – undo
130 135
 				$retour.="\t".$jsCallback."\n".
131 136
 						"\t$(document).trigger('jsonReady',[data]);\n".
132 137
 						"});\n";
133
-				if ($immediatly)
134
-					$this->jquery_code_for_compile[]=$retour;
138
+				if ($immediatly) {
139
+									$this->jquery_code_for_compile[]=$retour;
140
+				}
135 141
 					return $retour;
136 142
 	}
137 143
 
@@ -171,7 +177,7 @@  discard block
 block discarded – undo
171 177
 		if($context===null){
172 178
 			$parent="$('".$maskSelector."').parent()";
173 179
 			$newElm = "$('#'+newId)";
174
-		}else{
180
+		} else{
175 181
 			$parent=$context;
176 182
 			$newElm = $context.".find('#'+newId)";
177 183
 		}
@@ -184,8 +190,9 @@  discard block
 block discarded – undo
184 190
 		$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";
185 191
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
186 192
 		$retour.="\t".$jsCallback."\n"."});\n";
187
-		if ($immediatly)
188
-			$this->jquery_code_for_compile[]=$retour;
193
+		if ($immediatly) {
194
+					$this->jquery_code_for_compile[]=$retour;
195
+		}
189 196
 			return $retour;
190 197
 	}
191 198
 	/**
@@ -226,8 +233,9 @@  discard block
 block discarded – undo
226 233
 			}});\n";
227 234
 			$retour.="$('#".$form."').submit();\n";
228 235
 		}
229
-		if ($immediatly)
230
-			$this->jquery_code_for_compile[]=$retour;
236
+		if ($immediatly) {
237
+					$this->jquery_code_for_compile[]=$retour;
238
+		}
231 239
 			return $retour;
232 240
 	}
233 241
 
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	public function compile(JsUtils $js=null) {
17
-		if ($js===null)
18
-			return;
17
+		if ($js===null) {
18
+					return;
19
+		}
19 20
 		$params="{}";
20 21
 		$jsCallback=NULL;
21 22
 		$attr="id";
Please login to merge, or discard this patch.