Completed
Push — master ( 703022...edf19e )
by Jean-Christophe
03:12
created
Ajax/semantic/components/validation/FieldValidation.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,15 +43,16 @@
 block discarded – undo
43 43
 	}
44 44
 
45 45
 	public function addRule($type,$prompt=NULL,$value=NULL){
46
-		if($type instanceof  Rule)
47
-			$this->rules[]=$type;
48
-		else if(\is_array($type)){
46
+		if($type instanceof  Rule) {
47
+					$this->rules[]=$type;
48
+		} else if(\is_array($type)){
49 49
 			$value=JArray::getValue($type, "value", 2);
50 50
 			$prompt=JArray::getValue($type, "prompt", 1);
51 51
 			$type=JArray::getValue($type, "type", 0);
52 52
 			$this->rules[]=new Rule($type,$prompt,$value);
53
-		}else
54
-			$this->rules[]=new Rule($type,$prompt,$value);
53
+		} else {
54
+					$this->rules[]=new Rule($type,$prompt,$value);
55
+		}
55 56
 	}
56 57
 
57 58
 	public function jsonSerialize(){
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/Rule.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,10 +55,12 @@  discard block
 block discarded – undo
55 55
 
56 56
 	public function jsonSerialize() {
57 57
 		$result= ["type"=>$this->type];
58
-		if(isset($this->prompt))
59
-			$result["prompt"]=$this->prompt;
60
-		if(isset($this->value))
61
-			$result["value"]=$this->value;
58
+		if(isset($this->prompt)) {
59
+					$result["prompt"]=$this->prompt;
60
+		}
61
+		if(isset($this->value)) {
62
+					$result["value"]=$this->value;
63
+		}
62 64
 		return $result;
63 65
 	}
64 66
 
@@ -90,8 +92,9 @@  discard block
 block discarded – undo
90 92
 	 * @return \Ajax\semantic\components\validation\Rule
91 93
 	 */
92 94
 	public static function integer($min=NULL,$max=NULL,$prompt=NULL){
93
-		if(\is_int($min) && \is_int($max))
94
-			return new Rule("integer[{$min}..{$max}]",$prompt);
95
+		if(\is_int($min) && \is_int($max)) {
96
+					return new Rule("integer[{$min}..{$max}]",$prompt);
97
+		}
95 98
 		return new Rule("integer",$prompt);
96 99
 	}
97 100
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldTrait.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@
 block discarded – undo
44 44
 		$actionO=$action;
45 45
 		if (\is_object($action) === false) {
46 46
 			$actionO=new HtmlButton("action-" . $this->identifier, $action);
47
-			if (isset($icon))
48
-				$actionO->addIcon($icon, true, $labeled);
47
+			if (isset($icon)) {
48
+							$actionO->addIcon($icon, true, $labeled);
49
+			}
49 50
 		}
50 51
 		$this->addToProperty("class", $direction . " action");
51 52
 		$this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false);
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldsTrait.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,11 +18,12 @@
 block discarded – undo
18 18
 		if(\is_array($value)){
19 19
 			$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)));
20 20
 			return $itemO;
21
-		}elseif(\is_object($value)){
21
+		} elseif(\is_object($value)){
22 22
 			$itemO=new HtmlFormField("field-".$this->identifier, $value);
23 23
 			return $itemO;
24
-		}else
25
-			return new HtmlFormInput($value);
24
+		} else {
25
+					return new HtmlFormInput($value);
26
+		}
26 27
 	}
27 28
 
28 29
 	protected function createCondition($value){
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/CheckboxTrait.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,8 +43,9 @@  discard block
 block discarded – undo
43 43
 
44 44
 	public function getDataField(){
45 45
 		$field= $this->getField();
46
-		if($field instanceof AbstractCheckbox)
47
-			$field=$field->getField();
46
+		if($field instanceof AbstractCheckbox) {
47
+					$field=$field->getField();
48
+		}
48 49
 			return $field;
49 50
 	}
50 51
 
@@ -56,7 +57,7 @@  discard block
 block discarded – undo
56 57
 	public function setChecked($value=true){
57 58
 		if($value===true){
58 59
 			$this->getDataField()->setProperty("checked", "checked");
59
-		}else{
60
+		} else{
60 61
 			$this->getDataField()->removeProperty("checked");
61 62
 		}
62 63
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/checkbox/AbstractCheckbox.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,14 +13,15 @@  discard block
 block discarded – undo
13 13
 		$field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value);
14 14
 		$field->setProperty("name", $name);
15 15
 		$this->setField($field);
16
-		if (isset($label))
17
-			$this->setLabel($label);
16
+		if (isset($label)) {
17
+					$this->setLabel($label);
18
+		}
18 19
 	}
19 20
 
20 21
 	public function setChecked($value=true){
21 22
 		if($value===true){
22 23
 			$this->getField()->setProperty("checked", "checked");
23
-		}else{
24
+		} else{
24 25
 			$this->getField()->removeProperty("checked");
25 26
 		}
26 27
 		return $this;
@@ -49,8 +50,9 @@  discard block
 block discarded – undo
49 50
 	 * @return mixed
50 51
 	 */
51 52
 	public function getLabel() {
52
-		if (\array_key_exists("label", $this->content))
53
-			return $this->content["label"];
53
+		if (\array_key_exists("label", $this->content)) {
54
+					return $this->content["label"];
55
+		}
54 56
 	}
55 57
 
56 58
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButton.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function setFocusable($value=true) {
58
-		if ($value === true)
59
-			$this->setProperty("tabindex", "0");
60
-		else {
58
+		if ($value === true) {
59
+					$this->setProperty("tabindex", "0");
60
+		} else {
61 61
 			$this->removeProperty("tabindex");
62 62
 		}
63 63
 		return $this;
@@ -175,8 +175,9 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	public static function social($identifier, $social, $value=NULL) {
178
-		if ($value === NULL)
179
-			$value=\ucfirst($social);
178
+		if ($value === NULL) {
179
+					$value=\ucfirst($social);
180
+		}
180 181
 		$return=new HtmlButton($identifier, $value);
181 182
 		$return->addIcon($social);
182 183
 		return $return->addToPropertyCtrl("class", $social, Social::getConstants());
Please login to merge, or discard this patch.
Ajax/common/components/SimpleComponent.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 		foreach ( $this->events as $event => $jsCode ) {
25 25
 			if($event=="execute"){
26 26
 				$this->jquery_code_for_compile []=$jsCode;
27
-			}else if($event=="beforeExecute"){
27
+			} else if($event=="beforeExecute"){
28 28
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
29
-			}else{
29
+			} else{
30 30
 				$selector=$this->attachTo;
31 31
 				if(isset($this->itemSelector)){
32 32
 					$selector.=" ".$this->itemSelector;
@@ -75,8 +75,9 @@  discard block
 block discarded – undo
75 75
 
76 76
 	protected function setParamCtrl($key, $value, $typeCtrl) {
77 77
 		if (is_array($typeCtrl)) {
78
-			if (array_search($value, $typeCtrl)===false)
79
-				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
78
+			if (array_search($value, $typeCtrl)===false) {
79
+							throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
80
+			}
80 81
 		} else {
81 82
 			if (!$typeCtrl($value)) {
82 83
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Braces   +27 added lines, -20 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, $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
 	}
@@ -74,7 +77,7 @@  discard block
 block discarded – undo
74 77
 			if(JString::startswith($responseElement, "\"-")===true){
75 78
 				$responseElement=\str_replace("\"-", "\"", $responseElement);
76 79
 				$retour="\t$({$responseElement}).replaceWith( data );\n";
77
-			}else{
80
+			} else{
78 81
 				$retour="\t$({$responseElement}).html( data );\n";
79 82
 			}
80 83
 		}
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
 	}
91 94
 
92 95
 	protected function _correctAjaxUrl($url) {
93
-		if ($url!=="/" && JString::endsWith($url, "/")===true)
94
-			$url=substr($url, 0, strlen($url)-1);
96
+		if ($url!=="/" && JString::endsWith($url, "/")===true) {
97
+					$url=substr($url, 0, strlen($url)-1);
98
+		}
95 99
 		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
96 100
 			$url=$this->jsUtils->getUrl($url);
97 101
 		}
@@ -115,8 +119,9 @@  discard block
 block discarded – undo
115 119
 				$retour.="\t".$jsCallback."\n".
116 120
 						"\t$(document).trigger('jsonReady',[data]);\n".
117 121
 						"});\n";
118
-				if ($immediatly)
119
-					$this->jquery_code_for_compile[]=$retour;
122
+				if ($immediatly) {
123
+									$this->jquery_code_for_compile[]=$retour;
124
+				}
120 125
 					return $retour;
121 126
 	}
122 127
 
@@ -155,7 +160,7 @@  discard block
 block discarded – undo
155 160
 		if($context===null){
156 161
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
157 162
 			$newElm = "$('#'+newId)";
158
-		}else{
163
+		} else{
159 164
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
160 165
 			$newElm = $context.".find('#'+newId)";
161 166
 		}
@@ -165,8 +170,9 @@  discard block
 block discarded – undo
165 170
 		$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 171
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
167 172
 		$retour.="\t".$jsCallback."\n"."});\n";
168
-		if ($immediatly)
169
-			$this->jquery_code_for_compile[]=$retour;
173
+		if ($immediatly) {
174
+					$this->jquery_code_for_compile[]=$retour;
175
+		}
170 176
 			return $retour;
171 177
 	}
172 178
 	/**
@@ -207,8 +213,9 @@  discard block
 block discarded – undo
207 213
 			}});\n";
208 214
 			$retour.="$('#".$form."').submit();\n";
209 215
 		}
210
-		if ($immediatly)
211
-			$this->jquery_code_for_compile[]=$retour;
216
+		if ($immediatly) {
217
+					$this->jquery_code_for_compile[]=$retour;
218
+		}
212 219
 			return $retour;
213 220
 	}
214 221
 
Please login to merge, or discard this patch.