Beispiel #1
0
 public function validate(CM_Frontend_Environment $environment, $userInput)
 {
     $userInput = parent::validate($environment, $userInput);
     if (false === filter_var($userInput, FILTER_VALIDATE_URL)) {
         throw new CM_Exception_FormFieldValidation(new CM_I18n_Phrase('Invalid url'));
     }
     return $userInput;
 }
Beispiel #2
0
 public function validate(CM_Frontend_Environment $environment, $userInput)
 {
     $userInput = parent::validate($environment, $userInput);
     if (!is_numeric($userInput)) {
         throw new CM_Exception_FormFieldValidation(new CM_I18n_Phrase('Not numeric'));
     }
     return (double) $userInput;
 }
Beispiel #3
0
 public function validate(CM_Frontend_Environment $environment, $userInput)
 {
     $userInput = parent::validate($environment, $userInput);
     $emailVerification = $this->_getEmailVerification();
     if (!$emailVerification->isValid($userInput)) {
         throw new CM_Exception_FormFieldValidation('Invalid email address');
     }
     return $userInput;
 }
Beispiel #4
0
 function testArrayInputInvalidCharsRemoval()
 {
     $invalidInputs = array(chr(240), chr(192), chr(200) . chr(210), 'something' . chr(244));
     $field = new CM_FormField_Text(['name' => 'foo']);
     foreach ($invalidInputs as $input) {
         $filtered = $field->filterInput($input);
         $this->assertNotSame($filtered, $input);
     }
 }
Beispiel #5
0
 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     parent::prepare($renderParams, $environment, $viewResponse);
     $viewResponse->set('timeZone', $this->_getTimeZone($environment));
 }
Beispiel #6
0
 protected function _initialize()
 {
     $this->_params->set('lengthMin', 4);
     $this->_params->set('lengthMax', 100);
     parent::_initialize();
 }
Beispiel #7
0
 protected function _initialize()
 {
     $this->_setMinMaxOptions();
     parent::_initialize();
 }