1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dokuwiki_ynh.git synced 2024-09-03 18:26:20 +02:00
dokuwiki_ynh/sources/inc/compatibility.php
2014-02-11 14:56:25 +01:00

36 lines
No EOL
919 B
PHP

<?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;
}
}