@@ -15,7 +15,7 @@ |
||
15 | 15 | * @access public |
16 | 16 | * @return void |
17 | 17 | */ |
18 | - public function __construct($elementName=null, $value=null, $attributes=null) |
|
18 | + public function __construct($elementName = null, $value = null, $attributes = null) |
|
19 | 19 | { |
20 | 20 | parent::__construct($elementName, null, $attributes); |
21 | 21 | $this->setValue($value); |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | function toHtml() |
117 | 117 | { |
118 | 118 | // prevent problems with grouped elements |
119 | - $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values'; |
|
119 | + $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()).'_values'; |
|
120 | 120 | |
121 | 121 | $this->updateAttributes(array( |
122 | - 'onkeypress' => 'return autocomplete(this, event, ' . $arrayName . ');' |
|
122 | + 'onkeypress' => 'return autocomplete(this, event, '.$arrayName.');' |
|
123 | 123 | )); |
124 | 124 | if ($this->_flagFrozen) { |
125 | 125 | $js = ''; |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | ); |
240 | 240 | |
241 | 241 | $js .= $this->_js; |
242 | - $js .= 'var ' . $arrayName . " = new Array();\n"; |
|
242 | + $js .= 'var '.$arrayName." = new Array();\n"; |
|
243 | 243 | for ($i = 0; $i < count($this->_options); $i++) { |
244 | - $js .= $arrayName . '[' . $i . "] = '" . strtr($this->_options[$i], $jsEscape) . "';\n"; |
|
244 | + $js .= $arrayName.'['.$i."] = '".strtr($this->_options[$i], $jsEscape)."';\n"; |
|
245 | 245 | } |
246 | 246 | $js .= "//]]>\n</script>"; |
247 | 247 | } |
248 | - return $js . parent::toHtml(); |
|
248 | + return $js.parent::toHtml(); |
|
249 | 249 | }// end func toHtml |
250 | 250 | |
251 | 251 | // }}} |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * The object being generated |
42 | 42 | * @var QuickformForm |
43 | 43 | */ |
44 | - var $_obj= null; |
|
44 | + var $_obj = null; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Number of sections in the form (i.e. number of headers in it) |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->_obj->requirednote = $form->getRequiredNote(); |
122 | 122 | $this->_obj->errors = new StdClass; |
123 | 123 | |
124 | - if($this->_collectHidden) { |
|
124 | + if ($this->_collectHidden) { |
|
125 | 125 | $this->_obj->hidden = ''; |
126 | 126 | } |
127 | 127 | $this->_elementIdx = 1; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | function renderElement(&$element, $required, $error) |
141 | 141 | { |
142 | 142 | $elObj = $this->_elementToObject($element, $required, $error); |
143 | - if(!empty($error)) { |
|
143 | + if (!empty($error)) { |
|
144 | 144 | $name = $elObj->name; |
145 | 145 | $this->_obj->errors->$name = $error; |
146 | 146 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | |
150 | 150 | function renderHidden(&$element) |
151 | 151 | { |
152 | - if($this->_collectHidden) { |
|
153 | - $this->_obj->hidden .= $element->toHtml() . "\n"; |
|
152 | + if ($this->_collectHidden) { |
|
153 | + $this->_obj->hidden .= $element->toHtml()."\n"; |
|
154 | 154 | } else { |
155 | 155 | $this->renderElement($element, false, null); |
156 | 156 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | function startGroup(&$group, $required, $error) |
160 | 160 | { |
161 | 161 | $this->_currentGroup = $this->_elementToObject($group, $required, $error); |
162 | - if(!empty($error)) { |
|
162 | + if (!empty($error)) { |
|
163 | 163 | $name = $this->_currentGroup->name; |
164 | 164 | $this->_obj->errors->$name = $error; |
165 | 165 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | function _elementToObject(&$element, $required, $error) |
184 | 184 | { |
185 | - if($this->_elementType) { |
|
185 | + if ($this->_elementType) { |
|
186 | 186 | $ret = new $this->_elementType; |
187 | 187 | } |
188 | 188 | $ret->name = $element->getName(); |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | if (is_array($labels)) { |
194 | 194 | $ret->label = array_shift($labels); |
195 | 195 | foreach ($labels as $key => $label) { |
196 | - $key = is_int($key)? $key + 2: $key; |
|
197 | - $ret->{'label_' . $key} = $label; |
|
196 | + $key = is_int($key) ? $key + 2 : $key; |
|
197 | + $ret->{'label_'.$key} = $label; |
|
198 | 198 | } |
199 | 199 | } else { |
200 | 200 | $ret->label = $labels; |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | $ret->required = $required; |
203 | 203 | $ret->error = $error; |
204 | 204 | |
205 | - if(isset($this->_elementStyles[$ret->name])) { |
|
205 | + if (isset($this->_elementStyles[$ret->name])) { |
|
206 | 206 | $ret->style = $this->_elementStyles[$ret->name]; |
207 | - $ret->styleTemplate = "styles/". $ret->style .".html"; |
|
207 | + $ret->styleTemplate = "styles/".$ret->style.".html"; |
|
208 | 208 | } |
209 | - if($ret->type == 'group') { |
|
209 | + if ($ret->type == 'group') { |
|
210 | 210 | $ret->separator = $element->_separator; |
211 | 211 | $ret->elements = array(); |
212 | 212 | } else { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | function _storeObject($elObj) |
226 | 226 | { |
227 | 227 | $name = $elObj->name; |
228 | - if(is_object($this->_currentGroup) && $elObj->type != 'group') { |
|
228 | + if (is_object($this->_currentGroup) && $elObj->type != 'group') { |
|
229 | 229 | $this->_currentGroup->elements[] = $elObj; |
230 | 230 | } elseif (isset($this->_currentSection)) { |
231 | 231 | $this->_obj->sections[$this->_currentSection]->elements[] = $elObj; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | function setElementStyle($elementName, $styleName = null) |
238 | 238 | { |
239 | - if(is_array($elementName)) { |
|
239 | + if (is_array($elementName)) { |
|
240 | 240 | $this->_elementStyles = array_merge($this->_elementStyles, $elementName); |
241 | 241 | } else { |
242 | 242 | $this->_elementStyles[$elementName] = $styleName; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | function outputHeader() |
331 | 331 | { |
332 | - return "<form " . $this->attributes . ">\n"; |
|
332 | + return "<form ".$this->attributes.">\n"; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | function outputStyle() |
448 | 448 | { |
449 | 449 | ob_start(); |
450 | - HTML_Template_Flexy::staticQuickTemplate('styles/' . $this->style . '.html', $this); |
|
450 | + HTML_Template_Flexy::staticQuickTemplate('styles/'.$this->style.'.html', $this); |
|
451 | 451 | $ret = ob_get_contents(); |
452 | 452 | ob_end_clean(); |
453 | 453 | return $ret; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | function HTML_QuickForm_Renderer_ITStatic(&$tpl) |
111 | 111 | { |
112 | 112 | $this->HTML_QuickForm_Renderer(); |
113 | - $this->_tpl =& $tpl; |
|
113 | + $this->_tpl = & $tpl; |
|
114 | 114 | } // end constructor |
115 | 115 | |
116 | 116 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | // add hidden elements, if collected |
156 | 156 | if (!empty($this->_hidden)) { |
157 | - $this->_tpl->setVariable($this->_formName . '_hidden', $this->_hidden); |
|
157 | + $this->_tpl->setVariable($this->_formName.'_hidden', $this->_hidden); |
|
158 | 158 | } |
159 | 159 | // assign form attributes |
160 | 160 | $this->_tpl->setVariable($this->_formName.'_attributes', $form->getAttributes(true)); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->_elementIndex++; |
204 | 204 | } |
205 | 205 | if ($varName != $this->_inGroup) { |
206 | - $varName .= '_' == substr($varName, -1)? '': '_'; |
|
206 | + $varName .= '_' == substr($varName, -1) ? '' : '_'; |
|
207 | 207 | // element name is of type : group[name] |
208 | 208 | $label = $element->getLabel(); |
209 | 209 | $html = $element->toHtml(); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | function renderHidden(&$element) |
268 | 268 | { |
269 | - if ($this->_tpl->placeholderExists($this->_formName . '_hidden')) { |
|
269 | + if ($this->_tpl->placeholderExists($this->_formName.'_hidden')) { |
|
270 | 270 | $this->_hidden .= $element->toHtml(); |
271 | 271 | } else { |
272 | 272 | $name = $element->getName(); |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | // <!-- BEGIN form_group_error -->{form_group_error}<!-- END form_group_error --> |
308 | 308 | if (!empty($error)) { |
309 | 309 | if ($this->_tpl->placeholderExists($varName.'_error')) { |
310 | - if ($this->_tpl->blockExists($this->_formName . '_error_block')) { |
|
311 | - $this->_tpl->setVariable($this->_formName . '_error', $error); |
|
312 | - $error = $this->_getTplBlock($this->_formName . '_error_block'); |
|
310 | + if ($this->_tpl->blockExists($this->_formName.'_error_block')) { |
|
311 | + $this->_tpl->setVariable($this->_formName.'_error', $error); |
|
312 | + $error = $this->_getTplBlock($this->_formName.'_error_block'); |
|
313 | 313 | } elseif (strpos($this->_error, '{html}') !== false || strpos($this->_error, '{label}') !== false) { |
314 | 314 | $error = str_replace('{error}', $error, $this->_error); |
315 | 315 | } |
316 | 316 | } |
317 | - $this->_tpl->setVariable($varName . '_error', $error); |
|
317 | + $this->_tpl->setVariable($varName.'_error', $error); |
|
318 | 318 | array_pop($this->_errors); |
319 | 319 | } |
320 | 320 | } |
@@ -401,17 +401,17 @@ discard block |
||
401 | 401 | */ |
402 | 402 | function _renderRequired(&$label, &$html) |
403 | 403 | { |
404 | - if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_required_block')) { |
|
405 | - if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) { |
|
406 | - $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label); |
|
404 | + if ($this->_tpl->blockExists($tplBlock = $this->_formName.'_required_block')) { |
|
405 | + if (!empty($label) && $this->_tpl->placeholderExists($this->_formName.'_label', $tplBlock)) { |
|
406 | + $this->_tpl->setVariable($this->_formName.'_label', is_array($label) ? $label[0] : $label); |
|
407 | 407 | if (is_array($label)) { |
408 | 408 | $label[0] = $this->_getTplBlock($tplBlock); |
409 | 409 | } else { |
410 | 410 | $label = $this->_getTplBlock($tplBlock); |
411 | 411 | } |
412 | 412 | } |
413 | - if (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) { |
|
414 | - $this->_tpl->setVariable($this->_formName . '_html', $html); |
|
413 | + if (!empty($html) && $this->_tpl->placeholderExists($this->_formName.'_html', $tplBlock)) { |
|
414 | + $this->_tpl->setVariable($this->_formName.'_html', $html); |
|
415 | 415 | $html = $this->_getTplBlock($tplBlock); |
416 | 416 | } |
417 | 417 | } else { |
@@ -444,21 +444,21 @@ discard block |
||
444 | 444 | */ |
445 | 445 | function _renderError(&$label, &$html, $error) |
446 | 446 | { |
447 | - if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_error_block')) { |
|
448 | - $this->_tpl->setVariable($this->_formName . '_error', $error); |
|
449 | - if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) { |
|
450 | - $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label); |
|
447 | + if ($this->_tpl->blockExists($tplBlock = $this->_formName.'_error_block')) { |
|
448 | + $this->_tpl->setVariable($this->_formName.'_error', $error); |
|
449 | + if (!empty($label) && $this->_tpl->placeholderExists($this->_formName.'_label', $tplBlock)) { |
|
450 | + $this->_tpl->setVariable($this->_formName.'_label', is_array($label) ? $label[0] : $label); |
|
451 | 451 | if (is_array($label)) { |
452 | 452 | $label[0] = $this->_getTplBlock($tplBlock); |
453 | 453 | } else { |
454 | 454 | $label = $this->_getTplBlock($tplBlock); |
455 | 455 | } |
456 | - } elseif (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) { |
|
457 | - $this->_tpl->setVariable($this->_formName . '_html', $html); |
|
456 | + } elseif (!empty($html) && $this->_tpl->placeholderExists($this->_formName.'_html', $tplBlock)) { |
|
457 | + $this->_tpl->setVariable($this->_formName.'_html', $html); |
|
458 | 458 | $html = $this->_getTplBlock($tplBlock); |
459 | 459 | } |
460 | 460 | // clean up after ourselves |
461 | - $this->_tpl->setVariable($this->_formName . '_error', null); |
|
461 | + $this->_tpl->setVariable($this->_formName.'_error', null); |
|
462 | 462 | } elseif (!empty($label) && strpos($this->_error, '{label}') !== false) { |
463 | 463 | if (is_array($label)) { |
464 | 464 | $label[0] = str_replace(array('{label}', '{error}'), array($label[0], $error), $this->_error); |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | { |
104 | 104 | $this->HTML_QuickForm_Renderer_Object(true); |
105 | 105 | $this->_obj = new QuickformFlexyForm(); |
106 | - $this->_flexy =& $flexy; |
|
106 | + $this->_flexy = & $flexy; |
|
107 | 107 | } // end constructor |
108 | 108 | |
109 | 109 | function renderHeader(&$header) |
110 | 110 | { |
111 | - if($name = $header->getName()) { |
|
111 | + if ($name = $header->getName()) { |
|
112 | 112 | $this->_obj->header->$name = $header->toHtml(); |
113 | 113 | } else { |
114 | 114 | $this->_obj->header[$this->_sectionCount] = $header->toHtml(); |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | function _elementToObject(&$element, $required, $error) |
136 | 136 | { |
137 | 137 | $ret = parent::_elementToObject($element, $required, $error); |
138 | - if($ret->type == 'group') { |
|
138 | + if ($ret->type == 'group') { |
|
139 | 139 | $ret->html = $element->toHtml(); |
140 | 140 | unset($ret->elements); |
141 | 141 | } |
142 | - if(!empty($this->_label)) { |
|
142 | + if (!empty($this->_label)) { |
|
143 | 143 | $this->_renderLabel($ret); |
144 | 144 | } |
145 | 145 | |
146 | - if(!empty($this->_html)) { |
|
146 | + if (!empty($this->_html)) { |
|
147 | 147 | $this->_renderHtml($ret); |
148 | 148 | $ret->error = $error; |
149 | 149 | } |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | // Create an element key from the name |
152 | 152 | if (false !== ($pos = strpos($ret->name, '[')) || is_object($this->_currentGroup)) { |
153 | 153 | if (!$pos) { |
154 | - $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}'; |
|
154 | + $keys = '->{\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name).'\'}'; |
|
155 | 155 | } else { |
156 | - $keys = '->{\'' . str_replace( |
|
156 | + $keys = '->{\''.str_replace( |
|
157 | 157 | array('\\', '\'', '[', ']'), array('\\\\', '\\\'', '\'}->{\'', ''), |
158 | 158 | $ret->name |
159 | - ) . '\'}'; |
|
159 | + ).'\'}'; |
|
160 | 160 | } |
161 | 161 | // special handling for elements in native groups |
162 | 162 | if (is_object($this->_currentGroup)) { |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | } elseif (0 == strlen($ret->name)) { |
174 | - $keys = '->{\'element_' . $this->_elementIdx . '\'}'; |
|
174 | + $keys = '->{\'element_'.$this->_elementIdx.'\'}'; |
|
175 | 175 | } else { |
176 | - $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}'; |
|
176 | + $keys = '->{\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name).'\'}'; |
|
177 | 177 | } |
178 | 178 | // for radios: add extra key from value |
179 | 179 | if ('radio' == $ret->type && '[]' != substr($keys, -2)) { |
180 | - $keys .= '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->value) . '\'}'; |
|
180 | + $keys .= '->{\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->value).'\'}'; |
|
181 | 181 | } |
182 | 182 | $ret->keys = $keys; |
183 | 183 | $this->_elementIdx++; |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | if ($elObj) { |
198 | 198 | $keys = $elObj->keys; |
199 | 199 | unset($elObj->keys); |
200 | - if(is_object($this->_currentGroup) && ('group' != $elObj->type)) { |
|
201 | - $code = '$this->_currentGroup' . $keys . ' = $elObj;'; |
|
200 | + if (is_object($this->_currentGroup) && ('group' != $elObj->type)) { |
|
201 | + $code = '$this->_currentGroup'.$keys.' = $elObj;'; |
|
202 | 202 | } else { |
203 | - $code = '$this->_obj' . $keys . ' = $elObj;'; |
|
203 | + $code = '$this->_obj'.$keys.' = $elObj;'; |
|
204 | 204 | } |
205 | 205 | eval($code); |
206 | 206 | } |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | foreach (array_keys($this->renderedElements) as $key) { |
79 | 79 | if (!$this->renderedElements[$key]['rendered']) { |
80 | 80 | $this->renderedElements[$key]['rendered'] = true; |
81 | - $data .= $this->renderedElements[$key]['html'] . "\n"; |
|
81 | + $data .= $this->renderedElements[$key]['html']."\n"; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Insert the extra data and form elements at the end of the form |
86 | - $this->_html = str_replace('</form>', $data . "\n</form>", $this->_html); |
|
86 | + $this->_html = str_replace('</form>', $data."\n</form>", $this->_html); |
|
87 | 87 | return $this->_html; |
88 | 88 | } // end func toHtml |
89 | 89 | |
@@ -117,13 +117,11 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if (is_null($elementKey)) { |
120 | - $msg = is_null($elementValue) ? "Element $elementName does not exist." : |
|
121 | - "Element $elementName with value of $elementValue does not exist."; |
|
120 | + $msg = is_null($elementValue) ? "Element $elementName does not exist." : "Element $elementName with value of $elementValue does not exist."; |
|
122 | 121 | return PEAR::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true); |
123 | 122 | } else { |
124 | 123 | if ($this->renderedElements[$elementKey]['rendered']) { |
125 | - $msg = is_null($elementValue) ? "Element $elementName has already been rendered." : |
|
126 | - "Element $elementName with value of $elementValue has already been rendered."; |
|
124 | + $msg = is_null($elementValue) ? "Element $elementName has already been rendered." : "Element $elementName with value of $elementValue has already been rendered."; |
|
127 | 125 | return PEAR::raiseError(null, QUICKFORM_ERROR, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true); |
128 | 126 | } else { |
129 | 127 | $this->renderedElements[$elementKey]['rendered'] = true; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | // _hiddenHtml is cleared in finishForm(), so this only matters when |
184 | 184 | // finishForm() was not called (e.g. group::toHtml(), bug #3511) |
185 | - return $this->_hiddenHtml . $this->_html; |
|
185 | + return $this->_hiddenHtml.$this->_html; |
|
186 | 186 | } // end func toHtml |
187 | 187 | |
188 | 188 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $this->_html = str_replace('{content}', $this->_html, $html); |
245 | 245 | // add a validation script |
246 | 246 | if ('' != ($script = $form->getValidationScript())) { |
247 | - $this->_html = $script . "\n" . $this->_html; |
|
247 | + $this->_html = $script."\n".$this->_html; |
|
248 | 248 | } |
249 | 249 | } // end func finishForm |
250 | 250 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $nameLabel = $label; |
290 | 290 | } |
291 | 291 | |
292 | - $labelFor = !empty($labelForId) ? 'for="' . $labelForId . '"' : 'for="' . $element->getName() . '"'; |
|
292 | + $labelFor = !empty($labelForId) ? 'for="'.$labelForId.'"' : 'for="'.$element->getName().'"'; |
|
293 | 293 | |
294 | 294 | if (isset($this->_templates[$name])) { |
295 | 295 | // Custom template |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | if (is_array($label)) { |
332 | 332 | foreach ($label as $key => $text) { |
333 | - $key = is_int($key)? $key + 2: $key; |
|
333 | + $key = is_int($key) ? $key + 2 : $key; |
|
334 | 334 | $html = str_replace("{label_{$key}}", $text, $html); |
335 | 335 | $html = str_replace("<!-- BEGIN label_{$key} -->", '', $html); |
336 | 336 | $html = str_replace("<!-- END label_{$key} -->", '', $html); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | function renderHidden(&$element) |
391 | 391 | { |
392 | - $this->_hiddenHtml .= $element->toHtml() . "\n"; |
|
392 | + $this->_hiddenHtml .= $element->toHtml()."\n"; |
|
393 | 393 | } // end func renderHidden |
394 | 394 | |
395 | 395 | /** |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | { |
418 | 418 | $name = $group->getName(); |
419 | 419 | $this->_groupTemplate = $this->_prepareTemplate($group, $required, $error); |
420 | - $this->_groupElementTemplate = empty($this->_groupTemplates[$name])? '': $this->_groupTemplates[$name]; |
|
421 | - $this->_groupWrap = empty($this->_groupWraps[$name])? '': $this->_groupWraps[$name]; |
|
420 | + $this->_groupElementTemplate = empty($this->_groupTemplates[$name]) ? '' : $this->_groupTemplates[$name]; |
|
421 | + $this->_groupWrap = empty($this->_groupWraps[$name]) ? '' : $this->_groupWraps[$name]; |
|
422 | 422 | $this->_groupElements = array(); |
423 | 423 | $this->_inGroup = true; |
424 | 424 | } // end func startGroup |
@@ -437,13 +437,13 @@ discard block |
||
437 | 437 | $count = count($separator); |
438 | 438 | $html = ''; |
439 | 439 | for ($i = 0; $i < count($this->_groupElements); $i++) { |
440 | - $html .= (0 == $i? '': $separator[($i - 1) % $count]) . $this->_groupElements[$i]; |
|
440 | + $html .= (0 == $i ? '' : $separator[($i - 1) % $count]).$this->_groupElements[$i]; |
|
441 | 441 | } |
442 | 442 | } else { |
443 | 443 | if (is_null($separator)) { |
444 | 444 | $separator = ' '; |
445 | 445 | } |
446 | - $html = implode((string)$separator, $this->_groupElements); |
|
446 | + $html = implode((string) $separator, $this->_groupElements); |
|
447 | 447 | } |
448 | 448 | if (!empty($this->_groupWrap)) { |
449 | 449 | $html = str_replace('{content}', $html, $this->_groupWrap); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | function renderHidden(&$element) |
225 | 225 | { |
226 | 226 | if ($this->_collectHidden) { |
227 | - $this->_ary['hidden'] .= $element->toHtml() . "\n"; |
|
227 | + $this->_ary['hidden'] .= $element->toHtml()."\n"; |
|
228 | 228 | } else { |
229 | 229 | $this->renderElement($element, false, null); |
230 | 230 | } |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | // render label(s) |
270 | 270 | $labels = $element->getLabel(); |
271 | 271 | if (is_array($labels) && $this->_staticLabels) { |
272 | - foreach($labels as $key => $label) { |
|
273 | - $key = is_int($key)? $key + 1: $key; |
|
272 | + foreach ($labels as $key => $label) { |
|
273 | + $key = is_int($key) ? $key + 1 : $key; |
|
274 | 274 | if (1 === $key) { |
275 | 275 | $ret['label'] = $label; |
276 | 276 | } else { |
277 | - $ret['label_' . $key] = $label; |
|
277 | + $ret['label_'.$key] = $label; |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | } else { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | function HTML_QuickForm_Renderer_ITDynamic(&$tpl) |
96 | 96 | { |
97 | 97 | $this->HTML_QuickForm_Renderer(); |
98 | - $this->_tpl =& $tpl; |
|
98 | + $this->_tpl = & $tpl; |
|
99 | 99 | $this->_tpl->setCurrentBlock('qf_main_loop'); |
100 | 100 | } |
101 | 101 | |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | if (is_array($this->_groupSeparator)) { |
142 | 142 | $this->_tpl->setVariable('qf_separator', $this->_groupSeparator[($this->_groupElementIdx - 1) % count($this->_groupSeparator)]); |
143 | 143 | } else { |
144 | - $this->_tpl->setVariable('qf_separator', (string)$this->_groupSeparator); |
|
144 | + $this->_tpl->setVariable('qf_separator', (string) $this->_groupSeparator); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | $this->_groupElementIdx++; |
148 | 148 | |
149 | - } elseif(!empty($error)) { |
|
149 | + } elseif (!empty($error)) { |
|
150 | 150 | // show the error message or keep it for later use |
151 | - if ($this->_tpl->blockExists($blockName . '_error')) { |
|
151 | + if ($this->_tpl->blockExists($blockName.'_error')) { |
|
152 | 152 | $this->_tpl->setVariable('qf_error', $error); |
153 | 153 | } else { |
154 | 154 | $this->_errors[] = $error; |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | // show an '*' near the required element |
158 | 158 | if ($required) { |
159 | 159 | $this->_showRequired = true; |
160 | - if ($this->_tpl->blockExists($blockName . '_required')) { |
|
161 | - $this->_tpl->touchBlock($blockName . '_required'); |
|
160 | + if ($this->_tpl->blockExists($blockName.'_required')) { |
|
161 | + $this->_tpl->touchBlock($blockName.'_required'); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | // Prepare multiple labels |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | } |
176 | 176 | // render extra labels, if any |
177 | 177 | if (is_array($labels)) { |
178 | - foreach($labels as $key => $label) { |
|
179 | - $key = is_int($key)? $key + 2: $key; |
|
180 | - if ($this->_tpl->blockExists($blockName . '_label_' . $key)) { |
|
181 | - $this->_tpl->setVariable('qf_label_' . $key, $label); |
|
178 | + foreach ($labels as $key => $label) { |
|
179 | + $key = is_int($key) ? $key + 2 : $key; |
|
180 | + if ($this->_tpl->blockExists($blockName.'_label_'.$key)) { |
|
181 | + $this->_tpl->setVariable('qf_label_'.$key, $label); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |
@@ -197,19 +197,19 @@ discard block |
||
197 | 197 | function startGroup(&$group, $required, $error) |
198 | 198 | { |
199 | 199 | $blockName = $this->_matchBlock($group); |
200 | - $this->_tpl->setCurrentBlock($blockName . '_loop'); |
|
200 | + $this->_tpl->setCurrentBlock($blockName.'_loop'); |
|
201 | 201 | $this->_groupElementIdx = 0; |
202 | - $this->_groupSeparator = is_null($group->_separator)? ' ': $group->_separator; |
|
202 | + $this->_groupSeparator = is_null($group->_separator) ? ' ' : $group->_separator; |
|
203 | 203 | // show an '*' near the required element |
204 | 204 | if ($required) { |
205 | 205 | $this->_showRequired = true; |
206 | - if ($this->_tpl->blockExists($blockName . '_required')) { |
|
207 | - $this->_tpl->touchBlock($blockName . '_required'); |
|
206 | + if ($this->_tpl->blockExists($blockName.'_required')) { |
|
207 | + $this->_tpl->touchBlock($blockName.'_required'); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | // show the error message or keep it for later use |
211 | 211 | if (!empty($error)) { |
212 | - if ($this->_tpl->blockExists($blockName . '_error')) { |
|
212 | + if ($this->_tpl->blockExists($blockName.'_error')) { |
|
213 | 213 | $this->_tpl->setVariable('qf_error', $error); |
214 | 214 | } else { |
215 | 215 | $this->_errors[] = $error; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $name = $element->getName(); |
244 | 244 | $type = $element->getType(); |
245 | 245 | if (isset($this->_elementBlocks[$name]) && $this->_tpl->blockExists($this->_elementBlocks[$name])) { |
246 | - if (('group' == $type) || ($this->_elementBlocks[$name] . '_loop' != $this->_tpl->currentBlock)) { |
|
246 | + if (('group' == $type) || ($this->_elementBlocks[$name].'_loop' != $this->_tpl->currentBlock)) { |
|
247 | 247 | return $this->_elementBlocks[$name]; |
248 | 248 | } |
249 | 249 | } |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | } else { |
253 | 253 | $prefix = 'qf'; |
254 | 254 | } |
255 | - if ($this->_tpl->blockExists($prefix . '_' . $type)) { |
|
256 | - return $prefix . '_' . $type; |
|
257 | - } elseif ($this->_tpl->blockExists($prefix . '_' . $name)) { |
|
258 | - return $prefix . '_' . $name; |
|
255 | + if ($this->_tpl->blockExists($prefix.'_'.$type)) { |
|
256 | + return $prefix.'_'.$type; |
|
257 | + } elseif ($this->_tpl->blockExists($prefix.'_'.$name)) { |
|
258 | + return $prefix.'_'.$name; |
|
259 | 259 | } else { |
260 | - return $prefix . '_element'; |
|
260 | + return $prefix.'_element'; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 |