Permalink
Browse files

Remote getInstance() from validation protected methods.

  • Loading branch information...
predominant committed Jan 5, 2010
1 parent 1302fba commit 485570de246eb869daea90b05ba9777dc7c085f4
Showing with 10 additions and 12 deletions.
  1. +10 −12 cake/libs/validation.php
View
@@ -556,10 +556,10 @@ function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
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 @@ function _ipv4($check) {
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 @@ function _ipv6($check) {
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();
}
/**

0 comments on commit 485570d

Please sign in to comment.