@@ -92,7 +92,7 @@ |
||
92 | 92 | */ |
93 | 93 | public function getTranslator() |
94 | 94 | { |
95 | - if (! $this->isTranslatorEnabled()) { |
|
95 | + if (!$this->isTranslatorEnabled()) { |
|
96 | 96 | return; |
97 | 97 | } |
98 | 98 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param \Zend\I18n\Translator\TranslatorInterface $translator |
30 | 30 | * @return \UIComponents\Template\TemplateAbstract |
31 | 31 | */ |
32 | - public function __construct ($tags = false, $translator = null) |
|
32 | + public function __construct($tags = false, $translator = null) |
|
33 | 33 | { |
34 | 34 | return parent::__construct($tags, $translator); |
35 | 35 | } |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | * Needles (static) |
31 | 31 | * @var array |
32 | 32 | */ |
33 | - public $needles = array (); |
|
33 | + public $needles = array(); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Replacements (static) |
37 | 37 | * @var array |
38 | 38 | */ |
39 | - public $replacements = array (); |
|
39 | + public $replacements = array(); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * dynamicNeedles (dynamic) |
43 | 43 | * @var array |
44 | 44 | */ |
45 | - public $dynamicNeedles = array (); |
|
45 | + public $dynamicNeedles = array(); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * dynamicReplacements (dynamic) |
49 | 49 | * @var array |
50 | 50 | */ |
51 | - public $dynamicReplacements = array (); |
|
51 | + public $dynamicReplacements = array(); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Dynamic counter |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * Tags array (for dynamic blocks); |
61 | 61 | * @var array |
62 | 62 | */ |
63 | - public $tags = array ( |
|
63 | + public $tags = array( |
|
64 | 64 | 'static' => '{%s}', |
65 | 65 | 'start' => '<!-- BEGIN:BLOCK -->', |
66 | 66 | 'end' => '<!-- END:BLOCK -->' |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param \Zend\I18n\Translator\TranslatorInterface $translator |
80 | 80 | * @return \UIComponents\Template\TemplateAbstract |
81 | 81 | */ |
82 | - public function __construct ($tags = false, $translator = null) |
|
82 | + public function __construct($tags = false, $translator = null) |
|
83 | 83 | { |
84 | 84 | if (is_array($tags)) |
85 | 85 | { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param $sDomain string Sets the domain to use for template translations |
103 | 103 | * @return self |
104 | 104 | */ |
105 | - public function setDomain ($sDomain) |
|
105 | + public function setDomain($sDomain) |
|
106 | 106 | { |
107 | 107 | $this->_sDomain = $sDomain; |
108 | 108 | return $this; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param $encoding string Encoding to set |
143 | 143 | * @return self |
144 | 144 | */ |
145 | - public function setEncoding ($encoding) |
|
145 | + public function setEncoding($encoding) |
|
146 | 146 | { |
147 | 147 | $this->_encoding = $encoding; |
148 | 148 | return $this; |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | public function reset() |
168 | 168 | { |
169 | 169 | $this->dynamicContent = 0; |
170 | - $this->needles = array (); |
|
171 | - $this->replacements = array (); |
|
172 | - $this->dynamicNeedles = array (); |
|
173 | - $this->dynamicReplacements = array (); |
|
170 | + $this->needles = array(); |
|
171 | + $this->replacements = array(); |
|
172 | + $this->dynamicNeedles = array(); |
|
173 | + $this->dynamicReplacements = array(); |
|
174 | 174 | return $this; |
175 | 175 | } |
176 | 176 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | unset ($pieces[0][0]); |
216 | 216 | |
217 | 217 | //generate dynamic blocks |
218 | - for ($a = 0; $a < $this->dynamicContent; $a ++) { |
|
218 | + for ($a = 0; $a < $this->dynamicContent; $a++) { |
|
219 | 219 | $content .= str_replace($this->dynamicNeedles[$a], $this->dynamicReplacements[$a], $pieces[1][0]); |
220 | 220 | } |
221 | 221 | unset ($pieces[1][0]); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | if ($this->_encoding != "") |
231 | 231 | { |
232 | - $content = '<meta http-equiv="Content-Type" content="text/html; charset=' . $this->_encoding . '">' . "\n" . $content; |
|
232 | + $content = '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".$content; |
|
233 | 233 | //$content = str_replace("</head>", '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".'</head>', $content); |
234 | 234 | } |
235 | 235 | |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | |
253 | 253 | // Be sure that php code stays unchanged |
254 | 254 | $php_matches = array(); |
255 | - $container = array(); |
|
255 | + $container = array(); |
|
256 | 256 | if (preg_match_all('/<\?(php)?((.)|(\s))*?\?>/i', $template, $php_matches)) { |
257 | 257 | $x = 0; |
258 | 258 | foreach ($php_matches[0] as $php_match) { |
259 | 259 | $x++; |
260 | - $template = str_replace ($php_match , "{PHP#".$x."#PHP}", $template); |
|
260 | + $template = str_replace($php_match, "{PHP#".$x."#PHP}", $template); |
|
261 | 261 | $container[$x] = $php_match; |
262 | 262 | } |
263 | 263 | } |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | preg_match_all("/".preg_quote($functionName, "/")."\\(([\\\"\\'])(.*?)\\1\\)/s", $template, $matches); |
268 | 268 | |
269 | 269 | $matches = array_values(array_unique($matches[2])); |
270 | - for ($a = 0; $a < count($matches); $a ++) { |
|
270 | + for ($a = 0; $a < count($matches); $a++) { |
|
271 | 271 | $template = preg_replace("/".preg_quote($functionName, "/")."\\([\\\"\\']".preg_quote($matches[$a], "/")."[\\\"\\']\\)/s", $this->translate($matches[$a], $this->_sDomain), $template); |
272 | 272 | } |
273 | 273 | |
274 | 274 | // Change back php placeholder |
275 | 275 | if (is_array($container)) { |
276 | 276 | foreach ($container as $x => $php_match) { |
277 | - $template = str_replace ("{PHP#".$x."#PHP}" , $php_match, $template); |
|
277 | + $template = str_replace("{PHP#".$x."#PHP}", $php_match, $template); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | return $this; |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * |
33 | 33 | * @var array |
34 | 34 | */ |
35 | - protected $invokableClasses = [ ]; |
|
35 | + protected $invokableClasses = []; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Validate the plugin |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $escaper = $this->view->plugin('escapeHtmlAttr'); |
211 | 211 | |
212 | 212 | if ($found) { |
213 | - $foundPage = $found['page']; |
|
213 | + $foundPage = $found['page']; |
|
214 | 214 | $foundDepth = $found['depth']; |
215 | 215 | } else { |
216 | 216 | $foundPage = null; |
@@ -259,34 +259,33 @@ discard block |
||
259 | 259 | |
260 | 260 | // make sure indentation is correct |
261 | 261 | $depth -= $minDepth; |
262 | - $myIndent = $indent . str_repeat(' ', $depth); |
|
262 | + $myIndent = $indent.str_repeat(' ', $depth); |
|
263 | 263 | $attributes = $this->getAttributes(); |
264 | 264 | if ($depth > $prevDepth) { |
265 | 265 | // start new ul tag |
266 | - $ulClass = '' . |
|
267 | - ($depth == 0 ? $this->getUlClass() : |
|
268 | - ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
269 | - ) . |
|
270 | - ' level_' . $depth . |
|
266 | + $ulClass = ''. |
|
267 | + ($depth == 0 ? $this->getUlClass() : ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
268 | + ). |
|
269 | + ' level_'.$depth. |
|
271 | 270 | ''; |
272 | - if ($ulClass && $depth == 0) { |
|
273 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
271 | + if ($ulClass && $depth == 0) { |
|
272 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
274 | 273 | } else { |
275 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
274 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
276 | 275 | } |
277 | - $html .= $myIndent . '<ul' . $ulClass . ' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>' . PHP_EOL; |
|
276 | + $html .= $myIndent.'<ul'.$ulClass.' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>'.PHP_EOL; |
|
278 | 277 | } elseif ($prevDepth > $depth) { |
279 | 278 | // close li/ul tags until we're at current depth |
280 | 279 | for ($i = $prevDepth; $i > $depth; $i--) { |
281 | - $ind = $indent . str_repeat(' ', $i); |
|
282 | - $html .= $ind . ' </li>' . PHP_EOL; |
|
283 | - $html .= $ind . '</ul>' . PHP_EOL; |
|
280 | + $ind = $indent.str_repeat(' ', $i); |
|
281 | + $html .= $ind.' </li>'.PHP_EOL; |
|
282 | + $html .= $ind.'</ul>'.PHP_EOL; |
|
284 | 283 | } |
285 | 284 | // close previous li tag |
286 | - $html .= $myIndent . ' </li>' . PHP_EOL; |
|
285 | + $html .= $myIndent.' </li>'.PHP_EOL; |
|
287 | 286 | } else { |
288 | 287 | // close previous li tag |
289 | - $html .= $myIndent . ' </li>' . PHP_EOL; |
|
288 | + $html .= $myIndent.' </li>'.PHP_EOL; |
|
290 | 289 | } |
291 | 290 | |
292 | 291 | // render li tag and page |
@@ -306,10 +305,10 @@ discard block |
||
306 | 305 | if ($addClassToListItem && $page->getClass()) { |
307 | 306 | $liClasses[] = $page->getClass(); |
308 | 307 | } |
309 | - $liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"'; |
|
308 | + $liClass = empty($liClasses) ? '' : ' class="'.$escaper(implode(' ', $liClasses)).'"'; |
|
310 | 309 | |
311 | - $html .= $myIndent . ' <li' . $liClass . '>' . PHP_EOL |
|
312 | - . $myIndent . ' ' . $this->htmlify($page, $escapeLabels, $addClassToListItem) . PHP_EOL; |
|
310 | + $html .= $myIndent.' <li'.$liClass.'>'.PHP_EOL |
|
311 | + . $myIndent.' '.$this->htmlify($page, $escapeLabels, $addClassToListItem).PHP_EOL; |
|
313 | 312 | |
314 | 313 | // store as previous depth for next iteration |
315 | 314 | $prevDepth = $depth; |
@@ -317,10 +316,10 @@ discard block |
||
317 | 316 | |
318 | 317 | if ($html) { |
319 | 318 | // done iterating container; close open ul/li tags |
320 | - for ($i = $prevDepth+1; $i > 0; $i--) { |
|
321 | - $myIndent = $indent . str_repeat(' ', $i-1); |
|
322 | - $html .= $myIndent . ' </li>' . PHP_EOL |
|
323 | - . $myIndent . '</ul>' . PHP_EOL; |
|
319 | + for ($i = $prevDepth + 1; $i > 0; $i--) { |
|
320 | + $myIndent = $indent.str_repeat(' ', $i - 1); |
|
321 | + $html .= $myIndent.' </li>'.PHP_EOL |
|
322 | + . $myIndent.'</ul>'.PHP_EOL; |
|
324 | 323 | } |
325 | 324 | $html = rtrim($html, PHP_EOL); |
326 | 325 | } |
@@ -351,7 +350,7 @@ discard block |
||
351 | 350 | */ |
352 | 351 | public function findActive($container = null, $minDepth = null, $maxDepth = -1) |
353 | 352 | { |
354 | - if ( null == $container ) { |
|
353 | + if (null == $container) { |
|
355 | 354 | $container = $this->getContainer(); |
356 | 355 | } |
357 | 356 | return parent::findActive($container, $minDepth, $maxDepth); |
@@ -380,7 +379,7 @@ discard block |
||
380 | 379 | 'title' => $this->translate($page->getTitle(), $page->getTextDomain()), |
381 | 380 | ]; |
382 | 381 | $classnames = array(); |
383 | - if ( $addClassToListItem === false ) { |
|
382 | + if ($addClassToListItem === false) { |
|
384 | 383 | $class = $page->getClass(); |
385 | 384 | if (!empty($class)) { |
386 | 385 | $classnames[] = $page->getClass(); |
@@ -389,7 +388,7 @@ discard block |
||
389 | 388 | $maxDepth = $this->getMaxDepth(); |
390 | 389 | $depth = $page->get('level'); |
391 | 390 | $isBelowMaxLevel = ($maxDepth > $depth) || ($maxDepth === null) || ($maxDepth === false); |
392 | - if ( !empty($page->pages) && $isBelowMaxLevel ) { |
|
391 | + if (!empty($page->pages) && $isBelowMaxLevel) { |
|
393 | 392 | $classnames[] = 'dropdown-toggle'; |
394 | 393 | $attribs['data-toggle'] = (($depth == 0) ? $this->getSubLiClassLevel0() : $this->getSubLiClass()); |
395 | 394 | } |
@@ -408,8 +407,8 @@ discard block |
||
408 | 407 | $attribs['href'] = '#'; |
409 | 408 | } |
410 | 409 | |
411 | - $html = '<' . $element . $this->htmlAttribs($attribs) . '>'; |
|
412 | - $html .= ($page->get('icon') ? '<span class="' . $this->getIconPrefixClass() . '' . $page->get('icon') . '"></span> ' : '' ); |
|
410 | + $html = '<'.$element.$this->htmlAttribs($attribs).'>'; |
|
411 | + $html .= ($page->get('icon') ? '<span class="'.$this->getIconPrefixClass().''.$page->get('icon').'"></span> ' : ''); |
|
413 | 412 | $label = $this->translate($page->getLabel(), $page->getTextDomain()); |
414 | 413 | if ($escapeLabel === true) { |
415 | 414 | /** @var \Zend\View\Helper\EscapeHtml $escaper */ |
@@ -418,7 +417,7 @@ discard block |
||
418 | 417 | } else { |
419 | 418 | $html .= $label; |
420 | 419 | } |
421 | - $html .= '</' . $element . '>'; |
|
420 | + $html .= '</'.$element.'>'; |
|
422 | 421 | |
423 | 422 | return $html; |
424 | 423 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $classnames |
45 | 45 | */ |
46 | 46 | public function setClassnames($classnames) { |
47 | - if ( null !== $classnames ) { |
|
47 | + if (null !== $classnames) { |
|
48 | 48 | $this->classnames = $classnames; |
49 | 49 | } |
50 | 50 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $classname |
57 | 57 | * @return boolean |
58 | 58 | */ |
59 | - public function hasClass ($classname) { |
|
59 | + public function hasClass($classname) { |
|
60 | 60 | $classname = trim($classname); |
61 | 61 | if (!empty($classname)) { |
62 | 62 | $classes = explode(" ", $this->getClassnames()); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param string $classname |
72 | 72 | */ |
73 | - public function addClass ($classname) { |
|
73 | + public function addClass($classname) { |
|
74 | 74 | $classname = trim($classname); |
75 | 75 | if (!empty($classname)) { |
76 | 76 | $classes = explode(" ", $this->getClassnames()); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @param string $classname |
89 | 89 | */ |
90 | - public function removeClass ($classname) { |
|
90 | + public function removeClass($classname) { |
|
91 | 91 | $classname = trim($classname); |
92 | 92 | if (!empty($classname) && $this->hasClass($classname)) { |
93 | 93 | $classes = explode(" ", $this->getClassnames()); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @return the $attribute |
37 | 37 | */ |
38 | 38 | public function getAttribute($name) { |
39 | - return ( isset($this->attributes[$name]) ? $this->attributes[$name] : null ); |
|
39 | + return (isset($this->attributes[$name]) ? $this->attributes[$name] : null); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param mixed $value |
47 | 47 | */ |
48 | 48 | public function setAttribute($attribute, $value = "") { |
49 | - if ( null !== $attribute ) { |
|
49 | + if (null !== $attribute) { |
|
50 | 50 | $this->attributes[$attribute] = $value; |
51 | 51 | } |
52 | 52 | return $this; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param array $attributes |
68 | 68 | */ |
69 | 69 | public function setAttributes($attributes) { |
70 | - if ( is_array($attributes) ) { |
|
70 | + if (is_array($attributes)) { |
|
71 | 71 | $this->attributes = array_merge_recursive($this->attributes, $attributes); |
72 | 72 | } |
73 | 73 | return $this; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // except for "data-" and "aria-" attributes |
89 | 89 | foreach ($attribs as $key => $value) { |
90 | 90 | if ($value === null || (is_string($value) && !strlen($value))) { |
91 | - if ( (strpos($key, "data") === false) && (strpos($key, "aria") === false) ) { |
|
91 | + if ((strpos($key, "data") === false) && (strpos($key, "aria") === false)) { |
|
92 | 92 | unset($attribs[$key]); |
93 | 93 | } |
94 | 94 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | $xhtml = ''; |
98 | 98 | $oView = $this->getView(); |
99 | - $escaper = function ($val) { return $val; }; |
|
100 | - $escapeHtmlAttr = function ($val) { return $val; }; |
|
101 | - if ( ($oView instanceof \Zend\View\Renderer\RendererInterface) ) { |
|
99 | + $escaper = function($val) { return $val; }; |
|
100 | + $escapeHtmlAttr = function($val) { return $val; }; |
|
101 | + if (($oView instanceof \Zend\View\Renderer\RendererInterface)) { |
|
102 | 102 | $escaper = $oView->plugin('escapehtml'); |
103 | 103 | $escapeHtmlAttr = $oView->plugin('escapehtmlattr'); |
104 | 104 | } |
@@ -33,10 +33,10 @@ |
||
33 | 33 | */ |
34 | 34 | public function __invoke($options = array()) |
35 | 35 | { |
36 | - if ( is_object($options) && method_exists($options, 'toArray') ) { |
|
36 | + if (is_object($options) && method_exists($options, 'toArray')) { |
|
37 | 37 | $options = $options->toArray(); |
38 | - } else if ( is_object($options) ) { |
|
39 | - $options = (array)$options; |
|
38 | + } else if (is_object($options)) { |
|
39 | + $options = (array) $options; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if (isset($options['container']) && (null !== $options['container'])) { |
@@ -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 |