diff options
author | Guy Brand <gb@unistra.fr> | 2013-11-18 20:48:03 +0100 |
---|---|---|
committer | Guy Brand <gb@unistra.fr> | 2013-11-18 20:48:03 +0100 |
commit | 9d6d3a45521ca9b4eecc9f264a6adfe12d2ed764 (patch) | |
tree | d87417a2562e14e40f21012a9e1ede2d159239c5 /inc/compatibility.php | |
parent | 0f71b9e8c36a27b7e476b43879f1cf9636a9958e (diff) | |
parent | 14b3007921f7b66fc9e3621b861a3c83e7e9093c (diff) | |
download | rpg-9d6d3a45521ca9b4eecc9f264a6adfe12d2ed764.tar.gz rpg-9d6d3a45521ca9b4eecc9f264a6adfe12d2ed764.tar.bz2 |
Merge branch 'master' into stable
Diffstat (limited to 'inc/compatibility.php')
-rw-r--r-- | inc/compatibility.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/inc/compatibility.php b/inc/compatibility.php new file mode 100644 index 000000000..ae780e5ac --- /dev/null +++ b/inc/compatibility.php @@ -0,0 +1,36 @@ +<?php +/** + * compatibility functions + * + * This file contains a few functions that might be missing from the PHP build + */ + +if(!function_exists('ctype_space')) { + /** + * Check for whitespace character(s) + * + * @see ctype_space + * @param string $text + * @return bool + */ + function ctype_space($text) { + if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars + if(trim($text) === '') return true; + return false; + } +} + +if(!function_exists('ctype_digit')) { + /** + * Check for numeric character(s) + * + * @see ctype_digit + * @param string $text + * @return bool + */ + function ctype_digit($text) { + if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars + if(preg_match('/^\d+$/', $text)) return true; + return false; + } +}
\ No newline at end of file |