Remote getInstance() from validation protected methods.

This commit is contained in:
predominant 2010-01-06 09:34:07 +11:00
parent 1302fba632
commit 485570de24

View file

@ -556,10 +556,10 @@ class Validation extends Object {
function ip($check, $type = 'both') { function ip($check, $type = 'both') {
$_this =& Validation::getInstance(); $_this =& Validation::getInstance();
$success = false; $success = false;
if ($type === 'IPv4' || $type === 'both') { if ($type === 'ipv4' || $type === 'both') {
$success |= $_this->_ipv4($check); $success |= $_this->_ipv4($check);
} }
if ($type === 'IPv6' || $type === 'both') { if ($type === 'ipv6' || $type === 'both') {
$success |= $_this->_ipv6($check); $success |= $_this->_ipv6($check);
} }
return $success; return $success;
@ -576,11 +576,10 @@ class Validation extends Object {
if (function_exists('filter_var')) { if (function_exists('filter_var')) {
return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false; return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
} }
$_this =& Validation::getInstance(); $this->__populateIp();
$_this->__populateIp(); $this->check = $check;
$_this->check = $check; $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
$_this->regex = '/^' . $_this->__pattern['IPv4'] . '$/'; return $this->_check();
return $_this->_check();
} }
/** /**
@ -594,11 +593,10 @@ class Validation extends Object {
if (function_exists('filter_var')) { if (function_exists('filter_var')) {
return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false; return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
} }
$_this =& Validation::getInstance(); $this->__populateIp();
$_this->__populateIp(); $this->check = $check;
$_this->check = $check; $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
$_this->regex = '/^' . $_this->__pattern['IPv6'] . '$/'; return $this->_check();
return $_this->_check();
} }
/** /**