@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @see HTML_QuickForm::errorMessage() |
44 | 44 | */ |
45 | -define('QUICKFORM_OK', 1); |
|
46 | -define('QUICKFORM_ERROR', -1); |
|
47 | -define('QUICKFORM_INVALID_RULE', -2); |
|
48 | -define('QUICKFORM_NONEXIST_ELEMENT', -3); |
|
49 | -define('QUICKFORM_INVALID_FILTER', -4); |
|
50 | -define('QUICKFORM_UNREGISTERED_ELEMENT', -5); |
|
51 | -define('QUICKFORM_INVALID_ELEMENT_NAME', -6); |
|
52 | -define('QUICKFORM_INVALID_PROCESS', -7); |
|
53 | -define('QUICKFORM_DEPRECATED', -8); |
|
54 | -define('QUICKFORM_INVALID_DATASOURCE', -9); |
|
45 | +define('QUICKFORM_OK', 1); |
|
46 | +define('QUICKFORM_ERROR', -1); |
|
47 | +define('QUICKFORM_INVALID_RULE', -2); |
|
48 | +define('QUICKFORM_NONEXIST_ELEMENT', -3); |
|
49 | +define('QUICKFORM_INVALID_FILTER', -4); |
|
50 | +define('QUICKFORM_UNREGISTERED_ELEMENT', -5); |
|
51 | +define('QUICKFORM_INVALID_ELEMENT_NAME', -6); |
|
52 | +define('QUICKFORM_INVALID_PROCESS', -7); |
|
53 | +define('QUICKFORM_DEPRECATED', -8); |
|
54 | +define('QUICKFORM_INVALID_DATASOURCE', -9); |
|
55 | 55 | /**#@-*/ |
56 | 56 | |
57 | 57 | // }}} |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field |
230 | 230 | * @access public |
231 | 231 | */ |
232 | - public function __construct($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false) |
|
232 | + public function __construct($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false) |
|
233 | 233 | { |
234 | 234 | parent::__construct($attributes); |
235 | 235 | $method = (strtoupper($method) == 'GET') ? 'get' : 'post'; |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | 'id' => $form_id |
247 | 247 | ) + $target; |
248 | 248 | $this->updateAttributes($attributes); |
249 | - if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) { |
|
249 | + if (!$trackSubmit || isset($_REQUEST['_qf__'.$formName])) { |
|
250 | 250 | if (1 == get_magic_quotes_gpc()) { |
251 | - $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method? $_GET: $_POST); |
|
251 | + $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST); |
|
252 | 252 | foreach ($_FILES as $keyFirst => $valFirst) { |
253 | 253 | foreach ($valFirst as $keySecond => $valSecond) { |
254 | 254 | if ('name' == $keySecond) { |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | } |
260 | 260 | } |
261 | 261 | } else { |
262 | - $this->_submitValues = 'get' == $method? $_GET: $_POST; |
|
262 | + $this->_submitValues = 'get' == $method ? $_GET : $_POST; |
|
263 | 263 | $this->_submitFiles = $_FILES; |
264 | 264 | } |
265 | 265 | $this->_flagSubmitted = count($this->_submitValues) > 0 || count($this->_submitFiles) > 0; |
266 | 266 | } |
267 | 267 | if ($trackSubmit) { |
268 | - unset($this->_submitValues['_qf__' . $formName]); |
|
269 | - $this->addElement('hidden', '_qf__' . $formName, null); |
|
268 | + unset($this->_submitValues['_qf__'.$formName]); |
|
269 | + $this->addElement('hidden', '_qf__'.$formName, null); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public static function registerRule($ruleName, $type, $data1, $data2 = null) |
347 | 347 | { |
348 | - $registry =& HTML_QuickForm_RuleRegistry::singleton(); |
|
348 | + $registry = & HTML_QuickForm_RuleRegistry::singleton(); |
|
349 | 349 | $registry->registerRule($ruleName, $type, $data1, $data2); |
350 | 350 | } // end func registerRule |
351 | 351 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @access public |
361 | 361 | * @return boolean |
362 | 362 | */ |
363 | - function elementExists($element=null) |
|
363 | + function elementExists($element = null) |
|
364 | 364 | { |
365 | 365 | return isset($this->_elementIndex[$element]); |
366 | 366 | } // end func elementExists |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | function setDatasource(&$datasource, $defaultsFilter = null, $constantsFilter = null) |
386 | 386 | { |
387 | 387 | if (is_object($datasource)) { |
388 | - $this->_datasource =& $datasource; |
|
388 | + $this->_datasource = & $datasource; |
|
389 | 389 | if (is_callable(array($datasource, 'defaultValues'))) { |
390 | 390 | $this->setDefaults($datasource->defaultValues($this), $defaultsFilter); |
391 | 391 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if (!$this->elementExists('MAX_FILE_SIZE')) { |
497 | 497 | $this->addElement('hidden', 'MAX_FILE_SIZE', $this->_maxFileSize); |
498 | 498 | } else { |
499 | - $el =& $this->getElement('MAX_FILE_SIZE'); |
|
499 | + $el = & $this->getElement('MAX_FILE_SIZE'); |
|
500 | 500 | $el->updateAttributes(array('value' => $this->_maxFileSize)); |
501 | 501 | } |
502 | 502 | } // end func setMaxFileSize |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $elementObject->onQuickFormEvent('updateValue', null, $this); |
635 | 635 | } else { |
636 | 636 | $args = func_get_args(); |
637 | - $elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1)); |
|
637 | + $elementObject = & $this->_loadElement('addElement', $element, array_slice($args, 1)); |
|
638 | 638 | if (PEAR::isError($elementObject)) { |
639 | 639 | return $elementObject; |
640 | 640 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | isset($this->_elementIndex[$elementName]) |
647 | 647 | ) { |
648 | 648 | if ($this->_elements[$this->_elementIndex[$elementName]]->getType() == $elementObject->getType()) { |
649 | - $this->_elements[] =& $elementObject; |
|
649 | + $this->_elements[] = & $elementObject; |
|
650 | 650 | $elKeys = array_keys($this->_elements); |
651 | 651 | $this->_duplicateIndex[$elementName][] = end($elKeys); |
652 | 652 | } else { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return $error; |
662 | 662 | } |
663 | 663 | } else { |
664 | - $this->_elements[] =& $elementObject; |
|
664 | + $this->_elements[] = & $elementObject; |
|
665 | 665 | $elKeys = array_keys($this->_elements); |
666 | 666 | $this->_elementIndex[$elementName] = end($elKeys); |
667 | 667 | } |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | function &insertElementBefore(&$element, $nameAfter) |
696 | 696 | { |
697 | 697 | if (!empty($this->_duplicateIndex[$nameAfter])) { |
698 | - $error = PEAR::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, 'Several elements named "' . $nameAfter . '" exist in HTML_QuickForm::insertElementBefore().', 'HTML_QuickForm_Error', true); |
|
698 | + $error = PEAR::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, 'Several elements named "'.$nameAfter.'" exist in HTML_QuickForm::insertElementBefore().', 'HTML_QuickForm_Error', true); |
|
699 | 699 | return $error; |
700 | 700 | } elseif (!$this->elementExists($nameAfter)) { |
701 | 701 | $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$nameAfter' does not exist in HTML_QuickForm::insertElementBefore()", 'HTML_QuickForm_Error', true); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | for ($i = end($elKeys); $i >= $targetIdx; $i--) { |
718 | 718 | if (isset($this->_elements[$i])) { |
719 | 719 | $currentName = $this->_elements[$i]->getName(); |
720 | - $this->_elements[$i + 1] =& $this->_elements[$i]; |
|
720 | + $this->_elements[$i + 1] = & $this->_elements[$i]; |
|
721 | 721 | if ($this->_elementIndex[$currentName] == $i) { |
722 | 722 | $this->_elementIndex[$currentName] = $i + 1; |
723 | 723 | } else { |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | } |
729 | 729 | } |
730 | 730 | // Put the element in place finally |
731 | - $this->_elements[$targetIdx] =& $element; |
|
731 | + $this->_elements[$targetIdx] = & $element; |
|
732 | 732 | if (!$duplicate) { |
733 | 733 | $this->_elementIndex[$elementName] = $targetIdx; |
734 | 734 | } else { |
@@ -759,12 +759,12 @@ discard block |
||
759 | 759 | * @access public |
760 | 760 | * @throws HTML_QuickForm_Error |
761 | 761 | */ |
762 | - function &addGroup($elements, $name=null, $groupLabel='', $separator=null, $appendName = true) |
|
762 | + function &addGroup($elements, $name = null, $groupLabel = '', $separator = null, $appendName = true) |
|
763 | 763 | { |
764 | 764 | static $anonGroups = 1; |
765 | 765 | |
766 | 766 | if (0 == strlen($name)) { |
767 | - $name = 'qf_group_' . $anonGroups++; |
|
767 | + $name = 'qf_group_'.$anonGroups++; |
|
768 | 768 | $appendName = false; |
769 | 769 | } |
770 | 770 | $group = & $this->addElement('group', $name, $groupLabel, $elements, $separator, $appendName); |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | if (is_array($value)) { |
822 | 822 | $value[] = $v; |
823 | 823 | } else { |
824 | - $value = (null === $value)? $v: array($value, $v); |
|
824 | + $value = (null === $value) ? $v : array($value, $v); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | } |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | { |
845 | 845 | $value = null; |
846 | 846 | if (isset($this->_submitValues[$elementName]) || isset($this->_submitFiles[$elementName])) { |
847 | - $value = isset($this->_submitValues[$elementName])? $this->_submitValues[$elementName]: array(); |
|
847 | + $value = isset($this->_submitValues[$elementName]) ? $this->_submitValues[$elementName] : array(); |
|
848 | 848 | if (is_array($value) && isset($this->_submitFiles[$elementName])) { |
849 | 849 | foreach ($this->_submitFiles[$elementName] as $k => $v) { |
850 | 850 | $value = HTML_QuickForm::arrayMerge($value, $this->_reindexFiles($this->_submitFiles[$elementName][$k], $k)); |
@@ -859,34 +859,34 @@ discard block |
||
859 | 859 | array('\\', '\''), array('\\\\', '\\\''), |
860 | 860 | substr($elementName, 0, $pos) |
861 | 861 | ); |
862 | - $idx = "['" . str_replace( |
|
862 | + $idx = "['".str_replace( |
|
863 | 863 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
864 | 864 | substr($elementName, $pos + 1, -1) |
865 | - ) . "']"; |
|
865 | + )."']"; |
|
866 | 866 | if (isset($this->_submitValues[$base])) { |
867 | 867 | $value = eval("return (isset(\$this->_submitValues['{$base}']{$idx})) ? \$this->_submitValues['{$base}']{$idx} : null;"); |
868 | 868 | } |
869 | 869 | |
870 | 870 | if ((is_array($value) || null === $value) && isset($this->_submitFiles[$base])) { |
871 | 871 | $props = array('name', 'type', 'size', 'tmp_name', 'error'); |
872 | - $code = "if (!isset(\$this->_submitFiles['{$base}']['name']{$idx})) {\n" . |
|
873 | - " return null;\n" . |
|
874 | - "} else {\n" . |
|
872 | + $code = "if (!isset(\$this->_submitFiles['{$base}']['name']{$idx})) {\n". |
|
873 | + " return null;\n". |
|
874 | + "} else {\n". |
|
875 | 875 | " \$v = array();\n"; |
876 | 876 | foreach ($props as $prop) { |
877 | 877 | $code .= " \$v = HTML_QuickForm::arrayMerge(\$v, \$this->_reindexFiles(\$this->_submitFiles['{$base}']['{$prop}']{$idx}, '{$prop}'));\n"; |
878 | 878 | } |
879 | - $fileValue = eval($code . " return \$v;\n}\n"); |
|
879 | + $fileValue = eval($code." return \$v;\n}\n"); |
|
880 | 880 | if (null !== $fileValue) { |
881 | - $value = null === $value? $fileValue: HTML_QuickForm::arrayMerge($value, $fileValue); |
|
881 | + $value = null === $value ? $fileValue : HTML_QuickForm::arrayMerge($value, $fileValue); |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | } |
885 | 885 | |
886 | 886 | // This is only supposed to work for groups with appendName = false |
887 | 887 | if (null === $value && 'group' == $this->getElementType($elementName)) { |
888 | - $group =& $this->getElement($elementName); |
|
889 | - $elements =& $group->getElements(); |
|
888 | + $group = & $this->getElement($elementName); |
|
889 | + $elements = & $group->getElements(); |
|
890 | 890 | foreach (array_keys($elements) as $key) { |
891 | 891 | $name = $group->getElementName($key); |
892 | 892 | // prevent endless recursion in case of radios and such |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$elementName' does not exist in HTML_QuickForm::removeElement()", 'HTML_QuickForm_Error', true); |
1050 | 1050 | return $error; |
1051 | 1051 | } |
1052 | - $el =& $this->_elements[$this->_elementIndex[$elementName]]; |
|
1052 | + $el = & $this->_elements[$this->_elementIndex[$elementName]]; |
|
1053 | 1053 | unset($this->_elements[$this->_elementIndex[$elementName]]); |
1054 | 1054 | if (empty($this->_duplicateIndex[$elementName])) { |
1055 | 1055 | unset($this->_elementIndex[$elementName]); |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | $this->_rules[$element] = array(); |
1149 | 1149 | } |
1150 | 1150 | if ($validation == 'client') { |
1151 | - $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_attributes['id'] . '; } catch(e) { return true; } return myValidator(this);')); |
|
1151 | + $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_'.$this->_attributes['id'].'; } catch(e) { return true; } return myValidator(this);')); |
|
1152 | 1152 | } |
1153 | 1153 | $this->_rules[$element][] = array( |
1154 | 1154 | 'type' => $type, |
@@ -1181,20 +1181,20 @@ discard block |
||
1181 | 1181 | * @access public |
1182 | 1182 | * @throws HTML_QuickForm_Error |
1183 | 1183 | */ |
1184 | - function addGroupRule($group, $arg1, $type='', $format=null, $howmany=0, $validation = 'server', $reset = false) |
|
1184 | + function addGroupRule($group, $arg1, $type = '', $format = null, $howmany = 0, $validation = 'server', $reset = false) |
|
1185 | 1185 | { |
1186 | 1186 | if (!$this->elementExists($group)) { |
1187 | 1187 | return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Group '$group' does not exist in HTML_QuickForm::addGroupRule()", 'HTML_QuickForm_Error', true); |
1188 | 1188 | } |
1189 | 1189 | |
1190 | - $groupObj =& $this->getElement($group); |
|
1190 | + $groupObj = & $this->getElement($group); |
|
1191 | 1191 | if (is_array($arg1)) { |
1192 | 1192 | $required = 0; |
1193 | 1193 | foreach ($arg1 as $elementIndex => $rules) { |
1194 | 1194 | $elementName = $groupObj->getElementName($elementIndex); |
1195 | 1195 | foreach ($rules as $rule) { |
1196 | 1196 | $format = (isset($rule[2])) ? $rule[2] : null; |
1197 | - $validation = (isset($rule[3]) && 'client' == $rule[3])? 'client': 'server'; |
|
1197 | + $validation = (isset($rule[3]) && 'client' == $rule[3]) ? 'client' : 'server'; |
|
1198 | 1198 | $reset = isset($rule[4]) && $rule[4]; |
1199 | 1199 | $type = $rule[1]; |
1200 | 1200 | if (false === ($newName = $this->isRuleRegistered($type, true))) { |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | $required++; |
1219 | 1219 | } |
1220 | 1220 | if ('client' == $validation) { |
1221 | - $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_attributes['id'] . '; } catch(e) { return true; } return myValidator(this);')); |
|
1221 | + $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_'.$this->_attributes['id'].'; } catch(e) { return true; } return myValidator(this);')); |
|
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | $this->_required[] = $group; |
1256 | 1256 | } |
1257 | 1257 | if ($validation == 'client') { |
1258 | - $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_attributes['id'] . '; } catch(e) { return true; } return myValidator(this);')); |
|
1258 | + $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_'.$this->_attributes['id'].'; } catch(e) { return true; } return myValidator(this);')); |
|
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | } // end func addGroupRule |
@@ -1312,10 +1312,10 @@ discard block |
||
1312 | 1312 | if (false === strpos($elName, '[')) { |
1313 | 1313 | $this->_submitValues[$elName] = $this->_recursiveFilter($filter, $value); |
1314 | 1314 | } else { |
1315 | - $idx = "['" . str_replace( |
|
1315 | + $idx = "['".str_replace( |
|
1316 | 1316 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
1317 | 1317 | $elName |
1318 | - ) . "']"; |
|
1318 | + )."']"; |
|
1319 | 1319 | eval("\$this->_submitValues{$idx} = \$this->_recursiveFilter(\$filter, \$value);"); |
1320 | 1320 | } |
1321 | 1321 | } |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | } |
1436 | 1436 | $ruleName = false; |
1437 | 1437 | if (is_object($name) && is_a($name, 'html_quickform_rule')) { |
1438 | - $ruleName = !empty($name->name)? $name->name: strtolower(get_class($name)); |
|
1438 | + $ruleName = !empty($name->name) ? $name->name : strtolower(get_class($name)); |
|
1439 | 1439 | } elseif (is_string($name) && class_exists($name)) { |
1440 | 1440 | $parent = strtolower($name); |
1441 | 1441 | do { |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | } while ($parent = get_parent_class($parent)); |
1447 | 1447 | } |
1448 | 1448 | if ($ruleName) { |
1449 | - $registry =& HTML_QuickForm_RuleRegistry::singleton(); |
|
1449 | + $registry = & HTML_QuickForm_RuleRegistry::singleton(); |
|
1450 | 1450 | $registry->registerRule($ruleName, null, $name); |
1451 | 1451 | } |
1452 | 1452 | return $ruleName; |
@@ -1570,7 +1570,7 @@ discard block |
||
1570 | 1570 | return false; |
1571 | 1571 | } |
1572 | 1572 | |
1573 | - $registry =& HTML_QuickForm_RuleRegistry::singleton(); |
|
1573 | + $registry = & HTML_QuickForm_RuleRegistry::singleton(); |
|
1574 | 1574 | |
1575 | 1575 | foreach ($this->_rules as $target => $rules) { |
1576 | 1576 | $submitValue = $this->getSubmitValue($target); |
@@ -1601,10 +1601,10 @@ discard block |
||
1601 | 1601 | array('\\', '\''), array('\\\\', '\\\''), |
1602 | 1602 | substr($target, 0, $pos) |
1603 | 1603 | ); |
1604 | - $idx = "['" . str_replace( |
|
1604 | + $idx = "['".str_replace( |
|
1605 | 1605 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
1606 | 1606 | substr($target, $pos + 1, -1) |
1607 | - ) . "']"; |
|
1607 | + )."']"; |
|
1608 | 1608 | eval("\$isUpload = isset(\$this->_submitFiles['{$base}']['name']{$idx});"); |
1609 | 1609 | } |
1610 | 1610 | if ($isUpload && (!isset($submitValue['error']) || UPLOAD_ERR_NO_FILE == $submitValue['error'])) { |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | $result = $registry->validate($rule['type'], $submitValue, $rule['format'], false); |
1625 | 1625 | } |
1626 | 1626 | |
1627 | - if (!$result || (!empty($rule['howmany']) && $rule['howmany'] > (int)$result)) { |
|
1627 | + if (!$result || (!empty($rule['howmany']) && $rule['howmany'] > (int) $result)) { |
|
1628 | 1628 | if (isset($rule['group'])) { |
1629 | 1629 | $this->_errors[$rule['group']] = $rule['message']; |
1630 | 1630 | } else { |
@@ -1659,7 +1659,7 @@ discard block |
||
1659 | 1659 | * @access public |
1660 | 1660 | * @throws HTML_QuickForm_Error |
1661 | 1661 | */ |
1662 | - function freeze($elementList=null) |
|
1662 | + function freeze($elementList = null) |
|
1663 | 1663 | { |
1664 | 1664 | if (!isset($elementList)) { |
1665 | 1665 | $this->_freezeAll = true; |
@@ -1680,7 +1680,7 @@ discard block |
||
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | if (!empty($elementList)) { |
1683 | - return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Nonexistant element(s): '" . implode("', '", array_keys($elementList)) . "' in HTML_QuickForm::freeze()", 'HTML_QuickForm_Error', true); |
|
1683 | + return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Nonexistant element(s): '".implode("', '", array_keys($elementList))."' in HTML_QuickForm::freeze()", 'HTML_QuickForm_Error', true); |
|
1684 | 1684 | } |
1685 | 1685 | return true; |
1686 | 1686 | } // end func freeze |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | function accept(&$renderer) { |
1737 | 1737 | $renderer->startForm($this); |
1738 | 1738 | foreach (array_keys($this->_elements) as $key) { |
1739 | - $element =& $this->_elements[$key]; |
|
1739 | + $element = & $this->_elements[$key]; |
|
1740 | 1740 | $elementName = $element->getName(); |
1741 | 1741 | $required = ($this->isElementRequired($elementName) && !$element->isFrozen()); |
1742 | 1742 | $error = $this->getElementError($elementName); |
@@ -1782,7 +1782,7 @@ discard block |
||
1782 | 1782 | if (!is_null($in_data)) { |
1783 | 1783 | $this->addElement('html', $in_data); |
1784 | 1784 | } |
1785 | - $renderer =& $this->defaultRenderer(); |
|
1785 | + $renderer = & $this->defaultRenderer(); |
|
1786 | 1786 | $this->accept($renderer); |
1787 | 1787 | |
1788 | 1788 | return $renderer->toHtml(); |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | return ''; |
1805 | 1805 | } |
1806 | 1806 | |
1807 | - $registry =& HTML_QuickForm_RuleRegistry::singleton(); |
|
1807 | + $registry = & HTML_QuickForm_RuleRegistry::singleton(); |
|
1808 | 1808 | $test = array(); |
1809 | 1809 | $js_escape = array( |
1810 | 1810 | "\r" => '\r', |
@@ -1820,30 +1820,30 @@ discard block |
||
1820 | 1820 | if ('client' == $rule['validation']) { |
1821 | 1821 | unset($element); |
1822 | 1822 | |
1823 | - $dependent = isset($rule['dependent']) && is_array($rule['dependent']); |
|
1823 | + $dependent = isset($rule['dependent']) && is_array($rule['dependent']); |
|
1824 | 1824 | $rule['message'] = strtr($rule['message'], $js_escape); |
1825 | 1825 | |
1826 | 1826 | if (isset($rule['group'])) { |
1827 | - $group =& $this->getElement($rule['group']); |
|
1827 | + $group = & $this->getElement($rule['group']); |
|
1828 | 1828 | // No JavaScript validation for frozen elements |
1829 | 1829 | if ($group->isFrozen()) { |
1830 | 1830 | continue 2; |
1831 | 1831 | } |
1832 | - $elements =& $group->getElements(); |
|
1832 | + $elements = & $group->getElements(); |
|
1833 | 1833 | foreach (array_keys($elements) as $key) { |
1834 | 1834 | if ($elementName == $group->getElementName($key)) { |
1835 | - $element =& $elements[$key]; |
|
1835 | + $element = & $elements[$key]; |
|
1836 | 1836 | break; |
1837 | 1837 | } |
1838 | 1838 | } |
1839 | 1839 | } elseif ($dependent) { |
1840 | - $element = array(); |
|
1841 | - $element[] =& $this->getElement($elementName); |
|
1840 | + $element = array(); |
|
1841 | + $element[] = & $this->getElement($elementName); |
|
1842 | 1842 | foreach ($rule['dependent'] as $elName) { |
1843 | - $element[] =& $this->getElement($elName); |
|
1843 | + $element[] = & $this->getElement($elName); |
|
1844 | 1844 | } |
1845 | 1845 | } else { |
1846 | - $element =& $this->getElement($elementName); |
|
1846 | + $element = & $this->getElement($elementName); |
|
1847 | 1847 | } |
1848 | 1848 | // No JavaScript validation for frozen elements |
1849 | 1849 | if (is_object($element) && $element->isFrozen()) { |
@@ -1862,23 +1862,23 @@ discard block |
||
1862 | 1862 | } |
1863 | 1863 | if (count($test) > 0) { |
1864 | 1864 | return |
1865 | - "\n<script type=\"text/javascript\">\n" . |
|
1866 | - "//<![CDATA[\n" . |
|
1867 | - "function validate_" . $this->_attributes['id'] . "(frm) {\n" . |
|
1868 | - " var value = '';\n" . |
|
1869 | - " var errFlag = new Array();\n" . |
|
1870 | - " var _qfGroups = {};\n" . |
|
1871 | - " _qfMsg = '';\n\n" . |
|
1872 | - join("\n", $test) . |
|
1873 | - "\n if (_qfMsg != '') {\n" . |
|
1874 | - " _qfMsg = '" . strtr($this->_jsPrefix, $js_escape) . "' + _qfMsg;\n" . |
|
1875 | - " _qfMsg = _qfMsg + '\\n" . strtr($this->_jsPostfix, $js_escape) . "';\n" . |
|
1876 | - " alert(_qfMsg);\n" . |
|
1877 | - " return false;\n" . |
|
1878 | - " }\n" . |
|
1879 | - " return true;\n" . |
|
1880 | - "}\n" . |
|
1881 | - "//]]>\n" . |
|
1865 | + "\n<script type=\"text/javascript\">\n". |
|
1866 | + "//<![CDATA[\n". |
|
1867 | + "function validate_".$this->_attributes['id']."(frm) {\n". |
|
1868 | + " var value = '';\n". |
|
1869 | + " var errFlag = new Array();\n". |
|
1870 | + " var _qfGroups = {};\n". |
|
1871 | + " _qfMsg = '';\n\n". |
|
1872 | + join("\n", $test). |
|
1873 | + "\n if (_qfMsg != '') {\n". |
|
1874 | + " _qfMsg = '".strtr($this->_jsPrefix, $js_escape)."' + _qfMsg;\n". |
|
1875 | + " _qfMsg = _qfMsg + '\\n".strtr($this->_jsPostfix, $js_escape)."';\n". |
|
1876 | + " alert(_qfMsg);\n". |
|
1877 | + " return false;\n". |
|
1878 | + " }\n". |
|
1879 | + " return true;\n". |
|
1880 | + "}\n". |
|
1881 | + "//]]>\n". |
|
1882 | 1882 | "</script>"; |
1883 | 1883 | } |
1884 | 1884 | return ''; |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | */ |
1898 | 1898 | function getSubmitValues($mergeFiles = false) |
1899 | 1899 | { |
1900 | - return $mergeFiles? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles): $this->_submitValues; |
|
1900 | + return $mergeFiles ? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles) : $this->_submitValues; |
|
1901 | 1901 | } // end func getSubmitValues |
1902 | 1902 | |
1903 | 1903 | // }}} |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | if (is_array($value)) { |
1952 | 1952 | $value[] = $v; |
1953 | 1953 | } else { |
1954 | - $value = (null === $value)? $v: array($value, $v); |
|
1954 | + $value = (null === $value) ? $v : array($value, $v); |
|
1955 | 1955 | } |
1956 | 1956 | } |
1957 | 1957 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function HTML_Table($attributes = null, $tabOffset = 0, $useTGroups = false) |
166 | 166 | { |
167 | - parent::__construct($attributes, (int)$tabOffset); |
|
168 | - $this->_useTGroups = (boolean)$useTGroups; |
|
167 | + parent::__construct($attributes, (int) $tabOffset); |
|
168 | + $this->_useTGroups = (boolean) $useTGroups; |
|
169 | 169 | $this->addBody(); |
170 | 170 | if ($this->_useTGroups) { |
171 | 171 | $this->_thead = new HTML_Table_Storage($tabOffset, $this->_useTGroups); |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | function _adjustTbodyCount($body, $method) |
273 | 273 | { |
274 | 274 | if ($this->_autoGrow) { |
275 | - while ($this->_tbodyCount <= (int)$body) { |
|
275 | + while ($this->_tbodyCount <= (int) $body) { |
|
276 | 276 | $this->addBody(); |
277 | 277 | } |
278 | 278 | } else { |
279 | - return PEAR::raiseError('Invalid body reference[' . |
|
280 | - $body . '] in HTML_Table::' . $method); |
|
279 | + return PEAR::raiseError('Invalid body reference['. |
|
280 | + $body.'] in HTML_Table::'.$method); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -939,26 +939,26 @@ discard block |
||
939 | 939 | $tBodyMaxColCount = max($tBodyColCounts); |
940 | 940 | } |
941 | 941 | if ($this->_comment) { |
942 | - $strHtml .= $tabs . "<!-- $this->_comment -->" . $lnEnd; |
|
942 | + $strHtml .= $tabs."<!-- $this->_comment -->".$lnEnd; |
|
943 | 943 | } |
944 | 944 | if ($this->getRowCount() > 0 && $tBodyMaxColCount > 0) { |
945 | 945 | $strHtml .= |
946 | - $tabs . '<table' . $this->_getAttrString($this->_attributes) . '>' . $lnEnd; |
|
946 | + $tabs.'<table'.$this->_getAttrString($this->_attributes).'>'.$lnEnd; |
|
947 | 947 | if (!empty($this->_caption)) { |
948 | 948 | $attr = $this->_caption['attr']; |
949 | 949 | $contents = $this->_caption['contents']; |
950 | - $strHtml .= $tabs . $tab . '<caption' . $this->_getAttrString($attr) . '>'; |
|
950 | + $strHtml .= $tabs.$tab.'<caption'.$this->_getAttrString($attr).'>'; |
|
951 | 951 | if (is_array($contents)) { |
952 | 952 | $contents = implode(', ', $contents); |
953 | 953 | } |
954 | 954 | $strHtml .= $contents; |
955 | - $strHtml .= '</caption>' . $lnEnd; |
|
955 | + $strHtml .= '</caption>'.$lnEnd; |
|
956 | 956 | } |
957 | 957 | if (!empty($this->_colgroup)) { |
958 | 958 | foreach ($this->_colgroup as $g => $col) { |
959 | 959 | $attr = $this->_colgroup[$g]['attr']; |
960 | 960 | $contents = $this->_colgroup[$g]['contents']; |
961 | - $strHtml .= $tabs . $tab . '<colgroup' . $this->_getAttrString($attr) . '>'; |
|
961 | + $strHtml .= $tabs.$tab.'<colgroup'.$this->_getAttrString($attr).'>'; |
|
962 | 962 | if (!empty($contents)) { |
963 | 963 | $strHtml .= $lnEnd; |
964 | 964 | if (!is_array($contents)) { |
@@ -966,11 +966,11 @@ discard block |
||
966 | 966 | } |
967 | 967 | foreach ($contents as $a => $colAttr) { |
968 | 968 | $attr = $this->_parseAttributes($colAttr); |
969 | - $strHtml .= $tabs . $tab . $tab . '<col' . $this->_getAttrString($attr) . ' />' . $lnEnd; |
|
969 | + $strHtml .= $tabs.$tab.$tab.'<col'.$this->_getAttrString($attr).' />'.$lnEnd; |
|
970 | 970 | } |
971 | - $strHtml .= $tabs . $tab; |
|
971 | + $strHtml .= $tabs.$tab; |
|
972 | 972 | } |
973 | - $strHtml .= '</colgroup>' . $lnEnd; |
|
973 | + $strHtml .= '</colgroup>'.$lnEnd; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | if ($this->_useTGroups) { |
@@ -986,31 +986,31 @@ discard block |
||
986 | 986 | if ($this->_thead !== null) { |
987 | 987 | $this->_thead->setColCount($maxColCount); |
988 | 988 | if ($this->_thead->getRowCount() > 0) { |
989 | - $strHtml .= $tabs . $tab . '<thead' . |
|
990 | - $this->_getAttrString($this->_thead->_attributes) . |
|
991 | - '>' . $lnEnd; |
|
989 | + $strHtml .= $tabs.$tab.'<thead'. |
|
990 | + $this->_getAttrString($this->_thead->_attributes). |
|
991 | + '>'.$lnEnd; |
|
992 | 992 | $strHtml .= $this->_thead->toHtml($tabs, $tab); |
993 | - $strHtml .= $tabs . $tab . '</thead>' . $lnEnd; |
|
993 | + $strHtml .= $tabs.$tab.'</thead>'.$lnEnd; |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | if ($this->_tfoot !== null) { |
997 | 997 | $this->_tfoot->setColCount($maxColCount); |
998 | 998 | if ($this->_tfoot->getRowCount() > 0) { |
999 | - $strHtml .= $tabs . $tab . '<tfoot' . |
|
1000 | - $this->_getAttrString($this->_tfoot->_attributes) . |
|
1001 | - '>' . $lnEnd; |
|
999 | + $strHtml .= $tabs.$tab.'<tfoot'. |
|
1000 | + $this->_getAttrString($this->_tfoot->_attributes). |
|
1001 | + '>'.$lnEnd; |
|
1002 | 1002 | $strHtml .= $this->_tfoot->toHtml($tabs, $tab); |
1003 | - $strHtml .= $tabs . $tab . '</tfoot>' . $lnEnd; |
|
1003 | + $strHtml .= $tabs.$tab.'</tfoot>'.$lnEnd; |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | for ($i = 0; $i < $this->_tbodyCount; $i++) { |
1007 | 1007 | $this->_tbodies[$i]->setColCount($maxColCount); |
1008 | 1008 | if ($this->_tbodies[$i]->getRowCount() > 0) { |
1009 | - $strHtml .= $tabs . $tab . '<tbody' . |
|
1010 | - $this->_getAttrString($this->_tbodies[$i]->_attributes) . |
|
1011 | - '>' . $lnEnd; |
|
1009 | + $strHtml .= $tabs.$tab.'<tbody'. |
|
1010 | + $this->_getAttrString($this->_tbodies[$i]->_attributes). |
|
1011 | + '>'.$lnEnd; |
|
1012 | 1012 | $strHtml .= $this->_tbodies[$i]->toHtml($tabs, $tab); |
1013 | - $strHtml .= $tabs . $tab . '</tbody>' . $lnEnd; |
|
1013 | + $strHtml .= $tabs.$tab.'</tbody>'.$lnEnd; |
|
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | } else { |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $strHtml .= $this->_tbodies[$i]->toHtml($tabs, $tab); |
1020 | 1020 | } |
1021 | 1021 | } |
1022 | - $strHtml .= $tabs . '</table>' . $lnEnd; |
|
1022 | + $strHtml .= $tabs.'</table>'.$lnEnd; |
|
1023 | 1023 | } |
1024 | 1024 | return $strHtml; |
1025 | 1025 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | foreach ($attributes as $key => $value) { |
144 | 144 | // Modified by Ivan Tcholakov, 16-MAR-2010 |
145 | 145 | $value = @htmlspecialchars($value, ENT_COMPAT, $charset); |
146 | - $strAttr .= ' ' . $key . '= "' . $value. '"'; |
|
146 | + $strAttr .= ' '.$key.'= "'.$value.'"'; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | return $strAttr; |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | return $ret; |
171 | 171 | |
172 | 172 | } elseif (is_string($attributes)) { |
173 | - $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" . |
|
173 | + $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)". |
|
174 | 174 | "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/"; |
175 | 175 | if (preg_match_all($preg, $attributes, $regs)) { |
176 | - for ($counter=0; $counter<count($regs[1]); $counter++) { |
|
176 | + for ($counter = 0; $counter < count($regs[1]); $counter++) { |
|
177 | 177 | $name = $regs[1][$counter]; |
178 | 178 | $check = $regs[0][$counter]; |
179 | 179 | $value = $regs[7][$counter]; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //return ('' != $value? htmlspecialchars($value): ' ') . |
289 | 289 | // $this->_getPersistantData(); |
290 | 290 | |
291 | - $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()): ' ') . |
|
291 | + $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()) : ' '). |
|
292 | 292 | $this->_getPersistantData(); |
293 | 293 | return '<span class="freeze">'.$value.'</span>'; |
294 | 294 | // |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | return ''; |
310 | 310 | } else { |
311 | 311 | $id = $this->getAttribute('id'); |
312 | - return '<input' . $this->_getAttrString(array( |
|
312 | + return '<input'.$this->_getAttrString(array( |
|
313 | 313 | 'type' => 'hidden', |
314 | 314 | 'name' => $this->getName(), |
315 | 315 | 'value' => $this->getValue() |
316 | - ) + (isset($id)? array('id' => $id): array())) . ' />'; |
|
316 | + ) + (isset($id) ? array('id' => $id) : array())).' />'; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @access public |
345 | 345 | * @return void |
346 | 346 | */ |
347 | - function setPersistantFreeze($persistant=false) |
|
347 | + function setPersistantFreeze($persistant = false) |
|
348 | 348 | { |
349 | 349 | $this->_persistantFreeze = $persistant; |
350 | 350 | } //end func setPersistantFreeze |
@@ -414,10 +414,10 @@ discard block |
||
414 | 414 | if (isset($values[$elementName])) { |
415 | 415 | return $values[$elementName]; |
416 | 416 | } elseif (strpos($elementName, '[')) { |
417 | - $myVar = "['" . str_replace( |
|
417 | + $myVar = "['".str_replace( |
|
418 | 418 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
419 | 419 | $elementName |
420 | - ) . "']"; |
|
420 | + )."']"; |
|
421 | 421 | return eval("return (isset(\$values$myVar)) ? \$values$myVar : null;"); |
422 | 422 | } else { |
423 | 423 | return null; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @access public |
481 | 481 | * @return void |
482 | 482 | */ |
483 | - function accept(&$renderer, $required=false, $error=null) |
|
483 | + function accept(&$renderer, $required = false, $error = null) |
|
484 | 484 | { |
485 | 485 | $renderer->renderElement($this, $required, $error); |
486 | 486 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | static $idx = 1; |
500 | 500 | |
501 | 501 | if (!$this->getAttribute('id')) { |
502 | - $this->updateAttributes(array('id' => 'qf_' . substr(md5(microtime() . $idx++), 0, 6))); |
|
502 | + $this->updateAttributes(array('id' => 'qf_'.substr(md5(microtime().$idx++), 0, 6))); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | return array($name => $value); |
544 | 544 | } else { |
545 | 545 | $valueAry = array(); |
546 | - $myIndex = "['" . str_replace( |
|
546 | + $myIndex = "['".str_replace( |
|
547 | 547 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
548 | 548 | $name |
549 | - ) . "']"; |
|
549 | + )."']"; |
|
550 | 550 | eval("\$valueAry$myIndex = \$value;"); |
551 | 551 | return $valueAry; |
552 | 552 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @access public |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null) |
|
86 | + function HTML_QuickForm_hierselect($elementName = null, $elementLabel = null, $attributes = null, $separator = null) |
|
87 | 87 | { |
88 | 88 | $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); |
89 | 89 | $this->_persistantFreeze = true; |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | // setDefaults has probably been called before this function |
155 | 155 | // check if all elements have been created |
156 | 156 | $totalNbElements = count($this->_options); |
157 | - for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) { |
|
158 | - $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
157 | + for ($i = $this->_nbElements; $i < $totalNbElements; $i++) { |
|
158 | + $this->_elements[] = & new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
159 | 159 | $this->_nbElements++; |
160 | 160 | } |
161 | 161 | } |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | // setDefaults has probably been called before this function |
210 | 210 | // check if all elements have been created |
211 | 211 | $totalNbElements = 2; |
212 | - for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) { |
|
213 | - $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
212 | + for ($i = $this->_nbElements; $i < $totalNbElements; $i++) { |
|
213 | + $this->_elements[] = & new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
214 | 214 | $this->_nbElements++; |
215 | 215 | } |
216 | 216 | } |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | foreach (array_keys($this->_elements) AS $key) { |
234 | 234 | $array = eval("return isset(\$this->_options[{$key}]{$toLoad})? \$this->_options[{$key}]{$toLoad}: null;"); |
235 | 235 | if (is_array($array)) { |
236 | - $select =& $this->_elements[$key]; |
|
236 | + $select = & $this->_elements[$key]; |
|
237 | 237 | $select->_options = array(); |
238 | 238 | $select->loadArray($array); |
239 | 239 | |
240 | - $value = is_array($v = $select->getValue()) ? $v[0] : key($array); |
|
241 | - $toLoad .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $value) . '\']'; |
|
240 | + $value = is_array($v = $select->getValue()) ? $v[0] : key($array); |
|
241 | + $toLoad .= '[\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $value).'\']'; |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } // end func _setOptions |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | function _createElements() |
278 | 278 | { |
279 | 279 | for ($i = 0; $i < $this->_nbElements; $i++) { |
280 | - $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
280 | + $this->_elements[] = & new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
281 | 281 | } |
282 | 282 | } // end func _createElements |
283 | 283 | |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | $keys = array_keys($this->_elements); |
293 | 293 | $onChange = array(); |
294 | 294 | for ($i = 0; $i < count($keys) - 1; $i++) { |
295 | - $select =& $this->_elements[$keys[$i]]; |
|
295 | + $select = & $this->_elements[$keys[$i]]; |
|
296 | 296 | $onChange[$i] = $select->getAttribute('onchange'); |
297 | 297 | $select->updateAttributes( |
298 | - array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i]) |
|
298 | + array('onchange' => '_hs_swapOptions(this.form, \''.$this->_escapeString($this->getName()).'\', '.$keys[$i].');'.$onChange[$i]) |
|
299 | 299 | ); |
300 | 300 | } |
301 | 301 | |
@@ -433,37 +433,36 @@ discard block |
||
433 | 433 | for ($i = 1; $i < $this->_nbElements; $i++) { |
434 | 434 | $jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]); |
435 | 435 | } |
436 | - $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" . |
|
437 | - implode(",\n", $jsParts) . |
|
436 | + $this->_js .= "\n_hs_options['".$this->_escapeString($this->getName())."'] = [\n". |
|
437 | + implode(",\n", $jsParts). |
|
438 | 438 | "\n];\n"; |
439 | 439 | // default value; if we don't actually have any values yet just use |
440 | 440 | // the first option (for single selects) or empty array (for multiple) |
441 | 441 | $values = array(); |
442 | 442 | foreach (array_keys($this->_elements) as $key) { |
443 | 443 | if (is_array($v = $this->_elements[$key]->getValue())) { |
444 | - $values[] = count($v) > 1? $v: $v[0]; |
|
444 | + $values[] = count($v) > 1 ? $v : $v[0]; |
|
445 | 445 | } else { |
446 | 446 | // XXX: accessing the supposedly private _options array |
447 | - $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])? |
|
448 | - array(): |
|
449 | - $this->_elements[$key]->_options[0]['attr']['value']; |
|
447 | + $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0]) ? |
|
448 | + array() : $this->_elements[$key]->_options[0]['attr']['value']; |
|
450 | 449 | } |
451 | 450 | } |
452 | - $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " . |
|
453 | - $this->_convertArrayToJavascript($values, false) . ";\n"; |
|
451 | + $this->_js .= "_hs_defaults['".$this->_escapeString($this->getName())."'] = ". |
|
452 | + $this->_convertArrayToJavascript($values, false).";\n"; |
|
454 | 453 | } |
455 | 454 | include_once('HTML/QuickForm/Renderer/Default.php'); |
456 | - $renderer =& new HTML_QuickForm_Renderer_Default(); |
|
455 | + $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
457 | 456 | $renderer->setElementTemplate('{element}'); |
458 | 457 | parent::accept($renderer); |
459 | 458 | |
460 | 459 | if (!empty($onChange)) { |
461 | - $keys = array_keys($this->_elements); |
|
460 | + $keys = array_keys($this->_elements); |
|
462 | 461 | for ($i = 0; $i < count($keys) - 1; $i++) { |
463 | 462 | $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i])); |
464 | 463 | } |
465 | 464 | } |
466 | - return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") . |
|
465 | + return (empty($this->_js) ? '' : "<script type=\"text/javascript\">\n//<![CDATA[\n".$this->_js."//]]>\n</script>"). |
|
467 | 466 | $renderer->toHtml(); |
468 | 467 | } // end func toHtml |
469 | 468 | |
@@ -491,12 +490,12 @@ discard block |
||
491 | 490 | $onReset = $caller->getAttribute('onreset'); |
492 | 491 | if (strlen($onReset)) { |
493 | 492 | if (strpos($onReset, '_hs_setupOnReset')) { |
494 | - $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset))); |
|
493 | + $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['".$this->_escapeString($this->getName())."', ", $onReset))); |
|
495 | 494 | } else { |
496 | - $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } ")); |
|
495 | + $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['".$this->_escapeString($this->getName())."']); } ")); |
|
497 | 496 | } |
498 | 497 | } else { |
499 | - $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } ")); |
|
498 | + $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['".$this->_escapeString($this->getName())."']); } ")); |
|
500 | 499 | } |
501 | 500 | } |
502 | 501 | return $ret; |
@@ -521,7 +520,7 @@ discard block |
||
521 | 520 | } else { |
522 | 521 | $items = array(); |
523 | 522 | foreach ($array as $key => $val) { |
524 | - $item = $assoc? "'" . $this->_escapeString($key) . "': ": ''; |
|
523 | + $item = $assoc ? "'".$this->_escapeString($key)."': " : ''; |
|
525 | 524 | if (is_array($val)) { |
526 | 525 | $item .= $this->_convertArrayToJavascript($val, $assoc); |
527 | 526 | } else { |
@@ -531,7 +530,7 @@ discard block |
||
531 | 530 | } |
532 | 531 | } |
533 | 532 | $js = implode(', ', $items); |
534 | - return $assoc? '{ ' . $js . ' }': '[' . $js . ']'; |
|
533 | + return $assoc ? '{ '.$js.' }' : '['.$js.']'; |
|
535 | 534 | } |
536 | 535 | |
537 | 536 | // }}} |
@@ -551,7 +550,7 @@ discard block |
||
551 | 550 | } elseif (is_int($val) || is_double($val)) { |
552 | 551 | return $val; |
553 | 552 | } elseif (is_string($val)) { |
554 | - return "'" . $this->_escapeString($val) . "'"; |
|
553 | + return "'".$this->_escapeString($val)."'"; |
|
555 | 554 | } elseif (is_null($val)) { |
556 | 555 | return 'null'; |
557 | 556 | } else { |
@@ -572,7 +571,7 @@ discard block |
||
572 | 571 | */ |
573 | 572 | function _escapeString($str) |
574 | 573 | { |
575 | - return strtr($str,array( |
|
574 | + return strtr($str, array( |
|
576 | 575 | "\r" => '\r', |
577 | 576 | "\n" => '\n', |
578 | 577 | "\t" => '\t', |
@@ -247,7 +247,7 @@ |
||
247 | 247 | unset($attr['name']); |
248 | 248 | |
249 | 249 | $html = $this->_getTabs() |
250 | - . '<span' . $this->_getAttrString($attr) . '>' |
|
250 | + . '<span'.$this->_getAttrString($attr).'>' |
|
251 | 251 | . htmlspecialchars($captcha) |
252 | 252 | . '</span>'; |
253 | 253 | return $html; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @access public |
92 | 92 | * @return void |
93 | 93 | */ |
94 | - public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) |
|
94 | + public function __construct($elementName = null, $elementLabel = null, $elements = null, $separator = null, $appendName = true) |
|
95 | 95 | { |
96 | 96 | parent::__construct($elementName, $elementLabel); |
97 | 97 | $this->_type = 'group'; |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | { |
175 | 175 | $value = null; |
176 | 176 | foreach (array_keys($this->_elements) as $key) { |
177 | - $element =& $this->_elements[$key]; |
|
177 | + $element = & $this->_elements[$key]; |
|
178 | 178 | switch ($element->getType()) { |
179 | 179 | case 'radio': |
180 | - $v = $element->getChecked()? $element->getValue(): null; |
|
180 | + $v = $element->getChecked() ? $element->getValue() : null; |
|
181 | 181 | break; |
182 | 182 | case 'checkbox': |
183 | - $v = $element->getChecked()? true: null; |
|
183 | + $v = $element->getChecked() ? true : null; |
|
184 | 184 | break; |
185 | 185 | default: |
186 | 186 | $v = $element->getValue(); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $value = $v; |
192 | 192 | } else { |
193 | 193 | if (!is_array($value)) { |
194 | - $value = is_null($value)? array(): array($value); |
|
194 | + $value = is_null($value) ? array() : array($value); |
|
195 | 195 | } |
196 | 196 | if ('' === $elementName) { |
197 | 197 | $value[] = $v; |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | if (is_null($elementName)) { |
361 | 361 | $this->_elements[$key]->setName($this->getName()); |
362 | 362 | } elseif ('' === $elementName) { |
363 | - $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); |
|
363 | + $this->_elements[$key]->setName($this->getName().'['.$key.']'); |
|
364 | 364 | } else { |
365 | - $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); |
|
365 | + $this->_elements[$key]->setName($this->getName().'['.$elementName.']'); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller); |
@@ -393,12 +393,12 @@ discard block |
||
393 | 393 | $renderer->startGroup($this, $required, $error); |
394 | 394 | $name = $this->getName(); |
395 | 395 | foreach (array_keys($this->_elements) as $key) { |
396 | - $element =& $this->_elements[$key]; |
|
396 | + $element = & $this->_elements[$key]; |
|
397 | 397 | |
398 | 398 | if ($this->_appendName) { |
399 | 399 | $elementName = $element->getName(); |
400 | 400 | if (isset($elementName)) { |
401 | - $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']'); |
|
401 | + $element->setName($name.'['.(strlen($elementName) ? $elementName : $key).']'); |
|
402 | 402 | } else { |
403 | 403 | $element->setName($name); |
404 | 404 | } |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | if (is_null($elementName)) { |
430 | 430 | $this->_elements[$key]->setName($this->getName()); |
431 | 431 | } elseif ('' === $elementName) { |
432 | - $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); |
|
432 | + $this->_elements[$key]->setName($this->getName().'['.$key.']'); |
|
433 | 433 | } else { |
434 | - $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); |
|
434 | + $this->_elements[$key]->setName($this->getName().'['.$elementName.']'); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | $v = $this->_elements[$key]->exportValue($submitValues, $assoc); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @return void |
27 | 27 | * @throws |
28 | 28 | */ |
29 | - function HTML_QuickForm_email($elementName=null, $elementLabel=null, $attributes=null) |
|
29 | + function HTML_QuickForm_email($elementName = null, $elementLabel = null, $attributes = null) |
|
30 | 30 | { |
31 | 31 | parent::__construct($elementName, $elementLabel, $attributes); |
32 | 32 | $this->setType('email'); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | } elseif ('..' == $pathAry[$i] && $i > 1 && '..' != $pathAry[$i - 1]) { |
72 | - if ($i < count($pathAry) -1) { |
|
72 | + if ($i < count($pathAry) - 1) { |
|
73 | 73 | array_splice($pathAry, $i - 1, 2); |
74 | 74 | $i--; |
75 | 75 | } else { |
@@ -98,28 +98,28 @@ discard block |
||
98 | 98 | function _resolveRelativeURL($url) |
99 | 99 | { |
100 | 100 | $https = !empty($_SERVER['HTTPS']) && ('off' != strtolower($_SERVER['HTTPS'])); |
101 | - $scheme = ($https? 'https:': 'http:'); |
|
101 | + $scheme = ($https ? 'https:' : 'http:'); |
|
102 | 102 | if ('//' == substr($url, 0, 2)) { |
103 | - return $scheme . $url; |
|
103 | + return $scheme.$url; |
|
104 | 104 | |
105 | 105 | } else { |
106 | - $host = $scheme . '//' . $_SERVER['SERVER_NAME'] . |
|
106 | + $host = $scheme.'//'.$_SERVER['SERVER_NAME']. |
|
107 | 107 | (($https && 443 == $_SERVER['SERVER_PORT'] || |
108 | - !$https && 80 == $_SERVER['SERVER_PORT'])? '': ':' . $_SERVER['SERVER_PORT']); |
|
108 | + !$https && 80 == $_SERVER['SERVER_PORT']) ? '' : ':'.$_SERVER['SERVER_PORT']); |
|
109 | 109 | if ('' == $url) { |
110 | - return $host . $_SERVER['REQUEST_URI']; |
|
110 | + return $host.$_SERVER['REQUEST_URI']; |
|
111 | 111 | |
112 | 112 | } elseif ('/' == $url[0]) { |
113 | - return $host . $url; |
|
113 | + return $host.$url; |
|
114 | 114 | |
115 | 115 | } else { |
116 | 116 | list($basePath, $baseQuery) = $this->_splitUri($_SERVER['REQUEST_URI']); |
117 | 117 | list($actPath, $actQuery) = $this->_splitUri($url); |
118 | 118 | if ('' == $actPath) { |
119 | - return $host . $basePath . $actQuery; |
|
119 | + return $host.$basePath.$actQuery; |
|
120 | 120 | } else { |
121 | - $path = substr($basePath, 0, strrpos($basePath, '/') + 1) . $actPath; |
|
122 | - return $host . $this->_normalizePath($path) . $actQuery; |
|
121 | + $path = substr($basePath, 0, strrpos($basePath, '/') + 1).$actPath; |
|
122 | + return $host.$this->_normalizePath($path).$actQuery; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | if (!$page->controller->isValid($pageName)) { |
137 | 137 | $pageName = $page->controller->findInvalid(); |
138 | 138 | } |
139 | - $current =& $page->controller->getPage($pageName); |
|
139 | + $current = & $page->controller->getPage($pageName); |
|
140 | 140 | |
141 | 141 | } else { |
142 | - $current =& $page; |
|
142 | + $current = & $page; |
|
143 | 143 | } |
144 | 144 | // generate the URL for the page 'display' event and redirect to it |
145 | 145 | $action = $current->getAttribute('action'); |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | if (!preg_match('!^https?://!i', $action)) { |
148 | 148 | $action = $this->_resolveRelativeURL($action); |
149 | 149 | } |
150 | - $url = $action . (false === strpos($action, '?')? '?': '&') . |
|
151 | - $current->getButtonName('display') . '=true' . |
|
152 | - ((!defined('SID') || '' == SID || ini_get('session.use_only_cookies'))? '': '&' . SID); |
|
153 | - header('Location: ' . $url); |
|
150 | + $url = $action.(false === strpos($action, '?') ? '?' : '&'). |
|
151 | + $current->getButtonName('display').'=true'. |
|
152 | + ((!defined('SID') || '' == SID || ini_get('session.use_only_cookies')) ? '' : '&'.SID); |
|
153 | + header('Location: '.$url); |
|
154 | 154 | exit; |
155 | 155 | } |
156 | 156 | } |