@@ -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 |
@@ -27,12 +27,12 @@ |
||
27 | 27 | * |
28 | 28 | * @param array $tags |
29 | 29 | * @param \Zend\I18n\Translator\TranslatorInterface $translator |
30 | - * @return \UIComponents\Template\TemplateAbstract |
|
30 | + * @return \UIComponents\Template\TemplateAbstract |
|
31 | 31 | */ |
32 | 32 | public function __construct ($tags = false, $translator = null) |
33 | - { |
|
34 | - return parent::__construct($tags, $translator); |
|
35 | - } |
|
33 | + { |
|
34 | + return parent::__construct($tags, $translator); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | ?> |
39 | 39 | \ No newline at end of file |
@@ -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 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | abstract class TemplateAbstract implements TemplateInterface, TranslatorAwareInterface |
26 | 26 | { |
27 | - use TranslatorAwareInterfaceTrait; |
|
27 | + use TranslatorAwareInterfaceTrait; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Needles (static) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param array $tags |
79 | 79 | * @param \Zend\I18n\Translator\TranslatorInterface $translator |
80 | - * @return \UIComponents\Template\TemplateAbstract |
|
80 | + * @return \UIComponents\Template\TemplateAbstract |
|
81 | 81 | */ |
82 | 82 | public function __construct ($tags = false, $translator = null) |
83 | 83 | { |
@@ -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; |
@@ -189,8 +189,7 @@ discard block |
||
189 | 189 | if (!@ is_file($template)) |
190 | 190 | { |
191 | 191 | $content = & $template; //template is a string (it is a reference to save memory!!!) |
192 | - } |
|
193 | - else |
|
192 | + } else |
|
194 | 193 | { |
195 | 194 | $content = implode("", file($template)); //template is a file |
196 | 195 | } |
@@ -233,10 +232,11 @@ discard block |
||
233 | 232 | //$content = str_replace("</head>", '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".'</head>', $content); |
234 | 233 | } |
235 | 234 | |
236 | - if ($return) |
|
237 | - return $content; |
|
238 | - else |
|
239 | - echo $content; |
|
235 | + if ($return) { |
|
236 | + return $content; |
|
237 | + } else { |
|
238 | + echo $content; |
|
239 | + } |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -22,44 +22,44 @@ |
||
22 | 22 | interface TemplateInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * Set Templates placeholders and values |
|
27 | - * |
|
28 | - * With this method you can replace the placeholders |
|
29 | - * in the static templates with dynamic data. |
|
30 | - * |
|
31 | - * @param $which String 's' for Static or else dynamic |
|
32 | - * @param $needle String Placeholder |
|
33 | - * @param $replacement String Replacement String |
|
34 | - * |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function set($which = 's', $needle, $replacement); |
|
25 | + /** |
|
26 | + * Set Templates placeholders and values |
|
27 | + * |
|
28 | + * With this method you can replace the placeholders |
|
29 | + * in the static templates with dynamic data. |
|
30 | + * |
|
31 | + * @param $which String 's' for Static or else dynamic |
|
32 | + * @param $needle String Placeholder |
|
33 | + * @param $replacement String Replacement String |
|
34 | + * |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function set($which = 's', $needle, $replacement); |
|
38 | 38 | |
39 | - /** |
|
40 | - * Iterate internal counter by one |
|
41 | - * |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function next(); |
|
39 | + /** |
|
40 | + * Iterate internal counter by one |
|
41 | + * |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function next(); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Reset template data |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function reset(); |
|
46 | + /** |
|
47 | + * Reset template data |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function reset(); |
|
52 | 52 | |
53 | - /** |
|
54 | - * Generate the template and |
|
55 | - * print/return it. (do translations sequentially to save memory!!!) |
|
56 | - * |
|
57 | - * @param $template string/file Template |
|
58 | - * @param $return bool Return or print template |
|
59 | - * |
|
60 | - * @return string complete Template string |
|
61 | - */ |
|
62 | - public function generate($template, $return = 0); |
|
53 | + /** |
|
54 | + * Generate the template and |
|
55 | + * print/return it. (do translations sequentially to save memory!!!) |
|
56 | + * |
|
57 | + * @param $template string/file Template |
|
58 | + * @param $return bool Return or print template |
|
59 | + * |
|
60 | + * @return string complete Template string |
|
61 | + */ |
|
62 | + public function generate($template, $return = 0); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | } |
@@ -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 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | trait ComponentClassnamesTrait { |
24 | 24 | |
25 | - /** |
|
25 | + /** |
|
26 | 26 | * component's class-names |
27 | 27 | * |
28 | 28 | * @var string |
@@ -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,12 +36,12 @@ |
||
36 | 36 | */ |
37 | 37 | protected $serviceLocator; |
38 | 38 | |
39 | - /** |
|
40 | - * Set the event manager. |
|
41 | - * |
|
42 | - * @param EventManagerInterface $events |
|
43 | - * @return AbstractHelper |
|
44 | - */ |
|
39 | + /** |
|
40 | + * Set the event manager. |
|
41 | + * |
|
42 | + * @param EventManagerInterface $events |
|
43 | + * @return AbstractHelper |
|
44 | + */ |
|
45 | 45 | public function setEventManager(EventManagerInterface $events) |
46 | 46 | { |
47 | 47 | $events->setIdentifiers([ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected static $defaultRole; |
63 | 63 | |
64 | - /** |
|
64 | + /** |
|
65 | 65 | * Sets ACL to use when iterating pages |
66 | 66 | * |
67 | 67 | * Implements {@link HelperInterface::setAcl()}. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - /** |
|
113 | + /** |
|
114 | 114 | * Sets ACL role(s) to use when iterating pages |
115 | 115 | * |
116 | 116 | * Implements {@link HelperInterface::setRole()}. |
@@ -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 |