diff options
author | Anika Henke <anika@selfthinker.org> | 2013-11-02 13:10:14 +0000 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2013-11-02 13:10:14 +0000 |
commit | c5393ecb1aa570830d21e9dc95b4c21cd9aa9c01 (patch) | |
tree | 96e8dc34468a325596a5f94c85e38374fbc4b9ba /inc/compatibility.php | |
parent | 71c1143e8785954ea00a62aeb755ca7d8fa47e56 (diff) | |
parent | 38d74b12176722ce52dc1905c13816a78a2551ee (diff) | |
download | rpg-c5393ecb1aa570830d21e9dc95b4c21cd9aa9c01.tar.gz rpg-c5393ecb1aa570830d21e9dc95b4c21cd9aa9c01.tar.bz2 |
Merge remote-tracking branch 'origin/master' into video-audio
Conflicts:
inc/parser/xhtml.php
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 |