function grab() { parent::grab(); // strip out everything but numbers and decimal symbols $this->value = preg_replace('/[^\\d\\' . $this->decimal_symbol . ']/', '', $this->value); // complain if multiple decimal symbols if (!empty($this->value) && !is_numeric($this->value)) { $this->set_error('Please check the format of the amount you entered.'); } else { if (strpos($this->value, $this->decimal_symbol) !== false) { $this->value = sprintf('%.2F', $this->value); } } }
function display() { if ($this->use_picker && !defined("DATE_PICKER_HEAD_ITEMS_LOADED") && !defined('_PLASMATURE_INCLUDED_DATEPICKER')) { /** * We specify the english datepicker .js file ... the dynamic mechanism to pick the language * file that is built into the datepicker does not appear to work reliably when the date_picker is * added inline instead of into the head items */ echo '<script type="text/javascript" src="' . DATE_PICKER_HTTP_PATH . 'js/lang/en-us.js"></script>' . "\n"; echo '<script type="text/javascript" src="' . DATE_PICKER_HTTP_PATH . 'js/datepicker.js"></script>' . "\n"; echo '<link href="' . DATE_PICKER_HTTP_PATH . 'css/datepicker.css" rel="stylesheet" type="text/css" />' . "\n"; define('_PLASMATURE_INCLUDED_DATEPICKER', true); } parent::display(); }