1
0
mirror of synced 2025-01-31 20:41:44 +03:00
doctrine2/classes/Validator/Ip.class.php

23 lines
576 B
PHP
Raw Normal View History

2006-04-13 20:37:28 +00:00
<?php
2006-04-15 20:03:12 +00:00
class Doctrine_Validator_Ip {
2006-04-13 20:37:28 +00:00
/**
* @param Doctrine_Record $record
* @param string $key
* @param mixed $value
* @param string $args
2006-04-13 20:37:28 +00:00
* @return boolean
*/
public function validate(Doctrine_Record $record, $key, $value, $args) {
2006-04-13 20:37:28 +00:00
$e = explode(".",$request);
if(count($e) != 4) return false;
foreach($e as $k=>$v):
if(! is_numeric($v)) return false;
$v = (int) $v;
if($v < 0 || $v > 255) return false;
endforeach;
return true;
}
}
?>