@@ -10,15 +10,15 @@ discard block |
||
10 | 10 | class HtmlCardHeaderContent extends HtmlCardContent { |
11 | 11 | |
12 | 12 | public function __construct($identifier, $header=NULL, $metas=array(), $description=NULL) { |
13 | - parent::__construct($identifier, array ()); |
|
13 | + parent::__construct($identifier, array()); |
|
14 | 14 | if (isset($header)) { |
15 | 15 | $this->setHeader($header); |
16 | 16 | } |
17 | 17 | if (\is_array($metas)) { |
18 | - foreach ( $metas as $meta ) { |
|
18 | + foreach ($metas as $meta) { |
|
19 | 19 | $this->addMeta($meta); |
20 | 20 | } |
21 | - } else |
|
21 | + }else |
|
22 | 22 | $this->addMeta($metas); |
23 | 23 | if (isset($description)) { |
24 | 24 | $this->setDescription($description); |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | public function setDescription($value) { |
29 | - $this->content["description"]=new HtmlSemDoubleElement("description-" . $this->identifier, "div", "description", $value); |
|
29 | + $this->content["description"]=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $value); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function setHeader($value) { |
33 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
33 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
41 | 41 | */ |
42 | 42 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
43 | - $this->content=JArray::sortAssociative($this->content, [ "header","meta","description" ]); |
|
43 | + $this->content=JArray::sortAssociative($this->content, ["header", "meta", "description"]); |
|
44 | 44 | return parent::compile($js, $view); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -18,8 +18,9 @@ |
||
18 | 18 | foreach ( $metas as $meta ) { |
19 | 19 | $this->addMeta($meta); |
20 | 20 | } |
21 | - } else |
|
22 | - $this->addMeta($metas); |
|
21 | + } else { |
|
22 | + $this->addMeta($metas); |
|
23 | + } |
|
23 | 24 | if (isset($description)) { |
24 | 25 | $this->setDescription($description); |
25 | 26 | } |
@@ -12,22 +12,22 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | public function addMeta($value, $direction=Direction::LEFT) { |
15 | - if (\array_key_exists("meta", $this->content) === false) { |
|
16 | - $this->content["meta"]=array (); |
|
15 | + if (\array_key_exists("meta", $this->content)===false) { |
|
16 | + $this->content["meta"]=array(); |
|
17 | 17 | } |
18 | - $meta=new HtmlSemDoubleElement("meta-" . \sizeof($this->content["meta"]) . "" . $this->identifier, "div", "meta", $value); |
|
18 | + $meta=new HtmlSemDoubleElement("meta-".\sizeof($this->content["meta"])."".$this->identifier, "div", "meta", $value); |
|
19 | 19 | $this->content["meta"][]=$meta; |
20 | 20 | $meta->setFloated($direction); |
21 | 21 | return $meta; |
22 | 22 | } |
23 | 23 | |
24 | 24 | public function addContentIcon($icon, $caption=NULL, $direction=Direction::LEFT) { |
25 | - if ($direction === Direction::RIGHT) { |
|
25 | + if ($direction===Direction::RIGHT) { |
|
26 | 26 | $result=new HtmlSemDoubleElement("", "span", "", $caption); |
27 | 27 | $result->setFloated($direction); |
28 | 28 | $result->addIcon($icon); |
29 | 29 | $this->addContent($result); |
30 | - } else { |
|
30 | + }else { |
|
31 | 31 | $this->addIcon($icon); |
32 | 32 | $result=$this->addContent($caption); |
33 | 33 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->startIndex=$startIndex; |
52 | 52 | $this->autoActive=$autoActive; |
53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
54 | - $this->_hrefFunction=function ($e) { |
|
54 | + $this->_hrefFunction=function($e) { |
|
55 | 55 | return $e->getContent(); |
56 | 56 | }; |
57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setActive($index=null) { |
82 | 82 | if (!isset($index)) { |
83 | - $index=sizeof($this->content) - 1; |
|
83 | + $index=sizeof($this->content)-1; |
|
84 | 84 | } |
85 | 85 | $activeItem=$this->content[$index]; |
86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $this->startIndex=$startIndex; |
97 | 97 | $params=$dispatcher->getParams(); |
98 | 98 | $action=$dispatcher->getActionName(); |
99 | - $items=array ($dispatcher->getControllerName() ); |
|
100 | - if (\sizeof($params) > 0 || \strtolower($action) != "index") { |
|
99 | + $items=array($dispatcher->getControllerName()); |
|
100 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
101 | 101 | $items[]=$action; |
102 | - foreach ( $params as $p ) { |
|
103 | - if (\is_object($p) === false) |
|
102 | + foreach ($params as $p) { |
|
103 | + if (\is_object($p)===false) |
|
104 | 104 | $items[]=$p; |
105 | 105 | } |
106 | 106 | } |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | if (!isset($index)) { |
118 | 118 | $index=sizeof($this->content); |
119 | 119 | } |
120 | - if ($this->absolutePaths === true) { |
|
120 | + if ($this->absolutePaths===true) { |
|
121 | 121 | return $this->_hrefFunction($this->content[$index]); |
122 | - } else { |
|
123 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
122 | + }else { |
|
123 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
124 | 124 | return $this->_hrefFunction($e); |
125 | - }, $this->content), $this->startIndex, $index + 1)); |
|
125 | + }, $this->content), $this->startIndex, $index+1)); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | $this->setActive(); |
157 | 157 | } |
158 | 158 | $count=$this->count(); |
159 | - for($i=1; $i < $count; $i++) { |
|
160 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
159 | + for ($i=1; $i<$count; $i++) { |
|
160 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
161 | 161 | } |
162 | 162 | return parent::compile($js, $view); |
163 | 163 | } |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
168 | 168 | */ |
169 | 169 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
170 | - foreach ( $this->content as $element ) { |
|
170 | + foreach ($this->content as $element) { |
|
171 | 171 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
172 | 172 | } |
173 | 173 | return $this; |
174 | 174 | } |
175 | 175 | |
176 | 176 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
177 | - foreach ( $this->content as $element ) { |
|
178 | - if ($element->getProperty($this->attr) != NULL) |
|
177 | + foreach ($this->content as $element) { |
|
178 | + if ($element->getProperty($this->attr)!=NULL) |
|
179 | 179 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
180 | 180 | } |
181 | 181 | return $this; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function createItem($value) { |
191 | 191 | $count=$this->count(); |
192 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
192 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
193 | 193 | if (\is_array($value)) |
194 | 194 | $itemO->fromArray($value); |
195 | 195 | else { |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | public function addIconAt($icon, $index) { |
203 | 203 | $item=$this->getItem($index); |
204 | 204 | if (isset($item)) { |
205 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
205 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
206 | 206 | $item->wrapContent($icon); |
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | 210 | public function addItem($item) { |
211 | 211 | $itemO=parent::addItem($item); |
212 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
212 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
213 | 213 | return $itemO; |
214 | 214 | } |
215 | 215 |
@@ -100,8 +100,9 @@ discard block |
||
100 | 100 | if (\sizeof($params) > 0 || \strtolower($action) != "index") { |
101 | 101 | $items[]=$action; |
102 | 102 | foreach ( $params as $p ) { |
103 | - if (\is_object($p) === false) |
|
104 | - $items[]=$p; |
|
103 | + if (\is_object($p) === false) { |
|
104 | + $items[]=$p; |
|
105 | + } |
|
105 | 106 | } |
106 | 107 | } |
107 | 108 | return $this->addItems($items); |
@@ -175,8 +176,9 @@ discard block |
||
175 | 176 | |
176 | 177 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
177 | 178 | foreach ( $this->content as $element ) { |
178 | - if ($element->getProperty($this->attr) != NULL) |
|
179 | - $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
179 | + if ($element->getProperty($this->attr) != NULL) { |
|
180 | + $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
181 | + } |
|
180 | 182 | } |
181 | 183 | return $this; |
182 | 184 | } |
@@ -190,9 +192,9 @@ discard block |
||
190 | 192 | protected function createItem($value) { |
191 | 193 | $count=$this->count(); |
192 | 194 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
193 | - if (\is_array($value)) |
|
194 | - $itemO->fromArray($value); |
|
195 | - else { |
|
195 | + if (\is_array($value)) { |
|
196 | + $itemO->fromArray($value); |
|
197 | + } else { |
|
196 | 198 | $itemO->setContent($value); |
197 | 199 | $itemO->setProperty($this->attr, $this->getHref($count)); |
198 | 200 | } |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 9 | |
10 | 10 | trait BaseTrait { |
11 | - protected $_variations=[ ]; |
|
12 | - protected $_states=[ ]; |
|
11 | + protected $_variations=[]; |
|
12 | + protected $_states=[]; |
|
13 | 13 | protected $_baseClass; |
14 | 14 | |
15 | 15 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->setProperty("class", $this->_baseClass); |
38 | 38 | if (\is_string($variations)) |
39 | 39 | $variations=\explode(" ", $variations); |
40 | - foreach ( $variations as $variation ) { |
|
40 | + foreach ($variations as $variation) { |
|
41 | 41 | $this->addVariation($variation); |
42 | 42 | } |
43 | 43 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function addVariations($variations=array()) { |
52 | 52 | if (\is_string($variations)) |
53 | 53 | $variations=\explode(" ", $variations); |
54 | - foreach ( $variations as $variation ) { |
|
54 | + foreach ($variations as $variation) { |
|
55 | 55 | $this->addVariation($variation); |
56 | 56 | } |
57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addStates($states=array()) { |
61 | 61 | if (\is_string($states)) |
62 | 62 | $states=\explode(" ", $states); |
63 | - foreach ( $states as $state ) { |
|
63 | + foreach ($states as $state) { |
|
64 | 64 | $this->addState($state); |
65 | 65 | } |
66 | 66 | return $this; |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | $this->setProperty("class", $this->_baseClass); |
71 | 71 | if (\is_string($states)) |
72 | 72 | $states=\explode(" ", $states); |
73 | - foreach ( $states as $state ) { |
|
73 | + foreach ($states as $state) { |
|
74 | 74 | $this->addState($state); |
75 | 75 | } |
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addIcon($icon, $before=true) { |
80 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
80 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | public function setFloated($direction="right") { |
130 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
130 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function floatRight() { |
@@ -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 |