@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | |
113 | 113 | function getValue() { |
114 | 114 | if (!is_null($this->setValue)) return $this->setValue; |
115 | - if (isset($_REQUEST[$this->form . "_" . $this->name])) { |
|
116 | - return $_REQUEST[$this->form . "_" . $this->name]; |
|
115 | + if (isset($_REQUEST[$this->form."_".$this->name])) { |
|
116 | + return $_REQUEST[$this->form."_".$this->name]; |
|
117 | 117 | } |
118 | 118 | return $this->opt['default']; |
119 | 119 | } |
120 | 120 | |
121 | 121 | function getInputAttStatic(&$atts, &$type, &$content) { |
122 | - $atts['id'] = $atts['name'] = $this->form . "_" . $this->name; |
|
122 | + $atts['id'] = $atts['name'] = $this->form."_".$this->name; |
|
123 | 123 | $atts['type'] = "text"; |
124 | - $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this)); |
|
124 | + $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this)); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | function getInputAttDynamic(&$atts, &$type, &$content) { |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | function getLabelAttStatic(&$atts, &$type, &$content) { |
142 | - $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this)); |
|
143 | - $atts["for"] = $this->form . "_" . $this->name; |
|
142 | + $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this)); |
|
143 | + $atts["for"] = $this->form."_".$this->name; |
|
144 | 144 | $content = array($this->opt['label']); |
145 | 145 | } |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | function getHintAttStatic(&$atts, &$type, &$content) { |
151 | - $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this)); |
|
151 | + $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this)); |
|
152 | 152 | $atts['class'][] = "hamleFormHint"; |
153 | 153 | } |
154 | 154 |
@@ -66,7 +66,9 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | function __call($name, $valarray) { |
69 | - if (count($valarray) < 1) return $this->__get($name); |
|
69 | + if (count($valarray) < 1) { |
|
70 | + return $this->__get($name); |
|
71 | + } |
|
70 | 72 | $val = count($valarray) == 1 ? current($valarray) : $valarray; |
71 | 73 | switch ($name) { |
72 | 74 | case "name": |
@@ -111,7 +113,9 @@ discard block |
||
111 | 113 | } |
112 | 114 | |
113 | 115 | function getValue() { |
114 | - if (!is_null($this->setValue)) return $this->setValue; |
|
116 | + if (!is_null($this->setValue)) { |
|
117 | + return $this->setValue; |
|
118 | + } |
|
115 | 119 | if (isset($_REQUEST[$this->form . "_" . $this->name])) { |
116 | 120 | return $_REQUEST[$this->form . "_" . $this->name]; |
117 | 121 | } |
@@ -130,12 +134,15 @@ discard block |
||
130 | 134 | if (!$this->valid) { |
131 | 135 | $atts['class'][] = "hamleFormError"; |
132 | 136 | } |
133 | - if ($this->opt["disabled"]) |
|
134 | - $atts['disabled'] = "disabled"; |
|
135 | - if ($this->opt['required']) |
|
136 | - $atts['required'] = "required"; |
|
137 | - if ($this->opt['help']) |
|
138 | - $atts['title'] = $this->opt['help']; |
|
137 | + if ($this->opt["disabled"]) { |
|
138 | + $atts['disabled'] = "disabled"; |
|
139 | + } |
|
140 | + if ($this->opt['required']) { |
|
141 | + $atts['required'] = "required"; |
|
142 | + } |
|
143 | + if ($this->opt['help']) { |
|
144 | + $atts['title'] = $this->opt['help']; |
|
145 | + } |
|
139 | 146 | } |
140 | 147 | |
141 | 148 | function getLabelAttStatic(&$atts, &$type, &$content) { |
@@ -173,10 +180,12 @@ discard block |
||
173 | 180 | function doProcess($submit) { |
174 | 181 | if ($submit) { |
175 | 182 | $value = $this->getValue(); |
176 | - if ($this->opt['required']) |
|
177 | - $this->valid = $this->valid && strlen($value); |
|
178 | - if ($this->opt['regex']) |
|
179 | - $this->valid = $this->valid && preg_match($this->opt['regex'], $value); |
|
183 | + if ($this->opt['required']) { |
|
184 | + $this->valid = $this->valid && strlen($value); |
|
185 | + } |
|
186 | + if ($this->opt['regex']) { |
|
187 | + $this->valid = $this->valid && preg_match($this->opt['regex'], $value); |
|
188 | + } |
|
180 | 189 | } |
181 | 190 | } |
182 | 191 |