@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $retour.=$before; |
37 | 37 | if($hasLoader===true && JString::isNotNull($responseElement)){ |
38 | 38 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
39 | - }elseif($hasLoader==="internal"){ |
|
39 | + } elseif($hasLoader==="internal"){ |
|
40 | 40 | $retour.="\n$(this).addClass('loading');"; |
41 | 41 | } |
42 | 42 | $ajaxParameters=["url"=>"url","method"=>"'".\strtoupper($method)."'"]; |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | $retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n"; |
54 | 54 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback,$hasLoader,($historize?$originalSelector:null))."});\n"; |
55 | 55 | $retour=$this->_addJsCondition($jsCondition,$retour); |
56 | - if ($immediatly) |
|
57 | - $this->jquery_code_for_compile[]=$retour; |
|
56 | + if ($immediatly) { |
|
57 | + $this->jquery_code_for_compile[]=$retour; |
|
58 | + } |
|
58 | 59 | return $retour; |
59 | 60 | } |
60 | 61 | |
@@ -75,7 +76,7 @@ discard block |
||
75 | 76 | } |
76 | 77 | if(is_array($v)){ |
77 | 78 | $s .= "'{$k}':{".self::implodeAjaxParameters($v)."}"; |
78 | - }else{ |
|
79 | + } else{ |
|
79 | 80 | $s .= "'{$k}':{$v}"; |
80 | 81 | } |
81 | 82 | } |
@@ -100,12 +101,13 @@ discard block |
||
100 | 101 | if(JString::isNotNull($attr)){ |
101 | 102 | if ($attr==="value"){ |
102 | 103 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
103 | - }elseif ($attr==="html"){ |
|
104 | + } elseif ($attr==="html"){ |
|
104 | 105 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
105 | - }elseif(\substr($attr, 0,3)==="js:"){ |
|
106 | + } elseif(\substr($attr, 0,3)==="js:"){ |
|
106 | 107 | $retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n"; |
107 | - }elseif($attr!==null && $attr!=="") |
|
108 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
108 | + } elseif($attr!==null && $attr!=="") { |
|
109 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
110 | + } |
|
109 | 111 | } |
110 | 112 | return $retour; |
111 | 113 | } |
@@ -125,13 +127,14 @@ discard block |
||
125 | 127 | if (JString::isNotNull($responseElement)) { |
126 | 128 | if(isset($ajaxTransition)){ |
127 | 129 | $call=$this->setAjaxDataCall($ajaxTransition); |
128 | - }elseif(isset($this->ajaxTransition)){ |
|
130 | + } elseif(isset($this->ajaxTransition)){ |
|
129 | 131 | $call=$this->ajaxTransition; |
130 | 132 | } |
131 | - if(\is_callable($call)) |
|
132 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
133 | - else |
|
134 | - $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
133 | + if(\is_callable($call)) { |
|
134 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
135 | + } else { |
|
136 | + $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
137 | + } |
|
135 | 138 | } |
136 | 139 | if(isset($history)){ |
137 | 140 | if($this->params["autoActiveLinks"]){ |
@@ -154,8 +157,9 @@ discard block |
||
154 | 157 | } |
155 | 158 | |
156 | 159 | protected function _correctAjaxUrl($url) { |
157 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
158 | - $url=substr($url, 0, strlen($url)-1); |
|
160 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
161 | + $url=substr($url, 0, strlen($url)-1); |
|
162 | + } |
|
159 | 163 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
160 | 164 | $url=$this->getUrl($url); |
161 | 165 | } |
@@ -169,7 +173,7 @@ discard block |
||
169 | 173 | if(\preg_match("@^\{.*?\}$@", $params)){ |
170 | 174 | if( !isset($ajaxParameters['contentType'])|| !UString::contains('json', $ajaxParameters['contentType'])){ |
171 | 175 | return '$.param('.$params.')'; |
172 | - }else{ |
|
176 | + } else{ |
|
173 | 177 | return 'JSON.stringify('.$params.')'; |
174 | 178 | } |
175 | 179 | } |
@@ -179,8 +183,9 @@ discard block |
||
179 | 183 | public static function _implodeParams($parameters){ |
180 | 184 | $allParameters=[]; |
181 | 185 | foreach ($parameters as $params){ |
182 | - if(isset($params)) |
|
183 | - $allParameters[]=self::_correctParams($params); |
|
186 | + if(isset($params)) { |
|
187 | + $allParameters[]=self::_correctParams($params); |
|
188 | + } |
|
184 | 189 | } |
185 | 190 | return \implode("+'&'+", $allParameters); |
186 | 191 | } |
@@ -206,8 +211,9 @@ discard block |
||
206 | 211 | |
207 | 212 | protected function setDefaultParameters(&$parameters,$default){ |
208 | 213 | foreach ($default as $k=>$v){ |
209 | - if(!isset($parameters[$k])) |
|
210 | - $parameters[$k]=$v; |
|
214 | + if(!isset($parameters[$k])) { |
|
215 | + $parameters[$k]=$v; |
|
216 | + } |
|
211 | 217 | } |
212 | 218 | } |
213 | 219 | |
@@ -340,7 +346,7 @@ discard block |
||
340 | 346 | if($context===null){ |
341 | 347 | $parent="$('".$maskSelector."').parent()"; |
342 | 348 | $newElm = "$('#'+newId)"; |
343 | - }else{ |
|
349 | + } else{ |
|
344 | 350 | $parent=$context; |
345 | 351 | $newElm = $context.".find('#'+newId)"; |
346 | 352 | } |
@@ -567,7 +573,7 @@ discard block |
||
567 | 573 | $retour.="var self=this;\n"; |
568 | 574 | if($hasLoader===true){ |
569 | 575 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
570 | - }elseif($hasLoader==="internal"){ |
|
576 | + } elseif($hasLoader==="internal"){ |
|
571 | 577 | $retour.="\n$(this).addClass('loading');"; |
572 | 578 | } |
573 | 579 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -585,8 +591,9 @@ discard block |
||
585 | 591 | $retour.="$('#".$form."').submit();\n"; |
586 | 592 | } |
587 | 593 | $retour=$this->_addJsCondition($jsCondition, $retour); |
588 | - if ($immediatly) |
|
589 | - $this->jquery_code_for_compile[]=$retour; |
|
594 | + if ($immediatly) { |
|
595 | + $this->jquery_code_for_compile[]=$retour; |
|
596 | + } |
|
590 | 597 | return $retour; |
591 | 598 | } |
592 | 599 |
@@ -35,8 +35,9 @@ |
||
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 |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | public function compile($internal=false) { |
45 | - if ($internal===false&&$this->autoCompile===true) |
|
46 | - throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
45 | + if ($internal===false&&$this->autoCompile===true) { |
|
46 | + throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
47 | + } |
|
47 | 48 | foreach ( $this->components as $component ) { |
48 | 49 | $component->compile(); |
49 | 50 | } |
@@ -60,13 +61,14 @@ discard block |
||
60 | 61 | $this->components [$attachTo]=$component; |
61 | 62 | } |
62 | 63 | $component->attach($attachTo); |
63 | - }else{ |
|
64 | + } else{ |
|
64 | 65 | $this->components []=$component; |
65 | 66 | } |
66 | 67 | } |
67 | - if (isset($params)) |
|
68 | - if (\is_array($params)) |
|
68 | + if (isset($params)) { |
|
69 | + if (\is_array($params)) |
|
69 | 70 | $component->setParams($params); |
71 | + } |
|
70 | 72 | return $component; |
71 | 73 | } |
72 | 74 |
@@ -58,8 +58,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -71,8 +71,9 @@ discard block |
||
71 | 71 | if($index<$menu->count()){ |
72 | 72 | if(isset($this->content[$index])===false){ |
73 | 73 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
74 | - }else |
|
75 | - $this->content[$index]->setContent($content); |
|
74 | + } else { |
|
75 | + $this->content[$index]->setContent($content); |
|
76 | + } |
|
76 | 77 | } |
77 | 78 | return $this; |
78 | 79 | } |
@@ -239,15 +240,17 @@ discard block |
||
239 | 240 | * @see BaseHtml::run() |
240 | 241 | */ |
241 | 242 | public function run(JsUtils $js) { |
242 | - if(isset($this->_bsComponent)===false) |
|
243 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
243 | + if(isset($this->_bsComponent)===false) { |
|
244 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
245 | + } |
|
244 | 246 | $this->addEventsOnRun($js); |
245 | 247 | return $this->_bsComponent; |
246 | 248 | } |
247 | 249 | |
248 | 250 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
249 | - if(!$this->_activated && $this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
250 | - $this->activate(0); |
|
251 | + if(!$this->_activated && $this->content["menu"]->count()>0 && \sizeof($this->content)>1) { |
|
252 | + $this->activate(0); |
|
253 | + } |
|
251 | 254 | return parent::compile($js,$view); |
252 | 255 | } |
253 | 256 | } |