public function validate_vote($vote, $old_vote, $options) { $vote = parent::validate_vote($vote, $old_vote, $options); if ($vote > 0) { return 1; } else { return null; } }
public function validate_vote($vote, $old_vote, $options) { if ($vote === '') { return null; } $answers_count = preg_match_all("/\r\n|\n|\r/", $options['answers']); $vote = parent::validate_vote($vote, $old_vote, $options); $vote = intval($vote); // Force integer value. if (!is_integer($vote) || $vote < 0 || $vote > $answers_count) { return null; } else { return $vote; } }
public function validate_vote($vote, $old_vote, $options) { $vote = parent::validate_vote($vote, $old_vote, $options); // TODO: Prevent fractional votes, if necessary. if ($vote <= 0) { return in_array($options['icon'], array('numeric', 'slider')) ? 0 : 1; } else { if ($vote > $options['max']) { return intval($options['max']); } else { return $vote; } } }