@@ -13,7 +13,7 @@ |
||
13 | 13 | * @param int $rowCount |
14 | 14 | * @param int $colCount |
15 | 15 | */ |
16 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
16 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
17 | 17 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
18 | 18 | } |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -6,6 +6,9 @@ |
||
6 | 6 | |
7 | 7 | trait CheckboxTrait { |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $name |
|
11 | + */ |
|
9 | 12 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
10 | 13 | |
11 | 14 | public function setType($checkboxType) { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
16 | 16 | use CheckboxTrait; |
17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function slider($identifier, $label="", $value=NULL) { |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
32 | + }else |
|
33 | 33 | $label=NULL; |
34 | 34 | } |
35 | 35 | } |
36 | 36 | if (isset($label)) |
37 | 37 | $this->setLabel($label); |
38 | - foreach ( $fields as $field ) { |
|
38 | + foreach ($fields as $field) { |
|
39 | 39 | $this->addItem($field); |
40 | 40 | } |
41 | 41 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($this->_equalWidth) { |
66 | 66 | $count=$this->count(); |
67 | 67 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
68 | + }else |
|
69 | 69 | $this->addToProperty("class", "fields"); |
70 | 70 | return parent::compile($js, $view); |
71 | 71 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
99 | - $fields=array (); |
|
99 | + $fields=array(); |
|
100 | 100 | $i=0; |
101 | - foreach ( $items as $val => $caption ) { |
|
101 | + foreach ($items as $val => $caption) { |
|
102 | 102 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
103 | 103 | if ($val===$value) { |
104 | 104 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
115 | - $fields=array (); |
|
115 | + $fields=array(); |
|
116 | 116 | $i=0; |
117 | - foreach ( $items as $val => $caption ) { |
|
117 | + foreach ($items as $val => $caption) { |
|
118 | 118 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
119 | 119 | if (\array_search($val, $values)!==false) { |
120 | 120 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -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 | } |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | if ($this->_equalWidth) { |
66 | 68 | $count=$this->count(); |
67 | 69 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
69 | - $this->addToProperty("class", "fields"); |
|
70 | + } else { |
|
71 | + $this->addToProperty("class", "fields"); |
|
72 | + } |
|
70 | 73 | return parent::compile($js, $view); |
71 | 74 | } |
72 | 75 | |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | $fields[]=$itemO; |
107 | 110 | } |
108 | 111 | $radios=new HtmlFormFields("fields-".$name, $fields); |
109 | - if (isset($label)) |
|
110 | - $radios->setLabel($label)->setProperty("for", $name); |
|
112 | + if (isset($label)) { |
|
113 | + $radios->setLabel($label)->setProperty("for", $name); |
|
114 | + } |
|
111 | 115 | return $radios; |
112 | 116 | } |
113 | 117 | |
@@ -122,8 +126,9 @@ discard block |
||
122 | 126 | $fields[]=$itemO; |
123 | 127 | } |
124 | 128 | $radios=new HtmlFormFields("fields-".$name, $fields); |
125 | - if (isset($label)) |
|
126 | - $radios->setLabel($label)->setProperty("for", $name); |
|
129 | + if (isset($label)) { |
|
130 | + $radios->setLabel($label)->setProperty("for", $name); |
|
131 | + } |
|
127 | 132 | return $radios; |
128 | 133 | } |
129 | 134 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
6 | 6 | use Ajax\semantic\html\base\constants\Wide; |
7 | 7 | use Ajax\JsUtils; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
10 | 9 | use Ajax\semantic\html\collections\form\traits\FieldsTrait; |
11 | 10 |
@@ -15,6 +15,9 @@ |
||
15 | 15 | protected $_equalWidth; |
16 | 16 | protected $_name; |
17 | 17 | |
18 | + /** |
|
19 | + * @param string $identifier |
|
20 | + */ |
|
18 | 21 | public function __construct($identifier, $fields=array(), $equalWidth=true) { |
19 | 22 | parent::__construct($identifier, "div"); |
20 | 23 | $this->_equalWidth=$equalWidth; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
7 | 7 | |
8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
9 | - protected $_params=array (); |
|
9 | + protected $_params=array(); |
|
10 | 10 | |
11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
74 | 74 | */ |
75 | 75 | public function attachEvent($selector, $action=NULL) { |
76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
80 | 80 | } |
81 | 81 | $js=\str_replace("%identifier%", $this->identifier, $js); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function attachEvents($events=array()) { |
91 | 91 | if (\is_array($events)) { |
92 | - foreach ( $events as $action => $selector ) { |
|
92 | + foreach ($events as $action => $selector) { |
|
93 | 93 | $this->attachEvent($selector, $action); |
94 | 94 | } |
95 | 95 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
14 | 14 | $field->setProperty("name", $name); |
15 | 15 | $this->setField($field); |
16 | - if (isset($label)) |
|
17 | - $this->setLabel($label); |
|
16 | + if (isset($label)) { |
|
17 | + $this->setLabel($label); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public function setType($checkboxType) { |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | * @return mixed |
41 | 42 | */ |
42 | 43 | public function getLabel() { |
43 | - if (\array_key_exists("label", $this->content)) |
|
44 | - return $this->content["label"]; |
|
44 | + if (\array_key_exists("label", $this->content)) { |
|
45 | + return $this->content["label"]; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | |
47 | 49 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | private function afterInsert($item) { |
58 | - if (!$item instanceof HtmlMenu) |
|
59 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
60 | - else { |
|
58 | + if (!$item instanceof HtmlMenu) { |
|
59 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
60 | + } else { |
|
61 | 61 | $this->setSecondary(); |
62 | 62 | } |
63 | 63 | return $item; |
@@ -155,8 +155,9 @@ discard block |
||
155 | 155 | $this->apply(function (HtmlDoubleElement &$item) { |
156 | 156 | $item->setTagName("a"); |
157 | 157 | }); |
158 | - if ($vertical === true) |
|
159 | - $this->setVertical(); |
|
158 | + if ($vertical === true) { |
|
159 | + $this->setVertical(); |
|
160 | + } |
|
160 | 161 | return $this->addToProperty("class", "tabular"); |
161 | 162 | } |
162 | 163 | |
@@ -185,10 +186,11 @@ discard block |
||
185 | 186 | */ |
186 | 187 | public function fromDatabaseObject($object, $function) { |
187 | 188 | $return=$function($object); |
188 | - if (\is_array($return)) |
|
189 | - $this->addItems($return); |
|
190 | - else |
|
191 | - $this->addItem($return); |
|
189 | + if (\is_array($return)) { |
|
190 | + $this->addItems($return); |
|
191 | + } else { |
|
192 | + $this->addItem($return); |
|
193 | + } |
|
192 | 194 | } |
193 | 195 | |
194 | 196 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Sets the menu type |
35 | 35 | * @param string $type one of text,item |
36 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
36 | + * @return HtmlMenu |
|
37 | 37 | */ |
38 | 38 | public function setType($type="") { |
39 | 39 | return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
@@ -81,6 +81,7 @@ discard block |
||
81 | 81 | * {@inheritDoc} |
82 | 82 | * |
83 | 83 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
84 | + * @param HtmlIcon $item |
|
84 | 85 | */ |
85 | 86 | public function insertItem($item, $position=0) { |
86 | 87 | $item=parent::insertItem($this->getItemToInsert($item), $position); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @return \Ajax\semantic\html\collections\HtmlMenu |
37 | 37 | */ |
38 | 38 | public function setType($type="") { |
39 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
39 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function setActiveItem($index) { |
43 | 43 | $item=$this->getItem($index); |
44 | - if ($item !== null) { |
|
44 | + if ($item!==null) { |
|
45 | 45 | $item->addToProperty("class", "active"); |
46 | 46 | } |
47 | 47 | return $this; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | private function getItemToInsert($item) { |
51 | 51 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
52 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
52 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
53 | 53 | $itemO->setContent($item); |
54 | 54 | $item=$itemO; |
55 | 55 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | private function afterInsert($item) { |
60 | 60 | if (!$item instanceof HtmlMenu) |
61 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
61 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
62 | 62 | else { |
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | public function generateMenuAsItem($menu, $header=null) { |
91 | 91 | $count=$this->count(); |
92 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
92 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
93 | 93 | if (isset($header)) { |
94 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
94 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
95 | 95 | $headerItem->setContent($header); |
96 | 96 | $item->addContent($headerItem); |
97 | 97 | $this->_itemHeader=$headerItem; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
110 | 110 | $value->addContent(new HtmlIcon("", "dropdown")); |
111 | 111 | $value=$this->addItem($value); |
112 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
112 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
113 | 113 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
114 | 114 | $this->wrap("", $popup); |
115 | 115 | return $popup; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function addDropdownAsItem($value, $items=NULL) { |
119 | 119 | $dd=$value; |
120 | 120 | if (\is_string($value)) { |
121 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
121 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
122 | 122 | } |
123 | 123 | return $this->addItem($dd); |
124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
131 | 131 | */ |
132 | 132 | protected function createItem($value) { |
133 | - $itemO=new HtmlLink("item-" . \sizeof($this->content), "", $value); |
|
133 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
134 | 134 | return $itemO->setClass("item"); |
135 | 135 | } |
136 | 136 | |
@@ -143,28 +143,28 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | public function setVertical() { |
146 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
146 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function setPosition($value="right") { |
150 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
150 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public function setPointing($value=Direction::NONE) { |
154 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
154 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function asTab($vertical=false) { |
158 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
158 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
159 | 159 | $item->setTagName("a"); |
160 | 160 | }); |
161 | - if ($vertical === true) |
|
161 | + if ($vertical===true) |
|
162 | 162 | $this->setVertical(); |
163 | 163 | return $this->addToProperty("class", "tabular"); |
164 | 164 | } |
165 | 165 | |
166 | 166 | public function asPagination() { |
167 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
167 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
168 | 168 | $item->setTagName("a"); |
169 | 169 | }); |
170 | 170 | return $this->addToProperty("class", "pagination"); |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setWidth($width) { |
203 | 203 | if (\is_int($width)) { |
204 | - $width=Wide::getConstants()["W" . $width]; |
|
204 | + $width=Wide::getConstants()["W".$width]; |
|
205 | 205 | } |
206 | 206 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
207 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
207 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | public function addImage($identifier, $src="", $alt="") { |
@@ -30,10 +30,10 @@ |
||
30 | 30 | */ |
31 | 31 | public function setWidth($width) { |
32 | 32 | if (\is_int($width)) { |
33 | - $width=Wide::getConstants()["W" . $width]; |
|
33 | + $width=Wide::getConstants()["W".$width]; |
|
34 | 34 | } |
35 | 35 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
36 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
36 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function setValue($value) { |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | public function __construct($identifier, $width=NULL) { |
21 | 21 | parent::__construct($identifier, "div"); |
22 | 22 | $this->setClass("column"); |
23 | - if (isset($width)) |
|
24 | - $this->setWidth($width); |
|
23 | + if (isset($width)) { |
|
24 | + $this->setWidth($width); |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | /** |
@@ -48,10 +49,11 @@ discard block |
||
48 | 49 | |
49 | 50 | public function addDivider($vertical=true, $content=NULL) { |
50 | 51 | $divider=new HtmlDivider("", $content); |
51 | - if ($vertical) |
|
52 | - $divider->setVertical(); |
|
53 | - else |
|
54 | - $divider->setHorizontal(); |
|
52 | + if ($vertical) { |
|
53 | + $divider->setVertical(); |
|
54 | + } else { |
|
55 | + $divider->setHorizontal(); |
|
56 | + } |
|
55 | 57 | $this->wrap("", $divider); |
56 | 58 | return $divider; |
57 | 59 | } |
@@ -11,12 +11,24 @@ |
||
11 | 11 | protected $_states=[ ]; |
12 | 12 | protected $_baseClass; |
13 | 13 | |
14 | + /** |
|
15 | + * @param string $name |
|
16 | + */ |
|
14 | 17 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
15 | 18 | |
19 | + /** |
|
20 | + * @param string $name |
|
21 | + */ |
|
16 | 22 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
17 | 23 | |
24 | + /** |
|
25 | + * @param string $name |
|
26 | + */ |
|
18 | 27 | protected abstract function addToPropertyCtrlCheck($name, $value, $typeCtrl); |
19 | 28 | |
29 | + /** |
|
30 | + * @param string $name |
|
31 | + */ |
|
20 | 32 | public abstract function addToProperty($name, $value, $separator=" "); |
21 | 33 | |
22 | 34 | public function addVariation($variation) { |
@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | public function setVariations($variations) { |
36 | 36 | $this->setProperty("class", $this->_baseClass); |
37 | - if (\is_string($variations)) |
|
38 | - $variations=\explode(" ", $variations); |
|
37 | + if (\is_string($variations)) { |
|
38 | + $variations=\explode(" ", $variations); |
|
39 | + } |
|
39 | 40 | foreach ( $variations as $variation ) { |
40 | 41 | $this->addVariation($variation); |
41 | 42 | } |
@@ -48,8 +49,9 @@ discard block |
||
48 | 49 | } |
49 | 50 | |
50 | 51 | public function addVariations($variations=array()) { |
51 | - if (\is_string($variations)) |
|
52 | - $variations=\explode(" ", $variations); |
|
52 | + if (\is_string($variations)) { |
|
53 | + $variations=\explode(" ", $variations); |
|
54 | + } |
|
53 | 55 | foreach ( $variations as $variation ) { |
54 | 56 | $this->addVariation($variation); |
55 | 57 | } |
@@ -57,8 +59,9 @@ discard block |
||
57 | 59 | } |
58 | 60 | |
59 | 61 | public function addStates($states=array()) { |
60 | - if (\is_string($states)) |
|
61 | - $states=\explode(" ", $states); |
|
62 | + if (\is_string($states)) { |
|
63 | + $states=\explode(" ", $states); |
|
64 | + } |
|
62 | 65 | foreach ( $states as $state ) { |
63 | 66 | $this->addState($state); |
64 | 67 | } |
@@ -67,8 +70,9 @@ discard block |
||
67 | 70 | |
68 | 71 | public function setStates($states) { |
69 | 72 | $this->setProperty("class", $this->_baseClass); |
70 | - if (\is_string($states)) |
|
71 | - $states=\explode(" ", $states); |
|
73 | + if (\is_string($states)) { |
|
74 | + $states=\explode(" ", $states); |
|
75 | + } |
|
72 | 76 | foreach ( $states as $state ) { |
73 | 77 | $this->addState($state); |
74 | 78 | } |
@@ -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() { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | class JArray { |
6 | 6 | |
7 | 7 | public static function isAssociative($array) { |
8 | - return (array_values($array) !== $array); |
|
8 | + return (array_values($array)!==$array); |
|
9 | 9 | // return (array_keys($array)!==range(0, count($array)-1)); |
10 | 10 | } |
11 | 11 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
17 | + if ($pos<sizeof($values)) |
|
18 | 18 | return $values[$pos]; |
19 | 19 | } |
20 | 20 | |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | $result=NULL; |
23 | 23 | if (array_key_exists($key, $array)) { |
24 | 24 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
25 | + if ($condition($result)===true) |
|
26 | 26 | return $result; |
27 | 27 | } |
28 | 28 | $values=array_values($array); |
29 | - foreach ( $values as $val ) { |
|
30 | - if ($condition($val) === true) |
|
29 | + foreach ($values as $val) { |
|
30 | + if ($condition($val)===true) |
|
31 | 31 | return $val; |
32 | 32 | } |
33 | 33 | return $result; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 37 | if (array_key_exists($key, $array)) { |
38 | 38 | return $array[$key]; |
39 | - } else |
|
39 | + }else |
|
40 | 40 | return $default; |
41 | 41 | } |
42 | 42 | |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | $result=""; |
45 | 45 | if (\is_array($glue)) { |
46 | 46 | $size=\sizeof($pieces); |
47 | - if ($size > 0) { |
|
48 | - for($i=0; $i < $size - 1; $i++) { |
|
49 | - $result.=$pieces[$i] . @$glue[$i]; |
|
47 | + if ($size>0) { |
|
48 | + for ($i=0; $i<$size-1; $i++) { |
|
49 | + $result.=$pieces[$i].@$glue[$i]; |
|
50 | 50 | } |
51 | - $result.=$pieces[$size - 1]; |
|
51 | + $result.=$pieces[$size-1]; |
|
52 | 52 | } |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | $result=\implode($glue, $pieces); |
55 | 55 | } |
56 | 56 | return $result; |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | |
59 | 59 | public static function dimension($array) { |
60 | 60 | if (is_array(reset($array))) { |
61 | - $return=self::dimension(reset($array)) + 1; |
|
62 | - } else { |
|
61 | + $return=self::dimension(reset($array))+1; |
|
62 | + }else { |
|
63 | 63 | $return=1; |
64 | 64 | } |
65 | 65 | return $return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | public static function sortAssociative($array, $sortedKeys=array()) { |
69 | - $newArray=array (); |
|
70 | - foreach ( $sortedKeys as $key ) { |
|
69 | + $newArray=array(); |
|
70 | + foreach ($sortedKeys as $key) { |
|
71 | 71 | if (\array_key_exists($key, $array)) { |
72 | 72 | $newArray[$key]=$array[$key]; |
73 | 73 | } |
@@ -14,21 +14,24 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
18 | - return $values[$pos]; |
|
17 | + if ($pos < sizeof($values)) { |
|
18 | + return $values[$pos]; |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | |
21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
22 | 23 | $result=NULL; |
23 | 24 | if (array_key_exists($key, $array)) { |
24 | 25 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
26 | - return $result; |
|
26 | + if ($condition($result) === true) { |
|
27 | + return $result; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | $values=array_values($array); |
29 | 31 | foreach ( $values as $val ) { |
30 | - if ($condition($val) === true) |
|
31 | - return $val; |
|
32 | + if ($condition($val) === true) { |
|
33 | + return $val; |
|
34 | + } |
|
32 | 35 | } |
33 | 36 | return $result; |
34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 40 | if (array_key_exists($key, $array)) { |
38 | 41 | return $array[$key]; |
39 | - } else |
|
40 | - return $default; |
|
42 | + } else { |
|
43 | + return $default; |
|
44 | + } |
|
41 | 45 | } |
42 | 46 | |
43 | 47 | public static function implode($glue, $pieces) { |