@@ -14,8 +14,9 @@ |
||
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 | $result=""; |
20 | 21 | $params="{}"; |
21 | 22 | $callback=NULL; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | if(isset($router)===true){ |
14 | 14 | try { |
15 | 15 | $url=$router->generate($url); |
16 | - }catch (\Exception $e){ |
|
16 | + } catch (\Exception $e){ |
|
17 | 17 | return $router->getContext()->getBaseUrl(); |
18 | 18 | } |
19 | 19 | } |
@@ -61,8 +61,9 @@ |
||
61 | 61 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
62 | 62 | $items[]=$action; |
63 | 63 | foreach ($params as $p){ |
64 | - if(\is_object($p)===false) |
|
65 | - $items[]=$p; |
|
64 | + if(\is_object($p)===false) { |
|
65 | + $items[]=$p; |
|
66 | + } |
|
66 | 67 | } |
67 | 68 | } |
68 | 69 | return $items; |
@@ -6,8 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class JsUtils extends \Ajax\JsUtils{ |
8 | 8 | public function getUrl($url){ |
9 | - if($url==="") |
|
10 | - $url="/"; |
|
9 | + if($url==="") { |
|
10 | + $url="/"; |
|
11 | + } |
|
11 | 12 | return Url::toRoute($url); |
12 | 13 | } |
13 | 14 |
@@ -33,11 +33,13 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | protected function getUrlOrCss($element, $key) { |
36 | - if (isset($element)) |
|
37 | - return $element; |
|
36 | + if (isset($element)) { |
|
37 | + return $element; |
|
38 | + } |
|
38 | 39 | $version=$this->version; |
39 | - if (array_search($version, $this->getVersions())===false) |
|
40 | - $version=$this->getLastVersion(); |
|
40 | + if (array_search($version, $this->getVersions())===false) { |
|
41 | + $version=$this->getLastVersion(); |
|
42 | + } |
|
41 | 43 | return $this->replaceVersion($this->data [$this->provider] [$key], $version); |
42 | 44 | } |
43 | 45 | |
@@ -59,16 +61,17 @@ discard block |
||
59 | 61 | } |
60 | 62 | |
61 | 63 | protected function replaceVersionAndTheme($url, $version, $theme) { |
62 | - if (isset($theme)) |
|
63 | - return str_ireplace(array ( |
|
64 | + if (isset($theme)) { |
|
65 | + return str_ireplace(array ( |
|
64 | 66 | "%theme%", |
65 | 67 | "%version%" |
66 | 68 | ), array ( |
67 | 69 | $theme, |
68 | 70 | $version |
69 | 71 | ), $url); |
70 | - else |
|
71 | - return $this->replaceVersion($url, $version); |
|
72 | + } else { |
|
73 | + return $this->replaceVersion($url, $version); |
|
74 | + } |
|
72 | 75 | } |
73 | 76 | |
74 | 77 | public function getProviders() { |
@@ -76,10 +79,11 @@ discard block |
||
76 | 79 | } |
77 | 80 | |
78 | 81 | public function getVersions($provider=NULL) { |
79 | - if (isset($provider)) |
|
80 | - return $this->data [$provider] ["versions"]; |
|
81 | - else |
|
82 | - return $this->data [$this->provider] ["versions"]; |
|
82 | + if (isset($provider)) { |
|
83 | + return $this->data [$provider] ["versions"]; |
|
84 | + } else { |
|
85 | + return $this->data [$this->provider] ["versions"]; |
|
86 | + } |
|
83 | 87 | } |
84 | 88 | |
85 | 89 | public function getLastVersion($provider=NULL) { |
@@ -14,10 +14,11 @@ discard block |
||
14 | 14 | $this->data=$this->data ["JQueryUI"]; |
15 | 15 | if (is_int($theme)) { |
16 | 16 | $themes=$this->getThemes(); |
17 | - if (sizeof($themes)>$theme-1) |
|
18 | - $this->theme=$themes [$theme-1]; |
|
19 | - else |
|
20 | - throw new \Exception("CDNGuiGen : Le numéro de thème demandé n'existe pas"); |
|
17 | + if (sizeof($themes)>$theme-1) { |
|
18 | + $this->theme=$themes [$theme-1]; |
|
19 | + } else { |
|
20 | + throw new \Exception("CDNGuiGen : Le numéro de thème demandé n'existe pas"); |
|
21 | + } |
|
21 | 22 | } |
22 | 23 | $this->theme=$theme; |
23 | 24 | $this->cssUrl=null; |
@@ -28,16 +29,18 @@ discard block |
||
28 | 29 | } |
29 | 30 | |
30 | 31 | public function getThemes($provider=NULL) { |
31 | - if (isset($provider)) |
|
32 | - return $this->data [$provider] ["themes"]; |
|
33 | - else |
|
34 | - return $this->data [$this->provider] ["themes"]; |
|
32 | + if (isset($provider)) { |
|
33 | + return $this->data [$provider] ["themes"]; |
|
34 | + } else { |
|
35 | + return $this->data [$this->provider] ["themes"]; |
|
36 | + } |
|
35 | 37 | } |
36 | 38 | |
37 | 39 | public function getFirstTheme($provider=NULL) { |
38 | 40 | $themes=$this->getThemes($provider); |
39 | - if (sizeof($themes)>0) |
|
40 | - return $themes [0]; |
|
41 | + if (sizeof($themes)>0) { |
|
42 | + return $themes [0]; |
|
43 | + } |
|
41 | 44 | return ""; |
42 | 45 | } |
43 | 46 | |
@@ -46,14 +49,17 @@ discard block |
||
46 | 49 | } |
47 | 50 | |
48 | 51 | public function getCss() { |
49 | - if (isset($this->cssUrl)) |
|
50 | - return $this->cssUrl; |
|
52 | + if (isset($this->cssUrl)) { |
|
53 | + return $this->cssUrl; |
|
54 | + } |
|
51 | 55 | $version=$this->version; |
52 | - if (array_search($version, $this->getVersions())===false) |
|
53 | - $version=$this->getLastVersion(); |
|
56 | + if (array_search($version, $this->getVersions())===false) { |
|
57 | + $version=$this->getLastVersion(); |
|
58 | + } |
|
54 | 59 | $theme=$this->theme; |
55 | - if (array_search($theme, $this->getThemes())===false) |
|
56 | - $theme=$this->getFirstTheme(); |
|
60 | + if (array_search($theme, $this->getThemes())===false) { |
|
61 | + $theme=$this->getFirstTheme(); |
|
62 | + } |
|
57 | 63 | return $this->replaceVersionAndTheme($this->data [$this->provider] ["css"], $version, $theme); |
58 | 64 | } |
59 | 65 |
@@ -147,10 +147,12 @@ discard block |
||
147 | 147 | if (isset($param)) { |
148 | 148 | $param=$this->_prep_value($param); |
149 | 149 | $str="$({$element}).{$jQueryCall}({$param});"; |
150 | - } else |
|
151 | - $str="$({$element}).{$jQueryCall}();"; |
|
152 | - if ($immediatly) |
|
153 | - $this->jquery_code_for_compile[]=$str; |
|
150 | + } else { |
|
151 | + $str="$({$element}).{$jQueryCall}();"; |
|
152 | + } |
|
153 | + if ($immediatly) { |
|
154 | + $this->jquery_code_for_compile[]=$str; |
|
155 | + } |
|
154 | 156 | return $str; |
155 | 157 | } |
156 | 158 | /** |
@@ -165,8 +167,9 @@ discard block |
||
165 | 167 | $to=$this->_prep_element($to); |
166 | 168 | $element=$this->_prep_element($element); |
167 | 169 | $str="$({$to}).{$jQueryCall}({$element});"; |
168 | - if ($immediatly) |
|
169 | - $this->jquery_code_for_compile[]=$str; |
|
170 | + if ($immediatly) { |
|
171 | + $this->jquery_code_for_compile[]=$str; |
|
172 | + } |
|
170 | 173 | return $str; |
171 | 174 | } |
172 | 175 | |
@@ -222,12 +225,14 @@ discard block |
||
222 | 225 | if ($stopPropagation===true) { |
223 | 226 | $js="event.stopPropagation();\n".$js; |
224 | 227 | } |
225 | - if (array_search($event, $this->jquery_events)===false) |
|
226 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
227 | - else |
|
228 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
229 | - if($immediatly) |
|
230 | - $this->jquery_code_for_compile[]=$event; |
|
228 | + if (array_search($event, $this->jquery_events)===false) { |
|
229 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
230 | + } else { |
|
231 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
232 | + } |
|
233 | + if($immediatly) { |
|
234 | + $this->jquery_code_for_compile[]=$event; |
|
235 | + } |
|
231 | 236 | return $event; |
232 | 237 | } |
233 | 238 | |
@@ -355,7 +360,9 @@ discard block |
||
355 | 360 | } |
356 | 361 | |
357 | 362 | private function minify($input) { |
358 | - if(trim($input) === "") return $input; |
|
363 | + if(trim($input) === "") { |
|
364 | + return $input; |
|
365 | + } |
|
359 | 366 | return preg_replace( |
360 | 367 | array( |
361 | 368 | // Remove comment(s) |
@@ -62,8 +62,9 @@ |
||
62 | 62 | * @see BaseHtml::run() |
63 | 63 | */ |
64 | 64 | public function run(JsUtils $js) { |
65 | - if(isset($this->_bsComponent)===false) |
|
66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
65 | + if(isset($this->_bsComponent)===false) { |
|
66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
67 | + } |
|
67 | 68 | $this->addEventsOnRun($js); |
68 | 69 | return $this->_bsComponent; |
69 | 70 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $title=@$content[1]; |
18 | 18 | $desc=@$content[2]; |
19 | 19 | $status=@$content[3]; |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $title=@$content["title"]; |
23 | 23 | $desc=@$content["description"]; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if(isset($title)===true){ |
33 | 33 | $this->setTitle($title,$desc); |
34 | 34 | } |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |