@@ -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 | |