From 485570de246eb869daea90b05ba9777dc7c085f4 Mon Sep 17 00:00:00 2001 From: predominant Date: Wed, 6 Jan 2010 09:34:07 +1100 Subject: [PATCH] Remote getInstance() from validation protected methods. --- cake/libs/validation.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index abb897974..1ffd439d3 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -556,10 +556,10 @@ class Validation extends Object { function ip($check, $type = 'both') { $_this =& Validation::getInstance(); $success = false; - if ($type === 'IPv4' || $type === 'both') { + if ($type === 'ipv4' || $type === 'both') { $success |= $_this->_ipv4($check); } - if ($type === 'IPv6' || $type === 'both') { + if ($type === 'ipv6' || $type === 'both') { $success |= $_this->_ipv6($check); } return $success; @@ -576,11 +576,10 @@ class Validation extends Object { if (function_exists('filter_var')) { return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false; } - $_this =& Validation::getInstance(); - $_this->__populateIp(); - $_this->check = $check; - $_this->regex = '/^' . $_this->__pattern['IPv4'] . '$/'; - return $_this->_check(); + $this->__populateIp(); + $this->check = $check; + $this->regex = '/^' . $this->__pattern['IPv4'] . '$/'; + return $this->_check(); } /** @@ -594,11 +593,10 @@ class Validation extends Object { if (function_exists('filter_var')) { return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false; } - $_this =& Validation::getInstance(); - $_this->__populateIp(); - $_this->check = $check; - $_this->regex = '/^' . $_this->__pattern['IPv6'] . '$/'; - return $_this->_check(); + $this->__populateIp(); + $this->check = $check; + $this->regex = '/^' . $this->__pattern['IPv6'] . '$/'; + return $this->_check(); } /**