@@ -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 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $viewVars=$view->viewVars; |
14 | 14 | if (isset($viewVars["q"]) === false) { |
15 | 15 | $controls=array (); |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | $controls=$viewVars["q"]; |
18 | 18 | } |
19 | 19 | $controls[$identifier]=$content; |
@@ -17,12 +17,15 @@ discard block |
||
17 | 17 | parent::__construct($identifier, "a"); |
18 | 18 | $this->setClass("item"); |
19 | 19 | $this->setContent($content); |
20 | - if($value!==NULL) |
|
21 | - $this->setData($value); |
|
22 | - if($image!==NULL) |
|
23 | - $this->asMiniAvatar($image); |
|
24 | - if($description!==NULL) |
|
25 | - $this->setDescription($description); |
|
20 | + if($value!==NULL) { |
|
21 | + $this->setData($value); |
|
22 | + } |
|
23 | + if($image!==NULL) { |
|
24 | + $this->asMiniAvatar($image); |
|
25 | + } |
|
26 | + if($description!==NULL) { |
|
27 | + $this->setDescription($description); |
|
28 | + } |
|
26 | 29 | } |
27 | 30 | |
28 | 31 | public function setDescription($description){ |
@@ -39,8 +42,9 @@ discard block |
||
39 | 42 | |
40 | 43 | public function asOption(){ |
41 | 44 | $this->tagName="option"; |
42 | - if($this->getProperty("data-value")!==null) |
|
43 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
45 | + if($this->getProperty("data-value")!==null) { |
|
46 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
47 | + } |
|
44 | 48 | } |
45 | 49 | |
46 | 50 | /** |
@@ -31,8 +31,9 @@ |
||
31 | 31 | */ |
32 | 32 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
33 | 33 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
34 | - if(isset($msg)) |
|
35 | - $msg->setStyle($styles); |
|
34 | + if(isset($msg)) { |
|
35 | + $msg->setStyle($styles); |
|
36 | + } |
|
36 | 37 | return $msg; |
37 | 38 | } |
38 | 39 |
@@ -55,10 +55,12 @@ discard block |
||
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 |
||
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 |
@@ -18,11 +18,12 @@ |
||
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){ |
@@ -11,14 +11,15 @@ discard block |
||
11 | 11 | public function setContent($content){ |
12 | 12 | if($content==="-"){ |
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
14 | + } elseif($content==="-search-"){ |
|
15 | 15 | $values=\explode(",",$content,-1); |
16 | 16 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
17 | - }elseif(JString::startswith($content, "-")){ |
|
17 | + } elseif(JString::startswith($content, "-")){ |
|
18 | 18 | $content=\ltrim($content,"-"); |
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
21 | - parent::setContent($content); |
|
20 | + } else { |
|
21 | + parent::setContent($content); |
|
22 | + } |
|
22 | 23 | return $this; |
23 | 24 | } |
24 | 25 | |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
31 | 32 | $this->setClass("ui icon search input"); |
32 | 33 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
34 | - $input->setProperty("placeholder", $placeholder); |
|
34 | + if(isset($placeholder)) { |
|
35 | + $input->setProperty("placeholder", $placeholder); |
|
36 | + } |
|
35 | 37 | $this->content=$input; |
36 | - if(isset($icon)) |
|
37 | - $this->addIcon($icon); |
|
38 | + if(isset($icon)) { |
|
39 | + $this->addIcon($icon); |
|
40 | + } |
|
38 | 41 | return $this; |
39 | 42 | } |
40 | 43 | |
@@ -57,8 +60,9 @@ discard block |
||
57 | 60 | $this->setClass("header"); |
58 | 61 | $this->tagName="div"; |
59 | 62 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
63 | + if(isset($icon)) { |
|
64 | + $this->addIcon($icon,Direction::LEFT); |
|
65 | + } |
|
62 | 66 | return $this; |
63 | 67 | } |
64 | 68 |
@@ -29,12 +29,14 @@ discard block |
||
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 |
||
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 | |
@@ -66,8 +69,9 @@ discard block |
||
66 | 69 | if ($this->_equalWidth) { |
67 | 70 | $count=$this->count(); |
68 | 71 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
69 | - } else |
|
70 | - $this->addToProperty("class", "fields"); |
|
72 | + } else { |
|
73 | + $this->addToProperty("class", "fields"); |
|
74 | + } |
|
71 | 75 | return parent::compile($js, $view); |
72 | 76 | } |
73 | 77 | |
@@ -108,8 +112,9 @@ discard block |
||
108 | 112 | $fields[]=$itemO; |
109 | 113 | } |
110 | 114 | $radios=new HtmlFormFields("fields-".$name, $fields); |
111 | - if (isset($label)) |
|
112 | - $radios->setLabel($label)->setProperty("for", $name); |
|
115 | + if (isset($label)) { |
|
116 | + $radios->setLabel($label)->setProperty("for", $name); |
|
117 | + } |
|
113 | 118 | return $radios; |
114 | 119 | } |
115 | 120 | |
@@ -124,8 +129,9 @@ discard block |
||
124 | 129 | $fields[]=$itemO; |
125 | 130 | } |
126 | 131 | $radios=new HtmlFormFields("fields-".$name, $fields); |
127 | - if (isset($label)) |
|
128 | - $radios->setLabel($label)->setProperty("for", $name); |
|
132 | + if (isset($label)) { |
|
133 | + $radios->setLabel($label)->setProperty("for", $name); |
|
134 | + } |
|
129 | 135 | return $radios; |
130 | 136 | } |
131 | 137 |