@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | public function render($attributes=null) { |
| 53 | 53 | $attrs=$this->element->getAttributes(); |
| 54 | - foreach ( $attrs as $key => $value ) { |
|
| 54 | + foreach ($attrs as $key => $value) { |
|
| 55 | 55 | $this->htmlElement->setProperty($key, $value); |
| 56 | 56 | } |
| 57 | 57 | if (isset($attributes)) |
@@ -54,8 +54,9 @@ |
||
| 54 | 54 | foreach ( $attrs as $key => $value ) { |
| 55 | 55 | $this->htmlElement->setProperty($key, $value); |
| 56 | 56 | } |
| 57 | - if (isset($attributes)) |
|
| 58 | - $this->htmlElement->addProperties($attributes); |
|
| 57 | + if (isset($attributes)) { |
|
| 58 | + $this->htmlElement->addProperties($attributes); |
|
| 59 | + } |
|
| 59 | 60 | $this->htmlElement->setIdentifier($this->element->getName()); |
| 60 | 61 | $this->htmlElement->setValue($this->element->getValue()); |
| 61 | 62 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | parent::__construct($name, $attributes); |
| 14 | 14 | $list=new HtmlSelect($name); |
| 15 | 15 | $list->setTagName("select"); |
| 16 | - $this->renderer=new PhBsRenderer(new Select($name, array (), $attributes), $list); |
|
| 16 | + $this->renderer=new PhBsRenderer(new Select($name, array(), $attributes), $list); |
|
| 17 | 17 | $this->setOptions($options); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function __construct($autoCompile=true) { |
| 29 | 29 | $this->autoCompile=$autoCompile; |
| 30 | - $this->components=array (); |
|
| 31 | - $this->htmlComponents=array (); |
|
| 30 | + $this->components=array(); |
|
| 31 | + $this->htmlComponents=array(); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function isAutoCompile() { |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function compile($internal=false) { |
| 44 | - if ($internal===false&&$this->autoCompile===true) |
|
| 44 | + if ($internal===false && $this->autoCompile===true) |
|
| 45 | 45 | throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
| 46 | - foreach ( $this->components as $component ) { |
|
| 46 | + foreach ($this->components as $component) { |
|
| 47 | 47 | $component->compile(); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function compileHtml(JsUtils $js=NULL, View $view=NULL) { |
| 73 | - foreach ( $this->htmlComponents as $htmlComponent ) { |
|
| 73 | + foreach ($this->htmlComponents as $htmlComponent) { |
|
| 74 | 74 | $htmlComponent->compile($js, $view); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function compile($internal=false) { |
| 44 | - if ($internal===false&&$this->autoCompile===true) |
|
| 45 | - throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
| 44 | + if ($internal===false&&$this->autoCompile===true) { |
|
| 45 | + throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
| 46 | + } |
|
| 46 | 47 | foreach ( $this->components as $component ) { |
| 47 | 48 | $component->compile(); |
| 48 | 49 | } |
@@ -54,13 +55,16 @@ discard block |
||
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | public function addComponent(SimpleComponent $component, $attachTo, $params) { |
| 57 | - if ($this->autoCompile) |
|
| 58 | - $this->components []=$component; |
|
| 59 | - if (isset($attachTo)) |
|
| 60 | - $component->attach($attachTo); |
|
| 61 | - if (isset($params)) |
|
| 62 | - if (is_array($params)) |
|
| 58 | + if ($this->autoCompile) { |
|
| 59 | + $this->components []=$component; |
|
| 60 | + } |
|
| 61 | + if (isset($attachTo)) { |
|
| 62 | + $component->attach($attachTo); |
|
| 63 | + } |
|
| 64 | + if (isset($params)) { |
|
| 65 | + if (is_array($params)) |
|
| 63 | 66 | $component->setParams($params); |
| 67 | + } |
|
| 64 | 68 | return $component; |
| 65 | 69 | } |
| 66 | 70 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function compile($keyAndvalues) { |
| 27 | 27 | $result=$this->mask; |
| 28 | - foreach ( $keyAndvalues as $k => $v ) { |
|
| 28 | + foreach ($keyAndvalues as $k => $v) { |
|
| 29 | 29 | $result=str_ireplace("%{$k}%", $v, $result); |
| 30 | 30 | } |
| 31 | 31 | return $result; |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | class DefaultConfig extends Config { |
| 8 | 8 | |
| 9 | 9 | public function __construct() { |
| 10 | - parent::__construct(array ( |
|
| 11 | - "formElementsPrefix" => array ( |
|
| 10 | + parent::__construct(array( |
|
| 11 | + "formElementsPrefix" => array( |
|
| 12 | 12 | "txt" => "input_text", |
| 13 | 13 | "btn" => "button", |
| 14 | 14 | "ck" => "checkbox", |
@@ -60,10 +60,10 @@ |
||
| 60 | 60 | |
| 61 | 61 | protected function replaceVersionAndTheme($url, $version, $theme) { |
| 62 | 62 | if (isset($theme)) |
| 63 | - return str_ireplace(array ( |
|
| 63 | + return str_ireplace(array( |
|
| 64 | 64 | "%theme%", |
| 65 | 65 | "%version%" |
| 66 | - ), array ( |
|
| 66 | + ), array( |
|
| 67 | 67 | $theme, |
| 68 | 68 | $version |
| 69 | 69 | ), $url); |
@@ -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 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | if ($stopPropagation===true) { |
| 31 | 31 | $result.="event.stopPropagation();\n"; |
| 32 | 32 | } |
| 33 | - switch($this->method) { |
|
| 33 | + switch ($this->method) { |
|
| 34 | 34 | case "get": |
| 35 | 35 | $result.=$js->getDeferred($url, $responseElement, $params, $callback, $attr); |
| 36 | 36 | break; |
@@ -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; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function __construct(JsUtils $js) { |
| 18 | 18 | parent::__construct($js); |
| 19 | - $this->params=array ( |
|
| 19 | + $this->params=array( |
|
| 20 | 20 | "active" => 0 |
| 21 | 21 | ); |
| 22 | 22 | $this->uiName="accordion"; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return $this |
| 113 | 113 | */ |
| 114 | 114 | public function setHeightStyle($value) { |
| 115 | - return $this->setParamCtrl("heightStyle", $value, array ( |
|
| 115 | + return $this->setParamCtrl("heightStyle", $value, array( |
|
| 116 | 116 | "auto", |
| 117 | 117 | "fill", |
| 118 | 118 | "content" |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | * @return $this |
| 50 | 50 | */ |
| 51 | 51 | public function setAnimate($value) { |
| 52 | - if ($value instanceof Animation) |
|
| 53 | - $value=$value->getParams(); |
|
| 54 | - else if (is_string($value)) { |
|
| 52 | + if ($value instanceof Animation) { |
|
| 53 | + $value=$value->getParams(); |
|
| 54 | + } else if (is_string($value)) { |
|
| 55 | 55 | $animation=new Animation(); |
| 56 | 56 | $animation->setEasing($value); |
| 57 | 57 | } |