TYPO3 CMS  TYPO3_6-2
FloatValidator.php
Go to the documentation of this file.
1 <?php
3 
23 
29  const LOCALISATION_OBJECT_NAME = 'tx_form_system_validate_float';
30 
37  public function isValid() {
38  if ($this->requestHandler->has($this->fieldName)) {
39  $value = $this->requestHandler->getByMethod($this->fieldName);
40  $locale = localeconv();
41  $valueFiltered = str_replace(
42  array(
43  $locale['thousands_sep'],
44  $locale['mon_thousands_sep'],
45  $locale['decimal_point'],
46  $locale['mon_decimal_point']
47  ),
48  array(
49  '',
50  '',
51  '.',
52  '.'
53  ),
54  $value
55  );
56  if ($valueFiltered != strval(floatval($valueFiltered))) {
57  return FALSE;
58  }
59  }
60  return TRUE;
61  }
62 
63 }