@@ -40,48 +40,48 @@ discard block |
||
40 | 40 | */ |
41 | 41 | class HTML_QuickForm_Controller |
42 | 42 | { |
43 | - /** |
|
44 | - * Contains the pages (HTML_QuickForm_Page objects) of the miultipage form |
|
45 | - * @var array |
|
46 | - */ |
|
43 | + /** |
|
44 | + * Contains the pages (HTML_QuickForm_Page objects) of the miultipage form |
|
45 | + * @var array |
|
46 | + */ |
|
47 | 47 | var $_pages = array(); |
48 | 48 | |
49 | - /** |
|
50 | - * Contains the mapping of actions to corresponding HTML_QuickForm_Action objects |
|
51 | - * @var array |
|
52 | - */ |
|
49 | + /** |
|
50 | + * Contains the mapping of actions to corresponding HTML_QuickForm_Action objects |
|
51 | + * @var array |
|
52 | + */ |
|
53 | 53 | var $_actions = array(); |
54 | 54 | |
55 | - /** |
|
56 | - * Name of the form, used to store the values in session |
|
57 | - * @var string |
|
58 | - */ |
|
55 | + /** |
|
56 | + * Name of the form, used to store the values in session |
|
57 | + * @var string |
|
58 | + */ |
|
59 | 59 | var $_name; |
60 | 60 | |
61 | - /** |
|
62 | - * Whether the form is modal |
|
63 | - * @var bool |
|
64 | - */ |
|
61 | + /** |
|
62 | + * Whether the form is modal |
|
63 | + * @var bool |
|
64 | + */ |
|
65 | 65 | var $_modal = true; |
66 | 66 | |
67 | - /** |
|
68 | - * The action extracted from HTTP request: array('page', 'action') |
|
69 | - * @var array |
|
70 | - */ |
|
67 | + /** |
|
68 | + * The action extracted from HTTP request: array('page', 'action') |
|
69 | + * @var array |
|
70 | + */ |
|
71 | 71 | var $_actionName = null; |
72 | 72 | |
73 | - /** |
|
74 | - * Class constructor. |
|
75 | - * |
|
76 | - * Sets the form name and modal/non-modal behaviuor. Different multipage |
|
77 | - * forms should have different names, as they are used to store form |
|
78 | - * values in session. Modal forms allow passing to the next page only when |
|
79 | - * all of the previous pages are valid. |
|
80 | - * |
|
81 | - * @access public |
|
82 | - * @param string form name |
|
83 | - * @param bool whether the form is modal |
|
84 | - */ |
|
73 | + /** |
|
74 | + * Class constructor. |
|
75 | + * |
|
76 | + * Sets the form name and modal/non-modal behaviuor. Different multipage |
|
77 | + * forms should have different names, as they are used to store form |
|
78 | + * values in session. Modal forms allow passing to the next page only when |
|
79 | + * all of the previous pages are valid. |
|
80 | + * |
|
81 | + * @access public |
|
82 | + * @param string form name |
|
83 | + * @param bool whether the form is modal |
|
84 | + */ |
|
85 | 85 | function HTML_QuickForm_Controller($name, $modal = true) |
86 | 86 | { |
87 | 87 | $this->_name = $name; |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * Returns a reference to a session variable containing the form-page |
|
94 | - * values and pages' validation status. |
|
95 | - * |
|
96 | - * This is a "low-level" method, use exportValues() if you want just to |
|
97 | - * get the form's values. |
|
98 | - * |
|
99 | - * @access public |
|
100 | - * @param bool If true, then reset the container: clear all default, constant and submitted values |
|
101 | - * @return array |
|
102 | - */ |
|
92 | + /** |
|
93 | + * Returns a reference to a session variable containing the form-page |
|
94 | + * values and pages' validation status. |
|
95 | + * |
|
96 | + * This is a "low-level" method, use exportValues() if you want just to |
|
97 | + * get the form's values. |
|
98 | + * |
|
99 | + * @access public |
|
100 | + * @param bool If true, then reset the container: clear all default, constant and submitted values |
|
101 | + * @return array |
|
102 | + */ |
|
103 | 103 | function &container($reset = false) |
104 | 104 | { |
105 | 105 | $name = '_' . $this->_name . '_container'; |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | |
124 | - /** |
|
125 | - * Processes the request. |
|
126 | - * |
|
127 | - * This finds the current page, the current action and passes the action |
|
128 | - * to the page's handle() method. |
|
129 | - * |
|
130 | - * @access public |
|
131 | - * @throws PEAR_Error |
|
132 | - */ |
|
124 | + /** |
|
125 | + * Processes the request. |
|
126 | + * |
|
127 | + * This finds the current page, the current action and passes the action |
|
128 | + * to the page's handle() method. |
|
129 | + * |
|
130 | + * @access public |
|
131 | + * @throws PEAR_Error |
|
132 | + */ |
|
133 | 133 | function run() |
134 | 134 | { |
135 | 135 | // the names of the action and page should be saved |
@@ -138,25 +138,25 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | - /** |
|
142 | - * Registers a handler for a specific action. |
|
143 | - * |
|
144 | - * @access public |
|
145 | - * @param string name of the action |
|
146 | - * @param HTML_QuickForm_Action the handler for the action |
|
147 | - */ |
|
141 | + /** |
|
142 | + * Registers a handler for a specific action. |
|
143 | + * |
|
144 | + * @access public |
|
145 | + * @param string name of the action |
|
146 | + * @param HTML_QuickForm_Action the handler for the action |
|
147 | + */ |
|
148 | 148 | function addAction($actionName, &$action) |
149 | 149 | { |
150 | 150 | $this->_actions[$actionName] =& $action; |
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | - /** |
|
155 | - * Adds a new page to the form |
|
156 | - * |
|
157 | - * @access public |
|
158 | - * @param HTML_QuickForm_Page |
|
159 | - */ |
|
154 | + /** |
|
155 | + * Adds a new page to the form |
|
156 | + * |
|
157 | + * @access public |
|
158 | + * @param HTML_QuickForm_Page |
|
159 | + */ |
|
160 | 160 | function addPage(&$page) |
161 | 161 | { |
162 | 162 | $page->controller =& $this; |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | - /** |
|
168 | - * Returns a page |
|
169 | - * |
|
170 | - * @access public |
|
171 | - * @param string Name of a page |
|
172 | - * @return HTML_QuickForm_Page A reference to the page |
|
173 | - * @throws PEAR_Error |
|
174 | - */ |
|
167 | + /** |
|
168 | + * Returns a page |
|
169 | + * |
|
170 | + * @access public |
|
171 | + * @param string Name of a page |
|
172 | + * @return HTML_QuickForm_Page A reference to the page |
|
173 | + * @throws PEAR_Error |
|
174 | + */ |
|
175 | 175 | function &getPage($pageName) |
176 | 176 | { |
177 | 177 | if (!isset($this->_pages[$pageName])) { |
@@ -181,18 +181,18 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | - /** |
|
185 | - * Handles an action. |
|
186 | - * |
|
187 | - * This will be called if the page itself does not have a handler |
|
188 | - * to a specific action. The method also loads and uses default handlers |
|
189 | - * for common actions, if specific ones were not added. |
|
190 | - * |
|
191 | - * @access public |
|
192 | - * @param HTML_QuickForm_Page The page that failed to handle the action |
|
193 | - * @param string Name of the action |
|
194 | - * @throws PEAR_Error |
|
195 | - */ |
|
184 | + /** |
|
185 | + * Handles an action. |
|
186 | + * |
|
187 | + * This will be called if the page itself does not have a handler |
|
188 | + * to a specific action. The method also loads and uses default handlers |
|
189 | + * for common actions, if specific ones were not added. |
|
190 | + * |
|
191 | + * @access public |
|
192 | + * @param HTML_QuickForm_Page The page that failed to handle the action |
|
193 | + * @param string Name of the action |
|
194 | + * @throws PEAR_Error |
|
195 | + */ |
|
196 | 196 | function handle(&$page, $actionName) |
197 | 197 | { |
198 | 198 | if (isset($this->_actions[$actionName])) { |
@@ -215,26 +215,26 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | |
218 | - /** |
|
219 | - * Checks whether the form is modal. |
|
220 | - * |
|
221 | - * @access public |
|
222 | - * @return bool |
|
223 | - */ |
|
218 | + /** |
|
219 | + * Checks whether the form is modal. |
|
220 | + * |
|
221 | + * @access public |
|
222 | + * @return bool |
|
223 | + */ |
|
224 | 224 | function isModal() |
225 | 225 | { |
226 | 226 | return $this->_modal; |
227 | 227 | } |
228 | 228 | |
229 | 229 | |
230 | - /** |
|
231 | - * Checks whether the pages of the controller are valid |
|
232 | - * |
|
233 | - * @access public |
|
234 | - * @param string If set, check only the pages before (not including) that page |
|
235 | - * @return bool |
|
236 | - * @throws PEAR_Error |
|
237 | - */ |
|
230 | + /** |
|
231 | + * Checks whether the pages of the controller are valid |
|
232 | + * |
|
233 | + * @access public |
|
234 | + * @param string If set, check only the pages before (not including) that page |
|
235 | + * @return bool |
|
236 | + * @throws PEAR_Error |
|
237 | + */ |
|
238 | 238 | function isValid($pageName = null) |
239 | 239 | { |
240 | 240 | $data =& $this->container(); |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | |
276 | - /** |
|
277 | - * Returns the name of the page before the given. |
|
278 | - * |
|
279 | - * @access public |
|
280 | - * @param string |
|
281 | - * @return string |
|
282 | - */ |
|
276 | + /** |
|
277 | + * Returns the name of the page before the given. |
|
278 | + * |
|
279 | + * @access public |
|
280 | + * @param string |
|
281 | + * @return string |
|
282 | + */ |
|
283 | 283 | function getPrevName($pageName) |
284 | 284 | { |
285 | 285 | $prev = null; |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | - /** |
|
296 | - * Returns the name of the page after the given. |
|
297 | - * |
|
298 | - * @access public |
|
299 | - * @param string |
|
300 | - * @return string |
|
301 | - */ |
|
295 | + /** |
|
296 | + * Returns the name of the page after the given. |
|
297 | + * |
|
298 | + * @access public |
|
299 | + * @param string |
|
300 | + * @return string |
|
301 | + */ |
|
302 | 302 | function getNextName($pageName) |
303 | 303 | { |
304 | 304 | $prev = null; |
@@ -312,12 +312,12 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | |
315 | - /** |
|
316 | - * Finds the (first) invalid page |
|
317 | - * |
|
318 | - * @access public |
|
319 | - * @return string Name of an invalid page |
|
320 | - */ |
|
315 | + /** |
|
316 | + * Finds the (first) invalid page |
|
317 | + * |
|
318 | + * @access public |
|
319 | + * @return string Name of an invalid page |
|
320 | + */ |
|
321 | 321 | function findInvalid() |
322 | 322 | { |
323 | 323 | $data =& $this->container(); |
@@ -330,13 +330,13 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | |
333 | - /** |
|
334 | - * Extracts the names of the current page and the current action from |
|
335 | - * HTTP request data. |
|
336 | - * |
|
337 | - * @access public |
|
338 | - * @return array first element is page name, second is action name |
|
339 | - */ |
|
333 | + /** |
|
334 | + * Extracts the names of the current page and the current action from |
|
335 | + * HTTP request data. |
|
336 | + * |
|
337 | + * @access public |
|
338 | + * @return array first element is page name, second is action name |
|
339 | + */ |
|
340 | 340 | function getActionName() |
341 | 341 | { |
342 | 342 | if (is_array($this->_actionName)) { |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | } |
361 | 361 | |
362 | 362 | |
363 | - /** |
|
364 | - * Initializes default form values. |
|
365 | - * |
|
366 | - * @access public |
|
367 | - * @param array default values |
|
368 | - * @param mixed filter(s) to apply to default values |
|
369 | - * @throws PEAR_Error |
|
370 | - */ |
|
363 | + /** |
|
364 | + * Initializes default form values. |
|
365 | + * |
|
366 | + * @access public |
|
367 | + * @param array default values |
|
368 | + * @param mixed filter(s) to apply to default values |
|
369 | + * @throws PEAR_Error |
|
370 | + */ |
|
371 | 371 | function setDefaults($defaultValues = null, $filter = null) |
372 | 372 | { |
373 | 373 | if (is_array($defaultValues)) { |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | |
380 | - /** |
|
381 | - * Initializes constant form values. |
|
382 | - * These values won't get overridden by POST or GET vars |
|
383 | - * |
|
384 | - * @access public |
|
385 | - * @param array constant values |
|
386 | - * @param mixed filter(s) to apply to constant values |
|
387 | - * @throws PEAR_Error |
|
388 | - */ |
|
380 | + /** |
|
381 | + * Initializes constant form values. |
|
382 | + * These values won't get overridden by POST or GET vars |
|
383 | + * |
|
384 | + * @access public |
|
385 | + * @param array constant values |
|
386 | + * @param mixed filter(s) to apply to constant values |
|
387 | + * @throws PEAR_Error |
|
388 | + */ |
|
389 | 389 | function setConstants($constantValues = null, $filter = null) |
390 | 390 | { |
391 | 391 | if (is_array($constantValues)) { |
@@ -395,15 +395,15 @@ discard block |
||
395 | 395 | } |
396 | 396 | |
397 | 397 | |
398 | - /** |
|
399 | - * Adds new values to defaults or constants array |
|
400 | - * |
|
401 | - * @access private |
|
402 | - * @param array array to add values to (either defaults or constants) |
|
403 | - * @param array values to add |
|
404 | - * @param mixed filters to apply to new values |
|
405 | - * @throws PEAR_Error |
|
406 | - */ |
|
398 | + /** |
|
399 | + * Adds new values to defaults or constants array |
|
400 | + * |
|
401 | + * @access private |
|
402 | + * @param array array to add values to (either defaults or constants) |
|
403 | + * @param array values to add |
|
404 | + * @param mixed filters to apply to new values |
|
405 | + * @throws PEAR_Error |
|
406 | + */ |
|
407 | 407 | function _setDefaultsOrConstants(&$values, $newValues, $filter = null) |
408 | 408 | { |
409 | 409 | if (isset($filter)) { |
@@ -425,14 +425,14 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | |
428 | - /** |
|
429 | - * Recursively applies the callback function to the value |
|
430 | - * |
|
431 | - * @param mixed Callback function |
|
432 | - * @param mixed Value to process |
|
433 | - * @access private |
|
434 | - * @return mixed Processed values |
|
435 | - */ |
|
428 | + /** |
|
429 | + * Recursively applies the callback function to the value |
|
430 | + * |
|
431 | + * @param mixed Callback function |
|
432 | + * @param mixed Value to process |
|
433 | + * @access private |
|
434 | + * @return mixed Processed values |
|
435 | + */ |
|
436 | 436 | function _arrayMapRecursive($callback, $value) |
437 | 437 | { |
438 | 438 | if (!is_array($value)) { |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | |
450 | - /** |
|
451 | - * Sets the default values for the given page |
|
452 | - * |
|
453 | - * @access public |
|
454 | - * @param string Name of a page |
|
455 | - */ |
|
450 | + /** |
|
451 | + * Sets the default values for the given page |
|
452 | + * |
|
453 | + * @access public |
|
454 | + * @param string Name of a page |
|
455 | + */ |
|
456 | 456 | function applyDefaults($pageName) |
457 | 457 | { |
458 | 458 | $data =& $this->container(); |
@@ -465,13 +465,13 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | |
468 | - /** |
|
469 | - * Returns the form's values |
|
470 | - * |
|
471 | - * @access public |
|
472 | - * @param string name of the page, if not set then returns values for all pages |
|
473 | - * @return array |
|
474 | - */ |
|
468 | + /** |
|
469 | + * Returns the form's values |
|
470 | + * |
|
471 | + * @access public |
|
472 | + * @param string name of the page, if not set then returns values for all pages |
|
473 | + * @return array |
|
474 | + */ |
|
475 | 475 | function exportValues($pageName = null) |
476 | 476 | { |
477 | 477 | $data =& $this->container(); |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | |
500 | - /** |
|
501 | - * Returns the element's value |
|
502 | - * |
|
503 | - * @access public |
|
504 | - * @param string name of the page |
|
505 | - * @param string name of the element in the page |
|
506 | - * @return mixed value for the element |
|
507 | - */ |
|
500 | + /** |
|
501 | + * Returns the element's value |
|
502 | + * |
|
503 | + * @access public |
|
504 | + * @param string name of the page |
|
505 | + * @param string name of the element in the page |
|
506 | + * @return mixed value for the element |
|
507 | + */ |
|
508 | 508 | function exportValue($pageName, $elementName) |
509 | 509 | { |
510 | 510 | $data =& $this->container(); |
@@ -183,9 +183,9 @@ |
||
183 | 183 | return true; |
184 | 184 | } |
185 | 185 | |
186 | - /** |
|
187 | - * We don't need values from button-type elements (except submit) and files |
|
188 | - */ |
|
186 | + /** |
|
187 | + * We don't need values from button-type elements (except submit) and files |
|
188 | + */ |
|
189 | 189 | function exportValue(&$submitValues, $assoc = false) |
190 | 190 | { |
191 | 191 | $type = $this->getType(); |
@@ -184,9 +184,9 @@ |
||
184 | 184 | // }}} |
185 | 185 | // {{{ exportValue() |
186 | 186 | |
187 | - /** |
|
188 | - * We override this here because we don't want any values from static elements |
|
189 | - */ |
|
187 | + /** |
|
188 | + * We override this here because we don't want any values from static elements |
|
189 | + */ |
|
190 | 190 | function exportValue(&$submitValues, $assoc = false) |
191 | 191 | { |
192 | 192 | return null; |
@@ -33,34 +33,34 @@ |
||
33 | 33 | */ |
34 | 34 | class HTML_QuickForm_Rule |
35 | 35 | { |
36 | - /** |
|
37 | - * Name of the rule to use in validate method |
|
38 | - * |
|
39 | - * This property is used in more global rules like Callback and Regex |
|
40 | - * to determine which callback and which regex is to be used for validation |
|
41 | - * |
|
42 | - * @var string |
|
43 | - * @access public |
|
44 | - */ |
|
36 | + /** |
|
37 | + * Name of the rule to use in validate method |
|
38 | + * |
|
39 | + * This property is used in more global rules like Callback and Regex |
|
40 | + * to determine which callback and which regex is to be used for validation |
|
41 | + * |
|
42 | + * @var string |
|
43 | + * @access public |
|
44 | + */ |
|
45 | 45 | var $name; |
46 | 46 | |
47 | - /** |
|
48 | - * Validates a value |
|
49 | - * |
|
50 | - * @access public |
|
51 | - * @abstract |
|
52 | - */ |
|
47 | + /** |
|
48 | + * Validates a value |
|
49 | + * |
|
50 | + * @access public |
|
51 | + * @abstract |
|
52 | + */ |
|
53 | 53 | function validate($value, $options) |
54 | 54 | { |
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | |
58 | - /** |
|
59 | - * Sets the rule name |
|
60 | - * |
|
61 | - * @param string rule name |
|
62 | - * @access public |
|
63 | - */ |
|
58 | + /** |
|
59 | + * Sets the rule name |
|
60 | + * |
|
61 | + * @param string rule name |
|
62 | + * @access public |
|
63 | + */ |
|
64 | 64 | function setName($ruleName) |
65 | 65 | { |
66 | 66 | $this->name = $ruleName; |
@@ -225,41 +225,41 @@ discard block |
||
225 | 225 | list ($jsPrefix, $jsCheck) = $rule->getValidationScript($ruleData['format']); |
226 | 226 | if (!isset($ruleData['howmany'])) { |
227 | 227 | $js = $jsValue . "\n" . $jsPrefix . |
228 | - " if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" . |
|
229 | - " errFlag['{$jsField}'] = true;\n" . |
|
230 | - " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" . |
|
231 | - $jsReset . |
|
232 | - " }\n"; |
|
228 | + " if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" . |
|
229 | + " errFlag['{$jsField}'] = true;\n" . |
|
230 | + " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" . |
|
231 | + $jsReset . |
|
232 | + " }\n"; |
|
233 | 233 | } else { |
234 | 234 | $js = $jsValue . "\n" . $jsPrefix . |
235 | - " var res = 0;\n" . |
|
236 | - " for (var i = 0; i < value.length; i++) {\n" . |
|
237 | - " if (!(" . str_replace('{jsVar}', 'value[i]', $jsCheck) . ")) {\n" . |
|
238 | - " res++;\n" . |
|
239 | - " }\n" . |
|
240 | - " }\n" . |
|
241 | - " if (res < {$ruleData['howmany']} && !errFlag['{$jsField}']) {\n" . |
|
242 | - " errFlag['{$jsField}'] = true;\n" . |
|
243 | - " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" . |
|
244 | - $jsReset . |
|
245 | - " }\n"; |
|
235 | + " var res = 0;\n" . |
|
236 | + " for (var i = 0; i < value.length; i++) {\n" . |
|
237 | + " if (!(" . str_replace('{jsVar}', 'value[i]', $jsCheck) . ")) {\n" . |
|
238 | + " res++;\n" . |
|
239 | + " }\n" . |
|
240 | + " }\n" . |
|
241 | + " if (res < {$ruleData['howmany']} && !errFlag['{$jsField}']) {\n" . |
|
242 | + " errFlag['{$jsField}'] = true;\n" . |
|
243 | + " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" . |
|
244 | + $jsReset . |
|
245 | + " }\n"; |
|
246 | 246 | } |
247 | 247 | return $js; |
248 | 248 | } // end func getValidationScript |
249 | 249 | |
250 | 250 | |
251 | - /** |
|
252 | - * Returns JavaScript to get and to reset the element's value |
|
253 | - * |
|
254 | - * @access private |
|
255 | - * @param HTML_QuickForm_element element being processed |
|
256 | - * @param string element's name |
|
257 | - * @param bool whether to generate JavaScript to reset |
|
258 | - * the value |
|
259 | - * @param integer value's index in the array (only used for |
|
260 | - * multielement rules) |
|
261 | - * @return array first item is value javascript, second is reset |
|
262 | - */ |
|
251 | + /** |
|
252 | + * Returns JavaScript to get and to reset the element's value |
|
253 | + * |
|
254 | + * @access private |
|
255 | + * @param HTML_QuickForm_element element being processed |
|
256 | + * @param string element's name |
|
257 | + * @param bool whether to generate JavaScript to reset |
|
258 | + * the value |
|
259 | + * @param integer value's index in the array (only used for |
|
260 | + * multielement rules) |
|
261 | + * @return array first item is value javascript, second is reset |
|
262 | + */ |
|
263 | 263 | function _getJsValue(&$element, $elementName, $reset = false, $index = null) |
264 | 264 | { |
265 | 265 | $jsIndex = isset($index)? '[' . $index . ']': ''; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | for ($i = 0, $count = count($elements); $i < $count; $i++) { |
271 | 271 | $append = ($elements[$i]->getType() == 'select' && $elements[$i]->getMultiple())? '[]': ''; |
272 | 272 | $value .= "'" . $element->getElementName($i) . $append . "': true" . |
273 | - ($i < $count - 1? ', ': ''); |
|
273 | + ($i < $count - 1? ', ': ''); |
|
274 | 274 | } |
275 | 275 | $value .= |
276 | 276 | "};\n" . |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | |
364 | 364 | } elseif ($element->getType() == 'radio') { |
365 | 365 | $value = " value{$jsIndex} = '';\n" . |
366 | - // Fix for bug #5644 |
|
367 | - " var els = 'length' in frm.elements['$elementName']? frm.elements['$elementName']: [ frm.elements['$elementName'] ];\n" . |
|
368 | - " for (var i = 0; i < els.length; i++) {\n" . |
|
369 | - " if (els[i].checked) {\n" . |
|
370 | - " value{$jsIndex} = els[i].value;\n" . |
|
371 | - " }\n" . |
|
372 | - " }"; |
|
366 | + // Fix for bug #5644 |
|
367 | + " var els = 'length' in frm.elements['$elementName']? frm.elements['$elementName']: [ frm.elements['$elementName'] ];\n" . |
|
368 | + " for (var i = 0; i < els.length; i++) {\n" . |
|
369 | + " if (els[i].checked) {\n" . |
|
370 | + " value{$jsIndex} = els[i].value;\n" . |
|
371 | + " }\n" . |
|
372 | + " }"; |
|
373 | 373 | if ($reset) { |
374 | 374 | $tmp_reset .= " for (var i = 0; i < field.length; i++) {\n" . |
375 | - " field[i].checked = field[i].defaultChecked;\n" . |
|
376 | - " }"; |
|
375 | + " field[i].checked = field[i].defaultChecked;\n" . |
|
376 | + " }"; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | } else { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | if ($this->getChecked()) { |
177 | 177 | return '<code>[x]</code>' . |
178 | - $this->_getPersistantData(); |
|
178 | + $this->_getPersistantData(); |
|
179 | 179 | } else { |
180 | 180 | return '<code>[ ]</code>'; |
181 | 181 | } |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | // }}} |
289 | 289 | // {{{ exportValue() |
290 | 290 | |
291 | - /** |
|
292 | - * Return true if the checkbox is checked, null if it is not checked (getValue() returns false) |
|
293 | - */ |
|
291 | + /** |
|
292 | + * Return true if the checkbox is checked, null if it is not checked (getValue() returns false) |
|
293 | + */ |
|
294 | 294 | function exportValue(&$submitValues, $assoc = false) |
295 | 295 | { |
296 | 296 | $value = $this->_findValue($submitValues); |
@@ -44,16 +44,16 @@ |
||
44 | 44 | */ |
45 | 45 | var $_data = array(); |
46 | 46 | |
47 | - /** |
|
48 | - * Whether to use BC mode for specific rules |
|
49 | - * |
|
50 | - * Previous versions of QF passed element's name as a first parameter |
|
51 | - * to validation functions, but not to validation methods. This behaviour |
|
52 | - * is emulated if you are using 'function' as rule type when registering. |
|
53 | - * |
|
54 | - * @var array |
|
55 | - * @access private |
|
56 | - */ |
|
47 | + /** |
|
48 | + * Whether to use BC mode for specific rules |
|
49 | + * |
|
50 | + * Previous versions of QF passed element's name as a first parameter |
|
51 | + * to validation functions, but not to validation methods. This behaviour |
|
52 | + * is emulated if you are using 'function' as rule type when registering. |
|
53 | + * |
|
54 | + * @var array |
|
55 | + * @access private |
|
56 | + */ |
|
57 | 57 | var $_BCMode = array(); |
58 | 58 | |
59 | 59 | /** |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule |
37 | 37 | { |
38 | - /** |
|
39 | - * Possible operators to use |
|
40 | - * @var array |
|
41 | - * @access private |
|
42 | - */ |
|
38 | + /** |
|
39 | + * Possible operators to use |
|
40 | + * @var array |
|
41 | + * @access private |
|
42 | + */ |
|
43 | 43 | var $_operators = array( |
44 | 44 | 'eq' => '===', |
45 | 45 | 'neq' => '!==', |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | '!=' => '!==' |
52 | 52 | ); |
53 | 53 | |
54 | - /** |
|
55 | - * Returns the operator to use for comparing the values |
|
56 | - * |
|
57 | - * @access private |
|
58 | - * @param string operator name |
|
59 | - * @return string operator to use for validation |
|
60 | - */ |
|
54 | + /** |
|
55 | + * Returns the operator to use for comparing the values |
|
56 | + * |
|
57 | + * @access private |
|
58 | + * @param string operator name |
|
59 | + * @return string operator to use for validation |
|
60 | + */ |
|
61 | 61 | function _findOperator($name) |
62 | 62 | { |
63 | 63 | $name = trim($name); |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | { |
39 | 39 | // {{{ properties |
40 | 40 | |
41 | - /** |
|
42 | - * Uploaded file data, from $_FILES |
|
43 | - * @var array |
|
44 | - */ |
|
41 | + /** |
|
42 | + * Uploaded file data, from $_FILES |
|
43 | + * @var array |
|
44 | + */ |
|
45 | 45 | var $_value = null; |
46 | 46 | |
47 | 47 | // }}} |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | // }}} |
238 | 238 | // {{{ _ruleCheckMaxFileSize() |
239 | 239 | |
240 | - /** |
|
241 | - * Tries to find the element value from the values array |
|
242 | - * |
|
243 | - * Needs to be redefined here as $_FILES is populated differently from |
|
244 | - * other arrays when element name is of the form foo[bar] |
|
245 | - * |
|
246 | - * @access private |
|
247 | - * @return mixed |
|
248 | - */ |
|
240 | + /** |
|
241 | + * Tries to find the element value from the values array |
|
242 | + * |
|
243 | + * Needs to be redefined here as $_FILES is populated differently from |
|
244 | + * other arrays when element name is of the form foo[bar] |
|
245 | + * |
|
246 | + * @access private |
|
247 | + * @return mixed |
|
248 | + */ |
|
249 | 249 | function _findValue(&$values = null) |
250 | 250 | { |
251 | 251 | if (empty($_FILES)) { |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | $idx = "['" . str_replace( |
263 | 263 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
264 | 264 | substr($elementName, $pos + 1, -1) |
265 | - ) . "']"; |
|
265 | + ) . "']"; |
|
266 | 266 | $props = array('name', 'type', 'size', 'tmp_name', 'error'); |
267 | 267 | $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" . |
268 | - " return null;\n" . |
|
269 | - "} else {\n" . |
|
270 | - " \$value = array();\n"; |
|
268 | + " return null;\n" . |
|
269 | + "} else {\n" . |
|
270 | + " \$value = array();\n"; |
|
271 | 271 | foreach ($props as $prop) { |
272 | 272 | $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n"; |
273 | 273 | } |