Merge remote branch 'origin/2.0' into 2.0-class-loading

Conflicts:
	cake/libs/view/scaffolds/edit.ctp
	cake/libs/view/scaffolds/form.ctp
	cake/tests/test_app/plugins/test_plugin/views/tests/scaffold.edit.ctp
	cake/tests/test_app/plugins/test_plugin/views/tests/scaffold.form.ctp
	cake/tests/test_app/views/posts/scaffold.edit.ctp
	cake/tests/test_app/views/posts/scaffold.form.ctp
	lib/Cake/Error/ErrorHandler.php
	lib/Cake/Model/Behavior/TranslateBehavior.php
	lib/Cake/Model/Datasource/CakeSession.php
	lib/Cake/Routing/Router.php
	lib/Cake/TestSuite/TestManager.php
	lib/Cake/View/scaffolds/edit.ctp
	lib/Cake/tests/cases/console/shells/bake.test.php
	lib/Cake/tests/cases/libs/cake_log.test.php
	lib/Cake/tests/cases/libs/cake_request.test.php
	lib/Cake/tests/cases/libs/view/helpers/number.test.php
	lib/Cake/tests/test_app/plugins/test_plugin/views/tests/scaffold.edit.ctp
	lib/Cake/tests/test_app/views/posts/scaffold.edit.ctp
This commit is contained in:
José Lorenzo Rodríguez 2010-12-15 01:13:05 -04:30
commit 07e43bb0f8
122 changed files with 4822 additions and 2612 deletions

View file

@ -414,7 +414,8 @@ class Validation {
if (is_array($check)) {
return self::extension(array_shift($check), $extensions);
}
$extension = strtolower(array_pop(explode('.', $check)));
$pathSegments = explode('.', $check);
$extension = strtolower(array_pop($pathSegments));
foreach ($extensions as $value) {
if ($extension == strtolower($value)) {
return true;
@ -430,7 +431,7 @@ class Validation {
* @param string $ipVersion The IP Protocol version to validate against
* @return boolean Success
*/
public function ip($check, $type = 'both') {
public static function ip($check, $type = 'both') {
$type = strtolower($type);
$flags = array();
if ($type === 'ipv4' || $type === 'both') {
@ -667,12 +668,12 @@ class Validation {
*/
public static function url($check, $strict = false) {
self::__populateIp();
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~') . '\/0-9a-z]|(%[0-9a-f]{2}))';
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
$regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
'(?:' . self::$__pattern['IPv4'] . '|' . self::$__pattern['hostname'] . ')(?::[1-9][0-9]{0,3})?' .
'(?:' . self::$__pattern['IPv4'] . '|\[' . self::$__pattern['IPv6'] . '\]|' . self::$__pattern['hostname'] . ')(?::[1-9][0-9]{0,4})?' .
'(?:\/?|\/' . $validChars . '*)?' .
'(?:\?' . $validChars . '*)?' .
'(?:#' . $validChars . '*)?$/i';
'(?:#' . $validChars . '*)?$/iu';
return self::_check($check, $regex);
}
@ -700,6 +701,18 @@ class Validation {
return call_user_func_array(array($object, $method), array($check, $args));
}
/**
* Checks that a value is a valid uuid - http://tools.ietf.org/html/rfc4122
*
* @param string $check Value to check
* @return boolean Success
* @access public
*/
public static function uuid($check) {
$regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
return self::_check($check, $regex);
}
/**
* Attempts to pass unhandled Validation locales to a class starting with $classPrefix
* and ending with Validation. For example $classPrefix = 'nl', the class would be