<?php
/**
* dolphin. Collection of useful PHP skeletons.
-* Copyright (C) 2009 Johannes 'Banana' Keßler
+* Copyright (C) 2009-2019 Johannes 'Banana' Keßler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
switch ($mode) {
case 'mail':
- return self::check_email_address($input);
+ if(filter_var($input,FILTER_VALIDATE_EMAIL) === $input) {
+ return true;
+ }
+ else {
+ return false;
+ }
break;
case 'url':
- return filter_var($input,FILTER_VALIDATE_URL);
+ if(filter_var($input,FILTER_VALIDATE_URL) === $input) {
+ return true;
+ }
+ else {
+ return false;
+ }
break;
case 'nospace':
<?php
/**
* dolphin. Collection of useful PHP skeletons.
- * Copyright (C) 2009 Johannes 'Banana' Keßler
+ * Copyright (C) 2009-2019 Johannes 'Banana' Keßler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
switch ($mode) {
case 'mail':
- return self::check_email_address($input);
+ if(filter_var($input,FILTER_VALIDATE_EMAIL) === $input) {
+ return true;
+ }
+ else {
+ return false;
+ }
break;
case 'url':
- return filter_var($input,FILTER_VALIDATE_URL);
+ if(filter_var($input,FILTER_VALIDATE_URL) === $input) {
+ return true;
+ }
+ else {
+ return false;
+ }
break;
case 'nospace':
$pattern = '/[\p{L}\p{N}\p{Po}\p{Z}\s]/u';
break;
+ # strange. the \p{M} is needed.. don't know why..
+ case 'filename':
+ $pattern = '/[\p{L}\p{N}\p{M}\-_\.\p{Zs}]/u';
+ break;
+
case 'text':
default:
$pattern = '/[\p{L}\p{N}\p{P}\p{S}\p{Z}\p{M}\s]/u';