@@ -21,17 +21,17 @@ |
||
21 | 21 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::run() |
22 | 22 | */ |
23 | 23 | public function run(JsUtils $js) { |
24 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
24 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
25 | 25 | $this->addEventsOnRun($js); |
26 | 26 | return $this->_bsComponent; |
27 | 27 | } |
28 | 28 | |
29 | - public function addIcon($icon){ |
|
30 | - return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon),true); |
|
29 | + public function addIcon($icon) { |
|
30 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), true); |
|
31 | 31 | } |
32 | 32 | |
33 | - public static function icon($identifier,$icon,$href="#",$label=NULL){ |
|
34 | - $result=new HtmlLink($identifier,$href,$label); |
|
33 | + public static function icon($identifier, $icon, $href="#", $label=NULL) { |
|
34 | + $result=new HtmlLink($identifier, $href, $label); |
|
35 | 35 | return $result->addIcon($icon); |
36 | 36 | } |
37 | 37 | // TODO use Class Tag |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return \Ajax\semantic\html\HtmlIcon |
85 | 85 | */ |
86 | 86 | public function setFlipped($sens="horizontally") { |
87 | - return $this->addToMember($this->attributes, "flipped " . $sens); |
|
87 | + return $this->addToMember($this->attributes, "flipped ".$sens); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return \Ajax\semantic\html\HtmlIcon |
94 | 94 | */ |
95 | 95 | public function setRotated($sens="clockwise") { |
96 | - return $this->addToMember($this->attributes, "rotated " . $sens); |
|
96 | + return $this->addToMember($this->attributes, "rotated ".$sens); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function asLink($href=NULL) { |
104 | 104 | if (isset($href)) { |
105 | - $this->wrap("<a href='" . $href . "'>", "</a>"); |
|
105 | + $this->wrap("<a href='".$href."'>", "</a>"); |
|
106 | 106 | } |
107 | 107 | return $this->addToMember($this->attributes, "link"); |
108 | 108 | } |
109 | 109 | |
110 | 110 | public function setCircular($inverted=false) { |
111 | 111 | $invertedStr=""; |
112 | - if ($inverted !== false) |
|
112 | + if ($inverted!==false) |
|
113 | 113 | $invertedStr=" inverted"; |
114 | - return $this->addToMember($this->attributes, "circular" . $invertedStr); |
|
114 | + return $this->addToMember($this->attributes, "circular".$invertedStr); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function setBordered($inverted=false) { |
135 | 135 | $invertedStr=""; |
136 | - if ($inverted !== false) |
|
136 | + if ($inverted!==false) |
|
137 | 137 | $invertedStr=" inverted"; |
138 | - return $this->addToMember($this->attributes, "bordered" . $invertedStr); |
|
138 | + return $this->addToMember($this->attributes, "bordered".$invertedStr); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -109,8 +109,9 @@ discard block |
||
109 | 109 | |
110 | 110 | public function setCircular($inverted=false) { |
111 | 111 | $invertedStr=""; |
112 | - if ($inverted !== false) |
|
113 | - $invertedStr=" inverted"; |
|
112 | + if ($inverted !== false) { |
|
113 | + $invertedStr=" inverted"; |
|
114 | + } |
|
114 | 115 | return $this->addToMember($this->attributes, "circular" . $invertedStr); |
115 | 116 | } |
116 | 117 | |
@@ -133,8 +134,9 @@ discard block |
||
133 | 134 | */ |
134 | 135 | public function setBordered($inverted=false) { |
135 | 136 | $invertedStr=""; |
136 | - if ($inverted !== false) |
|
137 | - $invertedStr=" inverted"; |
|
137 | + if ($inverted !== false) { |
|
138 | + $invertedStr=" inverted"; |
|
139 | + } |
|
138 | 140 | return $this->addToMember($this->attributes, "bordered" . $invertedStr); |
139 | 141 | } |
140 | 142 |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | public function __construct($identifier, $src="", $alt="", $size=NULL) { |
12 | 12 | $image=new HtmlImg("img-", $src, $alt); |
13 | 13 | parent::__construct($identifier, "div", "ui image", $image); |
14 | - if (isset($size)) |
|
15 | - $this->setSize($size); |
|
14 | + if (isset($size)) { |
|
15 | + $this->setSize($size); |
|
16 | + } |
|
16 | 17 | } |
17 | 18 | |
18 | 19 | public function setCircular() { |
@@ -20,8 +21,9 @@ discard block |
||
20 | 21 | } |
21 | 22 | |
22 | 23 | public function asAvatar($caption=NULL) { |
23 | - if (isset($caption)) |
|
24 | - $this->wrap("", $caption); |
|
24 | + if (isset($caption)) { |
|
25 | + $this->wrap("", $caption); |
|
26 | + } |
|
25 | 27 | return $this->addToProperty("class", "avatar"); |
26 | 28 | } |
27 | 29 |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | class HtmlCard extends HtmlSemDoubleElement { |
17 | 17 | |
18 | 18 | public function __construct($identifier) { |
19 | - parent::__construct($identifier, "div", "ui card", array ()); |
|
19 | + parent::__construct($identifier, "div", "ui card", array()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | private function createContent($content, $baseClass="content") { |
23 | 23 | $count=\sizeof($this->content); |
24 | - $result=new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content); |
|
24 | + $result=new HtmlCardContent("content-".$count."-".$this->identifier, $content); |
|
25 | 25 | $result->setClass($baseClass); |
26 | 26 | return $result; |
27 | 27 | } |
28 | 28 | |
29 | 29 | private function addElementInContent($key, $element) { |
30 | - if (\array_key_exists($key, $this->content) === false) { |
|
31 | - $this->content[$key]=array (); |
|
30 | + if (\array_key_exists($key, $this->content)===false) { |
|
31 | + $this->content[$key]=array(); |
|
32 | 32 | } |
33 | 33 | $this->content[$key][]=$element; |
34 | 34 | return $element; |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | |
37 | 37 | public function addHeader($header, $niveau=4, $type="page") { |
38 | 38 | if (!$header instanceof HtmlHeader) { |
39 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
39 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
40 | 40 | } |
41 | 41 | $this->content["header"]=$this->createContent($header); |
42 | 42 | } |
43 | 43 | |
44 | 44 | public function addImage($image, $title="") { |
45 | 45 | if (!$image instanceof HtmlImage) { |
46 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
46 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
47 | 47 | } |
48 | 48 | $image->setClass("image"); |
49 | 49 | return $this->addElementInContent("content", $image); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
53 | 53 | $reveal=$visibleContent; |
54 | 54 | if (!$visibleContent instanceof HtmlReveal) { |
55 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
55 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
56 | 56 | } |
57 | 57 | return $this->addElementInContent("content", $reveal); |
58 | 58 | } |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | |
79 | 79 | public function addCardHeaderContent($header, $metas=array(), $description=NULL) { |
80 | 80 | $count=\sizeof($this->content); |
81 | - return $this->addElementInContent("content", new HtmlCardHeaderContent("content-" . $count . "-" . $this->identifier, $header, $metas, $description)); |
|
81 | + return $this->addElementInContent("content", new HtmlCardHeaderContent("content-".$count."-".$this->identifier, $header, $metas, $description)); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function addCardContent($content=array()) { |
85 | 85 | $count=\sizeof($this->content); |
86 | - return $this->addElementInContent("content", new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content)); |
|
86 | + return $this->addElementInContent("content", new HtmlCardContent("content-".$count."-".$this->identifier, $content)); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
94 | 94 | */ |
95 | 95 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
96 | - $this->content=JArray::sortAssociative($this->content, [ "header","image","content","extra-content" ]); |
|
96 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]); |
|
97 | 97 | return parent::compile($js, $view); |
98 | 98 | } |
99 | 99 | } |
100 | 100 | \ No newline at end of file |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | $output=$input; |
13 | 13 | } |
14 | 14 | if (is_array($input)) { |
15 | - if (sizeof($input) > 0) { |
|
16 | - if (self::containsElement($input) === false) { |
|
15 | + if (sizeof($input)>0) { |
|
16 | + if (self::containsElement($input)===false) { |
|
17 | 17 | $output=self::wrapStrings($input, $js, $separator=' ', $valueQuote='"'); |
18 | - } else { |
|
18 | + }else { |
|
19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
20 | 20 | } |
21 | 21 | } |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
28 | - if (\is_object($v) === true || \is_array($v)) |
|
27 | + foreach ($input as $v) { |
|
28 | + if (\is_object($v)===true || \is_array($v)) |
|
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function wrapStrings($input, $js, $separator=' ', $valueQuote='"') { |
35 | - if (JArray::isAssociative($input) === true) { |
|
36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
35 | + if (JArray::isAssociative($input)===true) { |
|
36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
38 | 38 | }, $input, array_keys($input))); |
39 | - } else { |
|
39 | + }else { |
|
40 | 40 | $result=implode($separator, array_values($input)); |
41 | 41 | } |
42 | 42 | return $result; |
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
47 | 47 | if (is_object($v)) |
48 | 48 | return $v->compile($js); |
49 | 49 | elseif (\is_array($v)) { |
50 | 50 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } else |
|
51 | + }else |
|
52 | 52 | return $v; |
53 | 53 | }, $input)); |
54 | 54 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | 27 | foreach ( $input as $v ) { |
28 | - if (\is_object($v) === true || \is_array($v)) |
|
29 | - return true; |
|
28 | + if (\is_object($v) === true || \is_array($v)) { |
|
29 | + return true; |
|
30 | + } |
|
30 | 31 | } |
31 | 32 | return false; |
32 | 33 | } |
@@ -44,12 +45,13 @@ discard block |
||
44 | 45 | |
45 | 46 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | 47 | return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
47 | - if (is_object($v)) |
|
48 | - return $v->compile($js); |
|
49 | - elseif (\is_array($v)) { |
|
48 | + if (is_object($v)) { |
|
49 | + return $v->compile($js); |
|
50 | + } elseif (\is_array($v)) { |
|
50 | 51 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } else |
|
52 | - return $v; |
|
52 | + } else { |
|
53 | + return $v; |
|
54 | + } |
|
53 | 55 | }, $input)); |
54 | 56 | } |
55 | 57 | } |
56 | 58 | \ No newline at end of file |
@@ -24,8 +24,8 @@ |
||
24 | 24 | use Ajax\semantic\traits\SemanticHtmlViewsTrait; |
25 | 25 | |
26 | 26 | class Semantic extends BaseGui { |
27 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
28 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait; |
|
27 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
28 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait; |
|
29 | 29 | |
30 | 30 | public function __construct($autoCompile=true) { |
31 | 31 | parent::__construct($autoCompile=true); |