Passed
Push — master ( 0da08b...5a8334 )
by Jean-Christophe
01:41
created
Ajax/semantic/html/collections/form/HtmlFormFields.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,12 +29,14 @@  discard block
 block discarded – undo
29 29
 				if (\is_string($end)) {
30 30
 					$label=$end;
31 31
 					\array_pop($fields);
32
-				} else
33
-					$label=NULL;
32
+				} else {
33
+									$label=NULL;
34
+				}
34 35
 			}
35 36
 		}
36
-		if (isset($label))
37
-			$this->setLabel($label);
37
+		if (isset($label)) {
38
+					$this->setLabel($label);
39
+		}
38 40
 		foreach ( $fields as $field ) {
39 41
 			$this->addItem($field);
40 42
 		}
@@ -57,8 +59,9 @@  discard block
 block discarded – undo
57 59
 
58 60
 	public function addItem($item) {
59 61
 		$item=parent::addItem($item);
60
-		if($item instanceof HtmlFormField)
61
-			$item->setContainer($this);
62
+		if($item instanceof HtmlFormField) {
63
+					$item->setContainer($this);
64
+		}
62 65
 		return $item;
63 66
 	}
64 67
 	
@@ -73,8 +76,9 @@  discard block
 block discarded – undo
73 76
 		if ($this->_equalWidth) {
74 77
 			$count=$this->count();
75 78
 			$this->addToProperty("class", Wide::getConstants()["W".$count]." fields");
76
-		} else
77
-			$this->addToProperty("class", "fields");
79
+		} else {
80
+					$this->addToProperty("class", "fields");
81
+		}
78 82
 		return parent::compile($js, $view);
79 83
 	}
80 84
 
@@ -115,8 +119,9 @@  discard block
 block discarded – undo
115 119
 			$fields[]=$itemO;
116 120
 		}
117 121
 		$radios=new HtmlFormFields($identifier, $fields);
118
-		if (isset($label))
119
-			$radios->setLabel($label)->setProperty("for", $name);
122
+		if (isset($label)) {
123
+					$radios->setLabel($label)->setProperty("for", $name);
124
+		}
120 125
 		return $radios;
121 126
 	}
122 127
 
@@ -132,8 +137,9 @@  discard block
 block discarded – undo
132 137
 			$fields[]=$itemO;
133 138
 		}
134 139
 		$radios=new HtmlFormFields($identifier, $fields);
135
-		if (isset($label))
136
-			$radios->setLabel($label)->setProperty("for", $name);
140
+		if (isset($label)) {
141
+					$radios->setLabel($label)->setProperty("for", $name);
142
+		}
137 143
 		return $radios;
138 144
 	}
139 145
 
Please login to merge, or discard this patch.
Ajax/common/html/HtmlDoubleElement.php 1 patch
Braces   +19 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,15 +32,17 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function addContent($content,$before=false) {
34 34
 		if (!\is_array($this->content)) {
35
-			if(isset($this->content))
36
-				$this->content=array ($this->content);
37
-			else
38
-				$this->content=array();
35
+			if(isset($this->content)) {
36
+							$this->content=array ($this->content);
37
+			} else {
38
+							$this->content=array();
39
+			}
40
+		}
41
+		if($before) {
42
+					array_unshift($this->content,$content);
43
+		} else {
44
+					$this->content []=$content;
39 45
 		}
40
-		if($before)
41
-			array_unshift($this->content,$content);
42
-		else
43
-			$this->content []=$content;
44 46
 		return $this;
45 47
 	}
46 48
 
@@ -78,9 +80,9 @@  discard block
 block discarded – undo
78 80
 		$instances=[];
79 81
 		if($content instanceof $class){
80 82
 			$instances[]=$content;
81
-		}elseif($content instanceof HtmlDoubleElement){
83
+		} elseif($content instanceof HtmlDoubleElement){
82 84
 			$instances=\array_merge($instances,$content->getContentInstances($class));
83
-		}elseif (\is_array($content)){
85
+		} elseif (\is_array($content)){
84 86
 			foreach ($content as $element){
85 87
 				$instances=\array_merge($instances,$this->_getContentInstances($class, $element));
86 88
 			}
@@ -93,10 +95,12 @@  discard block
 block discarded – undo
93 95
 	 * @return HtmlDoubleElement
94 96
 	 */
95 97
 	public function asLink($href=NULL,$target=NULL) {
96
-		if (isset($href))
97
-			$this->setProperty("href", $href);
98
-		if(isset($target))
99
-			$this->setProperty("target", $target);
98
+		if (isset($href)) {
99
+					$this->setProperty("href", $href);
100
+		}
101
+		if(isset($target)) {
102
+					$this->setProperty("target", $target);
103
+		}
100 104
 		return $this->setTagName("a");
101 105
 	}
102 106
 	
@@ -121,7 +125,7 @@  discard block
 block discarded – undo
121 125
 			$this->_editableContent=$frm;
122 126
 			$keypress="";
123 127
 			$focusOut="";
124
-		}else{
128
+		} else{
125 129
 			$focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');";
126 130
 			$this->_editableContent=$field;
127 131
 			$keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});";
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				$this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++);
65 65
 				$i++;
66 66
 			}
67
-		}else{
67
+		} else{
68 68
 			$separators[]=$count;
69 69
 			for($i=0;$i<$size;$i++){
70 70
 				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
@@ -78,17 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 	protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers,$nb){
80 80
 		$wrapper=null;
81
-		if(isset($headers[$sepFirst+1]))
82
-			$form->addHeader($headers[$sepFirst+1],4,true);
81
+		if(isset($headers[$sepFirst+1])) {
82
+					$form->addHeader($headers[$sepFirst+1],4,true);
83
+		}
83 84
 		if(isset($wrappers[$sepFirst+1])){
84 85
 			$wrapper=$wrappers[$sepFirst+1];
85 86
 		}
86 87
 		if(\sizeof($values)===1){
87 88
 			$added=$form->addField($values[0]);
88
-		}elseif(\sizeof($values)>1){
89
+		} elseif(\sizeof($values)>1){
89 90
 			$added=$form->addFields($values);
90
-		}else
91
-			return;
91
+		} else {
92
+					return;
93
+		}
92 94
 		if(isset($wrapper)){
93 95
 			$added->wrap($wrapper[0],$wrapper[1]);
94 96
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldTrait.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,8 +79,9 @@  discard block
 block discarded – undo
79 79
 		$actionO=$action;
80 80
 		if (\is_object($action) === false) {
81 81
 			$actionO=new HtmlButton("action-" . $this->identifier, $action);
82
-			if (isset($icon))
83
-				$actionO->addIcon($icon, true, $labeled);
82
+			if (isset($icon)) {
83
+							$actionO->addIcon($icon, true, $labeled);
84
+			}
84 85
 		}
85 86
 		$field->addToProperty("class", $direction . " action");
86 87
 		$field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false);
@@ -120,8 +121,9 @@  discard block
 block discarded – undo
120 121
 
121 122
 	public function setDisabled($disable=true) {
122 123
 		$field=$this->getField();
123
-		if($disable)
124
-			$field->addToProperty("class", "disabled");
124
+		if($disable) {
125
+					$field->addToProperty("class", "disabled");
126
+		}
125 127
 		return $this;
126 128
 	}
127 129
 	
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldsTrait.php 1 patch
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,11 +29,12 @@  discard block
 block discarded – undo
29 29
 		if(\is_array($value)){
30 30
 			$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)));
31 31
 			return $itemO;
32
-		}elseif(\is_object($value)){
32
+		} elseif(\is_object($value)){
33 33
 			$itemO=new HtmlFormField("field-".$this->identifier, $value);
34 34
 			return $itemO;
35
-		}else
36
-			return new HtmlFormInput($value);
35
+		} else {
36
+					return new HtmlFormInput($value);
37
+		}
37 38
 	}
38 39
 
39 40
 	protected function createCondition($value){
@@ -67,8 +68,7 @@  discard block
 block discarded – undo
67 68
 			if(isset($c)){
68 69
 				$df=$c->getDataField();
69 70
 				$df->setProperty($property,$value);
70
-			}
71
-			else{
71
+			} else{
72 72
 				return $this;
73 73
 			}
74 74
 		}
@@ -163,10 +163,12 @@  discard block
 block discarded – undo
163 163
 	public function addButtonIcon($identifier,$icon,$cssStyle=NULL,$onClick=NULL){
164 164
 		$bt=new HtmlButton($identifier);
165 165
 		$bt->asIcon($icon);
166
-		if(isset($onClick))
167
-			$bt->onClick($onClick);
168
-		if (isset($cssStyle))
169
-			$bt->addClass($cssStyle);
166
+		if(isset($onClick)) {
167
+					$bt->onClick($onClick);
168
+		}
169
+		if (isset($cssStyle)) {
170
+					$bt->addClass($cssStyle);
171
+		}
170 172
 		return $this->addItem($bt);
171 173
 	}
172 174
 
Please login to merge, or discard this patch.
Ajax/semantic/traits/SemanticHtmlCollectionsTrait.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function htmlMessage($identifier, $content="",$styles=NULL) {
37 37
 		$msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content));
38
-		if(isset($msg) && $styles!==null)
39
-			$msg->setStyle($styles);
38
+		if(isset($msg) && $styles!==null) {
39
+					$msg->setStyle($styles);
40
+		}
40 41
 		return $msg;
41 42
 	}
42 43
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Braces   +22 added lines, -15 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function addHeader($title, $niveau=1, $dividing=true) {
60 60
 		$header=new HtmlHeader("", $niveau, $title);
61
-		if ($dividing)
62
-			$header->setDividing();
61
+		if ($dividing) {
62
+					$header->setDividing();
63
+		}
63 64
 		return $this->addItem($header);
64 65
 	}
65 66
 
@@ -87,8 +88,9 @@  discard block
 block discarded – undo
87 88
 					if (\is_string($end)) {
88 89
 						$label=$end;
89 90
 						\array_pop($fields);
90
-					} else
91
-						$label=NULL;
91
+					} else {
92
+											$label=NULL;
93
+					}
92 94
 				}
93 95
 				$this->_fields=\array_merge($this->_fields, $fields);
94 96
 				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
@@ -152,27 +154,31 @@  discard block
 block discarded – undo
152 154
 	 */
153 155
 	public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) {
154 156
 		$message=new HtmlMessage($identifier, $content);
155
-		if (isset($header))
156
-			$message->addHeader($header);
157
-		if (isset($icon))
158
-			$message->setIcon($icon);
159
-		if (isset($type))
160
-			$message->setStyle($type);
157
+		if (isset($header)) {
158
+					$message->addHeader($header);
159
+		}
160
+		if (isset($icon)) {
161
+					$message->setIcon($icon);
162
+		}
163
+		if (isset($type)) {
164
+					$message->setStyle($type);
165
+		}
161 166
 		return $this->addItem($message);
162 167
 	}
163 168
 
164 169
 
165 170
 
166 171
 	public function compile(JsUtils $js=NULL,&$view=NULL){
167
-		if(\sizeof($this->_validationParams)>0)
168
-			$this->setProperty("novalidate", "");
172
+		if(\sizeof($this->_validationParams)>0) {
173
+					$this->setProperty("novalidate", "");
174
+		}
169 175
 		return parent::compile($js,$view);
170 176
 	}
171 177
 
172 178
 	public function run(JsUtils $js) {
173 179
 		if(isset($js)){
174 180
 			$compo=$js->semantic()->form("#".$this->identifier);
175
-		}else{
181
+		} else{
176 182
 			$compo=new Form();
177 183
 			$compo->attach("#".$this->identifier);
178 184
 		}
@@ -185,8 +191,9 @@  discard block
 block discarded – undo
185 191
 			if($field instanceof HtmlFormFields){
186 192
 				$items=$field->getItems();
187 193
 				foreach ($items as $_field){
188
-					if($_field instanceof HtmlFormField)
189
-						$this->addCompoValidation($compo, $_field);
194
+					if($_field instanceof HtmlFormField) {
195
+											$this->addCompoValidation($compo, $_field);
196
+					}
190 197
 				}
191 198
 			}
192 199
 		}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
60 60
 		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
61 61
 		$retour = $this->_addJsCondition($jsCondition, $retour);
62
-		if ($immediatly)
63
-			$this->jquery_code_for_compile[] = $retour;
62
+		if ($immediatly) {
63
+					$this->jquery_code_for_compile[] = $retour;
64
+		}
64 65
 		return $retour;
65 66
 	}
66 67
 
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
115 116
 			} elseif (\substr($attr, 0, 3) === "js:") {
116 117
 				$retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n";
117
-			} elseif ($attr !== null && $attr !== "")
118
-				$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
118
+			} elseif ($attr !== null && $attr !== "") {
119
+							$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
120
+			}
119 121
 		}
120 122
 		return $retour;
121 123
 	}
@@ -139,10 +141,11 @@  discard block
 block discarded – undo
139 141
 			} elseif (isset($this->ajaxTransition)) {
140 142
 				$call = $this->ajaxTransition;
141 143
 			}
142
-			if (\is_callable($call))
143
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
144
-			else
145
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
144
+			if (\is_callable($call)) {
145
+							$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
146
+			} else {
147
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
148
+			}
146 149
 		}
147 150
 		if (isset($history)) {
148 151
 			if ($this->params["autoActiveLinks"]) {
@@ -165,8 +168,9 @@  discard block
 block discarded – undo
165 168
 	}
166 169
 
167 170
 	protected function _correctAjaxUrl($url) {
168
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
169
-			$url = substr($url, 0, strlen($url) - 1);
171
+		if ($url !== "/" && JString::endsWith($url, "/") === true) {
172
+					$url = substr($url, 0, strlen($url) - 1);
173
+		}
170 174
 		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
171 175
 			$url = $this->getUrl($url);
172 176
 		}
@@ -190,8 +194,9 @@  discard block
 block discarded – undo
190 194
 	public static function _implodeParams($parameters) {
191 195
 		$allParameters = [];
192 196
 		foreach ($parameters as $params) {
193
-			if (isset($params))
194
-				$allParameters[] = self::_correctParams($params);
197
+			if (isset($params)) {
198
+							$allParameters[] = self::_correctParams($params);
199
+			}
195 200
 		}
196 201
 		return \implode("+'&'+", $allParameters);
197 202
 	}
@@ -217,8 +222,9 @@  discard block
 block discarded – undo
217 222
 
218 223
 	protected function setDefaultParameters(&$parameters, $default) {
219 224
 		foreach ($default as $k => $v) {
220
-			if (! isset($parameters[$k]))
221
-				$parameters[$k] = $v;
225
+			if (! isset($parameters[$k])) {
226
+							$parameters[$k] = $v;
227
+			}
222 228
 		}
223 229
 	}
224 230
 
@@ -746,8 +752,9 @@  discard block
 block discarded – undo
746 752
 			$retour .= "$('#" . $form . "').submit();\n";
747 753
 		}
748 754
 		$retour = $this->_addJsCondition($jsCondition, $retour);
749
-		if ($immediatly)
750
-			$this->jquery_code_for_compile[] = $retour;
755
+		if ($immediatly) {
756
+					$this->jquery_code_for_compile[] = $retour;
757
+		}
751 758
 		return $retour;
752 759
 	}
753 760
 
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsActionsTrait.php 1 patch
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 			$callback = ", function(){\n{$callback}\n}";
35 35
 		}
36 36
 		$str = "$({$element}).{$action}({$speed}{$callback});";
37
-		if ($immediatly)
38
-			$this->jquery_code_for_compile[] = $str;
37
+		if ($immediatly) {
38
+					$this->jquery_code_for_compile[] = $str;
39
+		}
39 40
 		return $str;
40 41
 	}
41 42
 
@@ -73,10 +74,12 @@  discard block
 block discarded – undo
73 74
 		if (isset($param)) {
74 75
 			$param = Javascript::prep_value($param);
75 76
 			$str = "$({$element}).{$jQueryCall}({$param});";
76
-		} else
77
-			$str = "$({$element}).{$jQueryCall}();";
78
-		if ($immediatly)
79
-			$this->jquery_code_for_compile[] = $str;
77
+		} else {
78
+					$str = "$({$element}).{$jQueryCall}();";
79
+		}
80
+		if ($immediatly) {
81
+					$this->jquery_code_for_compile[] = $str;
82
+		}
80 83
 		return $str;
81 84
 	}
82 85
 
@@ -94,8 +97,9 @@  discard block
 block discarded – undo
94 97
 		$to = Javascript::prep_element($to);
95 98
 		$element = Javascript::prep_element($element);
96 99
 		$str = "$({$to}).{$jQueryCall}({$element});";
97
-		if ($immediatly)
98
-			$this->jquery_code_for_compile[] = $str;
100
+		if ($immediatly) {
101
+					$this->jquery_code_for_compile[] = $str;
102
+		}
99 103
 		return $str;
100 104
 	}
101 105
 
@@ -153,10 +157,12 @@  discard block
 block discarded – undo
153 157
 		if (isset($value)) {
154 158
 			$value = Javascript::prep_value($value);
155 159
 			$str = "$({$element}).attr(\"$attributeName\",{$value});";
156
-		} else
157
-			$str = "$({$element}).attr(\"$attributeName\");";
158
-		if ($immediatly)
159
-			$this->jquery_code_for_compile[] = $str;
160
+		} else {
161
+					$str = "$({$element}).attr(\"$attributeName\");";
162
+		}
163
+		if ($immediatly) {
164
+					$this->jquery_code_for_compile[] = $str;
165
+		}
160 166
 		return $str;
161 167
 	}
162 168
 
@@ -219,8 +225,9 @@  discard block
 block discarded – undo
219 225
 
220 226
 		$str = "$({$element}).animate({\n$animations\n\t\t}" . $speed . $extra . ");";
221 227
 
222
-		if ($immediatly)
223
-			$this->jquery_code_for_compile[] = $str;
228
+		if ($immediatly) {
229
+					$this->jquery_code_for_compile[] = $str;
230
+		}
224 231
 		return $str;
225 232
 	}
226 233
 
@@ -410,8 +417,9 @@  discard block
 block discarded – undo
410 417
 		$element = Javascript::prep_element($element);
411 418
 		$str = "$({$element}).trigger(\"$event\");";
412 419
 
413
-		if ($immediatly)
414
-			$this->jquery_code_for_compile[] = $str;
420
+		if ($immediatly) {
421
+					$this->jquery_code_for_compile[] = $str;
422
+		}
415 423
 		return $str;
416 424
 	}
417 425
 
@@ -481,8 +489,9 @@  discard block
 block discarded – undo
481 489
 			$str .= "else{" . $jsCodeIfFalse . "}";
482 490
 		}
483 491
 
484
-		if ($immediatly)
485
-			$this->jquery_code_for_compile[] = $str;
492
+		if ($immediatly) {
493
+					$this->jquery_code_for_compile[] = $str;
494
+		}
486 495
 		return $str;
487 496
 	}
488 497
 
@@ -500,11 +509,13 @@  discard block
 block discarded – undo
500 509
 	private function _doJQuery($element, $jqueryCall, $param = "", $jsCallback = "", $immediatly = false) {
501 510
 		$param = Javascript::prep_value($param);
502 511
 		$callback = "";
503
-		if ($jsCallback != "")
504
-			$callback = ", function(event){\n{$jsCallback}\n}";
512
+		if ($jsCallback != "") {
513
+					$callback = ", function(event){\n{$jsCallback}\n}";
514
+		}
505 515
 		$script = "$(" . Javascript::prep_element($element) . ")." . $jqueryCall . "(" . $param . $callback . ");\n";
506
-		if ($immediatly)
507
-			$this->jquery_code_for_compile[] = $script;
516
+		if ($immediatly) {
517
+					$this->jquery_code_for_compile[] = $script;
518
+		}
508 519
 		return $script;
509 520
 	}
510 521
 
@@ -591,8 +602,9 @@  discard block
 block discarded – undo
591 602
 	 */
592 603
 	public function exec($js, $immediatly = false) {
593 604
 		$script = $js . "\n";
594
-		if ($immediatly)
595
-			$this->jquery_code_for_compile[] = $script;
605
+		if ($immediatly) {
606
+					$this->jquery_code_for_compile[] = $script;
607
+		}
596 608
 		return $script;
597 609
 	}
598 610
 
Please login to merge, or discard this patch.