This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidInteger($integer) | |
| { | |
| if (filter_var($integer, FILTER_VALIDATE_INT) && $integer > 0) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidFloat($float) | |
| { | |
| if (filter_var($float, FILTER_VALIDATE_FLOAT)) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidString($string) | |
| { | |
| if (empty($string)) { | |
| return false; | |
| } | |
| if (preg_match("/[\||\'|\<|\>|\[|\]|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\{\+]/", $string)) { | |
| return false; | |
| } else { | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidUrl($url) | |
| { | |
| if (empty($url)) { | |
| return false; | |
| } | |
| // only ASCII URL | |
| if (filter_var($url, FILTER_VALIDATE_URL)) { | |
| return true; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidEmail($email) | |
| { | |
| if (empty($email)) { | |
| return false; | |
| } | |
| if (filter_var($email, FILTER_VALIDATE_EMAIL)) { | |
| if (@count(explode("@", $email)) != 2) { | |
| return false; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidDate($date, $format = "d-m-Y H:i:s") | |
| { | |
| //since php 5.3 | |
| $parsedate = date_parse_from_format($format, $date); | |
| $datetmp = mktime($parsedate['hour'], $parsedate['minute'], $parsedate['second'], $parsedate['month'], $parsedate['day'], $parsedate['year']); | |
| return (strtotime($date) == $datetmp) ? true : false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValidTax($vatid) | |
| { | |
| $vatid = str_replace(array( | |
| ' ', | |
| '.', | |
| '-', | |
| ',', | |
| ', '), '', trim($vatid)); | |
| $prefix = substr($vatid, 0, 2); | |
| $number = substr($vatid, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // look into http://php.net/manual/en/language.types.float.php | |
| function compareFloatValues($a, $b, $operator = '==') | |
| { | |
| // This value is known as the machine epsilon, or unit roundoff, and is the smallest acceptable difference in calculations. | |
| $epsilon = 0.00001; | |
| // make equal to 5 digits of precision | |
| $a = (float)$a; | |
| $b = (float)$b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * isNetworkAvailable() TRUE wenn eine Datenverbindung vorhanden ist | |
| * | |
| * @param mixed activity | |
| * @return | |
| */ | |
| public static boolean isNetworkAvailable(Activity activity) { | |
| ConnectivityManager connectivity = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); | |
| if (connectivity == null) { | |
| return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * doAlert() für Warn- und Rückfragedialoge | |
| * | |
| * @param mixed context | |
| * @param mixed title | |
| * @param mixed message | |
| * @param boolean status | |
| */ | |
| @SuppressWarnings("deprecation") | |
| public void doAlert(Context context, String title, String message, Boolean status) { |
OlderNewer