@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | protected $block = false; |
30 | 30 | |
31 | - protected $_sizes = array('default','xs','sm','lg'); |
|
31 | + protected $_sizes = array('default', 'xs', 'sm', 'lg'); |
|
32 | 32 | protected $_foundations_sizes = array( |
33 | 33 | 'xs' => 'tiny', 'xs' => 'small', 'lg' => 'large', 'default' => '', |
34 | 34 | ); |
@@ -47,32 +47,32 @@ discard block |
||
47 | 47 | |
48 | 48 | $this->setHeader('')->setFooter(''); |
49 | 49 | |
50 | - if ( isset($options["attributes"]) && is_array($options["attributes"]) ) { |
|
50 | + if (isset($options["attributes"]) && is_array($options["attributes"])) { |
|
51 | 51 | $component->setAttributes($options["attributes"]); |
52 | 52 | } |
53 | 53 | $component->setAttributes(array_merge_recursive($component->getAttributes(), array( |
54 | 54 | 'role' => 'group' |
55 | 55 | ))); |
56 | 56 | |
57 | - if ( isset($options["vertical"]) && !!$options["vertical"] ) { |
|
57 | + if (isset($options["vertical"]) && !!$options["vertical"]) { |
|
58 | 58 | $component->setClassnames('btn-group-vertical vertical'); |
59 | - } else if ( isset($options["justified"]) && !!$options["justified"] ) { |
|
59 | + } else if (isset($options["justified"]) && !!$options["justified"]) { |
|
60 | 60 | $component->addClass('btn-group-justified'); |
61 | 61 | } |
62 | 62 | |
63 | - if ( isset($options["size"]) && in_array($options["size"], $component->getSizes()) ) { |
|
63 | + if (isset($options["size"]) && in_array($options["size"], $component->getSizes())) { |
|
64 | 64 | $component->addClass('btn-group-'.$options["size"].' '.strtolower($this->_foundations_sizes["size"])); |
65 | 65 | } |
66 | - if ( isset($options["block"]) ) { |
|
66 | + if (isset($options["block"])) { |
|
67 | 67 | $component->setBlock($options["block"]); |
68 | 68 | } |
69 | 69 | if ($component->getBlock()) $component->addClass('btn-block expanded'); |
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - if ( isset($options["buttons"]) && !empty($options["buttons"]) ) { |
|
73 | + if (isset($options["buttons"]) && !empty($options["buttons"])) { |
|
74 | 74 | $component->setContent($options["buttons"]); |
75 | - } else if ( isset($options["content"]) && !empty($options["content"]) ) { |
|
75 | + } else if (isset($options["content"]) && !empty($options["content"])) { |
|
76 | 76 | $component->setContent($options["content"]); |
77 | 77 | } |
78 | 78 |
@@ -66,7 +66,9 @@ |
||
66 | 66 | if ( isset($options["block"]) ) { |
67 | 67 | $component->setBlock($options["block"]); |
68 | 68 | } |
69 | - if ($component->getBlock()) $component->addClass('btn-block expanded'); |
|
69 | + if ($component->getBlock()) { |
|
70 | + $component->addClass('btn-block expanded'); |
|
71 | + } |
|
70 | 72 | |
71 | 73 | |
72 | 74 |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function __invoke($config = array(), $options = array()) |
53 | 53 | { |
54 | - if ( is_object($options) && method_exists($options, 'toArray') ) { |
|
54 | + if (is_object($options) && method_exists($options, 'toArray')) { |
|
55 | 55 | $options = $options->toArray(); |
56 | - } else if ( is_object($options) ) { |
|
57 | - $options = (array)$options; |
|
56 | + } else if (is_object($options)) { |
|
57 | + $options = (array) $options; |
|
58 | 58 | } |
59 | 59 | |
60 | - if ( is_object($config) && method_exists($config, 'toArray') ) { |
|
60 | + if (is_object($config) && method_exists($config, 'toArray')) { |
|
61 | 61 | $config = $config->toArray(); |
62 | - } else if ( is_object($options) ) { |
|
63 | - $config = (array)$config; |
|
62 | + } else if (is_object($options)) { |
|
63 | + $config = (array) $config; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $this->setOptions($config); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->setContent($options['children']); |
94 | 94 | } |
95 | 95 | |
96 | - $this->tags = (object)$this->tags; |
|
96 | + $this->tags = (object) $this->tags; |
|
97 | 97 | |
98 | 98 | $component = clone $this; |
99 | 99 | return $component; |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @param mixed $aHTMLTableColumns |
115 | 115 | * @return self |
116 | 116 | */ |
117 | - public function buildHeaderCells ($aHTMLTableColumns) { |
|
117 | + public function buildHeaderCells($aHTMLTableColumns) { |
|
118 | 118 | $sHTMLTableHeader = ""; |
119 | 119 | $sHTMLTableColumnGroup = ""; |
120 | 120 | $aColumns = array(); |
121 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
121 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
122 | 122 | if ($aColumn["field"]) { |
123 | 123 | $aColumns[] = $aColumn["field"]; |
124 | 124 | $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | * @param mixed $aHTMLTableColumns |
139 | 139 | * @return self |
140 | 140 | */ |
141 | - public function buildFooterCells ($aHTMLTableColumns) { |
|
141 | + public function buildFooterCells($aHTMLTableColumns) { |
|
142 | 142 | $sHTMLTableFooter = ""; |
143 | 143 | $aColumns = array(); |
144 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
144 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
145 | 145 | if ($aColumn["field"]) { |
146 | 146 | $aColumns[] = $aColumn["field"]; |
147 | 147 | $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
@@ -159,16 +159,16 @@ discard block |
||
159 | 159 | * @param mixed $aHTMLTableColumns |
160 | 160 | * @return array |
161 | 161 | */ |
162 | - public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
162 | + public function buildBodyCells($aRowData, $aHTMLTableColumns) { |
|
163 | 163 | $aRows = array(); |
164 | - foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
164 | + foreach ((array) $aRowData as $iRow => $oRowData) { |
|
165 | 165 | $sCells = ""; |
166 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
166 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
167 | 167 | $mCellValue = $oRowData[$aColumn["field"]]; |
168 | 168 | if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
169 | 169 | $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
170 | 170 | } |
171 | - if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
171 | + if (isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]])) { |
|
172 | 172 | $sClassname = $aColumn["field"]; |
173 | 173 | } else { |
174 | 174 | $sClassname = "col_".$iColumn; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * generate mini table mark-up template |
199 | 199 | * @return string |
200 | 200 | */ |
201 | - public function buildMarkupTemplate () { |
|
201 | + public function buildMarkupTemplate() { |
|
202 | 202 | $aHTML = array( |
203 | 203 | "<".$this->tags->container.">", |
204 | 204 | "<".$this->tags->row.">", |
@@ -222,25 +222,25 @@ discard block |
||
222 | 222 | * generate table mark-up |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - public function buildMarkup () { |
|
225 | + public function buildMarkup() { |
|
226 | 226 | $sHTML = ""; |
227 | 227 | |
228 | 228 | $sTableID = $this->getOptions("formID"); |
229 | 229 | if (!$sTableID) { |
230 | - $sTableID = "table" . md5(microtime()); |
|
230 | + $sTableID = "table".md5(microtime()); |
|
231 | 231 | $this->options["formID"] = $sTableID; |
232 | 232 | } |
233 | 233 | |
234 | 234 | $this->getTemplate()->reset(); |
235 | - $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
236 | - $this->buildHeaderCells( $this->getOptions("columns") ); |
|
237 | - $this->buildFooterCells( $this->getOptions("footer") ); |
|
238 | - $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
235 | + $this->getTemplate()->set('s', 'TABLEID', $sTableID); |
|
236 | + $this->buildHeaderCells($this->getOptions("columns")); |
|
237 | + $this->buildFooterCells($this->getOptions("footer")); |
|
238 | + $this->buildBodyCells($this->getData(), $this->getOptions("columns")); |
|
239 | 239 | $sTemplate = $this->getOptions("template"); |
240 | 240 | if ($sTemplate == "") { |
241 | 241 | $sTemplate = $this->buildMarkupTemplate(); |
242 | 242 | } |
243 | - $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
243 | + $sHTML = $this->getTemplate()->generate($sTemplate, true); |
|
244 | 244 | return $sHTML; |
245 | 245 | } |
246 | 246 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * generate table JSON data |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function buildData () { |
|
251 | + public function buildData() { |
|
252 | 252 | $sJSON = "[]"; |
253 | 253 | if (!empty($this->data)) { |
254 | 254 | $sJSON = json_encode($this->data); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param Template $template |
273 | 273 | * @return ProductTable |
274 | 274 | */ |
275 | - public function setTemplate( $template = null ) { |
|
275 | + public function setTemplate($template = null) { |
|
276 | 276 | if ($template == null) { |
277 | 277 | $this->template = new Template; |
278 | 278 | } else { |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | * @param mixed $data |
295 | 295 | * @return ProductTable |
296 | 296 | */ |
297 | - public function setData( $data = null) { |
|
298 | - if ( is_array($data) ) { |
|
297 | + public function setData($data = null) { |
|
298 | + if (is_array($data)) { |
|
299 | 299 | $this->data = $data; |
300 | 300 | } |
301 | 301 | return $this; |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @param string $key |
307 | 307 | * @return mixed |
308 | 308 | */ |
309 | - public function getOptions( $key = "" ) { |
|
310 | - if ( !empty($key) ) { |
|
311 | - if ( isset($this->options[$key]) ) { |
|
309 | + public function getOptions($key = "") { |
|
310 | + if (!empty($key)) { |
|
311 | + if (isset($this->options[$key])) { |
|
312 | 312 | return $this->options[$key]; |
313 | 313 | } else { |
314 | 314 | return false; |
@@ -322,16 +322,16 @@ discard block |
||
322 | 322 | * @return ProductTable |
323 | 323 | */ |
324 | 324 | public function setOptions($options) { |
325 | - if ( is_array($options) ) { |
|
325 | + if (is_array($options)) { |
|
326 | 326 | $this->options = $options; |
327 | - } else if ( is_object($options) ) { |
|
328 | - $this->options = (array)$options; |
|
327 | + } else if (is_object($options)) { |
|
328 | + $this->options = (array) $options; |
|
329 | 329 | } else { |
330 | 330 | throw new \Exception("invalid table options"); |
331 | 331 | } |
332 | - if ( isset($this->options["data"]) ) { |
|
332 | + if (isset($this->options["data"])) { |
|
333 | 333 | $this->setData($this->getOptions("data")); |
334 | - unset( $this->options->data ); |
|
334 | + unset($this->options->data); |
|
335 | 335 | } |
336 | 336 | return $this; |
337 | 337 | } |
@@ -25,23 +25,23 @@ discard block |
||
25 | 25 | class Table extends Element |
26 | 26 | { |
27 | 27 | /** @var \UIComponents\Template\Template $template */ |
28 | - public $template = null; |
|
28 | + public $template = null; |
|
29 | 29 | |
30 | - /** @var array $data */ |
|
31 | - public $data = array(); |
|
30 | + /** @var array $data */ |
|
31 | + public $data = array(); |
|
32 | 32 | |
33 | - /** @var array $options */ |
|
34 | - public $options = array(); |
|
33 | + /** @var array $options */ |
|
34 | + public $options = array(); |
|
35 | 35 | |
36 | - /** @var array $tags */ |
|
37 | - public $tags = array( |
|
38 | - "container" => "table", |
|
39 | - "row" => "tr", |
|
40 | - "cell" => "td", |
|
41 | - "headcell" => "th" |
|
42 | - ); |
|
36 | + /** @var array $tags */ |
|
37 | + public $tags = array( |
|
38 | + "container" => "table", |
|
39 | + "row" => "tr", |
|
40 | + "cell" => "td", |
|
41 | + "headcell" => "th" |
|
42 | + ); |
|
43 | 43 | |
44 | - /** |
|
44 | + /** |
|
45 | 45 | * View helper entry point: |
46 | 46 | * Retrieves helper and optionally sets component options to operate on |
47 | 47 | * |
@@ -106,235 +106,235 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function render() |
108 | 108 | { |
109 | - return $this->buildMarkup(); |
|
109 | + return $this->buildMarkup(); |
|
110 | 110 | } |
111 | 111 | |
112 | - /** |
|
113 | - * generate table header HTML |
|
114 | - * @param mixed $aHTMLTableColumns |
|
115 | - * @return self |
|
116 | - */ |
|
117 | - public function buildHeaderCells ($aHTMLTableColumns) { |
|
118 | - $sHTMLTableHeader = ""; |
|
119 | - $sHTMLTableColumnGroup = ""; |
|
120 | - $aColumns = array(); |
|
121 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
122 | - if ($aColumn["field"]) { |
|
123 | - $aColumns[] = $aColumn["field"]; |
|
124 | - $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
125 | - $sHTMLTableColumnGroup .= "<column class=\"".$aColumn["field"]."\" />"; |
|
126 | - } else { |
|
127 | - $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
128 | - $sHTMLTableColumnGroup .= "<column class=\"col_".$iColumn."\" />"; |
|
129 | - } |
|
130 | - } |
|
131 | - $this->getTemplate()->set('s', 'HEADERCELLS', $sHTMLTableHeader); |
|
132 | - $this->getTemplate()->set('s', 'COLUMNGROUP', "<columns>".$sHTMLTableColumnGroup."</columns>"); |
|
133 | - return ($this); |
|
134 | - } |
|
112 | + /** |
|
113 | + * generate table header HTML |
|
114 | + * @param mixed $aHTMLTableColumns |
|
115 | + * @return self |
|
116 | + */ |
|
117 | + public function buildHeaderCells ($aHTMLTableColumns) { |
|
118 | + $sHTMLTableHeader = ""; |
|
119 | + $sHTMLTableColumnGroup = ""; |
|
120 | + $aColumns = array(); |
|
121 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
122 | + if ($aColumn["field"]) { |
|
123 | + $aColumns[] = $aColumn["field"]; |
|
124 | + $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
125 | + $sHTMLTableColumnGroup .= "<column class=\"".$aColumn["field"]."\" />"; |
|
126 | + } else { |
|
127 | + $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
128 | + $sHTMLTableColumnGroup .= "<column class=\"col_".$iColumn."\" />"; |
|
129 | + } |
|
130 | + } |
|
131 | + $this->getTemplate()->set('s', 'HEADERCELLS', $sHTMLTableHeader); |
|
132 | + $this->getTemplate()->set('s', 'COLUMNGROUP', "<columns>".$sHTMLTableColumnGroup."</columns>"); |
|
133 | + return ($this); |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * generate table footer HTML |
|
138 | - * @param mixed $aHTMLTableColumns |
|
139 | - * @return self |
|
140 | - */ |
|
141 | - public function buildFooterCells ($aHTMLTableColumns) { |
|
142 | - $sHTMLTableFooter = ""; |
|
143 | - $aColumns = array(); |
|
144 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
145 | - if ($aColumn["field"]) { |
|
146 | - $aColumns[] = $aColumn["field"]; |
|
147 | - $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
148 | - } else { |
|
149 | - $sHTMLTableFooter .= "<".$this->tags->cell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
150 | - } |
|
151 | - } |
|
152 | - $this->getTemplate()->set('s', 'FOOTERCELLS', $sHTMLTableFooter); |
|
153 | - return ($this); |
|
154 | - } |
|
136 | + /** |
|
137 | + * generate table footer HTML |
|
138 | + * @param mixed $aHTMLTableColumns |
|
139 | + * @return self |
|
140 | + */ |
|
141 | + public function buildFooterCells ($aHTMLTableColumns) { |
|
142 | + $sHTMLTableFooter = ""; |
|
143 | + $aColumns = array(); |
|
144 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
145 | + if ($aColumn["field"]) { |
|
146 | + $aColumns[] = $aColumn["field"]; |
|
147 | + $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
148 | + } else { |
|
149 | + $sHTMLTableFooter .= "<".$this->tags->cell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
150 | + } |
|
151 | + } |
|
152 | + $this->getTemplate()->set('s', 'FOOTERCELLS', $sHTMLTableFooter); |
|
153 | + return ($this); |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * generate table body HTML |
|
158 | - * @param array $aRowData |
|
159 | - * @param mixed $aHTMLTableColumns |
|
160 | - * @return array |
|
161 | - */ |
|
162 | - public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
163 | - $aRows = array(); |
|
164 | - foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
165 | - $sCells = ""; |
|
166 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
167 | - $mCellValue = $oRowData[$aColumn["field"]]; |
|
168 | - if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
|
169 | - $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
|
170 | - } |
|
171 | - if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
172 | - $sClassname = $aColumn["field"]; |
|
173 | - } else { |
|
174 | - $sClassname = "col_".$iColumn; |
|
175 | - } |
|
176 | - $sCells .= "<".$this->tags->cell." class=\"".$sClassname."\">". |
|
177 | - $mCellValue. |
|
178 | - "</".$this->tags->cell.">"; |
|
179 | - } |
|
156 | + /** |
|
157 | + * generate table body HTML |
|
158 | + * @param array $aRowData |
|
159 | + * @param mixed $aHTMLTableColumns |
|
160 | + * @return array |
|
161 | + */ |
|
162 | + public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
163 | + $aRows = array(); |
|
164 | + foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
165 | + $sCells = ""; |
|
166 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
167 | + $mCellValue = $oRowData[$aColumn["field"]]; |
|
168 | + if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
|
169 | + $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
|
170 | + } |
|
171 | + if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
172 | + $sClassname = $aColumn["field"]; |
|
173 | + } else { |
|
174 | + $sClassname = "col_".$iColumn; |
|
175 | + } |
|
176 | + $sCells .= "<".$this->tags->cell." class=\"".$sClassname."\">". |
|
177 | + $mCellValue. |
|
178 | + "</".$this->tags->cell.">"; |
|
179 | + } |
|
180 | 180 | |
181 | - $aRows[] = $sCells; |
|
182 | - } |
|
181 | + $aRows[] = $sCells; |
|
182 | + } |
|
183 | 183 | |
184 | - foreach ($aRows as $iRow => $sRow) { |
|
185 | - $this->getTemplate()->set('d', 'ROWID', "row_".$aRowData[$iRow]["productID"]); |
|
186 | - $this->getTemplate()->set('d', 'BODYCELLS', $sRow); |
|
187 | - if (($iRow % 2) == 0) { |
|
188 | - $this->getTemplate()->set('d', 'CSS_CLASS', 'even'); |
|
189 | - } else { |
|
190 | - $this->getTemplate()->set('d', 'CSS_CLASS', 'odd'); |
|
191 | - } |
|
192 | - $this->getTemplate()->next(); |
|
184 | + foreach ($aRows as $iRow => $sRow) { |
|
185 | + $this->getTemplate()->set('d', 'ROWID', "row_".$aRowData[$iRow]["productID"]); |
|
186 | + $this->getTemplate()->set('d', 'BODYCELLS', $sRow); |
|
187 | + if (($iRow % 2) == 0) { |
|
188 | + $this->getTemplate()->set('d', 'CSS_CLASS', 'even'); |
|
189 | + } else { |
|
190 | + $this->getTemplate()->set('d', 'CSS_CLASS', 'odd'); |
|
191 | + } |
|
192 | + $this->getTemplate()->next(); |
|
193 | 193 | |
194 | - } |
|
195 | - } |
|
194 | + } |
|
195 | + } |
|
196 | 196 | |
197 | - /** |
|
198 | - * generate mini table mark-up template |
|
199 | - * @return string |
|
200 | - */ |
|
201 | - public function buildMarkupTemplate () { |
|
202 | - $aHTML = array( |
|
203 | - "<".$this->tags->container.">", |
|
204 | - "<".$this->tags->row.">", |
|
205 | - "{HEADERCELLS}", |
|
206 | - "</".$this->tags->row.">", |
|
207 | - "<!-- BEGIN:BLOCK -->", |
|
208 | - "<".$this->tags->row.">", |
|
209 | - "{BODYCELLS}", |
|
210 | - "</".$this->tags->row.">", |
|
211 | - "<!-- END:BLOCK -->", |
|
212 | - "<".$this->tags->row.">", |
|
213 | - "{FOOTERCELLS}", |
|
214 | - "</".$this->tags->row.">", |
|
215 | - "</".$this->tags->container.">" |
|
216 | - ); |
|
217 | - $sHTML = implode("", $aHTML); |
|
218 | - return $sHTML; |
|
219 | - } |
|
197 | + /** |
|
198 | + * generate mini table mark-up template |
|
199 | + * @return string |
|
200 | + */ |
|
201 | + public function buildMarkupTemplate () { |
|
202 | + $aHTML = array( |
|
203 | + "<".$this->tags->container.">", |
|
204 | + "<".$this->tags->row.">", |
|
205 | + "{HEADERCELLS}", |
|
206 | + "</".$this->tags->row.">", |
|
207 | + "<!-- BEGIN:BLOCK -->", |
|
208 | + "<".$this->tags->row.">", |
|
209 | + "{BODYCELLS}", |
|
210 | + "</".$this->tags->row.">", |
|
211 | + "<!-- END:BLOCK -->", |
|
212 | + "<".$this->tags->row.">", |
|
213 | + "{FOOTERCELLS}", |
|
214 | + "</".$this->tags->row.">", |
|
215 | + "</".$this->tags->container.">" |
|
216 | + ); |
|
217 | + $sHTML = implode("", $aHTML); |
|
218 | + return $sHTML; |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * generate table mark-up |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - public function buildMarkup () { |
|
226 | - $sHTML = ""; |
|
221 | + /** |
|
222 | + * generate table mark-up |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + public function buildMarkup () { |
|
226 | + $sHTML = ""; |
|
227 | 227 | |
228 | - $sTableID = $this->getOptions("formID"); |
|
229 | - if (!$sTableID) { |
|
230 | - $sTableID = "table" . md5(microtime()); |
|
231 | - $this->options["formID"] = $sTableID; |
|
232 | - } |
|
228 | + $sTableID = $this->getOptions("formID"); |
|
229 | + if (!$sTableID) { |
|
230 | + $sTableID = "table" . md5(microtime()); |
|
231 | + $this->options["formID"] = $sTableID; |
|
232 | + } |
|
233 | 233 | |
234 | - $this->getTemplate()->reset(); |
|
235 | - $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
236 | - $this->buildHeaderCells( $this->getOptions("columns") ); |
|
237 | - $this->buildFooterCells( $this->getOptions("footer") ); |
|
238 | - $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
239 | - $sTemplate = $this->getOptions("template"); |
|
240 | - if ($sTemplate == "") { |
|
241 | - $sTemplate = $this->buildMarkupTemplate(); |
|
242 | - } |
|
243 | - $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
244 | - return $sHTML; |
|
245 | - } |
|
234 | + $this->getTemplate()->reset(); |
|
235 | + $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
236 | + $this->buildHeaderCells( $this->getOptions("columns") ); |
|
237 | + $this->buildFooterCells( $this->getOptions("footer") ); |
|
238 | + $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
239 | + $sTemplate = $this->getOptions("template"); |
|
240 | + if ($sTemplate == "") { |
|
241 | + $sTemplate = $this->buildMarkupTemplate(); |
|
242 | + } |
|
243 | + $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
244 | + return $sHTML; |
|
245 | + } |
|
246 | 246 | |
247 | - /** |
|
248 | - * generate table JSON data |
|
249 | - * @return string |
|
250 | - */ |
|
251 | - public function buildData () { |
|
252 | - $sJSON = "[]"; |
|
253 | - if (!empty($this->data)) { |
|
254 | - $sJSON = json_encode($this->data); |
|
255 | - } |
|
256 | - return $sJSON; |
|
257 | - } |
|
247 | + /** |
|
248 | + * generate table JSON data |
|
249 | + * @return string |
|
250 | + */ |
|
251 | + public function buildData () { |
|
252 | + $sJSON = "[]"; |
|
253 | + if (!empty($this->data)) { |
|
254 | + $sJSON = json_encode($this->data); |
|
255 | + } |
|
256 | + return $sJSON; |
|
257 | + } |
|
258 | 258 | |
259 | - /** |
|
260 | - * return template object |
|
261 | - * @return Template |
|
262 | - */ |
|
263 | - public function getTemplate() { |
|
264 | - if ($this->template == null) { |
|
265 | - $this->setTemplate(); |
|
266 | - } |
|
267 | - return $this->template; |
|
268 | - } |
|
259 | + /** |
|
260 | + * return template object |
|
261 | + * @return Template |
|
262 | + */ |
|
263 | + public function getTemplate() { |
|
264 | + if ($this->template == null) { |
|
265 | + $this->setTemplate(); |
|
266 | + } |
|
267 | + return $this->template; |
|
268 | + } |
|
269 | 269 | |
270 | - /** |
|
271 | - * generate template object |
|
272 | - * @param Template $template |
|
273 | - * @return ProductTable |
|
274 | - */ |
|
275 | - public function setTemplate( $template = null ) { |
|
276 | - if ($template == null) { |
|
277 | - $this->template = new Template; |
|
278 | - } else { |
|
279 | - $this->template = $template; |
|
280 | - } |
|
281 | - return ($this); |
|
282 | - } |
|
270 | + /** |
|
271 | + * generate template object |
|
272 | + * @param Template $template |
|
273 | + * @return ProductTable |
|
274 | + */ |
|
275 | + public function setTemplate( $template = null ) { |
|
276 | + if ($template == null) { |
|
277 | + $this->template = new Template; |
|
278 | + } else { |
|
279 | + $this->template = $template; |
|
280 | + } |
|
281 | + return ($this); |
|
282 | + } |
|
283 | 283 | |
284 | - /** |
|
285 | - * return table data |
|
286 | - * @return mixed |
|
287 | - */ |
|
288 | - public function getData() { |
|
289 | - return $this->data; |
|
290 | - } |
|
284 | + /** |
|
285 | + * return table data |
|
286 | + * @return mixed |
|
287 | + */ |
|
288 | + public function getData() { |
|
289 | + return $this->data; |
|
290 | + } |
|
291 | 291 | |
292 | - /** |
|
293 | - * set new table data |
|
294 | - * @param mixed $data |
|
295 | - * @return ProductTable |
|
296 | - */ |
|
297 | - public function setData( $data = null) { |
|
298 | - if ( is_array($data) ) { |
|
299 | - $this->data = $data; |
|
300 | - } |
|
301 | - return $this; |
|
302 | - } |
|
292 | + /** |
|
293 | + * set new table data |
|
294 | + * @param mixed $data |
|
295 | + * @return ProductTable |
|
296 | + */ |
|
297 | + public function setData( $data = null) { |
|
298 | + if ( is_array($data) ) { |
|
299 | + $this->data = $data; |
|
300 | + } |
|
301 | + return $this; |
|
302 | + } |
|
303 | 303 | |
304 | - /** |
|
305 | - * return option by key or complete option set |
|
306 | - * @param string $key |
|
307 | - * @return mixed |
|
308 | - */ |
|
309 | - public function getOptions( $key = "" ) { |
|
310 | - if ( !empty($key) ) { |
|
311 | - if ( isset($this->options[$key]) ) { |
|
312 | - return $this->options[$key]; |
|
313 | - } else { |
|
314 | - return false; |
|
315 | - } |
|
316 | - } |
|
317 | - return $this->options; |
|
318 | - } |
|
304 | + /** |
|
305 | + * return option by key or complete option set |
|
306 | + * @param string $key |
|
307 | + * @return mixed |
|
308 | + */ |
|
309 | + public function getOptions( $key = "" ) { |
|
310 | + if ( !empty($key) ) { |
|
311 | + if ( isset($this->options[$key]) ) { |
|
312 | + return $this->options[$key]; |
|
313 | + } else { |
|
314 | + return false; |
|
315 | + } |
|
316 | + } |
|
317 | + return $this->options; |
|
318 | + } |
|
319 | 319 | |
320 | - /** |
|
321 | - * @param object|array $options |
|
322 | - * @return ProductTable |
|
323 | - */ |
|
324 | - public function setOptions($options) { |
|
325 | - if ( is_array($options) ) { |
|
326 | - $this->options = $options; |
|
327 | - } else if ( is_object($options) ) { |
|
328 | - $this->options = (array)$options; |
|
329 | - } else { |
|
330 | - throw new \Exception("invalid table options"); |
|
331 | - } |
|
332 | - if ( isset($this->options["data"]) ) { |
|
333 | - $this->setData($this->getOptions("data")); |
|
334 | - unset( $this->options->data ); |
|
335 | - } |
|
336 | - return $this; |
|
337 | - } |
|
320 | + /** |
|
321 | + * @param object|array $options |
|
322 | + * @return ProductTable |
|
323 | + */ |
|
324 | + public function setOptions($options) { |
|
325 | + if ( is_array($options) ) { |
|
326 | + $this->options = $options; |
|
327 | + } else if ( is_object($options) ) { |
|
328 | + $this->options = (array)$options; |
|
329 | + } else { |
|
330 | + throw new \Exception("invalid table options"); |
|
331 | + } |
|
332 | + if ( isset($this->options["data"]) ) { |
|
333 | + $this->setData($this->getOptions("data")); |
|
334 | + unset( $this->options->data ); |
|
335 | + } |
|
336 | + return $this; |
|
337 | + } |
|
338 | 338 | |
339 | 339 | |
340 | 340 | } |
341 | 341 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return string the assemled component rendered to HTML |
50 | 50 | */ |
51 | 51 | public function buildComponent() { |
52 | - if ( empty($this->getTagname()) ) { |
|
52 | + if (empty($this->getTagname())) { |
|
53 | 53 | $this->setTagname('div'); |
54 | 54 | // return ''; |
55 | 55 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | $content = (array($header, $body, $footer)); |
73 | - if ( is_array($body) && !isset($body["tagname"])) { |
|
73 | + if (is_array($body) && !isset($body["tagname"])) { |
|
74 | 74 | $content = array_merge(array($header), ($body), array($footer)); |
75 | 75 | } |
76 | 76 | |
77 | - $component = $this->_createElement($this->getTagname(), $this->getClassnames(), (array)$this->getAttributes(), $content); |
|
77 | + $component = $this->_createElement($this->getTagname(), $this->getClassnames(), (array) $this->getAttributes(), $content); |
|
78 | 78 | |
79 | 79 | return $component; |
80 | 80 |
@@ -39,38 +39,38 @@ |
||
39 | 39 | public function __invoke($formoptions = array(), $field = null) { |
40 | 40 | parent::__invoke(array()); |
41 | 41 | $form = null; |
42 | - if ( !is_array($formoptions) && ($formoptions instanceof \Zend\Form\Form) && (func_num_args() == 2) ) { |
|
42 | + if (!is_array($formoptions) && ($formoptions instanceof \Zend\Form\Form) && (func_num_args() == 2)) { |
|
43 | 43 | $form = $formoptions; |
44 | 44 | $field = func_get_arg(1); |
45 | - } else if ( isset($formoptions["form"]) && isset($formoptions["field"]) && ($formoptions["form"] instanceof \Zend\Form\Form) ) { |
|
45 | + } else if (isset($formoptions["form"]) && isset($formoptions["field"]) && ($formoptions["form"] instanceof \Zend\Form\Form)) { |
|
46 | 46 | $form = $formoptions["form"]; |
47 | 47 | $field = $formoptions["field"]; |
48 | 48 | } else |
49 | - if ( !($form instanceof \Zend\Form\Form) || empty($field) ) { |
|
49 | + if (!($form instanceof \Zend\Form\Form) || empty($field)) { |
|
50 | 50 | return ""; |
51 | 51 | } |
52 | 52 | $this->setForm($form); |
53 | 53 | |
54 | - if ( is_string($field) ) { |
|
54 | + if (is_string($field)) { |
|
55 | 55 | $field = $form->get($field); |
56 | 56 | if (!$field) { |
57 | 57 | return ""; |
58 | 58 | } |
59 | - } else if ( !($field instanceof \Zend\Form\Element) ) { |
|
59 | + } else if (!($field instanceof \Zend\Form\Element)) { |
|
60 | 60 | return ""; |
61 | 61 | } |
62 | - if ( !empty($this->getView()->formElementErrors($field)) ) { |
|
62 | + if (!empty($this->getView()->formElementErrors($field))) { |
|
63 | 63 | $this->addClass('has-error'); |
64 | 64 | } |
65 | - $this->setHeader( $this->getView()->formLabel($field) ); |
|
65 | + $this->setHeader($this->getView()->formLabel($field)); |
|
66 | 66 | /** @var \Zend\Form\View\HelperConfig $formPlugins */ |
67 | 67 | $formPlugins = $this->getView(); |
68 | - if ( $field->getAttribute('type') == 'select' ) { |
|
69 | - $this->setContent( $formPlugins->formSelect($field->setAttributes(array('class' => 'form-control'))) ); |
|
68 | + if ($field->getAttribute('type') == 'select') { |
|
69 | + $this->setContent($formPlugins->formSelect($field->setAttributes(array('class' => 'form-control')))); |
|
70 | 70 | } else { |
71 | - $this->setContent( $formPlugins->formInput($field->setAttributes(array('class' => 'form-control'))) ); |
|
71 | + $this->setContent($formPlugins->formInput($field->setAttributes(array('class' => 'form-control')))); |
|
72 | 72 | } |
73 | - $this->setFooter( $formPlugins->formElementErrors($field) ); |
|
73 | + $this->setFooter($formPlugins->formElementErrors($field)); |
|
74 | 74 | |
75 | 75 | $component = clone $this; |
76 | 76 | return $component; |
@@ -110,24 +110,24 @@ discard block |
||
110 | 110 | /** @var \Zend\View\Helper\EscapeHtml $escaper */ |
111 | 111 | $escaper = $this->view->plugin('escapeHtml'); |
112 | 112 | |
113 | - $listHtmlOpen = '<ol class="'.$this->getOlClass().'">' . PHP_EOL; |
|
114 | - if ( !empty($this->getHeader()) ) { |
|
115 | - $listHtmlOpen .= '<li class="' . $escaper($this->getHeaderClass()) . '">' . $escaper($this->getHeader()) . '</li>' . PHP_EOL; |
|
113 | + $listHtmlOpen = '<ol class="'.$this->getOlClass().'">'.PHP_EOL; |
|
114 | + if (!empty($this->getHeader())) { |
|
115 | + $listHtmlOpen .= '<li class="'.$escaper($this->getHeaderClass()).'">'.$escaper($this->getHeader()).'</li>'.PHP_EOL; |
|
116 | 116 | } |
117 | 117 | // put the deepest active page last in breadcrumbs |
118 | 118 | if ($this->getLinkLast()) { |
119 | - $html = '<li class="active">' . $this->htmlify($active) . '</li>' . PHP_EOL; |
|
119 | + $html = '<li class="active">'.$this->htmlify($active).'</li>'.PHP_EOL; |
|
120 | 120 | } else { |
121 | - $html = '<li class="active">' . $escaper( |
|
121 | + $html = '<li class="active">'.$escaper( |
|
122 | 122 | $this->translate($active->getLabel()) //, $active->getTextDomain()) |
123 | - ) . '</li>' . PHP_EOL; |
|
123 | + ).'</li>'.PHP_EOL; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // walk back to root |
127 | 127 | while ($parent = $active->getParent()) { |
128 | 128 | if ($parent instanceof AbstractPage) { |
129 | 129 | // prepend crumb to html |
130 | - $html = '<li>' . $this->htmlify($parent) . '</li>' . PHP_EOL |
|
130 | + $html = '<li>'.$this->htmlify($parent).'</li>'.PHP_EOL |
|
131 | 131 | //. $this->getSeparator() |
132 | 132 | . $html; |
133 | 133 | } |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | $active = $parent; |
141 | 141 | } |
142 | 142 | |
143 | - $listHtmlClose = '</ol>' . PHP_EOL; |
|
143 | + $listHtmlClose = '</ol>'.PHP_EOL; |
|
144 | 144 | |
145 | - return strlen($html) ? $listHtmlOpen . $this->getIndent() . $html . $listHtmlClose : ''; |
|
145 | + return strlen($html) ? $listHtmlOpen.$this->getIndent().$html.$listHtmlClose : ''; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return string the assemled component rendered to HTML |
55 | 55 | */ |
56 | 56 | public function buildComponent() { |
57 | - if ( empty($this->getTagname()) ) { |
|
57 | + if (empty($this->getTagname())) { |
|
58 | 58 | $this->setTagname('div'); |
59 | 59 | // return ''; |
60 | 60 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | $content = (array($header, $body, $footer)); |
78 | - if ( is_array($body) && !isset($body["tagname"])) { |
|
78 | + if (is_array($body) && !isset($body["tagname"])) { |
|
79 | 79 | $content = array_merge(array($header), ($body), array($footer)); |
80 | 80 | } |
81 | 81 | |
82 | - $contentElement = $this->_createElement($this->getTagname(), $this->getClassnamesContent(), (array)$this->getAttributes(), $content); |
|
82 | + $contentElement = $this->_createElement($this->getTagname(), $this->getClassnamesContent(), (array) $this->getAttributes(), $content); |
|
83 | 83 | $dialogElement = $this->_createElement($this->getTagname(), $this->getClassnamesDialog(), [], $contentElement); |
84 | 84 | $component = $this->_createElement($this->getTagname(), $this->getClassnames(), [], $dialogElement); |
85 | 85 | return $component; |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | protected $active = false; |
34 | 34 | |
35 | - protected $_tags = array('a','input','button'); |
|
35 | + protected $_tags = array('a', 'input', 'button'); |
|
36 | 36 | |
37 | - protected $_sizes = array('xs','sm','lg'); |
|
37 | + protected $_sizes = array('xs', 'sm', 'lg'); |
|
38 | 38 | protected $_foundations_sizes = array( |
39 | 39 | 'xs' => 'tiny', 'xs' => 'small', 'lg' => 'large', |
40 | 40 | ); |
41 | 41 | |
42 | - protected $_types = array('default','primary','success','info','warning','alert','danger','link'); |
|
42 | + protected $_types = array('default', 'primary', 'success', 'info', 'warning', 'alert', 'danger', 'link'); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * View helper entry point: |
@@ -57,31 +57,31 @@ discard block |
||
57 | 57 | $component->setHeader('')->setFooter(''); |
58 | 58 | |
59 | 59 | // tag options |
60 | - if ( isset($options["tagname"]) && in_array(strtolower($options["tagname"]), $component->getTags()) ) { |
|
60 | + if (isset($options["tagname"]) && in_array(strtolower($options["tagname"]), $component->getTags())) { |
|
61 | 61 | $component->setTagname(strtolower($options["tagname"])); |
62 | 62 | } else { |
63 | 63 | $component->setTagname('a'); |
64 | 64 | } |
65 | - if ( isset($options["attributes"]) && is_array($options["attributes"]) ) { |
|
65 | + if (isset($options["attributes"]) && is_array($options["attributes"])) { |
|
66 | 66 | $component->setAttributes($options["attributes"]); |
67 | 67 | } |
68 | 68 | |
69 | 69 | // bootstrap options |
70 | - if ( isset($options["size"]) && in_array(strtolower($options["size"]), $component->getSizes()) ) { |
|
70 | + if (isset($options["size"]) && in_array(strtolower($options["size"]), $component->getSizes())) { |
|
71 | 71 | $component->addClass('btn-'.strtolower($options["size"]).' '.strtolower($this->_foundations_sizes["size"])); |
72 | 72 | } |
73 | - if ( isset($options["type"]) && in_array(strtolower($options["type"]), $component->getTypes()) ) { |
|
73 | + if (isset($options["type"]) && in_array(strtolower($options["type"]), $component->getTypes())) { |
|
74 | 74 | $component->addClass('btn-'.strtolower($options["type"]).' '.strtolower($options["type"])); |
75 | 75 | } else { |
76 | 76 | $component->addClass('btn-default'); |
77 | 77 | } |
78 | - if ( isset($options["drop"]) ) { |
|
78 | + if (isset($options["drop"])) { |
|
79 | 79 | $component->setDrop($options["drop"]); |
80 | 80 | } |
81 | - if ( isset($options["block"]) ) { |
|
81 | + if (isset($options["block"])) { |
|
82 | 82 | $component->setBlock($options["block"]); |
83 | 83 | } |
84 | - if ( isset($options["active"]) ) { |
|
84 | + if (isset($options["active"])) { |
|
85 | 85 | $component->setActive($options["active"]); |
86 | 86 | } |
87 | 87 | |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | $component->setAttributes(array_merge_recursive($component->getAttributes(), array( |
93 | 93 | 'role' => 'button' |
94 | 94 | ))); |
95 | - if ( isset($options["disabled"]) ) { |
|
95 | + if (isset($options["disabled"])) { |
|
96 | 96 | $component->addClass('disabled'); |
97 | 97 | } |
98 | 98 | } else { |
99 | 99 | $component->setAttributes(array_merge_recursive($component->getAttributes(), array( |
100 | 100 | 'type' => 'button' |
101 | 101 | ))); |
102 | - if ( isset($options["disabled"]) ) { |
|
102 | + if (isset($options["disabled"])) { |
|
103 | 103 | $component->setAttributes(array_merge_recursive($component->getAttributes(), array( |
104 | 104 | 'disabled' => 'disabled' |
105 | 105 | ))); |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // tag content |
110 | - if ( isset($options["label"]) && !empty($options["label"]) ) { |
|
110 | + if (isset($options["label"]) && !empty($options["label"])) { |
|
111 | 111 | $component->setContent($options["label"]); |
112 | - } else if ( isset($options["content"]) && !empty($options["content"]) ) { |
|
112 | + } else if (isset($options["content"]) && !empty($options["content"])) { |
|
113 | 113 | $component->setContent($options["content"]); |
114 | 114 | } |
115 | 115 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param string $drop |
185 | 185 | */ |
186 | 186 | public function setDrop($drop) { |
187 | - if ( in_array(strtolower($drop), array('up','down'))) { |
|
187 | + if (in_array(strtolower($drop), array('up', 'down'))) { |
|
188 | 188 | $this->drop = $drop; |
189 | 189 | } |
190 | 190 | return $this; |
@@ -85,8 +85,12 @@ |
||
85 | 85 | $component->setActive($options["active"]); |
86 | 86 | } |
87 | 87 | |
88 | - if ($component->getBlock()) $component->addClass('btn-block expanded'); |
|
89 | - if ($component->getActive()) $component->addClass('active'); |
|
88 | + if ($component->getBlock()) { |
|
89 | + $component->addClass('btn-block expanded'); |
|
90 | + } |
|
91 | + if ($component->getActive()) { |
|
92 | + $component->addClass('active'); |
|
93 | + } |
|
90 | 94 | |
91 | 95 | if ($component->getTagname() == 'a') { |
92 | 96 | $component->setAttributes(array_merge_recursive($component->getAttributes(), array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $escaper = $this->view->plugin('escapeHtmlAttr'); |
98 | 98 | |
99 | 99 | if ($found) { |
100 | - $foundPage = $found['page']; |
|
100 | + $foundPage = $found['page']; |
|
101 | 101 | $foundDepth = $found['depth']; |
102 | 102 | } else { |
103 | 103 | $foundPage = null; |
@@ -146,28 +146,27 @@ discard block |
||
146 | 146 | |
147 | 147 | // make sure indentation is correct |
148 | 148 | $depth -= $minDepth; |
149 | - $myIndent = $indent . str_repeat(' ', $depth); |
|
149 | + $myIndent = $indent.str_repeat(' ', $depth); |
|
150 | 150 | |
151 | 151 | if ($depth > $prevDepth) { |
152 | 152 | // start new ul tag |
153 | - $ulClass = '' . |
|
154 | - ($depth == 0 ? $this->getUlClass() : |
|
155 | - ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
156 | - ) . |
|
157 | - ' level_' . $depth . |
|
153 | + $ulClass = ''. |
|
154 | + ($depth == 0 ? $this->getUlClass() : ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
155 | + ). |
|
156 | + ' level_'.$depth. |
|
158 | 157 | ''; |
159 | - if ($ulClass && $depth == 0) { |
|
160 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
158 | + if ($ulClass && $depth == 0) { |
|
159 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
161 | 160 | } else { |
162 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
161 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
163 | 162 | } |
164 | - $html .= $myIndent . '<' . $this->getTagname() . $ulClass . '>' . PHP_EOL; |
|
163 | + $html .= $myIndent.'<'.$this->getTagname().$ulClass.'>'.PHP_EOL; |
|
165 | 164 | } elseif ($prevDepth > $depth) { |
166 | 165 | // close li/ul tags until we're at current depth |
167 | 166 | for ($i = $prevDepth; $i > $depth; $i--) { |
168 | - $ind = $indent . str_repeat(' ', $i); |
|
167 | + $ind = $indent.str_repeat(' ', $i); |
|
169 | 168 | //$html .= $ind . ' </li>' . PHP_EOL; |
170 | - $html .= $ind . '</' . $this->getTagname() . '>' . PHP_EOL; |
|
169 | + $html .= $ind.'</'.$this->getTagname().'>'.PHP_EOL; |
|
171 | 170 | } |
172 | 171 | // close previous li tag |
173 | 172 | //$html .= $myIndent . ' </li>' . PHP_EOL; |
@@ -193,10 +192,10 @@ discard block |
||
193 | 192 | if ($addClassToListItem && $page->getClass()) { |
194 | 193 | $liClasses[] = $page->getClass(); |
195 | 194 | } |
196 | - $liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"'; |
|
195 | + $liClass = empty($liClasses) ? '' : ' class="'.$escaper(implode(' ', $liClasses)).'"'; |
|
197 | 196 | |
198 | 197 | $html .= /* $myIndent . ' <li' . $liClass . '>' . PHP_EOL |
199 | - . */ $myIndent . ' ' . $this->htmlify($page, $escapeLabels, $addClassToListItem) . PHP_EOL; |
|
198 | + . */ $myIndent.' '.$this->htmlify($page, $escapeLabels, $addClassToListItem).PHP_EOL; |
|
200 | 199 | |
201 | 200 | // store as previous depth for next iteration |
202 | 201 | $prevDepth = $depth; |
@@ -204,10 +203,10 @@ discard block |
||
204 | 203 | |
205 | 204 | if ($html) { |
206 | 205 | // done iterating container; close open ul/li tags |
207 | - for ($i = $prevDepth+1; $i > 0; $i--) { |
|
208 | - $myIndent = $indent . str_repeat(' ', $i-1); |
|
206 | + for ($i = $prevDepth + 1; $i > 0; $i--) { |
|
207 | + $myIndent = $indent.str_repeat(' ', $i - 1); |
|
209 | 208 | $html .= /*$myIndent . ' </li>' . PHP_EOL |
210 | - . */ $myIndent . '</' . $this->getTagname() . '>' . PHP_EOL; |
|
209 | + . */ $myIndent.'</'.$this->getTagname().'>'.PHP_EOL; |
|
211 | 210 | } |
212 | 211 | $html = rtrim($html, PHP_EOL); |
213 | 212 | } |
@@ -230,7 +229,7 @@ discard block |
||
230 | 229 | * @param string $tagname |
231 | 230 | */ |
232 | 231 | public function setTagname($tagname) { |
233 | - if ( null !== $tagname ) { |
|
232 | + if (null !== $tagname) { |
|
234 | 233 | $this->tagname = $tagname; |
235 | 234 | } |
236 | 235 | return $this; |
@@ -479,12 +479,12 @@ |
||
479 | 479 | ''.Locale::getDisplayLanguage(null). // ' - '.Locale::getDefault().' - '.Locale::getPrimaryLanguage(null).''. |
480 | 480 | '<span class="caret"></span>'. |
481 | 481 | '</a>'. |
482 | - sprintf( |
|
482 | + sprintf( |
|
483 | 483 | '<ul%s>%s</ul>', |
484 | 484 | ($subulclass) ? sprintf(' class="%s"', $subulclass) : '', |
485 | 485 | $list |
486 | - ). |
|
487 | - '</li>'. |
|
486 | + ). |
|
487 | + '</li>'. |
|
488 | 488 | '</ul>' |
489 | 489 | ; |
490 | 490 |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | } catch (\Exception $e) { |
423 | 423 | |
424 | - $msg = get_class($e) . ': ' . $e->getMessage() . "\n" . $e->getTraceAsString(); |
|
424 | + $msg = get_class($e).': '.$e->getMessage()."\n".$e->getTraceAsString(); |
|
425 | 425 | trigger_error($msg, E_USER_ERROR); |
426 | 426 | return ''; |
427 | 427 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | $list = ''; |
448 | 448 | $current = Locale::getDefault(); |
449 | - foreach($detector->getSupported() as $locale) { |
|
449 | + foreach ($detector->getSupported() as $locale) { |
|
450 | 450 | if ($this->omitCurrent() && $current === $locale) { |
451 | 451 | continue; |
452 | 452 | } |
@@ -461,22 +461,22 @@ discard block |
||
461 | 461 | $displayName = $this->getLocaleProperty('displayName', $locale, $labelLocale); |
462 | 462 | |
463 | 463 | $item = sprintf( |
464 | - '<li><a href="%s" title="%s"%s>%s</a></li>' . "\n", |
|
464 | + '<li><a href="%s" title="%s"%s>%s</a></li>'."\n", |
|
465 | 465 | $url, |
466 | 466 | $displayName, |
467 | 467 | ($current === $locale) ? ' class="active"' : '', |
468 | - (($iconprefixclass) ? '<span class="' . $iconprefixclass . $primary . '"></span> ' : '') . $label |
|
468 | + (($iconprefixclass) ? '<span class="'.$iconprefixclass.$primary.'"></span> ' : '').$label |
|
469 | 469 | ); |
470 | 470 | |
471 | 471 | $list .= $item; |
472 | 472 | } |
473 | 473 | $attributes = $this->getAttributes(); |
474 | - $html = |
|
474 | + $html = |
|
475 | 475 | '<ul'.(($class) ? sprintf(' class="%s"', $class) : '').' '.($this->htmlAttribs($attributes)).'>'. |
476 | 476 | '<li'.(($liclass) ? sprintf(' class="%s"', $liclass) : '').'>'. |
477 | 477 | '<a href="" class="'.(($liclass) ? $liclass.'-toggle' : '').'" data-toggle="'.(($liclass) ? $liclass : '').'" role="button" aria-haspopup="true" aria-expanded="false" title="'.Locale::getDisplayName(null).'">'. |
478 | 478 | '<span class="'.(($iconprefixclass) ? $iconprefixclass : '').Locale::getPrimaryLanguage(null).'"></span> '. |
479 | - ''.Locale::getDisplayLanguage(null). // ' - '.Locale::getDefault().' - '.Locale::getPrimaryLanguage(null).''. |
|
479 | + ''.Locale::getDisplayLanguage(null).// ' - '.Locale::getDefault().' - '.Locale::getPrimaryLanguage(null).''. |
|
480 | 480 | '<span class="caret"></span>'. |
481 | 481 | '</a>'. |
482 | 482 | sprintf( |